-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm/unix/make_begin.am
+IDL_FILES = echo.idl
BUILT_SOURCES = echoSK.cc schema.xml xmlrpcprog.py
-bin_PROGRAMS=echoSrv
-echoSrv_SOURCES = echoSrv.cxx
-nodist_echoSrv_SOURCES = echoSK.cc
-echoSrv_CXXFLAGS = $(OMNIORB_INCLUDES) $(OMNIORB_CXXFLAGS)
-echoSrv_LDFLAGS = $(OMNIORB_LIBS)
+bin_PROGRAMS=echoSrvDemo
+echoSrvDemo_SOURCES = echoSrv.cxx
+nodist_echoSrvDemo_SOURCES = echoSK.cc
+echoSrvDemo_CXXFLAGS = -I. $(OMNIORB_INCLUDES) $(OMNIORB_CXXFLAGS)
+echoSrvDemo_LDFLAGS = $(OMNIORB_LIBS)
AM_CXXFLAGS = $(THREAD_DEF)
EXTRA_DIST = echo.idl schema_orig.xml xmlrpcprog_orig.py
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __ECHO_IDL__
#define __ECHO_IDL__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include <time.h>
#include <echo.hh>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
#!/usr/bin/env python
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
import xmlrpclib,sys
data="""
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm/unix/make_begin.am
ACLOCAL_AMFLAGS = -I adm/unix/config_files
check-local:
cat /tmp/${USER}/UnitTestsResult
+dist-hook:
+ rm -rf `find $(distdir) -name CVS`
+
+dev_docs:
+ (cd doc && $(MAKE) $(AM_MAKEFLAGS) dev_docs)
+
+EXTRA_DIST = Misc \
+ build_cmake \
+ build_cmake.bat \
+ build_configure \
+ clean_configure \
+ configure.in.base \
+ rfind
+
--- /dev/null
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+# Doxyfile 1.5.6
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME =
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY =
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek,
+# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish,
+# Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish,
+# and Ukrainian.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member
+# documentation.
+
+DETAILS_AT_TOP = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page. This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = $(DOXSRCDIR)
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.cxx *.hxx
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output. If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code. Otherwise they will link to the documentstion.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = NO
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to FRAME, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
+# probably better off using the HTML help feature. Other possible values
+# for this tag are: HIERARCHIES, which will generate the Groups, Directories,
+# and Class Hiererachy pages using a tree view instead of an ordered list;
+# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which
+# disables this behavior completely. For backwards compatibility with previous
+# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE
+# respectively.
+
+GENERATE_TREEVIEW = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = YES
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader. This is useful
+# if you want to understand what is going on. On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is enabled by default, which results in a transparent
+# background. Warning: Depending on the platform used, enabling this option
+# may lead to badly anti-aliased labels on the edges of a graph (i.e. they
+# become hard to read).
+
+DOT_TRANSPARENT = YES
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE = NO
--- /dev/null
+#!/usr/bin/env python
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+"""Doxygen XML to SWIG docstring converter.
+
+Usage:
+
+ doxy2swig.py [options] input.xml output.i
+
+Converts Doxygen generated XML files into a file containing docstrings
+that can be used by SWIG-1.3.x. Note that you need to get SWIG
+version > 1.3.23 or use Robin Dunn's docstring patch to be able to use
+the resulting output.
+
+input.xml is your doxygen generated XML file and output.i is where the
+output will be written (the file will be clobbered).
+
+"""
+######################################################################
+#
+# This code is implemented using Mark Pilgrim's code as a guideline:
+# http://www.faqs.org/docs/diveintopython/kgp_divein.html
+#
+# Author: Prabhu Ramachandran
+# License: BSD style
+#
+# Thanks:
+# Johan Hake: the include_function_definition feature
+# Bill Spotz: bug reports and testing.
+#
+######################################################################
+
+from xml.dom import minidom
+import re
+import textwrap
+import sys
+import types
+import os.path
+import optparse
+
+
+def my_open_read(source):
+ if hasattr(source, "read"):
+ return source
+ else:
+ return open(source)
+
+def my_open_write(dest):
+ if hasattr(dest, "write"):
+ return dest
+ else:
+ return open(dest, 'w')
+
+
+class Doxy2SWIG:
+ """Converts Doxygen generated XML files into a file containing
+ docstrings that can be used by SWIG-1.3.x that have support for
+ feature("docstring"). Once the data is parsed it is stored in
+ self.pieces.
+
+ """
+
+ def __init__(self, src, include_function_definition=True, quiet=False):
+ """Initialize the instance given a source object. `src` can
+ be a file or filename. If you do not want to include function
+ definitions from doxygen then set
+ `include_function_definition` to `False`. This is handy since
+ this allows you to use the swig generated function definition
+ using %feature("autodoc", [0,1]).
+
+ """
+ f = my_open_read(src)
+ self.my_dir = os.path.dirname(f.name)
+ self.xmldoc = minidom.parse(f).documentElement
+ f.close()
+
+ self.pieces = []
+ self.pieces.append('\n// File: %s\n'%\
+ os.path.basename(f.name))
+
+ self.space_re = re.compile(r'\s+')
+ self.lead_spc = re.compile(r'^(%feature\S+\s+\S+\s*?)"\s+(\S)')
+ self.multi = 0
+ self.ignores = ['inheritancegraph', 'param', 'listofallmembers',
+ 'innerclass', 'name', 'declname', 'incdepgraph',
+ 'invincdepgraph', 'programlisting', 'type',
+ 'references', 'referencedby', 'location',
+ 'collaborationgraph', 'reimplements',
+ 'reimplementedby', 'derivedcompoundref',
+ 'basecompoundref']
+ #self.generics = []
+ self.include_function_definition = include_function_definition
+ if not include_function_definition:
+ self.ignores.append('argsstring')
+
+ self.quiet = quiet
+
+
+ def generate(self):
+ """Parses the file set in the initialization. The resulting
+ data is stored in `self.pieces`.
+
+ """
+ self.parse(self.xmldoc)
+
+ def parse(self, node):
+ """Parse a given node. This function in turn calls the
+ `parse_<nodeType>` functions which handle the respective
+ nodes.
+
+ """
+ pm = getattr(self, "parse_%s"%node.__class__.__name__)
+ pm(node)
+
+ def parse_Document(self, node):
+ self.parse(node.documentElement)
+
+ def parse_Text(self, node):
+ txt = node.data
+ txt = txt.replace('\\', r'\\\\')
+ txt = txt.replace('"', r'\"')
+ # ignore pure whitespace
+ m = self.space_re.match(txt)
+ if m and len(m.group()) == len(txt):
+ pass
+ else:
+ self.add_text(textwrap.fill(txt, break_long_words=False))
+
+ def parse_Element(self, node):
+ """Parse an `ELEMENT_NODE`. This calls specific
+ `do_<tagName>` handers for different elements. If no handler
+ is available the `generic_parse` method is called. All
+ tagNames specified in `self.ignores` are simply ignored.
+
+ """
+ name = node.tagName
+ ignores = self.ignores
+ if name in ignores:
+ return
+ attr = "do_%s" % name
+ if hasattr(self, attr):
+ handlerMethod = getattr(self, attr)
+ handlerMethod(node)
+ else:
+ self.generic_parse(node)
+ #if name not in self.generics: self.generics.append(name)
+
+ def parse_Comment(self, node):
+ """Parse a `COMMENT_NODE`. This does nothing for now."""
+ return
+
+ def add_text(self, value):
+ """Adds text corresponding to `value` into `self.pieces`."""
+ if type(value) in (types.ListType, types.TupleType):
+ self.pieces.extend(value)
+ else:
+ self.pieces.append(value)
+
+ def get_specific_nodes(self, node, names):
+ """Given a node and a sequence of strings in `names`, return a
+ dictionary containing the names as keys and child
+ `ELEMENT_NODEs`, that have a `tagName` equal to the name.
+
+ """
+ nodes = [(x.tagName, x) for x in node.childNodes \
+ if x.nodeType == x.ELEMENT_NODE and \
+ x.tagName in names]
+ return dict(nodes)
+
+ def generic_parse(self, node, pad=0):
+ """A Generic parser for arbitrary tags in a node.
+
+ Parameters:
+
+ - node: A node in the DOM.
+ - pad: `int` (default: 0)
+
+ If 0 the node data is not padded with newlines. If 1 it
+ appends a newline after parsing the childNodes. If 2 it
+ pads before and after the nodes are processed. Defaults to
+ 0.
+
+ """
+ npiece = 0
+ if pad:
+ npiece = len(self.pieces)
+ if pad == 2:
+ self.add_text('\n')
+ for n in node.childNodes:
+ self.parse(n)
+ if pad:
+ if len(self.pieces) > npiece:
+ self.add_text('\n')
+
+ def space_parse(self, node):
+ self.add_text(' ')
+ self.generic_parse(node)
+
+ do_ref = space_parse
+ do_emphasis = space_parse
+ do_bold = space_parse
+ do_computeroutput = space_parse
+ do_formula = space_parse
+
+ def do_compoundname(self, node):
+ self.add_text('\n\n')
+ data = node.firstChild.data
+ self.add_text('%%feature("docstring") %s "\n'%data)
+
+ def do_compounddef(self, node):
+ kind = node.attributes['kind'].value
+ if kind in ('class', 'struct'):
+ prot = node.attributes['prot'].value
+ if prot <> 'public':
+ return
+ names = ('compoundname', 'briefdescription',
+ 'detaileddescription', 'includes')
+ first = self.get_specific_nodes(node, names)
+ for n in names:
+ if first.has_key(n):
+ self.parse(first[n])
+ self.add_text(['";','\n'])
+ for n in node.childNodes:
+ if n not in first.values():
+ self.parse(n)
+ elif kind in ('file', 'namespace'):
+ nodes = node.getElementsByTagName('sectiondef')
+ for n in nodes:
+ self.parse(n)
+
+ def do_includes(self, node):
+ self.add_text('C++ includes: ')
+ self.generic_parse(node, pad=1)
+
+ def do_parameterlist(self, node):
+ text='unknown'
+ for key, val in node.attributes.items():
+ if key == 'kind':
+ if val == 'param': text = 'Parameters'
+ elif val == 'exception': text = 'Exceptions'
+ else: text = val
+ break
+ self.add_text(['\n', '\n', text, ':', '\n'])
+ self.generic_parse(node, pad=1)
+
+ def do_para(self, node):
+ self.add_text('\n')
+ self.generic_parse(node, pad=1)
+
+ def do_parametername(self, node):
+ self.add_text('\n')
+ try:
+ data=node.firstChild.data
+ except AttributeError: # perhaps a <ref> tag in it
+ data=node.firstChild.firstChild.data
+ if data.find('Exception') != -1:
+ self.add_text(data)
+ else:
+ self.add_text("%s: "%data)
+
+ def do_parameterdefinition(self, node):
+ self.generic_parse(node, pad=1)
+
+ def do_detaileddescription(self, node):
+ self.generic_parse(node, pad=1)
+
+ def do_briefdescription(self, node):
+ self.generic_parse(node, pad=1)
+
+ def do_memberdef(self, node):
+ prot = node.attributes['prot'].value
+ id = node.attributes['id'].value
+ kind = node.attributes['kind'].value
+ tmp = node.parentNode.parentNode.parentNode
+ compdef = tmp.getElementsByTagName('compounddef')[0]
+ cdef_kind = compdef.attributes['kind'].value
+
+ if prot == 'public':
+ first = self.get_specific_nodes(node, ('definition', 'name'))
+ name = first['name'].firstChild.data
+ if name[:8] == 'operator': # Don't handle operators yet.
+ return
+
+ if not first.has_key('definition') or \
+ kind in ['variable', 'typedef']:
+ return
+
+ if self.include_function_definition:
+ defn = first['definition'].firstChild.data
+ else:
+ defn = ""
+ self.add_text('\n')
+ self.add_text('%feature("docstring") ')
+
+ anc = node.parentNode.parentNode
+ if cdef_kind in ('file', 'namespace'):
+ ns_node = anc.getElementsByTagName('innernamespace')
+ if not ns_node and cdef_kind == 'namespace':
+ ns_node = anc.getElementsByTagName('compoundname')
+ if ns_node:
+ ns = ns_node[0].firstChild.data
+ self.add_text(' %s::%s "\n%s'%(ns, name, defn))
+ else:
+ self.add_text(' %s "\n%s'%(name, defn))
+ elif cdef_kind in ('class', 'struct'):
+ # Get the full function name.
+ anc_node = anc.getElementsByTagName('compoundname')
+ cname = anc_node[0].firstChild.data
+ self.add_text(' %s::%s "\n%s'%(cname, name, defn))
+
+ for n in node.childNodes:
+ if n not in first.values():
+ self.parse(n)
+ self.add_text(['";', '\n'])
+
+ def do_definition(self, node):
+ data = node.firstChild.data
+ self.add_text('%s "\n%s'%(data, data))
+
+ def do_sectiondef(self, node):
+ kind = node.attributes['kind'].value
+ if kind in ('public-func', 'func', 'user-defined', ''):
+ self.generic_parse(node)
+
+ def do_header(self, node):
+ """For a user defined section def a header field is present
+ which should not be printed as such, so we comment it in the
+ output."""
+ data = node.firstChild.data
+ self.add_text('\n/*\n %s \n*/\n'%data)
+ # If our immediate sibling is a 'description' node then we
+ # should comment that out also and remove it from the parent
+ # node's children.
+ parent = node.parentNode
+ idx = parent.childNodes.index(node)
+ if len(parent.childNodes) >= idx + 2:
+ nd = parent.childNodes[idx+2]
+ if nd.nodeName == 'description':
+ nd = parent.removeChild(nd)
+ self.add_text('\n/*')
+ self.generic_parse(nd)
+ self.add_text('\n*/\n')
+
+ def do_simplesect(self, node):
+ kind = node.attributes['kind'].value
+ if kind in ('date', 'rcs', 'version'):
+ pass
+ elif kind == 'warning':
+ self.add_text(['\n', 'WARNING: '])
+ self.generic_parse(node)
+ elif kind == 'see':
+ self.add_text('\n')
+ self.add_text('See: ')
+ self.generic_parse(node)
+ else:
+ self.generic_parse(node)
+
+ def do_argsstring(self, node):
+ self.generic_parse(node, pad=1)
+
+ def do_member(self, node):
+ kind = node.attributes['kind'].value
+ refid = node.attributes['refid'].value
+ if kind == 'function' and refid[:9] == 'namespace':
+ self.generic_parse(node)
+
+ def do_doxygenindex(self, node):
+ self.multi = 1
+ comps = node.getElementsByTagName('compound')
+ for c in comps:
+ refid = c.attributes['refid'].value
+ fname = refid + '.xml'
+ if not os.path.exists(fname):
+ fname = os.path.join(self.my_dir, fname)
+ if not self.quiet:
+ print "parsing file: %s"%fname
+ p = Doxy2SWIG(fname, self.include_function_definition, self.quiet)
+ p.generate()
+ self.pieces.extend(self.clean_pieces(p.pieces))
+
+ def write(self, fname):
+ o = my_open_write(fname)
+ if self.multi:
+ o.write("".join(self.pieces))
+ else:
+ o.write("".join(self.clean_pieces(self.pieces)))
+ o.close()
+
+ def clean_pieces(self, pieces):
+ """Cleans the list of strings given as `pieces`. It replaces
+ multiple newlines by a maximum of 2 and returns a new list.
+ It also wraps the paragraphs nicely.
+
+ """
+ ret = []
+ count = 0
+ for i in pieces:
+ if i == '\n':
+ count = count + 1
+ else:
+ if i == '";':
+ if count:
+ ret.append('\n')
+ elif count > 2:
+ ret.append('\n\n')
+ elif count:
+ ret.append('\n'*count)
+ count = 0
+ ret.append(i)
+
+ _data = "".join(ret)
+ ret = []
+ for i in _data.split('\n\n'):
+ if i == 'Parameters:' or i == 'Exceptions:':
+ ret.extend([i, '\n-----------', '\n\n'])
+ elif i.find('// File:') > -1: # leave comments alone.
+ ret.extend([i, '\n'])
+ else:
+ _tmp = textwrap.fill(i.strip(), break_long_words=False)
+ _tmp = self.lead_spc.sub(r'\1"\2', _tmp)
+ ret.extend([_tmp, '\n\n'])
+ return ret
+
+
+def convert(input, output, include_function_definition=True, quiet=False):
+ p = Doxy2SWIG(input, include_function_definition, quiet)
+ p.generate()
+ p.write(output)
+
+def main():
+ usage = __doc__
+ parser = optparse.OptionParser(usage)
+ parser.add_option("-n", '--no-function-definition',
+ action='store_true',
+ default=False,
+ dest='func_def',
+ help='do not include doxygen function definitions')
+ parser.add_option("-q", '--quiet',
+ action='store_true',
+ default=False,
+ dest='quiet',
+ help='be quiet and minimise output')
+
+ options, args = parser.parse_args()
+ if len(args) != 2:
+ parser.error("error: no input and output specified")
+
+ convert(args[0], args[1], not options.func_def, options.quiet)
+
+
+if __name__ == '__main__':
+ main()
fun:Py_ADDRESS_IN_RANGE
}
+{
+ ADDRESS_IN_RANGE/Invalid read of size 8 (x86_64 aka amd64)
+ Memcheck:Value8
+ fun:Py_ADDRESS_IN_RANGE
+}
+
{
ADDRESS_IN_RANGE/Conditional jump or move depends on uninitialised value
Memcheck:Cond
fun:Py_ADDRESS_IN_RANGE
}
+#
+# Leaks (including possible leaks)
+# Hmmm, I wonder if this masks some real leaks. I think it does.
+# Will need to fix that.
+#
+
+{
+ Handle PyMalloc confusing valgrind (possibly leaked)
+ Memcheck:Leak
+ fun:realloc
+ fun:_PyObject_GC_Resize
+ fun:COMMENT_THIS_LINE_TO_DISABLE_LEAK_WARNING
+}
+
+{
+ Handle PyMalloc confusing valgrind (possibly leaked)
+ Memcheck:Leak
+ fun:malloc
+ fun:_PyObject_GC_New
+ fun:COMMENT_THIS_LINE_TO_DISABLE_LEAK_WARNING
+}
+
+{
+ Handle PyMalloc confusing valgrind (possibly leaked)
+ Memcheck:Leak
+ fun:malloc
+ fun:_PyObject_GC_NewVar
+ fun:COMMENT_THIS_LINE_TO_DISABLE_LEAK_WARNING
+}
+
+#
+# Non-python specific leaks
+#
+
+{
+ Handle pthread issue (possibly leaked)
+ Memcheck:Leak
+ fun:calloc
+ fun:allocate_dtv
+ fun:_dl_allocate_tls_storage
+ fun:_dl_allocate_tls
+}
+
+{
+ Handle pthread issue (possibly leaked)
+ Memcheck:Leak
+ fun:memalign
+ fun:_dl_allocate_tls_storage
+ fun:_dl_allocate_tls
+}
+
+{
+ OCC allocator/Invalid read of size 4
+ Memcheck:Addr4
+ fun:_ZN23TCollection_AsciiStringC1EPKc
+}
+{
+ OCC allocator/Invalid read of size 4
+ Memcheck:Addr4
+ fun:_ZN23TCollection_AsciiStringC1ERKS_PKc
+}
+{
+ OCC allocator/Invalid read of size 4
+ Memcheck:Addr4
+ fun:_ZN26TCollection_ExtendedStringC1EPKcj
+}
+{
+ OCC allocator/Invalid read of size 4
+ Memcheck:Addr4
+ fun:_ZN23TCollection_AsciiString9AssignCatEPKc
+}
+
+{
+ omniORB send uninitialized
+ Memcheck:Param
+ socketcall.sendto(msg)
+ fun:send
+ fun:_ZN4omni13tcpConnection4SendEPvmmm
+}
+
{
ADDRESS_IN_RANGE/Invalid read of size 4
Memcheck:Addr4
fun:PyObject_Free
}
+{
+ ADDRESS_IN_RANGE/Invalid read of size 8
+ Memcheck:Addr8
+ fun:PyObject_Free
+}
{
ADDRESS_IN_RANGE/Invalid read of size 4
Memcheck:Value4
fun:PyObject_Free
}
+{
+ ADDRESS_IN_RANGE/Invalid read of size 8
+ Memcheck:Value8
+ fun:PyObject_Free
+}
{
ADDRESS_IN_RANGE/Conditional jump or move depends on uninitialised value
Memcheck:Addr4
fun:PyObject_Realloc
}
+{
+ ADDRESS_IN_RANGE/Invalid read of size 8
+ Memcheck:Addr8
+ fun:PyObject_Realloc
+}
{
ADDRESS_IN_RANGE/Invalid read of size 4
Memcheck:Value4
fun:PyObject_Realloc
}
+{
+ ADDRESS_IN_RANGE/Invalid read of size 8
+ Memcheck:Value8
+ fun:PyObject_Realloc
+}
{
ADDRESS_IN_RANGE/Conditional jump or move depends on uninitialised value
fun:PyObject_Realloc
}
-#
-# Non-python specific leaks
-#
+###
+### All the suppressions below are for errors that occur within libraries
+### that Python uses. The problems to not appear to be related to Python's
+### use of the libraries.
+###
{
- Handle pthread issue (possibly leaked)
- Memcheck:Leak
- fun:calloc
- fun:allocate_dtv
- fun:_dl_allocate_tls_storage
- fun:_dl_allocate_tls
+ Generic gentoo ld problems
+ Memcheck:Cond
+ obj:/lib/ld-2.3.4.so
+ obj:/lib/ld-2.3.4.so
+ obj:/lib/ld-2.3.4.so
+ obj:/lib/ld-2.3.4.so
}
{
- Handle pthread issue (possibly leaked)
- Memcheck:Leak
- fun:calloc
- obj:/lib/ld-2.3.6.so
- fun:_dl_allocate_tls
+ DBM problems, see test_dbm
+ Memcheck:Param
+ write(buf)
+ fun:write
+ obj:/usr/lib/libdb1.so.2
+ obj:/usr/lib/libdb1.so.2
+ obj:/usr/lib/libdb1.so.2
+ obj:/usr/lib/libdb1.so.2
+ fun:dbm_close
}
{
- Handle pthread issue (possibly leaked)
- Memcheck:Leak
- fun:memalign
- fun:_dl_allocate_tls_storage
- fun:_dl_allocate_tls
+ DBM problems, see test_dbm
+ Memcheck:Value8
+ fun:memmove
+ obj:/usr/lib/libdb1.so.2
+ obj:/usr/lib/libdb1.so.2
+ obj:/usr/lib/libdb1.so.2
+ obj:/usr/lib/libdb1.so.2
+ fun:dbm_store
+ fun:dbm_ass_sub
+}
+
+{
+ DBM problems, see test_dbm
+ Memcheck:Cond
+ obj:/usr/lib/libdb1.so.2
+ obj:/usr/lib/libdb1.so.2
+ obj:/usr/lib/libdb1.so.2
+ fun:dbm_store
+ fun:dbm_ass_sub
+}
+
+{
+ DBM problems, see test_dbm
+ Memcheck:Cond
+ fun:memmove
+ obj:/usr/lib/libdb1.so.2
+ obj:/usr/lib/libdb1.so.2
+ obj:/usr/lib/libdb1.so.2
+ obj:/usr/lib/libdb1.so.2
+ fun:dbm_store
+ fun:dbm_ass_sub
}
-###
-### All the suppressions below are for errors that occur within libraries
-### that Python uses. The problems to not appear to be related to Python's
-### use of the libraries.
-###
{
GDBM problems, see test_gdbm
Memcheck:Param
}
+{
+ ZLIB problems, see test_gzip
+ Memcheck:Cond
+ obj:/lib/libz.so.1.2.3
+ obj:/lib/libz.so.1.2.3
+ fun:deflate
+}
+
+{
+ Avoid problems w/readline doing a putenv and leaking on exit
+ Memcheck:Leak
+ fun:malloc
+ fun:xmalloc
+ fun:sh_set_lines_and_columns
+ fun:_rl_get_screen_size
+ fun:_rl_init_terminal_io
+ obj:/lib/libreadline.so.4.3
+ fun:rl_initialize
+}
+
###
### These occur from somewhere within the SSL, when running
### test_socket_sll. They are too general to leave on by default.
--- /dev/null
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+IF(WINDOWS)
+ SET(EXPATHOME $ENV{EXPATHOME})
+ FIND_LIBRARY(EXPAT_LIB libexpat PATHS ${EXPATHOME}/bin ${EXPATHOME}/Bin)
+ FIND_PATH(EXPAT_INCLUDE_DIR expat.h PATHS ${EXPATHOME}/include ${EXPATHOME}/Source/lib)
+ELSE(WINDOWS)
+ FIND_LIBRARY(EXPAT_LIB expat)
+ENDIF(WINDOWS)
+
+IF(EXPAT_INCLUDE_DIR)
+ SET(EXPAT_INCLUDES -I${EXPAT_INCLUDE_DIR})
+ENDIF(EXPAT_INCLUDE_DIR)
+SET(EXPAT_LIBS ${EXPAT_LIB})
--- /dev/null
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+SET(GRAPHVIZ_LIBS)
+IF(WINDOWS)
+ SET(GRAPHVIZHOME $ENV{GRAPHVIZHOME})
+ FIND_PATH(GRAPHVIZ_INCLUDE_DIR gvc.h ${GRAPHVIZHOME}/include/graphviz)
+ FIND_LIBRARY(GVC_LIB gvc ${GRAPHVIZHOME}/bin)
+ SET(GRAPHVIZ_LIBS ${GRAPHVIZ_LIBS} ${GVC_LIB})
+ FIND_LIBRARY(GRAPH_LIB graph ${GRAPHVIZHOME}/bin)
+ SET(GRAPHVIZ_LIBS ${GRAPHVIZ_LIBS} ${GRAPH_LIB})
+ELSE(WINDOWS)
+ SET(GRAPHVIZHOME $ENV{GRAPHVIZHOME})
+ IF(NOT GRAPHVIZHOME)
+ SET(GRAPHVIZHOME /usr)
+ ENDIF(NOT GRAPHVIZHOME)
+ FIND_PATH(GRAPHVIZ_INCLUDE_DIR gvc.h ${GRAPHVIZHOME}/include/graphviz)
+ FIND_LIBRARY(GVC_LIB gvc ${GRAPHVIZHOME}/lib)
+ SET(GRAPHVIZ_LIBS ${GRAPHVIZ_LIBS} ${GVC_LIB})
+ENDIF(WINDOWS)
+
+IF(GRAPHVIZ_INCLUDE_DIR)
+ SET(GRAPHVIZ_CPPFLAGS -I${GRAPHVIZ_INCLUDE_DIR})
+ENDIF(GRAPHVIZ_INCLUDE_DIR)
+SET(GRAPHVIZ_LIBADD ${GRAPHVIZ_LIBS})
--- /dev/null
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+# ------
+MESSAGE(STATUS "Check for sphinx ...")
+# ------
+
+IF(SPHINX_IS_MANDATORY STREQUAL 0)
+ SET(SPHINX_IS_MANDATORY 0)
+ SET(SPHINX_IS_OPTIONAL 1)
+ENDIF(SPHINX_IS_MANDATORY STREQUAL 0)
+IF(SPHINX_IS_OPTIONAL STREQUAL 0)
+ SET(SPHINX_IS_MANDATORY 1)
+ SET(SPHINX_IS_OPTIONAL 0)
+ENDIF(SPHINX_IS_OPTIONAL STREQUAL 0)
+IF(NOT SPHINX_IS_MANDATORY AND NOT SPHINX_IS_OPTIONAL)
+ SET(SPHINX_IS_MANDATORY 0)
+ SET(SPHINX_IS_OPTIONAL 1)
+ENDIF(NOT SPHINX_IS_MANDATORY AND NOT SPHINX_IS_OPTIONAL)
+
+# ------
+
+SET(SPHINX_STATUS 1)
+IF(WITHOUT_SPHINX OR WITH_SPHINX STREQUAL 0)
+ SET(SPHINX_STATUS 0)
+ MESSAGE(STATUS "sphinx disabled from command line.")
+ENDIF(WITHOUT_SPHINX OR WITH_SPHINX STREQUAL 0)
+
+# ------
+
+IF(SPHINX_STATUS)
+ IF(WITH_SPHINX)
+ SET(SPHINX_ROOT_USER ${WITH_SPHINX})
+ ENDIF(WITH_SPHINX)
+ IF(NOT SPHINX_ROOT_USER)
+ SET(SPHINX_ROOT_USER $ENV{SPHINX_ROOT})
+ ENDIF(NOT SPHINX_ROOT_USER)
+ IF(NOT SPHINX_ROOT_USER)
+ SET(SPHINX_ROOT_USER $ENV{SPHINXHOME})
+ ENDIF(NOT SPHINX_ROOT_USER)
+ENDIF(SPHINX_STATUS)
+
+# ------
+
+IF(SPHINX_STATUS)
+ SET(SPHINX_EXECUTABLE_TO_FIND sphinx-build)
+ IF(SPHINX_ROOT_USER)
+ SET(BINDIR)
+ IF(WINDOWS)
+ SET(BINDIR ${SPHINX_ROOT_USER}/Scripts)
+ ELSE(WINDOWS)
+ SET(BINDIR ${SPHINX_ROOT_USER}/bin)
+ ENDIF(WINDOWS)
+ FIND_PROGRAM(SPHINX_EXECUTABLE ${SPHINX_EXECUTABLE_TO_FIND} PATHS ${BINDIR} NO_DEFAULT_PATH)
+ ELSE(SPHINX_ROOT_USER)
+ FIND_PROGRAM(SPHINX_EXECUTABLE ${SPHINX_EXECUTABLE_TO_FIND})
+ ENDIF(SPHINX_ROOT_USER)
+ IF(SPHINX_EXECUTABLE)
+ MESSAGE(STATUS "${SPHINX_EXECUTABLE_TO_FIND} found: ${SPHINX_EXECUTABLE}")
+ ELSE(SPHINX_EXECUTABLE)
+ MESSAGE(STATUS "${SPHINX_EXECUTABLE_TO_FIND} not found, try to use WITH_SPHINX option or SPHINX_ROOT (or SPHINXHOME) environment variable")
+ SET(SPHINX_STATUS 0)
+ ENDIF(SPHINX_EXECUTABLE)
+ENDIF(SPHINX_STATUS)
+
+# ----
+
+IF(SPHINX_STATUS)
+ SET(SPHINX_IS_OK 1)
+ELSE(SPHINX_STATUS)
+ SET(SPHINX_IS_OK 0)
+ IF(SPHINX_IS_MANDATORY)
+ MESSAGE(FATAL_ERROR "sphinx not found ... mandatory ... abort")
+ ELSE(SPHINX_IS_MANDATORY)
+ MESSAGE(STATUS "sphinx not found ... optional ... disabled")
+ ENDIF(SPHINX_IS_MANDATORY)
+ENDIF(SPHINX_STATUS)
+
+# ----
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl @synopsis AC_CXX_OPTION(-option,variable where we add option if ok,action if ok; action if not ok)
dnl Check options for C++ compiler
dnl @author Bernard Secher - 15/01/2004
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl @synopsis AC_LINKER_OPTIONS
dnl Check warning flags for C++ compiler to control warning messages
dnl
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl @synopsis AC_PROG_SWIG([major.minor.micro])
dnl This macro searches for a SWIG installation on your system. If found you
dnl should) SWIG via $(SWIG). You can use the optional first argument to check
if test -z "$available_patch" ; then
[available_patch=0]
fi
- if test $available_major -ne $required_major \
- -o $available_minor -ne $required_minor \
- -o $available_patch -lt $required_patch ; then
- AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org])
- SWIG='echo "Error: SWIG version >= $1 is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false'
- else
- AC_MSG_NOTICE([SWIG executable is '$SWIG'])
+ if test $available_major -lt $required_major ; then
+ AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version (major version too low). You should look at http://www.swig.org])
+ SWIG='echo "Error: SWIG version >= $1 is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false'
+ elif test $available_major -eq $required_major; then
+ if test $available_minor -lt $required_minor ; then
+ AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version (minor version too low). You should look at http://www.swig.org])
+ SWIG='echo "Error: SWIG version >= $1 is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false'
+ elif test $available_minor -eq $required_minor ;then
+ if test $available_patch -lt $required_patch; then
+ AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version (maintenance version too low). You should look at http://www.swig.org])
+ SWIG='echo "Error: SWIG version >= $1 is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false'
+ else
+ AC_MSG_NOTICE([SWIG executable is '$SWIG'])
+ swig_ok=yes
+ SWIG_LIB=`$SWIG -swiglib`
+ AC_MSG_NOTICE([SWIG runtime library directory is '$SWIG_LIB'])
+ fi
+ else
+ AC_MSG_NOTICE([SWIG executable is '$SWIG'])
+ swig_ok=yes
+ SWIG_LIB=`$SWIG -swiglib`
+ AC_MSG_NOTICE([SWIG runtime library directory is '$SWIG_LIB'])
+ fi
+ else
+ AC_MSG_NOTICE([SWIG executable is '$SWIG'])
swig_ok=yes
- SWIG_LIB=`$SWIG -swiglib`
- AC_MSG_NOTICE([SWIG runtime library directory is '$SWIG_LIB'])
- fi
+ SWIG_LIB=`$SWIG -swiglib`
+ AC_MSG_NOTICE([SWIG runtime library directory is '$SWIG_LIB'])
+ fi
else
AC_MSG_WARN([cannot determine SWIG version])
SWIG='echo "Error: Cannot determine SWIG version. You should look at http://www.swig.org" ; false'
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-dnl
-dnl @synopsis AC_PYTHON_DEVEL()
-dnl Checks for Python and tries to get the include path to 'Python.h'.
-dnl It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS) output variable.
-dnl @authors Sebastian Huber <address@hidden>, Alan W. Irwin
-dnl <address@hidden>, Rafael Laboissiere <address@hidden> and
-dnl Andrew Collier <address@hidden>.
-dnl
-AC_DEFUN([AC_PYTHON_DEVEL],[
- #
- # should allow for checking of python version here...
- #
- AC_REQUIRE([AM_PATH_PYTHON])
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_python_devel.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_PYTHON_DEVEL([version])
+#
+# DESCRIPTION
+#
+# Note: Defines as a precious variable "PYTHON_VERSION". Don't override it
+# in your configure.ac.
+#
+# This macro checks for Python and tries to get the include path to
+# 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS)
+# output variables. It also exports $(PYTHON_EXTRA_LIBS) and
+# $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code.
+#
+# You can search for some particular version of Python by passing a
+# parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please
+# note that you *have* to pass also an operator along with the version to
+# match, and pay special attention to the single quotes surrounding the
+# version number. Don't use "PYTHON_VERSION" for this: that environment
+# variable is declared as precious and thus reserved for the end-user.
+#
+# This macro should work for all versions of Python >= 2.1.0. As an end
+# user, you can disable the check for the python version by setting the
+# PYTHON_NOVERSIONCHECK environment variable to something else than the
+# empty string.
+#
+# If you need to use this macro for an older Python version, please
+# contact the authors. We're always open for feedback.
+#
+# LICENSE
+#
+# Copyright (c) 2009 Sebastian Huber <sebastian-huber@web.de>
+# Copyright (c) 2009 Alan W. Irwin <irwin@beluga.phys.uvic.ca>
+# Copyright (c) 2009 Rafael Laboissiere <rafael@laboissiere.net>
+# Copyright (c) 2009 Andrew Collier <colliera@ukzn.ac.za>
+# Copyright (c) 2009 Matteo Settenvini <matteo@member.fsf.org>
+# Copyright (c) 2009 Horst Knorr <hk_classes@knoda.org>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program 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 General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+#serial 8
+
+AC_DEFUN([AX_PYTHON_DEVEL],[
+ #
+ # Allow the use of a (user set) custom python version
+ #
+ AC_ARG_VAR([PYTHON_VERSION],[The installed Python
+ version to use, for example '2.3'. This string
+ will be appended to the Python interpreter
+ canonical name.])
+
+ AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]])
+ if test -z "$PYTHON"; then
+ AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path])
+ PYTHON_VERSION=""
+ fi
+
+ #
+ # Check for a version of Python >= 2.1.0
+ #
+ AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
+ ac_supports_python_ver=`$PYTHON -c "import sys; \
+ ver = sys.version.split ()[[0]]; \
+ print (ver >= '2.1.0')"`
+ if test "$ac_supports_python_ver" != "True"; then
+ if test -z "$PYTHON_NOVERSIONCHECK"; then
+ AC_MSG_RESULT([no])
+ AC_MSG_FAILURE([
+This version of the AC@&t@_PYTHON_DEVEL macro
+doesn't work properly with versions of Python before
+2.1.0. You may need to re-run configure, setting the
+variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG,
+PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
+Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
+to something else than an empty string.
+])
+ else
+ AC_MSG_RESULT([skip at user request])
+ fi
+ else
+ AC_MSG_RESULT([yes])
+ fi
+
+ #
+ # if the macro parameter ``version'' is set, honour it
+ #
+ if test -n "$1"; then
+ AC_MSG_CHECKING([for a version of Python $1])
+ ac_supports_python_ver=`$PYTHON -c "import sys; \
+ ver = sys.version.split ()[[0]]; \
+ print (ver $1)"`
+ if test "$ac_supports_python_ver" = "True"; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([this package requires Python $1.
+If you have it installed, but it isn't the default Python
+interpreter in your system path, please pass the PYTHON_VERSION
+variable to configure. See ``configure --help'' for reference.
+])
+ PYTHON_VERSION=""
+ fi
+ fi
+
+ #
+ # Check if you have distutils, else fail
+ #
+ AC_MSG_CHECKING([for the distutils Python package])
+ ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
+ if test -z "$ac_distutils_result"; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([cannot import Python module "distutils".
+Please check your Python installation. The error was:
+$ac_distutils_result])
+ PYTHON_VERSION=""
+ fi
+
+ #
# Check for Python include path
+ #
AC_MSG_CHECKING([for Python include path])
- python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
- for i in "$python_path/include/python$PYTHON_VERSION/" "$python_path/include/python/" "$python_path/" ; do
- python_path=`find $i -type f -name Python.h -print | sed "1q"`
- if test -n "$python_path" ; then
- break
+ if test -z "$PYTHON_CPPFLAGS"; then
+ python_path=`$PYTHON -c "import distutils.sysconfig; \
+ print (distutils.sysconfig.get_python_inc ());"`
+ if test -n "${python_path}"; then
+ python_path="-I$python_path"
fi
- done
- python_path=`echo $python_path | sed "s,/Python.h$,,"`
- AC_MSG_RESULT([$python_path])
- if test -z "$python_path" ; then
- AC_MSG_ERROR([cannot find Python include path])
+ PYTHON_CPPFLAGS=$python_path
fi
- AC_SUBST([PYTHON_CPPFLAGS],[-I$python_path])
+ AC_MSG_RESULT([$PYTHON_CPPFLAGS])
+ AC_SUBST([PYTHON_CPPFLAGS])
+ #
# Check for Python library path
+ #
AC_MSG_CHECKING([for Python library path])
- python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
- for i in "$python_path/lib/python$PYTHON_VERSION/config/" "$python_path/lib/python$PYTHON_VERSION/" "$python_path/lib/python/config/" "$python_path/lib/python/" "$python_path/" ; do
- python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"`
- if test -n "$python_path" ; then
- break
+ if test -z "$PYTHON_LDFLAGS"; then
+ # (makes two attempts to ensure we've got a version number
+ # from the interpreter)
+ ac_python_version=`cat<<EOD | $PYTHON -
+
+# join all versioning strings, on some systems
+# major/minor numbers could be in different list elements
+from distutils.sysconfig import *
+ret = ''
+for e in get_config_vars ('VERSION'):
+ if (e != None):
+ ret += e
+print (ret)
+EOD`
+
+ if test -z "$ac_python_version"; then
+ if test -n "$PYTHON_VERSION"; then
+ ac_python_version=$PYTHON_VERSION
+ else
+ ac_python_version=`$PYTHON -c "import sys; \
+ print (sys.version[[:3]])"`
+ fi
+ fi
+
+ # Make the versioning information available to the compiler
+ AC_DEFINE_UNQUOTED([HAVE_PYTHON], ["$ac_python_version"],
+ [If available, contains the Python version number currently in use.])
+
+ # First, the library directory:
+ ac_python_libdir=`cat<<EOD | $PYTHON -
+
+# There should be only one
+import distutils.sysconfig
+for e in distutils.sysconfig.get_config_vars ('LIBDIR'):
+ if e != None:
+ print (e)
+ break
+EOD`
+
+ # Before checking for libpythonX.Y, we need to know
+ # the extension the OS we're on uses for libraries
+ # (we take the first one, if there's more than one fix me!):
+ ac_python_soext=`$PYTHON -c \
+ "import distutils.sysconfig; \
+ print (distutils.sysconfig.get_config_vars('SO')[[0]])"`
+
+ # Now, for the library:
+ ac_python_soname=`$PYTHON -c \
+ "import distutils.sysconfig; \
+ print (distutils.sysconfig.get_config_vars('LDLIBRARY')[[0]])"`
+
+ # Strip away extension from the end to canonicalize its name:
+ ac_python_library=`echo "$ac_python_soname" | sed "s/${ac_python_soext}$//"`
+
+ # This small piece shamelessly adapted from PostgreSQL python macro;
+ # credits goes to momjian, I think. I'd like to put the right name
+ # in the credits, if someone can point me in the right direction... ?
+ #
+ if test -n "$ac_python_libdir" -a -n "$ac_python_library" \
+ -a x"$ac_python_library" != x"$ac_python_soname"
+ then
+ # use the official shared library
+ ac_python_library=`echo "$ac_python_library" | sed "s/^lib//"`
+ PYTHON_LDFLAGS="-L$ac_python_libdir -l$ac_python_library"
+ else
+ # old way: use libpython from python_configdir
+ ac_python_libdir=`$PYTHON -c \
+ "from distutils.sysconfig import get_python_lib as f; \
+ import os; \
+ print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"`
+ PYTHON_LDFLAGS="-L$ac_python_libdir -lpython$ac_python_version"
+ fi
+
+ if test -z "PYTHON_LDFLAGS"; then
+ AC_MSG_ERROR([
+ Cannot determine location of your Python DSO. Please check it was installed with
+ dynamic libraries enabled, or try setting PYTHON_LDFLAGS by hand.
+ ])
fi
- done
- python_path=`echo $python_path | sed "s,/libpython.*$,,"`
- AC_MSG_RESULT([$python_path])
- if test -z "$python_path" ; then
- AC_MSG_ERROR([cannot find Python library path])
fi
- AC_SUBST([PYTHON_LDFLAGS],["-L$python_path -lpython$PYTHON_VERSION"])
+ AC_MSG_RESULT([$PYTHON_LDFLAGS])
+ AC_SUBST([PYTHON_LDFLAGS])
+
#
- python_site=`echo $python_path | sed "s/config/site-packages/"`
- AC_SUBST([PYTHON_SITE_PKG],[$python_site])
+ # Check for site packages
+ #
+ AC_MSG_CHECKING([for Python site-packages path])
+ if test -z "$PYTHON_SITE_PKG"; then
+ PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
+ print (distutils.sysconfig.get_python_lib(0,0));"`
+ fi
+ AC_MSG_RESULT([$PYTHON_SITE_PKG])
+ AC_SUBST([PYTHON_SITE_PKG])
+
#
# libraries which must be linked in when embedding
#
AC_MSG_CHECKING(python extra libraries)
- PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
+ if test -z "$PYTHON_EXTRA_LIBS"; then
+ PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
conf = distutils.sysconfig.get_config_var; \
- print conf('LOCALMODLIBS')+' '+conf('LIBS')"
- AC_MSG_RESULT($PYTHON_EXTRA_LIBS)`
+ print (conf('LOCALMODLIBS') + ' ' + conf('LIBS'))"`
+ fi
+ AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
AC_SUBST(PYTHON_EXTRA_LIBS)
- #
- # linking flags needed when embedding
- #
- AC_MSG_CHECKING(python extra linking flags)
- if test -z "$PYTHON_EXTRA_LDFLAGS"; then
- PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
- conf = distutils.sysconfig.get_config_var; \
- print conf('LINKFORSHARED')"`
- fi
- AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
- AC_SUBST(PYTHON_EXTRA_LDFLAGS)
+
+ #
+ # linking flags needed when embedding
+ #
+ AC_MSG_CHECKING(python extra linking flags)
+ if test -z "$PYTHON_EXTRA_LDFLAGS"; then
+ PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
+ conf = distutils.sysconfig.get_config_var; \
+ print (conf('LINKFORSHARED'))"`
+ fi
+ AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
+ AC_SUBST(PYTHON_EXTRA_LDFLAGS)
+
+ #
+ # final check to see if everything compiles alright
+ #
+ AC_MSG_CHECKING([consistency of all components of python development environment])
+ # save current global flags
+ ac_save_LIBS="$LIBS"
+ ac_save_CPPFLAGS="$CPPFLAGS"
+ LIBS="$ac_save_LIBS $PYTHON_LDFLAGS $PYTHON_EXTRA_LDFLAGS $PYTHON_EXTRA_LIBS"
+ CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
+ AC_LANG_PUSH([C])
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([[#include <Python.h>]],
+ [[Py_Initialize();]])
+ ],[pythonexists=yes],[pythonexists=no])
+ AC_LANG_POP([C])
+ # turn back to default flags
+ CPPFLAGS="$ac_save_CPPFLAGS"
+ LIBS="$ac_save_LIBS"
+
+ AC_MSG_RESULT([$pythonexists])
+
+ if test ! "x$pythonexists" = "xyes"; then
+ AC_MSG_FAILURE([
+ Could not link test program to Python. Maybe the main Python library has been
+ installed in some non-standard library path. If so, pass it to configure,
+ via the LDFLAGS environment variable.
+ Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
+ ============================================================================
+ ERROR!
+ You probably have to install the development version of the Python package
+ for your distribution. The exact name of this package varies among them.
+ ============================================================================
+ ])
+ PYTHON_VERSION=""
+ fi
+
+ #
+ # all done!
+ #
])
+AC_DEFUN([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL])
+++ /dev/null
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-dnl
-# -----------------------------------------------------------------------------
-# --- from KERNEL_SRC 3.2.3
-# Check availability of Salome's KERNEL binary distribution
-#
-# Author : Jerome Roy (CEA, 2003)
-#
-
-AC_DEFUN([CHECK_KERNEL],[
-AC_REQUIRE([AC_LINKER_OPTIONS])dnl
-
-AC_CHECKING(for Kernel)
-
-Kernel_ok=no
-
-KERNEL_LDFLAGS=""
-KERNEL_CXXFLAGS=""
-
-AC_ARG_WITH(kernel,
- [--with-kernel=DIR root directory path of KERNEL build or installation],
- [KERNEL_DIR="$withval"],
- [KERNEL_DIR=""])
-
-if test "x${KERNEL_DIR}" = "x" ; then
- AC_MSG_RESULT(for \${KERNEL_ROOT_DIR}: ${KERNEL_ROOT_DIR})
- # no --with-kernel-dir option used
- if test "x${KERNEL_ROOT_DIR}" != "x" ; then
- # KERNEL_ROOT_DIR environment variable defined
- KERNEL_DIR=${KERNEL_ROOT_DIR}
- else
- # search Kernel binaries in PATH variable
- AC_PATH_PROG(TEMP,runSalome)
- if test "x${TEMP}" != "x" ; then
- AC_MSG_RESULT(runSalome was found at : ${TEMP})
- KERNEL_BIN_DIR=`dirname ${TEMP}`
- KERNEL_DIR=`cd ${KERNEL_BIN_DIR}/../..; pwd`
- fi
- fi
-fi
-
-if test -f ${KERNEL_DIR}/bin/salome/runSalome ; then
- AC_MSG_RESULT(Using Kernel module distribution in ${KERNEL_DIR})
- Kernel_ok=yes
-
- if test "x${KERNEL_ROOT_DIR}" = "x" ; then
- KERNEL_ROOT_DIR=${KERNEL_DIR}
- fi
-
- if test "x${KERNEL_SITE_DIR}" = "x" ; then
- KERNEL_SITE_DIR=${KERNEL_ROOT_DIR}
- fi
-
- AC_SUBST(KERNEL_ROOT_DIR)
- AC_SUBST(KERNEL_SITE_DIR)
-
- KERNEL_LDFLAGS=-L${KERNEL_DIR}/lib${LIB_LOCATION_SUFFIX}/salome
- KERNEL_CXXFLAGS=-I${KERNEL_DIR}/include/salome
-
- AC_SUBST(KERNEL_LDFLAGS)
- AC_SUBST(KERNEL_CXXFLAGS)
-else
- AC_MSG_WARN("Cannot find compiled Kernel module distribution")
-fi
-
-AC_MSG_RESULT(for Kernel: $Kernel_ok)
-
-])dnl
-
-# -----------------------------------------------------------------------------
-# --- from GUI_SRC 3.2.3
-# Check availability of Salome binary distribution
-#
-# Author : Marc Tajchman (CEA, 2002)
-#------------------------------------------------------------
-
-AC_DEFUN([CHECK_GUI],[
-AC_REQUIRE([AC_LINKER_OPTIONS])dnl
-
-AC_CHECKING(for $2 $1 )
-
-SalomeGUI_ok=no
-
-GUI_LDFLAGS=""
-GUI_CXXFLAGS=""
-
-AC_ARG_WITH(gui,
- [ --with-gui=DIR root directory path of SALOME GUI installation],
- [SALOME_GUI_DIR="$withval"],[SALOME_GUI_DIR=""])
-
-if test "x${SALOME_GUI_DIR}" = "x" ; then
- # no --with-gui-dir option used
- AC_MSG_RESULT(try \${GUI_ROOT_DIR}: ${GUI_ROOT_DIR})
- if test "x${GUI_ROOT_DIR}" != "x" ; then
- # SALOME_ROOT_DIR environment variable defined
- SALOME_GUI_DIR=${GUI_ROOT_DIR}
- else
- # search Salome binaries in PATH variable
- AC_PATH_PROG(TEMP, $1)
- if test "x${TEMP}" != "x" ; then
- AC_MSG_RESULT($1 was found at : ${TEMP})
- SALOME_BIN_DIR=`dirname ${TEMP}`
- SALOME_GUI_DIR=`cd ${SALOME_BIN_DIR}/../..; pwd`
- fi
- fi
-fi
-
-if test -f ${SALOME_GUI_DIR}/bin/salome/$1 ; then
- SalomeGUI_ok=yes
- AC_MSG_RESULT(Using SALOME GUI distribution in ${SALOME_GUI_DIR})
-
- if test "x${GUI_ROOT_DIR}" == "x" ; then
- GUI_ROOT_DIR=${SALOME_GUI_DIR}
- fi
-
- AC_SUBST(GUI_ROOT_DIR)
-
- GUI_LDFLAGS=-L${SALOME_GUI_DIR}/lib${LIB_LOCATION_SUFFIX}/salome
- GUI_CXXFLAGS=-I${SALOME_GUI_DIR}/include/salome
-
- AC_SUBST(GUI_LDFLAGS)
- AC_SUBST(GUI_CXXFLAGS)
-else
- AC_MSG_WARN("Cannot find compiled SALOME GUI distribution")
-fi
-
-AC_MSG_RESULT(for $2: ${SalomeGUI_ok})
-
-])dnl
-
-AC_DEFUN([CHECK_SALOME_GUI],[
- CHECK_GUI([SUITApp],
- [SALOME GUI])
-])dnl
-
-# -----------------------------------------------------------------------------
-# --- from PYHELLO1_SRC 3.2.3
-# Check availability of PYHELLO binary distribution
-#
-# Author : Marc Tajchman (CEA, 2002)
-#------------------------------------------------------------
-
-AC_DEFUN([CHECK_PYHELLO],[
-
-AC_CHECKING(for PyHello)
-
-PyHello_ok=no
-
-AC_ARG_WITH(pyHello,
- --with-py-hello=DIR root directory path of PYHELLO installation,
- PYHELLO_DIR="$withval",PYHELLO_DIR="")
-
-if test "x$PYHELLO_DIR" = "x" ; then
-
-# no --with-py-hello option used
-
- if test "x$PYHELLO_ROOT_DIR" != "x" ; then
-
- # PYHELLO_ROOT_DIR environment variable defined
- PYHELLO_DIR=$PYHELLO_ROOT_DIR
-
- else
-
- # search PyHello binaries in PATH variable
- AC_PATH_PROG(TEMP, PYHELLOGUI.py)
- if test "x$TEMP" != "x" ; then
- PYHELLO_BIN_DIR=`dirname $TEMP`
- PYHELLO_DIR=`dirname $PYHELLO_BIN_DIR`
- fi
-
- fi
-#
-fi
-
-if test -f ${PYHELLO_DIR}/bin/salome/PYHELLOGUI.py ; then
- PyHello_ok=yes
- AC_MSG_RESULT(Using PYHELLO distribution in ${PYHELLO_DIR})
-
- if test "x$PYHELLO_ROOT_DIR" == "x" ; then
- PYHELLO_ROOT_DIR=${PYHELLO_DIR}
- fi
- AC_SUBST(PYHELLO_ROOT_DIR)
-else
- AC_MSG_WARN("Cannot find compiled PYHELLO distribution")
-fi
-
-AC_MSG_RESULT(for PYHELLO: $PyHello_ok)
-
-])dnl
-
-# -----------------------------------------------------------------------------
-# --- from GEOM_SRC 3.2.3
-# Check availability of Geom binary distribution
-#
-# Author : Nicolas REJNERI (OPEN CASCADE, 2003)
-#
-
-AC_DEFUN([CHECK_GEOM],[
-
-AC_CHECKING(for Geom)
-
-Geom_ok=no
-
-GEOM_LDFLAGS=""
-GEOM_CXXFLAGS=""
-
-AC_ARG_WITH(geom,
- [ --with-geom=DIR root directory path of GEOM installation ],
- GEOM_DIR="$withval",GEOM_DIR="")
-
-if test "x$GEOM_DIR" == "x" ; then
-
-# no --with-geom-dir option used
-
- if test "x$GEOM_ROOT_DIR" != "x" ; then
-
- # GEOM_ROOT_DIR environment variable defined
- GEOM_DIR=$GEOM_ROOT_DIR
-
- else
-
- # search Geom binaries in PATH variable
- AC_PATH_PROG(TEMP, libGEOM_Swig.py)
- if test "x$TEMP" != "x" ; then
- GEOM_BIN_DIR=`dirname $TEMP`
- GEOM_DIR=`dirname $GEOM_BIN_DIR`
- fi
-
- fi
-#
-fi
-
-if test -f ${GEOM_DIR}/bin/salome/libGEOM_Swig.py ; then
- Geom_ok=yes
- AC_MSG_RESULT(Using Geom module distribution in ${GEOM_DIR})
-
- if test "x$GEOM_ROOT_DIR" == "x" ; then
- GEOM_ROOT_DIR=${GEOM_DIR}
- fi
- AC_SUBST(GEOM_ROOT_DIR)
-
- GEOM_LDFLAGS=-L${GEOM_DIR}/lib${LIB_LOCATION_SUFFIX}/salome
- GEOM_CXXFLAGS=-I${GEOM_DIR}/include/salome
-
- AC_SUBST(GEOM_LDFLAGS)
- AC_SUBST(GEOM_CXXFLAGS)
-
-else
- AC_MSG_WARN("Cannot find compiled Geom module distribution")
-fi
-
-AC_MSG_RESULT(for Geom: $Geom_ok)
-
-])dnl
-
-# -----------------------------------------------------------------------------
-# --- from VISU_SRC 3.2.3
-###########################################################
-# File : check_Visu.m4
-# Author : Vadim SANDLER (OCN)
-# Created : 13/07/05
-# Check availability of VISU binary distribution
-###########################################################
-
-AC_DEFUN([CHECK_VISU],[
-
-AC_CHECKING(for VISU)
-
-Visu_ok=no
-
-VISU_LDFLAGS=""
-VISU_CXXFLAGS=""
-
-
-AC_ARG_WITH(visu,
- [ --with-visu=DIR root directory path of VISU module installation ],
- VISU_DIR="$withval",VISU_DIR="")
-
-if test "x$VISU_DIR" == "x" ; then
- # no --with-visu-dir option used
- if test "x$VISU_ROOT_DIR" != "x" ; then
- # VISU_ROOT_DIR environment variable defined
- VISU_DIR=$VISU_ROOT_DIR
- fi
-fi
-
-if test -f ${VISU_DIR}/idl/salome/VISU_Gen.idl ; then
- Visu_ok=yes
- AC_MSG_RESULT(Using VISU module distribution in ${VISU_DIR})
-
- if test "x$VISU_ROOT_DIR" == "x" ; then
- VISU_ROOT_DIR=${VISU_DIR}
- fi
- AC_SUBST(VISU_ROOT_DIR)
-
- VISU_LDFLAGS=-L${VISU_DIR}/lib${LIB_LOCATION_SUFFIX}/salome
- VISU_CXXFLAGS=-I${VISU_DIR}/include/salome
-
- AC_SUBST(VISU_LDFLAGS)
- AC_SUBST(VISU_CXXFLAGS)
-
-else
- AC_MSG_WARN("Cannot find VISU module sources")
-fi
-
-AC_MSG_RESULT(for VISU: $Visu_ok)
-
-])dnl
-
-# -----------------------------------------------------------------------------
-
-AC_DEFUN([CHECK_SALOME_ENV],[
-
-AC_CHECKING(for SALOME_ENV)
-
-Salome_Env_ok=no
-
-AC_ARG_WITH(salome_env,
- [ --with-salome_env= path of script that sets salome prerequisites ],
- SALOME_ENV_PATH="$withval",SALOME_ENV_PATH="")
-
-if test "x$SALOME_ENV_PATH" == "x" ; then
- # no --with-salome_env option used
- if test "x$PREREQUISITE_SH" != "x" ; then
- # PREREQUISITE_SH environment variable defined
- SALOME_ENV_PATH=$PREREQUISITE_SH
- fi
-fi
-
-if test "x$SALOME_ENV_PATH" != "x" ; then
- if test -f ${SALOME_ENV_PATH} ; then
- Salome_Env_ok=yes
- AC_MSG_RESULT(Using script ${SALOME_ENV_PATH} for salome prerequisites in tests)
-
- if test "x$PREREQUISITE_SH" == "x" ; then
- PREREQUISITE_SH=${SALOME_ENV_PATH}
- fi
- AC_SUBST(PREREQUISITE_SH)
- fi
-fi
-
-if test -f ${SALOME_ENV_PATH} ; then
- AC_MSG_RESULT(for SALOME_ENV: $Salome_Env_ok)
-else
- AC_MSG_WARN("Cannot find SALOME_ENV module sources")
- AC_MSG_RESULT(for SALOME_ENV: $Salome_Env_ok)
-fi
-
-])dnl
-
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([CHECK_BOOST],[
AC_CHECKING(for BOOST Library)
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([CHECK_CAS],[
AC_REQUIRE([AC_PROG_CXX])dnl
AC_REQUIRE([AC_PROG_CXXCPP])dnl
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
# Check presence of "CPPUNIT" product presence
#
# Author : Anthony GEAY (CEA, 2006)
CPPUNIT_LIBS_DIR="$LOCAL_LIBS_DIR"
fi
fi
+AM_CONDITIONAL(CPPUNIT_IS_OK, [test x"$cppunit_ok" = xyes])
AC_LANG_RESTORE
AC_MSG_RESULT(for cppunit: $cppunit_ok)
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([AC_CHECK_EXPAT],[
AC_CHECKING(for expat)
-EXPAT_INCLUDES=
+CXXFLAGS_old=$CXXFLAGS
+CPPFLAGS_old=$CPPFLAGS
+
+# Custom location of expat package can be specified
+# through EXPAT_DIR variable
+if test "x$EXPAT_DIR" != "x"
+then
+ if test "x$EXPAT_DIR" = "x/usr"
+ then
+ AC_MSG_NOTICE(Trying native Expat...)
+ TMPLIBS="-lexpat $LIBS"
+ else
+ AC_MSG_NOTICE(Trying Expat from $EXPAT_DIR ...)
+ TMPLIBS="-L$EXPAT_DIR/lib -lexpat $LIBS"
+ CXXFLAGS="$CXXFLAGS -I$EXPAT_DIR/include"
+ CPPFLAGS="$CPPFLAGS -I$EXPAT_DIR/include"
+ EXPAT_INCLUDES="-I$EXPAT_DIR/include"
+ fi
+else
+ AC_MSG_NOTICE(Trying native Expat...)
+ TMPLIBS="-lexpat $LIBS"
+fi
+
AC_CHECK_HEADER(expat.h,expat_ok="yes",expat_ok="no")
if test "x$expat_ok" = "xyes"
then
- EXPAT_LIBS="-lexpat"
LIBS_old=$LIBS
- AC_CHECK_LIB(expat,XML_ExpatVersionInfo, LIBS="-lexpat $LIBS",,)
+ LIBS=$TMPLIBS
+ AC_CHECK_LIB(expat,XML_ExpatVersionInfo,expat_ok="yes",expat_ok="no",)
LIBS=$LIBS_old
fi
+if test "x$expat_ok" = "xyes"
+then
+ EXPAT_LIBS=$TMPLIBS
+fi
+
AC_MSG_RESULT(for expat: $expat_ok)
+CXXFLAGS=$CXXFLAGS_old
+CPPFLAGS=$CPPFLAGS_old
+
AC_SUBST(EXPAT_LIBS)
AC_SUBST(EXPAT_INCLUDES)
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([CHECK_HTML_GENERATORS],[
AC_CHECKING(for html generators)
AC_SUBST(DOXYGEN_WITH_PYTHON)
AC_SUBST(DOXYGEN_WITH_STL)
fi
+AM_CONDITIONAL(DOXYGEN_IS_OK, [test x"$doxygen_ok" = xyes])
dnl AC_SUBST(DOXYGEN)
AC_SUBST(GRAPHVIZHOME)
GRAPHVIZHOME=$GRAPHVIZ_PREFIX
GRAPHVIZ_CPPFLAGS="-I${GRAPHVIZHOME}/include/graphviz"
- GRAPHVIZ_LDFLAGS="-L${GRAPHVIZHOME}/lib/graphviz"
+ if test "x$GRAPHVIZHOME" = "x/usr" ; then
+ GRAPHVIZ_LDFLAGS="-L${GRAPHVIZHOME}/lib/graphviz"
+ else
+ GRAPHVIZ_LDFLAGS="-L${GRAPHVIZHOME}/lib -L${GRAPHVIZHOME}/lib/graphviz"
+ fi
fi
dnl AC_SUBST(DOT)
CPPFLAGS_old=$CPPFLAGS
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([AC_CHECK_LIBXML],[
AC_CHECKING(for libxml)
CXXFLAGS="$CXXFLAGS -I$LIBXML_DIR/include/libxml2"
if test "x$LIBXML_DIR" = "x/usr"
then
+ AC_MSG_NOTICE(Trying native Libxml2...)
TMPLIBS="-lxml2 $LIBS"
else
+ AC_MSG_NOTICE(Trying Libxml2 from $LIBXML_DIR ...)
TMPLIBS="-L$LIBXML_DIR/lib -lxml2 $LIBS"
fi
LIBXML_INCLUDES="-I$LIBXML_DIR/include/libxml2"
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([AC_CHECK_OMNIORB],[
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CXX])dnl
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
# Check availability of Salome's KERNEL binary distribution
#
# Author : Jerome Roy (CEA, 2003)
AC_MSG_WARN("Cannot find DSC Ports module distribution")
fi
+ KERNEL_LDFLAGS=-L${KERNEL_ROOT_DIR}/lib/salome
+ KERNEL_CXXFLAGS=-I${KERNEL_ROOT_DIR}/include/salome
+
AC_SUBST(KERNEL_ROOT_DIR)
AC_SUBST(KERNEL_SITE_DIR)
AC_SUBST(SALOME_ROOT_DIR)
AC_SUBST(SALOME_VERSION)
+ AC_SUBST(KERNEL_LDFLAGS)
+ AC_SUBST(KERNEL_CXXFLAGS)
else
AC_MSG_WARN("Cannot find compiled Kernel module distribution")
])dnl
+# -----------------------------------------------------------------------------
+# --- from GUI_SRC 3.2.3
+# Check availability of Salome binary distribution
+#
+# Author : Marc Tajchman (CEA, 2002)
+#------------------------------------------------------------
+
+AC_DEFUN([CHECK_GUI],[
+AC_REQUIRE([AC_LINKER_OPTIONS])dnl
+
+AC_CHECKING(for $2 $1 )
+
+SalomeGUI_ok=no
+HAS_GUI=0
+
+GUI_LDFLAGS=""
+GUI_CXXFLAGS=""
+
+AC_ARG_WITH(gui,
+ [ --with-gui=DIR root directory path of SALOME GUI installation],
+ [SALOME_GUI_DIR="$withval"],[SALOME_GUI_DIR=""])
+
+if test "x${SALOME_GUI_DIR}" = "x" ; then
+ # no --with-gui-dir option used
+ AC_MSG_RESULT(try \${GUI_ROOT_DIR}: ${GUI_ROOT_DIR})
+ if test "x${GUI_ROOT_DIR}" != "x" ; then
+ # SALOME_ROOT_DIR environment variable defined
+ SALOME_GUI_DIR=${GUI_ROOT_DIR}
+ else
+ # search Salome binaries in PATH variable
+ AC_PATH_PROG(TEMP, $1)
+ if test "x${TEMP}" != "x" ; then
+ AC_MSG_RESULT($1 was found at : ${TEMP})
+ SALOME_BIN_DIR=`dirname ${TEMP}`
+ SALOME_GUI_DIR=`cd ${SALOME_BIN_DIR}/../..; pwd`
+ fi
+ fi
+fi
+
+if test -f ${SALOME_GUI_DIR}/bin/salome/$1 ; then
+ SalomeGUI_ok=yes
+ HAS_GUI=1
+ AC_MSG_RESULT(Using SALOME GUI distribution in ${SALOME_GUI_DIR})
+
+ if test "x${GUI_ROOT_DIR}" == "x" ; then
+ GUI_ROOT_DIR=${SALOME_GUI_DIR}
+ fi
+
+ AC_SUBST(GUI_ROOT_DIR)
+
+ GUI_LDFLAGS=-L${SALOME_GUI_DIR}/lib/salome
+ GUI_CXXFLAGS=-I${SALOME_GUI_DIR}/include/salome
+
+ AC_SUBST(GUI_LDFLAGS)
+ AC_SUBST(GUI_CXXFLAGS)
+else
+ AC_MSG_WARN("Cannot find compiled SALOME GUI distribution")
+fi
+
+AC_MSG_RESULT(for $2: ${SalomeGUI_ok})
+
+# Propagate test into atlocal
+AC_SUBST(HAS_GUI)
+
+# Propagate test into Makefiles...
+AM_CONDITIONAL(HAS_GUI, test $HAS_GUI = 1)
+
+# ... and into source files
+AC_DEFINE_UNQUOTED(WITH_GUI, $HAS_GUI, [SALOME GUI])
+
+])dnl
+
+AC_DEFUN([CHECK_SALOME_GUI],[
+ CHECK_GUI([SUITApp],
+ [SALOME GUI])
+])dnl
+
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([CHECK_SPHINX],[
AC_CHECKING(for sphinx doc generator)
sphinx_ok=no
fi
+dnl Can I load ths sphinx module ?
+dnl This code comes from the ax_python_module macro.
+if test -z $PYTHON;
+then
+ PYTHON="python"
+fi
+PYTHON_NAME=`basename $PYTHON`
+AC_MSG_CHECKING($PYTHON_NAME module: sphinx)
+ $PYTHON -c "import sphinx" 2>/dev/null
+ if test $? -eq 0;
+ then
+ AC_MSG_RESULT(yes)
+ eval AS_TR_CPP(HAVE_PYMOD_sphinx)=yes
+ else
+ AC_MSG_RESULT(no)
+ eval AS_TR_CPP(HAVE_PYMOD_sphinx)=no
+ sphinx_ok=no
+ fi
+
AM_CONDITIONAL(SPHINX_IS_OK, [test x"$sphinx_ok" = xyes])
])dnl
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl the following variables are exported:
dnl QT_MOC
dnl QT_UIC
dnl path given with --with-qt4 options
dnl presence of QTDIR variable
dnl /usr
+dnl when HAS_GUI is false (no salome gui) and nothing is said for qt4, qt4 is not checked
dnl usages
dnl ./configure --prefix=/home/prascle/partage/maquettes/install
dnl ./configure --prefix=/home/prascle/partage/maquettes/install --with-qt4
AC_REQUIRE([AC_PROG_CPP])
qt_ok=no
+ qt4_wanted=yes
+ WITH_QT4=0
# --- check if qt4 standard install directory is defined (with subdirectories bin lib include)
qt4_install_path=""
fi
fi
- # --- if qt4 standard install directory is not defined: QTDIR value if defined, or /usr
+ # --- if qt4 standard install directory is not defined
+ # if HAS_GUI= 0: Qt4 not wanted
+ # else: QTDIR value if defined, or /usr
if test x${withval} = xnotset
then
- if test -z $QTDIR
+ if test x${HAS_GUI} = x0
then
- qt4_install_path="/usr"
+ qt4_wanted=no
+ AC_MSG_NOTICE([SALOME GUI not present, Qt4 not specified, skip detection])
else
- qt4_install_path=$QTDIR
+ if test -z $QTDIR
+ then
+ qt4_install_path="/usr"
+ else
+ if test $QTDIR = /usr/lib/qt3 ; then
+ if test -d /usr/lib/qt4 ; then
+ AC_MSG_RESULT(it is strange for a qt4 installation !)
+ AC_MSG_RESULT(/usr/lib/qt4 is present)
+ AC_MSG_RESULT(replacing QTDIR by /usr/lib/qt4)
+ QTDIR=/usr/lib/qt4
+ fi
+ fi
+ qt4_install_path=$QTDIR
+ fi
fi
fi
# --- if qt4 standard install directory is not wanted: --without-qt4 or --with-qt4=no
if test x${withval} = xno
then
- qt4_install_path=""
+ qt4_wanted=no
+ AC_MSG_NOTICE([Qt4 is not wanted, skip detection])
fi
QT_DIR=${qt4_install_path}
AC_SUBST(QT_DIR)
+ # ----------------------------------------------------------------------
+ # --- only when qt4 wanted (no explicit --without-qt4 nor --with-qt4=no)
+
+ if test x${qt4_wanted} = xyes
+ then
+
# --- check if qt4 includes directory is defined
qt4_include_path=""
AC_ARG_WITH([qt4-includes],
fi
fi
- WITH_QT4=0
-
- AC_MSG_NOTICE(${qt4_include_path})
- AC_MSG_NOTICE(${qt4_library_path})
- AC_MSG_NOTICE(${qt4_tools_path})
# test if qt4 is completely defined
qt4_defined=yes
then
qt4_defined=no
AC_MSG_NOTICE([No Qt4 include path defined])
+ else
+ AC_MSG_NOTICE([Qt4 include path is ${qt4_include_path}])
fi
if test x${qt4_library_path} = x
then
qt4_defined=no
AC_MSG_NOTICE([No Qt4 library path defined])
+ else
+ AC_MSG_NOTICE([Qt4 library path is ${qt4_library_path}])
fi
if test x${qt4_tools_path} = x
then
qt4_defined=no
AC_MSG_NOTICE([No Qt4 tools path defined])
+ else
+ AC_MSG_NOTICE([Qt4 tools path is ${qt4_tools_path}])
fi
# saving values for compilation variables
AC_SUBST(qt4_cppflags)
# --- we test the library file presence and usability
- if test x${qt4_library_path} = /usr/lib
+ if test x${qt4_library_path} = x/usr/lib
then
qt4_ldflags=""
else
fi
AC_MSG_NOTICE([checking whether link with qt4 is working])
- qt4_lib_name=QtGui
- qt4_libs="-l$qt4_lib_name"
+ qt4_libs="-lQtCore -lQtGui"
LDFLAGS="${LDFLAGS} ${qt4_ldflags}"
LIBS="${LIBS} ${qt4_libs}"
AC_LANG_PUSH(C++)
AC_MSG_NOTICE([No Qt4 support])
fi
+ # restoring saved values
+ CPPFLAGS=$saved_CPPFLAGS
+ LDFLAGS=$saved_LDFLAGS
+ LIBS=$saved_LIBS
+
+ fi
+ # --- end: only when qt4 wanted (no explicit --without-qt4 nor --with-qt4=no)
+ # ----------------------------------------------------------------------
+
# Propagate test into atlocal
AC_SUBST(WITH_QT4)
# ... and into source files
AC_DEFINE_UNQUOTED(HAS_QT4, $WITH_QT4, [Qt4 library])
- # restoring saved values
- CPPFLAGS=$saved_CPPFLAGS
- LDFLAGS=$saved_LDFLAGS
- LIBS=$saved_LIBS
-
])
AC_DEFUN([I2_CHECK_QSCINTILLA],
[
AC_REQUIRE([I2_CHECK_QT4])
-
qscintilla_ok=no
WITH_QSCI4=0
+ # ----------------------------------------------------------------------
+ # --- check qscintilla only when qt4 OK
+
+ if test x${WITH_QT4} = x1
+ then
+
# --- check if qsci4 includes directory is defined
qsci4_include_path=""
qsci4_cppflags=""
AC_SUBST(qsci4_cppflags)
# --- we test the library file presence and usability
+ if test x${qsci4_library_path} = x/usr/lib/qt4/lib
+ then
+ qsci4_library_path=/usr/lib
+ fi
if test x${qsci4_library_path} = x/usr/lib
then
qsci4_ldflags=""
AC_SUBST(qsci4_libs)
WITH_QSCI4=1
qscintilla_ok=yes
- # Propagate test into atlocal
- AC_SUBST(WITH_QSCI4)
fi
else
AC_MSG_NOTICE([no support for qscintilla for qt4])
fi
+ # restoring saved values
+ CPPFLAGS=$saved_CPPFLAGS
+ LDFLAGS=$saved_LDFLAGS
+ LIBS=$saved_LIBS
+
+ else
+ # --- end: check qscintilla only when qt4 OK
+ # ----------------------------------------------------------------------
+ AC_MSG_NOTICE([qscintilla for qt4 not checked because Qt4 not wanted or not detected])
+ fi
+
+ # Propagate test into atlocal
+ AC_SUBST(WITH_QSCI4)
+
# Propagate test into Makefiles...
AM_CONDITIONAL(WITH_QSCI4, test $WITH_QSCI4 = 1)
# ... and into source files
AC_DEFINE_UNQUOTED(HAS_QSCI4, $WITH_QSCI4, [QsciScintilla library])
- # restoring saved values
- CPPFLAGS=$saved_CPPFLAGS
- LDFLAGS=$saved_LDFLAGS
- LIBS=$saved_LIBS
-
])
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl define macros :
dnl AC_ENABLE_PRODUCTION AC_DISABLE_PRODUCTION
dnl AC_ENABLE_DEBUG AC_DISABLE_DEBUG
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
# Check presence of "threads"
#
# Author : Anthony GEAY (CEA, 2006)
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
##
# Here any commonly used variables can be defined
##
# Documentation directory
docdir = $(datadir)/doc/salome
+# translation (*.qm) files generation (lrelease)
+%.qm: resources/%.ts
+ $(QT_DIR)/bin/lrelease $< -qm $@
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
SUFFIXES =
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
dist_salomeres_DATA = $(QMFILES) ${ICONS}
ICONS = $(LIBICONS:%=resources/%)
--- /dev/null
+#!/bin/sh
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+CURRENT_DIR=`pwd`
+CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
+cd ${CONF_DIR}
+python $KERNEL_ROOT_DIR/salome_adm/cmake_files/am2cmake.py --yacs
+status=$?
+cd ${CURRENT_DIR}
+exit $status
--- /dev/null
+@REM Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+@REM
+@REM This library is free software; you can redistribute it and/or
+@REM modify it under the terms of the GNU Lesser General Public
+@REM License as published by the Free Software Foundation; either
+@REM version 2.1 of the License.
+@REM
+@REM This library is distributed in the hope that it will be useful,
+@REM but WITHOUT ANY WARRANTY; without even the implied warranty of
+@REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+@REM Lesser General Public License for more details.
+@REM
+@REM You should have received a copy of the GNU Lesser General Public
+@REM License along with this library; if not, write to the Free Software
+@REM Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+@REM
+@REM See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+@REM
+
+%PYTHONBIN% %KERNEL_ROOT_DIR%\salome_adm\cmake_files\am2cmake.py --yacs\r
#! /bin/sh
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# --
# --
#
--- /dev/null
+#!/bin/sh
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
+cd ${CONF_DIR}
+
+TO_CLEAN=
+TO_CLEAN=${TO_CLEAN}' build_configure.log'
+TO_CLEAN=${TO_CLEAN}' Makefile.am.list'
+TO_CLEAN=${TO_CLEAN}' aclocal.m4'
+TO_CLEAN=${TO_CLEAN}' autom4te*'
+TO_CLEAN=${TO_CLEAN}' configure'
+TO_CLEAN=${TO_CLEAN}' configure.in'
+TO_CLEAN=${TO_CLEAN}' missing'
+TO_CLEAN=${TO_CLEAN}' install-sh'
+TO_CLEAN=${TO_CLEAN}' ltmain.sh'
+TO_CLEAN=${TO_CLEAN}' config.guess'
+TO_CLEAN=${TO_CLEAN}' config.sub'
+TO_CLEAN=${TO_CLEAN}' depcomp'
+TO_CLEAN=${TO_CLEAN}' yacs_config.h.in'
+
+rm -rf $TO_CLEAN > /dev/null
+
+l=`find . -name "Makefile.in" -or -name "*~"`
+
+if test X"$l" != X ; then
+ rm -f $l
+fi
+
+find . -name "semantic.cache" -print -exec rm {} \;
+find . -name "*.pyc" -print -exec rm {} \;
+rm -f src/salomegui_swig/doc.i
+rm -f adm/unix/config_files/l*.m4
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# --
# Author : Anthony Geay (CEA)
# --
# -----------------------------------------------------------------------------
#
-AC_INIT([Salome2 Project], [5.1.0], [paul.rascle@edf.fr], [SalomeYacs])
+AC_INIT([Salome2 Project], [6.5.0], [paul.rascle@edf.fr], [SalomeYacs])
AM_INIT_AUTOMAKE([tar-pax])
AC_CONFIG_HEADER(yacs_config.h)
MODULE_NAME=yacs
AC_SUBST(MODULE_NAME)
-XVERSION=0x050100
+SHORT_VERSION=`echo $VERSION | awk -F. '{printf("%d.%d",$1,$2)}'`
+AC_SUBST(SHORT_VERSION)
+XVERSION=`echo $VERSION | awk -F. '{printf("0x%02x%02x%02x",$1,$2,$3)}'`
AC_SUBST(XVERSION)
RELEASE=$VERSION
CHECK_HTML_GENERATORS
CHECK_SPHINX
+CHECK_GUI(SALOME_Session_Server,SALOME_Session_Server)
+
I2_CHECK_QT4
I2_CHECK_QSCINTILLA
AM_CONDITIONAL([SALOME_KERNEL], [test "x$KERNEL_ROOT_DIR" != "x"])
AM_CONDITIONAL([DSC_PORTS], [test -f $KERNEL_ROOT_DIR/idl/salome/DSC_Engines.idl])
-CHECK_GUI(SALOME_Session_Server,SALOME_Session_Server)
-
-AM_CONDITIONAL([HAS_GUI], [test "x$GUI_ROOT_DIR" != "x"])
+AM_CONDITIONAL(WINDOWS, [ test ])
echo
echo
src/engine/Makefile \
src/engine/Plugin/Makefile \
src/engine/Test/Makefile \
+ src/engine_swig/Makefile \
src/hmi/Makefile \
src/pyqt/Makefile \
src/runtime/Makefile \
src/runtime/Test/Makefile \
+ src/runtime_swig/Makefile \
src/genericgui/Makefile \
src/salomewrap/Makefile \
src/salomegui/Makefile \
+ src/salomegui_swig/Makefile \
src/salomeloader/Makefile \
+ src/salomeloader/testSalomeLoader.py \
src/wrappergen/Makefile \
src/wrappergen/src/Makefile \
src/yacsloader/Makefile \
src/yacsloader/Test/Makefile \
- src/yacsorb/Makefile \
src/yacsloader/Test/YacsLoaderTest.sh \
src/yacsloader/Test/YacsLoaderInSessionTest.sh \
- src/yacsloader/Test/YacsLoaderInSessionTest2.sh \
src/yacsloader/Test/display.sh \
src/yacsloader/Test/config_appli.xml \
+ src/yacsloader_swig/Makefile \
+ src/yacsloader_swig/Test/Makefile \
+ src/yacsloader_swig/Test/YacsLoaderTest.sh \
+ src/yacsloader_swig/Test/YacsLoaderInSessionTest.sh \
+ src/yacsloader_swig/Test/config_appli.xml \
+ src/yacsorb/Makefile \
src/salomegui/resources/YACSCatalog.xml \
+ src/salomegui/resources/SalomeApp.xml \
doc/Doxyfile \
+ doc/conf.py \
])
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# Doxyfile 1.4.2
#---------------------------------------------------------------------------
# Project related configuration options
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# Doxyfile 1.4.2
#---------------------------------------------------------------------------
# Project related configuration options
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = \
- @top_srcdir@/doc \
+ @top_srcdir@/doc/ref \
@top_srcdir@/idl \
@top_srcdir@/src/bases \
@top_srcdir@/src/engine \
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm/unix/make_begin.am
.PHONY : latex
build_dev_docs:
doxygen
-DOXFILES= bases.dox engine.dox hmi.dox python.dox runtime.dox yacs.dox yacsloader.dox
+DOXFILES= ref/bases.dox ref/engine.dox ref/hmi.dox ref/python.dox ref/runtime.dox ref/yacs.dox ref/yacsloader.dox
-EXTRA_DIST= html htmldev $(DOXFILES)
+EXTRA_DIST= _static exemples $(DOXFILES)
yacsdocdir=$(docdir)/gui/YACS
yacsdevdocdir=$(docdir)/gui/YACS/dev
htm:
mkdir -p html doctrees
- $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) html
+ $(SPHINXBUILD) -c $(top_builddir)/doc -b html $(ALLSPHINXOPTS) html
@echo
@echo "Build finished. The HTML pages are in html."
latex:
mkdir -p latex doctrees
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) latex
+ $(SPHINXBUILD) -c $(top_builddir)/doc -b latex $(ALLSPHINXOPTS) latex
+ @echo "Running LaTeX files through pdflatex..."
+ make -C latex all-pdf
+ @echo "pdflatex finished; the PDF files are in latex."
+
+pdf:
+ $(SPHINXBUILD) -c $(top_builddir)/doc -b pdf $(ALLSPHINXOPTS) pdf
@echo
- @echo "Build finished; the LaTeX files are in latex."
- @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
- "run these through (pdf)latex."
+ @echo "Build finished. The pdf documents are in pdf."
+
+html:
+ mkdir -p $@
+
+htmldev:
+ mkdir -p $@
RSTFILES= \
accesCorba.rst \
annexe_common.rst \
batch.rst \
calcium.rst \
+calciumyacs.rst \
+calciumapi.rst \
+calciummod.rst \
calculator.rst \
-compInterne.rst \
-components.rst \
+compInterne.rst \
+components.rst \
console.rst \
cppsalome.rst \
dataflow.rst \
-etapes.rst \
+etapes.rst \
execpy.rst \
execution.rst \
execxml.rst \
hxx2salome.rst \
index.rst \
integration.rst \
-intro.rst \
+using.rst \
main_menu.rst \
modification.rst \
operations.rst \
pysalome.rst \
python.rst \
rappels.rst \
-references.rst \
+references.rst \
representation.rst \
-salome.rst \
+salome.rst \
schemapy.rst \
schemaxml.rst \
scratch.rst \
toolbars.rst \
+optimizer.rst \
yacsgen.rst
-EXTRA_DIST+= $(RSTFILES) images
+EXTRA_DIST+= $(RSTFILES) images
+
+EXTRA_DIST+= \
+ref/classDiagram.png \
+ref/createNodeCollaboration.png \
+opml.dtd \
+opml.xslt \
+ref/programingRules.sxw \
+ref/schema.jpeg \
+ref/sequenceCreateNode.png \
+ref/undoCreateNodeCollaboration.png
install-data-local:
$(INSTALL) -d $(DESTDIR)$(yacsdocdir)
if test -d "html"; then b=; else b="$(srcdir)/"; fi; \
cp -rf $$b"html"/* $(DESTDIR)$(yacsdocdir) ; \
- if test -f $$b"latex"/yacs.pdf; then cp -f $$b"latex"/yacs.pdf $(DESTDIR)$(yacsdocdir) ; fi;
+ if test -f $$b"latex"/using.pdf; then cp -f $$b"latex"/using.pdf $(DESTDIR)$(yacsdocdir) ; fi; \
+ if test -f $$b"latex"/integration.pdf; then cp -f $$b"latex"/integration.pdf $(DESTDIR)$(yacsdocdir) ; fi;
install_dev_docs:
$(INSTALL) -d $(DESTDIR)$(yacsdevdocdir)
if test -d "htmldev"; then b=; else b="$(srcdir)/"; fi; \
find $$b"htmldev" -name "*.*" -exec cp -rf {} $(DESTDIR)$(yacsdevdocdir) ';' ; \
- cp -rf $(top_srcdir)/src/yacsloader/samples $(DESTDIR)$(yacsdevdocdir); \
- rm -rf $(DESTDIR)$(yacsdevdocdir)/samples/CVS;
+ cp -rf $(top_srcdir)/src/yacsloader/samples $(DESTDIR)$(yacsdevdocdir); \
+ rm -rf $(DESTDIR)$(yacsdevdocdir)/samples/CVS;
uninstall-local:
chmod -R +w $(DESTDIR)$(yacsdocdir)
clean-local:
-rm -rf html latex doctrees
if test -d "html"; then rm -rf html ; fi
+
+dist-hook:
+ if test -d "html"; then b=; else b="$(srcdir)/"; fi; \
+ if test -d $$b"html"; then cp -rf $$b"html" $(distdir) ; fi; \
+ if test -d "htmldev"; then b=; else b="$(srcdir)/"; fi; \
+ if test -d $$b"htmldev"; then cp -rf $$b"htmldev" $(distdir) ; fi
--- /dev/null
+/**
+ * Sphinx stylesheet -- basic theme
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+/* -- main layout ----------------------------------------------------------- */
+
+div.clearer {
+ clear: both;
+}
+
+/* -- relbar ---------------------------------------------------------------- */
+
+div.related {
+ width: 100%;
+ font-size: 90%;
+}
+
+div.related h3 {
+ display: none;
+}
+
+div.related ul {
+ margin: 0;
+ padding: 0 0 0 10px;
+ list-style: none;
+}
+
+div.related li {
+ display: inline;
+}
+
+div.related li.right {
+ float: right;
+ margin-right: 5px;
+}
+
+/* -- sidebar --------------------------------------------------------------- */
+
+div.sphinxsidebarwrapper {
+ padding: 10px 5px 0 10px;
+}
+
+div.sphinxsidebar {
+ float: left;
+ width: 230px;
+ margin-left: -100%;
+ font-size: 90%;
+}
+
+div.sphinxsidebar ul {
+ list-style: none;
+}
+
+div.sphinxsidebar ul ul,
+div.sphinxsidebar ul.want-points {
+ margin-left: 20px;
+ list-style: square;
+}
+
+div.sphinxsidebar ul ul {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+div.sphinxsidebar form {
+ margin-top: 10px;
+}
+
+div.sphinxsidebar input {
+ border: 1px solid #98dbcc;
+ font-family: sans-serif;
+ font-size: 1em;
+}
+
+img {
+ border: 0;
+}
+
+/* -- search page ----------------------------------------------------------- */
+
+ul.search {
+ margin: 10px 0 0 20px;
+ padding: 0;
+}
+
+ul.search li {
+ padding: 5px 0 5px 20px;
+ background-image: url(file.png);
+ background-repeat: no-repeat;
+ background-position: 0 7px;
+}
+
+ul.search li a {
+ font-weight: bold;
+}
+
+ul.search li div.context {
+ color: #888;
+ margin: 2px 0 0 30px;
+ text-align: left;
+}
+
+ul.keywordmatches li.goodmatch a {
+ font-weight: bold;
+}
+
+/* -- index page ------------------------------------------------------------ */
+
+table.contentstable {
+ width: 90%;
+}
+
+table.contentstable p.biglink {
+ line-height: 150%;
+}
+
+a.biglink {
+ font-size: 1.3em;
+}
+
+span.linkdescr {
+ font-style: italic;
+ padding-top: 5px;
+ font-size: 90%;
+}
+
+/* -- general index --------------------------------------------------------- */
+
+table.indextable {
+ width: 100%;
+}
+
+table.indextable td {
+ text-align: left;
+ vertical-align: top;
+}
+
+table.indextable dl, table.indextable dd {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+table.indextable tr.pcap {
+ height: 10px;
+}
+
+table.indextable tr.cap {
+ margin-top: 10px;
+ background-color: #f2f2f2;
+}
+
+img.toggler {
+ margin-right: 3px;
+ margin-top: 3px;
+ cursor: pointer;
+}
+
+div.modindex-jumpbox {
+ border-top: 1px solid #ddd;
+ border-bottom: 1px solid #ddd;
+ margin: 1em 0 1em 0;
+ padding: 0.4em;
+}
+
+div.genindex-jumpbox {
+ border-top: 1px solid #ddd;
+ border-bottom: 1px solid #ddd;
+ margin: 1em 0 1em 0;
+ padding: 0.4em;
+}
+
+/* -- general body styles --------------------------------------------------- */
+
+a.headerlink {
+ visibility: hidden;
+}
+
+h1:hover > a.headerlink,
+h2:hover > a.headerlink,
+h3:hover > a.headerlink,
+h4:hover > a.headerlink,
+h5:hover > a.headerlink,
+h6:hover > a.headerlink,
+dt:hover > a.headerlink {
+ visibility: visible;
+}
+
+div.body p.caption {
+ text-align: inherit;
+}
+
+div.body td {
+ text-align: left;
+}
+
+.field-list ul {
+ padding-left: 1em;
+}
+
+.first {
+ margin-top: 0 !important;
+}
+
+p.rubric {
+ margin-top: 30px;
+ font-weight: bold;
+}
+
+img.align-left, .figure.align-left, object.align-left {
+ clear: left ;
+ float: left ;
+ margin-right: 1em }
+
+img.align-right, .figure.align-right, object.align-right {
+ clear: right ;
+ float: right ;
+ margin-left: 1em }
+
+img.align-center, .figure.align-center, object.align-center {
+ display: block;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+.align-left {
+ text-align: left;
+}
+
+.align-center {
+ clear: both;
+ text-align: center;
+}
+
+.align-right {
+ text-align: right;
+}
+
+/* -- sidebars -------------------------------------------------------------- */
+
+div.sidebar {
+ margin: 0 0 0.5em 1em;
+ border: 1px solid #ddb;
+ padding: 7px 7px 0 7px;
+ background-color: #ffe;
+ width: 40%;
+ float: right;
+}
+
+p.sidebar-title {
+ font-weight: bold;
+}
+
+/* -- topics ---------------------------------------------------------------- */
+
+div.topic {
+ border: 1px solid #ccc;
+ padding: 7px 7px 0 7px;
+ margin: 10px 0 10px 0;
+}
+
+p.topic-title {
+ font-size: 1.1em;
+ font-weight: bold;
+ margin-top: 10px;
+}
+
+/* -- admonitions ----------------------------------------------------------- */
+
+div.admonition {
+ margin-top: 10px;
+ margin-bottom: 10px;
+ padding: 7px;
+}
+
+div.admonition dt {
+ font-weight: bold;
+}
+
+div.admonition dl {
+ margin-bottom: 0;
+}
+
+p.admonition-title {
+ margin: 0px 10px 5px 0px;
+ font-weight: bold;
+}
+
+div.body p.centered {
+ text-align: center;
+ margin-top: 25px;
+}
+
+/* -- tables ---------------------------------------------------------------- */
+
+table.docutils {
+ border: 0 solid #dce;
+ border-collapse: collapse;
+}
+
+table.docutils td, table.docutils th {
+ padding: 2px 5px 2px 5px;
+ border-left: 0;
+ background-color: #eef;
+}
+
+table.field-list td, table.field-list th {
+ border: 0 !important;
+}
+
+table.footnote td, table.footnote th {
+ border: 0 !important;
+}
+
+table.docutils th {
+ border-top: 1px solid #cac;
+ background-color: #ede;
+}
+
+th {
+ text-align: left;
+ padding-right: 5px;
+}
+
+th.head {
+ text-align: center;
+}
+
+/* -- other body styles ----------------------------------------------------- */
+
+ol.arabic {
+ list-style: decimal;
+}
+
+ol.loweralpha {
+ list-style: lower-alpha;
+}
+
+ol.upperalpha {
+ list-style: upper-alpha;
+}
+
+ol.lowerroman {
+ list-style: lower-roman;
+}
+
+ol.upperroman {
+ list-style: upper-roman;
+}
+
+dl {
+ margin-bottom: 15px;
+}
+
+dd p {
+ margin-top: 0px;
+}
+
+dd ul, dd table {
+ margin-bottom: 10px;
+}
+
+dd {
+ margin-top: 3px;
+ margin-bottom: 10px;
+ margin-left: 30px;
+}
+
+dt:target, .highlight {
+ background-color: #fbe54e;
+}
+
+dt:target, .highlighted {
+ background-color: #fbe54e;
+}
+
+dl.glossary dt {
+ font-weight: bold;
+ font-size: 1.1em;
+}
+
+.field-list ul {
+ margin: 0;
+ padding-left: 1em;
+}
+
+.field-list p {
+ margin: 0;
+}
+
+.refcount {
+ color: #060;
+}
+
+.optional {
+ font-size: 1.3em;
+}
+
+.versionmodified {
+ font-style: italic;
+}
+
+p.deprecated {
+ background-color: #ffe4e4;
+ border: 1px solid #f66;
+ padding: 7px
+}
+
+.system-message {
+ background-color: #fda;
+ padding: 5px;
+ border: 3px solid red;
+}
+
+.footnote:target {
+ background-color: #ffa
+}
+
+.line-block {
+ display: block;
+ margin-top: 1em;
+ margin-bottom: 1em;
+}
+
+.line-block .line-block {
+ margin-top: 0;
+ margin-bottom: 0;
+ margin-left: 1.5em;
+}
+
+.guilabel, .menuselection {
+ font-family: sans-serif;
+}
+
+.accelerator {
+ text-decoration: underline;
+}
+
+.classifier {
+ font-style: oblique;
+}
+
+.impl-detail {
+ margin-top: 10px;
+ margin-bottom: 10px;
+ padding: 7px;
+ border: 1px solid #ccc;
+}
+
+.impl-detail .compound-first {
+ margin-top: 0;
+}
+
+.impl-detail .compound-last {
+ margin-bottom: 0;
+}
+
+/* -- code displays --------------------------------------------------------- */
+
+pre {
+ overflow: auto;
+}
+
+td.linenos pre {
+ padding: 5px 0px;
+ border: 0;
+ background-color: transparent;
+ color: #aaa;
+}
+
+table.highlighttable {
+ margin-left: 0.5em;
+}
+
+table.highlighttable td {
+ padding: 0 0.5em 0 0.5em;
+}
+
+tt.descname {
+ background-color: transparent;
+ font-weight: bold;
+ font-size: 1.2em;
+}
+
+tt.descclassname {
+ background-color: transparent;
+}
+
+tt.xref, a tt {
+ background-color: transparent;
+ font-weight: bold;
+}
+
+h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
+ background-color: transparent;
+}
+
+.viewcode-link {
+ float: right;
+}
+
+.viewcode-back {
+ float: right;
+ font-family: sans-serif;
+}
+
+div.viewcode-block:target {
+ margin: -1px -10px;
+ padding: 0 10px;
+}
+
+/* -- math display ---------------------------------------------------------- */
+
+img.math {
+ vertical-align: middle;
+}
+
+div.body div.math p {
+ text-align: center;
+}
+
+span.eqno {
+ float: right;
+}
+
+/* -- printout stylesheet --------------------------------------------------- */
+
+@media print {
+ div.document,
+ div.documentwrapper,
+ div.bodywrapper {
+ margin: 0 !important;
+ width: 100%;
+ }
+
+ div.sphinxsidebar,
+ div.related,
+ div.footer,
+ #top-link {
+ display: none;
+ }
+}
.. _secaccescorba:
-Composant à accès distant (via CORBA)
-=====================================
-
-
-Principe
---------
-
-Les interfaces nécessaires pour "voir" un objet interne comme un composant
-distant reposent sur la définition d'un "contrat" qui précise les services
-proposés par un composant et le mode d'accès à ces services (paramètres
-d'entrée et de sortie, exceptions renvoyées).
-
-Ces déclarations sont contenues
-dans un **fichier IDL** qui sert de référence pour définir le code d'interface
-côté composant et côté clients du composant. Des exemples sont donnés plus
-loin. A partir du fichier IDL, le concepteur du composant développe une
-interface côté serveur pour faire communiquer le réseau (via CORBA) et l'objet
-interne. A partir du fichier IDL, le concepteur de chaque client développe
-une interface pour faire communiquer le réseau (via CORBA) et le code
-utilisateur du composant.
+Component with remote access (through CORBA)
+================================================
+Principle
+----------
+The interfaces necessary to “see” an internal object like a remote component are based on the definition of a “contract” that
+specifies the services proposed by a component and the mode of accessing these services (input and output parameters, exceptions returned).
+
+These declarations are contained in an **IDL file** that is used as a reference to define the interface code at the component end
+and at the clients end of the component. Examples are given later. The designer of the component starts from the IDL file and
+develops a server end interface to set up communication between the network (through CORBA) and the internal object.
+The designer of each client starts from the IDL file and develops an interface to set up communication between the
+network (through CORBA) and the component user code.
.. _figaccescorba2:
.. image:: images/accesCorbaIDL.png
- :width: 62ex
:align: center
- .. centered:: Accès depuis CORBA
-
+ .. centered:: Access from CORBA
-Fichier IDL
+IDL file
-----------
-
-La première étape consiste, pour le développeur du composant à définir dans un
-fichier dit fichier IDL, la liste des services proposés et leur mode d'appel.
-Ce fichier contient des déclarations de structures de données et des classes
-("interface" dans la terminologie CORBA) dans un langage défini par la norme
-CORBA (IDL). Un document de référence sur la syntaxe du langage IDL est `OMG
-IDL Syntax and Semantics <http://doc.ece.uci.edu/CORBA/formal/01-12-07.pdf>`_
-[IDL]_.
-
-**Remarque**
- Ce langage est proche d'un sous-ensemble des langages C++ et java.
- CORBA a défini son propre langage d'interface pour assurer la transparence par
- rapport aux langages d'implémentation des clients et serveurs. Un client
- écrit avec un langage de programmation peut se connecter à travers CORBA, à un
- serveur implémenté dans un autre langage. La seule condition est que l'on
- dispose de 2 ORB (ou systèmes) CORBA interfacés aux langages utilisés dans le
- serveur et le client. Pour de nombreux langages (C, C++, java, python, ...),
- il existe des ORB capables de les gérer. Au sein de Salomé, on a choisi un
- ORB unique, omniORB, qui permet d'utiliser des clients et des serveurs écrits
- indifféremment en C++ ou en python.
-
-
-Exemple 6 (1ère partie)
+The first step is for the component developer to define a list of proposed services and the method of calling them, in
+a file called the IDL file. This file contains data structures declarations and classes (“interface” in the CORBA terminology) in
+a language defined by the CORBA (IDL) standard.
+`OMG IDL Syntax and Semantics <http://doc.ece.uci.edu/CORBA/formal/01-12-07.pdf>`_ [IDL]_ is a reference document on the IDL language syntax.
+
+**Note**
+ This language is similar to a sub-set of the C++ and java languages. CORBA defined its own interface language to achieve
+ transparency relative to client and server implementation languages. A client written with a programming language can connect
+ through CORBA to a server implemented in another language. The only condition is that there are two CORBA ORBs (or systems)
+ interfaced with languages used in the server and the client. There are ORBs capable of managing many
+ languages (C, C++, java, python, etc.). A single ORB (omniORB) was chosen within SALOME, making it possible to use clients
+ and servers written in C++ or in python indifferently.
+
+Example 6 (Part 1)
^^^^^^^^^^^^^^^^^^^^^^^
-
-On construit un fichier IDL pour accéder depuis CORBA à des objets (C++) de la
-classe alglin (voir fichier ``alglin.hxx`` d'Exemple 1 et suivants).
-Le fichier IDL correspondant contiendra par exemple :
+An IDL file is written to access objects (C++) in the alglin class from CORBA (see the ``alglin.hxx`` file in Example 1 and
+other examples). The corresponding IDL file may for example contain:
.. _alglin.idl:
.. include:: ./exemples/exemple6/alglin.idl
:literal:
+**Comments**
-**Commentaires**
-
- #. Le fichier IDL commence par la ligne ``module Distant {``. Autant que
- possible, on conseille d'encadrer les déclarations d'interfaces dans un module.
-
- #. La classe ``vecteur`` de la version C++ n'a pas besoin d'être déclarée dans
- l'IDL. Le langage IDL possède en effet un type de base (``sequence <double>``)
- capable de gérer un vecteur simple.
+#. The IDL file begins with the ``module Distant {`` line. Whenever possible, it is recommended that interface declarations
+ should be contained within a module.
+#. The ``vecteur`` class of the C++ version does not have to be declared in IDL. The IDL language has a base type (``sequence <double>``)
+ that can manage a simple vector.
-
-Exemple 7 (1ère partie)
+Example 7 (Part 1)
^^^^^^^^^^^^^^^^^^^^^^^
-
-On construit un fichier IDL pour accéder depuis CORBA à des objets (python) de
-la classe FreeFem (voir ``FreeFem.py``, Exemple 4 et suivants) Le
-fichier IDL correspondant contiendra par exemple :
+An IDL file is constructed to access (python) objects in the FreeFem class from CORBA (see ``FreeFem.py``, Example 4 and
+subsequent examples). The corresponding IDL file may for example contain:
.. _freefem.idl:
:literal:
-Interface côté serveur
+Server end interface
----------------------
-
-A partir du fichier IDL, il faut développer une interface côté serveur. Le
-principe consiste à définir un objet communicant avec l'objet interne d'une
-part et avec la couche de communication CORBA d'autre part. L'écriture
-dépendra du langage d'implémentation de l'objet interne (C++ ou python).
-
+A server end interface has to be developed from the IDL file. The principle consists of defining an object communicating
+firstly with the internal object and secondly with the CORBA communication layer. It will be written in a manner that will
+depend on the implementation language of the internal object (C++ or python).
.. _interfacec++:
-Interface serveur C++
+C++ server interface
^^^^^^^^^^^^^^^^^^^^^
-
.. image:: images/objCorbaCpp.png
- :width: 61ex
:align: center
-.. centered:: Génération d'interface C++ CORBA
-
-Lorsque l'objet interne est écrit en C++ (ou possède une couche supérieure
-C++), il faut définir une classe d'implémentation C++ côté serveur qui
-
-* dérive de la classe ``POA_<nom module>::<nom classe idl>`` (classe générée
- par le système à partir du fichier IDL),
-
-* dérive de la classe ``PortableServer::RefCountServantBase`` (classe fournie
- par le système, qui muni la classe d'implémentation d'un compteur de
- référence),
+.. centered:: CORBA C++ interface generation
-* définit des méthodes correspondant aux méthodes et attributs de la classe
- IDL,
+When the internal object is written in C++ (or it has a C++ higher layer), a C++ implementation class will have to be
+defined at the server end that
-* possède en attribut un pointeur vers l'objet interne.
+- is derived from the ``POA_<module name>::<idl class name>`` class (class generated by the system starting from the IDL file)
+- is derived from the ``PortableServer::ServantBase`` class (class provided by the system, that provides a reference
+ counter to the implementation class)
+- defines methods corresponding to the methods and attributes of the IDL class
+- has a pointer to the internal object as an attribute.
-**Remarque**
- Le dernier point ci-dessus peut être remplacé par :
+**Note**
+ The final point above can be replaced by:
.. epigraph::
- dérive de la classe de l'objet interne.
+ is derived from the class of the internal object
- On conseille plutôt la première version qui est plus simple à mettre en oeuvre.
+ The first version is recommended in preference, because it is easier to implement.
+**Important**: Most CORBA implementations can generate skeletons of implementation classes. It is strongly recommended
+that this feature should be used to facilitate writing implementation classes.
-**Important** : La plupart des implémentations CORBA peuvent générer des squelettes de classes
-d'implémentations. On conseille vivement d'utiliser cette possibilité pour
-faciliter l'écriture des classes d'implémentation.
-
-Dans le cas d'omniORB, la commande ::
+In the case of omniORB::
omniidl -bcxx -Wbexample <nom>.idl
-(remarquer l'option -Wbexample) génère un fichier ``<nom>_i.cc`` qui contient
-la classe d'implémentation et un exemple de programme principal côté serveur.
-Il faut alors "nettoyer" ce fichier (en conservant les prototypes d'appel des
-méthodes) et le compléter. Les méthodes des classes d'implémentation
-reçoivent et renvoient des objets CORBA. Il faut donc, si nécessaire, que
-chaque méthode :
-
-* convertisse les objets CORBA en entrée en objets (ou en type simples) C++
-
-* appelle la (ou les) méthodes de l'objet interne
-
-* convertisse les objets C++, résultats des méthodes de l'objet interne en
- objets CORBA
+(note the –Wbexample option) generates a ``<name>_i.cc`` file that contains the implementation class and an example of
+the main program at the server end. This file then has to be “cleaned” (keeping the method call prototypes) and completed.
+Methods for implementation classes receive and return CORBA objects. Therefore, if necessary, each method must:
+- convert CORBA objects in input into C++ objects (or into simple types)
+- call the method(s) of the internal object
+- convert the C++ objects resulting from the methods of the internal object into CORBA objects
.. _implc++:
-Exemple 6 (suite)
-^^^^^^^^^^^^^^^^^
-
-Donnons comme exemple, une classe d'implémentation côté serveur qui permette
-d'appeler depuis CORBA les objets de la classe ``alglin`` :
+Example 6 (continued)
+^^^^^^^^^^^^^^^^^^^^^^^
+Consider an example consisting of a server end implementation class that calls objects in the ``alglin`` class from CORBA:
.. _alglini.hxx:
.. include:: ./exemples/exemple6/alglin_i.cxx
:literal:
-**Remarque**
- Notons que les fonctions ``create_vector`` et ``destroy_vector`` ne sont pas
- exportées dans l'IDL, puisqu'on utilise un type CORBA standard
- (``sequence<double>``.
+**Note**
+ Note that the ``create_vector`` and ``destroy_vector`` functions are not exported in IDL, because a standard CORBA type
+ is used (``sequence<double>``).
-Interface serveur python
+Python server interface
^^^^^^^^^^^^^^^^^^^^^^^^
-
-Ce cas est similaire au précédent. Il peut
-être plus simple (il n'est pas toujours nécessaire d'inclure les phases de
-conversion des paramètres d'entrée et de sortie).
+This case is similar to the previous case. It can be simpler (it is not always necessary to include input and output
+parameter conversion phases).
.. _interfacepython:
.. image:: images/objCorbapy.png
- :width: 61ex
:align: center
- .. centered:: Génération d'interface python CORBA
-
+ .. centered:: Generation of the python CORBA interface
-**Remarque**
- Ceci est dû au fait que python est moins fortement typé que C++ : une fonction
- python peut s'exécuter si les paramètres d'entrée possèdent toutes les méthodes
- et attributs appelés dans la fonction. C'est le cas, si les méthodes de la
- classe d'implémentation ont les mêmes signatures que des méthodes de la classe
- de l'objet interne, comme dans l'exemple 7 ci-après.
+**Note**
+ This is due to the fact that python is not as strongly typed as C++: a python function can be executed if the input parameters
+ possess all methods and attributes called in the function. This is the case if the methods in the implementation class have
+ the same signatures as methods in the internal object class, as in example 7 below.
-Exemple 7 (suite)
-^^^^^^^^^^^^^^^^^
-
-Donnons comme exemple, une classe d'implémentation python côté serveur qui
-permette d'appeler depuis CORBA les objets de la classe ``FreeFem`` :
+Example 7 (continued)
+^^^^^^^^^^^^^^^^^^^^^^^^^
+We will consider an example consisting of the python implementation class at the server end used to call objects in
+the ``FreeFem`` class from CORBA:
.. _freefemi.py:
.. include:: ./exemples/exemple7/FreeFem_i.py
:literal:
-
-Interface client
+Client interface
----------------
+The client end interface code can be written in any language (provided that there is a CORBA implementation in this
+language), independently of the language(s) used at the server end.
-Le code d'interface côté client peut être écrit dans n'importe quel langage
-(pourvu que l'on dispose d'une implémentation CORBA dans ce langage),
-indépendamment du ou des langages utilisés côté serveur.
-
-Essentiellement, il faut :
-
-* lors de la compilation, faire générer l'interface CORBA côté client (en
- général, CORBA génère simultanément les 2 interfaces côté client et serveur) et
- l'intégrer dans le code client,
+Essentially, it is necessary:
-* lors de l'exécution, récupérer la référence CORBA du composant côté serveur,
+- during compilation, to have the CORBA interface generated at the client end (generally, CORBA generates the two
+ interfaces at the client and server ends simultaneously) and to integrate it into the client code,
+- during execution, retrieve the CORBA reference of the server end component,
+- call component methods on this CORBA reference.
-* appeler sur cette référence CORBA, les méthodes du composant.
-
-
-Exemple 8
+Example 8
^^^^^^^^^
-
-Dans le cadre de Salomé, l'écriture de clients n'est pas nécessaire pour les
-composants utilisateur. Donnons cependant un exemple de client C++ et un
-exemple de client python de la classe CORBA AlgLin :
-
+In the context of SALOME, there is no need to write clients for user components. However, consider a C++ client example
+and a python client example in the CORBA AlgLin class:
``client.cxx``
.. _secacceslocal:
-Composant à accès local
-=======================
-
-
-Principe
---------
-
-Comme indiqué au chapitre :ref:`secetapes`,
-l'objet interne construit au chapitre :ref:`seccompinterne`
-peut être manipulé depuis un interpréteur python
-local, suivant le schéma ci-après.
+Component with local access
+==============================
+Principle
+-------------
+As mentioned in the :ref:`secetapes` chapter, the internal object built in the :ref:`seccompinterne` chapter can be manipulated
+from a local python interpreter according to the following scheme.
.. _figacceslocal2:
.. image:: images/accesLocal.png
- :width: 46ex
:align: center
-.. centered:: Accès depuis un interpréteur python local
-
-Dans le cas d'un objet interne C++, il faudra écrire une interface python-C++
-pour obtenir un composant local. L'écriture de cette interface fera l'objet de
-la section suivante. Dans le cas d'un objet interne python, il n'y a rien à
-faire : l'objet interne python peut être utilisé tel quel comme composant
-local.
-
-
-A partir d'un objet interne python
-----------------------------------
+.. centered:: Access from a local python interpreter
-Si l'objet interne est implémenté comme objet python, il n'est pas nécessaire
-d'introduire une interface supplémentaire.
+In the case of a C++ internal object, a python/ C++ interface has to be written to obtain a local component.
+The next section describes how this interface is written. Nothing needs to be done in the case of a python internal
+object: the python internal object can be used as a local component.
+Starting from a python internal object
+------------------------------------------
+There is no need to introduce an additional interface if the internal object is implemented as a python object.
-A partir d'un objet interne C++
--------------------------------
+Starting from a C++ internal object
+------------------------------------------
+A python/C++ interface has to be used before a C++ object can be used from a python interpreter. This interface can be
+coded by the integrator or it can be generated (semi-) automatically using tools such as swig [SWIG]_ or boost [BOOST]_.
+This document describes how the interface is generated using swig, through a simple example. Refer to the swig
+documentation, or even the python documentation, for processing of special cases.
-Pour pouvoir utiliser un objet C++ à partir d'un interpréteur python, il faut
-passer par une interface python/C++. Cette interface peut être codée par
-l'intégrateur ou être générée (semi-) automatiquement à l'aide d'outils tels
-que swig [SWIG]_ ou boost [BOOST]_. On envisagera ici la génération de
-l'interface à l'aide de swig, à l'aide d'un exemple simple. Pour le traitement
-de cas particuliers, on renvoit à la documentation de swig, voire à la
-documentation de python.
-
-
-Fichier d'interface swig
+Swig interface file
^^^^^^^^^^^^^^^^^^^^^^^^
-
-La procédure standard pour utiliser swig est d'écrire un **fichier d'interface**
-(se terminant par ``.i``). Ce fichier d'interface ressemble fortement à une
-fichier d'interface C++ (voir par exemple ``vecteur.hxx`` ou
-``FreeFem.hxx``). Il contient toutes les déclarations C++
-(structures, fonctions, classes, constantes, ...) que l'intégrateur veut
-"exporter" au niveau python. Dans le cas des classes C++, seule la partie
-publique des classes peut être indiquée dans le fichier d'interface. Des
-exemples seront donnés plus loin.
-
-
-Processus de génération du code de l'interface C++/python
+The standard procedure to use swig is to write an **interface file** (terminating with ``.i``). This interface file
+is very similar to a C++ interface file (for example see ``vecteur.hxx`` or ``FreeFem.hxx``). It contains all C++
+declarations (structures, functions, classes, constants, etc.) that the integrator wants to “export” to the python level.
+Only the public part of classes can be indicated in the interface file for C++ classes. Examples will be given later.
+
+Process for generating the C++ / python interface code
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+**Rule**
+ Extensions to the python language written in the C / C++ / f77 language (compiled languages other than python) must be compiled
+ in the form of dynamic libraries (``.so`` under unix, ``.dll`` under windows). These extensions will be loaded from the python
+ interpreter using the import command.
-**Règle**
- Les extensions au langage python, écrites en langage C/C++/f77 (langages
- compilés autres que python), doivent être compilées sous forme de librairies
- dynamiques (``.so`` sous unix, ``.dll`` sous windows). Depuis l'interpréteur
- python, on chargera ces extensions au moyen de la commande ``import``.
-
-Tous les composants à intégrer seront donc compilés sous forme de librairie
-dynamique, ce qui impliquera une procédure particulière pour l'utilisation des
-outils de débogages (voir plus loin). Les différentes opérations à effectuer
-et les fichiers intervenant dans le processus sont schématisés par la figure
-suivante.
+Therefore, all components to be integrated will be compiled in the form of a dynamic library, which will mean a particular
+procedure for the use of debugging tools (see below). The various operations to be carried out and the files involved in the
+process are shown diagrammatically on the following figure.
.. _processusswig:
.. image:: images/accesLocalCpp.png
- :width: 45ex
:align: center
-.. centered:: Interface via swig
-
+.. centered:: Interface through swig
-Exemple 5 (première version)
+Example 5 (first version)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+If it is required to access the ``alglin`` class from a local python interpreter, an interface file will be written with type:
-Si on veut accéder depuis un interpréteur python local à la classe ``alglin``,
-on écrira un fichier d'interface du type :
.. _alglin.i.v1:
.. include:: ./exemples/exemple5/v1/alglin.i
:literal:
-Les différentes lignes signifient : ::
+The different lines mean::
%module AlgLinModule
-Définit le nom du module python. Pour importer les définitions du composant
-depuis un interpréteur python, on écrira : ``import AlgLinModule``. ::
+Defines the name of the python module. We will write ``import AlgLinModule``, to import the definitions of the component
+from a python interpreter. ::
%{
#include "alglin.hxx"
%}
-Entre les lignes ``%{`` et ``%}``, on indique les déclarations C++ dont le code
-de l'interface C++/python aura besoin (sinon le fichier C++ généré par swig ne
-compilera pas). Typiquement, on inclut ici le fichier d'interface de l'objet
-interne C++ construit au chapitre précédent. ::
+The C++ declarations that the C++ / python interface code will need will have to be written between the ``%{`` and ``%}``
+lines (otherwise the C++ file generated by swig will not compile). Typically, the interface file of the C++ internal
+object constructed in the previous chapter will be included here.
+
+::
class alglin {
public:
};
-On indique dans le reste du fichier ``alglin.i``, les classes et définitions
-que l'on désire exporter vers l'interpréteur python. Exemple d'usage de
-l'interface générée :
-
+The remainder of the ``alglin.i``. file includes an indication about the classes and definitions that are to be
+exported to the python interpreter. Example use of the generated interface:
.. include:: ./exemples/exemple5/v1/sortie.txt
:literal:
-**Remarques**
-
- #. Par rapport à la déclaration de la classe C++ (fichier ``alglin.hxx``), on a
- introduit un constructeur (``alglin()``) et un destructeur (``~alglin()``).
- Dans la classe C++ de l'objet interne, ces constructeur et destructeur ne sont
- pas nécessaires (l'objet interne n'a pas besoin d'être initialisé à sa création
- et ne gère pas de mémoire dynamique C++). Le compilateur fournit un
- constructeur et un destructeur par défaut dans ce cas. Pour le fichier
- d'interface swig, par contre, **il faut** déclarer explicitement un
- constructeur et un destructeur pour que python puisse gérer correctement la
- mémoire C++ (i.e. quand un objet python est créé/détruit, l'objet C++ interne
- soit aussi créé/détruit "proprement").
-
- #. Remarquer que dans le fichier d'interface ``alglin.i``, on n'explicite pas
- la définition de la structure/classe ``vecteur``. Les objets de type
- ``vecteur`` seront vus depuis l'interpréteur python comme des objets "boîte
- noire" (on connait leur type et leur emplacement mémoire mais pas les
- méthodes/attributs associés). Si on essaie d'appeler une méthode sur un objet
- vecteur, on obtient le message d'erreur suivant :
-
+**Notes**
+
+ #. A constructor (``alglin()`` ) and a destructor (``~alglin()`` ) have been introduced that were not in the declaration of
+ the C++ class (file ``alglin.hxx``). This constructor and this destructor are not necessary in the C++ class of the internal
+ object (the internal object does not need to be initialised when it is created and does not manage the C++ dynamic memory).
+ In this case, the compiler provides a default constructor and destructor. On the other hand, a constructor and a destructor
+ **must be** explicitly declared for the swig interface file so that python can manage the C++ memory correctly (i.e. the internal
+ C++ object is also created / deleted “cleanly” when a python object is created / deleted).
+ #. Note that the definition of the ``vector`` structure/class is not explicitely described in the ``alglin.i`` interface file. ``Vector``
+ type objects will be seen from the python interpreter as “black box” objects (their type and memory location are known, but
+ associated methods / attributes are not known). The following error message will be produced if an attempt is made to call
+ a method on a vector object:
+
.. include:: ./exemples/exemple5/v1/sortie2.txt
:literal:
.. epigraph::
- La deuxième version de cet exemple (ci-après) corrigera ce problème.
+ The second version of this example (below) will correct this problem.
.. %
-Exemple 5 (deuxième version)
+Example 5 (second version)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+The first version of the example suffers from two defects (among others) concerning vector type objects:
-La première version de l'exemple souffre de deux défauts (parmi d'autres ...),
-concernant les objets de type vecteur :
+- there is no access to methods nor to attributes of objects in the vector class (see the second comment above)
+- nothing is provided to initialise/modify the coefficients contained in a vector object.
-* on n'a pas accès aux méthodes ni aux attributs d'objets de la classe vecteur
- (cf. la seconde remarque ci-dessus),
-
-* rien n'est prévu pour initialiser/modifier les coefficients contenus dans un
- objet vecteur.
-
-swig permet d'enrichir le fichier d'interface ``alglin.i``
-pour ajouter les fonctionnalités manquantes :
+Swig enriches the ``alglin.i`` interface file to add missing functions:
.. _alglin.i.v2:
.. include:: ./exemples/exemple5/v2/alglin.i
:literal:
-**Remarque**
- Par rapport à la version précédente, on a la déclaration de
- la classe vecteur, ce qui donne par exemple accès à la taille des vecteurs et à
- une "poignée" sur les coefficients (mais pas sur les coefficients
- individuellement). La troisième version corrigera ce défaut. Un exemple
- d'utilisation du composant (et de la limitation sur l'accès aux vecteurs) est :
+
+**Note**
+ Unlike the previous version, there is the declaration of the vector class, which for example provides access to the size of vectors
+ and to a “handle” to coefficients (but not to coefficients individually). The third version will correct this defect.
+ An example use of the component (and the limitation on access to vectors) is given below:
.. include:: ./exemples/exemple5/v2/sortie.txt
:literal:
-
-Exemple 5 (troisième version)
+Example 5 (third version)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+The second version of the example makes it possible to “see” vector type objects but only at the “surface”. In particular, there is
+no individual access to coefficients from the python interpreter. By adding utility functions (``__setitem__`` and ``__getitem__``)
+into the ``alglin.i`` interface, the third version makes it possible to (partially) simulate genuine coefficient vectors from the python layer.
-La deuxième version de l'exemple permet de "voir" les objets de type vecteur
-mais seulement en "surface". En particulier, on n'a pas accès aux coefficients
-individuellement depuis l'interpréteur python. La troisième version, en
-ajoutant dans l'interface ``alglin.i`` des fonctions utilitaires
-(``__setitem__`` et ``__getitem__``) permet de simuler (partiellement) depuis
-la couche python de véritables vecteurs de coefficients.
+**Note**: We have also added an ``__str__`` display function that displays the list of coefficients of v, when
+``print v`` is executed from the interpreter.
-**Remarque**
- On a aussi ajouté
- une fonction d'affichage\ ``__str__``, qui permet, quand on exécute ``print
- v`` depuis l'interpréteur, d'afficher la liste des coefficients de v.
.. _alglin.i.v3:
.. include:: ./exemples/exemple5/v3/alglin.i
:literal:
-Un exemple d'utilisation du composant (y compris l'accès aux vecteurs) est :
-
+The following contains an example use of the component (including access to vectors):
.. include:: ./exemples/exemple5/v3/sortie.txt
:literal:
.. _advancepy:
-Utilisation avancée de l'interface de programmation Python
+Advanced use of the Python programming interface
==========================================================================
-Passage d'objets Python entre noeuds de calcul
+Passing Python objects between calculation nodes
--------------------------------------------------
-Le modèle de données standard de YACS permet d'échanger un certain nombre de types
-de données (voir :ref:`datatypes`) qui sont limités aux types supportés par CORBA.
-Le langage Python permet de manipuler des types de données qui ne sont pas gérés par YACS.
-En particulier, le dictionnaire Python avec des types de données hétérogènes n'est pas géré
-par le modèle de données de YACS.
-
-Il est cependant possible d'échanger des dictionnaires python entre certains types de noeuds de calcul
-en utilisant des références d'objets avec un protocole non standard. Le protocole standard est
-le protocole IDL qui correspond à une sérialisation des données gérée par CORBA.
-Il existe deux autres protocoles (python et json) qui utilisent des mécanismes de sérialisation
-non CORBA qui supportent plus de types de données dont les dictionnaires.
-Le nom du protocole apparait dans la première partie du Repositiory ID du type (avant le premier :).
-
-Le protocole python
+The YACS standard data model is used to exchange a number of data types (see :ref:`datatypes`) that are limited to
+types supported by CORBA. The Python language allows to manipulate data types that are not managed by YACS.
+In particular, the Python dictionary with heterogeneous data types is not managed by the YACS data model.
+
+However, Python dictionaries can be exchanged between some types of calculation nodes by using object references with
+a non-standard protocol. The standard protocol is the IDL protocol that corresponds to serialisation of data
+managed by CORBA. There are two other protocols (python and json) that use non-CORBA serialisation mechanisms
+that support more data types including dictionaries.
+The protocol name appears in the first part of the type Repository ID (before the first :).
+
+The Python protocol
++++++++++++++++++++++
-Le protocole python s'appuie sur une sérialisation faite par le module cPickle (implémentation C
-du module pickle).
-Il suffit de définir un type référence d'objet avec le protocole python pour pouvoir échanger
-des objets python entre noeuds inline python et avec des composants SALOME implémentés en python.
-Les composants SALOME implémentés en python qui veulent supporter ce type d'échange doivent être
-conçus pour recevoir une chaine de caractères qui contient l'objet sérialisé. La désérialisation
-de l'objet reste à la charge du composant. Dans l'autre sens, la sérialisation est à la charge
-du composant qui doit retourner une chaine de caractères pour ce type d'objet.
+The Python protocol is based on serialisation done by the cPickle module (C implementation of the pickle module).
+All that is necessary is to define an object reference type with the Python protocol so that Python objects
+can be exchanged between Python inline nodes and with SALOME components implemented in Python.
+SALOME components implemented in Python that are required to support this exchange type must be designed
+to receive a character string that contains the serialised object. The component is responsible for deserialising the object.
+In the other direction, the component is responsible for serialising the object and must return a character string
+for this object type.
-Définition du type "objet python"::
+Definition of the “Python object” type::
tc1=p.createInterfaceTc("python:obj:1.0","PyObj",[])
-Définition de deux noeuds Python qui utilisent ce type::
+Definition of two Python nodes that use this type::
n2=r.createScriptNode("","node2")
p.edAddChild(n2)
p.edAddChild(n3)
p.edAddDFLink(n2.getOutputPort("p1"),n3.getInputPort("p1"))
-Définition d'un noeud de service SALOME qui utilise ce type::
+Definition of a SALOME service node that uses this type::
n1=r.createCompoNode("","node1")
n1.setRef("compo1")
p.edAddChild(n1)
p.edAddDFLink(n2.getOutputPort("p1"),n1.getInputPort("p1"))
-L'implémentation du composant compo1 doit prendre en charge la sérialisation/désérialisation
-comme dans l'exemple de la méthode run qui suit::
+The implementation of component compo1 must handle serialisation / deserialisation in the same
+way as the example in the run method described below::
def run(self,s):
o=cPickle.loads(s)
ret={'a':6, 'b':[1,2,3]}
return cPickle.dumps(ret,-1)
-Le protocole json
+The json protocol
++++++++++++++++++++++
-Le protocole json s'appuie sur la sérialisation/désérialisation `JSON <http://www.json.org/>`_
-(JavaScript Object Notation) à la place de cPickle. json supporte moins de types de données
-et nécessite l'installation du module python simplejson mais il a l'avantage d'être
-plus interopérable. En particulier, il existe des librairies C++ qui sérialisent/désérialisent
-du JSON.
+The json protocol is based on `JSON <http://www.json.org/>`_ (JavaScript Object Notation)
+serialisation / deserialisation instead of cPickle. JSON supports fewer data types and requires that
+the simplejson Python module should be installed, but it has the advantage that it is more interoperable.
+In particular, there are C++ libraries that serialise/deserialise the JSON.
-Pour utiliser ce protocole dans YACS, il suffit de remplacer python par json dans la définition
-du type. Par exemple::
+All that is necessary to use this protocol in YACS is to replace python by json in the type definition. For example::
tc1=p.createInterfaceTc("json:obj:1.0","PyObj",[])
-Le reste est identique sauf l'implémentation du composant qui devient en reprenant l'exemple
-ci-dessus::
+The rest is identical, except for implementation of the component that is as follows, using the same example as above::
def run(self,s):
o=simplejson.loads(s)
ret={'a':6, 'b':[1,2,3]}
return simplejson.dumps(ret)
-Définition de composants Python inline
+Definition of inline Python components
--------------------------------------------------
-Normalement, un composant SALOME Python doit être développé en dehors de YACS soit
-à la main soit en utilisant un générateur de module SALOME comme :ref:`yacsgen`.
-Il est possible de définir un composant SALOME implémenté en Python directement
-dans un script python. Ce type de composant peut être utile dans les phases de test,
-par exemple.
+Normally, a Python SALOME component must be developed outside YACS, either manually or using a SALOME module generator
+such as :ref:`yacsgen`.
+A SALOME component implemented in Python can be defined directly in a Python script. This type of component
+can be useful in test phases, for example.
-La première étape consiste à compiler l'interface IDL directement dans le script python
-ce qui a pour effet de créer les modules Python CORBA nécessaires. Par exemple, voici
-comment on produit les modules CORBA compo1 et compo1__POA qui contiennent l'interface
-base avec une seule méthode run::
+The first step consists of compiling the IDL Interface directly in the Python script, which has the effect of
+creating the necessary CORBA Python modules. For example, the following shows how CORBA modules compo1 and compo1_POA
+are produced that contain the basic interface with a single run method::
idlcompo="""
#include "DSC_Engines.idl"
};
};
"""
- m=omniORB.importIDLString(idlcompo,["-I/local/chris/SALOME2/RELEASES/Install/KERNEL_V4_0/idl/salome"])
+ m=omniORB.importIDLString(idlcompo,
+ ["-I/local/chris/SALOME/Install/KERNEL_V5/idl/salome"])
-La deuxième étape consiste à définir le corps du composant compo1 et donc de sa méthode run.
+The second step consists of defining the body of component compo1 and therefore its run method.
-Voici un exemple de définition faite dans le corps du script Python::
+The following is an example definition made in the body of the Python script::
import compo1
import compo1__POA
class compo(compo1__POA.base,dsccalcium.PyDSCComponent):
def run(self,s):
print "+++++++++++run+++++++++++",s
- return "Bien recu"+s
+ return "received "+s
compo1.compo1=compo
-Ce qui est important ici, c'est que SALOME trouve dans le module compo1, la classe de même nom
-qui représente le composant (d'où la dernière ligne).
+The important point here is that SALOME finds the class with the same name that represents the component
+in module compo1 (which is why there is the last line).
-La troisième étape consiste à définir un container SALOME local au script car ce composant n'a
-d'existence que dans le script. La définition d'un container de nom "MyContainerPy" se fera
-comme suit::
+The third step consists of defining a SALOME container local to the script because this component
+only exists in the script. The container name “MyContainerPy” will be defined as follows::
from omniORB import CORBA
from SALOME_ContainerPy import SALOME_ContainerPy_i
poaManager.activate()
cpy_i = SALOME_ContainerPy_i(orb, poa, "MyContainerPy")
-en prenant bien garde à activer CORBA avec poaManager.activate().
+taking care to activate CORBA with poaManager.activate().
+
+All that is necessary afterwards is to create a YACS container and to place a SALOME node in it, in the same
+way as for a standard component.
-Ensuite, il ne reste plus qu'à créer un container YACS et à y placer un noeud SALOME
-comme pour un composant standard.
-Annexe : traitement des commons fortran et variables globales C/C++
-===================================================================
-
-
-Common fortran
+Appendix: processing of fortran commons and C / C++ global variables
+========================================================================
+Fortran common
--------------
-
-Cette section résulte de réflexions menées par Marc Boucker, Alexandre Douce,
-Céline Béchaud et l'auteur (pour plus de détails, voir [COMMON]_). On ne prétend
-pas ici présenter un état complet des situations possibles. Les codes
-fortran 77 que l'on veut commander depuis l'interpréteur python ou depuis
-Corba/Salomé, définissent souvent des zones mémoires partagées entre les
-différentes fonctions fortran, appelées "common". Exemple : Les fonctions
-``f1`` et ``f2`` utilisent la même zone mémoire ``a`` dans le common ``C``.
+This section is the result of studies carried out by Marc Boucker, Alexandre Douce, Céline Béchaud and Marc Tajchman
+(for further details, see [COMMON]_). We do not aim to present a complete state of possible situations in this description.
+The fortran 77 codes that are to be controlled from the python interpreter or from Corba / SALOME often define memory zones
+shared between the different fortran functions, called “common”.
+For example, functions ``f1`` and ``f2`` use the same memory zone ``a`` in common ``C``.
.. _f1:
.. include:: ./exemples/exemple11/v1/f2.f
:literal:
-Si les deux fonctions sont contenues dans le même composant et le common ``C``
-n'est pas utilisé par des fonctions d'autres composants, le common n'est pas
-visible de l'extérieur du composant et "tout se passe bien" (voir figure
-:ref:`Utilisation d'un common dans un composant <figcommon0>`). Si le concepteur du composant veut permettre la lecture
-et/ou l'écriture du common depuis la couche python et/ou CORBA, il pourra
-écrire facilement des fonctions d'accès (par exemple fonctions ``setCommon`` et
-``getCommon`` dans l'exemple ci-après).
-
+If the two functions are contained in the same component and common ``C`` is not used by functions of other components, the
+common is not visible from outside the component and “everything takes place properly” (see
+figure :ref:`Using a common in a component <figcommon0>`). If the component designer wants to allow common to be read or
+written from the python and/or CORBA layer, he will easily be able to write access functions (for example ``setCommon`` and
+``getCommon`` functions in the following example).
``common.f``
.. image:: images/common0.png
- :width: 34ex
:align: center
-.. centered::
- Utilisation d'un common dans un composant
+.. centered:: Using a common in a component
-On donne ici un exemple d'encapsulation dans C++, puis dans python (via swig) :
+The following is an example encapsulation in C++, then in python (through swig):
``f.hxx``
.. include:: ./exemples/exemple11/v1/modf.i
:literal:
-Un exemple d'utilisation :
-
+A practical example:
.. include:: ./exemples/exemple11/v1/resultats.txt
:literal:
-Si le common ``C`` est utilisé dans plusieurs librairies dynamiques, la gestion
-est plus délicate. De façon générale, on ne peut pas supposer que le common
-utilisé par chacune des librairies est situé à la méme adresse mémoire. Il y
-a deux situations types que l'on peut rencontrer :
+If common ``C`` is used in several dynamic libraries, management is more difficult. In general, it is impossible
+to assume that the common used by each library is located at the same memory address. There are two typical
+situations that can arise:
-#. Les deux composants sont montés localement depuis un même interpréteur
- python :
+#. The two components are installed locally from the same python interpreter:
.. _figcommon1:
.. image:: images/common1.png
- :width: 42ex
:align: center
- .. centered::
- Utilisation d'un common partagé entre deux librairies - version locale
+ .. centered:: Using a common shared between two libraries – Local version
+
-#. Les deux composants sont montés dans des espaces mémoire différents (sur la
- même machine ou des machines différentes) via le mécanisme Salomé (conteneurs)
- :
+#. The two components are installed in different memory zones (on the same machine or on different machines) through
+ the SALOME mechanism (containers):
.. _figcommon2:
.. image:: images/common2.png
- :width: 47ex
:align: center
- .. centered::
- Utilisation d'un common partagé entre deux librairies - version distribuée
-
-Dans les deux cas, il faut prévoir des fonctions de synchronisation (par
-exemple en utilisant les fonctions de lecture/écriture des commons depuis la
-couche de commande python et/ou Salomé). L'adaptation au cas des deux
-composants locaux chargés depuis un interpréteur python s'écrit :
-
-#. Pour le premier composant :
+ .. centered:: Using a common shared between two libraries – distributed version
+Synchronization functions are necessary in both cases (for example using functions to read / write commons
+from the python and/or SALOME command layer). The adaptation to the case of two local components loaded from a
+python interpreter is written as follows:
+
+#. For the first component:
``f1.hxx``
.. include:: ./exemples/exemple11/v2/modf1.i
:literal:
-#. Pour le second composant :
-
+#. For the second component:
``f2.hxx``
.. include:: ./exemples/exemple11/v2/modf2.i
:literal:
-#. Les fonctions de lecture d'écriture du common seront incorporées dans chaque
- composant.
+#. Read and write functions for the common will be included in each component.
-Un exemple d'utilisation
+
+A practical example
.. include:: ./exemples/exemple11/v2/resultats.txt
:literal:
-En résumé, si un code existant comportant des commons doit être découpé en
-plusieurs composants, on peut soit :
-
-* modifier le code en enlevant les commons et en faisant transiter les
- informations via les listes de paramètres des fonctions;
+In summary, if an existing code comprising commons has to be broken down into several components, it is possible to either:
-* écrire des fonctions d'accès en lecture/écriture aux commons et utiliser ces
- fonctions de lecture/écriture depuis les couches supérieures aux composant de
- façon à synchroniser les état internes des différents composants.
+- modify the code by removing the commons and transferring information through lists of function parameters;
+- write functions to provide read/write access to the commons and use these read/write functions from layers higher
+ than components, so as to synchronize the internal states of the different components.
+
+The first solution requires that in-depth action is taken in the fortran code, while the second requires that the
+user explicitely synchronises commons in the different components. It is strongly recommended that commons should not be
+used in new fortran codes.
-La première solution demande d'intervenir en profondeur dans le code fortran,
-la seconde exige que l'utilisateur synchronise explicitement les commons dans
-les différents composants. En ce qui concerne les nouveaux codes fortran, on
-déconseille vivement l'utilisation des commons.
-
-
-Variables globales C/C++
+C/C++ global variables
------------------------
-
-La situation est analogue au cas des commons : chaque composant aura son propre
-jeu de variables globales. Il faudra d'une façon ou d'une autre assurer la
-cohérence de ces différents jeux de variables.
+The situation is similar to the case of commons: each component will have its own set of global variables.
+A method is necessary to assure that these different sets of variables are consistant.
+++ /dev/null
-/*! \page bases Base classes
-
-\section toc Table of contents
-
- - \ref bases_intro
-
-
-\section bases_intro Introduction
-
-\code
-
-\endcode
-
-*/
.. _batch:
-Lancement d'une application Salomé dans un gestionnaire de Batch
+Starting a SALOME application in a batch manager
================================================================
-Cette section explique comment utiliser Salomé avec les gestionnaires
-de batch qui sont utilisés dans l'exploitation de clusteurs.
-L'objectif est de lancer une application Salomé avec un script de commande sur un clusteur à partir
-d'une session Salomé lancée sur la machine personnelle de l'utilisateur. Le script
-contient la tâche que l'utilisateur veut que Salomé exécute. Il s'agit le plus souvent
-du lancement d'un schéma YACS.
-
-Principes
----------
-
-Le principe du lancement est le suivant: depuis une première session Salomé, une application
-Salomé est lancée sur le clusteur par le biais du gestionnaire de batch. Il y a donc deux
-installations de Salomé: une sur la machine de l'utilisateur et une autre sur le clusteur.
-Sur le clusteur, l'utilisateur doit avoir un compte, y avoir accès en lecture/écriture. De plus, il doit
-avoir configuré correctement le protocole de connexion depuis son poste, qu'il utilise rsh ou ssh.
-
-La suite de ce chapitre détaille les différentes étapes du lancement. Tout d'abord, une application Salomé
-est lancée sur la machine de l'utilisateur avec un fichier CatalogResources.xml contenant la description
-de la machine batch visée (voir :ref:`catalogresources_batch`). Ensuite, l'utilisateur appelle le service de Salomé pour
-le lancement sur machine batch. Pour cela, l'utilisateur décrit les fichiers d'entrées et de sorties de l'application
-Salomé lancée en batch ainsi que du script python à lancer (voir :ref:`service_launcher`). Ce service
-lance ensuite l'application Salomé définit dans le fichier CatalogResources.xml sur la machine batch et
-exécute le fichier de commande python (voir :ref:`salome_clusteur_batch`).
+This section explains how SALOME is used with batch managers used in the operation of clusters.
+The objective is to run a SALOME application with a command script on a cluster starting from a
+SALOME session running on the user's personal machine. The script contains the task that the user
+wants SALOME to execute. The most usual task is to start a YACS scheme.
+
+Principles
+-----------
+The start principle is as follows: starting from a first SALOME session, a SALOME application is started
+on a cluster using the batch manager. Therefore there are two SALOME installations: one on the user’s machine
+and the other on the cluster. The user must have an account on the cluster, and must have a read/write access to it.
+He must also have correctly configured the connection protocol from his own station, regardless of whether he uses rsh or ssh.
+
+The remainder of this chapter describes the different run steps. Firstly, a SALOME application is run on
+the user’s machine using a CatalogResources.xml file containing the description of the target batch
+machine (see :ref:`catalogresources_batch`). The user then calls the SALOME service to run it on the batch machine.
+The user does this by describing input and output files for the SALOME application running in batch
+and for the Python script to be run (see :ref:`service_launcher`). This service then starts the SALOME
+application defined in the CatalogResources.xml file on the batch machine and executes the Python
+command file (see :ref:`salome_clusteur_batch`).
.. _catalogresources_batch:
-Description du clusteur par le biais du fichier CatalogResources.xml
+Description of the cluster using the CatalogResource.xml file
--------------------------------------------------------------------
-Le fichier CatalogResources.xml contient la description des différentes ressources de calcul (machines)
-distribuées que Salomé peut utiliser pour lancer ses containers. Il peut aussi contenir la description de
-clusteurs administrés par des gestionnaires de batch.
+The CatalogResources.xml file contains the description of the different distributed calculation
+resources (machines) that SALOME can use to launch its containers. It can also contain the description
+of clusters administered by batch managers.
-Voici un exemple de description d'un clusteur:
+The following is an example of description of a cluster:
-::
+.. code-block:: xml
<machine hostname="clusteur1"
alias="frontal.com"
appliPath="/home/user/applis/batch_exemples"
batchQueue="mpi1G_5mn_4p"
userCommands="ulimit -s 8192"
- preReqFilePath="/home/ribes/SALOME4/env-prerequis.sh"
+ preReqFilePath="/home/ribes/SALOME5/env-prerequis.sh"
OS="LINUX"
CPUFreqMHz="2800"
memInMB="4096"
nbOfNodes="101"
nbOfProcPerNode="2"/>
-Voici la description des différents champs utilisés dans un lancement batch:
-
-- **hostname**: nomme le clusteur pour les commandes de Salomé. Attention, ce nom n'est pas
- utilisé pour identifier le frontal du clusteur.
-- **alias**: nomme le frontal du clusteur. Ce nom de machine doit être atteignable par le protocole
- définit dans le fichier. C'est cette machine qui sera utilisé pour lancer la session batch.
-- **protocol**: fixe le protocole de connexion entre la session utilisateur et le frontal du clusteur.
- Choix possibles: **rsh** ou **ssh**.
-- **userName**: nom de l'utilisateur sur le clusteur.
-- **mode**: identifie la description de la machine comme un clusteur géré par un batch.
- Choix possibles: **interactive** ou **batch**. Pour que la machine soit prise en compte comme étant un clusteur
- avec un gestionnaire de batch, il faut choisir l'option **batch**.
-- **batch**: identifie le gestionnaire de batch. Choix possibles: **pbs**, **lsf** ou **sge**.
-- **mpi**: Salomé utilise **mpi** pour lancer la session Salomé et les containers sur les différents noeuds
- de calcul alloués par le gestionnaire de batch. Choix possibles: **lam**, **mpich1**, **mpich2**, **openmpi**,
- **slurm** ou **prun**. Il faut noter que certains gestionnaires de batch remplacent le lanceur de mpi
- par leur propre lanceur pour la gestion des ressources, d'où les options **slurm** et **prun**.
-- **appliPath**: contient le chemin de l'application Salomé préalablement installée sur le clusteur.
-
-Il existe deux champs optionnels qui peuvent être utiles selon la configuration des clusteurs:
-
-- **batchQueue**: spécifie la queue du gestionnaire de batch à utiliser.
-- **userCommands**: permet d'insérer du code **sh** lors du lancement de Salomé. Ce code est exécuté sur tous
- les noeuds.
-
+The following is the description of the different fields used when launching a batch:
+ - **hostname**: names the cluster for SALOME commands. Warning, this name is not used to identify the cluster front end.
+ - **alias**: names the cluster front end. It must be possible to reach this machine name using the protocol
+ defined in the file. This is the machine that will be used to start the batch session.
+ - **protocol**: fixes the connection protocol between the user session and the cluster front end.
+ The possible choices are rsh or ssh.
+ - **userName**: user name on the cluster.
+ - **mode**: identifies the description of the machine as a cluster managed by a batch. The possible choices are
+ interactive and batch. The batch option must be chosen for the machine to be accepted as a cluster with a batch manager.
+ - **batch**: identifies the batch manager. Possible choices are: pbs, lsf or sge.
+ - **mpi**: SALOME uses mpi to Start the SALOME session and containers on different calculation nodes allocated
+ by the batch manager. Possible choices are lam, mpich1, mpich2, openmpi, slurm and prun. Note that some
+ batch managers replace the mpi launcher with their own launcher for management of resources, which is the
+ reason for the slurm and prun options.
+ - **appliPath**: contains the path of the SALOME application previously installed on the cluster.
+
+There are two optional fields that can be useful depending on the configuration of clusters.
+ - **batchQueue**: specifies the queue of the batch manager to be used
+ - **userCommands**: to insert the sh code when SALOME is started. This code is executed on all nodes.
.. _service_launcher:
-Utilisation du service Launcher
--------------------------------
-Le service Launcher est un serveur CORBA lancé par le noyau de Salomé. Son interface est décrite dans le
-fichier **SALOME_ContainerManager.idl** du noyau.
+Using the Launcher service
+-------------------------------
+The Launcher service is a CORBA server started by the SALOME kernel. Its interface is described in the
+**SALOME_ContainerManager.idl** file of the kernel.
-Voici son interface:
+Its interface is as follows:
::
in FilesList filesToExport,
in FilesList filesToImport,
in BatchParameters batch_params,
- in MachineParameters params ) raises (SALOME::SALOME_Exception);
+ in MachineParameters params )
+ raises (SALOME::SALOME_Exception);
- string queryJob ( in long jobId, in MachineParameters params ) raises (SALOME::SALOME_Exception);
- void deleteJob( in long jobId, in MachineParameters params ) raises (SALOME::SALOME_Exception);
+ string queryJob ( in long jobId, in MachineParameters params )
+ raises (SALOME::SALOME_Exception);
+ void deleteJob( in long jobId, in MachineParameters params )
+ raises (SALOME::SALOME_Exception);
- void getResultsJob( in string directory, in long jobId, in MachineParameters params )
- raises (SALOME::SALOME_Exception);
+ void getResultsJob( in string directory, in long jobId,
+ in MachineParameters params )
+ raises (SALOME::SALOME_Exception);
- boolean testBatch(in MachineParameters params) raises (SALOME::SALOME_Exception);
+ boolean testBatch(in MachineParameters params)
+ raises (SALOME::SALOME_Exception);
void Shutdown();
long getPID();
};
-La méthode **submitSalomeJob** permet de lancer une application Salomé sur un gestionnaire de batch.
-Cette méthode retourne un identifiant de **job** qui est utilisé dans les méthodes **queryJob**,
-**deleteJob** et **getResultsJob**.
+The **submitSalome.job** method launches a SALOME application on a batch manager.
+This method returns a **job** identifier that is used in the **query.Job**, **delete.Job** and **getResults.Job** methods.
-Voici un exemple d'utilisation de cette méthode:
+The following is an example using this method:
::
clt = orbmodule.client()
cm = clt.Resolve('SalomeLauncher')
- # Le script python qui va être lancé sur le clusteur
+ # The python script that will be launched on the cluster
script = '/home/user/Dev/Install/BATCH_EXEMPLES_INSTALL/tests/test_Ex_Basic.py'
- # Préparation des arguments pour submitSalomeJob
+ # Preparation of arguments for submitSalomeJob
filesToExport = []
filesToImport = ['/home/user/applis/batch_exemples/filename']
batch_params = Engines.BatchParameters('', '00:05:00', '', 4)
- params = Engines.MachineParameters('','clusteur1','','','','',[],'',0,0,1,1,0,'prun','lsf','','',4)
-
- # Utilisation de submitSalomeJob
- jobId = cm.submitSalomeJob(script, filesToExport, filesToImport, batch_params, params)
-
-
-Voici la description des différents arguments de **submitSalomeJob**:
-
-- **fileToExecute**: il s'agit du script python qui sera exécuté dans l'application Salomé sur le clusteur.
- Cet argument contient le chemin du script **sur** la machine locale et **non** sur le clusteur.
-- **filesToExport**: il s'agit d'une liste de fichiers qui seront copiés dans le répertoire de lancement sur
- le clusteur.
-- **filesToImport**: il s'agit d'une liste de fichiers qui seront copiés depuis le clusteur sur la
- machine utilisateur lors de l'appel à la méthode **getResultsJob**.
-- **batch_params**: il s'agit d'une structure qui contient des informations qui seront données au gestionnaire
- de batch. Cette structure est composée de quatre arguments. Le premier argument permettra de donner le nom du
- répertoire où l'on veut que les fichiers et l'application Salomé soit lancée (actuellement cette fonction n'est pas
- disponible). Le deuxième argument est le temps demandé. Il est exprimé sous cette forme: hh:mn:se, ex: 01:30:00.
- Le troisième argument est la mémoire requise. Elle est exprimée sous la forme: 32gb ou encore 512mb. Enfin,
- le dernier argument décrit le nombre de processeurs demandé.
-- **params**: il contient la description de la machine souhaitée. Ici on identifie clairement sur quel clusteur
- on veut lancer l'application.
-
-Pour connaitre dans quel état est le Job, il faut utiliser la méthode **queryJob**. Il y a trois états possibles:
-**en attente**, **en exécution** et **terminé**.
-Voici un exemple d'utilisation de cette méthode:
+ params = Engines.MachineParameters('','clusteur1','','','','',[],'',0,0,1,1,0,
+ 'prun','lsf','','',4)
+
+ # Using submitSalomeJob
+ jobId = cm.submitSalomeJob(script, filesToExport, filesToImport,
+ batch_params, params)
+
+The following is a description of the different arguments of **submitSalomeJob**:
+
+- **fileToExecute**: this is the python script that will be executed in the SALOME application on the cluster.
+ This argument contains the script path **on** the local machine and **not on** the cluster.
+- **filesToExport**: this is a list of files that will be copied into the run directory on the cluster
+- **filesToImport**: this is a list of files that will be copied from the cluster onto the user machine when the **getResultsJob** method is called.
+- **batch_params**: this is a structure that contains information that will be given to the batch manager. This structure is
+ composed of four arguments. The first argument will be used to give the name of the directory in which it is required that
+ the files and SALOME application should be run (this function is not available at the moment). The second argument
+ is the requested time. It is expressed in the form hh:min:se, for example 01:30:00. The third argument is the required memory.
+ It is expressed in the form of 32gb or 512mb. Finally, the final argument describes the requested number of processors.
+- **params**: contains the description of the required machine. In this case, the cluster on which the application is to be launched
+ is clearly identified.
+
+The **queryJob** method should be used to determine the state of the Job. There are three possible states, namely **waiting**,
+**running** and **terminated**.
+The following is an example of how this method is used:
::
status = cm.queryJob(jobId, params)
print jobId,' ',status
-L'identifiant du job fournit par la méthode **submitSalomeJob** est utilisé dans cette méthode ainsi que la
-structure **params**.
+The job identifier supplied by the **submitSalomeJob** method is used in this method together with the **params** structure.
-Enfin pour récupérer les résultats de l'application, il faut utiliser la méthode **getResultsJob**.
-Voici un exemple d'utilisation de cette méthode:
+Finally, the **getResultsJob** method must be used to retrieve application results.
+The following is an example of how to use this method:
::
cm.getResultsJob('/home/user/Results', jobId, params)
-Le premier argument contient le répertoire où l'utilisateur veut récupérer les résultats. En plus de ceux
-définis dans la liste **filesToImport**, l'utilisateur reçoit automatiquement les logs de l'application
-Salomé et des différents containers qui ont été lancés.
+The first argument contains the directory in which the user wants to retrieve the results. The user automatically receives
+logs from the SALOME application and the different containers that have been started, in addition to those defined in the **filesToImport** list.
.. _salome_clusteur_batch:
-Salomé sur le clusteur batch
-----------------------------
-
-Salomé ne fournit par pour l'instant un service pour l'installation automatique de la plateforme depuis
-la machine personnelle de d'utilisateur. Il faut donc que Salomé (KERNEL + des modules) et une application Salomé
-soient préinstallés sur le clusteur. Dans l'exemple suivit dans cette documentation, l'application est installée dans
-le répertoire **/home/user/applis/batch_exemples**.
-
-Lors du l'utilisation de la méthode **submitSalomeJob**, Salomé crée un répertoire dans $HOME/Batch/**date_du_lancement**.
-C'est dans ce répertoire que les différents fichiers d'entrées sont copiés.
-
-Contraintes de Salomé sur les gestionnaires de batch
+SALOME on the batch cluster
----------------------------------------------------
+SALOME does not provide a service for automatic installation of the platform from the user’s personal machine, for the moment.
+Therefore, SALOME (KERNEL + modules) and a SALOME application have to be installed beforehand on the cluster.
+In the example used in this documentation, the application is installed in the directory **/home/user/applis/batch_exemples**.
-Salomé a besoin de certaines fonctionnalités que le gestionnaire de batch doit autoriser pour que le lancement
-d'applications Salomé soit possible.
-
-Salomé lance plusieurs **threads** par processeurs pour chaque serveur CORBA qui est lancé.
-Certains gestionnaires de batch peuvent limiter le nombre de threads à un nombre trop faible ou encore le gestionnaire
-de batch peut avoir configurer la taille de pile des threads à un niveau trop haut. Dans notre exemple, la taille
-de pile des threads est fixée par l'utilisateur dans le champ **userCommands** du fichier CatalogResources.xml.
+When the **submitSalomeJob** method is being used, SALOME creates a directory in $HOME/Batch/**run_date**.
+The various input files are copied into this directory.
-Salomé lance des processus dans la session sur les machines allouées par le gestionnaire de batch.
-Il faut donc que le gestionnaire de batch l'autorise.
+SALOME constraints on batch managers
+----------------------------------------------------
+SALOME needs some functions that the batch manager must authorise before SALOME applications can be run.
-Enfin, Salomé est basée sur l'utilisation de bibliothèques dynamiques et sur l'utilisation de la fonction **dlopen**.
-Il faut que le système le permette.
+SALOME runs several processor **threads** for each CORBA server that is started.
+Some batch managers can limit the number of threads to a number that is too small, or the batch manager may configure the size
+of the thread stack so that it is too high.
+In our example, the user fixes the size of the thread stack in the **userCommands** field in the CatalogResources.xml file.
+SALOME starts processes in the session on machines allocated by the batch manager. Therefore, the batch manager must authorise this.
+Finally, SALOME is based on the use of dynamic libraries and the **dlopen** function. The system must allow this.
.. _calcium:
-Guide de mise en oeuvre d'un couplage CALCIUM dans SALOME
+Guide for the use of CALCIUM coupling in SALOME
==========================================================
+This manual only contains a brief explanation of the use of primitives (see :ref:`calciumapi`
+and :ref:`calciummod` for reference guide),
+please refer to [Calcium1]_ and [Calcium2]_ for further information on this subject.
+.. toctree::
+ :maxdepth: 2
+ calciumyacs
+ calciumapi
+ calciummod
-Ce manuel ne se substitue pas au manuel CALCIUM et n'explique donc que succinctement l'utilisation des primitives, il convient de se rapporter aux notes HI-26/03/007/A et HI-76/96/009/B pour plus d'informations à ce sujet.
+.. [Calcium1] EDF report HI-26/03/007/A
+.. [Calcium2] EDF report HI-76/96/009/B
-
-
-
-L'évolution du produit CALCIUM vers CALCIUM dans SALOME
--------------------------------------------------------
-
-
-
-Cette section explique les raisons de l'évolution du produit CALCIUM vers CALCIUM dans SALOME. Après une brève présentation des avantages et inconvénients du produit CALCIUM existant, la deuxième section présente l'implémentation de CALCIUM dans SALOME en utilisant les ports DSC. La dernière section expose l'utilisation conjointe des ports CALCIUM et du superviseur YACS.
-
-Le produit CALCIUM existant
-'''''''''''''''''''''''''''
-
-
-
-Le produit CALCIUM permet la mise en oeuvre rapide de couplages de codes Fortran/C/C++ de façon simple et peu intrusive. Les responsables des codes intervenant dans le couplage distinguent les données d'intérêt général par la définition de points de connexion d'entrés et de sorties. Le responsable du couplage global définit le nombre d'exécutions simultanées des différents codes et les liens de transmission entre les points de connexion de ces instances d'exécution. Cette description s'appelle le schéma de couplage et est stockée dans un fichier de couplage.
-
-
-
-Les points de connexion sont typés par des types simples (entier, flottant, double, booléens, chaîne) et fonctionnent selon un mode temporel ou itératif. Les données produites sont estampillées par une date ou un numéro d'itération. La production et la lecture de données se font dans les codes respectivement par appel aux primitives d'écritures ou de lectures. La production est indépendante des demandes sur les points de connexion en lecture (asynchronisme).
-
-
-
-Lorsque des données sont demandées pour une date ultérieure aux données déjà produites, les instances lectrices attendent sur les primitives de lectures bloquantes ou reçoivent un code indiquant l'absence de donnée en mode non bloquant. Lorsque des données sont demandées à une date encadrée par les estampilles de données déjà produites, le lecteur a la possibilité d'obtenir des données interpolées (L0 et L1) en mode temporel. S'il se trouve que le/s lecteur/s attendent des données qui ne seront jamais produites, le couplage se trouve en inter-blocage. CALCIUM détecte cette situation et propose soit de stopper l'exécution du couplage soit d'extrapoler les données demandées afin de débloquer la situation. Cette gestion dépend du mode d'utilisation de CALCIUM : mode de production ou mode debug.
-
-
-
-En effet, le produit CALCIUM possède depuis sa version 3 deux modes de fonctionnement. Le premier dit mode debug, seul mode disponible des versions antérieures, possède un processus coupleur par lequel toutes les données transitent. Dans le second, dit mode de production, les instances de codes communiquent directement entre elles. En mode debug, le débit de transfert est limité par la capacité du lien réseau du coupleur à gérer les accès simultanés. Dans ce mode, le coupleur doit stocker une copie de chaque donnée reçue afin de pouvoir les délivrer au moment voulu et être capable de détecter une situation d'inter blocage. Le mode de production permet un transfert de données dont les performances ne sont pas limitées par la capacité des liens entrant et sortant du coupleur puisqu'il n'existe plus. Ce mode a cependant les limitations suivantes : pas de détection d'inter blocage (mais gestion d'un timeout), fonctionnement local des requêtes de retour en arrière, pas de mode d'exécution pas à pas et pas de gestion dynamique de couplage.
-
-
-
-
-
-Les ports CALCIUM dans SALOME
-'''''''''''''''''''''''''''''
-
-
-
-Une expérimentation d'utilisation de l'outil CALCIUM existant (en mode de production) dans SALOME a permis de mettre en place plusieurs couplages lors de l'école d'été 2004. Elle a montré la pertinence de faire cohabiter des ports de type datastream avec les ports dataflow/control flow de SALOME. Elle a cependant nécessité une modification spécifique localisée dans la procédure de lancement CALCIUM et mis en valeur les limitations suivantes :
-
-
-
-* Nécessité d'utiliser un container différent par service utilisant CALCIUM (même pour les services d'un même composant ( CALCIUM n'est pas multithread safe )
-
-
-
-* Ré exécutions successives du couplage difficiles (nécessité de ne pas appeler MPI_FIN et problèmes liés à l'état de la machine virtuelle MPI)
-
-
-
-* Le SUPERVISEUR SALOME n'a aucun contrôle sur l'exécution du couplage CALCIUM
-
-
-
-* Pas d'extension possible des types CALCIUM transmis
-
-
-
-* Cohabitations parfois difficiles de l'environnement MPI et de l'environnement CORBA
-
-
-
-
-Le module KERNEL de SALOME V4 est pourvu de nouveaux ports de communications appelés ports DSC (Dynamic Software Component) permettant aux composants d'ajouter/supprimer dynamiquement de nouvelles interfaces accessibles à tous. La note ..... décrit l'utilisation/conception/utilité de ces nouveaux ports. Il existe deux classes de ports DSC, les ports qui fournissent une interface (ports provides) et les ports qui utilisent des interfaces (port uses).
-
-
-
-Une implémentation de ports CALCIUM basée sur cette technologie est disponible depuis la version V4 du KERNEL de SALOME. Il est donc possible de réaliser des couplages CALCIUM par simples appels des primitives CALCIUM dans les services des composants. Cette implémentation reprend les fonctionnalités de CALCIUM dans son mode de production. L'utilisation de cette technologie nécessite uniquement le module KERNEL de SALOME. Cependant, à moins d'utiliser le superviseur YACS, l'utilisateur devra écrire un script python ou un service de composant pour charger les composants du couplage, les initialiser, connecter les différents ports, les configurer et lancer les services dans l'ordre adéquat.
-
-
-
-Les ports CALCIUM/SALOME et le superviseur YACS :
-'''''''''''''''''''''''''''''''''''''''''''''''''
-
-
-
-Le superviseur YACS disponible depuis la version V4.1 de SALOME gère tous types de ports DSC et en particulier les ports CALCIUM. Il décharge l'utilisateur de l'implémentation d'un script ou d'un service pour connecter et configurer les ports. Il contrôle la validité du schéma de calcul et lance les services conformément aux dépendances décrites. Il est possible de créer un schéma de calcul mixant des ports de type datastream (mode CALCIUM), dataflow (arrivée d'une donnée qui peut enclencher le démarrage d'un service) et control flow (déclenchement d'un service par la fin d'exécution d'un autre) et créer ainsi des schémas de calcul élaborés.
-
-Le schéma de calcul ainsi créé peut se sauvegarder au format XML. Ce fichier représente l'équivalent du fichier de couplage CALCIUM pour la partie déclaration et paramétrage des liens, la déclaration des ports se faisant dans le fichier XML qui catalogue les ressources du composant.
-
-
-
-
-
-
-La création d'un composant SALOME utilisant CALCIUM
----------------------------------------------------
-
-
-
-L'utilisation de CALCIUM dans SALOME suppose l'existence de composants SALOME proposant des services à base de ports CALCIUM. Plusieurs choix sont possibles pour créer de tels composants :
-
-
-
-* Créer un module SALOME contenant des composants dont les services ont des ports CALCIUM,
-
-
-
-* Créer plusieurs modules SALOME contenant au moins un composant dont le/s service/s ont des ports CALCIUM.
-
-
-
-
-La création d'un module SALOME consiste en la structuration sous forme d'une arborescence standardisée des fichiers d'entêtes, des sources, des bibliothèques et des ressources. Elle peut se faire à partir d'un module modèle (HELLO, pyHELLO) ou à partir d'un générateur de module, ModuleGenerator (cf. http://pal.der.edf.fr/pal/projets/pal/superv/modulegenerator ) par exemple.
-
-
-
-La personnalisation du composant SALOME pour l'utilisation de ports CALCIUM consiste-en :
-
-
-
-* l'inclusion d'un fichier déclarant les ports DSC dans le fichier IDL du composant,
-
-
-
-* l'inclusion d'un fichier et la déclaration d'un héritage pour rendre notre composant supervisable,
-
-
-
-* la création des ports CALCIUM utilisés dans la définition d'une méthode normalisée appelée init_service,
-
-
-
-* la déclaration des ports CALCIUM du/es composant/s dans le fichier catalogue du module.
-
-
-
-En utilisant le ModuleGenerator, la méthode init_service et le catalogue XML des services fournis par les composants sont générés automatiquement.
-
-
-
-
-
-La déclaration IDL des composants utilisant des ports CALCIUM
-'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-
-
-Les ports étant dynamiquement déclarés dans le service init_service, les ports CALCIUM n'ont pas besoin d'être préalablement déclarés dans le fichier IDL. Il faut cependant inclure le fichier DSC_Engine.idl dans le/s fichier/s IDL des composants pour bénéficier des ports DSC.
-
-
-
-Exemple du fichier CALCIUM_TESTS.idl du module CALCIUM_TEST définissant trois composants ECODE, SCODE, ESPION qui proposent chacun un unique service de lancement du code wrappé correspondant :
-
-
-::
-
- #include "DSC_Engines.idl"
-
- /*! \file CALCIUM_TESTS.idl
- This file contains the first installation test of CALCIUM product.
- Each engine contains one service.
- */
- module CALCIUM_TESTS {
-
- interface ECODE : Engines::Superv_Component {
- void EcodeGo();
- };
-
- interface SCODE : Engines::Superv_Component {
- void ScodeGo();
- };
-
- interface ESPION : Engines::Superv_Component {
- void EspionGo();
- };
-
- };
-
-
-La déclaration d'un composant C++ utilisant des ports CALCIUM
-'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-
-
-Dans le cas d'un composant wrapper (qui ne fait qu'appeler une implémentation d'une autre unité de compilation), un seul header est nécessaire :
-
-
-
-#include "Superv_Component_i.hxx"
-
-
-
-Ce fichier d'entête est nécessaire pour rendre notre composant supervisable et pour utiliser les ports DSC. Le composant héritera virtuellement de la classe Superv_Component_i.
-
-
-
-
-
-Exemple du fichier de déclaration ECODE.hxx du composant ECODE :
-
-
-
-
-::
-
- #ifndef _ECODE_HXX_
- #define _ECODE_HXX_
-
- #include "Superv_Component_i.hxx"
- //Header CORBA généré du module CALCIUM_TESTS
- #include "CALCIUM_TESTS.hh"
-
- //Interface du code wrappé, ici le code C ecode
- extern "C" { int ecode(void *); }
-
- class ECODE_impl :
- public virtual POA_CALCIUM_TESTS::ECODE, //Implémente l'interface CORBA du composant ECODE
- public virtual Superv_Component_i { //Rend le composant supervisable
-
- public :
- ECODE_impl(CORBA::ORB_ptr orb, //Constructeur classique des composants SALOME
- PortableServer::POA_ptr poa,
- PortableServer::ObjectId * contId,
- const char *instanceName,
- const char *interfaceName);
-
- virtual ~ECODE_impl();
-
- CORBA::Boolean init_service(const char * service_name); //Initialisation du service EcodeGo()
- void EcodeGo();
- };
-
- extern "C"
- {
- PortableServer::ObjectId * ECODEEngine_factory(CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- PortableServer::ObjectId * contId,
- const char *instanceName,
- const char *interfaceName);
- }
-
- #endif
-
-
-
-
-
-La déclaration des ressources des composants (partie 1)
-'''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-
-
-Les composants publient les signatures de leurs services dans un fichier de ressources XML appelé le catalogue du module (ou catalogue de composants). Ce fichier peut être généré par le ModuleGenerator.
-
-
-
-Extrait du catalogue CALCIUM_TESTSCatalog.xml concernant le composant ECODE :
-
-
-
-Notre composant ECODE fournit un unique service EcodeGo() qui n'a ni de paramètres d'entrée ni de paramètres sortie.
-
-Nous verrons dans la section création de ports CALCIUM que ce fichier de ressources sera complété de la déclaration des ports datastream.
-::
-
- ....
- <component>
- <component-name>ECODE</component-name>
- ....
- <component-interface-list>
- <component-interface-name>ECODE</component-interface-name>
- <component-interface-comment></component-interface-comment>
- <component-service-list>
- <component-service>
- <!-- service-identification -->
- <service-name>EcodeGo</service-name>
- ...
- <!-- service-connexion -->
- <inParameter-list>
- </inParameter-list>
- <outParameter-list>
- </outParameter-list>
- <DataStream-list>
- </DataStream-list>
- </component-service>
- </component-service-list>
- </component-interface-list>
- </component>
-
-
-
-
-La définition d'un composant utilisant les ports CALCIUM
-''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-
-
-Le composant se charge de créer les ports dont il a besoin. L'étape de création d'un port CALCIUM consiste en l'appel de la méthode add_port fournie par l'héritage virtuel de la classe Superv_Component_i. Elle doit être effectuée avant le lancement du/des services utilisant le port. C'est la raison pour laquelle cette déclaration se trouve dans la méthode standard init_service(char * nom_du_service_a_initialiser). Il existe deux méthodes pour créer un port CALCIUM : la méthode create_calcium_port et la méthode add_port .
-
-
-
-La création de ports CALCIUM par la méthode add_port
-++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-
-
-Cette méthode est utilisée pour créer tout type de port DSC. Elle peut être utilisée pour créer les ports CALCIUM en particulier.
-
-
-::
-
- add_port< typage_de_mon_port_fabriqué >( "le type de port à fabriquer",
- "provides"|”uses”,
- "le nom du port")
-
-
-
-
-*"le type de port à fabriquer"* :
-
-
-
-Cette chaîne indique à la fabrique de port DSC du module KERNEL le nom du type de port à créer. Pour CALCIUM, il s'agit des types :
-
-“CALCIUM_integer”, “CALCIUM_real”, “CALCIUM_double”, “CALCIUM_logical”, “CALCIUM_complex”, “CALCIUM_string”
-
-
-
-*"provides"|”uses”* :
-
-
-
-Cette chaîne indique s'il s'agit d'un port CALCIUM de sortie (uses) ou d'un port d'entrée provides. Noter que dans la sémantique DSC, c'est le port provides qui fournie une interface d'écriture utilisée par le port uses.
-
-
-
-*"le nom du port"* :
-
-
-
-Le nom du port correspond au nom de la variable utilisée dans les primitives CALCIUM.
-
-
-
-*Le typage_de_mon_port_fabriqué* :
-
-
-
-Ce type permet de typer le pointeur retourné par add_port. En ce qui concerne CALCIUM, il s'agit d'indiquer le typage correspondant au nom de type déjà indiqué à la fabrique compléter par l'information uses ou provides :
-
-
-
-calcium_integer_port_provides ou calcium_integer_port_uses
-
-calcium_real_port_provides ou calcium_real_port_uses
-
-calcium_integer_port_provides ou calcium_integer_port_uses
-
-calcium_integer_port_provides ou calcium_integer_port_uses
-
-calcium_integer_port_provides ou calcium_integer_port_uses
-
-calcium_string_port_provides ou calcium_string_port_uses
-
-
-
-Extrait de la méthode init_service dans le fichier ECODE.cxx du composant ECODE :
-
-
-::
-
- CORBA::Boolean ECODE_impl::init_service(const char * service_name) {
-
- CORBA::Boolean rtn = false;
- string s_name(service_name);
-
- if (s_name == "EcodeGo") {
-
- try {
-
- add_port<calcium_integer_port_provides>("CALCIUM_integer","provides","ETP_EN")->
- setDependencyType(CalciumTypes::TIME_DEPENDENCY);
-
- add_port<calcium_real_port_provides>("CALCIUM_real","provides","ETP_RE") ->
- setDependencyType(CalciumTypes::TIME_DEPENDENCY);
-
- add_port<calcium_double_port_provides>("CALCIUM_double","provides","ETP_DB")->
- setDependencyType(CalciumTypes::TIME_DEPENDENCY);
-
- add_port<calcium_complex_port_provides>("CALCIUM_complex","provides","ETP_CX")->
- setDependencyType(CalciumTypes::TIME_DEPENDENCY);
-
- add_port<calcium_string_port_provides>("CALCIUM_string","provides","ETP_CH")->
- setDependencyType(CalciumTypes::TIME_DEPENDENCY);
-
- add_port<calcium_logical_port_provides>("CALCIUM_logical","provides","ETP_LQ")->
- setDependencyType(CalciumTypes::TIME_DEPENDENCY);
- ....
- rtn = true;
- } catch ( const DSC_Exception & ex ) {
- std::cerr << ex.what() << std::endl;;
- }
- } //FIN (s_name == "Ecode")
-
- return rtn;
- }
-
-
-La création de ports CALCIUM par la méthode create_calcium_port
-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-
-
-Cette méthode écrite spécialement pour la création de ports CALCIUM simplifie la création des ports. Elle est utilisée par le ModuleGenerator. Le paramètre “IN”|”OUT” indique s'il s'agit d'un port CALCIUM d'entrée ou de sortie. Le paramètre “T”|”I” indique le mode temporel ou itératif du port.
-
-
-
-Extrait de la méthode init_service dans le fichier ECODE.cxx du composant ECODE :
-
-
-::
-
- ECODE_i::init_service(const char * service_name) {
- CORBA::Boolean rtn = false;
- string s_name(service_name);
- if (s_name == "EcodeGo") {
- try {
- //initialisation CALCIUM ports IN
- create_calcium_port(this,"ETP_EN","CALCIUM_integer","IN","T");
- create_calcium_port(this,"ETP_RE","CALCIUM_real","IN","T");
- create_calcium_port(this,"ETP_DB","CALCIUM_double","IN","T");
- create_calcium_port(this,"ETP_CX","CALCIUM_complex","IN","T");
- create_calcium_port(this,"ETP_CH","CALCIUM_string","IN","T");
- create_calcium_port(this,"ETP_LQ","CALCIUM_logical","IN","T");
- ... }
- catch(const PortAlreadyDefined& ex) {
- std::cerr << "ECODE: " << ex.what() << std::endl;
- //Ports already created : we use them
- }
- catch ( ... ) {
- std::cerr << "ECODE: unknown exception" << std::endl;
- }
- rtn = true;
- }
- return rtn;
- }
-
-
-
-
-
-
-
-La déclaration des ressources des composants (partie 2)
-''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-
-
-Le fichier XML de ressources des composants doit être complété pour déclarer l'existence de ports CALCIUM dans les différents composants. Le ModuleGenerator prend en compte les ports CALCIUM à la génération du catalogue du module.
-
-
-
-Extrait du catalogue CALCIUM_TESTSCatalog.xml concernant le composant ECODE :
-
-
-::
-
- .....
- <DataStream-list>
- <inParameter>
- <inParameter-name>ETP_EN</inParameter-name>
- <inParameter-type>CALCIUM_integer</inParameter-type>
- <inParameter-dependency>T</inParameter-dependency>
- </inParameter>
- <inParameter>
- <inParameter-name>ETP_RE</inParameter-name>
- <inParameter-type>CALCIUM_real</inParameter-type>
- <inParameter-dependency>T</inParameter-dependency>
- </inParameter>
- <inParameter>
- <inParameter-name>ETP_DB</inParameter-name>
- <inParameter-type>CALCIUM_double</inParameter-type>
- <inParameter-dependency>T</inParameter-dependency>
- </inParameter>
- .....
- </DataStream-list>
-
-
-La configuration d'un port CALCIUM
-''''''''''''''''''''''''''''''''''
-
-
-
-L'étape de configuration des ports reprend l'ensemble des paramétrages possibles des liens du fichier de couplage de CALCIUM hors SALOME. Cette étape peut être effectuée à la création du port dans le composant (méthode init_service), par un composant/script de paramétrage du couplage ou par le superviseur YACS. Cette étape permet d'indiquer pour chaque port de classe provides les caractéristiques suivantes :
-
-
-
-* La dépendance temporelle/itérative des données reçues :
-
-TIME_DEPENDENCY ou ITERATION_DEPENDENCY
-
-
-
-* Le niveau de stockage des données (taille de la pile de l'historique) :
-
-UNLIMITED_STORAGE_LEVEL (par défaut)
-
-ou un entier strictement positif
-
-
-
-* Le schéma temporel choisi pour définir la date utilisée dans les primitives (CPLxx) de lecture en mode temporel :
-
-
- * TI_SCHEM (valeur par défaut) : Les valeurs de la variable d’entrée utilisée sont prises à l’instant correspondant au début du pas de temps en cours de calcul (cf. paramètre **ti** de CPLxx)
-
-
-
- * TF_SCHEM : Les valeurs de la variable d’entrée sont prises à l’instant correspondant à la fin du pas de temps en cours de calcul (cf. paramètre **tf** de CPLxx)
-
-
-
- * ALPHA_SCHEM : Les valeurs de la variable d’entrée sont prises à un instant égal à TF* *ALPHA* +TI * (1 *-ALPHA* ). *ALPHA* peut prendre des valeurs strictement comprises entre 0 et 1. La valeur 0 est remplacée par l’option TI_SCHEM et la valeur 1 est remplacée par l’option TF_SCHEM).
-
-
-
-
-
-* Le type d'interpolation à utiliser pour un port en mode temporel :
-
-L0_SCHEM, L1_SCHEM
-
-
-
-* Le type d'extrapolation à utiliser en cas de blocage/timeout :
-
-E0_SCHEM, E1_SCHEM (non encore fonctionnel)
-
-
-
-* La valeur du paramètre DELTAT qui indique si deux dates sont identiques.
-
-
-
-
-L'ensemble des mots clés utilisés à la configuration des ports sont définis dans le namespace C++ CalciumTypes du fichier CalciumTypes.hxx.
-
-La configuration au moment de la création du PORT
-+++++++++++++++++++++++++++++++++++++++++++++++++
-
-
-
-A la création d'un port, la méthode add_port renvoie un pointeur sur le port utile à sa configuration. Dans la méthode init_service, un exemple de configuration consiste à indiquer si le port est en mode temporel ou itératif :
-
-
-::
-
- add_port<calcium_integer_port_provides>("CALCIUM_integer","provides","ETP_EN")->
- setDependencyType(CalciumTypes::TIME_DEPENDENCY);
-
-
-
-
-Voici les méthodes disponibles pour configurer les ports CALCIUM :
-
-
-
-* Positionner/Interroger le type de dépendance :
-
-
-Le type de dépendance indique au port si les données sont estampillées par une date ou (exclusif) un numéro d'itération. Le type de dépendance est par défaut indéfini (CalciumTypes::UNDEFINED_DEPENDENCY). Il est possible d'indiquer CalciumTypes::TIME_DEPENDENCY ou CalciumTypes::ITERATION_DEPENDENCY.
-
-
-::
-
- void setDependencyType (DependencyType dependencyType);
- DependencyType getDependencyType () const;
-
-
-
-* Positionner/Interroger le niveau de stockage des données produites :
-
-
-
-Le niveau de stockage de l'historique des données produites doit être supérieur ou égale à 1. Il est par défaut illimité ( CalciumTypes::UNLIMITED_STORAGE_LEVEL). Il peut être nécessaire de l'abaisser afin de limiter la consommation mémoire de cas de couplage présentant de nombreuses itérations.
-
-
-::
-
- void setStorageLevel (size_t storageLevel);
- size_t getStorageLevel () const;
-
-
-
-
-* Positionner/Interroger le schéma temporel utilisé pour la définition de la date de lecture :
-
-
-
-Le schéma temporel choisi pour définir la date utilisée dans les primitives de lecture en mode temporel est défini à CalciumTypes::TI_SCHEM par défaut. Il est également possible d'indiquer CalciumTypes::TF_SCHEM ou CalciumTypes::ALPHA_SCHEM.
-
-
-::
-
- void setDateCalSchem (DateCalSchem dateCalSchem);
- DateCalSchem getDateCalSchem () const;
-
-
-
-
-Si le schéma temporel utilisé est ALPHA_SCHEM, la méthode suivante permet d'indiquer la valeur d'ALPHA à utiliser. Alpha vaut zéro par défaut (équivaut à TI_SCHEM) et peut être positionné entre 0 et 1 compris.
-
-
-::
-
- void setAlpha(double alpha);
- double getAlpha() const ;
-
-
-
-
-* Positionner/Interroger l'écart toléré pour que deux dates soient considérées identiques :
-
-
-Deux dates T1 et T2 sont identiques si abs(T1-T2) < CalciumTypes::EPSILON. Epsilon vaut 1E-6 par défaut. Il est possible de le paramétrer sur chacun des ports (0 <= deltaT <= 1).
-
-
-::
-
- void setDeltaT(double deltaT );
- double getDeltaT() const ;
-
-
-
-
-* Positionner/Interroger le type d'interpolation temporelle à utiliser :
-
-
-Lorsque qu'une demande de lecture est formulée pour une date T qui n'a pas été produite mais encadrée par les dates T1 (min) et T2(max) pour lesquelles des données ont déjà été produites, CALCIUM réalise par défaut une interpolation linéaire CalciumTypes::L1_SCHEM. L'utilisateur peut demander une “interpolation” en escalier CalciumTypes::L0_SCHEM.
-
-
-::
-
- void setInterpolationSchem (InterpolationSchem interpolationSchem);
- InterpolationSchem getInterpolationSchem () const ;
-
-
-
-
-* Positionner/Interroger le type d'extrapolation à utiliser :
-
-
-Ce paramètre permet d'indiquer si l'on veut réaliser une extrapolation pour sortir d'un cas de blocage (un port qui attend une donnée qui ne sera jamais produite). La valeur par défaut est CalciumTypes::UNDEFINED_EXTRA_SCHEM. Les valeurs possibles sont EO_SCHEM (extrapolation en escalier) ou E1_SCHEM (extrapolation linéaire).
-
-
-::
-
- void setExtrapolationSchem (ExtrapolationSchem extrapolationSchem);
- ExtrapolationSchem getExtrapolationSchem () const ;
-
-
-La configuration par les propriétés des ports DSC
-+++++++++++++++++++++++++++++++++++++++++++++++++
-
-
-
-Cette section explique une utilisation avancée des propriétés des ports DSC pour réaliser l'étape de configuration des ports CALCIUM, elle peut être ignorée en cas d'une utilisation simple des ports CALCIUM.
-
-Tous les ports DSC sont configurables par une liste de propriétés. Il est donc possible d'effectuer l'étape de configuration par un appel CORBA sur les ports concernés.
-
-
-
-Les méthodes [set|get]properties des ports DSC manipulent une liste de paires avec une clé du nom de la propriété en première position et la valeur associée en seconde position :
-
-
-
-Extrait du fichier SALOME_Component.idl du KERNEL de SALOME :
-::
-
- struct KeyValuePair {
- string key;
- any value;
- };
- typedef sequence<KeyValuePair> FieldsDict;
- void setProperties(in FieldsDict dico);
- FieldsDict getProperties();
-
-
-
-
-CALCIUM déclare les types suivants dans le fichier Calcium_Ports.idl du KERNEL de SALOME :
-
-
-::
-
- const long UNLIMITED_STORAGE_LEVEL = -70;
- enum DependencyType { UNDEFINED_DEPENDENCY, TIME_DEPENDENCY, ITERATION_DEPENDENCY};
- enum DateCalSchem { TI_SCHEM, TF_SCHEM , ALPHA_SCHEM};
- enum InterpolationSchem { L0_SCHEM, L1_SCHEM };
- enum ExtrapolationSchem { UNDEFINED_EXTRA_SCHEM, E0_SCHEM, E1_SCHEM};
-
-
-
-
-
-
-Les propriétés reconnues sont donc les paires suivantes :
-
-("StorageLevel", int > 0 )
-
-("Alpha”, 0 <= double <= 1 )
-
-("DeltaT", 0 <= double <= 1 )
-
-("DependencyType", enum CORBA DependencyType)
-
-("DateCalSchem", enum CORBA DateCalSchem)
-
-("InterpolationSchem",enum CORBA InterpolationSchem)
-
-("ExtrapolationSchem",enum CORBA ExtrapolationSchem)
-
-
-
-Exemple de configuration dynamique par un script python (extrait du fichier CAS_1.py):
-::
-
- ...
- port1=ecode.get_provides_port("ETS_DB",0);
- myAny1_1=4
- port1.set_property("StorageLevel",any.to_any(myAny1_1))
-
-
-
-Les méthodes get_provides_port et set_properties sont fournies par l'implémentation par défaut des composants SALOME supervisable.
-
-La configuration dans le fichier XML de YACS
-++++++++++++++++++++++++++++++++++++++++++++
-
-
-
-Le module superviseur YACS est capable d'importer/exporter les schémas de calcul au format XML. On y trouve en particulier la déclaration des liens entre les ports des différentes instances des composants. Le GUI de YACS permet de générer toutes sortes de schémas de calcul et d'en lancer une exécution.
-
-A l'heure actuelle le GUI de YACS 4.1.1 ne permet pas d'ajouter des propriétés aux ports CALCIUM. Il faudra donc les ajouter manuellement dans le fichier XML. Dans YACS la configuration des ports CALCIUM se fait en déclarant des propriétés sur les liens.
-
-Extrait du schéma de calcul CAS_1.xml, premier cas test des fonctionnalités CALCIUM :
-
-Exemple de configuration du port ETS_DB à un niveau d'historique de 4.
-::
-
- <stream>
- <fromnode>SCODE</fromnode> <fromport>STS_DB</fromport>
- <tonode>ECODE</tonode> <toport>ETS_DB</toport>
- <property name="StorageLevel" value="4"/>
- </stream>
-
-
-
-Les paires (clés,valeur) utilisées pour décrire les propriétés sont celles listées dans la section précédente.
-
-Les appels aux méthodes CALCIUM
-'''''''''''''''''''''''''''''''
-
-
-
-L'API C/C++/Fortran de CALCIUM dans SALOME est globalement identique à celle du produit CALCIUM hors SALOME. Elle est désormais aussi disponible en Python.
-
-L'API classique C/C++ est étendue d'une version zéro copie qui permet le transfert de données sans recopie intermédiaire.
-
-Les développeurs C++ ont à leur disposition une API plus spécifique au C++ qui propose des paramètres de types plus adaptés au langage.
-
-Il est également possible d'utiliser directement les ports DSC CALCIUM avec leurs types CORBA associés.
-
-
-
-Appels CALCIUM classiques en C/C++/F/Python
-+++++++++++++++++++++++++++++++++++++++++++
-
-
-
-Qu'il s'agisse d'intégrer un code CALCIUM C/C++/Fortran existant dans la plate-forme SALOME ou de développer un nouveau composant CALCIUM, l'API classique de CALCIUM reste essentiellement la même.
-
-
-
-Le code contenant les appels CALCIUM est soit directement écrit dans le service SALOME du composant en C++, soit accessible via un appel de procédure.
-
-
-
-Dans le premier cas, le code doit être écrit en C/C++/Python car il n'existe pas de composant SALOME directement écrit en Fortran.
-
-
-
-Dans le second cas, le service appelant doit transmettre le pointeur d'accès à son composant. En effet, à la différence de l'API CALCIUM hors SALOME, toutes les procédures ont comme premier argument le pointeur du composant détenteur des ports associés. Ceci permet à la bibliothèque CALCIUM d'identifier le composant détenteur des ports demandés [1]_ .
-
-
-
-Extrait de l'implémentation du service EcodeGo() (ECODE.cxx) appelant le code wrappé ecode(void * component) (Ecode.c) :
-
-
-
-
-
-(Ce code peut être généré par le ModuleGenerator)
-
-
-
-
-::
-
- void ECODE_impl::EcodeGo() {
- Superv_Component_i * component = dynamic_cast<Superv_Component_i*>(this);
- try {
- ecode(component);
- }
- catch ( const CalciumException & ex)
- ....
- }
-
-
-
-
-
-
-Un code déjà écrit pour utiliser CALCIUM doit uniquement être adapté pour transmettre le pointeur de son composant en premier paramètre des appels aux procédures CALCIUM. En dehors de cette observation, le code reste identique au code CALCIUM initial.
-
-
-
-Extrait de l'implémentation du code source CALCIUM appelé par le service (Ecode.c) :
-
-
-::
-
- ...
- #include <calcium.h>
- ...
- int ecode(void * component)
- {
- ...
- /* Connexion au coupleur */
- info = cp_cd(component,nom_instance);
-
- info=
- cp_len(component,CP_TEMPS,&ti_re,&tf_re,&i,"ETP_EN",1,&n,EDATA_EN);
- ...
- info = cp_fin(component,CP_CONT);
- }
-
-
-
-
-
-
-La procédure C ecode se connecte au coupleur CALCIUM via la procédure cp_cd puis formule une demande de lecture bloquante au port/au point de connexion ETP_EN selon un schéma temporel entre ti_re et tf_re. Une seule donnée est demandée, elle sera stockée dans le buffer EDATA_EN. La procédure se finie sur une déconnexion du coupleur en indiquant par le drapeau CP_CONT que les éventuels clients des ports associés à ecode recevront la dernière valeur connue en cas de nouvelles demandes de lecture. Si le drapeau CP_ARRET était utilisé, toute demande ultérieure de lecture sur les ports associés à ecode() sortirait en erreur.
-
-
-
-
-
-En fortran le schéma est le même, voici un extrait du fichier Ecode.f :
-
-
-::
-
- SUBROUTINE ECODE(compo)
- INCLUDE "calcium.hf"
- ...
- INTEGER compo
- ...
- CALL CPCD(compo,nom_instance, info)
- ...
- CALL CPLEN(compo,CP_TEMPS,ti_re,tf_re,i,'ETP_EN',1,n,EDATA_EN
- . ,info)
- ...
- CALL CPFIN(compo,CP_CONT, info)
-
-
-
-
-
-
-Appels CALCIUM C/C++ en mode zéro copie
-+++++++++++++++++++++++++++++++++++++++
-
-
-
-Les ports DSC CALCIUM de type provides (points de connexion CALCIUM d'entrée) conservent les données reçues à concurrence de l'historique demandé (illimité par défaut). Lorsque l'utilisateur formule une lecture pour des données déjà disponibles, le port recopie ces données dans le buffer fourni par l'utilisateur. Une API CALCIUM étendue propose à l'utilisateur de fournir un pointeur nul en place du pointeur de réception pré alloué afin d'obtenir directement un pointeur sur le buffer interne du port CALCIUM de classe provides. Ceci évite une recopie de taille potentiellement importante mais impose à l'utilisateur d'être vigilant sur les points suivants :
-
-1. Le buffer obtenu doit être utilisé en lecture seule. A moins d'une utilisation particulière, toute modification du buffer serait répercutée lors de nouvelle demandes de lecture pour la même estampille ou lors d'un calcul d'interpolation mettant cette estampille en jeu.
-
-
-
-2. Le buffer est soumis au niveau d'historique positionné pour le port. Si le niveau d'historique positionné pour le port entraîne la suppression de l'estampille et du buffer associé, l'utilisateur possédera un pointeur sur buffer invalide et son utilisation amènerait probablement à une corruption de la mémoire.
-
-
-
-3. Le zéro copie n'est pas utilisé sur les entiers et les booléens car ces types n'existent pas en CORBA.
-
-
-
-1. L'utilisateur doit appeler une seule fois la procédure CALCIUM de libération du pointeur obtenu. Ceci permet de libérer d'éventuels buffers créés pour les cas où le zéro copie n'est pas possible. Cela permet également de comptabiliser les références distribuées pour éviter une libération précoce (non encore implémenté).
-
-
-
-
-L'API zéro copie consiste à appeler les procédures de lecture ecp_lxx en place de leur homologue cp_lxx et de passer l'adresse d'un pointeur dont la valeur est initialisée à zéro.
-
-
-
-L'API des procédures d'écriture n'est pas modifiée car ces procédures fonctionnent toujours en zéro copie. Si les composants émetteurs et récepteurs sont placés dans le même container, une recopie est provoquée à la réception des données pour éviter toute interaction entre le buffer de l'émetteur et celui du récepteur.
-
-
-
-Extrait de l'implémentation zéro copie du code source CALCIUM appelé par le service (Ecode.c) :
-
-
-::
-
- float *sav_EDATA_RE = _EDATA_RE; //Garde un ptr sur les données précédemment reçues
- _EDATA_RE = NULL;
- ti_re = 1.1;
- tf_re = 1.2;
- info = ecp_lre(component,CP_TEMPS,&ti_re,&tf_re,&i,"ETP_RE",0,&n,&_EDATA_RE);
- fprintf(file_2,"%f\n", _EDATA_RE[0]);
- ti_re = 0.0;
- tf_re = 1.0;
-
- ecp_lre_free(sav_EDATA_RE);
- ecp_lre_free(_EDATA_RE);
-
-
-
-
-
-
-Appels CALCIUM avec API spécifique au C++
-+++++++++++++++++++++++++++++++++++++++++
-
-
-
-Les développeurs C++ ont à leur disposition une API spécifique qui propose des paramètres avec des types plus adaptés au langage.
-
-
-
-Que ce soit en écriture ou en lecture et quel que soit le type de données transmises ; les estampilles en temps sont toujours de type double et les itérations toujours de type long. Les noms de variables sont des chaînes STL. Le nom des méthodes en lecture et en écriture est le même quel que soit le type de données manipulé. Le type de données est automatiquement trouvé, mis à part les complexes les logiques et les chaînes de caractères
-
-
-::
-
- template <typename T1, typename T2> static void
- ecp_ecriture ( Superv_Component_i & component, int const & dependencyType,
- double const & t, long const & i,
- const string & nomVar, size_t bufferLength, T1 const & data )
-
-
-
-::
-
- template <typename T1, typename T2 > static void
- ecp_lecture ( Superv_Component_i & component, int const & dependencyType,
- double & ti, double const & tf, long & i,
- const string & nomVar, size_t bufferLength,
- size_t & nRead, T1 * &data )
-
-
-
-
-Ces méthodes sont définies dans le fichier d'entête CalciumCxxInterface.hxx . L'utilisateur inclura donc la directive #include “CalciumCxxInterface.hxx” dans son code.
-
-
-
-Remarque : Le fichier CalciumInterface.hxx doit être inclus une fois seulement car il déclare et définit des méthodes C++ template. Cela ne pose pas de problème à la compilation mais un problème de définitions multiples à l'édition des liens.
-
-
-
-Pour les types CALCIUM entier, float ou double, il n'est pas nécessaire de préciser T1 et T2 car il existe une méthode en écriture et une méthode en lecture avec un paramètre template unique qui appelle leurs homologues avec la contrainte : T1==T2==<Type Des Données Utilisé>.
-
-
-
-En ce qui concerne les complexes, il faut utiliser l'instantiation <float,cplx> et prendre à sa charge de multiplier le nombre de complexes par deux pour passer le paramètre bufferLength. Dans ce cas de figure, la seule différence par rapport à une utilisation de type float est le typage des ports utilisés calcium_complex_port_provides au lieu de calcium_real_port_provides.
-
-Pour le type logique, l'instantiation se fait avec <int, bool>.
-
-Pour les chaînes de caractères, l'instanciation est < char*, str >. L'appel en lecture de chaînes de caractères ne nécessite pas le paramètre de longueur maximum de chaîne que l'on trouve dans l'API classique C/C++/Fortran.
-
-
-
-
-Différences par rapport au produit CALCIUM hors SALOME
-++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-
-
-Seules les procédures de lecture/écriture ainsi que de connexion et déconnexion sont implémentées. Les procédures d'effacement, de retour arrière, d'interrogation, de configuration dynamique et de debuggage ne sont pas implémentées.
-
-
-
-Il est cependant possible de créer et connecter dynamiquement des composants qui lisent/écrivent sur les ports d'autres services de composants. Tout service SALOME utilisant les ports CALCIUM possède en quelque sorte les privilèges d'un espion (en mode de production).
-
-
-
-Il est possible de relier plusieurs ports de sortie sur un même port d'entrée et un port de sortie à plusieurs ports d'entrée. Le premier cas n'était pas possible en CALCIUM hors SALOME.
-
-
-
-La routine de connexion cp_cd ne renvoie pas de “nom d'instance”.
-
-
-
-Les lectures/écritures sont implémentées en mode bloquant, le mode non-bloquant n'est pas encore implémenté.
-
-
-
-Le nommage global/local du type AAAA.BBBB de CALCIUM hors SALOME n'existe pas. Il faut donc supprimer toute référence à ce type de nommage.
-
-
-
-L'ensemble des ports créés par les différents services d'un même composant sont visibles/utilisables par tous ces services. Il n'est cependant pas conseillé de les utiliser de cette manière.
-
-
-
-Le timeout utilisé pour la détection d'inter blocage ainsi que l'extrapolation ne sont pas encore implémentés.
-
-
-
-Les ports fichiers ne sont pas implémentés, il existe cependant des ports DSC fichier dans SALOME.
-
-
-
-Les ports non connectés ne provoquent pas d'anomalie à l'exécution du couplage sauf s'ils sont utilisés.
-
-
-
-Les codes d'erreur CALCIUM renvoyés par les primitives sont ceux de CALCIUM hors SALOME. En utilisant l'API spécifique en C++, il est possible d'attraper les exceptions de classe CalciumException (CalciumException.hxx) qui contiennent le code d'erreur CALCIUM ainsi qu'un message explicatif. Le code d'erreur contenu dans l'exception s'obtient par appel à la méthode CalciumTypes::InfoType getInfo() . La classe CalciumException hérite également de l'exception C++ SALOME_Exception.
-
-
-
-Il est nécessaire d'utiliser une option de compilation pour autoriser les exceptions C++ à traverser les codes C et Fortran appelés depuis le service du composant SALOME. Pour les compilateurs GNU, cette option est -fexceptions.
-
-
-
-Les journaux générés par les containers SALOME contiennent des informations sur l'évolution des services utilisant CALCIUM. Un travail reste cependant à faire pour synthétiser plus clairement ces informations sous forme de fichiers trace CALCIUM.
-
-
-
-Il est prévu d'étendre les types de données transmis à des types complexes comme des champs ou maillages MED.
-
-
-
-
-
-Le lancement du couplage CALCIUM
---------------------------------
-
-
-
-
-
-Il est possible de lancer le couplage CALCIUM de trois manières. La première consiste à utiliser uniquement le KERNEL de SALOME et gérer les instances de composants par un script python. La seconde consiste en la création d'un composant qui piloterait le couplage. La troisième consiste à utiliser le composant superviseur YACS avec ou sans son GUI.
-
-
-
-La mise en place de l'environnement
-'''''''''''''''''''''''''''''''''''
-
-
-
-Quelle que soit la méthode choisie, il est nécessaire d'indiquer au module KERNEL l'existence de nouveaux modules à utiliser. Si l'ensemble des composants est au sein d'un même module, un seul module est à déclarer.
-
-Cette étape n'est pas spécifique aux composants CALCIUM, elle est nécessaire pour tout composant SALOME.
-
-
-
-Déclaration de <mon module>_ROOT_DIR
-++++++++++++++++++++++++++++++++++++
-
-
-
-Que ce soit dans un script shell *envSalome.sh* rassemblant l'ensemble des variables d'environnement utiles à SALOME ou dans la console de l'utilisateur, le module KERNEL se repose sur une variable <mon module>_ROOT_DIR pour localiser le répertoire d'installation du module <mon module>.
-
-
-
-Exemple de déclaration du module CALCIUM_TESTS en bash :
-
-
-::
-
- INSTALLROOT="/local/salome4.1.1/SALOME4/V4_1_1NoDebug"
- export CALCIUM_TESTS=${INSTALLROOT}/DEV/INSTALL/CALCIUM_TESTS
-
-
-
-Dans le cadre d'une application SALOME (cf. documentation en ligne du module KERNEL définissant la notion d'application), l'outil appli_gen.py préparera l'environnement adéquat dans le répertoire env.d.
-
-
-
-
-Chargement du module <mon module> au lancement de SALOME
-++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-
-
-Afin de charger le module <mon module> au lancement de SALOME, deux solutions existent :
-
-Déclaration dans le fichier SalomeApp.xml
-#########################################
-
-
-
-Il suffit de déclarer le nom de son module dans le paramètre modules du fichier SalomeApp.xml.
-
-Voici un exemple pour le module CALCIUM_TESTS :
-
-
-::
-
- <section name="launch">
- ....
- <parameter name="modules" value="GEOM,SMESH,VISU,YACS,MED,CALCIUM_TESTS"/>
- ....
- </section>
-
-
-
-
-Utilisation de l'option –-module
-################################
-
-
-
-Cette option permet de limiter le chargement des modules à la liste indiquée en ligne de commande (elle suppose que l'environnement de l'utilisateur indique la localisation des modules).
-
-
-::
-
- ./runAppli --module=YACS,CALCIUM_TESTS
-
-
-
-
-Le lancement d'un couplage simple via un script python
-''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-
-
-La création des composants et la connexion de leurs ports peuvent être effectuées via une session salome python.
-
-
-
-Le script CAS_1.py charge des instances des composants ECODE, SCODE et ESPION, connecte leurs ports, réalise les configurations nécessaires et s'occupe de lancer les exécutions.
-
-
-
-Voici un extrait du fichier CAS_1.py :
-::
-
-
- import LifeCycleCORBA
- import Engines
- import Ports
- import CALCIUM_TESTS
- import orbmodule
- import user
-
- import sys
- import threading
- from omniORB import any
-
- #Chargement des instances de composants via le LifeCycle
- lcc = LifeCycleCORBA.LifeCycleCORBA()
- ecode = lcc.FindOrLoad_Component('FactoryServer3', 'ECODE')
- ecode.init_service("EcodeGo")
- scode = lcc.FindOrLoad_Component('FactoryServer4', 'SCODE')
- scode.init_service("ScodeGo")
-
- #Affichage du contenu du Serveur de noms
- #Obtention d'une référence au gestionnaire de connexions
- clt=orbmodule.client()
- clt.showNS()
- connection_manager = clt.Resolve("ConnectionManager")
-
- #Création des liens CALCIUM via le gestionnaire de connexions
- connection_manager.connect(scode, "STP_EN",ecode, "ETP_EN")
- connection_manager.connect(scode, "STP_RE", ecode, "ETP_RE")
- connection_manager.connect(scode, "STP_DB", ecode, "ETP_DB")
- connection_manager.connect(scode, "SIP_EN", ecode, "EIP_EN")
- connection_manager.connect(scode, "SIP_DB", ecode, "EIP_DB")
- connection_manager.connect(scode, "SIS_EN", ecode, "EIS_EN")
- connection_manager.connect(scode, "SIS_DB", ecode, "EIS_DB")
- connection_manager.connect(scode, "STS_EN", ecode, "ETS_EN")
- connection_manager.connect(scode, "STS_DB", ecode, "ETS_DB")
- port1=ecode.get_provides_port("ETS_DB",0);
- myAny1_1=4
- port1.set_property("StorageLevel",any.to_any(myAny1_1))
- connection_manager.connect(scode, "STS_DB", ecode, "ETP_DB2")
- connection_manager.connect(scode, "STP_CX", ecode, "ETP_CX")
- connection_manager.connect(scode, "STP_CH", ecode, "ETP_CH")
- connection_manager.connect(scode, "STP_LQ", ecode, "ETP_LQ")
- #Création et connexion de l'espion
- #Il est possible de créer l'ESPION après le lancement des instances d'ECODE et d'SCODE, cependant les données produites avant sa connexion lui seront inconnues.
- espion = lcc.FindOrLoad_Component('FactoryServer5', 'ESPION')
- espion.init_service("EspionGo")
-
- connection_manager.connect(scode, "STP_DB2", ecode, "ETP_DB2")
- connection_manager.connect(espion, "STP_DB2", ecode, "ETP_DB2")
- connection_manager.connect(scode, "SIP_DB2", espion, "SIP_DB2")
- connection_manager.connect(espion, "SIP_DB" , ecode , "EIP_DB" )
- connection_manager.connect(scode, "SIP_DB" , espion, "EIP_DB")
-
- #Si l'espion est lancé en dernier le CAS_1 passe mais le test 15 ne passe pas
- handler3=threading.Thread(target=espion.EspionGo)
- handler3.start()
- handler=threading.Thread(target=ecode.EcodeGo)
- handler.start()
- handler2=threading.Thread(target=scode.ScodeGo)
- handler2.start()
-
- handler.join()
- handler2.join()
- handler3.join()
-
-
-
-
-Le lancement du script peut s'effectuer via la commande suivante :
-
-
-::
-
- ./runAppli -t --module=YACS,CALCIUM_TESTS -u <mon chemin d'accès au module CALCIUM_TESTS installé>/CALCIUM_TESTS/lib/python2.4/site-packages/salome/CAS_1.py
-
-
-
-
-
-Le lancement du couplage via le GUI de YACS
-'''''''''''''''''''''''''''''''''''''''''''
-
-
-
-Si le catalogue du module contient la description des composants et de leurs services, il est aisé de constituer un schéma de couplage en insérant les services de composants que l'on veut lier.
-
-Pour insérer un service, il suffit de cliquer droit /CAS_1/create a node/ create a node from catalog/ dans l'arbre d'édition du graphe.
-
-Lier deux ports consiste en la sélection du port de sortie (dans l'arbre d'édition) suivie d'un clic droit sur la commande /add data link/, puis en la sélection du port d'entrée.
-
-Dans la version V4.1.1 du GUI de YACS, il n'y a pas de contrôle de cohérence sur le branchement de type de ports CALCIUM incompatibles. Une erreur surviendra cependant à l'exécution.
-
-Une fois le schéma créé, il est possible de l'exporter au format XML de schéma de couplage YACS (cf barre outils).
-
-
-
-Voici un exemple graphique du schéma de couplage du premier cas test CALCIUM :
-
-.. image:: images/1000000000000780000004B0E1FC3F2E.png
- :width: 17.586cm
- :height: 10.989cm
-
-Une fois le schéma établi, il suffit de créer une exécution en cliquant droit sur /YACS/CAS_1/New Execution/. L'arbre d'étude devient arbre d'exécution où apparaît l'état des différents services. Une fois le lancement effectué (par pression sur le bouton adéquat dans la barre d'outil) les services sont dans l'état 'done' si tout s'est bien déroulé. Il est possible d'afficher le journal d'un container associé à l'exécution d'un service en cliquant droit sur le service intéressé et en sélectionnant /Node container Log/. En cas d'erreur des rapports sont visualisables en sélectionnant /Error Details/ ou /Error Report/.
-
-Il est possible de créer autant d'exécutions que nécessaire. Une modification du schéma d'édition ne modifie pas les schémas d'exécutions existants. Il faut recréer une exécution pour lancer le schéma modifié. Pour retrouver le schéma d'édition correspondant à un schéma d'exécution il faut cliquer droit et sélectionner /New Edition/.
-
-
-
-Toute configuration de container est possible :
-
-1. plusieurs services CALCIUM (d'un même composant ou de composants différents) couplés au sein d'un même container
-
-
-
-2. plusieurs services CALCIUM (d'un même composant ou de composants différents) couplés au sein de containers différents
-
-
-
-3. une configuration intermédiaire des deux cas précédents.
-
-
-
-Limitations actuelles :
-
-1. Il n'est pas possible d'avoir plusieurs services d'un même composant utilisant simultanément des ports CALCIUM distincts mais de même nom.
-
-
-
-2. Il n'est pas possible de relancer une même exécution car la méthode init_service tente de créer des ports existants (il faut recréer une exécution ou modifier init_service de façon à mémoriser la création des ports).
-
-
-
-Le lancement du couplage via YACS sans GUI
-''''''''''''''''''''''''''''''''''''''''''
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-ANNEXE 1 : Création d'une application SALOME
---------------------------------------------
-
-
-
-Exemple de commande invoquée pour créer une application SALOME après adaptation du fichier config_appli.xml :
-
-
-::
-
- python DEV/INSTALL/KERNEL/bin/salome/appli_gen.py --prefix=/local/salome4.1.1_mine --config=/local/salome4.1.1/SALOME4/V4_1_1NoDebug/DEV/SRC/KERNEL_SRC_V4_1_0_maintainance/bin/config_appli.xml
-
-
-ANNEXE 2 : Schéma de couplage, fichier XML YACS
------------------------------------------------
-
-
-
-Le fichier CAS_1.xml complet du schéma de couplage du cas test CALCIUM CAS_1 (Il peut être généré par le GUI de YACS) :
-
-
-::
-
- <?xml version='1.0'?>
- <proc>
- <type name="Bool" kind="bool"/>
- <type name="Double" kind="double"/>
- <type name="Int" kind="int"/>
- <type name="String" kind="string"/>
- <objref name="CALCIUM_complex" id="IDL:Ports/Calcium_Ports/Calcium_Complex_Port:1.0"/>
- <objref name="CALCIUM_double" id="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0"/>
- <objref name="CALCIUM_integer" id="IDL:Ports/Calcium_Ports/Calcium_Integer_Port:1.0"/>
- <objref name="CALCIUM_logical" id="IDL:Ports/Calcium_Ports/Calcium_Logical_Port:1.0"/>
- <objref name="CALCIUM_real" id="IDL:Ports/Calcium_Ports/Calcium_Real_Port:1.0"/>
- <objref name="CALCIUM_string" id="IDL:Ports/Calcium_Ports/Calcium_String_Port:1.0"/>
- <objref name="file" id="file"/>
- <container name="DefaultContainer">
- <property name="container_name" value=""/>
- <property name="cpu_clock" value="0"/>
- <property name="hostname" value=""/>
- <property name="isMPI" value="false"/>
- <property name="mem_mb" value="0"/>
- <property name="nb_component_nodes" value="0"/>
- <property name="nb_node" value="0"/>
- <property name="nb_proc_per_node" value="0"/>
- <property name="parallelLib" value=""/>
- <property name="workingdir" value=""/>
- </container>
- <service name="SCODE">
- <component>SCODE</component>
- <load container="DefaultContainer"/>
- <method>ScodeGo</method>
- <outstream name="STP_EN" type="CALCIUM_integer"/>
- <outstream name="STP_RE" type="CALCIUM_real"/>
- <outstream name="STP_DB" type="CALCIUM_double"/>
- <outstream name="STP_CX" type="CALCIUM_complex"/>
- <outstream name="STP_CH" type="CALCIUM_string"/>
- <outstream name="STP_LQ" type="CALCIUM_logical"/>
- <outstream name="SIP_EN" type="CALCIUM_integer"/>
- <outstream name="SIP_DB" type="CALCIUM_double"/>
- <outstream name="STP_DB2" type="CALCIUM_double"/>
- <outstream name="SIS_EN" type="CALCIUM_integer"/>
- <outstream name="SIS_DB" type="CALCIUM_double"/>
- <outstream name="STS_EN" type="CALCIUM_integer"/>
- <outstream name="STS_DB" type="CALCIUM_double"/>
- <outstream name="SIP_DB2" type="CALCIUM_double"/>
- </service>
- <service name="ECODE">
- <component>ECODE</component>
- <load container="DefaultContainer"/>
- <method>EcodeGo</method>
- <instream name="ETP_EN" type="CALCIUM_integer"/>
- <instream name="ETP_RE" type="CALCIUM_real"/>
- <instream name="ETP_DB" type="CALCIUM_double"/>
- <instream name="ETP_CX" type="CALCIUM_complex"/>
- <instream name="ETP_CH" type="CALCIUM_string"/>
- <instream name="ETP_LQ" type="CALCIUM_logical"/>
- <instream name="EIP_EN" type="CALCIUM_integer"/>
- <instream name="EIP_DB" type="CALCIUM_double"/>
- <instream name="ETP_DB2" type="CALCIUM_double"/>
- <instream name="EIS_EN" type="CALCIUM_integer"/>
- <instream name="EIS_DB" type="CALCIUM_double"/>
- <instream name="ETS_EN" type="CALCIUM_integer"/>
- <instream name="ETS_DB" type="CALCIUM_double"/>
- </service>
- <service name="Espion">
- <component>ESPION</component>
- <load container="DefaultContainer"/>
- <method>EspionGo</method>
- <instream name="SIP_DB2" type="CALCIUM_double"/>
- <instream name="EIP_DB" type="CALCIUM_double"/>
- <outstream name="STP_DB2" type="CALCIUM_double"/>
- <outstream name="SIP_DB" type="CALCIUM_double"/>
- </service>
- <stream>
- <fromnode>SCODE</fromnode> <fromport>STP_EN</fromport>
- <tonode>ECODE</tonode> <toport>ETP_EN</toport>
- </stream>
- <stream>
- <fromnode>SCODE</fromnode> <fromport>STP_RE</fromport>
- <tonode>ECODE</tonode> <toport>ETP_RE</toport>
- </stream>
- <stream>
- <fromnode>SCODE</fromnode> <fromport>STP_DB</fromport>
- <tonode>ECODE</tonode> <toport>ETP_DB</toport>
- </stream>
- <stream>
- <fromnode>SCODE</fromnode> <fromport>STP_CX</fromport>
- <tonode>ECODE</tonode> <toport>ETP_CX</toport>
- </stream>
- <stream>
- <fromnode>SCODE</fromnode> <fromport>STP_CH</fromport>
- <tonode>ECODE</tonode> <toport>ETP_CH</toport>
- </stream>
- <stream>
- <fromnode>SCODE</fromnode> <fromport>STP_LQ</fromport>
- <tonode>ECODE</tonode> <toport>ETP_LQ</toport>
- </stream>
- <stream>
- <fromnode>SCODE</fromnode> <fromport>SIP_EN</fromport>
- <tonode>ECODE</tonode> <toport>EIP_EN</toport>
- </stream>
- <stream>
- <fromnode>SCODE</fromnode> <fromport>SIP_DB</fromport>
- <tonode>ECODE</tonode> <toport>EIP_DB</toport>
- </stream>
- <stream>
- <fromnode>SCODE</fromnode> <fromport>SIP_DB</fromport>
- <tonode>Espion</tonode> <toport>EIP_DB</toport>
- </stream>
- <stream>
- <fromnode>SCODE</fromnode> <fromport>STP_DB2</fromport>
- <tonode>ECODE</tonode> <toport>ETP_DB2</toport>
- </stream>
- <stream>
- <fromnode>SCODE</fromnode> <fromport>SIS_EN</fromport>
- <tonode>ECODE</tonode> <toport>EIS_EN</toport>
- </stream>
- <stream>
- <fromnode>SCODE</fromnode> <fromport>SIS_DB</fromport>
- <tonode>ECODE</tonode> <toport>EIS_DB</toport>
- </stream>
- <stream>
- <fromnode>SCODE</fromnode> <fromport>STS_EN</fromport>
- <tonode>ECODE</tonode> <toport>ETS_EN</toport>
- </stream>
- <stream>
- <fromnode>SCODE</fromnode> <fromport>STS_DB</fromport>
- <tonode>ECODE</tonode> <toport>ETS_DB</toport>
- <property name="level" value="4"/>
- </stream>
- <stream>
- <fromnode>SCODE</fromnode> <fromport>STS_DB</fromport>
- <tonode>Espion</tonode> <toport>SIP_DB2</toport>
- </stream>
- <stream>
- <fromnode>SCODE</fromnode> <fromport>STS_DB</fromport>
- <tonode>Espion</tonode> <toport>EIP_DB</toport>
- </stream>
- <stream>
- <fromnode>SCODE</fromnode> <fromport>SIP_DB2</fromport>
- <tonode>Espion</tonode> <toport>SIP_DB2</toport>
- </stream>
- <stream>
- <fromnode>Espion</fromnode> <fromport>STP_DB2</fromport>
- <tonode>ECODE</tonode> <toport>ETP_DB2</toport>
- </stream>
- <stream>
- <fromnode>Espion</fromnode> <fromport>SIP_DB</fromport>
- <tonode>ECODE</tonode> <toport>EIP_DB</toport>
- </stream>
- </proc>
-
-
-
-ANNEXE 3 : Génération d'un module CALCIUM
------------------------------------------
-
-
-
-Script ModuleGenerator complet pour créer un module CALCIUM_TESTS généré :
-::
-
- from module_generator import Generator,Module,PYComponent,CPPComponent,Service,F77Component
- context={"update":1,
- "prerequisites":"/local/salome4.1.1/SALOME4/V4_1_1NoDebug/prerequis-V4_1_1NoDebug.sh",
- "kernel":"/local/salome4.1.1/SALOME4/V4_1_1NoDebug/DEV/INSTALL/KERNEL/"
- }
-
- c1=CPPComponent("ECODE",
- services=[
- Service("EcodeGo",
- instream=[
- ("ETP_EN","CALCIUM_integer","T"),
- ("ETP_RE","CALCIUM_real","T"),
- ("ETP_DB","CALCIUM_double","T"),
- ("ETP_CX","CALCIUM_complex","T"),
- ("ETP_CH","CALCIUM_string","T"),
- ("ETP_LQ","CALCIUM_logical","T"),
- ("EIP_EN","CALCIUM_integer","I"),
- ("EIP_DB","CALCIUM_double","I"),
- ("ETP_DB2","CALCIUM_double","T"),
- ("EIS_EN","CALCIUM_integer","I"),
- ("EIS_DB","CALCIUM_double","I"),
- ("ETS_EN","CALCIUM_integer","T"),
- ("ETS_DB","CALCIUM_double","T") ],
- outstream=[],
- defs="extern \"C\" {\n\
- int ecode(void *); \n\
- }",
- body="\
- ecode(component);\
- "
- ,),
- ],
- libs="",
- rlibs=""
- )
-
- c2=CPPComponent("SCODE",
- services=[
- Service("ScodeGo",
- instream=[],
- outstream=[
- ("STP_EN","CALCIUM_integer","T"),
- ("STP_RE","CALCIUM_real","T"),
- ("STP_DB","CALCIUM_double","T"),
- ("STP_CX","CALCIUM_complex","T"),
- ("STP_CH","CALCIUM_string","T"),
- ("STP_LQ","CALCIUM_logical","T"),
- ("SIP_EN","CALCIUM_integer","I"),
- ("SIP_DB","CALCIUM_double","I"),
- ("STP_DB2","CALCIUM_double","T"),
- ("SIS_EN","CALCIUM_integer","I"),
- ("SIS_DB","CALCIUM_double","I"),
- ("STS_EN","CALCIUM_integer","T"),
- ("STS_DB","CALCIUM_double","T"),
- ("SIP_DB2","CALCIUM_double","I") ],
- defs="extern \"C\" {\n\
- int scode(void *); \n\
- }",
- body="\
- scode(component);\
- "
- ,),
- ],
- libs="",
- rlibs=""
- )
-
- c3=CPPComponent("ESPION",
- services=[
- Service("EspionGo",
- instream=[
- ("SIP_DB2","CALCIUM_double","I"),
- ("EIP_DB","CALCIUM_double","I")],
- outstream=[
- ("STP_DB2","CALCIUM_double","T"),
- ("SIP_DB","CALCIUM_double","I") ],
- defs="extern \"C\" {\n\
- int espion(void *); \n\
- }",
- body="\
- espion(component);\
- "
- ,),
- ],
- libs="",
- rlibs=""
- )
-
-
- m=Module("CALCIUM_TESTS",components=[c1,c2,c3],prefix="INSTALL")
-
- g=Generator(m,context)
- g.generate()
- ##g.bootstrap()
- ##g.configure()
- ##g.make()
- ##g.install()
- ##g.make_appli("appli",restrict=["KERNEL","GUI","YACS"])
-
-.. [1] La bibliothèque CALCIUM est partagée par plusieurs composants d'un même container, elle a donc besoin d'un pointeur sur le composant pour identifier les ports demandés.
--- /dev/null
+
+.. _calciumapi:
+
+
+==========================================================
+CALCIUM C and Fortran coupling library
+==========================================================
+This section is the CALCIUM coupling library reference for C and Fortran.
+For python, see module :mod:`calcium`.
+
+Presentation is done in the following order:
+
+- include files : constants
+- functions to connect and disconnect
+- functions to export data
+- functions to import data
+- functions to erase data
+- examples
+- error codes
+
+Include files
+====================
+All constants used with the coupling library are defined in an include file.
+
+**C:**
+
+.. code-block:: c
+
+ #include "calcium.h"
+
+**Fortran:**
+
+.. code-block:: fortran
+
+ INCLUDE 'calcium.hf'
+
+These constants are:
+
+- Error codes (see :ref:`errcodes`)
+- Dependency modes (CP_TEMPS, CP_ITERATION or CP_SEQUENTIEL)
+- Disconnection modes (CP_CONT or CP_ARRET)
+
+
+.. default-domain:: c
+
+Functions to connect and disconnect
+===============================================
+
+**C:**
+
+.. function:: int info = cp_cd(long *compo, char *instance_name)
+
+ Initialize the connection with YACS.
+
+**Fortran:**
+
+.. function:: call cpcd(compo, instance_name, info)
+
+ :param compo: component address
+ :type compo: long
+ :param instance_name: instance name given by YACS
+ :type instance_name: 64 characters string, output
+ :param info: error code (possible codes: CPMACHINE)
+ :type info: int, return
+
+
+**C:**
+
+.. function:: int info = cp_fin(long *compo, int directive)
+
+ Close the connection with YACS.
+
+**Fortran:**
+
+.. function:: call cpfin(compo, directive, info)
+
+ :param compo: component address
+ :type compo: long
+ :param directive: indicate how variables will be handled after disconnection. If directive = CP_CONT,
+ variables produced by this component are defined constant beyond the last time or iteration number. If
+ directive = CP_ARRET, variables are not defined beyond the last step.
+ :type directive: int
+ :param info: error code (possible codes: CPDNDI)
+ :type info: int, return
+
+
+Functions to export data
+===============================
+Writing requests is the way for a component to export data through one of its
+output ports. nm_var is the port name.
+
+Each request exports n values from the var_xxx array. Exported values are defined
+at time t if mode is CP_TEMPS or at iteration number i if mode is CP_ITERATION.
+
+It is mandatory to export data at increasing times or iteration numbers.
+The export is done in an asynchronous way. Control is given back to the caller as
+soon as data have been sent.
+
+There is generally one request for each data type to export. Each request can be used with one and only port type.
+For long type, two requests are available (cp_elg and cp_eln). One (cp_elg) is working with CALCIUM_integer port type
+and the second (cp_eln) is working with CALCIUM_long port type.
+
+The available port types are :
+
+- CALCIUM_integer
+- CALCIUM_long
+- CALCIUM_float
+- CALCIUM_double
+- CALCIUM_complex
+- CALCIUM_string
+- CALCIUM_logical
+
+**C:**
+
+.. function:: int info = cp_ere(long *compo, int dep, float t, int i, char *nm_var, int n, float *var_real)
+
+ for single precision floating point values (C float type and CALCIUM_float port type)
+.. function:: int info = cp_edb(long *compo, int dep, double td, int i, char *nm_var, int n, double *var_double)
+
+ for double precision floating point values (C double type and CALCIUM_double port type)
+.. function:: int info = cp_ecp(long *compo, int dep, float t, int i, char *nm_var, int n, float *var_complex)
+
+ for complex values (C float type and CALCIUM_complex port type)
+.. function:: int info = cp_een(long *compo, int dep, float t, int i, char *nm_var, int n, int *var_integer)
+
+ for integer values (C int type and CALCIUM_integer port type)
+.. function:: int info = cp_elg(long *compo, int dep, float t, int i, char *nm_var, int n, long *var_long)
+
+ for integer values (C long type and CALCIUM_integer port type)
+.. function:: int info = cp_eln(long *compo, int dep, float t, int i, char *nm_var, int n, long *var_long)
+
+ for integer values (C long type and CALCIUM_long port type)
+.. function:: int info = cp_elo(long *compo, int dep, float t, int i, char *nm_var, int n, int *var_boolean)
+
+ for boolean values (C int type and CALCIUM_logical port type)
+.. function:: int info = cp_ech(long *compo, int dep, float t, int i, char *nm_var, int n, char **var_string, int strSize)
+
+ for string values (C char* type and CALCIUM_string port type)
+
+**Fortran:**
+
+.. function:: CALL CPERE(LONGP compo, INTEGER dep, REAL*4 t, INTEGER i, nm_var, INTEGER n, REAL*4 var_real, INTEGER info)
+.. function:: CALL CPEDB(LONGP compo, INTEGER dep, REAL*8 td, INTEGER i, nm_var, INTEGER n, REAL*8 var_double, INTEGER info)
+.. function:: CALL CPECP(LONGP compo, INTEGER dep, REAL*4 t, INTEGER i, nm_var, INTEGER n, REAL*4 var_complex, INTEGER info)
+.. function:: CALL CPEEN(LONGP compo, INTEGER dep, REAL*4 t, INTEGER i, nm_var, INTEGER n, INTEGER var_integer, INTEGER info)
+.. function:: CALL CPELG(LONGP compo, INTEGER dep, REAL*4 t, INTEGER i, nm_var, INTEGER n, INTEGER*8 var_long, INTEGER info)
+
+ can only be used on 64 bits architecture.
+.. function:: CALL CPELN(LONGP compo, INTEGER dep, REAL*4 t, INTEGER i, nm_var, INTEGER n, INTEGER*8 var_long, INTEGER info)
+
+ can only be used on 64 bits architecture.
+.. function:: CALL CPEIN(LONGP compo, INTEGER dep, REAL*4 t, INTEGER i, nm_var, INTEGER n, INTEGER*4 var_int, INTEGER info)
+.. function:: CALL CPELO(LONGP compo, INTEGER dep, REAL*4 t, INTEGER i, nm_var, INTEGER n, INTEGER*4 var_boolean,INTEGER info)
+.. function:: CALL CPECH(LONGP compo, INTEGER dep, REAL*4 t, INTEGER i, nm_var, INTEGER n, var_string, INTEGER info)
+
+ :param compo: component address
+ :type compo: long
+ :param dep: dependency type - CP_TEMPS (time dependency) or CP_ITERATION (iteration dependency)
+ :type dep: int
+ :param t: time value if dep=CP_TEMPS
+ :type t: float
+ :param td: time value if dep=CP_TEMPS
+ :type td: double
+ :param i: iteration number if dep=CP_ITERATION
+ :type i: int
+ :param nm_var: port name
+ :type nm_var: string (64 characters)
+ :param n: number of values to export (from var_xxx array)
+ :type n: int
+ :param var_real: array containing the values to export
+ :type var_real: float array
+ :param var_complex: array containing the values to export (array size is twice the number of complex numbers)
+ :type var_complex: float array
+ :param var_integer: array containing the values to export
+ :type var_integer: int array
+ :param var_long: array containing the values to export
+ :type var_long: long array
+ :param var_boolean: array containing the values to export
+ :type var_boolean: int array
+ :param var_string: array containing the values to export
+ :type var_string: array of strings
+ :param var_double: array containing the values to export
+ :type var_double: double array
+ :param strSize: size of strings in var_string
+ :type strSize: int
+ :param info: error code (possible codes: CPIT, CPITVR, CPNMVR, CPNTNULL, CPIOVR, CPTPVR or CPCTVR)
+ :type info: int, return
+
+.. note::
+ LONGP is a Fortran type that is same size as the C long type, so, most of a time, INTEGER\*4 for 32 bits architecture
+ and INTEGER\*8 for 64 bits architecture.
+
+.. warning::
+ CPELG (or cp_elg) can produce wrong results (conversion problem) on 64 bits architecture if the KERNEL module is built
+ with the default option (--with-cal_int=int)
+
+See :ref:`fortran64bits` for more details.
+
+
+Functions to import data
+=============================
+Reading requests is the way for a component to import data through one of its
+input ports. nm_var is the port name. Import is only possible if the input port
+is connected to an output port.
+
+Reading requests can be of two kinds:
+ - standard request
+ - sequential request
+
+A standard request imports data at a given time or iteration number. In case of time dependency, the effective time
+is calculated by YACS from the interval time (ti, tf) and the interpolation scheme that is given in the coupling file.
+
+A sequential request imports data in a sequential way. Each request returns
+the next data with its associated time or iteration number.
+
+There is generally one request for each data type to import. Each request can be used with one and only port type.
+For long type, two requests are available (cp_llg and cp_lln). One (cp_llg) is working with CALCIUM_integer port type
+and the second (cp_lln) is working with CALCIUM_long port type.
+
+**C:**
+
+.. function:: int info = cp_lre(long *compo, int dep, float *ti, float *tf, int *i, char *nm_var, int len, int *n, float *var_real)
+.. function:: int info = cp_ldb(long *compo, int dep, double *tid, double *tfd, int *i, char *nm_var, int len, int *n, double *var_double)
+.. function:: int info = cp_lcp(long *compo, int dep, float *ti, float *tf, int *i, char *nm_var, int len, int *n, float *var_complex)
+.. function:: int info = cp_len(long *compo, int dep, float *ti, float *tf, int *i, char *nm_var, int len, int *n, int *var_integer)
+.. function:: int info = cp_llg(long *compo, int dep, float *ti, float *tf, int *i, char *nm_var, int len, int *n, long *var_long)
+.. function:: int info = cp_lln(long *compo, int dep, float *ti, float *tf, int *i, char *nm_var, int len, int *n, long *var_long)
+.. function:: int info = cp_llo(long *compo, int dep, float *ti, float *tf, int *i, char *nm_var, int len, int *n, int *var_boolean)
+.. function:: int info = cp_lch(long *compo, int dep, float *ti, float *tf, int *i, char *nm_var, int len, int *n, char **var_string, int strSize)
+
+**Fortran:**
+
+.. function:: CALL CPLRE(LONGP compo, INTEGER dep, REAL*4 ti, tf, INTEGER i, nm_var,INTEGER len, INTEGER n,REAL*4 var_real, INTEGER info)
+.. function:: CALL CPLDB(LONGP compo, INTEGER dep, REAL*8 tid, tf, INTEGER i, nm_var,INTEGER len, INTEGER n,REAL*8 var_double, INTEGER info)
+.. function:: CALL CPLCP(LONGP compo, INTEGER dep, REAL*4 ti, tf, INTEGER i, nm_var,INTEGER len, INTEGER n,REAL*4 var_complex, INTEGER info)
+.. function:: CALL CPLEN(LONGP compo, INTEGER dep, REAL*4 ti, tf, INTEGER i, nm_var,INTEGER len, INTEGER n,INTEGER var_integer, INTEGER info)
+.. function:: CALL CPLLG(LONGP compo, INTEGER dep, REAL*4 ti, tf, INTEGER i, nm_var,INTEGER len, INTEGER n,INTEGER*8 var_long, INTEGER info)
+
+ can only be used on 64 bits architecture.
+.. function:: CALL CPLLN(LONGP compo, INTEGER dep, REAL*4 ti, tf, INTEGER i, nm_var,INTEGER len, INTEGER n,INTEGER*8 var_long, INTEGER info)
+
+ can only be used on 64 bits architecture.
+.. function:: CALL CPLIN(LONGP compo, INTEGER dep, REAL*4 ti, tf, INTEGER i, nm_var,INTEGER len, INTEGER n,INTEGER*4 var_int, INTEGER info)
+.. function:: CALL CPLLO(LONGP compo, INTEGER dep, REAL*4 ti, tf, INTEGER i, nm_var,INTEGER len, INTEGER n,INTEGER*4 var_boolean,INTEGER info)
+.. function:: CALL CPLCH(LONGP compo, INTEGER dep, REAL*4 ti, tf, INTEGER i, nm_var,INTEGER len, INTEGER n,var_string, INTEGER info)
+
+ :param compo: component address
+ :type compo: long
+ :param dep: dependency type - CP_TEMPS (time dependency) or CP_ITERATION (iteration dependency)
+ :type dep: int
+ :param ti: interval start time if dep=CP_TEMPS or associated time if dep=CP_SEQUENTIEL
+ :type ti: float, inout
+ :param tf: interval end time if dep=CP_TEMPS
+ :type tf: float
+ :param tid: interval start time if dep=CP_TEMPS or associated time if dep=CP_SEQUENTIEL
+ :type tid: double, inout
+ :param tfd: interval end time if dep=CP_TEMPS
+ :type tfd: double
+ :param i: iteration number if dep=CP_ITERATION or dep=CP_SEQUENTIEL
+ :type i: int, inout
+ :param nm_var: port name
+ :type nm_var: string (64 characters)
+ :param len: size of var_xxx array
+ :type len: int
+ :param n: effective number of values imported (into var_xxx array)
+ :type n: int, out
+ :param var_real: array containing the values imported
+ :type var_real: float array, out
+ :param var_complex: array containing the values imported (array size is twice the number of complex numbers)
+ :type var_complex: float array, out
+ :param var_integer: array containing the values imported
+ :type var_integer: int array, out
+ :param var_long: array containing the values imported
+ :type var_long: long array, out
+ :param var_boolean: array containing the values imported
+ :type var_boolean: int array, out
+ :param var_string: array containing the values imported
+ :type var_string: array of strings (char*), out
+ :param var_double: array containing the values imported
+ :type var_double: double array, out
+ :param strSize: size of strings in var_string
+ :type strSize: int
+ :param info: error code (possible codes: CPIT, CPITVR, CPNMVR, CPNTNULL, CPIOVR, CPTPVR, CPLIEN, CPATTENTE, CPLGVR or CPSTOP)
+ :type info: int, return
+
+.. note::
+ LONGP is a Fortran type that is same size as the C long type, so, most of a time, INTEGER\*4 for 32 bits architecture
+ and INTEGER\*8 for 64 bits architecture.
+
+.. warning::
+ CPLLG (or cp_llg) can produce wrong results (conversion problem) on 64 bits architecture if the KERNEL module is built
+ with the default option (--with-cal_int=int)
+
+See :ref:`fortran64bits` for more details.
+
+Functions to erase data
+==========================
+The functions cp_fini and cp_fint are used to request that all values of the specified
+variable defined for iteration number or time before a given one be erased.
+
+The functions cp_effi and cp_efft are used to request that all values of the specified
+variable defined for iteration number or time after a given one be erased.
+
+**C:**
+
+.. function:: int info = cp_fini(long *compo, char *nm_var, int i)
+
+ Erase all values of port nm_var before iteration i
+
+**Fortran:**
+
+.. function:: call cpfini(compo, nm_var, i, info)
+
+ :param compo: component address
+ :type compo: long
+ :param nm_var: port name
+ :type nm_var: string
+ :param i: iteration number
+ :type i: int
+ :param info: error code
+ :type info: int, return
+
+**C:**
+
+.. function:: int info = cp_fint(long *compo, char *nm_var, float t)
+
+ Erase all values of port nm_var before time t
+
+**Fortran:**
+
+.. function:: call cpfint(compo, nm_var, t, info)
+
+ :param compo: component address
+ :type compo: long
+ :param nm_var: port name
+ :type nm_var: string
+ :param t: time
+ :type t: float
+ :param info: error code
+ :type info: int, return
+
+**C:**
+
+.. function:: int info = cp_effi(long *compo, char *nm_var, int i)
+
+ Erase all values of port nm_var after iteration i
+
+**Fortran:**
+
+.. function:: call cpfini(compo, nm_var, i, info)
+
+ :param compo: component address
+ :type compo: long
+ :param nm_var: port name
+ :type nm_var: string
+ :param i: iteration number
+ :type i: int
+ :param info: error code
+ :type info: int, return
+
+**C:**
+
+.. function:: int info = cp_efft(long *compo, char *nm_var, float t)
+
+ Erase all values of port nm_var after time t
+
+**Fortran:**
+
+.. function:: call cpfint(compo, nm_var, t, info)
+
+ :param compo: component address
+ :type compo: long
+ :param nm_var: port name
+ :type nm_var: string
+ :param t: time
+ :type t: float
+ :param info: error code
+ :type info: int, return
+
+Examples
+===========
+Fortran example
+-------------------
+If you want to export a single precision real array and import an integer array in iteration mode,
+you could write a subroutine as follows. Connection and disconnection must be done only once.
+
+.. code-block:: fortran
+
+ subroutine coupling(compo)
+ include 'calcium.hf'
+ integer*8 compo
+ real*4 t,af(10)
+ integer i, info, n, ai(10), nval
+ character*64 name
+ C connect to YACS
+ call cpcd(compo,name,info)
+ n=10
+ af(1)=2.5
+ C export 10 real values at iteration 1 on port outa
+ call cpere(compo,CP_ITERATION,t,i,'outa',n,af,info)
+ C import 10 integer values at iteration 1 on port ina
+ call cplen(compo,CP_ITERATION,ti,tf,i,'ina',n,nval,ai,info)
+ write(6,*)ai(1)
+ C disconnect
+ call cpfin(compo,CP_CONT,info)
+ end
+
+C example
+-------------------
+If you want to export a double precision real array and import an integer array in time mode,
+you could write a function as follows. Connection and disconnection must be done only once.
+
+.. code-block:: c
+
+
+ void coupling(void* compo)
+ {
+ int info, i, n;
+ char[64] name;
+ double af[10], td,tf;
+ int ai[10];
+ // connect to YACS
+ info = cp_cd(compo,name);
+ af[0]=10.99;
+ n=10;
+ td=0.;
+ // export 10 double values at time 0. on port outa
+ info = cp_edb(compo,CP_TEMPS,td,i,"outa",n,af);
+ tf=1.;
+ // import 10 integer values at interval time (0.,1.) on port ina
+ // (by default, it is imported at start time 0.)
+ info = cp_len(compo,CP_TEMPS,&td,&tf,&i,"ina",n,&nval,ai);
+ // disconnect
+ info = cp_fin(compo,CP_CONT);
+ }
+
+
+
+.. _errcodes:
+
+Error codes
+==============
+
+========= ============ =================================
+Code Value Explanation
+========= ============ =================================
+CPOK 0 No error
+CPERIU 1 Emitter unknown
+CPNMVR 2 Variable name unknown
+CPIOVR 3 Different input/output codes in code and supervisor
+CPTP 4 Variable type unknown
+CPTPVR 5 Different variable types in code and supervisor
+CPIT 6 Dependency mode unknown
+CPITVR 7 Different dependency modes in code and supervisor
+CPRENA 8 Unauthorized request
+CPDNTP 9 Unauthorized disconnection request type
+CPDNDI 10 Unauthorized disconnection directive
+CPNMCD 11 Code name unknown
+CPNMIN 12 Instance name unknown
+CPATTENTE 13 Waiting request
+CPBLOC 14 Blocking
+CPNTNUL 15 Zero value number
+CPLGVR 16 Insufficient variable length
+CPSTOP 17 Instance is going to stop
+CPATAL 18 Unexpected instance stop
+CPNOCP 19 Manual execution
+CPCTVR 20 Output variable not connected
+CPPASNULL 21 Number of steps to execute is nul
+CPMACHINE 22 Computer not declared
+CPGRNU 23 Environment variable COUPLAGE_GROUPE is not set
+CPGRIN 24 Instance group given by COUPLAGE_GROUPE is wrong
+CPERRFICH 26 Format error in input file
+CPNORERR 27 Request ignored because of switching to NORMAL mode
+CPRUNERR 28 Supervisor is in normal execution mode
+CPOPT 29 Unknown option
+CPVALOPT 30 Option value is wrong
+CPECREFF 31 Impossible to write because of an erasing request
+CPLIEN 32 Reading of a variable wrongly connected
+CPDECL 35 Error in declaration
+CPINEXEC 36 Error in instance launching
+CPCOM 37 Communication error
+CPMODE 39 Execution mode not defined
+CPINSTDEC 40 Disconnected instance
+========= ============ =================================
+
+.. _fortran64bits:
+
+Some considerations about architecture (32, 64 bits) and programming language (C, Fortran)
+=============================================================================================
+Depending on the architecture and the language, types have varying sizes.
+For example, below we compare the size of C and Fortran types for two Linux distributions. One is Debian etch 32 bits
+and the other is Debian lenny 64 bits.
+
+**Type size (in bytes) in C:**
+
+======================= ==================== ===================
+Architecture, compiler 32 bits, gcc 3.3 64 bits, gcc 4.3
+======================= ==================== ===================
+short 2 2
+int 4 4
+long 4 8
+long long 8 8
+float 4 4
+double 8 8
+long double 12 16
+======================= ==================== ===================
+
+**Type size (in bytes) in Fortran:**
+
+======================= ================== ======================= =======================================================
+Architecture, compiler 32 bits, g77 3.3 64 bits, gfortran 4.3 64bits, gfortran -fdefault-integer-8 -fdefault-real-8
+======================= ================== ======================= =======================================================
+integer 4 4 8
+integer*8 8 8 8
+real 4 4 8
+double precision 8 8 8
+real*8 8 8 8
+======================= ================== ======================= =======================================================
+
+With another architecture or compiler, sizes can be different.
+
+Most of a time, Fortran INTEGER is mapped on C int type. So it is 4 bytes wide and equivalent to INTEGER\*4.
+This is the case for 32 bits architecture and 64 bits architecture with standard fortran options.
+
+It is possible, with special options, to map Fortran INTEGER on C long type (-i8 with intel compiler or
+-fdefault-integer-8 with gnu fortran, for example). In this case, using the standard CALCIUM API can be cumbersome.
+
+It is possible to build the SALOME KERNEL module with a special option (--with-cal_int=long) to match this kind of mapping.
+
+By using the cp_een call (or CPEEN fortran call), it is possible to write a code that is independent from the mapping
+and that can always use fortran INTEGER type.
+
--- /dev/null
+.. _calciummod:
+
+==============================================
+:mod:`calcium` -- python interface
+==============================================
+
+.. module:: calcium
+ :platform: Unix
+ :synopsis: calcium interface (connect to YACS and exchange data between coupled components)
+
+calcium python module provides all is needed to connect to YACS and exchange data between coupled components.
+
+Presentation is done in the following order:
+
+- constants
+- array types
+- functions to connect and disconnect
+- functions to export data
+- functions to import data
+- functions to erase data
+- example
+
+Constants
+================
+The constants defined in this module are:
+
+.. data:: CP_TEMPS
+
+ This constant is used in cp_e* and cp_l* calls to indicate that data are associated to a time step.
+
+.. data:: CP_ITERATION
+
+ This constant is used in cp_e* and cp_l* calls to indicate that data are associated to an iteration number.
+
+.. data:: CP_SEQUENTIEL
+
+ This constant is used in cp_l* calls to indicate that the call requests the next data that has been produced.
+
+.. data:: CP_CONT
+
+ This constant can be used in cp_fin to indicate that variables produced by the component are defined
+ beyond the last time or iteration number and their value is equal to the last value produced.
+
+.. data:: CP_ARRET
+
+ This constant can be used in cp_fin to indicate that variables produced by the component are not defined
+ beyond the last time or iteration number.
+
+and all the error codes as listed in :ref:`errcodes`.
+
+Array types
+=============
+numpy arrays can be used to export or import data but if the numpy module is not installed
+calcium provides simple array types to replace them.
+
+.. class:: calcium.intArray(nelem)
+
+ The constructor takes a single argument which is the number of elements of the array
+
+.. class:: calcium.longArray(nelem)
+
+ The constructor takes a single argument which is the number of elements of the array
+
+.. class:: calcium.floatArray(nelem)
+
+ The constructor takes a single argument which is the number of elements of the array
+
+.. class:: calcium.doubleArray(nelem)
+
+ The constructor takes a single argument which is the number of elements of the array
+
+.. class:: calcium.stringArray(nelem, eltsize)
+
+ The constructor takes two arguments: the number of elements of the array and the size
+ of the elements (strings)
+
+Functions to connect and disconnect
+===============================================
+
+.. function:: calcium.cp_cd(compo) -> info, name
+
+ Initialize the connection with YACS.
+
+ :param compo: component reference
+ :type compo: SALOME component object
+
+ :param info: error code
+ :type info: int
+ :param name: instance name given by YACS
+ :type name: string
+
+.. function:: calcium.cp_fin(compo, directive) -> info
+
+ Close the connection with YACS.
+
+ :param compo: component reference
+ :type compo: SALOME component object
+ :param directive: indicate how variables will be handled after disconnection. If directive = CP_CONT,
+ variables produced by this component are defined constant beyond the last time or iteration number. If
+ directive = CP_ARRET, variables are not defined beyond the last step.
+ :type directive: int
+
+ :param info: error code
+ :type info: int
+
+Functions to export data
+============================
+.. function:: calcium.cp_ere(compo, dep, t, i, nm_var, n,var_real) -> info
+.. function:: calcium.cp_edb(compo, dep, t, i, nm_var, n,var_double) -> info
+.. function:: calcium.cp_ecp(compo, dep, t, i, nm_var, n,var_complex) -> info
+.. function:: calcium.cp_een(compo, dep, t, i, nm_var, n,var_integer) -> info
+.. function:: calcium.cp_elg(compo, dep, t, i, nm_var, n,var_long) -> info
+.. function:: calcium.cp_eln(compo, dep, t, i, nm_var, n,var_long) -> info
+.. function:: calcium.cp_elo(compo, dep, t, i, nm_var, n,var_boolean) -> info
+.. function:: calcium.cp_ech(compo, dep, t, i, nm_var, n,var_string) -> info
+
+ :param compo: component reference
+ :type compo: SALOME component object
+ :param dep: dependency mode (calcium.CP_TEMPS, calcium.CP_ITERATION)
+ :type dep: int
+ :param t: export time if mode=calcium.CP_TEMPS
+ :type t: float
+ :param i: export iteration number if mode=calcium.CP_ITERATION
+ :type i: int
+ :param nm_var: port name
+ :type nm_var: string
+ :param n: number of values to export
+ :type n: int
+ :param var_real: array containing float values to export
+ :type var_real: float numpy array or :class:`calcium.floatArray`
+ :param var_double: array containing double values to export
+ :type var_double: double numpy array or :class:`calcium.doubleArray`
+ :param var_complex: array containing complex values to export
+ :type var_complex: complex numpy array or :class:`calcium.floatArray` (double size)
+ :param var_integer: array containing integer values to export
+ :type var_integer: integer numpy array or :class:`calcium.intArray`
+ :param var_long: array containing long values to export
+ :type var_long: long numpy array or :class:`calcium.longArray`
+ :param var_boolean: array containing boolean values to export
+ :type var_boolean: integer numpy array or :class:`calcium.intArray`
+ :param var_string: array containing string values to export
+ :type var_string: string numpy array or :class:`calcium.stringArray`
+
+ :param info: error code
+ :type info: int
+
+With numpy, the data types to use when creating the array, are the following:
+
+============ ====================
+Request numpy data type
+============ ====================
+cp_lre 'f'
+cp_ldb 'd'
+cp_lcp 'F'
+cp_len 'i'
+cp_llg 'l'
+cp_lln 'l'
+cp_llo 'i'
+cp_lch 'Sxx'
+============ ====================
+
+.. note::
+
+ For cp_lch xx is the size of the element string
+
+
+Functions to import data
+===========================
+.. function:: calcium.cp_lre(compo, dep, ti, tf, i, nm_var, len, var_real) -> info, t, ii, n
+.. function:: calcium.cp_ldb(compo, dep, ti, tf, i, nm_var, len, var_double) -> info, t, ii, n
+.. function:: calcium.cp_lcp(compo, dep, ti, tf, i, nm_var, len, var_complex) -> info, t, ii, n
+.. function:: calcium.cp_len(compo, dep, ti, tf, i, nm_var, len, var_integer) -> info, t, ii, n
+.. function:: calcium.cp_llg(compo, dep, ti, tf, i, nm_var, len, var_long) -> info, t, ii, n
+.. function:: calcium.cp_lln(compo, dep, ti, tf, i, nm_var, len, var_long) -> info, t, ii, n
+.. function:: calcium.cp_llo(compo, dep, ti, tf, i, nm_var, len, var_boolean) -> info, t, ii, n
+.. function:: calcium.cp_lch(compo, dep, ti, tf, i, nm_var, len, var_string) -> info, t, ii, n
+
+ :param compo: component reference
+ :type compo: SALOME component object
+ :param dep: dependency mode (calcium.CP_TEMPS, calcium.CP_ITERATION or calcium.CP_SEQUENTIEL)
+ :type dep: int
+ :param ti: interval start time
+ :type ti: float
+ :param tf: interval end time
+ :type tf: float
+ :param i: iteration number
+ :type i: int
+ :param nm_var: port name
+ :type nm_var: string
+ :param len: number of values to import
+ :type len: int
+ :param var_real: array to store imported float values (must be large enough to contain imported values)
+ :type var_real: float numpy array or :class:`calcium.floatArray`
+ :param var_double: array to store imported double values
+ :type var_double: double numpy array or :class:`calcium.doubleArray`
+ :param var_complex: array to store imported complex values
+ :type var_complex: complex numpy array or :class:`calcium.floatArray` (double size)
+ :param var_integer: array to store imported integer values
+ :type var_integer: integer numpy array or :class:`calcium.intArray`
+ :param var_long: array to store imported long values
+ :type var_long: long numpy array or :class:`calcium.longArray`
+ :param var_boolean: array to store imported boolean values
+ :type var_boolean: integer numpy array or :class:`calcium.intArray`
+ :param var_string: array to store imported string values
+ :type var_string: string numpy array or :class:`calcium.stringArray`
+
+ :param info: error code
+ :type info: int
+ :param t: effective time if mode=calcium.CP_TEMPS or associated time if mode=calcium.CP_SEQUENTIEL
+ :type t: float
+ :param ii: associated iteration number if mode=calcium.CP_SEQUENTIEL
+ :type ii: int
+ :param n: effective number of imported values (<= len)
+ :type n: int
+
+Functions to erase data
+==========================
+The functions cp_fini and cp_fint are used to request that all values of the specified
+variable defined for iteration number or time before a given one be erased.
+
+The functions cp_effi and cp_efft are used to request that all values of the specified
+variable defined for iteration number or time after a given one be erased.
+
+.. function:: calcium.cp_fini(compo, nm_var, i) -> info
+
+ Erase all values of port nm_var before iteration i
+
+ :param compo: component reference
+ :type compo: SALOME component object
+ :param nm_var: port name
+ :type nm_var: string
+ :param i: iteration number
+ :type i: int
+ :param info: error code
+ :type info: int, return
+
+.. function:: calcium.cp_fint(compo, nm_var, t) -> info
+
+ Erase all values of port nm_var before time t
+
+ :param compo: component reference
+ :type compo: SALOME component object
+ :param nm_var: port name
+ :type nm_var: string
+ :param t: time
+ :type t: float
+ :param info: error code
+ :type info: int, return
+
+.. function:: calcium.cp_effi(compo, nm_var, i) -> info
+
+ Erase all values of port nm_var after iteration i
+
+ :param compo: component reference
+ :type compo: SALOME component object
+ :param nm_var: port name
+ :type nm_var: string
+ :param i: iteration number
+ :type i: int
+ :param info: error code
+ :type info: int, return
+
+.. function:: calcium.cp_efft(compo, nm_var, t) -> info
+
+ Erase all values of port nm_var after time t
+
+ :param compo: component reference
+ :type compo: SALOME component object
+ :param nm_var: port name
+ :type nm_var: string
+ :param t: time
+ :type t: float
+ :param info: error code
+ :type info: int, return
+
+Example
+========
+If you want to export a double precision real array and import an integer array in time mode,
+you could write a function as follows. Connection and disconnection must be done only once.
+
+.. code-block:: numpy
+
+ import calcium
+ import numpy
+
+ def coupling(compo):
+ # connect to YACS
+ info, name = calcium.cp_cd(compo)
+ # export 10 double values at time 0. on port outa
+ af=numpy.zeros(10,'d')
+ af[0]=4.3
+ info = calcium.cp_edb(compo,calcium.CP_TEMPS,0.,0,"outa",10,af);
+ tf=1.;
+ # import 10 integer values at interval time (0.,1.) on port ina
+ # (by default it is imported at the start time 0.)
+ ai=numpy.zeros(10,'i')
+ info,t,i,n = calcium.cp_len(compo,calcium.CP_TEMPS,0., 1.,0,"ina",10,ai);
+ # disconnect
+ info = calcium.cp_fin(compo,calcium.CP_CONT);
+
+
+
--- /dev/null
+
+.. _calciumyacs:
+
+
+From the old CALCIUM product to CALCIUM in SALOME
+-------------------------------------------------------
+
+This section describes why the CALCIUM product has been upgraded to CALCIUM in SALOME.
+After a brief presentation of the advantages and disadvantages of the existing CALCIUM product, the second section
+presents the implementation of CALCIUM in SALOME using the DSC ports.
+The final section describes the joint use of CALCIUM ports and the YACS supervisor.
+
+The existing CALCIUM product
+''''''''''''''''''''''''''''''
+The CALCIUM product enables fast and easy coupling of Fortran / C / C++ codes in a simple and only slightly
+intrusive manner. Persons responsible for codes used in coupling make a distinction between general interest
+data by the definition of input and output connection points. The person responsible for global coupling defines
+the number of simultaneous executions of the different codes and transmission links between connection points of
+these execution instances. This description is called the coupling scheme and is stored in a coupling file.
+
+Connection points are typed by simple types (integer, floating point, double, booleans, chain) and operate based
+on the time or iterative mode. The data produced are stamped by a date or an iteration number. Data are
+produced and read in codes by a call to write or read primitives. Production is independent of requests on
+read connection points (asynchronism).
+
+When data are requested for a date later than the data already produced, read instances wait on blocking read primitives
+or receive a code indicating that there are no data in non-blocking mode. When data are requested at a date surrounded
+by previously produced data stamps, the reader can obtain interpolated data (L0 and L1) in time mode. Coupling is
+interlocked if the reader(s) is (are) waiting for data that will never be produced. CALCIUM detects this situation
+and proposes either that the execution of coupling should be stopped or that the requested data should be extrapolated
+to unlock the situation. This management depends on mode in which CALCIUM is being used (production mode or debug mode).
+
+CALCIUM has had two operating modes since its version 3. The first called debug mode was the only mode available in
+earlier versions, and has a coupler process through which all data pass. In the second so-called production mode,
+instances of codes communicate with each other directly. In debug mode, the transfer flow is limited by the capacity
+of the coupler network link to manage simultaneous accesses. In this mode, the coupler must store a copy of each
+received data so as to be able to deliver them at the required time and be capable of detecting an interlocked situation.
+Production mode enables a data transfer with performances that are not limited by the capacity of input and output
+links of the coupler because there is no longer a coupler. However, this mode has the limitations that there is no
+detection of interlocking (but a timeout is managed), step back requests are controlled locally, there is no step
+by step execution mode and no dynamic management of coupling.
+
+CALCIUM ports in SALOME
+'''''''''''''''''''''''''''''
+Several couplings were set up during the 2004 Summer school as a result of experimental use of the existing CALCIUM
+tool (in production mode) in SALOME. It showed the relevance of getting datastream type ports to cohabit with
+SALOME dataflow / control flow ports. However, it required a specific modification located in the CALCIUM start
+procedure and it highlighted the following limitations:
+
+- the need to use a different container for each service using CALCIUM (even for services in the same
+ component (CALCIUM is not multithread safe)).
+- successive re-executions of coupling are difficult (need to not call MPI_FIN and problems related to the state of
+ the MPI virtual machine)
+- the SALOME SUPERVISOR has no control over execution of CALCIUM coupling
+- no possible extension of transmitted CALCIUM types
+- cohabitation of the MPI environment and the CORBA environment is sometimes difficult.
+
+The SALOME KERNEL module is provided with new communication ports called DSC (Dynamic Software Component) ports
+that components use to dynamically add / delete new interfaces accessible to everyone.
+:ref:`progdsc` describes how these new ports are used / designed / and their usefulness.
+There are two classes of DSC ports, firstly ports that provide an interface (provides ports), and secondly ports
+that use the interfaces (uses ports).
+
+An implementation of CALCIUM ports based on this technology has been available since SALOME KERNEL version V4.
+Therefore, CALCIUM couplings are possible simply by calling CALCIUM primitives in component services.
+This implementation reuses CALCIUM functions in its production mode. Use of this technology only requires
+the SALOME KERNEL module. However, unless the YACS supervisor is used, the user must write a python script or
+a component service to load and initialize the coupling components, connect the different ports and configure
+them, and start the services in the appropriate order.
+
+
+CALCIUM / SALOME ports and the YACS supervisor
+'''''''''''''''''''''''''''''''''''''''''''''''''
+The YACS supervisor available in SALOME (since version V4.1) manages all types of DSC ports, and particularly CALCIUM ports.
+It relieves the user from the need to implement a script or a service to connect and configure the ports. It checks
+the validity of the calculation scheme and starts services in accordance with the described dependencies.
+A calculation scheme can be created mixing datastream type ports (calcium mode), dataflow ports (arrival of data that
+can trigger starting a service) and control flow ports (one service is started by the end of execution of another
+service), thus creating elaborated calculation schemes.
+
+The calculation scheme thus created can be saved in the XML format. This file represents the equivalent of the
+CALCIUM coupling file for the link declaration and parameter setting part, ports being declared in the XML file
+that catalogs component resources.
+
+Creating a SALOME component using CALCIUM
+---------------------------------------------------
+The use of CALCIUM in SALOME assumes that SALOME components are available offering services based on CALCIUM ports.
+There are several choices for creating such components:
+
+- Create a SALOME module containing components for which the services have CALCIUM ports
+- Create several SALOME modules containing at least one component for which the service(s) have CALCIUM ports.
+
+Creating a SALOME module consists of structuring header, source, library and resource files in the form of a standard
+directory structure. It can be done from a model module (HELLO, PYHELLO), or from a module generator (for example :ref:`yacsgen`)
+
+Customisation of the SALOME component for the use of CALCIUM ports consists of:
+
+- including a file declaring DSC ports in the IDL file of the component,
+- including a file and declaring an inheritance to make our component supervisable,
+- creating CALCIUM ports used in the definition of a standard method called init_service,
+- declaration of CALCIUM ports of the component(s) in the module catalog file.
+
+By using YACSGEN, the init_service method and the XML catalog of services provided by components are generated automatically.
+
+
+The IDL declaration of components using CALCIUM ports
+'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+Since ports are dynamically declared in the init_service method, CALCIUM ports do not need to be previously declared
+in the IDL file. However, the DSC_Engine.idl file must be included in the components IDL file(s) to benefit from DSC ports.
+
+Example of the CALCIUM_TESTS.idl file for the CALCIUM_TEST module defining the three ECODE, SCODE, ESPION components, each
+of which offers a unique service to start up the corresponding wrapped code:
+
+::
+
+ #include "DSC_Engines.idl"
+
+ /*! \file CALCIUM_TESTS.idl
+ This file contains the first installation test of CALCIUM product.
+ Each engine contains one service.
+ */
+ module CALCIUM_TESTS {
+
+ interface ECODE : Engines::Superv_Component {
+ void EcodeGo();
+ };
+
+ interface SCODE : Engines::Superv_Component {
+ void ScodeGo();
+ };
+
+ interface ESPION : Engines::Superv_Component {
+ void EspionGo();
+ };
+
+ };
+
+Declaration of a C++ component using CALCIUM ports
+'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+Only one header is necessary in the case of a wrapper component (that does nothing except to call an
+implementation of another compilation unit):
+
+.. code-block:: cpp
+
+ #include “Superv_Component_i.hxx”
+
+This header file is necessary to make our component supervisable and to use DSC ports. The component will
+virtually inherit the Superv_Component_i class.
+
+Example ECODE.hxx declaration file for the ECODE component:
+
+.. code-block:: cpp
+
+ #ifndef _ECODE_HXX_
+ #define _ECODE_HXX_
+
+ #include "Superv_Component_i.hxx"
+ //Header CORBA generated from the CALCIUM_TESTS module
+ #include "CALCIUM_TESTS.hh"
+
+ //Interface for the wrapped code, in this case C code ecode
+ extern "C" { int ecode(void *); }
+
+ class ECODE_impl :
+ //Implements the CORBA interface for the ECODE component
+ public virtual POA_CALCIUM_TESTS::ECODE,
+ //Makes the component supervisable
+ public virtual Superv_Component_i {
+
+ public :
+ //Classical SALOME component constructor
+ ECODE_impl(CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName);
+
+ virtual ~ECODE_impl();
+
+ //Initialisation of the service EcodeGo()
+ CORBA::Boolean init_service(const char * service_name);
+ void EcodeGo();
+ };
+
+ extern "C"
+ {
+ PortableServer::ObjectId * ECODEEngine_factory(CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName);
+ }
+
+ #endif
+
+
+Declaration of component resources (part 1)
+'''''''''''''''''''''''''''''''''''''''''''''''''''''''
+Components publish signatures of their services in an XML resource file called the module catalog (or components catalog).
+This file can be generated by YACSGEN.
+
+Extract from the CALCIUM_TESTSCatalog.xml catalog concerning the ECODE component:
+
+Our ECODE component provides a unique EcodeGo() service that has no input parameters and no output parameters.
+
+The Creating CALCIUM ports section describes how this resource file will be extended by the declaration of datastream ports.
+
+.. code-block:: xml
+
+ ....
+ <component>
+ <component-name>ECODE</component-name>
+ ....
+ <component-interface-list>
+ <component-interface-name>ECODE</component-interface-name>
+ <component-interface-comment></component-interface-comment>
+ <component-service-list>
+ <component-service>
+ <!-- service-identification -->
+ <service-name>EcodeGo</service-name>
+ ...
+ <!-- service-connexion -->
+ <inParameter-list>
+ </inParameter-list>
+ <outParameter-list>
+ </outParameter-list>
+ <DataStream-list>
+ </DataStream-list>
+ </component-service>
+ </component-service-list>
+ </component-interface-list>
+ </component>
+
+Definition of a component using CALCIUM ports
+''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+The component creates the ports that it needs. The step to create a CALCIUM port consists of calling the add_port method
+provided by the virtual inheritance from the Superv_Component_i class. It must be done before the service(s) that use
+the port is (are) started. This is why this declaration is located in the
+standard init_service(char * name_of_service_to_be_initialised) method. There are two methods of creating a
+CALCIUM port, firstly the create_calcium_port method and secondly the add_port method.
+
+Creating CALCIUM ports using the add_port method
+++++++++++++++++++++++++++++++++++++++++++++++++++++
+This method is used to create any type of DSC port. It can be used to create CALCIUM ports in particular.
+
+.. code-block:: cpp
+
+ add_port< typing_of_my_fabricated_port >( "the type of port to be fabricated",
+ "provides"|”uses”,
+ "the port name")
+
+
+*"the type of port to be fabricated"*:
+ This string notifies the DSC port factory in the KERNEL module about the name of the type of port
+ to be created. The following types are possible for CALCIUM:
+ “CALCIUM_integer”, “CALCIUM_real”, “CALCIUM_double”, “CALCIUM_logical”, “CALCIUM_complex”,
+ “CALCIUM_string”
+*“provides”|”uses”*:
+ This string indicates if it is a CALCIUM output (uses) port or an input provides port. Note that in the DSC semantic,
+ the provides port provides a write interface used by the uses port.
+*“the port name”*:
+ The port name corresponds to the name of the variable used in CALCIUM primitives.
+*typing_of_my_fabricated_port*:
+ This type types the pointer returned by add_port. The objective for CALCIUM is to indicate the typing corresponding to
+ the type name already given in the factory plus the uses or provides information:
+
+ - calcium_integer_port_provides or calcium_integer_port_uses
+ - calcium_real_port_provides or calcium_real_port_uses
+ - calcium_double_port_provides or calcium_double_port_uses
+ - calcium_string_port_provides or calcium_string_port_uses
+ - calcium_complex_port_provides or calcium_complex_port_uses
+ - calcium_logical_port_provides or calcium_logical_port_uses
+
+
+Extract from the init_service method in the ECODE.cxx file for the ECODE component:
+
+.. code-block:: cpp
+
+ CORBA::Boolean ECODE_impl::init_service(const char * service_name) {
+
+ CORBA::Boolean rtn = false;
+ string s_name(service_name);
+
+ if (s_name == "EcodeGo") {
+
+ try {
+
+ add_port<calcium_integer_port_provides>("CALCIUM_integer","provides","ETP_EN")->
+ setDependencyType(CalciumTypes::TIME_DEPENDENCY);
+
+ add_port<calcium_real_port_provides>("CALCIUM_real","provides","ETP_RE") ->
+ setDependencyType(CalciumTypes::TIME_DEPENDENCY);
+
+ add_port<calcium_double_port_provides>("CALCIUM_double","provides","ETP_DB")->
+ setDependencyType(CalciumTypes::TIME_DEPENDENCY);
+
+ add_port<calcium_complex_port_provides>("CALCIUM_complex","provides","ETP_CX")->
+ setDependencyType(CalciumTypes::TIME_DEPENDENCY);
+
+ add_port<calcium_string_port_provides>("CALCIUM_string","provides","ETP_CH")->
+ setDependencyType(CalciumTypes::TIME_DEPENDENCY);
+
+ add_port<calcium_logical_port_provides>("CALCIUM_logical","provides","ETP_LQ")->
+ setDependencyType(CalciumTypes::TIME_DEPENDENCY);
+ ....
+ rtn = true;
+ } catch ( const DSC_Exception & ex ) {
+ std::cerr << ex.what() << std::endl;;
+ }
+ } //FIN (s_name == "Ecode")
+
+ return rtn;
+ }
+
+Creating CALCIUM ports using the create_calcium_port method
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+This method is specially written for the creation of CALCIUM ports, and simplifies the creation of ports.
+It is used by YACSGEN. The “IN”|”OUT” parameter indicates whether it is a CALCIUM input or output port.
+The “T”|”I” parameter indicates the port mode, time or iterative.
+
+Extract from the init_service method in the ECODE.cxx file for the ECODE component:
+
+
+.. code-block:: cpp
+
+ ECODE_i::init_service(const char * service_name) {
+ CORBA::Boolean rtn = false;
+ string s_name(service_name);
+ if (s_name == "EcodeGo") {
+ try {
+ //initialisation CALCIUM ports IN
+ create_calcium_port(this,"ETP_EN","CALCIUM_integer","IN","T");
+ create_calcium_port(this,"ETP_RE","CALCIUM_real","IN","T");
+ create_calcium_port(this,"ETP_DB","CALCIUM_double","IN","T");
+ create_calcium_port(this,"ETP_CX","CALCIUM_complex","IN","T");
+ create_calcium_port(this,"ETP_CH","CALCIUM_string","IN","T");
+ create_calcium_port(this,"ETP_LQ","CALCIUM_logical","IN","T");
+ ... }
+ catch(const PortAlreadyDefined& ex) {
+ std::cerr << "ECODE: " << ex.what() << std::endl;
+ //Ports already created : we use them
+ }
+ catch ( ... ) {
+ std::cerr << "ECODE: unknown exception" << std::endl;
+ }
+ rtn = true;
+ }
+ return rtn;
+ }
+
+
+Declaration of component resources (part 2)
+''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+The XML component resource file must be completed to declare that CALCIUM ports exist in the different components.
+YACSGEN takes account of CALCIUM ports in the generation of the module catalog.
+
+Extract from the CALCIUM_TESTSCatalog.xml catalog for the ECODE component:
+
+.. code-block:: xml
+
+ .....
+ <DataStream-list>
+ <inParameter>
+ <inParameter-name>ETP_EN</inParameter-name>
+ <inParameter-type>CALCIUM_integer</inParameter-type>
+ <inParameter-dependency>T</inParameter-dependency>
+ </inParameter>
+ <inParameter>
+ <inParameter-name>ETP_RE</inParameter-name>
+ <inParameter-type>CALCIUM_real</inParameter-type>
+ <inParameter-dependency>T</inParameter-dependency>
+ </inParameter>
+ <inParameter>
+ <inParameter-name>ETP_DB</inParameter-name>
+ <inParameter-type>CALCIUM_double</inParameter-type>
+ <inParameter-dependency>T</inParameter-dependency>
+ </inParameter>
+ .....
+ </DataStream-list>
+
+
+Configuring a CALCIUM port
+''''''''''''''''''''''''''''''''''
+The step to configure ports uses all possible link parameter settings in the CALCIUM coupling file outside SALOME.
+This step can be done when the port is created in the component (init_service method) by a coupling parameter
+setting component / script, or by the YACS supervisor. This step indicates the following characteristics
+for each port in the provides class:
+
+- time / iteration dependency of received data:
+ TIME_DEPENDENCY or ITERATION_DEPENDENCY
+- The data storage level (size of the history stack):
+ UNLIMITED_STORAGE_LEVEL (by default) or a strictly positive integer
+- The time scheme selected to define the date used in read primitives (CPLxx) in time mode:
+
+ * TI_SCHEM (default value): Values of the input variable used are taken at the time corresponding to the beginning of
+ the current time step in the calculation (see parameter **ti** of CPLxx)
+ * TF_SCHEM: Values of the input variable are taken at the time corresponding to the end of the current time step
+ in the calculation (see parameter **tf** of CPLxx)
+ * ALPHA_SCHEM: Values of the input variable are taken at an instant equal to TF * *ALPHA* + TI * (1 - *ALPHA*).
+ *ALPHA* can be equal to values strictly between 0 and 1. The value 0 is replaced by the TI_SCHEM option and
+ the value 1 is replaced by the TF_SCHEM option).
+
+- The interpolation type to be used for a port in time mode:
+ L0_SCHEM, L1_SCHEM
+- The extrapolation type to be used in the case of blockage / timeout:
+ E0_SCHEM, E1_SCHEM (not yet functional)
+- The value of the DELTAT parameter that indicates if two dates are identical.
+
+All of the keywords used when the ports are configured are defined in the CalciumTypes C++ namespace in the CalciumTypes.hxx file.
+
+Configuration when the PORT is created
++++++++++++++++++++++++++++++++++++++++++++++++++
+When a port is created, the add_port method returns a pointer to the port useful to its configuration. One example
+configuration in the init_service method consists of indicating if the port is in time dependency or iteration dependency mode:
+
+.. code-block:: cpp
+
+ add_port<calcium_integer_port_provides>("CALCIUM_integer","provides","ETP_EN")->
+ setDependencyType(CalciumTypes::TIME_DEPENDENCY);
+
+
+The following methods are available to configure CALCIUM ports:
+
+* Set / Query the dependency type:
+
+The dependency type informs the port if the data are stamped by a date or (exclusive) an iteration number. The default
+dependency type is undefined (CalciumTypes::UNDEFINED_DEPENDENCY). CalciumTYpes::TIME_DEPENDENCY or
+CalciumTypes::ITERATION_DEPENDENCY can be defined.
+
+.. code-block:: cpp
+
+ void setDependencyType (DependencyType dependencyType);
+ DependencyType getDependencyType () const;
+
+
+* Set / Query the storage level of the data produced:
+
+The storage level in the history of data produced must be greater than or equal to 1. By default it is
+unlimited (CalciumTypes::UNLIMITED_STORAGE_LEVEL). It may have to be reduced, to limit memory consumption for the
+case of a coupling with many iterations.
+
+.. code-block:: cpp
+
+ void setStorageLevel (size_t storageLevel);
+ size_t getStorageLevel () const;
+
+
+* Set / Query the time scheme used to define the read date:
+
+The time scheme chosen to define the date used in read primitives in time mode is set to CalciumTypes::TI_SCHEM by default. It is also possible to enter CalciumTypes::TF_SCHEM or CalciumTypes::ALPHA_SCHEM.
+
+.. code-block:: cpp
+
+ void setDateCalSchem (DateCalSchem dateCalSchem);
+ DateCalSchem getDateCalSchem () const;
+
+
+If the time scheme used is ALPHA_SCHEM, the next method is used to indicate the value of ALPHA to be used. Alpha is equal to zero by default (equivalent to TI_SCHEM) and it can be set to between 0 and 1 inclusive.
+
+
+.. code-block:: cpp
+
+ void setAlpha(double alpha);
+ double getAlpha() const ;
+
+
+* Set / Query the tolerated deviation within which two dates will be considered to be identical:
+
+Two dates D1 and D2 are identical if abs(T1-T2) <CalciumTypes::EPSILON. Epsilon is equal to 1E-6 by default.
+Parameters can be set for it on each port (0 <= deltaT <= 1).
+
+.. code-block:: cpp
+
+ void setDeltaT(double deltaT );
+ double getDeltaT() const ;
+
+
+* Set / Query the type of time interpolation to be used:
+
+When a read request is formulated for a date T that has not been produced but is surrounded by dates T1(min) and T2(max) for which data have already been produced, CALCIUM produces a CalciumTypes::L1_SCHEM linear interpolation by default. The user can request a CalciumTypes::L0_SCHEM step “interpolation”.
+
+.. code-block:: cpp
+
+ void setInterpolationSchem (InterpolationSchem interpolationSchem);
+ InterpolationSchem getInterpolationSchem () const ;
+
+* Set / Query the type of the extrapolation to be used:
+
+This parameter is used to indicate whether an extrapolation is required to exit from a blocking case (a port waiting for data that will never be produced). The default value is Calcium-Types::UNDEFINED_EXTRA_SCHEM. Possible values are EO_SCHEM (step extrapolation) or E1-SCHEM (linear extrapolation).
+
+.. code-block:: cpp
+
+ void setExtrapolationSchem (ExtrapolationSchem extrapolationSchem);
+ ExtrapolationSchem getExtrapolationSchem () const ;
+
+
+Configuration using properties of DSC ports
++++++++++++++++++++++++++++++++++++++++++++++++++
+This section explains advanced use of the properties of DSC ports to perform the CALCIUM ports configuration step, it can
+be ignored if CALCIUM ports are used in a simple manner.
+
+All DSC ports can be configured by a list of properties. Therefore, the configuration step can be made using a CORBA call on the ports concerned.
+
+The [set|get]_property methods of DSC ports manipulate a list of pairs with a key equal to the name of the property in
+the first position and the associated value in the second position.
+
+Extract from the SALOME_Component.idl file of the SALOME KERNEL:
+
+::
+
+ struct KeyValuePair {
+ string key;
+ any value;
+ };
+ typedef sequence<KeyValuePair> FieldsDict;
+ void setProperties(in FieldsDict dico);
+ FieldsDict getProperties();
+
+
+
+CALCIUM declares the following types in the SALOME KERNEL Calcium_Ports.idl file:
+
+::
+
+ const long UNLIMITED_STORAGE_LEVEL = -70;
+ enum DependencyType { UNDEFINED_DEPENDENCY, TIME_DEPENDENCY, ITERATION_DEPENDENCY};
+ enum DateCalSchem { TI_SCHEM, TF_SCHEM , ALPHA_SCHEM};
+ enum InterpolationSchem { L0_SCHEM, L1_SCHEM };
+ enum ExtrapolationSchem { UNDEFINED_EXTRA_SCHEM, E0_SCHEM, E1_SCHEM};
+
+
+Therefore, the recognised properties are the following pairs:
+
+- (“StorageLevel”, int > 0 )
+- (“Alpha”, 0 <= double <= 1 )
+- (“DeltaT”, 0 <= double <= 1 )
+- (“DependencyType”, enum CORBA DependencyType)
+- (“DateCalSchem”, enum CORBA DateCalSchem)
+- (“InterpolationSchem”,enum CORBA InterpolationSchem)
+- (“ExtrapolationSchem”,enum CORBA ExtrapolationSchem)
+
+Example dynamic configuration by a python script (extract from file CAS_1.py):
+
+.. code-block:: python
+
+ ...
+ port1=ecode.get_provides_port("ETS_DB",0);
+ myAny1_1=4
+ port1.set_property("StorageLevel",any.to_any(myAny1_1))
+
+
+The get_provides_port and set_property methods are provided by the default implementation of supervisable SALOME components.
+
+The configuration in the YACS XML file
+++++++++++++++++++++++++++++++++++++++++++++
+The YACS supervisor module is capable of importing / exporting calculation schemes in the XML format. In particular, this
+includes the declaration of links between the ports of the different component instances. The YACS GUI generates all sorts of
+calculation schemes and starts their execution.
+
+At the present time, properties cannot be added to CALCIUM ports with YACS GUI. Therefore, they have to be added into
+the XML file manually. In YACS, calcium ports are configured by declaring properties on the links.
+
+Extract from the CAS_1.xml calculation scheme, first test case of CALCIUM functions:
+
+Example configuration of the ETS_DB port at a history level of 4.
+
+.. code-block:: xml
+
+ <stream>
+ <fromnode>SCODE</fromnode> <fromport>STS_DB</fromport>
+ <tonode>ECODE</tonode> <toport>ETS_DB</toport>
+ <property name="StorageLevel" value="4"/>
+ </stream>
+
+
+(Keys, value) pairs used to describe properties are as listed in the previous section.
+
+Calls to CALCIUM methods
+'''''''''''''''''''''''''''''''
+The CALCIUM C / C++ / Fortran API in SALOME is globally identical to the API for the CALCIUM product outside SALOME.
+It is now also available in Python.
+
+See :ref:`calciumapi` for C and Fortran API documentation and :mod:`calcium` for Python API documentation.
+
+The classical C / C++ API is extended by a zero copy version that transfers data without an intermediate copy.
+
+C++ developers can use an API more specific to C++ that proposes parameter types more adapted to the language.
+
+It is also possible to use CALCIUM DSC ports more directly with their associated CORBA types.
+
+
+
+Classical CALCIUM calls in C / C++ / F / Python
++++++++++++++++++++++++++++++++++++++++++++++++++
+The classical CALCIUM API remains essentially the same, regardless of whether the objective is to include an existing
+CALCIUM C / C ++ / Fortran code in the SALOME platform or to develop a new CALCIUM component.
+
+The code containing CALCIUM calls is written directly in the SALOME service of the C++ component, or is accessible through a procedure call.
+
+In the first case, the code must be written in C / C++ / Python because there is no SALOME component written directly in Fortran.
+
+In the second case, the calling service must transmit the access pointer to its component. Unlike the CALCIUM outside
+SALOME API, the first argument of all procedures is the pointer of the component that holds the associated ports.
+This enables the CALCIUM library to identify the component that holds the requested ports [1]_.
+
+Extract from the implementation of the EcodeGo() (ECODE.cxx) service calling the ecode wrapped code (void* component)(Ecode.c):
+
+(This code can be generated by YACSGEN)
+
+
+.. code-block:: cpp
+
+ void ECODE_impl::EcodeGo() {
+ Superv_Component_i * component = dynamic_cast<Superv_Component_i*>(this);
+ try {
+ ecode(component);
+ }
+ catch ( const CalciumException & ex)
+ ....
+ }
+
+
+A code already written to use CALCIUM only needs to be adapted to transmit the pointer of its component as a first
+parameter of calls to CALCIUM procedures. Apart from this observation, the code remains exactly the same as the
+initial calcium code.
+
+Extract from the implementation of the calcium source code applied by the service (Ecode.c):
+
+.. code-block:: c
+
+ ...
+ #include <calcium.h>
+ ...
+ int ecode(void * component)
+ {
+ ...
+ /* Connection to the coupler */
+ info = cp_cd(component,nom_instance);
+
+ info= cp_len(component,CP_TEMPS,&ti_re,&tf_re,&i,"ETP_EN",1,&n,EDATA_EN);
+ ...
+ info = cp_fin(component,CP_CONT);
+ }
+
+
+
+The C ecode procedure connects to the CALCIUM coupler through the cp_cd procedure and then formulates a blocking read
+request to the ETP_EN port / connection point according to a time scheme between ti_re and tf_re. Only one data is
+requested, it will be stored in the EDATA_EN buffer. The procedure finishes when the coupler is disconnected, using
+the CP_CONT flag to indicate that any clients of ports associated with ecode will receive the most recent known value
+if there are any new read requests. If the CP_ARRET flag was used, any subsequent read request on the ports associated
+with ecode() would exit in error.
+
+The scheme is the same in fortran, the following is an extract from the Ecode.f file:
+
+.. code-block:: fortran
+
+ SUBROUTINE ECODE(compo)
+ INCLUDE 'calcium.hf'
+ INTEGER compo
+ ----
+ CALL CPCD(compo,nom_instance, info)
+ ----
+ CALL CPLEN(compo,CP_TEMPS,ti_re,tf_re,i,'ETP_EN',1,n,EDATA_EN,info)
+ ----
+ CALL CPFIN(compo,CP_CONT, info)
+ ----
+
+
+CALCIUM C/C++ calls in zero copy mode
++++++++++++++++++++++++++++++++++++++++
+CALCIUM DSC ports of the provides type (CALCIUM entry connection points) keep the received data to be able to create the
+requested history (unlimited by default). When the user formulates a read for data that are already available, the port
+copies these data into the buffer provided by the user. An extended CALCIUM API allows the user to supply a null pointer
+to replace the pre-allocated reception pointer, so as to obtain a pointer to the internal buffer of the CALCIUM provides
+class port directly. This prevents a potentially large copy, but it obliges the user to be vigilant on the following points:
+
+1. The buffer obtained must be used in read only. Unless it is used in a particular manner, any modification to the buffer
+ would be reflected in new read requests for the same stamp or during an interpolation calculation using this stamp.
+2. The buffer is dependent on the history level set for the port. If the history level set for the port is such that the
+ stamp and the associated buffer will be deleted, the user will have a pointer to an invalid buffer and its use would probably corrupt memory.
+3. Zero copy is not used on integers and booleans because these types do not exist in CORBA.
+4. The user must call the CALCIUM procedure once only to release the pointer obtained. This releases any buffers created for
+ cases in which a zero copy is impossible. This also helps to count distributed references to prevent early release (not yet implemented).
+
+The zero copy API consists of calling ecp_lxx read procedures instead of their corresponding procedure cp_lxx and transferring
+the address of a pointer for which the value is initialized to zero.
+
+The write procedures API is not modified because these procedures still operate in zero copy. If the sender and receiver
+components are placed in the same container, a copy is triggered on reception of data to prevent any interaction between
+the sender's buffer and the receiver's buffer.
+
+Extract from the zero copy implementation of the CALCIUM source code called by the (Ecode.c) service:
+
+
+.. code-block:: c
+
+ float *sav_EDATA_RE = _EDATA_RE; //keep a ptr to previously received data
+ _EDATA_RE = NULL;
+ ti_re = 1.1;
+ tf_re = 1.2;
+ info = ecp_lre(component,CP_TEMPS,&ti_re,&tf_re,&i,"ETP_RE",0,&n,&_EDATA_RE);
+ fprintf(file_2,"%f\n", _EDATA_RE[0]);
+ ti_re = 0.0;
+ tf_re = 1.0;
+
+ ecp_lre_free(sav_EDATA_RE);
+ ecp_lre_free(_EDATA_RE);
+
+
+CALCIUM calls with API specific to C++
++++++++++++++++++++++++++++++++++++++++++
+C++ developers can use a specific API that proposes parameters with types better adapted to the language.
+
+Time stamps are always of the double type and iterations are always of the long type, regardless of whether it is in write or
+read and regardless of the type of transmitted data. Variable names are STL strings. The name of read and write methods is
+the same regardless of the type of data manipulated. The type of data is found automatically, except for complex types,
+logical types and character strings.
+
+.. code-block:: cpp
+
+ template <typename T1, typename T2> static void
+ ecp_ecriture ( Superv_Component_i & component, int const & dependencyType,
+ double const & t, long const & i,
+ const string & nomVar, size_t bufferLength, T1 const & data )
+
+
+
+ template <typename T1, typename T2 > static void
+ ecp_lecture ( Superv_Component_i & component, int const & dependencyType,
+ double & ti, double const & tf, long & i,
+ const string & nomVar, size_t bufferLength,
+ size_t & nRead, T1 * &data )
+
+
+These methods are defined in the CalciumCxxInterface.hxx header file. Therefore the user will include
+the ``#include ”CalciumCxxInterface.hxx”`` directive in the code.
+
+Note: the CalciumInterface.hxx file has to be included only once because it declares and defines C++ template methods.
+This does not create any problem with compilation, but there is a multiple definition problem during link editing.
+
+But there is no need to specify T1 and T2 for integer, float or double CALCIUM types, because there is a write method
+and a read method with a single template parameter that calls their corresponding methods with the constraint T1==T2==<Type of Data Used>.
+
+For complex types, the <float,cplx> instantiation has to be used and the number of complexes has to be multiplied by two to
+transfer the bufferLength parameter. In this case, the only difference from use of the float type is the typing of the ports
+used, namely calcium_complex_port_provides instead of calcium_real_port_provides.
+
+Instantiation for the logical type is done with <int, bool>.
+
+Instantiation for character strings is <char*, str>. The character strings can be read without giving the maximum string
+length parameter located in the classical C / C++ / Fortran API.
+
+Differences from the CALCIUM product outside SALOME
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
+All that are implemented are read / write procedures and connection/disconnection procedures. Step back, query, dynamic
+configuration and debugging procedures are not implemented.
+
+However, it is possible to dynamically create and connect components that read/write on ports of other component services.
+Any SALOME service using CALCIUM ports has the privileges of a spy (in production mode).
+
+Several output ports can be connected to the same input port and one output port can be connected to several input ports.
+The first case was not possible in CALCIUM outside SALOME.
+
+Reads/writes are implemented in blocking mode; non-blocking mode is not yet implemented.
+
+All ports created by the different services of a single component are visible / usable by all these services.
+However, it is not recommended that they should be used in this way.
+
+The extrapolation has not yet been implemented.
+
+File ports have not yet been implemented, however there are some DSC file ports in SALOME.
+
+Ports not connected do not cause any error in execution of coupling unless they are used.
+
+CALCIUM error codes returned by primitives are the same as for CALCIUM outside SALOME. By using the specific C++ API,
+CalciumException class exceptions (CalciumException.hxx) that contain the CALCIUM error code and an explanation message
+can be caught. The error code contained in the exception is obtained by calling the CalciumTypes::InfoType getInfo() method.
+The CalciumException class also inherits from the C++ SALOME_Exception exception.
+
+A compilation option has to be used to allow C++ exceptions to pass through the C and Fortran codes called from
+the SALOME component service. This option for GNU compilers is -fexceptions.
+
+Data type exchange will be extended to complex types such as MED fields or meshes.
+
+
+Starting CALCIUM coupling
+--------------------------------
+CALCIUM coupling can be started in three different ways. The first is to use the SALOME KERNEL only and to manage
+component instances by a python script. The second is to create a component that would control coupling. The third
+is to use the YACS supervisor component with or without its GUI.
+
+Setting up the environment
+'''''''''''''''''''''''''''''''''''
+Regardless of what method is chosen, the KERNEL module has to be notified about the existence of new modules to be used.
+Only one module needs to be declared if all components are within the same module.
+
+This step is no specific to CALCIUM components, it is necessary for all SALOME components.
+
+Declaration of <my module>_ROOT_DIR
+++++++++++++++++++++++++++++++++++++
+The KERNEL module is based on a <my module>_ROOT_DIR variable in either a envSalome.sh shell script containing all environment
+variables useful to SALOME or in the user console, to locate the installation directory of the <my module> module.
+
+Example declaration of the CALCIUM_TESTS module in bash:
+
+.. code-block:: sh
+
+ INSTALLROOT="/local/salome/SALOME5/V5NoDebug"
+ export CALCIUM_TESTS=${INSTALLROOT}/DEV/INSTALL/CALCIUM_TESTS
+
+
+The appli_gen.py tool will prepare the appropriate environment in the env.d directory for a SALOME application (see :ref:`appli`).
+
+Loading the <my module> module when running SALOME
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+There are two solutions for loading the <my module> module when SALOME is run.
+
+Declaration in the SalomeApp.xml file.
+#########################################
+All that is necessary is to declare the name of its module in the modules parameter in the SalomeApp.xml file.
+
+The following is an example for the CALCIUM_TESTS module:
+
+.. code-block:: xml
+
+ <section name="launch">
+ ....
+ <parameter name="modules" value="GEOM,SMESH,VISU,YACS,MED,CALCIUM_TESTS"/>
+ ....
+ </section>
+
+
+
+Using the --module option.
+################################
+This option limits loading of modules to the list indicated in the command line (it assumes that the user’s environment
+indicates the location of the modules).
+
+.. code-block:: sh
+
+ ./runAppli --module=YACS,CALCIUM_TESTS
+
+
+Running a simple coupling through a python script
+''''''''''''''''''''''''''''''''''''''''''''''''''''''
+Components can be created and their ports can be connected using a Python SALOME session.
+The script CAS_1.py loads instances of the ECODE, SCODE and ESPION components, connects their ports, makes the necessary
+configurations and starts executions.
+
+The following is an extract from the CAS_1.py file that can be found in <path to CALCIUM_TESTS module>/CALCIUM_TESTS/lib/python2.4/site-packages/salome:
+
+.. code-block:: python
+
+
+ import LifeCycleCORBA
+ import Engines
+ import Ports
+ import CALCIUM_TESTS
+ import orbmodule
+ import user
+
+ import sys
+ import threading
+ from omniORB import any
+
+ #Load component instances through the LifeCycle
+ lcc = LifeCycleCORBA.LifeCycleCORBA()
+ ecode = lcc.FindOrLoad_Component('FactoryServer3', 'ECODE')
+ ecode.init_service("EcodeGo")
+ scode = lcc.FindOrLoad_Component('FactoryServer4', 'SCODE')
+ scode.init_service("ScodeGo")
+
+ #Display the content of the naming server
+ #Obtain a reference to the connection manager
+
+ clt=orbmodule.client()
+ clt.showNS()
+ connection_manager = clt.Resolve("ConnectionManager")
+
+ #Create CALCIUM links through the connection manager
+ connection_manager.connect(scode, "STP_EN",ecode, "ETP_EN")
+ connection_manager.connect(scode, "STP_RE", ecode, "ETP_RE")
+ connection_manager.connect(scode, "STP_DB", ecode, "ETP_DB")
+ connection_manager.connect(scode, "SIP_EN", ecode, "EIP_EN")
+ connection_manager.connect(scode, "SIP_DB", ecode, "EIP_DB")
+ connection_manager.connect(scode, "SIS_EN", ecode, "EIS_EN")
+ connection_manager.connect(scode, "SIS_DB", ecode, "EIS_DB")
+ connection_manager.connect(scode, "STS_EN", ecode, "ETS_EN")
+ connection_manager.connect(scode, "STS_DB", ecode, "ETS_DB")
+ port1=ecode.get_provides_port("ETS_DB",0);
+ myAny1_1=4
+ port1.set_property("StorageLevel",any.to_any(myAny1_1))
+ connection_manager.connect(scode, "STS_DB", ecode, "ETP_DB2")
+ connection_manager.connect(scode, "STP_CX", ecode, "ETP_CX")
+ connection_manager.connect(scode, "STP_CH", ecode, "ETP_CH")
+ connection_manager.connect(scode, "STP_LQ", ecode, "ETP_LQ")
+ #Create and connect the spy (espion)
+ #The ESPION can be created after the instances of ECODE and SCODE have been run,
+ #however data produced before the connection will be lost
+ espion = lcc.FindOrLoad_Component('FactoryServer5', 'ESPION')
+ espion.init_service("EspionGo")
+
+ connection_manager.connect(scode, "STP_DB2", ecode, "ETP_DB2")
+ connection_manager.connect(espion, "STP_DB2", ecode, "ETP_DB2")
+ connection_manager.connect(scode, "SIP_DB2", espion, "SIP_DB2")
+ connection_manager.connect(espion, "SIP_DB" , ecode , "EIP_DB" )
+ connection_manager.connect(scode, "SIP_DB" , espion, "EIP_DB")
+
+ #If the spy is run last, CAS_1 works but test 15 does not work
+ handler3=threading.Thread(target=espion.EspionGo)
+ handler3.start()
+ handler=threading.Thread(target=ecode.EcodeGo)
+ handler.start()
+ handler2=threading.Thread(target=scode.ScodeGo)
+ handler2.start()
+
+ handler.join()
+ handler2.join()
+ handler3.join()
+
+
+
+The script can be run using the following command:
+
+.. code-block:: sh
+
+ ./runAppli -t --module=YACS,CALCIUM_TESTS -u CAS_1.py
+
+Running coupling through the YACS GUI
+'''''''''''''''''''''''''''''''''''''''''''
+If the module catalog contains the description of components and their services, it is easy to create a coupling scheme by
+inserting the services of components that are to be linked.
+
+To insert a service, simply do a right click / CASE_1 / create a node / create a node from catalog / in the edit tree of the graph.
+
+Linking two ports consists of selecting the output port (in the edit tree) and then doing a right click on the /add data link/ command, and then selecting the input port.
+
+There is no consistency check on the branch of incompatible CALCIUM port types in current version of the YACS GUI. However, an error will occur at the time of execution.
+
+Once the scheme has been created, it can be exported in the YACS coupling scheme XML format (see toolbar).
+
+The following is a graphic example of the coupling scheme for the first CALCIUM test case:
+
+.. image:: images/calcium1.png
+ :align: center
+
+Once the scheme has been created, all that is necessary is to create an execution by doing a right click on /YACS/CAS_1/New Execution/.
+The study tree becomes the execution tree in which the state of the different services appears. Once it has been
+run (by pressing the appropriate button in the tool bar), the services are in the ‘done’ state if everything took place correctly.
+The log of a container associated with execution of a service can be displayed by doing a right click on the service concerned
+and selecting /Node container Log/. If an error occurs, reports are displayed by selecting /Error Details/ or /Error Report/.
+
+As many executions as are necessary can be created. Modifying the edit scheme does not modify existing execution schemes.
+One execution has to be recreated to start the modified scheme. Do a right click and select /New Edition/ in order to find
+the edit scheme corresponding to an execution scheme again.
+
+Any container configuration is possible:
+
+1. several CALCIUM services (for one component or different components) coupled within a single container
+2. several CALCIUM services (for one component or different components) coupled within different containers
+3. an intermediate configuration between the previous two cases.
+
+Current limitations:
+
+1. It is impossible to have several services of a single component simultaneously using distinct CALCIUM ports with the same name.
+2. It is not possible to restart the same execution because the init_service method will attempt to create existing
+ ports (an execution has to be created or init_service has to be modified so as to memorise the creation of ports).
+
+
+Running coupling through YACS without GUI
+''''''''''''''''''''''''''''''''''''''''''
+To do this, you have to create a schema file in XML format (see :ref:`schemaxml`) and to execute it in console
+mode (see :ref:`execxml`).
+
+
+Setting up a timeout to interrupt execution in case of interlocking
+'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+Sometimes (mainly during development phases), a calculation can ends up in a deadlock. A component waits for a data that
+another component must send but this component is also waiting and all these components are waiting in a loop, so the calculation
+never ends : it's a deadlock.
+
+There is no way in CALCIUM to detect this deadlock, but it is possible to set a timeout to go out of the deadlock.
+A timeout is a time in seconds. When a component waits longer than timeout, an error occurs and the calculation is interrupted.
+The timeout can be specified by setting the environment variable DSC_TIMEOUT (export DSC_TIMEOUT=600, in bash to set a 10 minutes timeout).
+It must be set before launching a SALOME session and is therefore globally used for all the calculations in the session.
+
+It is also possible to specify a timeout in the XML coupling file by way of a service node property (DSC_TIMEOUT) as in
+the following example:
+
+.. code-block:: xml
+
+ <service name="canal" >
+ <component>FLUIDE</component>
+ <method>prun</method>
+ <load container="A"/>
+ <property name="DSC_TIMEOUT" value="20"/>
+ <instream name="tpi" type="CALCIUM_real"/>
+ <instream name="iconv" type="CALCIUM_integer"/>
+ <outstream name="tfi" type="CALCIUM_real"/>
+ </service>
+
+As a consequence, the timeout will be active for all the services in the container of the service (container A in the example).
+
+It is not yet possible to specify a timeout limited to one port or one link.
+
+Creating a SALOME application
+--------------------------------------------
+Example command invoked to create a SALOME application after adapting the config_appli.xml file:
+
+.. code-block:: sh
+
+ python $KERNEL_ROOT_DIR/bin/salome/appli_gen.py --prefix=/local/salome5_my_appli \
+ --config=config_appli_mod.xml
+
+
+
+Coupling scheme: example of YACS XML file
+-----------------------------------------------
+The complete CAS_1.xml file for the coupling scheme of the CALCIUM CAS_1 test case (it can be generated by the YACS GUI):
+
+.. code-block:: xml
+
+ <?xml version='1.0'?>
+ <proc>
+ <type name="Bool" kind="bool"/>
+ <type name="Double" kind="double"/>
+ <type name="Int" kind="int"/>
+ <type name="String" kind="string"/>
+ <objref name="CALCIUM_complex"
+ id="IDL:Ports/Calcium_Ports/Calcium_Complex_Port:1.0"/>
+ <objref name="CALCIUM_double"
+ id="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0"/>
+ <objref name="CALCIUM_integer"
+ id="IDL:Ports/Calcium_Ports/Calcium_Integer_Port:1.0"/>
+ <objref name="CALCIUM_logical"
+ id="IDL:Ports/Calcium_Ports/Calcium_Logical_Port:1.0"/>
+ <objref name="CALCIUM_real"
+ id="IDL:Ports/Calcium_Ports/Calcium_Real_Port:1.0"/>
+ <objref name="CALCIUM_string"
+ id="IDL:Ports/Calcium_Ports/Calcium_String_Port:1.0"/>
+ <objref name="file" id="file"/>
+ <container name="DefaultContainer">
+ <property name="container_name" value=""/>
+ <property name="cpu_clock" value="0"/>
+ <property name="hostname" value=""/>
+ <property name="isMPI" value="false"/>
+ <property name="mem_mb" value="0"/>
+ <property name="nb_component_nodes" value="0"/>
+ <property name="nb_node" value="0"/>
+ <property name="nb_proc_per_node" value="0"/>
+ <property name="parallelLib" value=""/>
+ <property name="workingdir" value=""/>
+ </container>
+ <service name="SCODE">
+ <component>SCODE</component>
+ <load container="DefaultContainer"/>
+ <method>ScodeGo</method>
+ <outstream name="STP_EN" type="CALCIUM_integer"/>
+ <outstream name="STP_RE" type="CALCIUM_real"/>
+ <outstream name="STP_DB" type="CALCIUM_double"/>
+ <outstream name="STP_CX" type="CALCIUM_complex"/>
+ <outstream name="STP_CH" type="CALCIUM_string"/>
+ <outstream name="STP_LQ" type="CALCIUM_logical"/>
+ <outstream name="SIP_EN" type="CALCIUM_integer"/>
+ <outstream name="SIP_DB" type="CALCIUM_double"/>
+ <outstream name="STP_DB2" type="CALCIUM_double"/>
+ <outstream name="SIS_EN" type="CALCIUM_integer"/>
+ <outstream name="SIS_DB" type="CALCIUM_double"/>
+ <outstream name="STS_EN" type="CALCIUM_integer"/>
+ <outstream name="STS_DB" type="CALCIUM_double"/>
+ <outstream name="SIP_DB2" type="CALCIUM_double"/>
+ </service>
+ <service name="ECODE">
+ <component>ECODE</component>
+ <load container="DefaultContainer"/>
+ <method>EcodeGo</method>
+ <instream name="ETP_EN" type="CALCIUM_integer"/>
+ <instream name="ETP_RE" type="CALCIUM_real"/>
+ <instream name="ETP_DB" type="CALCIUM_double"/>
+ <instream name="ETP_CX" type="CALCIUM_complex"/>
+ <instream name="ETP_CH" type="CALCIUM_string"/>
+ <instream name="ETP_LQ" type="CALCIUM_logical"/>
+ <instream name="EIP_EN" type="CALCIUM_integer"/>
+ <instream name="EIP_DB" type="CALCIUM_double"/>
+ <instream name="ETP_DB2" type="CALCIUM_double"/>
+ <instream name="EIS_EN" type="CALCIUM_integer"/>
+ <instream name="EIS_DB" type="CALCIUM_double"/>
+ <instream name="ETS_EN" type="CALCIUM_integer"/>
+ <instream name="ETS_DB" type="CALCIUM_double"/>
+ </service>
+ <service name="Espion">
+ <component>ESPION</component>
+ <load container="DefaultContainer"/>
+ <method>EspionGo</method>
+ <instream name="SIP_DB2" type="CALCIUM_double"/>
+ <instream name="EIP_DB" type="CALCIUM_double"/>
+ <outstream name="STP_DB2" type="CALCIUM_double"/>
+ <outstream name="SIP_DB" type="CALCIUM_double"/>
+ </service>
+ <stream>
+ <fromnode>SCODE</fromnode> <fromport>STP_EN</fromport>
+ <tonode>ECODE</tonode> <toport>ETP_EN</toport>
+ </stream>
+ <stream>
+ <fromnode>SCODE</fromnode> <fromport>STP_RE</fromport>
+ <tonode>ECODE</tonode> <toport>ETP_RE</toport>
+ </stream>
+ <stream>
+ <fromnode>SCODE</fromnode> <fromport>STP_DB</fromport>
+ <tonode>ECODE</tonode> <toport>ETP_DB</toport>
+ </stream>
+ <stream>
+ <fromnode>SCODE</fromnode> <fromport>STP_CX</fromport>
+ <tonode>ECODE</tonode> <toport>ETP_CX</toport>
+ </stream>
+ <stream>
+ <fromnode>SCODE</fromnode> <fromport>STP_CH</fromport>
+ <tonode>ECODE</tonode> <toport>ETP_CH</toport>
+ </stream>
+ <stream>
+ <fromnode>SCODE</fromnode> <fromport>STP_LQ</fromport>
+ <tonode>ECODE</tonode> <toport>ETP_LQ</toport>
+ </stream>
+ <stream>
+ <fromnode>SCODE</fromnode> <fromport>SIP_EN</fromport>
+ <tonode>ECODE</tonode> <toport>EIP_EN</toport>
+ </stream>
+ <stream>
+ <fromnode>SCODE</fromnode> <fromport>SIP_DB</fromport>
+ <tonode>ECODE</tonode> <toport>EIP_DB</toport>
+ </stream>
+ <stream>
+ <fromnode>SCODE</fromnode> <fromport>SIP_DB</fromport>
+ <tonode>Espion</tonode> <toport>EIP_DB</toport>
+ </stream>
+ <stream>
+ <fromnode>SCODE</fromnode> <fromport>STP_DB2</fromport>
+ <tonode>ECODE</tonode> <toport>ETP_DB2</toport>
+ </stream>
+ <stream>
+ <fromnode>SCODE</fromnode> <fromport>SIS_EN</fromport>
+ <tonode>ECODE</tonode> <toport>EIS_EN</toport>
+ </stream>
+ <stream>
+ <fromnode>SCODE</fromnode> <fromport>SIS_DB</fromport>
+ <tonode>ECODE</tonode> <toport>EIS_DB</toport>
+ </stream>
+ <stream>
+ <fromnode>SCODE</fromnode> <fromport>STS_EN</fromport>
+ <tonode>ECODE</tonode> <toport>ETS_EN</toport>
+ </stream>
+ <stream>
+ <fromnode>SCODE</fromnode> <fromport>STS_DB</fromport>
+ <tonode>ECODE</tonode> <toport>ETS_DB</toport>
+ <property name="level" value="4"/>
+ </stream>
+ <stream>
+ <fromnode>SCODE</fromnode> <fromport>STS_DB</fromport>
+ <tonode>Espion</tonode> <toport>SIP_DB2</toport>
+ </stream>
+ <stream>
+ <fromnode>SCODE</fromnode> <fromport>STS_DB</fromport>
+ <tonode>Espion</tonode> <toport>EIP_DB</toport>
+ </stream>
+ <stream>
+ <fromnode>SCODE</fromnode> <fromport>SIP_DB2</fromport>
+ <tonode>Espion</tonode> <toport>SIP_DB2</toport>
+ </stream>
+ <stream>
+ <fromnode>Espion</fromnode> <fromport>STP_DB2</fromport>
+ <tonode>ECODE</tonode> <toport>ETP_DB2</toport>
+ </stream>
+ <stream>
+ <fromnode>Espion</fromnode> <fromport>SIP_DB</fromport>
+ <tonode>ECODE</tonode> <toport>EIP_DB</toport>
+ </stream>
+ </proc>
+
+
+
+Generating a CALCIUM module with YACSGEN: example
+-----------------------------------------------------
+Complete YACSGEN script to create a generated CALCIUM_TESTS module:
+
+.. code-block:: python
+
+ from module_generator import Generator,Module,Service
+ from module_generator import PYComponent,CPPComponent,F77Component
+ context={"update":1,
+ "prerequisites":"/local/salome5/SALOME5/V5NoDebug/prerequis-V5NoDebug.sh",
+ "kernel":"/local/salome5/SALOME5/V5NoDebug/DEV/INSTALL/KERNEL/"
+ }
+
+ c1=CPPComponent("ECODE",
+ services=[
+ Service("EcodeGo",
+ instream=[
+ ("ETP_EN","CALCIUM_integer","T"),
+ ("ETP_RE","CALCIUM_real","T"),
+ ("ETP_DB","CALCIUM_double","T"),
+ ("ETP_CX","CALCIUM_complex","T"),
+ ("ETP_CH","CALCIUM_string","T"),
+ ("ETP_LQ","CALCIUM_logical","T"),
+ ("EIP_EN","CALCIUM_integer","I"),
+ ("EIP_DB","CALCIUM_double","I"),
+ ("ETP_DB2","CALCIUM_double","T"),
+ ("EIS_EN","CALCIUM_integer","I"),
+ ("EIS_DB","CALCIUM_double","I"),
+ ("ETS_EN","CALCIUM_integer","T"),
+ ("ETS_DB","CALCIUM_double","T") ],
+ outstream=[],
+ defs="""extern "C" {
+ int ecode(void *);
+ }""",
+ body="""
+ ecode(component);
+ """
+ ,),
+ ],
+ libs="",
+ rlibs=""
+ )
+
+ c2=CPPComponent("SCODE",
+ services=[
+ Service("ScodeGo",
+ instream=[],
+ outstream=[
+ ("STP_EN","CALCIUM_integer","T"),
+ ("STP_RE","CALCIUM_real","T"),
+ ("STP_DB","CALCIUM_double","T"),
+ ("STP_CX","CALCIUM_complex","T"),
+ ("STP_CH","CALCIUM_string","T"),
+ ("STP_LQ","CALCIUM_logical","T"),
+ ("SIP_EN","CALCIUM_integer","I"),
+ ("SIP_DB","CALCIUM_double","I"),
+ ("STP_DB2","CALCIUM_double","T"),
+ ("SIS_EN","CALCIUM_integer","I"),
+ ("SIS_DB","CALCIUM_double","I"),
+ ("STS_EN","CALCIUM_integer","T"),
+ ("STS_DB","CALCIUM_double","T"),
+ ("SIP_DB2","CALCIUM_double","I") ],
+ defs="""extern "C" {
+ int scode(void *);
+ }""",
+ body="""
+ scode(component);
+ """
+ ,),
+ ],
+ libs="",
+ rlibs=""
+ )
+
+ c3=CPPComponent("ESPION",
+ services=[
+ Service("EspionGo",
+ instream=[
+ ("SIP_DB2","CALCIUM_double","I"),
+ ("EIP_DB","CALCIUM_double","I")],
+ outstream=[
+ ("STP_DB2","CALCIUM_double","T"),
+ ("SIP_DB","CALCIUM_double","I") ],
+ defs="""extern "C" {
+ int espion(void *);
+ }""",
+ body="""
+ espion(component);
+ """
+ ,),
+ ],
+ libs="",
+ rlibs=""
+ )
+
+
+ m=Module("CALCIUM_TESTS",components=[c1,c2,c3],prefix="INSTALL")
+
+ g=Generator(m,context)
+ g.generate()
+ ##g.bootstrap()
+ ##g.configure()
+ ##g.make()
+ ##g.install()
+ ##g.make_appli("appli",restrict=["KERNEL","GUI","YACS"])
+
+.. [1] The CALCIUM library is shared between several components in a single container, therefore it needs a pointer to the component to identify the requested ports.
+
.. _calculator:
-MED Calculator Component
+MEDCoupling Calculator Component
=========================
-This example is the following of the HELLO component. It's purpose is to show how to quickly create a new Salome module, to introduce the use of MED objects within Salome/Corba context, to demonstrate the mechanism of exceptions, and to introduce the use of Salome supervisor.
+This example is the following of the HELLO component. It's purpose is to show how to quickly create a new SALOME module, to introduce the use of MEDCoupling objects within SALOME/Corba context, to demonstrate the mechanism of exceptions, and to introduce the use of SALOME supervisor.
The MED libraries
------------------
+-------------------------
-Let's go back a little bit on the different MED libraries (a web site giving general information and documentation about MED project is accessible from the Salome2 web site, links section).
+Let's go back a little bit on the different MED libraries (a web site giving general information and documentation about MED / MEDCoupling project is accessible from the SALOME web site, links section).
-The first level (called “Med File”) is a C and Fortran API that implements mesh and field persistence. The definition of the mesh format (the definition of the implemented entities, the connectivity references ...) is done in [R3]_. The use of the API is documented by [R4]_ and [R5]_. The produced files are based on hdf format, and have the “.med” extension.
+The first level (called “MED File”) is a C and Fortran API that implements mesh and field persistence. The definition of the mesh format (the definition of the implemented entities, the connectivity references ...) is done in [R3]_. The use of the API is documented by [R4]_ and [R5]_. The produced files are based on hdf format, and have the “.med” extension.
-The second level library is called “Med Memory”, which is a C++ API that allows creating mesh and field objects in memory. Mesh creation can be done from scratch using set functions, or by loading a file with a driver (see html documentation and [R6]_). Fields are also created using drivers, or by initialization with a user-defined analytic function. Supported file format are .med, .sauv (persistent format of the CASTEM code), vtk (only in write mode), and porflow (fluid flow and heat transfer code). Med Memory was developed to allow the exchange of mesh and field objects in memory between solvers. It can also be used as an internal data structure for new solvers. A last purpose was to gather in the same place existing algorithms and services around meshes and fields :
+The second level library is called “MEDCoupling”, which is a C++ API that allows to create mesh and field objects in memory and manipulate them. Mesh creation can be done from scratch using set functions, or by loading a file with a driver (see html documentation and [R6]_). Fields are also created using drivers (MEDLoader), or by initialization with a user-defined analytic function. Supported file format are .med, .sauv (persistent format of the CASTEM code) and vtk (only in write mode). MEDCoupling was developed to allow the exchange of mesh and field objects in memory between solvers. It can also be used as an internal data structure for new solvers. A last purpose was to gather in the same place existing algorithms and services around meshes and fields :
* computation of sub-elements nodal connectivities (faces, edges),
-There are two libraries on the third level: a python API generated by SWIG, and a CORBA API :
+There are two libraries on the third level: a python API generated by SWIG, and a CORBA interface to exchange meshes, fields objects between different processes and SALOME containers without using files:
-* The python API wraps the complete Med Memory API, and allows a python user to manipulate Med Memory C++ objects within python.
+* The python API wraps the complete MEDCoupling API, and allows a python user to manipulate MEDCoupling C++ objects within python.
-* The CORBA API was written to facilitate distributed computation inside Salome. The API defines interfaces for the main MED objects (FIELD, SUPPORT, MESH). These interfaces are defined in the file MED.idl, they propose methods that allow distant users to access data. They are implemented by CORBA servants that encapsulate C++ Med Memory objects. This last library is the one we are using here to implement the CALCULATOR component on the server side.
+* The CORBA interface defined in MEDCouplingCorbaInterface.idl, propose methods that allow distant users to retrieve remote meshes, fields objects and to make available objects for others components. They are implemented by CORBA servants that encapsulate C++ MEDCoupling objects. This last library is the one we are using here to implement the CALCULATOR component on the server side.
-Finally, on the client side, we will demonstrate the use of the MEDClient classes. These classes are proxy classes designed to facilitate and optimize interaction of distant MED CORBA objects with local solvers. The Corba API is completely hidden to clients.
+Finally, on the client side, we will demonstrate the use of the MEDClient classes. These classes are proxy classes designed to facilitate and optimize interaction of distant MEDCoupling CORBA objects with local solvers. The Corba API is completely hidden to clients.
-Creation of a new Salome module - Compilation
+Creation of a new SALOME module - Compilation
---------------------------------------------
-The first step when developing a new Salome module is to create a directories tree with makefiles that allow you to compile a Salome component. This directories tree must follow Salome2 rules, which are described in [R1]_ and [R2]_. Create a complete tree from scratch is complicated, and error prone. The easiest way consist to find an existing module that “looks like the one you need”, and copy it. A shell script was written to facilitate this step : renameSalomeModule . This utility replace, after copying a module, any occurrence of the old name by the new one, thus avoiding to forget one of them. In the following example, we create a CALCULATOR_SRC module by copying HELLO_SRC module, then renameSalomeModule replace any occurrence of HELLO by CALCULATOR in CALCULATOR_SRC module:
+The first step when developing a new SALOME module is to create a directories tree with makefiles that allow you to compile a SALOME component. This directories tree must follow SALOME rules, which are described in [R1]_ and [R2]_. Create a complete tree from scratch is complicated, and error prone. The easiest way consist to find an existing module that “looks like the one you need”, and copy it. A shell script was written to facilitate this step : renameSalomeModule . This utility replace, after copying a module, any occurrence of the old name by the new one, thus avoiding to forget one of them. In the following example, we create a CALCULATOR_SRC module by copying HELLO_SRC module, then renameSalomeModule replace any occurrence of HELLO by CALCULATOR in CALCULATOR_SRC module:
#include "SALOME_Component.idl"
#include "SALOME_Exception.idl"
- #include "MED.idl"
+ #include "MEDCouplingCorbaServant.idl"
module CALCULATOR_ORB
{
/*! \brief Interface of the %CALCULATOR component
*/
- interface CALCULATOR_Gen : Engines::Component
+ interface CALCULATOR_Gen : Engines::EngineComponent
{
/*!
Calculate the maximum relative difference of field with the previous one.
At first call, store passed field and return 1.
*/
double convergenceCriteria(
- in SALOME_MED::FIELDDOUBLE field);
+ in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface field);
/*!
Apply to each (scalar) field component the linear function x -> ax+b.
Release field1 after use.
*/
- SALOME_MED::FIELDDOUBLE applyLin(
- in SALOME_MED::FIELDDOUBLE field1,
+ SALOME_MED::MEDCouplingFieldDoubleCorbaInterface applyLin(
+ in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface field1,
in double a1,
in double a2);
Return exception if fields are not compatible.
Release field1 and field2 after use.
*/
- SALOME_MED::FIELDDOUBLE add(
- in SALOME_MED::FIELDDOUBLE field1,
- in SALOME_MED::FIELDDOUBLE field2)
+ SALOME_MED::MEDCouplingFieldDoubleCorbaInterface add(
+ in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface field1,
+ in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface field2)
raises (SALOME::SALOME_Exception);
/*!
return euclidian norm of field
Release field after use.
*/
- double norm2(in SALOME_MED::FIELDDOUBLE field);
+ double norm2(in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface field);
/*!
return L2 norm of field
Release field after use.
*/
- double normL2(in SALOME_MED::FIELDDOUBLE field);
+ double normL2(in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface field);
/*!
return L1 norm of field
Release field after use.
*/
- double normL1(in SALOME_MED::FIELDDOUBLE field);
+ double normL1(in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface field);
/*!
return max norm of field
Release field after use.
*/
- double normMax(in SALOME_MED::FIELDDOUBLE field);
+ double normMax(in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface field);
/*!
This utility method print in standard output the coordinates & field values
Release field after use.
*/
- void printField(in SALOME_MED::FIELDDOUBLE field);
+ void printField(in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface field);
/*!
This method clones field in four examples.
Release field after use.
*/
void cloneField(
- in SALOME_MED::FIELDDOUBLE field,
- out SALOME_MED::FIELDDOUBLE clone1,
- out SALOME_MED::FIELDDOUBLE clone2,
- out SALOME_MED::FIELDDOUBLE clone3,
- out SALOME_MED::FIELDDOUBLE clone4 );
+ in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface field,
+ out SALOME_MED::MEDCouplingFieldDoubleCorbaInterface clone1,
+ out SALOME_MED::MEDCouplingFieldDoubleCorbaInterface clone2,
+ out SALOME_MED::MEDCouplingFieldDoubleCorbaInterface clone3,
+ out SALOME_MED::MEDCouplingFieldDoubleCorbaInterface clone4 );
};
};
-* the inclusion of SALOME_Component.idl and SALOME_Exception.idl files, necessary for each Salome component (the CALCULATOR interface inherit from Engines::Component to benefit common services),
+* the inclusion of SALOME_Component.idl and SALOME_Exception.idl files, necessary for each SALOME component (the CALCULATOR interface inherit from Engines::EngineComponent to benefit common services),
-* the inclusion of MED.idl, because we are using the FIELDDOUBLE interface defined in SALOME_MED module.
+* the inclusion of MEDCouplingCorbaServant.idl, because we are using the MEDCouplingFieldDoubleCorbaInterface interface defined in SALOME_MED module.
The IDL attributes are mapped to C++ methods. This operation is normalized by CORBA. Here, we give the mapping for the types involved in our example:
-====================== =================
- **IDL Type** **C++ type**
-====================== =================
- **double** CORBA::DOUBLE
- **in FIELDDOUBLE** FIELDDOUBLE_ptr
- **out FIELDDOUBLE** FIELDDOUBLE_out
- **FIELDDOUBLE** FIELDDOUBLE_ptr
-====================== =================
+=============================================== =========================================
+ **IDL Type** **C++ type**
+=============================================== =========================================
+ **double** CORBA::DOUBLE
+ **in MEDCouplingFieldDoubleCorbaInterface** MEDCouplingFieldDoubleCorbaInterface_ptr
+ **out MEDCouplingFieldDoubleCorbaInterface** MEDCouplingFieldDoubleCorbaInterface_out
+ **MEDCouplingFieldDoubleCorbaInterface** MEDCouplingFieldDoubleCorbaInterface_ptr
+=============================================== =========================================
-FIELDDOUBLE_ptr and FIELDDOUBLE_out are C++ classes generated by the IDL compiler to map the MED CORBA interface FIELDDOUBLE . We will see below how to create such classes. But before, let's have a look on the new header of the user-defined derived class CALCULATOR.hxx :
+MEDCouplingFieldDoubleCorbaInterface_ptr and MEDCouplingFieldDoubleCorbaInterface_out are C++ classes generated by the IDL compiler to map the MEDCoupling CORBA interface MEDCouplingFieldDoubleCorbaInterface . We will see below how to create such classes. But before, let's have a look on the new header of the user-defined derived class CALCULATOR.hxx :
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(CALCULATOR_Gen)
- #include CORBA_CLIENT_HEADER(MED)
+ #include CORBA_CLIENT_HEADER(MEDCouplingCorbaServant)
#include "SALOME_Component_i.hxx"
class CALCULATOR:
virtual ~CALCULATOR();
CORBA::Double convergenceCriteria(
- SALOME_MED::FIELDDOUBLE_ptr field);
+ SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field);
CORBA::Double normMax(
- SALOME_MED::FIELDDOUBLE_ptr field1);
+ SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field1);
CORBA::Double normL2(
- SALOME_MED::FIELDDOUBLE_ptr field1);
- CORBA::Double norm2(SALOME_MED::FIELDDOUBLE_ptr field1);
+ SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field1);
+ CORBA::Double norm2(SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field1);
CORBA::Double normL1(
- SALOME_MED::FIELDDOUBLE_ptr field1);
- SALOME_MED::FIELDDOUBLE_ptr applyLin(
- SALOME_MED::FIELDDOUBLE_ptr field1,
+ SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field1);
+ SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr applyLin(
+ SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field1,
CORBA::Double a,CORBA::Double b);
- SALOME_MED::FIELDDOUBLE_ptr add(
- SALOME_MED::FIELDDOUBLE_ptr field1,
- SALOME_MED::FIELDDOUBLE_ptr field2)
+ SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr add(
+ SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field1,
+ SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field2)
throw ( SALOME::SALOME_Exception );
- void printField(SALOME_MED::FIELDDOUBLE_ptr field);
+ void printField(SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field);
void cloneField(
- SALOME_MED::FIELDDOUBLE_ptr field,
+ SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field,
SALOME_MED::FIELDDOUBLE_out clone1,
SALOME_MED::FIELDDOUBLE_out clone2,
SALOME_MED::FIELDDOUBLE_out clone3,
-* the inclusion of CORBA_CLIENT_HEADER(MED) : this macro includes the header we needs to use CORBA MED interfaces (here, to use FIELDDOUBLE interface).
+* the inclusion of CORBA_CLIENT_HEADER(MEDCouplingCorbaServant) : this macro includes the header we needs to use CORBA MEDCoupling interfaces (here, to use MEDCouplingFieldDoubleCorbaInterface interface).
::
- CORBA::Double CALCULATOR::norm2(FIELDDOUBLE_ptr field1)
+ CORBA::Double CALCULATOR::norm2(SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field1)
{
beginService( "CALCULATOR::norm2");
- BEGIN_OF("CALCULATOR::Norm2(FIELDDOUBLE_ptr field1)");
+ BEGIN_OF("CALCULATOR::Norm2(SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field1)");
// Create a local field from corba field
// apply method normMax on it. When exiting the function
// f1 is deleted, and with it the remote corba field.
- FIELDClient<double> f1(field1);
- CORBA::Double norme = f1.norm2();
- END_OF("CALCULATOR::Norm2(FIELDDOUBLE_ptr field1)");
+ ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDCouplingFieldDouble> f1=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(field1);
+ CORBA::Double norme = f1->norm2();
+ END_OF("CALCULATOR::Norm2(SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field1)");
endService( "CALCULATOR::norm2");
return norme;
}
-The norm2 method receives as an input parameter a reference to a distant MED CORBA field (named field1 ). It plays the role of the client toward the distant field field1 . As a client, we could directly call the methods of the FIELDDOUBLE CORBA API, for example call the getValue() method to retrieve the field values as an array. Doing this has some drawbacks. The transfer is not optimized because values are duplicated on server side. On the client side, we retrieve an array, but if we want to use existing solver or a function that takes an MedMemory C++ field, we need to rebuild a C++ field from the array, which is fastidious. That's why we are using here FIELDClient class : FIELDClient<double>. This is a proxy C++ template class (also available for int type), that inherit the interface of the MedMemory C++ FIELD<double> class. Therefore, it can be used anywhere in place where a FIELD<double> is expected. The characteristics of this class are :
+The norm2 method receives as an input parameter a reference to a distant MEDCoupling CORBA field (named field1 ). It plays the role of the client toward the distant field field1 . As a client, we could directly call the methods of the MEDCouplingFieldDouble CORBA interface, for example call the getValue() method to retrieve the field values as an array. Doing this has some drawbacks. The transfer is not optimized because values are duplicated on server side. On the client side, we retrieve an array, but if we want to use existing solver or a function that takes an MEDCoupling C++ field, we need to rebuild a C++ field from the array, which is fastidious. That's why we are using here MEDCouplingFieldDoubleClient class : MEDCouplingFieldDouble. This is a proxy C++ template class (also available for int type), that inherit the interface of the MEDCoupling C++ MEDCouplingFieldDouble class. Therefore, it can be used anywhere in place where a MEDCouplingFieldDouble is expected. The characteristics of this class are :
* it holds the CORBA reference of the distant field – and release it when object get out of scope (done in the class destructor),
-* the memory is automatically managed : when deleted, the FIELDClient release the CORBA reference it holds.
+* the memory is automatically managed : when deleted, the MEDCouplingFieldDoubleClient release the CORBA reference it holds.
-* and as already said, it can be used anywhere in state of a FIELD<double>, thus facilitating re-use of existing C++ API.
+* and as already said, it can be used anywhere in state of a MEDCouplingFieldDouble, thus facilitating re-use of existing C++ API.
-In our example, we simply create a FIELDClient , and then call on it the norm2 method of the MedMemory C++ API :
+In our example, we simply create a MEDCouplingFieldDoubleClient , and then call on it the norm2 method of the MEDCoupling C++ API :
::
- FIELDClient<double> f1(field1);
- CORBA::Double norme = f1.norm2();
+ ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDCouplingFieldDouble> f1=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(field1);
+ CORBA::Double norme = f1->norm2();
A client class was also created for MESH, called MESHClient , with the same characteristics. For meshes, all the arrays (connectivities, coordinates) are transferred on demand, which is generally more interesting than for fields (where we usually need to retrieve values soon or later).
::
- FIELDDOUBLE_ptr CALCULATOR::applyLin(
- FIELDDOUBLE_ptr field1,
+ SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr CALCULATOR::applyLin(
+ SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field1,
CORBA::Double a,CORBA::Double b)
{
beginService( "CALCULATOR::applyLin");
BEGIN_OF("CALCULATOR::applyLin");
// create a local field on the heap,
// because it has to remain after exiting the function
- FIELD<double> * f1 = new FIELDClient<double>(field1);
+ ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDCouplingFieldDouble> f1=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(field1);
+ int nbOfCompo=f1->getArray()->getNumberOfComponents();
+ f1->getArray()->rearrange(1);
+ ParaMEDMEM::MEDCouplingFieldDoubleServant *NewField=NULL;
+ SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr myFieldIOR = NULL;
f1->applyLin(a,b);
+ f1->getArray()->rearrange(nbOfCompo);
// create servant from f1, give it the property of c++
// field (parameter true). This imply that when the
// client will release it's field, it will delete
// NewField,and f1.
- FIELDDOUBLE_i * NewField = new FIELDDOUBLE_i(f1,true) ;
+ NewField = new ParaMEDMEM::MEDCouplingFieldDoubleServant(f1);
// activate object
- FIELDDOUBLE_ptr myFieldIOR = NewField->_this() ;
+ myFieldIOR = NewField->_this() ;
END_OF("CALCULATOR::applyLin");
endService( "CALCULATOR::applyLin");
-The method is client for the parameter field field1 , and server for the returned field NewField . The client part (treatment of field1 ) is similar to the first example : we create with field1 a FIELDClient f1 and apply on it C++ method applyLin. The difference is that creation is done on the heap, not on the stack (we will explain why later) :
+The method is client for the parameter field field1 , and server for the returned field NewField . The client part (treatment of field1 ) is similar to the first example : we create with field1 a MEDCouplingFieldDoubleClient f1 and apply on it C++ method applyLin. The difference is that creation is done on the heap, not on the stack (we will explain why later) :
::
- FIELDDOUBLE_i * NewField = new FIELDDOUBLE_i(f1,true) ;
+ ParaMEDMEM::MEDCouplingFieldDoubleServant * NewField = new ParaMEDMEM::MEDCouplingFieldDoubleServant(f1);
f1->applyLin(a,b);
-For the server part, we create a CORBA field (class FIELDDOUBLE_i ), activate it and return a reference on it :
+For the server part, we create a CORBA field (class ParaMEDMEM::MEDCouplingFieldDoubleCorbaInterface ), activate it and return a reference on it :
::
- FIELDDOUBLE_i * NewField = new FIELDDOUBLE_i(f1,true) ;
- FIELDDOUBLE_ptr myFieldIOR = NewField->_this() ;
+ ParaMEDMEM::MEDCouplingFieldDoubleServant * NewField = new ParaMEDMEM::MEDCouplingFieldDoubleServant(f1);
+ SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr myFieldIOR = NewField->_this() ;
return myFieldIOR;
-The parameters passed to the FIELDDOUBLE_i constructor are the C++ field f1 that is wrapped and used to give the services declared in IDL, and a boolean that indicates if ownership of wrapped field is transferred or not. If ownership is transferred, this means that when the CORBA field will be released by a client (for example by a FIELDClient created with a reference on it), it will delete the C++ field it holds. For example, the following code a hypothetic client could write would cause deletion of C++ field f1 :
+The parameters passed to the ParaMEDMEM::MEDCouplingFieldDoubleServant constructor are the C++ field f1 that is wrapped and used to give the services declared in IDL, and a boolean that indicates if ownership of wrapped field is transferred or not. If ownership is transferred, this means that when the CORBA field will be released by a client (for example by a MEDCouplingFieldDoubleClient created with a reference on it), it will delete the C++ field it holds. For example, the following code a hypothetic client could write would cause deletion of C++ field f1 :
::
- FIELDDOUBLE_ptr distant_f = CALCULATOR::applyLin(f,a,b);
- FIELD<double>* local_f = new FIELDClient<double>(distant_f);
+ SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr distant_f = CALCULATOR::applyLin(f,a,b);
+ ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDCouplingFieldDouble> local_f=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(distant_f);
// .. Use local_f
delete local_f; // causes release of distant_f and deletion
// of the C++ field it holds
-.. [R1] Guide pour le développement d'un module Salome 2 en Python (C. Caremoli) (voir :ref:`pysalome`).
+.. [R1] Guide for the development of a SALOME module in Python (C. Caremoli) (see :ref:`pysalome`).
-.. [R2] Guide pour le développement d'un module Salome 2 en C++ (N. Crouzet) (voir :ref:`cppsalome`).
+.. [R2] Guide for the development of a SALOME module in C++ (N. Crouzet) (see :ref:`cppsalome`).
-.. [R3] Définition du modèle d'échange de données MED V2.2 (V. Lefebvre, E. Fayolle).
+.. [R3] Définition du modèle d'échange de données MED V3 (V. Lefebvre, E. Fayolle).
-.. [R4] Guide de référence de la bibliothèque MED V2.2 (V. Lefebvre, E. Fayolle).
+.. [R4] Guide de référence de la bibliothèque MED V3 (V. Lefebvre, E. Fayolle).
-.. [R5] Guide d'utilisation de la bibliothèque MED V2.2 (V. Lefebvre, E. Fayolle).
+.. [R5] Guide d'utilisation de la bibliothèque MED V3 (V. Lefebvre, E. Fayolle).
-.. [R6] User's guide of Med Memory (P. Goldbronn, E. Fayolle, N. Bouhamou).
+.. [R6] User's guide of MEDCoupling (Doc HTML MED).
.. _seccompinterne:
-Mise sous forme d'objet interne
+Defining an internal object
===============================
-.. index:: single: objet interne
+.. index:: single: internal object
-Dans la suite de ce document, on supposera qu'un **objet interne** est un
-**objet C++ ou python** qui fournit une première interface au code initial.
-Suivant la forme du code initial (binaire exécutable, librairie statique ou
-dynamique, fichiers sources f77, C, C++ ou python), cet objet aura différentes
-formes et la communication objet interne --- code initial sera différente.
+In the remainder of this document, it is assumed that an **internal object** is a **C++ or python object** that provides a
+first interface to the initial code. The form of this object and communication between the internal object and the
+initial code will be different depending on the form of the initial code (executable binary, static or dynamic library,
+f77, C, C++ or python source files).
-
-Méthodes et attributs de l'objet
+Object methods and attributes
--------------------------------
+In each case, the services and the internal state of the internal object will have to be defined. In particular:
-Dans chaque cas, il faudra définir les services et l'état interne de l'objet
-interne. En particulier :
-
-* choisir les différents services de cet objet
-
-* pour chaque service, définir les données d'entrée et de sortie
-
-* pour chaque entrée et chaque sortie, définir le type de la donnée et
- éventuellement les pré-conditions et post-conditions associées (par exemple,
- donnée d'entrée positive)
-
-* définir l'état interne de l'objet et éventuellement sa valeur avant et après
- l'appel aux différents services
-
-Les **services** seront implémentés sous forme de **méthodes publiques** et
-l'**état interne** sous forme d'**attributs**. Si le concepteur de l'objet
-désire permettre à l'utilisateur d'accéder en lecture/écriture aux attributs,
-il doit fournir des services accédant à ces attributs.
-
-
-Routines fortran77/fonctions C/classes C++
-------------------------------------------
-
-
-Principe
-^^^^^^^^
-
-Dans le cas de routines fortran77, de fonctions C et de classes C++,
-l'intégrateur ajoutera simplement une enveloppe C++ autour de ces fonctions
-(voir figure :ref:`Objet interne C++ <figobjetinterne>`), pour obtenir l'objet interne. Chaque
-méthode de l'objet
+* choose the different services of this object
+* for each service, define input and output data
+* for each input and each output, define the data type and possibly associated pre-conditions and post-conditions (for example positive input data)
+* define the internal state of the object and possibly its value before and after the call to different services.
-* extrait, si nécessaire, l'information des paramètres d'entrée,
+**Services** will be implemented in the form of **public methods** and the **internal state** will be implemented in the form of **attributes**.
+If the designer of the object allows the user to access the attributes in read and write, he must provide services to access these attributes.
-* appelle la ou les routines internes concernées,
+Fortran77 routines / C functions / C++ classes
+--------------------------------------------------
+Principle
+^^^^^^^^^^^
+In the case of Fortran77 routines, C functions and C++ classes, the integrator will simply add a C++ envelope around
+these functions (see figure :ref:`C++ internal object<figobjetinterne>`), to obtain the internal object.
+Each method in the object:
-* met en forme les résultats de ces routines internes dans les paramètres de
- sortie.
+- extracts information from the input parameters if necessary
+- calls the internal routine(s) concerned,
+- formats the results of these internal routines in the output parameters.
.. _figobjetinterne:
.. image:: images/objintcpp.png
- :width: 54ex
:align: center
-.. centered::
- Objet interne C++
+.. centered:: C++ internal object
.. _exemple1:
-Exemple 1
+Example 1
^^^^^^^^^
-Soient les routines fortran f77 suivantes effectuant des calculs d'algèbre
-linéaire sur des tableaux unidimensionnels de flottants :
+Consider the following f77 fortran routines performing linear algebra calculations on one dimensional floating tables:
``addvec.f``
.. include:: ./exemples/exemple1/prdscl.f
:literal:
-ainsi qu'une classe C++ simulant un type vecteur (très) rudimentaire :
+and a C++ class simulating a (very) rudimentary vector type:
.. _vecteur.hxx:
-``vecteur.hxx (interface C++)``
+``vecteur.hxx (C++ interface)``
.. include:: ./exemples/exemple1/exec2/vecteur.hxx
:literal:
-``vecteur.cxx (implémentation C++)``
+``vecteur.cxx (C++ implementation)``
.. include:: ./exemples/exemple1/exec2/vecteur.cxx
:literal:
-L'objet interne (i.e. la classe C++) dans l'exemple est :
+The internal object (i.e. the C++ class) in the example is:
``alglin.hxx``
.. include:: ./exemples/exemple1/exec2/alglin.cxx
:literal:
-**Remarques**
+**Notes**:
- #. Le choix des méthodes, du passage des paramètres et de leur type, est laissé
- libre à l'intégrateur (conformément aux souhaits des utilisateurs de l'objet).
- La correspondance entre les paramètres de l'objet interne et ceux des routines
- du code initial est réalisée par l'implémentation (fichier ``alglin.cxx``, ci-
- avant).
+#. The integrator chooses methods, parameter transfers and parameter types (in accordance with the requirements of object users).
+ The correspondence between parameters of the internal object and parameters of routines in the initial code is organised
+ by the implementation (file ``alglin.cxx``, above).
+#. In particular, if MED structures [MED]_ are transferred as input arguments, the C++ implementation file will be required to extract
+ and format information to be transferred to internal calculation routines (in the form of simple and scalar tables for internal
+ fortran routines). For output arguments in the MED format, the implementation will introduce the results of internal routines
+ into the MED objects to be returned.
- #. En particulier, si des structures MED [MED]_ sont passées en argument
- d'entrée, le fichier d'implémentation C++, sera chargé d'extraire et mettre en
- forme les informations à passer aux routines de calcul internes (sous forme de
- tableaux simples et scalaires pour les routines fortran internes). Pour les
- arguments de sortie au format MED, les résultats des routines internes seront
- introduites par l'implémentation dans les objets MED à retourner.
+Note the following in the above example:
-Dans l'exemple ci-avant, remarquer :
-
-* la declaration ``extern "C"`` devant les prototypes en C++ des fonctions
- fortran,
-
-* le caractère "underscore" ajouté au nom C++ des fonctions fortran,
-
-* le mode de passage des arguments, la règle étant : sauf exceptions (longueur
- des chaînes de caractères), on passe des pointeurs. Pour les arguments
- scalaires, on passe l'adresse de ces scalaires; pour des arguments pointeurs
- (tableaux), on passe les pointeurs tels quels.
-
-L'objet interne peut maintenant être utilisé dans un code C++ :
+* the ``“C” extern`` declaration in front of C++ prototypes of fortran functions
+* the “underscore” character added to the C++ name of fortran functions
+* the mode of transferring arguments, the rule being that pointers will be transferred apart from exceptions (length of
+ character strings). For scalar arguments, the addresses of the scalar arguments will be transferred; for pointer
+ arguments (tables), the pointers will be transferred as is.
+The internal object can now be used in a C++ code:
.. include:: ./exemples/exemple1/exec2/main_extraits.cxx
:literal:
-Références
+References
^^^^^^^^^^
+The C / fortran77 encapsulation in a C++ code follows the standard procedure (formats of reals / integers,
+routine names, transfer of arguments). For example, further information on this subject is given in [ForCpp]_ or [ForCpp2]_.
-L'encapsulation C/fortran77 dans un code C++ suit la procédure standard
-(formats des réels/entiers, nom des routines, passage des arguments). A ce
-sujet, on pourra consulter, par exemple, [ForCpp]_ ou [ForCpp2]_.
-
-
-Fonctions/Classes Python
+Python function/classes
------------------------
-
-
-Principe
-^^^^^^^^
-
-Le principe d'encapsulation de fonctions/classes python dans un objet interne
-(python) est le même que dans le cas précédent.
+Principle
+^^^^^^^^^^
+The principle of encapsulation of python functions / classes in an internal object (python) is the same as in the previous case
.. _figobjetinterne2:
.. image:: images/objintpy.png
- :width: 54ex
:align: center
- .. centered::
- Objet interne python
+ .. centered:: Python internal object
-Exemple 2
+Example 2
^^^^^^^^^
-Un exemple similaire au précédent part de fonctions python à encapsuler :
-
+An example similar to the previous example starts from Python functions to be encapsulated:
``func.py``
.. include:: ./exemples/exemple2/func.py
:literal:
-Il est facile d'intégrer ces fonctions dans une classe python :
+It is easy to integrate these functions into a python class:
``compo.py``
.. include:: ./exemples/exemple2/compo.py
:literal:
-**Remarque**
- En fait, il n'est même pas nécessaire d'enrober les fonctions python de
- ``func.py``, mais c'est plus "propre" (en particulier si l'objet possède un
- état interne). Le script ci-après permet d'utiliser l'objet interne python
- depuis un interpréteur python :
+**Note**:
+ In fact, it is not even necessary to embed python functions of ``func.py``, but it is “cleaner” (particularly if
+ the object has an internal state). The following script uses the Python internal object from a python interpreter:
.. include:: ./exemples/exemple2/exmpl.py
:literal:
-Code initial sous forme d'exécutables
--------------------------------------
-
-
-Principe
-^^^^^^^^
-
-Ce cas se rencontre lorsqu'on ne dispose pas des sources du code interne (ou
-lorsqu'on ne désire pas intégrer ces sources dans l'architecture interne).
-On supposera que le code est sous forme d'un binaire exécutable par le système
-d'exploitation. Les communications avec le code peuvent se faire,
-
-1. en entrée, soit :
-
- * par un ou plusieurs fichiers,
- * par la ligne de commande,
- * en répondant au clavier à des questions du code
+Initial code in the form of executables
+--------------------------------------------
+Principle
+^^^^^^^^^^
+This case occurs when there are no internal code sources (or when it is not required to integrate these sources
+into the internal architecture). It will be assumed that the code is in the form of a binary that can be executed
+by the operating system. Communications can be made with the code.
-2. en sortie, soit :
+1. In input, either:
- * par un ou plusieurs fichiers,
- * à l'affichage écran.
+ - by one or several files,
+ - by the command line,
+ - using the keyboard to answer questions from the code
-La communication avec les exécutables se fait à l'aide des commandes
-(disponibles en C++ et en python) :
+2. In output, either:
-* ``system`` : lancer un exécutable avec lequel on communique en entrée via
- fichiers ou la ligne de commande, en sortie, via fichiers;
+ - by one or several files,
+ - on-screen display.
-* ``popen`` : mêmes fonctionnalités que le cas précédent, avec en plus la
- possibilité de récupérer la sortie standard (écran) de l'exécutable.
+Communication with executables is made using commands (available in C++ and in python):
-Les commandes ci-dessus sont rangées par ordre de complexité croissante (on
-conseille d'utiliser autant que possible ``system``).
+- ``system``: start an executable with which input communications are made through files or the command line, and
+ output communications are made through files,
+- ``popen``: same functions as the previous case, also with the possibility of retrieving the standard output (screen)
+ for the executable.
+The above commands are stored in order of increasing complexity (it is recommended that ``system`` should be used as much as possible).
-Exemple 3 : Objet interne python, connecté à des exécutables externes.
+Example 3: Python internal object connected to external executables
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+It is required to use a “System” object that has 5 services:
+- ``cd``, that starts from a path (character string) and sets a current directory,
+- ``cp``, that starts from 2 file names, and copies the first file onto the second in the current directory,
+- ``touch``, that starts from a file name and updates the date of the file if there is one, and otherwise creates it,
+- ``rm``, that starts from a file name and destroys the file in the current directory,
+- ``dir``, that lists the files contained in the current directory.
-On désire utiliser
-un objet "Systeme" qui possède 5 services :
-
-* ``cd``, qui, à partir d'un chemin (chaîne de caractères), positionne un
- répertoire courant,
-
-* ``cp``, qui, à partir de 2 noms de fichiers, copie le premier fichier sur le
- second dans le répertoire courant;
-
-* ``touch``, qui, à partir d'un nom de fichier, met à jour la date du fichier
- s'il existe, le crée sinon;
-
-* ``rm``, qui, à partir d'un nom de fichier, détruit le fichier dans le
- répertoire courant;
-
-* ``dir``, qui liste les fichiers contenus dans le répertoire courant.
-
-L'état interne de l'objet sera constitué du nom du répertoire courant dans
-lequel travailleront les services de l'objet (qui est positionné par le
-service ``cd``).
-
-En python, la classe de l'objet pourrait s'écrire :
+The internal state of the object will be composed of the name of the current directory in which the services of the
+object (that is set by the ``cd`` service) will work.
+In Python, the object class could be written:
``systeme.py``
.. include:: ./exemples/exemple3/systeme.py
:literal:
-et son utilisation depuis l'interpréteur python :
+and its use from the python interpreter:
.. include:: ./exemples/exemple3/use.py
:literal:
+**Notes**
-**Remarques**
-
- #. Ceci est donné à titre d'exemple, python possède en standard tout ce qu'il
- faut pour rendre ces services, sans passer par des commandes systèmes
- (``system`` et ``popen``).
-
- #. L'exemple illustre le passage d'arguments d'entrées par la ligne de
- commandes (noms passés en argument) et la "capture" des sorties écran des
- exécutables extérieurs (``system`` ne permet pas de récupérer simplement la
- sortie standard de la commande unix ``ls``, on utilise ``popen`` dans ce cas).
-
+#. This is given as an example, Python has everything necessary in the standard version to perform these services, without
+ the use of system commands (``system`` and ``popen``).
+#. The example illustrates transfer of input arguments through the command line (names transferred as arguments) and the “capture” of
+ screen outputs from external executables (``system`` that cannot simply recover the standard output from the unix command ``ls``, and
+ in this case ``popen`` is used).
.. _exemple4:
-Exemple 4 : Objet interne connecté à un exécutable externe.
+Example 4: Internal object connected to an external executable
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Cet exemple montre une
-interface (très) partielle d'un exécutable binaire *FreeFem* [FreeFem]_ sous la
-forme d'un objet C++. L'interface donne accès à la définition d'une géométrie
-2D par sa frontière ainsi que la résolution approchée d'une équation simple
-(convection forcée) sur cette géométrie. Les différentes méthodes de l'objet
-interne sont :
-
-* une méthode qui enregistre la géométrie du domaine,
-
-* une méthode qui enregistre le champs de vitesse convectante,
+This example shows a (very) partial interface of a binary executable *FreeFem* [FreeFem]_ in the form of a C++ object.
+The interface provides access to the definition of a 2D geometry through its boundary, and the approximate resolution of a
+simple equation (forced convection) on this geometry. The different methods of the internal object are:
-* la méthode de calcul qui reçoit la condition initiale (sous forme analytique
- --- chaîne de caractères), le pas de temps et le nombre de pas de temps.
+- a method that records the geometry of the domain,
+- a method that records the convecting velocity fields,
+- the calculation method that receives the initial condition (in analytic form – character string), the time step and the number of time steps.
-L'état interne de l'objet est constitué de la géométrie et du champs de
-vitesse. La méthode de calcul crée un fichier à partir de ses paramètres et
-de l'état interne, puis lance une boucle de calcul (par un appel système).
-Les résultats du calcul ne sont pas récupérés par l'objet.
+The internal state of the object is composed of the geometry and the velocity field.
+The calculation method creates a file starting from its parameters and the internal state, and then starts a calculation
+loop (by a system call). The object does not recover the calculation results.
-**Remarques**
+**Comments**
- #. Une encapsulation complète de FreeFem demanderait un effort beaucoup plus
- important, ceci n'est qu'un exemple.
+#. A complete encapsulation of FreeFem would require far too much effort, this is simply an example.
+#. We do not retrieve a result in the C++ object in this example (the change is only displayed by the FreeFem internal graphic
+ engine). If it was required to do so, it would be necessary to read the file produced by the external code after the system
+ call, and transfer the results in a form that could be understood by the User of the internal object.
- #. On ne récupère pas ici de résultat dans l'objet C++ (l'évolution est
- seulement visualisée par le moteur graphique interne de FreeFem). Si on
- désirait le faire, il faudrait après l'appel système, relire le fichier produit
- par le code externe, et renvoyer les résultats sous forme compréhensible par
- l'utilisateur de l'objet interne
-
-Deux versions (C++ et python) sont listées ci-après.
+Two versions (C++ and python) are listed below.
.. _freefem.hxx:
.. include:: ./exemples/exemple4/FreeFem.py
:literal:
-L'utilisation depuis un code C++ ou un interpréteur python est similaire dans
-les 2 versions :
-
+Use from a C++ code or a python interpreter is similar in the 2 versions:
``version C++``
.. _components:
-Integration de composants dans l'environnement Salome
+Integration of components into the SALOME environment
=============================================================
-Ce document décrit les opérations à effectuer pour intégrer des codes (de calcul
-par exemple) dans l'architecture Salomé.
+This document describes operations to be done to integrate codes (for example calculation codes) in the
+SALOME architecture.
-On peut envisager plusieurs scénarios d'intégration:
+Several integration scenarios could be envisaged:
-* Le plus simple est le pilotage local du code depuis un interpréteur python.
- Le code ne fonctionnera que sur une machine.
+- The simplest is local control of the code from a Python interpretor. The code will only operate on one machine.
+- The next stage consists of being able to control the code locally or remotely. The selected architecture
+ consists of presenting the code as a CORBA server [CORBA]_, capable of receiving and executing requests
+ from CORBA clients. SALOME offers a number of services that simplify the use of CORBA.
+- Finally, actual integration into SALOME consists of providing SALOME with all information necessary to control
+ the code, for example from the man-machine interface or for example through supervision.
-* Le stade suivant consiste à pouvoir piloter le code localement ou à
- distance. L'architecture retenue consiste à exposer le code comme un serveur
- CORBA [CORBA]_, capable de recevoir et d'exécuter des requêtes de clients CORBA.
- Salomé offre un certain nombre de services permettant de simplifier
- l'utilisation de CORBA.
+Several types of situations may be envisaged, knowing that there will always be special cases that should be
+dealt with by adapting procedures described in this document.
+The typical situations envisaged depend on the form of the available code:
-* Enfin, l'intégration proprement dite dans Salomé consiste à fournir à Salomé
- toutes les informations nécessaires au pilotage de code, par exemple depuis
- l'interface homme-machine ou via la supervision par exemple.
+- binary executable
+- binary library,
+- f77/C/C++ source code
+- python source code
-On envisagera plusieurs situations types, sachant qu'il y aura toujours des cas
-particuliers qui devront être traités en adaptant les procédures décrites dans
-ce document. Les situations types envisagées sont considérées suivant la
-forme du code disponible:
-
-* exécutable binaire,
-
-* librairie binaire,
-
-* code source f77/C/C++,
-
-* code source python.
-
-Dans la mesure du possible, on donnera des exemples des différentes situations
-rencontrées.
+We will give examples of the different situations encountered wherever possible.
.. toctree::
:maxdepth: 2
+++ /dev/null
-# -*- coding: utf-8 -*-
-#
-# yacs documentation build configuration file, created by
-# sphinx-quickstart on Fri Aug 29 09:57:25 2008.
-#
-# This file is execfile()d with the current directory set to its containing dir.
-#
-# The contents of this file are pickled, so don't put values in the namespace
-# that aren't pickleable (module imports are okay, they're removed automatically).
-#
-# All configuration values have a default; values that are commented out
-# serve to show the default.
-
-import sys, os
-
-# If your extensions are in another directory, add it here. If the directory
-# is relative to the documentation root, use os.path.abspath to make it
-# absolute, like shown here.
-#sys.path.append(os.path.abspath('.'))
-
-# General configuration
-# ---------------------
-
-# Add any Sphinx extension module names here, as strings. They can be extensions
-# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = []
-
-# Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
-
-# The suffix of source filenames.
-source_suffix = '.rst'
-
-# The encoding of source files.
-#source_encoding = 'utf-8'
-
-# The master toctree document.
-master_doc = 'index'
-
-# General information about the project.
-project = 'yacs'
-copyright = '2007-2009 CEA/DEN, EDF R&D, OPEN CASCADE, C. Caremoli, N. Crouzet, P. Rascle, A. Ribes, E. Fayolle, M. Tajchman'
-
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short X.Y version.
-version = '5.1'
-# The full version, including alpha/beta/rc tags.
-release = '5.1'
-
-# The language for content autogenerated by Sphinx. Refer to documentation
-# for a list of supported languages.
-#language = None
-
-# There are two options for replacing |today|: either, you set today to some
-# non-false value, then it is used:
-#today = ''
-# Else, today_fmt is used as the format for a strftime call.
-#today_fmt = '%B %d, %Y'
-
-# List of documents that shouldn't be included in the build.
-#unused_docs = []
-
-# List of directories, relative to source directory, that shouldn't be searched
-# for source files.
-exclude_trees = ['.build','ref','images','CVS']
-
-# The reST default role (used for this markup: `text`) to use for all documents.
-#default_role = None
-
-# If true, '()' will be appended to :func: etc. cross-reference text.
-#add_function_parentheses = True
-
-# If true, the current module name will be prepended to all description
-# unit titles (such as .. function::).
-#add_module_names = True
-
-# If true, sectionauthor and moduleauthor directives will be shown in the
-# output. They are ignored by default.
-#show_authors = False
-
-# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = 'sphinx'
-
-
-# Options for HTML output
-# -----------------------
-
-# The style sheet to use for HTML and HTML Help pages. A file of that name
-# must exist either in Sphinx' static/ path, or in one of the custom paths
-# given in html_static_path.
-html_style = 'default.css'
-
-# The name for this set of Sphinx documents. If None, it defaults to
-# "<project> v<release> documentation".
-#html_title = None
-
-# A shorter title for the navigation bar. Default is the same as html_title.
-#html_short_title = None
-
-# The name of an image file (relative to this directory) to place at the top
-# of the sidebar.
-#html_logo = None
-
-# The name of an image file (within the static path) to use as favicon of the
-# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
-# pixels large.
-#html_favicon = None
-
-# Add any paths that contain custom static files (such as style sheets) here,
-# relative to this directory. They are copied after the builtin static files,
-# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
-
-# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
-# using the given strftime format.
-#html_last_updated_fmt = '%b %d, %Y'
-
-# If true, SmartyPants will be used to convert quotes and dashes to
-# typographically correct entities.
-#html_use_smartypants = True
-
-# Custom sidebar templates, maps document names to template names.
-#html_sidebars = {}
-
-# Additional templates that should be rendered to pages, maps page names to
-# template names.
-#html_additional_pages = {}
-
-# If false, no module index is generated.
-html_use_modindex = False
-
-# If false, no index is generated.
-#html_use_index = True
-
-# If true, the index is split into individual pages for each letter.
-#html_split_index = False
-
-# If true, the reST sources are included in the HTML build as _sources/<name>.
-#html_copy_source = True
-
-# If true, an OpenSearch description file will be output, and all pages will
-# contain a <link> tag referring to it. The value of this option must be the
-# base URL from which the finished HTML is served.
-#html_use_opensearch = ''
-
-# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
-#html_file_suffix = ''
-
-# Output file base name for HTML help builder.
-htmlhelp_basename = 'yacsdoc'
-
-
-# Options for LaTeX output
-# ------------------------
-
-# The paper size ('letter' or 'a4').
-latex_paper_size = 'a4'
-
-# The font size ('10pt', '11pt' or '12pt').
-latex_font_size = '10pt'
-
-# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title, author, document class [howto/manual]).
-latex_documents = [
- ('index', 'yacs.tex', 'Documentation YACS', 'C. Caremoli, N. Crouzet, P. Rascle, A. Ribes, E. Fayolle, M. Tajchman', 'manual'),
-]
-
-# The name of an image file (relative to this directory) to place at the top of
-# the title page.
-#latex_logo = None
-
-# For "manual" documents, if this is true, then toplevel headings are parts,
-# not chapters.
-#latex_use_parts = False
-
-# Additional stuff for the LaTeX preamble.
-#latex_preamble = ''
-
-# Documents to append as an appendix to all manuals.
-#latex_appendices = []
-
-# If false, no module index is generated.
-latex_use_modindex = False
--- /dev/null
+# -*- coding: utf-8 -*-
+#
+# yacs documentation build configuration file, created by
+# sphinx-quickstart on Fri Aug 29 09:57:25 2008.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# The contents of this file are pickled, so don't put values in the namespace
+# that aren't pickleable (module imports are okay, they're removed automatically).
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If your extensions are in another directory, add it here. If the directory
+# is relative to the documentation root, use os.path.abspath to make it
+# absolute, like shown here.
+#sys.path.append(os.path.abspath('.'))
+
+# General configuration
+# ---------------------
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc']
+#add pdfbuilder to build a pdf with rst2pdf
+#extensions = ['rst2pdf.pdfbuilder']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = [os.path.join('@srcdir@','_templates')]
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = 'yacs'
+copyright = '2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE, C. Caremoli, N. Crouzet, P. Rascle, A. Ribes, E. Fayolle, M. Tajchman'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '@SHORT_VERSION@'
+# The full version, including alpha/beta/rc tags.
+release = '@VERSION@'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of documents that shouldn't be included in the build.
+#unused_docs = []
+
+# List of directories, relative to source directory, that shouldn't be searched
+# for source files.
+exclude_trees = ['.build','ref','images','CVS']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+
+# Options for HTML output
+# -----------------------
+
+# The theme to use for HTML and HTML Help pages. Major themes that come with
+# Sphinx are currently 'default' and 'sphinxdoc'.
+html_theme = 'default'
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = [os.path.join('@srcdir@','_static')]
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_use_modindex = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, the reST sources are included in the HTML build as _sources/<name>.
+#html_copy_source = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = ''
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'yacsdoc'
+
+
+# Options for LaTeX output
+# ------------------------
+
+# The paper size ('letter' or 'a4').
+latex_paper_size = 'a4'
+
+# The font size ('10pt', '11pt' or '12pt').
+latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, document class [howto/manual]).
+latex_documents = [
+ ('using', 'using.tex', 'YACS User Documentation', r'C. Caremoli, N. Crouzet, E. Fayolle,\\P. Rascle, A. Ribes, M. Tajchman', 'manual'),
+ ('integration', 'integration.tex', 'YACS Integration Documentation', r'C. Caremoli, N. Crouzet, E. Fayolle,\\P. Rascle, A. Ribes, M. Tajchman', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# Additional stuff for the LaTeX preamble.
+latex_preamble = """
+\RecustomVerbatimEnvironment
+ {Verbatim}{Verbatim}
+ {fontsize=\scriptsize}
+"""
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+latex_use_modindex = False
+
+#Options for rst2pdf output (through reportlab)
+pdf_documents = [
+ ('using', 'using', 'YACS User Documentation', 'C. Caremoli, N. Crouzet, P. Rascle, A. Ribes, E. Fayolle, M. Tajchman'),
+ ('integration', 'integration', 'YACS Integration Documentation', 'C. Caremoli, N. Crouzet, P. Rascle, A. Ribes, E. Fayolle, M. Tajchman'),
+]
+
+# A comma-separated list of custom stylesheets.
+pdf_stylesheets = ['sphinx','kerning','a4']
+
+# Create a compressed PDF
+# Use True/False or 1/0
+#pdf_compressed = False
+
+# A colon-separated list of folders to search for fonts. Example:
+# pdf_font_path = ['/usr/share/fonts', '/usr/share/texmf-dist/fonts/']
+
+# Language to be used for hyphenation support
+#pdf_language = "en_US"
+
.. _console:
************************************
-Utilisation de YACS en mode console
+Using YACS in console mode
************************************
.. toctree::
.. _cppsalome:
===========================================================
-Guide pour le développement d'un module SALOME en C++
+Guide for the development of a SALOME module in C++
===========================================================
-Ce document a pour objectif de décrire les différentes étapes
-du développement d'un module SALOME en C++.
-Il fait suite au document :ref:`pysalome`, qui documente le module PYHELLO, et en reprend la démarche :
-construction pas à pas d'un module HELLO.
-Comme de nombreux points ne sont pas repris, il est recommendé de lire ce
-document préalablement.
+The purpose of this document is to describe the different steps in the development of a SALOME module in C++.
+It follows on from the :ref:`pysalome` document, that documents the PYHELLO module, and it uses the same
+approach: step by step construction of a HELLO module. Since many points are not repeated, it is recommended
+that this document should be read first.
-
-Les étapes de construction du module exemple
+Steps in the construction of the example module
====================================================
-Le composant choisi pour illustrer le processus de construction en C++
-est le même que celui choisi pour illustrer la construction du module python :
-il implémentera donc la même interface idl Corba.
-Il sera complété par un GUI graphique écrit en Qt.
-
-Les différentes étapes du développement seront les suivantes :
-
- - créer une arborescence de module
- - créer un composant SALOME chargeable par un container C++
- - configurer le module pour que le composant soit connu de SALOME
- - ajouter un GUI graphique
- - rendre le composant utilisable dans le superviseur
-
-Création de l'arborescence du module
+The component chosen to illustrate the C++ construction process is the same as the process chosen to illustrate
+construction of the Python module: therefore, it will implement the same Corba idl interface. It will be
+completed by a graphic GUI written in Qt.
+
+The various steps of the development will be as follows:
+ - create a module structure
+ - create a SALOME component that can be loaded by a C++ container
+ - configure the module so that the component is known to SALOME
+ - add a graphic GUI
+ - make the component useable in the YACS module.
+
+Creating the module tree structure
=======================================
-Dans un premier temps, on se contentera de mettre dans le module exemple un composant
-SALOME écrit en C++ qui sera chargeable par un container C++.
-Il suffit donc d'une interface idl et d'une implantation C++ du composant.
-Pour mettre en oeuvre ceci dans un module SALOME, il nous faut reproduire l'arborescence de
-fichier standard suivante::
+We will start by simply putting a SALOME component written in C++ and that can be loaded by a C++ container, into the
+example module. Therefore, all that is necessary is an idl interface and a C++ implantation of the component.
+We need to reproduce the following standard file tree structure, to use it in a SALOME module::
+ HELLO1_SRC
+ build_configure
+ HELLO.hxx
+ doc
-Pour cela, on recopie l'arborescence de PYHELLO, et on modifie où nécessaire
-PYHELLO en HELLO::
+This is done by copying the PYHELLO tree structure, and modifying PYHELLO to HELLO if necessary::
cp -r PYHELLO1_SRC HELLO1_SRC
cd HELLO1_SRC
mv src/PYHELLO src/HELLO
-Interface idl
+IDL interface
==================
-Dans le répertoire idl, nous modifions le fichier idl HELLO_Gen.idl : le
-module défini est renommé HELLO_ORB, et l'interface en HELLO_Gen.
-Le service rendu reste le même : à partir d'une chaine de caractères
-fournie comme unique argument, retour d'une chaine de caractères obtenue
-par concaténation de "Hello, " et de la chaine d'entrée.
-Ce service est spécifié par la fonction makeBanner.
-
-Un utilitaire de documentation basé sur doxygen a été mis en place pour
-compiler une documentation des services corba à partir de commentaires se
-trouvant dans les fichiers idl. Nous rajouter donc à notre idl quelques
-commentaires, en respectant le formalisme doxygen.
-Un commentaire doxygen commence par "/\*!" et se finit par "\*/".
-Pour structurer un minimum les pages générées, on les regroupe par module ou
-sujet. Dans notre exemple, nous utilisons la directive::
-
- \ingroup EXAMPLES
-
-spécifiant que la documentation générée fait partie du groupe EXAMPLES.
-(pour plus d'information sur doxygen, consulter le site http://www.doxygen.org).
-
-Pour finir, nous mettons à jour le Makefile avec le nouveau nom de composant::
-
+We modify the HELLO_Gen.idl file in the idl directory: the defined module is named HELLO_ORB, and the interface
+is named HELLO_Gen. The service provided remains the same: starting from a character string supplied as the
+single argument, a character string derived from the concatenation of “Hello” and the input string is returned.
+This service is specified by the hello function.
+
+A documentation utility based on doxygen has been implemented to compile a documentation of corba services
+starting from comments located in idl files. Therefore, we will add few comments to our idl, respecting the
+doxygen formalism.
+A doxygen comment begins with "/\*" and ends with "\*/".
+They are grouped by module or subject, to provide a minimum structure for generated pages.
+We will use the following directive in our example::
+
+ \ingroup EXAMPLES
+
+specifying that the generated documentation forms part of the EXAMPLES group (please refer to
+the http://www.doxygen.org site for further information about doxygen).
+
+Finally, we will update the Makefile with the new component name::
+
IDL_FILES = HELLO_Gen.idl
-Implémentation C++
+C++ implementation
==================
-
-Les sources
+Sources
-----------
-
-L'implémentation C++ de notre module CORBA HELLO (interface idl HELLO_Gen) est faite dans le répertoire
-/src/HELLO::
+The C++ implementation of our CORBA HELLO module (HELLO_Gen idl interface) is made in the src/HELLO directory::
HELLO.hxx
HELLO.cxx
-Au début du header de notre module (HELLO.hxx), les inclusions suivantes sont
-nécessaires::
+The following inclusions are necessary at the beginning of the header of our module (HELLO.hxx)::
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(HELLO_Gen)
#include "SALOME_Component_i.hxx"
-Le fichier SALOMEconfig.h contient un certain nombre de définitions utiles
-pour assurer l'indépendance du code par rapport à la version de CORBA
-utilisée. SALOME_Component_i.hxx contient l'interface de la classe
-d'implémentation C++ du composant de base Salome (idl Engines::Component).
-Enfin, la macro CORBA_SERVER_HEADER assure l'indépendance des noms de fichiers
-d'inclusion par rapport à l'implémentation de l'ORB CORBA.
+The SALOMEconfig.h file contains a number of definitions useful for making the code independent from
+the version of CORBA used. SALOME_Component_i.hxx contains the interface of the C++ implementation class
+of the SALOME basic component (idl Engines::EngineComponent). Finally, the CORBA_SERVER_HEADER macro
+makes inclusion file names independent of the implementation of the CORBA ORB.
-Après cela, nous définissons une classe d'implémentation, nommée HELLO, dérivant de
-POA_HELLO_ORB::HELLO_Gen (classe abstraite générée automatiquement par CORBA lors de la
-compilation de l'idl) et de Engines_Component_i (car l'interface idl HELLO_Gen
-dérive de Engines::Component comme tout composant Salome). Cette classe
-contient un constructeur dont les arguments sont imposés par CORBA, un
-destructeur virtuel, et une méthode makeBanner fournissant le service souhaité::
+The next step is to define an implementation class called HELLO, derived from POA_HELLO_ORB::HELLO_Gen (abstract class
+generated automatically by CORBA during the compilation of the idl) and Engines_Component_i (because
+the HELLO_Gen idl interface is derived from Engines::EngineComponent like every SALOME component).
+This class contains a constructor whose arguments are imposed by SALOME, a virtual destructor, hello, goodbye and copyOrMove methods providing the required service::
class HELLO:
public POA_HELLO_ORB::HELLO_Gen,
public Engines_Component_i
{
public:
- HELLO(CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- PortableServer::ObjectId * contId,
- const char *instanceName,
- const char *interfaceName);
- virtual ~HELLO();
- char* makeBanner(const char* name);
+ HELLO(CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName);
+ virtual ~HELLO();
+ HELLO_ORB::status hello ( SALOMEDS::Study_ptr study, const char* name );
+ HELLO_ORB::status goodbye( SALOMEDS::Study_ptr study, const char* name );
+ void copyOrMove( const HELLO_ORB::object_list& what,
+ SALOMEDS::SObject_ptr where,
+ CORBA::Long row, CORBA::Boolean isCopy );
+
};
-La fonction makeBanner prend comme argument et renvoit un char*, projection C++ du type CORBA/IDL
-string.
-La documentation complète du mapping c++ de l'IDL est fournie par l'OMG sur
-son site internet : http://www.omg.org/cgi-bin/doc?ptc/00-01-02.
+The hello and goodbye functions use a char* as an argument and return status of the operation.
+The list of the statuses is defined in the HELLO_Gen.idl, see status enumeration for details.
-Enfin, nous fournissons l'interface (normalisé) de la fonction HELLOEngine_factory, qui
-sera appelée par le "FactoryServer C++" pour charger le composant HELLO:
-::
+Finally, we supply the standard interface of the HELLOEngine_factory function that will be called by the “FactoryServer C++”
+to load the HELLO component::
extern "C"
- PortableServer::ObjectId * HELLOEngine_factory(
- CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- PortableServer::ObjectId * contId,
- const char *instanceName,
- const char *interfaceName);
+ PortableServer::ObjectId * HELLOEngine_factory(CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName);
-Dans le fichier source (HELLO.cxx) se trouvent les définitions
-du constructeur et de la fonction d'instanciation
-HELLOEngine_factory (toutes deux normalisées!), et de makeBanner:
+The definitions of the constructor and the HELLOEngine_factory instantiation function (both normalized!),
+hello, goodbye and copyOrMove are given in the source file (HELLO.cxx)::
-::
+ HELLO_ORB::status HELLO::hello( SALOMEDS::Study_ptr study, const char* name )
+ {
+ ...
+ }
- char* HELLO::makeBanner(const char* name)
- {
- string banner="Hello, ";
- banner+=name;
- return CORBA::string_dup(banner.c_str());
- }
+ HELLO_ORB::status HELLO::goodbye( SALOMEDS::Study_ptr study, const char* name )
+ {
+ ...
+ }
-Dans cette fonction, l'emploi de string_dup (fonction déclarée dans le
-namespace CORBA) n'est pas obligatoire (on aurait pu utiliser l'opérateur new),
-mais conseillé car ces fonctions permettent aux ORB d'utiliser des mécanismes
-spéciaux de gestion de la mémoire sans avoir à redéfinir les opérateurs new
-globaux.
+ void HELLO::copyOrMove( const HELLO_ORB::object_list& what,
+ SALOMEDS::SObject_ptr where,
+ CORBA::Long row, CORBA::Boolean isCopy )
+ {
+ ...
+ }
Makefile
--------
-
-Dans le makefile, il faut définir certaines cibles::
-
- VPATH=.:@srcdir@:@top_srcdir@/idl
- LIB = libHELLOEngine.la
- LIB_SRC = HELLO.cxx
- LIB_SERVER_IDL = HELLO_Gen.idl
- LIB_CLIENT_IDL = SALOME_Component.idl SALOME_Exception.idl Logger.idl
- CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome
- LDFLAGS+= -lSalomeContainer -lOpUtil -L${KERNEL_ROOT_DIR}/lib/salome
-
-Passons en revue chacune de ces cibles.
-
-- LIB contient le nom *normalisé* (lib<Nom_Module>Engine.la) le nom de la
- librairie, LIB_SRC définit le nom des fichiers sources, et VPATH les
- repertoire où l'on peut les trouver.
-- LIB_SERVER_IDL contient le nom des fichiers idl implémentés par le module.
-- LIB_CLIENT_IDL contient le nom des idl où sont définis les services CORBA
- utilisés par le module. HELLO utilise Logger.idl via les macros "MESSAGE",
- SALOME_Component.idl et SALOME_Exception.idl via l'héritage de HELLO_ORB
-- Il faut ajouter à CPPFLAGS le chemin pour les fichiers includes utilisés
- (SALOMEconfig.h, SALOME_Component_i.hxx et utilities.h se trouvent dans
- ${KERNEL_ROOT_DIR}/include/salome)
-- La classe HELLO utilise les librairies lib (pour Engines_Component_i) et
- libOptUtil (pour PortableServer et Salome_Exception). On indique donc le nom
- de ces librairies et leur chemin dans LDFLAGS.
- D'autres librairies sont souvent utiles, par exemple libsalomeDS si on
- implémente la persistence, ou libSalomeNS si on utilise le naming service.
-
-
-Pilotage du composant depuis Python (mode TUI)
-==============================================
-
-Lors de la compilation du module, la cible lib du Makefile dans /idl a
-provoqué la génération d'un stub python (souche côté client générée à partir
-de l'idl et offrant une interface dans le langage client - ici python.
-Concrètement, un module python HELLO_ORB contenant une classe
-_objref_HELLO_Gen sont créés, permettant de faire appel aux services de notre
-module C++ depuis python. Mettons ceci en application. Pour cela, nous lançons
-Salome en mode TUI::
-
- cd $HELLO_ROOT_DIR/bin/salome
- python -i runSalome.py --modules=HELLO --xterm --logger --containers=cpp,python --killall
-
-Depuis la fenêtre python, nous importons le module LifeCycle, et utilisons ses
-services pour charger notre composant Dans la conteneur C++ FactoryServer::
+In makefile, some targets have to be defined::
+
+ # header files
+ salomeinclude_HEADERS = HELLO.hxx
+
+ # Libraries targets
+ lib_LTLIBRARIES = libHELLOEngine.la
+ dist_libHELLOEngine_la_SOURCES = \
+ HELLO.cxx
+
+ libHELLOEngine_la_CPPFLAGS = \
+ $(CORBA_CXXFLAGS) \
+ $(CORBA_INCLUDES) \
+ $(KERNEL_CXXFLAGS) \
+ -I$(top_builddir)/idl
+
+ libHELLOEngine_la_LDFLAGS = \
+ ../../idl/libSalomeIDLHELLO.la \
+ $(KERNEL_LDFLAGS) \
+ -lSalomeContainer \
+ -lOpUtil \
+ -lSalomeIDLKernel
+
+Review each of these targets
+
+- salomeinclude_HEADERS contains the header files.
+- lib_LTLIBRARIES contains the normalized name (lib<Nom_Module>Engine.la) of the library, LIB_SRC defines the name of source files, and VPATH defines the directories in which they can be found.
+- The path for the include files used has to be added to CPPFLAGS (SALOME.config.h, SALOME_Component_i.hxx and utilities.h are located in ${KERNEL_ROOT_DIR}/include/salome).
+- The HELLO class uses lib libraries (for Engines_Component_i) and libOptUtil (for PortableServer and Salome_Exception). Therefore, the name of these libraries and their path in LDFLAGS will be indicated. Other libraries are often useful, for example libsalomeDS if persistence is implemented, or libSalomeNS if the naming service is used.
+
+Controlling the component from Python (TUI mode)
+=====================================================
+When the module is compiled, the lib target of the Makefile in /idl provoked generation of a Python
+stub (stub at the customer end generated from the idl and providing an interface in the client language – in this case Python).
+Specifically, a HELLO_ORB python module containing a classe_objref_HELLO_Gen is created and used to call services of our
+C++ module from Python. To put this into application, we run SALOME in TUI mode::
+
+ runSalome --modules=HELLO -t --pinter --logger --killall
+
+We import the LifeCycle module from the Python window, and use its services to load our component into the FactoryServer C++ container::
>>> import LifeCycleCORBA
- >>> lcc = LifeCycleCORBA.LifeCycleCORBA(clt.orb)
+ >>> lcc = LifeCycleCORBA.LifeCycleCORBA()
+ >>> import salome
+ >>> salome.salome_init()
+ createNewStudy
+ []
+ extStudy_1 1
>>> import HELLO_ORB
>>> hello = lcc.FindOrLoadComponent("FactoryServer", "HELLO")
-L'import de HELLO_ORB est nécessaire avant l'appel de FindOrLoadComponent,
-pour permettre de retourner un objet typé (opération de "narrowing"). Sinon,
-l'objet retourné est générique de type Engines::Component. Vérifions que notre
-objet hello est correctement typé, et appelons le service makeBanner::
+HELLO_ORB has to be imported before FindOrLoadComponent is called, so that a typed object can be
+returned (“narrowing” operation). Otherwise, the returned object is generic of the
+Engines::EngineComponent type.
+Let us check that hello object is correctly typed, and we will call the hello service::
>>> print hello
<HELLO_ORB._objref_HELLO_Gen instance at 0x8274e94>
- >>> mybanner=hello.makeBanner("Nicolas")
- >>> print mybanner
- Hello, Nicolas
-
-Les commandes précédentes ont été regroupées dans la fonction test du script
-/bin/runSalome.py.
+ >>> status=hello.hello(salome.myStudy, "Nicolas")
+ >>> print status
+ OP_OK
+The previous commands were grouped in the test function of the /bin/runSalome.py script.
-Interface graphique
+Graphic interface
===================
-
Introduction
-------------
-
-Pour aller plus loin dans l'intégration de notre module, nous allons ajouter
-une interface graphique (développée en Qt), s'intégrant dans l'interface
-applicative de Salome (IAPP).
-On ne détaillera pas ici le fonctionnement de l'IAPP de Salome, mais pour
-résumer, l'IAPP gère une boucle d'évènements (clics souris, clavier, etc), et
-redirige après traitement ces évènements vers le module actif (le principe est
-qu'à un instant donné, *un* module est actif. Lorsqu'un module est activé, son
-IHM est chargée dynamiquement).
-Le programmeur de la GUI d'un module a donc à charge de définir les méthodes
-permettant de traiter correctement les évènements transmis. Parmi ces
-méthodes, citons les principales : OnGUIEvent(), OnMousePress(), OnMouseMove(),
-OnKeyPress(), DefinePopup(), CustomPopup().
-
-Choix des widgets
------------------
-
-Description xml
-```````````````
-La description des items de notre module se fait dans le fichier XML
-/ressources/HELLO_en.xml. Ce fichier est utilisé par l'IAPP pour charger
-dynamiquement l'IHM du module quand celle-ci est activée.
-Le principe est de définir par des balises les menus et boutons souhaités, et
-d'y associer des ID, qui seront récupérés par les fonctions gérant les
-évènemements IHM. Plusieures possibilités sont offertes:
-
-- ajout d'items à des menus déjà existant, auquel cas il faut reprendre les
- balises du menu pré-existant, et y ajouter les nouveaux items. Dans
- l'exemple qui suis, on ajoute le Menu **Hello** et l'item **MyNewItem** au
- menu File, dont l'ID vaut 1::
-
- <menu-item label-id="File" item-id="1" pos-id="">
- <submenu label-id="Hello" item-id="19" pos-id="8">
- <popup-item item-id="190" pos-id="" label-id="MyNewItem" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- </submenu>
- <endsubmenu />
- </menu-item>
-
-- Création de nouveaux menus. Pour le module HELLO, nous ajoutons un menu
- HELLO, avec un unique item de label "Get banner"::
-
- <menubar>
- <menu-item label-id="HELLO" item-id="90" pos-id="3">
- <popup-item item-id="901" label-id="Get banner" icon-id="" tooltip-id="Get HELLO banner" accel-id="" toggle-id="" execute-action=""/>
- </menu-item>
- </menubar>
-
-- Ajout d'un bouton dans la barre à boutons. Dans l'exemple suivant, nous
- créons un deuxième point d'entrée pour notre action "Get banner", sous forme
- d'un bouton associé au même ID "901". L'icône est spécifiée par la le champ
- icon-id, qui doit être un fichier graphique 20x20 pixels au format png::
-
- <toolbar label-id="HELLO">
- <toolbutton-item item-id="901" label-id="Get banner" icon-id="ExecHELLO.png"
- tooltip-id="Get HELLO banner" accel-id="" toggle-id="" execute-action=""/>
- </toolbar>
-
-Convention
-``````````
-A chaque menu ou item est associé un ID. Les numéros entre 1 et 40 sont
-réservés à l'IAPP. Les numéros d'ID suivent une certaine règle, quoique
-celle-ci ne soit pas obligatoire. Au menu "HELLO" est associé l'ID 90. Son
-unique item "Get banner" a l'ID 901. Un deuxième item aurait l'ID 902, et un
-sous item l'ID 9021.
-
-
-Implémentation de l'IHM
------------------------
-
-L'implémentation C++ de l'IHM est faite dans le répertoire /src/HELLOGUI.
-Le header HELLOGUI.h déclare de la classe HELLOGUI, et
-contient des directives Qt (Q_OBJECT). De ce fait, il doit être processé par
-le compilateur moc (Qt Meta Model Compiler). Pour cette raison, l'extension du
-fichier est .h et dans le Makefile nous ajoutons la cible::
-
- LIB_MOC = HELLOGUI.h
-
-Le fichier source HELLO.cxx contient la définition des fonctions membres, et
-le Makefile permet de construire une librairie libHELLOGUI (le nom est
-normalisé poour permettre le chargement dynamique : lib<NomModule>GUI.
-
-Gestion des évènements
-``````````````````````
-Pour l'IHM d'HELLO, nous définissons la fonction HELLOGUI::OnGUIEvent, qui
-sera appelé à chaque évènement. Cette fonction contient essentiellement une
-structure switch permettant de traiter l'ID reçu en argument::
-
- switch (theCommandID)
- {
- case 901:
- // Traitement de "Get banner"
- ...
- case 190:
- // Traitement de "MyNewItem"
- ...
- }
-
-Le traitement standard consiste à récupérer des données d'entrée (ici, le
-prénom via une fenêtre de dialogue QInputDialog::getText), à récupérer une
-poignée sur le composant CORBA interfacé afin d'appeler le service souhaité
-(ici, getBanner), et d'afficher le résultat obtenu ().
+----------------
+To go further with the integration of our module, we will add a graphic interface (developed in Qt) that is
+integrated into the SALOME application interface (IAPP). We will not describe operation of the SALOME IAPP herein,
+but in summary, the IAPP manages an event loop (mouse click, keyboard, etc.) and after processing these events
+redirects them towards the active module (the principle is that **a single** module is active at a given moment.
+When a module is activated, its Graphic User Interface is dynamically loaded).
+Therefore the programmer of a module GUI defines methods to process transmitted events correctly.
+The most important of these events are OnGUIEvent(), OnMousePress(), OnMouseMove(), OnKeyPress(), DefinePopup(), CustomPopup().
-Classes disponibles
-````````````````````
-Pour les dialogues avec l'utilisateur, il est possible d'utiliser n'importe
-quelle classe fournie par Qt (http://doc.trolltech.com/3.2/classes.html).
-Cependant, lorque c'eset possible, il est préférable d'utiliser les fonctions
-QAD (Qt Application Desktop), définies dans KERNEL_SRC/src/SALOMEGUI, qui
-encapsulent les fonctions Qt correspondantes et gèrent mieux les
-communications avec l'IAPP. Ainsi, dans HELLOGUI, nous utilisons la classe
-QAD_MessageBox en lieu et place de la classe Qt QMessageBox.
+Strictly speaking, the GUI library is optional for each SALOME module.
+In some cases it's enough to implement CORBA engine only. Then,
+the services of the module will be avaiable in a CORBA environment.
+The module can be loaded to the SALOME container and its services
+can be used in the SALOME supervision computation schemas, in Python
+scripts or/and in C++ implementation of other modules.
+A GUI library is necessary only if it is planned to access the module
+functionality from the SALOME GUI session via menu actions, dialog boxes
+and so on.
-Gestion du multi-linguisme
-``````````````````````````
-Qt fournit un outil d'aide au support du multi-linguisme. Celui-ci est
-repris dans salome. Le principe est simple : toutes les chaînes de caractères
-utilisées pour les labels des menus et les dialogues avec l'utilisateur
-sont encapsulés dans des appels à la fonction Qt tr() (pour translate), qui
-prend en argument un nom de label. Par exemple, pour demander à l'utilisateur
-de rentrer un prénom, nous utilisons la fonction getText, où les deux premiers
-arguments sont des labels encapsulés par tr()::
+- src/HELLOGUI/HELLOGUI.h
+- src/HELLOGUI/HELLOGUI.cxx
- myName = QInputDialog::getText( tr("QUE_HELLO_LABEL"), tr("QUE_HELLO_NAME"),
- QLineEdit::Normal, QString::null, &ok);
+These files provide the implementation of a GUI library of
+the HELLO module. In particular, these files specify menus, toolbars,
+dialog boxes and other such staff.
-Le nom des label est préfixé à titre indicatif par trois lettres et un underscore. Les codes
-suivants sont utilisés::
+- src/HELLOGUI/HELLO_msg_en.ts
+- src/HELLOGUI/HELLO_icons.ts
- - MEN_ : label menu
- - BUT_ : label bouton
- - TOT_ : aide tooltip
- - ERR_ : message d'erreur
- - WRN_ : message d'alerte
- - INF_ : message d'information
- - QUE_ : question
- - PRP_ : prompt dans la barre des status
+These files provide a description (internationalization) of GUI
+resources of the HELLO module. HELLO_msg_en.ts provides an English
+translation of the string resources used in a module (there can be also
+translation files for other languages, for instance French; these files
+are distinguished by the language suffix). HELLO_icons.ts
+defines images and icons resources used within the GUI library of
+HELLO module. Please refer to Qt linguist documentation for more
+details.
+- resources
-La traduction des labels encapsulés par tr() est faite pour différents
-langages cibles (par exemple français et anglais) dans des fichiers nommés "<nom_module>_msg_<langage>.po".
-<langage> correspond au code du langage, on a choisi **en** pour l'anglais et
-**fr** pour le français. Ce fichier doit contenir pour chaque clé sa
-traduction, par exemple::
+This optional directory usually contains different resources files
+required for the correct operation of SALOME module.
- msgid "HELLOGUI::INF_HELLO_BANNER"
- msgstr "HELLO Information"
+- resources/HELLO.png
+- resources/handshake.png
+- resources/goodbye.png
+- resources/testme.png
-Le squelette de ce fichier peut être généré par l'utilitaire Qt findtr::
+These are different module icon files. HELLO.png file provides main icon
+of HELLO module to be shown in the SALOME GUI desktop. Other files are
+the icons for the functions implemented by the module; they are used
+in the menus and toolbars.
- findtr HELLOGUI.cxx > HELLO_msg_en.po
-puis éditer le fichier HELLO_msg_en.po pour remplir les traductions.
-Ces fichiers sont ensuite compilés par l'utilitaire **msg2qm** pour générer
-des binaires *.qm*. Pour cela, il faut remplir la cible LIB_MOC dans le
-Makefile::
+- resources/HELLOCatalog.xml.in
- PO_FILES = HELLO_msg_en.po HELLO_msg_fr.po
+The XML description of the CORBA services provided by the HELLO
+module. This file is parsed by SALOME supervision module (YACS) to generate
+the list of service nodes to be used in the calculation schemas. The
+simplest way to create this file is to use Catalog Generator utility
+provided by the SALOME KERNEL module, that can automatically generate
+XML description file from the IDL file. In GUI, this utility is available
+via the Tools main menu.
-Pour l'utilisateur final, le choix du langage se fait au niveau de chaque
-module dans le fichier ressources/config, en utilisant la commande::
- langage=<langage>
-
-Règles syntaxiques de nommage
+Syntax naming rules
=============================
-
-Dans ce qui précède, nous avons utilisé un certain nombre de règles de
-nommage. Le présent chapitre se propose de faire le point sur ces règles.
-Celles-ci ne sont pas toutes obligatoires, mais simplifient la compréhension
-si on les suit!
-
-+-------------------+------------------+----------------+---------------------------------------+
-| Règle | Formalisme | Exemple HELLO | Commentaire |
-+===================+==================+================+=======================================+
-| Nom du module | <Module> | HELLO | C'est le nom qui figure dans le |
-| | | | catalogue des modules |
-+-------------------+------------------+----------------+---------------------------------------+
-| Base CVS | <Module> | EXAMPLES | Si la base cvs contient plusieurs |
-| | | | modules, on prend un autre nom |
-+-------------------+------------------+----------------+---------------------------------------+
-| Repertoire source | <Module>_SRC | HELLO1_SRC | L'indice 1 est utilisé car on prévoit |
-| | | | plusieurs version du module |
-+-------------------+------------------+----------------+---------------------------------------+
-| Fichier idl | <Module>_Gen.idl | HELLO_Gen.idl | |
-| | | | |
-+-------------------+------------------+----------------+---------------------------------------+
-| Nom du module | <Module>_ORB | HELLO_ORB | On évite d'utiliser le nom du module |
-| CORBA | | | (conflits) |
-+-------------------+------------------+----------------+---------------------------------------+
-| Nom de | <Module>_Gen | HELLO_Gen | La compilation de l'idl génère une |
-| l'interface CORBA | | | classe abstraite |
-| | | | POA_<Module>_ORB::<Module>_Gen |
-+-------------------+------------------+----------------+---------------------------------------+
-| fichier source | <Module>.cxx | HELLO.cxx | Dans le répertoire /src/<Module> |
-| | | | |
-+-------------------+------------------+----------------+---------------------------------------+
-| Classe | <Module> | HELLO | Cette classe hérite de |
-| d'implémentation | | | POA_HELLO_ORB::HELLO_Gen |
-+-------------------+------------------+----------------+---------------------------------------+
-| Fonction | <Module>_ | HELLO_Engine | Cette fonction est appelée par |
-| d'instanciation | Engine_factory | factory | le FactoryServer de Salome |
-+-------------------+------------------+----------------+---------------------------------------+
-| Catalogue des | <Module>Catalog | HELLOCatalog | Dans /ressources |
-| modules | .xml | .xml | |
-+-------------------+------------------+----------------+---------------------------------------+
-| Nom de la | lib<Module>Engine| libHELLOEngine | Dans le répertoire /src/<Module> |
-| librairie C++ | | | |
-+-------------------+------------------+----------------+---------------------------------------+
-| Librairie C++ | lib<Module>GUI | libHELLOGUI | Dans le répertoire /src/<Module>GUI |
-| de l'IHM | | | |
-+-------------------+------------------+----------------+---------------------------------------+
-| Variable | <Module>_ROOT_DIR| HELLO_ROOT_DIR | |
-| d'environnement | | | |
-+-------------------+------------------+----------------+---------------------------------------+
-| ... | ... | ... | ... |
-| | | | |
-+-------------------+------------------+----------------+---------------------------------------+
+A number of naming rules were used in the above description. This chapter gives more details about these rules.
+They are not all compulsory, but they make it easy to understand the program if they are respected!
+
+======================== ======================== ===================== =============================================================================
+ Rules Formalism HELLO example Comment
+======================== ======================== ===================== =============================================================================
+ Module name <Module> HELLO This is the name that appears in the modules catalog
+ CVS base <Module> EXAMPLES If the cvs base contains several modules, another name will be used.
+ Source directory <Module>_SRC HELLO1_SRC Index 1 is used because several versions of the module are provided.
+ Idl file <Module>_Gen.idl HELLO_Gen.idl
+ CORBA module name <Module>_ORB HELLO_ORB Avoid the use of the module name (conflicts)
+ CORBA interface name <Module>_Gen HELLO_Gen The idl compilation generates an abstract class POA_<Module>_ORB::<Module>_Gen
+ Source file <Module>.cxx HELLO.cxx In the /src/<Module> directory
+ Implementation class <Module> HELLO This class inherits from POA_HELLO_ORB::HELLO_Gen
+ Instantiation function <Module>_Engine_factory HELLO_Engine_factory This function is called by the SALOME Container
+ Modules catalog <Module>Catalog.xml HELLOCatalog.xml In /resources
+ C++ library name lib<Module>Engine HELLO-Engine In the /src/<Module> directory
+ GUI C++ name lib<Module>GUI libHELLOGUI In the /src/<Module>GUI directory
+ Environment variable <Module>_ROOT_DIR… HELLO_ROOT_DIR
+ ... ... ... ...
+======================== ======================== ===================== =============================================================================
-------------------
Let's consider a YACS schema containing Block, FOR loop and inline script nodes with data ports.
-The first step is to import the schema from YACS XML file. One of the ways for the user to do it is to click on the **Import schema** button on the :ref:`schema` and choose **YACS XML** item from the pull-down list. Let's open legendre7.xml from YACS_SRC/src/gui directory.
-
-After import operation, arrangement of the schema nodes and **Fit All** operation we have the following state of Salome 4.1 application.
+The first step is to import the schema from YACS XML file. One of the ways for the user to do it is to click on the **Import schema** button
+on the :ref:`schema`. Let's open legendre7.xml from YACS_SRC/src/yacsloader/samples directory.
+After import operation, click on the **Fit All** button of the 2D Viewer. We have the following state of SALOME application.
.. image:: images/functionality_list_98.jpg
**The result of legendre7.xml import**
-For more convenient view of a schema representation in 2D Viewer the user can rebuild schemas' links with help of **Rebuild links** command from :ref:`visualization`. The result will be the following.
+For more convenient view of a schema representation in 2D Viewer the user can arrange nodes and links with help of
+the **arrange nodes recursion** command of the **proc** node context menu.
+The result will be the following.
.. centered::
- **Representation of a schema after rebuild links operation**
+ **Representation of a schema after arrange nodes operation**
-To change input value of the schemas' node it is needed to select this node either in schema 2D Viewer or in the Tree View of a schema. And after that change input ports values with help of corresponding controls on the property page of the selected node. But in our case, if we want to execute a body of the **loopiter** node 5 times we have to change the **nsteps** output port value of **init**
-node from 3 to 5 with help of its property page, and press "Apply" button on the Input Panel schema 2D Viewer.
+To change input value of the schemas' node it is needed to select this node either in schema 2D Viewer or in the Tree View of a schema.
+And after that change input ports values with help of corresponding controls on the property page of the selected node.
+But in our case, if we want to execute a body of the **loopiter** node 5 times we have to change the **nsteps** output port value of **init**
+node from 3 to 5 with help of its property page (python editor), and press "Apply" button on the Input Panel schema 2D Viewer.
.. image:: images/functionality_list_100.jpg
:align: center
- :width: 38ex
.. centered::
**Property page of init node**
-In order to execute this schema the user should to create a run of the schema with help of **New execution** button on the :ref:`execution_toolbar`. After a new schema run has been created, schema run Tree View is constructed and schema run object is published in the Object Browser.
+In order to execute this schema the user should create a run of the schema with help of **New execution** button on
+the :ref:`execution_toolbar`. After a new schema run has been created, schema run Tree View is constructed and schema run object
+is published in the Object Browser.
+
+.. image:: images/functionality_list_101a.jpg
+ :align: center
.. image:: images/functionality_list_101.jpg
:align: center
- :width: 40ex
.. centered::
**Object Browser content and schema run Tree View**
-If the user selects schema object in the Tree View, Input Panel with schema property page will occur. Errors raised during create execution process is shown in the 'Error Log' list box of schema property page in the run mode. In our case there are no errors occured during creation of execution.
+If the user selects schema object in the Tree View, Input Panel with schema property page is presented. Errors raised during
+create execution process are shown in the list box of schema property page in the run mode. In our case there is
+no error.
.. image:: images/functionality_list_102.jpg
:align: center
- :width: 38ex
.. centered::
**Schema property page in the run mode**
-To use :ref:`breakpoints run mode <breakpoints_mode>` it is sufficient for the user to set breakpoints on nodes using check boxes in the run Tree View. Let's set one breakpoint - on **iter2** node inside **deuxIter** block.
+To use :ref:`breakpoints run mode <breakpoints_mode>` it is sufficient for the user to set breakpoints on nodes using check boxes
+in the run Tree View. Let's set one breakpoint - on **iter2** node inside **deuxIter** block.
.. image:: images/functionality_list_103.jpg
:align: center
- :width: 40ex
.. centered::
**Set breakpoint in run Tree View**
-Start execution with help of **Start/Resume** button on :ref:`execution_toolbar` in run mode. Execution is paused on the **iter2** node inside **deuxIter** block. The run Tree View displays states of nodes.
+Start execution with help of **Start/Resume** button on :ref:`execution_toolbar` in run mode. Execution is paused on the **iter2** node
+inside **deuxIter** block. The run Tree View displays states of nodes.
.. image:: images/functionality_list_104.jpg
:align: center
- :width: 41ex
.. centered::
**Run Tree View of paused schema**
-Now try to save execution state of the schema by clicking :ref:`save_restore_execution_state` button on :ref:`execution_toolbar`. Save the current state of execution into /tmp/legendre7_exec_state.xml file.
+Now try to save execution state of the schema by clicking the **Save State** command in the YACS main menu or the **Save State** button in
+the :ref:`execution_toolbar`. Save the current state of execution into /tmp/legendre7_exec_state.xml file.
.. image:: images/functionality_list_105.jpg
:align: center
- :width: 60ex
.. centered::
**Save the current execution state of legendre7.xml schema**
-Now execute the schema using **Start/Resume** button until the execution of the schema is finished, making sure that **loopiter** node had been executed 5 times.
+Now execute the schema using **Start/Resume** button until the execution of the schema is finished, making sure that **loopiter** node
+had been executed 5 times.
.. image:: images/functionality_list_106.jpg
:align: center
- :width: 40ex
.. centered::
**Execution of legendre7.xml schema is finished**
-The user can check values of output ports with help of 'Output ports' table on the propertty page of a node.
+The user can check values of output ports with help of 'Output ports' table on the property page of a node.
.. image:: images/functionality_list_107.jpg
:align: center
- :width: 64ex
-
.. centered::
**Output port values of iter_1 node**
-Let's try to load saved execution state of legendre7.xml schema. After this operation run Tree View should be in the same state as at the moment of saving execution state.
+
+Go back to edit mode and let's try to load saved execution state of legendre7.xml schema with the **Load previous state** button
+in the :ref:`execution_toolbar`. After this operation run Tree View should be in the same state as at the moment of saving execution state.
.. image:: images/functionality_list_108.jpg
:align: center
- :width: 40ex
.. centered::
**Run Tree View after load execution state**
-Continue execution of the schema from the saved state and check values of output ports when execution is finished. They should be the same as obtained earlier during the first execution.
-
+Continue execution of the schema from the saved state and check values of output ports when execution is finished. They should be
+the same as obtained earlier during the first execution.
+++ /dev/null
-/*! \page engine Engine
-
-\section toc Table of contents
-
- - \ref engine_intro
- - \ref basic_concepts
- - \ref engine_executor
-
-\section engine_intro Introduction
-
-The engine is in charge to :
-
- - edit
- - check consistency
- - schedule
- - execute
-
-graphs of execution independently from the context (\ref engine_runtime) the graph is destined to run.
-
-\section basic_concepts Basic concepts in YACS::ENGINE
-
-The understanding of YACS::ENGINE implementation needs a good knowledge of the basic concepts (\subpage engineConcepts):
-
-- \ref engine_node
-- \ref engine_ports
-- \ref engine_links
-- \ref engine_types
-- \ref engine_context
-- \ref engine_placement
-
-\section engine_executor Executor
-
-The executor is in charge to run a graph of execution. Executor is
-TOTALLY independant from Node and Port implementation. The only APIs seen
-from YACS::ENGINE::Executor are YACS::ENGINE::Scheduler and YACS::ENGINE::Task. So, from the Executor point of
-view, a graph of execution is a scheduler scheduling tasks.
-The responsability of executor is to launch, concurrently or not, tasks selected by
-scheduler and to
-notify to tasks and to the scheduler what it is going to do and what happend
-during tasks' execution.
-There are several launching mode in executor. Here the common modes :
-- launch tasks until scheduler declares that all is finished.
-- launch tasks until a given task is upon to be launched.
-- launch tasks one by one. (step by step)
-
-*/
-
-/*! \page engineConcepts Engine concepts
-
-\section engine_node Nodes
-
-A Node is an entity performing a treatement or job using ingoing data
-given in ingoing \ref engine_ports
-provided by other Nodes or 'manually' set and providing itself data in outgoing \ref engine_ports. A
-Node is eventually put into a scope (see \ref engine_hierarchy) in
-which all it's links with other Nodes can be performed. The most
-little scope if it exists of a Node is referenced by YACS::ENGINE::Node::_father.
-
-There are 2 types of Node :
-
-- Node performing a job NOT splitable into several simpler jobs. In
-this case job is called task. This type of Node can be dowcasted into
-YACS::ENGINE::ElementaryNode. That's why, YACS::ENGINE::ElementaryNode inherits from YACS::ENGINE::Task
-and YACS::ENGINE::Node.
-
-- Node performing job splittable into several jobs. This type of
-Node can be dowcasted into YACS::ENGINE::ComposedNode. As this specific
-type of Node is composed of several Nodes it is in charge of schedule
-them. That's why, YACS::ENGINE::ComposedNode inherits from YACS::ENGINE::Scheduler and YACS::ENGINE::Node.
-
-\subsection engine_hierarchy Node hierarchy
-
-- It has been called hierarchy 'MyHierarchy' of a node 'MyNode' the biggest tree which each node of
-this tree is an instance of ComposedNode and each leaves are instances
-of ElementaryNode. One of these leaves/nodes is 'MyNode'. The links between leaves/nodes nodes/nodes are
-established by the fatherness stored in each instance of Node
-(YACS::ENGINE::Node::_father).
-- The unique node of
-this tree only linked down (with _father equal to 0) and having no
-father is called \b RootNode of 'MyHierarchy'.
-- A \b level \b of \b hierarchy of 'MyHierarchy' is the set of node/leaf having
-the same father.
-- A \b scope of a the hierarchy 'MyHierarchy' is a subtree of
-'MyHierarchy' tree. A scope is represented by the head node of this subtree.
-
-\section engine_ports Ports
-
-A YACS::ENGINE::Port is an interface of a YACS::ENGINE::Node from the
-outside. Ports can have several semantics.
-
-- \ref engine_control_flow
-- \ref engine_data_flow
-- \ref engine_data_stream
-
-\subsection engine_control_flow Control flow
-
-The semantic of this port is to put constraints on the sequence of
-execution to synchronize nodes, on THE SAME
-LEVEL of \ref engine_hierarchy between them.
-
-\subsection engine_data_flow Data
-
-Instances of these type of ports inherits from YACS::ENGINE::DataFlowPort.
-This type of port represents data exchange protocol performed
-physically by implementation in \ref
-engine_runtime at the end of execution an instance of an ElementaryNode. So contrary to \ref
-engine_data_stream, this data exchange protocol is performed following
-\ref engine_control_flow synchronization.
-
-\subsection engine_data_stream DataStream
-
-Instances of these type of ports inherits from
-YACS::ENGINE::DataStreamPort. DataStream ports are ports for data
-exchange NOT synchronized by \ref engine_control_flow.
-
-\section engine_links Links
-
-A link in YACS does not lie onto a C++ object. A link exists in
-YACS::ENGINE model only like
-a sorted pair (YACS::ENGINE::OutPort, YACS::ENGINE::InPort).
-The semantic of elements of pair can be different (\ref engine_data_flow
-or \ref engine_data_stream ). This pair
-is stored in both YACS::ENGINE::OutPort side and YACS::ENGINE::InPort
-side. The storage YACS::ENGINE::InPort side is only for
-edition facility (Node, Port suppression), but at execution time, only links info
-YACS::ENGINE::OutPort side is used.
-
-A link is constructed by the call to
-YACS::ENGINE::ComposedNode::edAddLink method. The instance of
-YACS::ENGINE::ComposedNode on which apply edAddLink must be so that
-inPort and OutPort are both in its scope.
-
-\subsection engine_links_cpx Point of view of engine at run time
-
-It is important to note that a link defined by edAddLink method can
-hide potentially a serie of elementary links. This is particalary true
-when 2 dataflow ports inside 2 different loops are linked each other ;
-in this case \ref engine_data_flow / \ref engine_data_stream
-conversion is requested.
-An elementary link is a link in which the semantic of both elements in pair
-are exactly the same. So the complexity linked to modification of port
-semantic in a link is managed at edition time so that at run time only
-elementary links are seen.
-
-\section engine_types Data types
-
-YACS::ENGINE::TypeCode instances are destined to describe data
- structure of a piece of data expected by an instance of
- YACS::ENGINE::DataPort (for type checking at edition : static type
- checking) or held in YACS::ENGINE::Any instance (for type checking
- at execution : dynamic type checking).
-All data exchanged by calculation nodes through input and output
-data ports have a type.
-
-The type is given by the port that holds the data by calling
-its YACS::ENGINE::DataPort::edGetType() method.
-All types are instances of the YACS::ENGINE::TypeCode class or one of
-its derived classes : YACS::ENGINE::TypeCode_objref, YACS::ENGINE::TypeCode_seq.
-
-\section engine_context Context
-
-A context is a set of libraries allowing directly or indirectly from C++ calls to :
-
- - launch on demand, a computation or a job specified uniquely by a
- string of character and a list of inputs and giving in return a
- list of data in specific data formats.
- - handle data of these specific data formats. Each of these data
- formats overlapping all or part of data overlapped by YACS::ENGINE::Any.
-
-Concretely it takes form of set of :
-
- - middlewares (CORBA, SOAP, MPI, PVM ...)
- - high level langage interpreters (as python, perl, shell) callable
- from C++.
- - plateform (<a href="http://www.salome-platform.org">SALOME</a>)
-
-\section engine_runtime Runtime
-
-A runtime exists in a given \ref engine_context. A runtime is in charge to :
-
-- treat physically the basic execution of elementary tasks in a given context
-- the traduction of data in this context.
-- to perform the physical deployment of the execution.
-
-The runtime simply appears in engine as an interface
-that a concrete runtime must implement to be piloted by YACS::ENGINE.
-
-\section engine_placement Deployment
-
-This the 3rd point of view of a graph of execution, after
-links between nodes (see \ref engine_links ) and hierarchy in nodes (
-\ref engine_hierarchy ).
-Deployment concept is accessible in interface YACS::ENGINE::Task with the
-concept of YACS::ENGINE::ComponentInstance and YACS::ENGINE::Container.
-
-- a ComponentInstance is a common environement \b shared by a set of
- YACS::ENGINE::ServiceNode. Typically ServiceNodes sharing a same
- ComponentInstance are sharing a same state taking different form
- (environement var and/or memory space and/or internal variables...).
-- a Container is a common process \b shared by several ComponentInstances.
-
-A task needed to be placed or deployed
-at runtime has to return something different from 0 on call to
-YACS::ENGINE::Task::getComponent(). YACS::ENGINE::ServiceNode is the
-abstract class representing all executable nodes needed to be
-deployed.
-
-It's important to note that the placement (or deployment) of
-ServiceNodes can be performed at different moment at runtime.
-
-- Either it is performed once for all YACS::ENGINE::Container before
-launching any task. This placement startegy is \b absolutly required for batch
-mode. This condition is checked by the YACS::ENGINE::Executor by
-calling YACS::ENGINE::Scheduler::isPlacementPredictableB4Run.
-- or it is done at the last moment on call of
-YACS::ENGINE::Load when execution of a ServiceNode is required by
-Executor on running process.
-
-
-
-*/
.. _secetapes:
-Etapes dans l'intégration d'un composant
+Steps in integration of a component
========================================
+Concept of component
+-----------------------
+There are many definitions of the software component. We will use the following for SALOME:
+**Component**
-Notion de composant
--------------------
+ A component is a software entity with the following characteristics and behaviours:
-Il existe de nombreuses définitions de composant logiciel. Dans le cadre de
-Salomé, nous retiendrons la suivante :
+ - **physically identifiable**: in other words a component is not a concept or a design “pattern”, but
+ is a “genuine” portion of binary code and can be directly executed (or interpreted) after deployment;
+ - **composable**: it must be possible to create a relation between a component and other components: it has
+ one (or several) interfaces that interact like communication channels between components;
+ - one component **interacts with the other components** only through its interface(s);
+ - a component is **integrated into an application architecture** by a deployment process.
+ This deployment process is dependent on the hardware and software platform sub-tending the architecture
-**Composant**
-
- Un composant est une entité logicielle possédant les caractéristiques et les comportements suivants :
-
- * **physiquement identifiable**, c'est à dire qu'un composant n'est pas un
- concept ou un "pattern" de conception mais un "vrai" morceau de code binaire,
- directement exécutable - ou interprétable - après déploiement ;
-
- * **composable**, un composant doit pouvoir être mis en relation avec d'autres
- composants : il expose une - ou plusieurs - interfaces qui agissent comme des
- canaux de communication entre composants ;
-
- * un composant **interagit avec les autres composants** uniquement au travers
- de sa (ou ses) interface(s);
-
- * un composant est **intégré dans une architecture** applicative par un
- processus de déploiement. Ce processus de déploiement est dépendant de la
- plate-forme matérielle et logicielle sous-tendant l'architecture ;
-
-
-Schéma général
+General scheme
--------------
.. index:: single: architecture
-L'intégration d'un code de calcul sous forme de composant dans l'architecture
-PAL se fait en plusieurs étapes, schématisées par la figure suivante :
+A calculation code is integrated in the form of a component in the PAL architecture in several steps, diagrammatically
+represented by the following figure:
.. image:: images/phases.png
- :width: 56ex
:align: center
-.. centered:: Phases d'intégration d'un composant
-
+.. centered:: Component integration phases
-Pour utiliser le composant :
+To use the component:
-* localement, via un interpréteur python, il faudra écrire une interface python
- via des outils tels que **SWIG** [SWIG]_ ou **Boost** [BOOST]_;
-
-* à distance, à travers CORBA [CORBA]_, il faudra écrire une interface CORBA
- (fichier IDL, classe d'implémentation), Salomé offrant des services permettant
- de simplifier l'utilisation de CORBA;
-
-* via l'application SALOME, il faudra spécialiser les fichiers écrits au point
- précédent et spécifier les fichiers de ressources éventuels (graphiques et
- autres).
-
-
-Code de départ
+- locally through a python interpretor, a python interface needs to be written using tools such as **SWIG** [SWIG]_ or **Boost** [BOOST]_;
+- remotely through CORBA [CORBA]_, a CORBA interface (IDL file, implementation class) must be written. SALOME offers services that can simplify the use of CORBA;
+- through the SALOME application, files written according to the above point must be specialised and resource files, if any, must be specified (graphic and other).
+
+Initial code
--------------
+Specific cases may differ widely, depending on the form of the code to be integrated in SALOME.
+In this document, we will consider situations in which we initially have:
-Les cas de figures peuvent être très différents les uns des autres suivant la
-forme du code à intégrer dans Salomé. Dans ce document, on envisagera les
-situations dans lesquelles on dispose au départ :
-
-* d'un code sous forme d'un ou plusieurs exécutables séparés.
-
-* d'un ensemble de fonctions f77/routines C/classes C++.
-
-* d'un ensemble de scripts python, qui contrôlent éventuellement des routines,
- fonctions ou classes f77/C/C++.
-
+- a code in the form of one or several separate executables
+- a set of f77 functions / C routines / C++ classes
+- a set of python scripts that can control f77 / C / C++ routines, functions or classes.
.. _compinterne:
-Mise sous forme d'objet interne
--------------------------------
-
-.. index:: single: objet interne
+Putting the initial code in the form of an internal object
+----------------------------------------------------------------
-Pour simplifier les phases suivantes, un premier travail consiste à présenter
-le code de départ sous la forme d'un objet C++ ou python.
+.. index:: single: internal object
+A first work to simplify the next phases consists of presenting the initial code in the form of a C++ or python object.
-**objet interne**
+**internal object**
- Cet objet C++ ou python sera appelé "**objet interne**" dans ce document. Il sera composé de
- méthodes et d'attributs, publics et privés (suivant la terminologie standard
- orientée-objet) :
+ This C++ or python object will be called "**internal object**" in this document. It will be composed of
+ public or private methods and attributes (according to the standard object oriented terminology):
- .. index:: single: méthodes; publiques
+ .. index:: single: methods; public
- * les **méthodes publiques** sont les services de calcul que l'on veut rendre
- disponibles aux utilisateurs de l'objet interne,
+ - **public methods** are calculation services that are to be made available to users of the internal object
- .. index:: single: attributs; publics
+ .. index:: single: attributes; public
- * les **attributs publics** sont les données de l'objet que l'on veut rendre
- disponibles aux utilisateurs de cet objet interne,
+ - **public attributes** are object data that are to be made available to users of this internal object
.. index::
- single: méthodes; privées
- single: attributs; privés
+ single: methods; private
+ single: attributes; private
- * les **méthodes et attributs privés** sont les services et les données de
- l'objet interne que l'on ne veut pas rendre disponibles aux utilisateurs de
- l'objet interne (et qui ne seront visibles que des autres méthodes de ce même
- objet).
+ - **private methods and attributes** are services and data of the internal object that are not to be
+ made available to users of the internal object (and that will only be visible from other methods of this object).
.. index::
- single: etat interne
+ single: internal state
single: common fortran77
- single: variables globales
-
-**Remarques**
-
- 1. La distinction "public/privé" n'a pas réellement de sens en python où tout
- est public par défaut.
+ single: global variables
- 2. L'objet interne est vu de l'utilisateur comme un ensemble de méthodes
- publiques (par ex. services de calcul) qui délèguent les requêtes au code
- encapsulé (voir figures :ref:`Objet interne englobant le code initial <figinterne1>`,
- :ref:`Objet interne communicant avec un code extérieur <figinterne2>` et
- :ref:`Code initial déjà sous forme d'objet interne <figinterne3>`.
+**Notes**
- 3. Entre 2 appels successifs de services de l'objet, les attributs gardent la
- "mémoire de l'objet" (l'état interne, par exemple : common fortran77 ou
- variables globales [#f1]_ C/C++).
+1. The “public/private” distinction is not really meaningful in Python, in which everything is public by default.
+2. The user sees the internal object as a set of public methods (e.g. calculation services) that delegate requests to the encapsulated code (see the :ref:`Internal object embedding the initial code <figinterne1>`, :ref:`Internal object communicating with an external code <figinterne2>` and :ref:`Initial code already in the form of an internal object <figinterne3>` figures)
+3. Attributes keep the “object memory” between 2 successive calls to object services (internal state, for example fortran77 common or C/C++ global variables [#f1]_).
.. index::
- single: service; de l'objet interne
- single: etat interne
+ single: service; internal object
+ single: internal state
-La première partie du travail, une étape de conception, consiste à définir les
-services et l'état interne de cet objet. En particulier :
+The first part of the work, a design step, consists of defining the services and the internal state of this object. In particular:
-* choisir les différents services,
+- choose the different services,
+- for each service, define input and output data,
+- for each input and each output, define the data type and also the associated pre-conditions and post-conditions,
+- define the internal state of the object and possibly its value before and after the call to the different services.
-* pour chaque service, définir les données d'entrée et de sortie
+Depending on the case, the internal object may:
-* pour chaque entrée et chaque sortie, définir le type de la donnée et
- éventuellement les pré-conditions et post-conditions associées,
-
-* définir l'état interne de l'objet et éventuellement sa valeur avant et après
- l'appel aux différents services.
-
-Suivant les cas, l'objet interne pourra :
-
-* "englober" le code initial, c'est le cas d'un code initial sous forme d'une
- librairie ou dont le code source est disponible;
+* “encompass” the initial code, this is the case for an initial code in the form of a library or for which the source code is available;
.. _figinterne1:
.. image:: images/objint1.png
- :width: 40ex
:align: center
- .. centered:: Objet interne englobant le code initial
+ .. centered:: Internal object encompassing the initial code
-* communiquer avec le code source via le système d'exploitation (Unix, Windows,
- etc), c'est le cas d'un code initial sous la forme d'un exécutable binaire;
+* communicate with the source code through the operating system (Unix, Windows, etc.), this is the case for an initial code
+ in the form of a binary executable:
.. _figinterne2:
.. image:: images/objint2.png
- :width: 58ex
:align: center
- .. centered:: Objet interne communicant avec un code extérieur
+ .. centered:: Internal object communicating with an external code
- **Remarque**
- La communication avec le code extérieur binaire pourra se faire par fichiers, ou
- par la ligne de commandes, par exemple.
+ **Note**: The communication with the binary external code may be made through files, or for example through the command line.
-* dans le cas où le code initial est déjà sous la forme d'une classe python, il
- n'y a rien à faire.
+* if the initial code is already in the form of a python class, there is nothing to be done.
.. _figinterne3:
.. image:: images/objint3.png
- :width: 36ex
:align: center
- .. centered:: Code initial déjà sous forme d'objet interne
-
+ .. centered:: Initial code already in the form of an internal object
-
-Accès depuis un interpréteur python local
+Access from a local python interpreter
-----------------------------------------
-
-L'objet C++/python construit au paragraphe (:ref:`compinterne`)
-peut être enrobé dans un composant manipulé depuis un
-interpréteur python local, suivant la figure suivante.
+The C++/python object constructed in the (:ref:`compinterne`) section may be embedded in a component manipulated from a
+local python interpreter as shown on the following figure.
.. _python_local:
.. image:: images/accesLocal.png
- :width: 46ex
:align: center
-.. centered:: Accès depuis un interpréteur python local
+.. centered:: Access from a local python interpreter
-Suivant le type et l'implémentation de l'objet interne (C++ ou python), il
-faudra ou non fournir une interface. Des outils tels que **swig**
-ou **boost** permettent de simplifier cette tâche [#f2]_.
+It may or may not be necessary to provide an interface, depending on the type and implementation of the
+internal object (C++ or python). Tools such as **swig** and **boost** can simplify this task [#f2]_.
-
-Accès depuis CORBA
+Access from CORBA
------------------
+An interface has to be provided to enable a remote access to the component through CORBA, independently of the access from
+a local python interpreter. Operation of CORBA as a client-server is selected as shown in the figure
+:ref:`Access from CORBA <figaccescorba>`, which shows communication between a client and a server through CORBA.
+
+**CORBA server**
+ A server is an executable, for the purposes of this document and in the SALOME environment.
+ It is connected to a communication channel called a CORBA bus that transmits requests to it and to which
+ the server returns the results of these requests. A server can host several CORBA objects to which it delegates
+ execution of these requests. The CORBA client-server relation is specified by an interface file called the **IDL file**.
+ This represents a contract between the component and the clients that use the component.
-Indépendamment de l'accès depuis un interpréteur python local, il faut fournir
-une interface permettant un accès distant au composant via CORBA. Le
-fonctionnement de CORBA retenu est celui de client-serveur comme illustré par la
-figure :ref:`Accès depuis CORBA <figaccescorba>` où on représente la
-communication entre un client et un serveur via CORBA.
-
-**Serveur CORBA**
- Dans ce document et
- dans l'environnement Salomé, un serveur est un exécutable. Il est branché sur
- un canal de communication appelé bus CORBA qui lui transmet des requêtes et
- vers lequel le serveur renvoie les résultats de ces requêtes. Un serveur peut
- héberger plusieurs objets CORBA auxquels il délègue l'exécution des requêtes.
- La relation client-serveur CORBA est spécifiée par un fichier d'interface, dit
- **fichier IDL**. Celui-ci représente un contrat entre le composant et les
- clients qui utilisent le composant.
-
-Les composants dans ce mode de
-fonctionnement seront des objets CORBA. La relation serveur - composant sera
-précisée au paragraphe :ref:`contfab`.
-
-**Remarque**
- Le respect du fichier IDL par le
- client et le serveur conditionne la bonne exécution des requêtes. Pour cette
- raison, dans Salomé, les différents fichiers IDL sont rassemblés dans des
- répertoires vus par tous les clients et serveurs CORBA.
+In this operating mode, the components will be CORBA objects. The server – component relation will be specified
+in the :ref:`contfab` paragraph.
+
+**Note**: Requests cannot be executed correctly unless the client and the server respect the IDL file. This is why
+in SALOME, the different IDL files are assembled in directories seen by all CORBA clients and servers.
.. _figaccescorba:
.. image:: images/accesCorba.png
- :width: 58ex
:align: center
-.. centered:: Accès depuis CORBA
-
-L'intégrateur de code doit fournir une partie de l'interface serveur du
-composant, sous forme d'une classe dite d'**implémentation** (démarche
-similaire en python et C++, côté serveur). Le reste de l'interface est générée
-à partir du fichier d'interface IDL. Du côté des clients, par contre,
-l'interface CORBA est presque entièrement générée (particulièrement si le
-client est écrit en python).
-
+.. centered:: Access from CORBA
-Particularités de l'environnement Salomé
-----------------------------------------
+The code integrator must provide a part of the component server interface in the form of a so-called **implementation**
+class (similar procedure in python and C++, at the server end). The remainder of the interface is generated
+from the IDL interface file. On the other hand, the CORBA interface is generated almost entirely at the client
+end (particularly if the client is written in Python).
-
-Services de Salomé
+Specific features of the SALOME environment
+------------------------------------------------
+SALOME services
^^^^^^^^^^^^^^^^^^
+SALOME provides a number of services above CORBA that simplify its use. For example:
-Salomé fournit un certain nombre de services au-dessus de CORBA permettant de
-simplifier son utilisation. On citera:
-
-
-L'accès au service de nommage:
+Access to the naming service
""""""""""""""""""""""""""""""
-
-Une IOR (référence CORBA) est un pointeur distant, dont le maniement n'est pas
-toujours aisé. Un exemple d'IOR est le suivant : ::
+An IOR (CORBA reference) is a remote pointer, which is not always easy to handle. The following is an example of an IOR::
IOR:010000003400000049444c3a6174742e636f6d2f4174744e6f74696669
636174696f6e2f4576656e744368616e6e656c466163746f72793a312e3000
010000000000000026000000010100000a0000003132372e302e302e310006
800e000000fedd112a3d000007ef0000000001
-dont la signification est : ::
+which has the following meaning::
Type ID: "IDL:att.com/AttNotification/EventChannelFactory:1.0"
Profiles: 1. IIOP 1.0 127.0.0.1 32774 POA(root) 0x00000001 (4 bytes)
-Le service de nommage CORBA permet à l'utilisateur d'associer un nom à cette
-IOR. Salomé fournit une classe (C++ ou python) permettant d'utiliser de
-façon simple cette association.
+With the CORBA naming service, the user can associate a name with this IOR. SALOME provides a class (C++ or python)
+that makes it easy to use this association.
-
-Des structures de données standardisées :
+Standard data structures
"""""""""""""""""""""""""""""""""""""""""
+In addition to CORBA data structures (scalar, character strings, vectors, generic structures) SALOME offers typical structures
+to represent meshes, support (parts of meshes) and value fields on these supports. These structures are grouped under the
+name of the *data exchange model (MED)* [MED]_.
-En plus des structures de données CORBA (scalaires, chaînes de caractères,
-vecteurs, structures génériques), Salomé propose des structures type pour
-représenter les maillages, support (parties de maillages) et champs de valeurs
-sur ces supports. Ces structures sont regroupées sous le nom de *modèle
-d'échange de données (MED)* [MED]_.
-
-
-L'utilisation du service de notification CORBA :
-""""""""""""""""""""""""""""""""""""""""""""""""
-
-CORBA propose un service d'envoi de notification (avancement du calcul par
-exemple). Salomé propose des fonctionnalités pour simplifier l'envoi de
-messages par les composants et un canal d'événements où les clients peuvent
-suivre l'évolution des calculs par les composants.
-
-
-Un service d'enregistrement (registry) :
-""""""""""""""""""""""""""""""""""""""""
-
-Ce service permet à l'utilisateur de connaître l'ensemble des composants
-auxquels il peut envoyer des requêtes.
-
-
-Un catalogue de modules:
-""""""""""""""""""""""""
-
-Ce service permet à l'utilisateur et à Salomé de connaître les différents
-composants disponibles avec les différents services disponibles ainsi que
-l'emplacement de ces composants sur les disques des différentes machines.
-
-
-Un service de gestion d'études :
-""""""""""""""""""""""""""""""""
-
-Ce service permet de regrouper (au choix de l'utilisateur) différentes
-informations utilisées ou produites par les composants lors d'une session
-d'utilisation de Salomé.
+Use of the CORBA notification service
+"""""""""""""""""""""""""""""""""""""""""
+CORBA offers a service to send notifications (for example calculation progress). SALOME offers features to make it easier
+for components to send messages and an events channel in which customers can monitor how component calculations are progressing.
+A registry service
+"""""""""""""""""""""""""""""""""""""""""
+With this service, the customer can know all components to which he can send requests.
-Des composants de base :
-""""""""""""""""""""""""
+A modules catalog
+"""""""""""""""""""""""""""""""""""""""""
+With this service, the User and SALOME can know the different available components with the different available
+services and the location of these components on disks on different machines.
-Salomé est une plateforme générique de liaison CAO-Calcul qui propose des
-composants de CAO, de maillage et de visualisation et de supervision des
-calculs.
+A study management service
+"""""""""""""""""""""""""""""""""""""""""
+This service groups different items of information used or produced by components during a SALOME usage session (at the choice of the user).
+Basic components
+"""""""""""""""""""""""""""""""""""""""""
+SALOME is a generic CAD-Calculation platform that offers CAD, mesh, display and calculation supervision components.
.. _contfab:
-Conteneurs et fabriques
-^^^^^^^^^^^^^^^^^^^^^^^
-
+Containers and factories
+^^^^^^^^^^^^^^^^^^^^^^^^^^
.. index::
single: container
- single: factory
- single: conteneur
- single: fabrique
-
-Salomé est basé sur la notion de conteneur (ou "container") et de fabrique (ou
-"factory").
+ single: factory
-**Conteneur-fabrique**
- Un **conteneur** est un serveur CORBA chargé d'héberger des
- composants CORBA et est responsable du cycle de vie (chargement/déchargement,
- initialisation) de ces composants. Chaque conteneur contient un objet CORBA
- particulier appelé **fabrique**, auquel on peut envoyer des requêtes pour
- charger ou décharger des composants.
+SALOME is based on the concept of containers and factories.
-Exemple
+**Container-factory**
+ A **container** is a CORBA server that hosts CORBA components and is responsible for the life cycle (load/unload, initialize)
+ of these components. Each container contains a particular CORBA object called a factory, to which requests to load or unload
+ components can be sent.
+
+Example
"""""""
+Assume that a client would like to use the services of a component named A in a container named B on a machine named M.
+The different arrows on the :ref:`Container, factory and components<figconteneur>` figure show the operation:
-Supposons qu'un client désire utiliser des services d'un composant nommé A dans
-un conteneur nommé B sur une machine nommée M. Les différentes flèches sur
-la figure :ref:`Conteneur, fabrique et composants<figconteneur>` illustrent le fonctionnement :
-
-#. Le client s'adresse au noyau Salomé (sur sa machine) et lui demande de lui
- fournir une référence sur le composant A dans un conteneur B sur une machine M.
- Le noyau cherche si un tel composant est déjà référencé.
-
-#. Si le composant n'est pas référencé, le noyau Salomé cherche le conteneur B
- sur la machine M. Si le conteneur n'existe pas, Salomé le crée. Le noyau
- récupère une référence sur l'objet "fabrique" dans le conteneur B.
-
-#. L'objet "fabrique" du conteneur B charge dynamiquement la librairie
- contenant le code du composant A à partir du disque.
-
-#. Le composant est créé et enregistré dans le noyau Salomé, qui renvoie au
- client la référence sur le composant.
-
-#. Le client peut émettre des requêtes au composant.
+#. The client contacts the SALOME kernel (on its machine) and asks the kernel to provide it with a reference to component A in a container B on a machine M. The kernel searches if such a component is already referenced.
+#. If the component is not referenced, the SALOME kernel searches for container B on machine M. If the container does not exist, SALOME creates it. The kernel retrieves a reference on the “factory” object in container B.
+#. The “factory” object in container B dynamically loads the library containing the code of component A starting from the disk.
+#. The component is created and registered in the SALOME kernel, that forwards the reference on the component to the client.
+#. The client can issue requests to the component.
-**Remarque**
- Quand une référence sur un composant a été obtenue par le processus précédent
- (points 1 à 4), le client peut la conserver et émettre des requêtes au composant
- pendant toute la suite du calcul sans repasser par les mêmes étapes. Dans la
- version actuelle de Salomé, on n'a pas encore mis en place une procédure de
- reprise automatique si le composant (ou le conteneur qui le contient) tombe.
+**Note**: When a reference on a component has been obtained using the previous process (items 1 to 4), the client can keep it
+and issue requests to the component throughout the remainder of the calculation without repeating the same steps.
+In the current version of SALOME, an automatic restart procedure has not yet been set up for the case in which the component
+(or the container that contains it) is lost.
.. _figconteneur:
.. image:: images/conteneur.png
- :width: 50ex
:align: center
-.. centered:: Conteneur, fabrique et composants
+.. centered:: Container, factory and components
.. rubric:: Footnotes
-.. [#f1] On donnera à l'annexe 1, quelques indications sur le traitement des common fortran et variables globales C++.
+.. [#f1] Appendix 1 contains some information about processing of Fortran common and C++ global variables.
-.. [#f2] Au moment où est écrit ce document, l'outil retenu par Salomé est swig. Tant que ce choix n'est pas remis en cause, on ne conseille pas l'utilisation de boost pour l'intégration de composants dans Salomé (l'interopérabilité des deux outils n'ayant pas été testée).
+.. [#f2] At the time of writing this document, the tool selected by SALOME is swig. As long as the choice is not modified, it is not recommended that boost should be used to integrate components into SALOME (since interoperability of the two tools has not been tested).
.. _execpy:
-Exécution d'un schéma de calcul avec l'interface de programmation Python
+Execution of a calculation scheme with the Python programming interface
==========================================================================
-Il faut tout d'abord avoir un objet Python schéma de calcul que l'on appellera p.
-On l'obtient en utilisant la :ref:`schemapy`.
+The first step is to have a Python calculation scheme object that will be called p.
+It is obtained using :ref:`schemapy`.
-Si ce n'est pas déjà fait, il faut importer les modules YACS et initialiser YACS
-pour SALOME. Ensuite, il faut créer un objet Executor qui va exécuter le schéma de calcul.
+If it has not already been done, YACS modules have to be imported and YACS needs to be initialised
+for SALOME. An Executor object will then have to be created that will execute the calculation scheme.
-Création de l'objet Executor::
+Create the Executor object::
e = pilot.ExecutorSwig()
-Un schéma peut être exécuté selon deux modes :
- - le mode standard qui exécute en bloc le schéma en attendant la fin complète
- de l'exécution
- - le mode pas à pas qui permet d'exécuter partiellement le schéma et de faire
- des pauses et des reprises
+There are two modes by which a scheme may be executed:
-Exécution du schéma en mode standard
+- standard mode that executes the scheme in block, waiting until the execution is completely finished
+- step by step mode, to partially execute the scheme and make pauses and restarts.
+
+Executing the scheme in standard mode
----------------------------------------
-Pour ce type d'exécution, on utilise la méthode RunW de l'Executor. Cette méthode a trois arguments.
-Le premier est le schéma de calcul (ou même un noeud composé sous certaines conditions). Le deuxième
-indique le niveau de verbosité pour une exécution en mode debug (0 est le niveau sans debug, 1, 2 ou 3
-pour debug). Le troisième est un booléen qui vaut True si l'exécution part de zéro (tous les noeuds
-sont calculés) ou False si l'exécution part d'un état sauvegardé du schéma. Ces deux derniers arguments
-ont pour valeur par défaut 0 et True.
+The Executor RunW method is used for this type of execution. This method has three arguments.
+The first is the calculation scheme (or even a composite node under some conditions). The second indicates
+the verbosity for execution in debug mode (0 is the level without debug, 1, 2 or 3 for debug).
+The third is a boolean that is equal to True if execution starts from zero (all nodes are calculated) or False if
+execution starts from a backed up state of the scheme.
+The default values of the latter two arguments are equal to 0 and True.
-Exécution du schéma par l'objet Executor en partant de zéro, sans debug::
+Execution of the scheme by the Executor object starting from zero, without debug::
e.RunW(p)
if p.getEffectiveState() != pilot.DONE:
print p.getErrorReport()
sys.exit(1)
-Si l'exécution s'est bien déroulée, l'état du schéma obtenu par ``p.getEffectiveState()``
-vaut DONE. Si ce n'est pas le cas, le schéma est en erreur. Un compte-rendu d'erreurs (voir :ref:`errorreport`)
-est donné par ``p.getErrorReport()``.
+If the execution took place correctly, the state of the scheme obtained by ``p.getEffectiveState()`` is equal to DONE.
+If this is not the case, the scheme is in error. An error report (see :ref:`errorreport`) is given by ``p.getErrorReport()``.
-Dans tous les cas, il est ensuite possible de récupérer les valeurs contenues dans les ports
-d'entrée et de sortie.
+In all cases, the values contained in the input and output ports can then be retrieved.
-Sauvegarde de l'état d'un schéma
+Saving the state of a scheme
------------------------------------
-Suite à une exécution d'un schéma, il est possible de sauvegarder l'état du schéma dans un fichier
-XML pour un redémarrage ultérieur éventuel. Cette sauvegarde est réalisée en utilisant la méthode
-saveState du schéma de calcul. Elle prend un argument qui est le nom du fichier dans lequel
-sera sauvegardé l'état.
+The state of a scheme after it has been executed can be saved in an XML file for a later restart if required.
+This save is done using the saveState method for the calculation scheme. It uses an argument that is the name of
+the file in which the state will be saved.
-Voici comme se présente cet appel::
+This call is in the following format::
p.saveState("state.xml")
-Chargement de l'état d'un schéma
+Loading the state of a scheme
------------------------------------
-Il est possible d'initialiser un schéma de calcul avec un état sauvegardé dans un fichier. Le schéma
-de calcul doit bien entendu exister. Ensuite, il faut utiliser la fonction loadState du module loader.
-Elle prend deux arguments : le schéma de calcul et le nom du fichier contenant l'état sauvegardé.
+A calculation scheme can be initialised with a state saved in a file. Obviously, the calculation scheme must exist.
+Then, the loadState function of the loader module must be used. It takes two arguments: the calculation scheme and
+the name of the file containing the saved state.
-Par exemple, pour initialiser le schéma p avec l'état précédemment sauvegardé, on fera::
+For example, proceed as follows to initialise scheme p with the previously saved state::
import loader
loader.loadState(p,"state.xml")
-Cette initialisation n'est possible que si les structures du schéma et de l'état sauvegardé sont identiques.
+This initialisation is only possible if the structures of the scheme and the saved state are identical.
-Après initialisation, on démarre l'exécution en passant False en troisième argument de RunW::
+After initialisation, execution is started by transferring False as a third argument of RunW::
e.RunW(p,0,False)
-Exécution du schéma en mode pas à pas
-----------------------------------------
-Ce type d'exécution est pour des utilisateurs avancés car il nécessite l'utilisation de la programmation
-par thread en Python. Ne pas oublier d'importer le module threading::
+Executing the scheme in step by step mode
+-----------------------------------------------
+This type of execution is for advanced users because it requires the use of thread programming in Python.
+Do not forget to import the threading module::
import threading
-Si on veut utiliser le mode pas à pas ou mettre des breakpoints, il faut exécuter le schéma dans un thread
-séparé et réaliser les opérations de contrôle de l'exécution dans le thread principal.
+If it is required to use step by step mode or to add breakpoints, the scheme will have to be executed in a
+separate thread and execution control operations will have to be done in the main thread.
-Exécution avec arrêt sur breakpoints
+Execution with stop on breakpoints
+++++++++++++++++++++++++++++++++++++++
-Pour réaliser une exécution avec breakpoints, il faut définir la liste des breakpoints, mettre le mode
-d'exécution à exécution avec breakpoints puis de lancer l'exécution dans un thread séparé.
+Before execution with breakpoints is possible, it is necessary to define the list of breakpoints, to set
+execution mode to execution with breakpoints, and then to start execution in a separate thread.
+
+The list of breakpoints is defined by transferring a list of node names to the executor setListOfBreakPoints method.
+The mode is defined using the executor setExecMode method with a parameter equal to 2.
+Possible values are:
-La liste des breakpoints est définie en passant une liste de noms de noeud à la méthode setListOfBreakPoints
-de l'exécuteur.
-Le mode est défini en utilisant la méthode setExecMode de l'exécuteur avec un paramètre de valeur 2.
-Les valeurs possibles sont :
-
-- 0, pour un mode d'exécution standard (mode CONTINUE)
-- 1, pour un mode d'exécution avec pause à chaque pas d'exécution (mode STEPBYSTEP)
-- 2, pour un mode d'exécution avec breakpoints (mode STOPBEFORENODES)
+- 0, for standard execution mode (CONTINUOUS mode)
+- 1, for execution mode with pause at each execution step (STEPBYSTEP mode)
+- 2, for execution mode with breakpoints (STOPBEFORENODES mode).
-Le lancement de l'exécution se fait avec la méthode RunB de l'exécuteur à la place de RunW pour une exécution
-standard. Les trois arguments sont les mêmes :
+Execution is started using the executor RunB method instead of RunW for a standard execution.
+The three arguments are the same:
-- le schéma de calcul
-- le niveau d'affichage (0,1,2,3)
-- exécution de zéro (True, False)
+- the calculation scheme
+- the display level (0,1,2,3)
+- execution start from zero (True, False)
-Par exemple, pour s'arrêter avant le noeud "node1", on écrira::
+For example, the following will be written to stop before node “node1”::
e.setListOfBreakPoints(['node1'])
e.setExecMode(2)
mythread=threading.Thread(target=e.RunB, args=(p,1))
mythread.start()
-Il est possible de visualiser l'état des noeuds du schéma en appelant la méthode
-displayDot pendant une pause::
-
+The state of nodes in the scheme can be displayed by calling the displayDot method during a pause::
+
e.displayDot(p)
-Ensuite, il faut attendre que l'exécution passe en pause : une exécution passe en pause
-quand toutes les taches possibles avant l'exécution du noeud "node1" sont terminées.
-On utilise la méthode waitPause pour faire cette attente. Ensuite on arrête l'exécution
-par appel de la méthode stopExecution et on libère le thread. Il est conseillé de faire
-une petite attente avant de faire l'attente de la pause.
-Au total, on ajoutera la séquence suivante::
+It is then necessary to wait until the execution changes to pause: an execution changes to pause when
+all possible tasks before execution of node “node1” are terminated. The waitPause method is used to
+control this wait. The next step will be to stop execution by calling the stopExecution method and the
+thread will then be released. It is recommended that there should be a short wait before waiting for the pause.
+In total, the following sequence will be added::
time.sleep(0.1)
e.waitPause()
e.stopExecution()
mythread.join()
-Arrêt sur breakpoint suivi d'une reprise jusqu'à la fin du schéma
-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Pour reprendre une exécution après un arrêt sur breakpoint, il suffit de passer en mode
-CONTINUE et de relancer l'exécution en appelant la méthode resumeCurrentBreakPoint.
-L'attente de la fin de l'exécution du schéma est réalisée par appel de waitPause.
+A stop on breakpoint followed by resuming until the end of the scheme
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+After a stop on breakpoint, an execution is resumed by changing to CONTINUE mode and then restarting
+the execution by calling the resumeCurrentBreakPoint method.
+The wait for the end of scheme execution is controlled by calling waitPause.
-La séquence d'appel pour reprise sur breakpoint est la suivante::
+The call sequence to resume on breakpoint is as follows::
e.setExecMode(0)
e.resumeCurrentBreakPoint()
e.waitPause()
mythread.join()
-Exécution en mode pas à pas
-+++++++++++++++++++++++++++++
-Lors d'une exécution en mode pas à pas, l'exécuteur de schéma de calcul se met en pause
-à chaque pas d'exécution. Un pas d'exécution correspond à l'exécution d'un groupe de noeuds
-de calcul. Ce groupe peut contenir plus d'un noeud de calcul si le schéma de calcul
-présente des branches d'exécution parallèles.
-
-Pour passer dans ce mode on appelle la méthode setExecMode avec la valeur 1 (mode STEPBYSTEP) puis
-on lance l'exécuteur dans un thread comme précédemment. On attend la fin du pas d'exécution avec
-la méthode waitPause. On obtient la liste des noeuds du pas suivant avec la méthode getTasksToLoad.
-On définit la liste des noeuds à exécuter avec la méthode setStepsToExecute et on relance l'exécution
-avec la méthode resumeCurrentBreakPoint.
-Le tout doit être mis dans une boucle dont on sort à la fin de l'exécution quand il n'y a plus de noeuds
-à exécuter.
-
-La séquence complète se présente comme suit::
+Execution in step by step mode
++++++++++++++++++++++++++++++++++++++
+When executing in step by step mode, the calculation scheme executor pauses at each execution step.
+An execution step corresponds to execution of a group of calculation nodes. This group may contain
+more than one calculation node if the calculation scheme contains parallel execution branches.
+
+This mode is selected by calling the setExecMode method using the value 1 (STEPBYSTEP mode), and the executor
+is then started in a thread in the same way as above. The waitPause method is used to wait until the end of
+the execution step. The list of nodes in the next step is obtained using the getTasksToLoad method.
+The list of nodes to be executed is defined using the setStepsToExecute method and the execution is
+resumed using the resumeCurrentBreakPoint method.
+Everything must be placed in a loop that is exited at the end of the execution when there are no longer any nodes to be executed.
+
+The complete sequence is as follows::
e.setExecMode(1)
mythread=threading.Thread(target=e.RunB, args=(p,0))
-In the frames of one YACS GUI session YACS module allows the user to operate with several study documents (one per desktop). Each study may contain some schemas, but only one YACS engine instance exists per study.
+In the frames of one YACS GUI session, YACS module allows the user to operate with several study documents (one per desktop). Each study
+may contain some schemas, but only one YACS engine instance exists per study.
.. _execute_schema:
Execute a schema
----------------
-The user can execute a schema in different modes. Each of these modes can be chosen from :ref:`execute` of the YACS GUI in schema run mode. They are
+The user can execute a schema in different modes. Each of these modes can be chosen from :ref:`yacs_menu` of the YACS GUI in schema run mode. They are
-It's worth mentioning that for breakpoints mode it is suitable to use nodes' check boxes in the schema Tree View for run mode in order to set a breakpoint on the certain node.
+It's worth mentioning that for breakpoints mode it is suitable to use nodes' check boxes in the schema Tree View for run mode in order
+to set a breakpoint on a node.
-**Stop on error** option from :ref:`execute` finishes execution of a schema if any error occurs. It's useful if a schema has some parallel chains of nodes which can be executed simultaneously, and the user wants to break execution process of the whole schema if only one of chains raise an error.
+**Stop on error** option from :ref:`execution_toolbar` or from YACS main menu :ref:`yacs_menu` finishes execution of a schema if any error occurs.
+It's useful if a schema has some parallel chains of nodes which can be executed simultaneously, and the user wants to break execution process
+of the whole schema if only one of chains raise an error.
.. _start_resume:
-In order to start/resume execution of a schema it is needed to choose **Start/Resume** item from :ref:`execute` or click corresponding button on :ref:`execution_toolbar`. **Resume** command resumes schemas' execution, if it was paused earlier.
+In order to start/resume execution of a schema it is needed to choose **Start/Resume execution** item from YACS main menu :ref:`yacs_menu` or click
+corresponding button on :ref:`execution_toolbar`. This same command resumes schemas' execution, if it was paused earlier.
.. _pause_abort_reset:
-The user can pause execution of a schema with help of **Pause** item from :ref:`execute` or corresponding button on :ref:`execution_toolbar`. By analogy to **Pause** operation **Abort** and **Reset** commands can be activated either from Execute menu or Execution toolbar. **Abort** command kills execution of a schema, and
-**Reset** command resets nodes statuses and ports values to the initial ones as its were before the execution process.
+The user can pause execution of a schema with help of **Suspend execution** item from YACS main menu :ref:`yacs_menu` or corresponding button
+on :ref:`execution_toolbar`. By analogy, **Abort execution** and **Restart execution** commands can be activated either from YACS
+main menu or Execution toolbar. **Abort execution** command kills execution of a schema, and
+**Restart execution** command restart execution after having reset nodes terminated with error to initial state.
-In the frames of YACS GUI a preliminary step of checking schemas' validity before create a schema run is implemented. The user is informed by the system about all problems detected by this operation.
+In the frames of YACS GUI a preliminary step of checking schemas' validity before creating a schema run is performed. The user is
+informed by the system about all problems detected by this operation.
.. image:: images/functionality_list_79.jpg
:align: center
-
.. centered::
**An example result of checking schemas' validity before create a schema run**
-If a preliminary check is successfully done, schema run is created and then the user can start its execution in the chosen mode. Schema run is exported to an XML file and passed to YACS CORBA engine and executed there. YACS CORBA engine is also given a study ID.
+If a preliminary check is successfully done, schema run is created and then the user can start its execution in the chosen mode. Schema run
+is exported to an XML file and passed to YACS CORBA engine and executed there. YACS CORBA engine is also given a study ID.
For visual representation of execution state the following means are provided by YACS module.
-+ **State of a node** - each state has its own color code at any moment of the execution. During the execution the background color of the nodes' status bar is changed according to its execution status. In the YACS module for SALOME 4.1 this color code is predefined. Color codes from existing Supervisor GUI are reused where possible. But in the further versions of YACS module the user will have
- the possibility to specify it in the user preferences (see :ref:`set_user_preferences` section).
-
-
-+ **Values of ports** are shown during the execution process either on ports inside nodes' presentation or on nodes' property page in run mode.
-
++ **State of a node** - each state has its own color code at any moment of the execution. During the execution the background color of
+ the nodes' status is changed according to its execution status. In the YACS module for SALOME this color code is predefined.
+ The user has the possibility to specify it in the user preferences (see :ref:`set_user_preferences` section).
-+ For each node, a **progress indicator** is shown that informs the user about the time spent on execution of the node and approximate execution percentage of the job. This information is shown on both presentation of a node and its property page in run mode too.
++ **Values of ports** are shown during the execution process either on ports inside Tree view or on nodes' property page.
-
-
-More than that, schema Tree View in run mode shows information about the current execution state of the whole schema and the current execution state of each node.
+More than that, schema Tree View in run mode shows information about the current execution state of the whole schema and the current
+execution state of each node.
.. image:: images/functionality_list_80.jpg
:align: center
- :width: 46ex
.. centered::
**The state of run Tree View during schemas' execution**
.. image:: images/functionality_list_81.jpg
:align: center
- :width: 43ex
.. centered::
.. image:: images/functionality_list_82.jpg
:align: center
- :width: 53ex
-
.. centered::
**Inline node property page in run mode**
-The user can get a detailed information about errors (if any) occured during the execution process from "Error Log" list view on the schema run property page.
+The user can get a detailed information about errors (if any) occured during the execution process from list box on the schema run property page.
+
+The user can get errors on one node by using the **Node Error Details** command from its context menu.
+
+.. image:: images/functionality_list_82a.jpg
+ :align: center
+
+.. centered::
+ **Error Details in an Inline node (zero division error)**
+
+The **Node Error Report** command from the context menu gives the same information plus the status of the node.
+
+For SALOME nodes, the **Node Container Log** command shows the associated container log as the node is executed in a remote process (container).
+
+Lastly, the **YACS container log** command from the schema context menu shows the log of the YACS server where the user can find information
+to solve problems encountered during the execution.
+
+.. image:: images/functionality_list_82b.jpg
+ :align: center
+
+.. centered::
+ **YACS container log**
.. _save_restore_execution_state:
Save/Restore execution state
----------------------------
-If the current study contains an executable schema and the schema is in paused or stopped state, the user can save the current execution state of the schema for its further usage.
+If the current study contains an executable schema and the schema is in paused or stopped state, the user can save the current execution
+state of the schema for its further usage.
-The user can save an execution state of the schema by choosing the **Save execution state ...** command from the :ref:`execute` or from the :ref:`execution_toolbar`. As a result of this operation, the dialog box similar to the standard SALOME GUI "Save file" dialog box is shown by YACS module. The user should select an XML file to
-save schemas execution state into and the current execution state of a schema is saved into the selected XML file.
+The user can save an execution state of the schema by choosing the **Save State** command from the YACS main menu :ref:`yacs_menu` or from
+the :ref:`execution_toolbar`. As a result of this operation, the dialog box similar to the standard SALOME GUI "Save file" dialog box
+is shown by YACS module. The user should select an XML file to save schemas execution state into and the current execution state of the
+schema is saved into the selected XML file.
Here is an example of XML file structure storing the current state of schemas' execution.
XML file contains states of all schema nodes and the state of the whole schema.
-If during saving the execution state into the XML file the problems with access rights or free space on a disk drive occur, YACS module cancels saving of the execution state and shows an error message.
+If during saving the execution state into the XML file, problems with access rights or free space on a disk drive occur, YACS module
+cancels saving of the execution state and shows an error message.
+
+To continue the execution later from saved state the user can restore execution state for the selected schema from an XML file with
+help from the :ref:`execution_toolbar`.
-To continue the execution later from saved state the user can restore execution state for the selected schema from an XML file with help of **Load execution state ...** command from the :ref:`execute`, from the :ref:`execution_toolbar` or from schema context popup menu in the Object Bowser.
+By default the **Save State** and **Load execution state** commands are applicable to the active schema.
-By default the **Save execution state...** and **Load execution state ...** commands are applicable to the active schema. But if there is any selected schema in the Object Browser, it is used.
+.. _shutdown:
+
+Schema shutdown
+--------------------
+In GUI, shutdown must be explicitly requested by the user by using the context menu of the schema (**Shutdown Proc** entry).
+
+.. image:: images/functionality_list_82c.jpg
+ :align: center
+
+The shutdown level can be changed in the schema property page with the shutdown level combobox.
+
+.. image:: images/functionality_list_64a.jpg
+ :align: center
.. _create_new_edition:
Create new edition
------------------
-In the run mode YACS GUI for SALOME 4.1 provides the user with the possibility to create a copy of executed schema in order to do some modifications in it. This functionality is avalable with help of **New edition** command from :ref:`execute` in run mode of a schema, from corresponding button on the :ref:`execution_toolbar` in
-the same mode or from the schema run context popup menu in the Object Browser.
+In the run mode YACS GUI for SALOME provides the user with the possibility to create a copy of executed schema in order to do some
+modifications in it. This functionality is avalable with help of **Edit Again** command from YACS main menu :ref:`yacs_menu` in run mode of
+a schema or from corresponding button on the :ref:`execution_toolbar` in the same mode.
-In such a case the user can done any modifications in the edition copy of the current schema run and after some corrections create a new run schema object corresponding to the modified version of the schema. It can be considered as a cyclic process of execution and correction of a schema.
+In such a case the user can done any modifications in the edition copy of the current schema run and after some corrections create a
+new run schema object corresponding to the modified version of the schema. It can be considered as a cyclic process of execution
+and correction of a schema.
.. _execxml:
-Exécution d'un schéma de calcul en mode console
+Executing a calculation scheme in console mode
========================================================
-Pour exécuter un schéma de calcul, au format XML, en mode console, il faut disposer d'une installation
-de SALOME bien configurée. Dans tout ce qui suit, on utilisera le mode d'exécution de SALOME
-à partir d'une `application SALOME <http://nepal.der.edf.fr/pub/SALOME_userguide/KERNEL4/doc/salome/gui/KERNEL/SALOME_Application.html>`_.
-
- 1. lancer SALOME : ./runAppli -t depuis le répertoire d'application, par exemple (on peut le faire de
- n'importe quel autre répertoire).
- 2. exécuter le superviseur YACS : ./runSession driver schema.xml
- 3. stopper SALOME : ./runSession shutdownSalome.py pour arrêter proprement ou ./runSession killSalome.py pour
- un arrêt brutal
-
-Il est possible de configurer une session d'exécution puis d'exécuter YACS et de stopper SALOME
-au sein de cette session en faisant :
-
- 2. initialiser la session : ./runSession
- 3. exécuter le superviseur YACS : driver schema.xml
- 4. stopper SALOME : shutdownSalome.py ou killSalome.py
- 5. sortir de la session : CTRL+D
-
-Le superviseur YACS en mode console (driver) accepte quelques options pour paramétrer
-son exécution::
-
- Usage: driver [OPTION...] graph.xml
- driver -- a SALOME YACS graph executor
-
- -d, --display=level Display dot files: 0=never to 3=very often
- -e, --dump-on-error[=file] Stop on first error and dump state
- -f, --dump-final[=file] dump final state
- -l, --load-state=file Load State from a previous partial execution
- -s, --stop-on-error Stop on first error
- -v, --verbose Produce verbose output
- -x, --save-xml-schema[=file] dump xml schema
- -?, --help Give this help list
- --usage Give a short usage message
- -V, --version Print program version
-
-Voici quelques utilisations typiques de driver.
-
-Exécution standard
+
+A well-configured SALOME installation is necessary to execute a calculation scheme in the XML format in console mode.
+SALOME execution mode from a SALOME application will be used in the remainder of this document.
+
+1. run SALOME: ./runAppli -t, for example from the application directory (it can be run from any other directory).
+2. execute the YACS supervisor: ./runSession driver schema.xml
+3. stop SALOME: ./runSession shutdownSalome.py for a clean stop or ./runSession killSalome.py for an immediate stop.
+
+Steps 2 and 3 can be done from inside a SALOME session. YACS can be executed and SALOME can be stopped within this session as follows:
+
+1. initialise the session: /.runSession
+2. execute the YACS supervisor: driver schema.xml
+3. stop SALOME: shutdownSalome.py or killSalome.py
+4. exit from the session: CTRL+D
+
+The YACS supervisor in console (driver) mode accepts a few options to set parameters for its execution::
+
+ Usage: driver [OPTION...] graph.xml
+ driver -- a SALOME YACS graph executor
+
+ -d, --display=level Display dot files: 0=never to 3=very often
+ (default 0)
+ -e, --dump-on-error[=file] Stop on first error and dump state
+ -f, --dump-final[=file] dump final state
+ -l, --load-state=file Load State from a previous partial execution
+ -r, --reset=level Reset the schema before execution: 0=nothing,
+ 1=reset error nodes to ready state (default 0)
+ -s, --stop-on-error Stop on first error
+ -t, --shutdown=level Shutdown the schema: 0=no shutdown to 3=full
+ shutdown (default 1)
+ -v, --verbose Produce verbose output
+ -x, --save-xml-schema[=file] dump xml schema
+ -?, --help Give this help list
+ --usage Give a short usage message
+ -V, --version Print program version
+
+The following gives a few typical uses of the driver.
+
+Standard execution
--------------------
-Lors d'une exécution standard, le superviseur lit le fichier XML qui décrit le schéma,
-l'exécute et produit un compte-rendu d'erreurs (voir :ref:`errorreport`) s'il y a lieu::
+During a standard execution, the supervisor reads the XML file that describes the scheme, executes it and then produces
+an error report (see :ref:`errorreport`) if necessary::
driver schema.xml
-
-Exécution avec affichage des états des noeuds pendant l'exécution
+
+Execution displaying states of nodes during execution
----------------------------------------------------------------------
::
driver --display=1 schema.xml
+
-Exécution avec sauvegarde de l'état final du schéma
----------------------------------------------------------
+Execution saving the final state of the scheme
+----------------------------------------------------------------------
::
driver --dump-final=mystate.xml schema.xml
-Exécution avec chargement de l'état initial du schéma
----------------------------------------------------------
+Execution loading the initial state of the scheme
+----------------------------------------------------------------------
::
driver --load-state=mystate.xml schema.xml
+.. _xml_shutdown:
+
+How to configure schema shutdown
+---------------------------------------------
+No shutdown::
+
+ driver --shutdown=0 schema.xml
+
+Full shutdown::
+
+ driver --shutdown=3 schema.xml
+
+Restart a schema with reset of nodes in error
+----------------------------------------------------------------------
+::
+
+ driver --reset=1 --load-state=mystate.xml schema.xml
+
+How to manage several SALOME sessions
+----------------------------------------------------------------------
+When you need to launch several SALOME session to execute several schemas in parallel, you have to
+store the SALOME session number to be able to shutdown or kill one of the sessions but not all of them.
+The session number can be stored in a file by using the --ns-port-log argument of the runAppli command.
+
+Here is an example with 2 SALOME sessions:
+
+1. Launch first SALOME session with execution of a schema::
+
+ <appli>/runAppli -t --ns-port-log=session1.log
+ <appli>/runSession waitContainers.py FactoryServer
+ <appli>/runSession driver schema1.xml
+
+2. Launch second SALOME session with execution of another schema::
+
+ <appli>/runAppli -t --ns-port-log=session2.log
+ <appli>/runSession waitContainers.py FactoryServer
+ <appli>/runSession driver schema2.xml
+
+3. Shutdown first session::
+
+ <appli>/runSession -p `cat session1.log` shutdownSalome.py
+
+4. Kill second session::
+
+ <appli>/bin/salome/killSalomeWithPort.py `cat session2.log`
+
+
- subroutine addvec(C,A,B,n)\r
- integer i,n\r
- double precision A(n), B(n), C(n)\r
-C\r
- do i=1, n\r
- C(i) = A(i) + B(i)\r
- enddo\r
-C\r
- return\r
- end\r
+ subroutine addvec(C,A,B,n)
+ integer i,n
+ double precision A(n), B(n), C(n)
+C
+ do i=1, n
+ C(i) = A(i) + B(i)
+ enddo
+C
+ return
+ end
-#include "alglin.hxx"\r
-\r
-extern "C" {\r
- double * valloc(long n);\r
- void vfree(double *x);\r
- void addvec_(double *C, double *A, double *B, long *n);\r
- double prdscl_(double *A, double *B, long *n);\r
-}\r
-\r
-void alglin::addvec(vecteur *C, vecteur *A, vecteur *B) {\r
- long n = A->n();\r
- addvec_(C->x(), A->x(), B->x(), &n);\r
-}\r
-\r
-double alglin::prdscl(vecteur *A, vecteur *B) {\r
- long n = A->n();\r
- return prdscl_(A->x(), B->x(), &n);\r
-}\r
-\r
-vecteur * alglin::create_vector(long n) {\r
- return new vecteur(n);\r
-}\r
-\r
-void alglin::destroy_vector(vecteur *V) {\r
- delete V;\r
-}\r
+#include "alglin.hxx"
+
+extern "C" {
+ double * valloc(long n);
+ void vfree(double *x);
+ void addvec_(double *C, double *A, double *B, long *n);
+ double prdscl_(double *A, double *B, long *n);
+}
+
+void alglin::addvec(vecteur *C, vecteur *A, vecteur *B) {
+ long n = A->n();
+ addvec_(C->x(), A->x(), B->x(), &n);
+}
+
+double alglin::prdscl(vecteur *A, vecteur *B) {
+ long n = A->n();
+ return prdscl_(A->x(), B->x(), &n);
+}
+
+vecteur * alglin::create_vector(long n) {
+ return new vecteur(n);
+}
+
+void alglin::destroy_vector(vecteur *V) {
+ delete V;
+}
-#include "vecteur.hxx"\r
-\r
-class alglin {\r
-\r
-public:\r
- void addvec(vecteur *C, vecteur *A, vecteur *B);\r
- double prdscl(vecteur *A, vecteur *B);\r
- vecteur * create_vector(long n);\r
- void destroy_vector(vecteur *V);\r
-\r
-};\r
-\r
+#include "vecteur.hxx"
+
+class alglin {
+
+public:
+ void addvec(vecteur *C, vecteur *A, vecteur *B);
+ double prdscl(vecteur *A, vecteur *B);
+ vecteur * create_vector(long n);
+ void destroy_vector(vecteur *V);
+
+};
+
- alglin CompInterne;\r
-\r
- long n = 5;\r
- vecteur *A = CompInterne.create_vector(n);\r
- vecteur *B = CompInterne.create_vector(n);\r
- vecteur *C = CompInterne.create_vector(n);\r
-\r
-// ...\r
-\r
- CompInterne.addvec(C, A, B);\r
- cout << CompInterne.prdscl(A, B) << endl;\r
-\r
+ alglin CompInterne;
+
+ long n = 5;
+ vecteur *A = CompInterne.create_vector(n);
+ vecteur *B = CompInterne.create_vector(n);
+ vecteur *C = CompInterne.create_vector(n);
+
+// ...
+
+ CompInterne.addvec(C, A, B);
+ cout << CompInterne.prdscl(A, B) << endl;
+
-#include "vecteur.hxx"\r
-\r
-vecteur::vecteur(long n)\r
-{\r
- xx = new double[n];\r
- nn = n;\r
-}\r
-\r
-vecteur::~vecteur()\r
-{\r
- delete [] xx;\r
-}\r
-\r
+#include "vecteur.hxx"
+
+vecteur::vecteur(long n)
+{
+ xx = new double[n];
+ nn = n;
+}
+
+vecteur::~vecteur()
+{
+ delete [] xx;
+}
+
-class vecteur {\r
-\r
-public:\r
- vecteur(long n);\r
- ~vecteur();\r
-\r
- double * x() { return xx; };\r
- long n() { return nn; };\r
-\r
-private:\r
- double *xx;\r
- long nn;\r
-};\r
+class vecteur {
+
+public:
+ vecteur(long n);
+ ~vecteur();
+
+ double * x() { return xx; };
+ long n() { return nn; };
+
+private:
+ double *xx;
+ long nn;
+};
- double precision function prdscl(A,B,n)\r
- integer i,n\r
- double precision A(n), B(n), S\r
-C\r
- S = 0.0D0\r
- do i=1, n\r
- S = S + A(i) * B(i)\r
- enddo\r
-C\r
- prdscl = S\r
- return\r
- end\r
+ double precision function prdscl(A,B,n)
+ integer i,n
+ double precision A(n), B(n), S
+C
+ S = 0.0D0
+ do i=1, n
+ S = S + A(i) * B(i)
+ enddo
+C
+ prdscl = S
+ return
+ end
-#include "SALOME_Component.idl"\r
-\r
-module Solveur {\r
-\r
- struct Bord {\r
- string X;\r
- string Y;\r
- long n;\r
- };\r
- typedef sequence<Bord> seqBords;\r
-\r
- interface FreeFemComponent : Engines::Component \r
-{\r
- \r
- void Bords(in seqBords B);\r
- void Flux(in string u1, in string u2);\r
-\r
- void Convection(in string cond_init, in double dt, in long n);\r
-\r
- };\r
-\r
-};\r
+#include "SALOME_Component.idl"
+
+module Solveur {
+
+ struct Bord {
+ string X;
+ string Y;
+ long n;
+ };
+ typedef sequence<Bord> seqBords;
+
+ interface FreeFemComponent : Engines::EngineComponent
+{
+
+ void Bords(in seqBords B);
+ void Flux(in string u1, in string u2);
+
+ void Convection(in string cond_init, in double dt, in long n);
+
+ };
+
+};
-from SALOME_ComponentPy import *\r
-\r
-import FreeFem\r
-\r
-class FreeFemComponent(Engines__POA.FreeFemComponent,\r
- SALOME_ComponentPy_i):\r
-\r
- def __init__(self, orb, poa, this, containerName,\r
- instanceName, interfaceName):\r
- SALOME_ComponentPy_i.__init__(self, orb, poa, this, containerName,\r
- instanceName, interfaceName, 0)\r
- self.F = FreeFem.FreeFem();\r
-\r
- def Bords(self, b):\r
- self.F.Bords(b);\r
-\r
- def Flux(self, u1, u2):\r
- self.F.Flux(u1, u2);\r
-\r
- def Convection(self, cond_init, dt, n):\r
- self.F.Convection(cond_init, dt, n)\r
-\r
+from SALOME_ComponentPy import *
+
+import FreeFem
+
+class FreeFemComponent(Engines__POA.FreeFemComponent,
+ SALOME_ComponentPy_i):
+
+ def __init__(self, orb, poa, this, containerName,
+ instanceName, interfaceName):
+ SALOME_ComponentPy_i.__init__(self, orb, poa, this, containerName,
+ instanceName, interfaceName, 0)
+ self.F = FreeFem.FreeFem();
+
+ def Bords(self, b):
+ self.F.Bords(b);
+
+ def Flux(self, u1, u2):
+ self.F.Flux(u1, u2);
+
+ def Convection(self, cond_init, dt, n):
+ self.F.Convection(cond_init, dt, n)
+
- subroutine setcom(b)\r
- real b\r
-C\r
- real a\r
- common / C / a\r
-C\r
- a = b\r
-C\r
- return\r
- end\r
-\r
- subroutine getcom(b)\r
- real b\r
-C\r
- real a\r
- common / C / a\r
-C\r
- b = a\r
-C\r
- return\r
- end\r
+ subroutine setcom(b)
+ real b
+C
+ real a
+ common / C / a
+C
+ a = b
+C
+ return
+ end
+
+ subroutine getcom(b)
+ real b
+C
+ real a
+ common / C / a
+C
+ b = a
+C
+ return
+ end
-\r
-extern "C" float f1(float *);\r
-extern "C" float f2(float *);\r
-extern "C" void setcom(float *);\r
-extern "C" void getcom(float *);\r
-\r
-class f {\r
-\r
-public:\r
-\r
- f() {\r
- float y = 1.0;\r
- setcom(&y);\r
- }\r
-\r
- void setCommon(float x) {\r
- setcom(&x);\r
- }\r
-\r
- float getCommon() {\r
- float x;\r
- getcom(&x);\r
- return x;\r
- }\r
-\r
- float f1(float x) {\r
- return ::f1(&x);\r
- }\r
-\r
- float f2(float x) {\r
- return ::f2(&x);\r
- }\r
-};\r
+
+extern "C" float f1(float *);
+extern "C" float f2(float *);
+extern "C" void setcom(float *);
+extern "C" void getcom(float *);
+
+class f {
+
+public:
+
+ f() {
+ float y = 1.0;
+ setcom(&y);
+ }
+
+ void setCommon(float x) {
+ setcom(&x);
+ }
+
+ float getCommon() {
+ float x;
+ getcom(&x);
+ return x;
+ }
+
+ float f1(float x) {
+ return ::f1(&x);
+ }
+
+ float f2(float x) {
+ return ::f2(&x);
+ }
+};
- real function f1(x)\r
- real x\r
-C\r
- real a\r
- common / C / a\r
-C\r
- f1 = x / a\r
- return\r
- end\r
+ real function f1(x)
+ real x
+C
+ real a
+ common / C / a
+C
+ f1 = x / a
+ return
+ end
- real function f2(x)\r
- real x\r
-C\r
- real a\r
- common / C / a\r
-C\r
- f2 = x * a\r
- return\r
- end\r
+ real function f2(x)
+ real x
+C
+ real a
+ common / C / a
+C
+ f2 = x * a
+ return
+ end
-%module modf\r
-\r
-%{\r
-#include "f.hxx"\r
-%}\r
-\r
-class f {\r
-\r
-public:\r
-\r
- void setCommon(float x);\r
- float getCommon();\r
- float f1(float x);\r
- float f2(float x);\r
-};\r
+%module modf
+
+%{
+#include "f.hxx"
+%}
+
+class f {
+
+public:
+
+ void setCommon(float x);
+ float getCommon();
+ float f1(float x);
+ float f2(float x);
+};
->>> import modf\r
->>> f = modf.f();\r
->>> f.init(3.0)\r
->>> print f.f1(1)\r
-0.333333343267\r
->>> print f.f2(1)\r
-3.0\r
->>> print f.f1(f.f2(1))\r
-1.0\r
+>>> import modf
+>>> f = modf.f();
+>>> f.init(3.0)
+>>> print f.f1(1)
+0.333333343267
+>>> print f.f2(1)
+3.0
+>>> print f.f1(f.f2(1))
+1.0
-extern "C" float f1(float *);\r
-extern "C" void setcom(float *);\r
-extern "C" void getcom(float *);\r
-\r
-class f {\r
-\r
-public:\r
-\r
- f() {\r
- float y = 1.0;\r
- setcom(&y);\r
- }\r
- void setCommon(float x) {\r
- setcom(&x);\r
- }\r
- float getCommon() {\r
- float x;\r
- getcom(&x);\r
- return x;\r
- }\r
- float f1(float x) {\r
- return ::f1(&x);\r
- }\r
-};\r
+extern "C" float f1(float *);
+extern "C" void setcom(float *);
+extern "C" void getcom(float *);
+
+class f {
+
+public:
+
+ f() {
+ float y = 1.0;
+ setcom(&y);
+ }
+ void setCommon(float x) {
+ setcom(&x);
+ }
+ float getCommon() {
+ float x;
+ getcom(&x);
+ return x;
+ }
+ float f1(float x) {
+ return ::f1(&x);
+ }
+};
-\r
-extern "C" float f2(float *);\r
-extern "C" void setcom(float *);\r
-extern "C" void getcom(float *);\r
-\r
-class f {\r
-\r
-public:\r
-\r
- f() {\r
- float y = 1.0;\r
- setcom(&y);\r
- }\r
- void setCommon(float x) {\r
- setcom(&x);\r
- }\r
- float getCommon() {\r
- float x;\r
- getcom(&x);\r
- return x;\r
- }\r
- float f2(float x) {\r
- return ::f2(&x);\r
- }\r
-};\r
+
+extern "C" float f2(float *);
+extern "C" void setcom(float *);
+extern "C" void getcom(float *);
+
+class f {
+
+public:
+
+ f() {
+ float y = 1.0;
+ setcom(&y);
+ }
+ void setCommon(float x) {
+ setcom(&x);
+ }
+ float getCommon() {
+ float x;
+ getcom(&x);
+ return x;
+ }
+ float f2(float x) {
+ return ::f2(&x);
+ }
+};
-%module modf1\r
-\r
-%{\r
-#include "f1.hxx"\r
-%}\r
-\r
-class f {\r
-\r
-public:\r
-\r
- f();\r
- float f1(float x);\r
- void setCommon(float x);\r
- float getCommon();\r
-};\r
+%module modf1
+
+%{
+#include "f1.hxx"
+%}
+
+class f {
+
+public:
+
+ f();
+ float f1(float x);
+ void setCommon(float x);
+ float getCommon();
+};
-%module modf2\r
-\r
-%{\r
-#include "f2.hxx"\r
-%}\r
-\r
-class f {\r
-\r
-public:\r
-\r
- f();\r
- float f2(float x);\r
- void setCommon(float x);\r
- float getCommon();\r
-};\r
+%module modf2
+
+%{
+#include "f2.hxx"
+%}
+
+class f {
+
+public:
+
+ f();
+ float f2(float x);
+ void setCommon(float x);
+ float getCommon();
+};
->>> import modf1\r
->>> import modf2\r
->>> f1 = modf1.f();\r
->>> f2 = modf2.f();\r
->>> f1.setCommon(2.0)\r
->>> print "f1(1) = ", f1.f1(1.0)\r
-f1(1) = 0.5\r
->>> print "avant synchronisation"\r
-avant synchronisation\r
->>> print "f2(1) = ", f2.f2(1.0)\r
-f2(1) = 1.0\r
->>> f2.setCommon(f1.getCommon())\r
->>> print "après synchronisation"\r
-après synchronisation\r
->>> print "f2(1) = ", f2.f2(1.0)\r
-f2(1) = 2.0\r
+>>> import modf1
+>>> import modf2
+>>> f1 = modf1.f();
+>>> f2 = modf2.f();
+>>> f1.setCommon(2.0)
+>>> print "f1(1) = ", f1.f1(1.0)
+f1(1) = 0.5
+>>> print "avant synchronisation"
+avant synchronisation
+>>> print "f2(1) = ", f2.f2(1.0)
+f2(1) = 1.0
+>>> f2.setCommon(f1.getCommon())
+>>> print "après synchronisation"
+après synchronisation
+>>> print "f2(1) = ", f2.f2(1.0)
+f2(1) = 2.0
-import func\r
-\r
-class compo:\r
- def prdscl(self, x, y):\r
- return func.prdscl(x, y)\r
-\r
- def addvec(self, x, y):\r
- return func.addvec(x, y)\r
+import func
+
+class compo:
+ def prdscl(self, x, y):
+ return func.prdscl(x, y)
+
+ def addvec(self, x, y):
+ return func.addvec(x, y)
-import compo\r
-\r
-x = []\r
-y = []\r
-for i in range(5):\r
- ii = i+1\r
- x.append(2*ii)\r
- y.append(ii*ii)\r
-\r
-C = compo.compo()\r
- \r
-z = C.addvec(x, y)\r
-print 'x = ', x\r
-print 'y = ', y\r
-print 'z = ', z\r
-print C.prdscl(x,y)\r
-\r
+import compo
+
+x = []
+y = []
+for i in range(5):
+ ii = i+1
+ x.append(2*ii)
+ y.append(ii*ii)
+
+C = compo.compo()
+
+z = C.addvec(x, y)
+print 'x = ', x
+print 'y = ', y
+print 'z = ', z
+print C.prdscl(x,y)
+
-def addvec(x, y): \r
- n = len(x)\r
- z = []\r
- for i in range(n):\r
- z.append(x[i] + y[i])\r
- return z\r
-\r
-def prdscl(x, y):\r
- n = len(x)\r
- S = 0\r
- for i in range(n):\r
- S = S + x[i] * y[i]\r
- return S\r
+def addvec(x, y):
+ n = len(x)
+ z = []
+ for i in range(n):
+ z.append(x[i] + y[i])
+ return z
+
+def prdscl(x, y):
+ n = len(x)
+ S = 0
+ for i in range(n):
+ S = S + x[i] * y[i]
+ return S
-from os import system, popen\r
-from string import split\r
-\r
-class Systeme:\r
- \r
- def __init__(self):\r
- self.repertoire = '.'\r
-\r
- def cd(self, rep):\r
- self.repertoire = rep\r
-\r
- def cp(self, nom1, nom2):\r
- system('cp '\r
- + self.repertoire + '/' + nom1 + ' ' \r
- + self.repertoire + '/' + nom2)\r
-\r
- def touch(self, nom):\r
- system('touch '\r
- + self.repertoire + '/' + nom)\r
-\r
- def rm(self, nom):\r
- system('rm '\r
- + self.repertoire + '/' + nom)\r
- \r
- def dir(self):\r
- f = popen('ls ' + self.repertoire)\r
- s = f.read()\r
- f.close()\r
- return split(s)\r
-\r
+from os import system, popen
+from string import split
+
+class Systeme:
+
+ def __init__(self):
+ self.repertoire = '.'
+
+ def cd(self, rep):
+ self.repertoire = rep
+
+ def cp(self, nom1, nom2):
+ system('cp '
+ + self.repertoire + '/' + nom1 + ' '
+ + self.repertoire + '/' + nom2)
+
+ def touch(self, nom):
+ system('touch '
+ + self.repertoire + '/' + nom)
+
+ def rm(self, nom):
+ system('rm '
+ + self.repertoire + '/' + nom)
+
+ def dir(self):
+ f = popen('ls ' + self.repertoire)
+ s = f.read()
+ f.close()
+ return split(s)
+
-import systeme\r
-\r
-S = systeme.Systeme()\r
-\r
-print "create U1 ..."\r
-S.touch('U1')\r
-print "dir : ", S.dir()\r
-\r
-print "copy U1 to U2 ..."\r
-S.cp('U1', 'U2')\r
-print "dir : ", S.dir()\r
-\r
-print "delete U1 ..."\r
-S.rm('U1')\r
-print "dir : ", S.dir()\r
-\r
-print "delete U2 ..."\r
-S.rm('U2')\r
-print "dir : ", S.dir()\r
+import systeme
+
+S = systeme.Systeme()
+
+print "create U1 ..."
+S.touch('U1')
+print "dir : ", S.dir()
+
+print "copy U1 to U2 ..."
+S.cp('U1', 'U2')
+print "dir : ", S.dir()
+
+print "delete U1 ..."
+S.rm('U1')
+print "dir : ", S.dir()
+
+print "delete U2 ..."
+S.rm('U2')
+print "dir : ", S.dir()
-#include "FreeFem.hxx"\r
-#include <fstream>\r
-\r
-void FreeFem::Bords(vector<sBord> &B) {\r
- B_ = B;\r
-}\r
-\r
-void FreeFem::Flux(string u1, string u2) {\r
- VX_ = u1;\r
- VY_ = u2;\r
-}\r
-\r
-void FreeFem::Convection(string Cinit, double dt, long n) {\r
-\r
- ofstream f("/tmp/example.edp");\r
- \r
- int i, nB = B_.size();\r
-\r
- for (i=0; i<nB; i++)\r
- f << "border b" << i << "(t=0,1){" \r
- << B_[i].X << "; " << B_[i].Y << "; }" << endl;\r
-\r
- f << "mesh th = buildmesh(";\r
- for (i=0; i<nB; i++)\r
- f << "b" << i << "(" << B_[i].n << ")" \r
- << ( i<nB-1 ? '+' : ')');\r
- f << ";" << endl;\r
-\r
- f << "fespace Vh(th,P1);" << endl;\r
- f << "Vh v = " << Cinit << ";" << endl << "plot(v);" <<endl;\r
- f << "real dt = " << dt << ", t=0;" << endl;\r
- f << "Vh u1 = " << VX_ << ", u2 = " << VY_ << ";" << endl;\r
- f << "int i;" << endl << "Vh vv,vo;" << endl\r
- << "for ( i=0; i<" << n << "; i++) {" << endl\r
- << "t += dt;" << endl << "vo=v;" << endl\r
- << "v=convect([u1,u2],-dt,vo);" << endl\r
- << "plot(v,wait=0);" << endl << "};" << endl;\r
- \r
- f.close();\r
-\r
- system("FreeFem++ /tmp/example.edp");\r
-}\r
+#include "FreeFem.hxx"
+#include <fstream>
+
+void FreeFem::Bords(vector<sBord> &B) {
+ B_ = B;
+}
+
+void FreeFem::Flux(string u1, string u2) {
+ VX_ = u1;
+ VY_ = u2;
+}
+
+void FreeFem::Convection(string Cinit, double dt, long n) {
+
+ ofstream f("/tmp/example.edp");
+
+ int i, nB = B_.size();
+
+ for (i=0; i<nB; i++)
+ f << "border b" << i << "(t=0,1){"
+ << B_[i].X << "; " << B_[i].Y << "; }" << endl;
+
+ f << "mesh th = buildmesh(";
+ for (i=0; i<nB; i++)
+ f << "b" << i << "(" << B_[i].n << ")"
+ << ( i<nB-1 ? '+' : ')');
+ f << ";" << endl;
+
+ f << "fespace Vh(th,P1);" << endl;
+ f << "Vh v = " << Cinit << ";" << endl << "plot(v);" <<endl;
+ f << "real dt = " << dt << ", t=0;" << endl;
+ f << "Vh u1 = " << VX_ << ", u2 = " << VY_ << ";" << endl;
+ f << "int i;" << endl << "Vh vv,vo;" << endl
+ << "for ( i=0; i<" << n << "; i++) {" << endl
+ << "t += dt;" << endl << "vo=v;" << endl
+ << "v=convect([u1,u2],-dt,vo);" << endl
+ << "plot(v,wait=0);" << endl << "};" << endl;
+
+ f.close();
+
+ system("FreeFem++ /tmp/example.edp");
+}
-#include <string>\r
-#include <vector>\r
-\r
-struct sBord {\r
- string X;\r
- string Y;\r
- int n;\r
-};\r
-\r
-class FreeFem\r
-{\r
- public:\r
-\r
- void Bords(vector<sBord> &B);\r
- void Flux(string u1, string u2);\r
- void Convection(string Cinit, double dt, long n);\r
-\r
- private:\r
-\r
- string VX_, VY_;\r
- vector<sBord> B_;\r
-};\r
+#include <string>
+#include <vector>
+
+struct sBord {
+ string X;
+ string Y;
+ int n;
+};
+
+class FreeFem
+{
+ public:
+
+ void Bords(vector<sBord> &B);
+ void Flux(string u1, string u2);
+ void Convection(string Cinit, double dt, long n);
+
+ private:
+
+ string VX_, VY_;
+ vector<sBord> B_;
+};
-import os\r
-\r
-class Bord:\r
- def __init__(self, X, Y, n):\r
- self.X = X\r
- self.Y = Y\r
- self.n = n\r
- \r
-class FreeFem:\r
- def __init__(self):\r
- self.u1 = "0"\r
- self.u2 = "0"\r
- self.bords = [ Bord("x = cos(2*pi*t)", "y = sin(2*pi*t)", 100) ]\r
- \r
- def Bords(self, b):\r
- self.bords = b\r
-\r
- def Flux(self, u1, u2):\r
- self.u1 = u1\r
- self.u2 = u2\r
- \r
- def Convection(self, cond_init, dt, n):\r
-\r
- f = open("/tmp/example.edp", "w")\r
- s = ""\r
- ib = 1\r
- nb = len(self.bords)\r
- for b in self.bords:\r
- f.write("border b" + str(ib) + "(t=0,1){" + \\r
- b.X + "; " + b.Y + "; };\n");\r
- s = s + "b" + str(ib) + "(" + str(b.n)+ ")"\r
- if (ib < nb):\r
- s = s + "+ "\r
- else:\r
- s = s + ");"\r
- ib = ib+1\r
- \r
- f.write("mesh th = buildmesh(" + s + "\n");\r
- f.write("fespace Vh(th,P1);\n");\r
- f.write("Vh v = " + cond_init + ";\nplot(v);\n")\r
- f.write("real dt = " + str(dt) + ", t=0;\n");\r
- \r
- f.write("Vh u1 = " + str(self.u1) + \\r
- ", u2 = " + str(self.u2) + ";\n");\r
- \r
- f.write("int i;\nVh vv,vo;\n"\r
- "for ( i=0; i< " + str(n) + " ; i++) {\n"\r
- "t += dt;\nvo=v;\nv=convect([u1,u2],-dt,vo);\n"\r
- "plot(v,wait=0);\n};\n");\r
- f.close()\r
- os.system('FreeFem++ /tmp/example.edp');\r
-\r
+import os
+
+class Bord:
+ def __init__(self, X, Y, n):
+ self.X = X
+ self.Y = Y
+ self.n = n
+
+class FreeFem:
+ def __init__(self):
+ self.u1 = "0"
+ self.u2 = "0"
+ self.bords = [ Bord("x = cos(2*pi*t)", "y = sin(2*pi*t)", 100) ]
+
+ def Bords(self, b):
+ self.bords = b
+
+ def Flux(self, u1, u2):
+ self.u1 = u1
+ self.u2 = u2
+
+ def Convection(self, cond_init, dt, n):
+
+ f = open("/tmp/example.edp", "w")
+ s = ""
+ ib = 1
+ nb = len(self.bords)
+ for b in self.bords:
+ f.write("border b" + str(ib) + "(t=0,1){" + \
+ b.X + "; " + b.Y + "; };\n");
+ s = s + "b" + str(ib) + "(" + str(b.n)+ ")"
+ if (ib < nb):
+ s = s + "+ "
+ else:
+ s = s + ");"
+ ib = ib+1
+
+ f.write("mesh th = buildmesh(" + s + "\n");
+ f.write("fespace Vh(th,P1);\n");
+ f.write("Vh v = " + cond_init + ";\nplot(v);\n")
+ f.write("real dt = " + str(dt) + ", t=0;\n");
+
+ f.write("Vh u1 = " + str(self.u1) + \
+ ", u2 = " + str(self.u2) + ";\n");
+
+ f.write("int i;\nVh vv,vo;\n"
+ "for ( i=0; i< " + str(n) + " ; i++) {\n"
+ "t += dt;\nvo=v;\nv=convect([u1,u2],-dt,vo);\n"
+ "plot(v,wait=0);\n};\n");
+ f.close()
+ os.system('FreeFem++ /tmp/example.edp');
+
-#include "FreeFem.hxx"\r
-\r
-int main()\r
-{\r
- FreeFem C;\r
-\r
- vector<sBord> B(1);\r
- B[0].X = "x=cos(2*pi*t)";\r
- B[0].Y = "y=sin(2*pi*t)";\r
- B[0].n = 100;\r
-\r
- C.Bords(B);\r
- C.Flux("y", "-x");\r
- C.Convection("exp(-10*((x-0.3)^2 +(y-0.3)^2))", 0.1, 40);\r
-}\r
+#include "FreeFem.hxx"
+
+int main()
+{
+ FreeFem C;
+
+ vector<sBord> B(1);
+ B[0].X = "x=cos(2*pi*t)";
+ B[0].Y = "y=sin(2*pi*t)";
+ B[0].n = 100;
+
+ C.Bords(B);
+ C.Flux("y", "-x");
+ C.Convection("exp(-10*((x-0.3)^2 +(y-0.3)^2))", 0.1, 40);
+}
-from FreeFem import *\r
-\r
-C = FreeFem()\r
-\r
-C.Flux("y", "-x")\r
-C.Bords( [ Bord("x=cos(2*pi*t)", "y=sin(2*pi*t)", 100)] );\r
-C.Convection('exp(-10*((x-0.3)^2 +(y-0.3)^2))', 0.1, 50)\r
-\r
+from FreeFem import *
+
+C = FreeFem()
+
+C.Flux("y", "-x")
+C.Bords( [ Bord("x=cos(2*pi*t)", "y=sin(2*pi*t)", 100)] );
+C.Convection('exp(-10*((x-0.3)^2 +(y-0.3)^2))', 0.1, 50)
+
-%module AlgLinModule\r
-\r
-%{\r
-#include "alglin.hxx"\r
-%}\r
-\r
-class alglin {\r
-public:\r
- alglin();\r
- ~alglin();\r
- void addvec(vecteur *C, vecteur *A, vecteur *B);\r
- double prdscl(vecteur *A, vecteur *B);\r
- vecteur * create_vector(long n);\r
- void destroy_vector(vecteur *V);\r
-};\r
-\r
+%module AlgLinModule
+
+%{
+#include "alglin.hxx"
+%}
+
+class alglin {
+public:
+ alglin();
+ ~alglin();
+ void addvec(vecteur *C, vecteur *A, vecteur *B);
+ double prdscl(vecteur *A, vecteur *B);
+ vecteur * create_vector(long n);
+ void destroy_vector(vecteur *V);
+};
+
->>> import AlgLinModule\r
->>> C = AlgLinModule.alglin()\r
->>> C\r
-<C alglin instance>\r
->>> v1 = C.create_vector(10)\r
->>> v2 = C.create_vector(20)\r
->>> print "v1 = ", v1\r
-v1 = _8116410_vecteur_p\r
->>> print "v2 = ", v2\r
-v2 = _80d06c8_vecteur_p\r
+>>> import AlgLinModule
+>>> C = AlgLinModule.alglin()
+>>> C
+<C alglin instance>
+>>> v1 = C.create_vector(10)
+>>> v2 = C.create_vector(20)
+>>> print "v1 = ", v1
+v1 = _8116410_vecteur_p
+>>> print "v2 = ", v2
+v2 = _80d06c8_vecteur_p
->>>> print v.n()\r
-Traceback (most recent call last):\r
- File "<stdin>", line 1, in ?\r
-AttributeError: n\r
+>>>> print v.n()
+Traceback (most recent call last):
+ File "<stdin>", line 1, in ?
+AttributeError: n
-%module AlgLinModule\r
-\r
-%{\r
-#include "alglin.hxx"\r
-%}\r
-\r
-class vecteur {\r
- \r
-public:\r
- vecteur(long n);\r
- ~vecteur();\r
- \r
- double * x();\r
- long n();\r
-};\r
-\r
-class alglin {\r
-\r
-public:\r
- alglin();\r
- ~alglin();\r
- void addvec(vecteur *C, vecteur *A, vecteur *B);\r
- double prdscl(vecteur *A, vecteur *B);\r
- vecteur * create_vector(long n);\r
- void destroy_vector(vecteur *V);\r
-\r
-};\r
-\r
+%module AlgLinModule
+
+%{
+#include "alglin.hxx"
+%}
+
+class vecteur {
+
+public:
+ vecteur(long n);
+ ~vecteur();
+
+ double * x();
+ long n();
+};
+
+class alglin {
+
+public:
+ alglin();
+ ~alglin();
+ void addvec(vecteur *C, vecteur *A, vecteur *B);
+ double prdscl(vecteur *A, vecteur *B);
+ vecteur * create_vector(long n);
+ void destroy_vector(vecteur *V);
+
+};
+
->>> import AlgLinModule\r
->>> n = 5\r
->>> C = AlgLinModule.alglin()\r
->>> v = C.create_vector(n)\r
->>> print "v =", v\r
-v = <C vecteur instance>\r
->>> print "v.n =", v.n()\r
-v.n = 5\r
->>> x = v.x()\r
->>> print x\r
-_811a160_double_p\r
->>> print x[4]\r
-a\r
->>> print type(x)\r
-<type 'string'>\r
+>>> import AlgLinModule
+>>> n = 5
+>>> C = AlgLinModule.alglin()
+>>> v = C.create_vector(n)
+>>> print "v =", v
+v = <C vecteur instance>
+>>> print "v.n =", v.n()
+v.n = 5
+>>> x = v.x()
+>>> print x
+_811a160_double_p
+>>> print x[4]
+a
+>>> print type(x)
+<type 'string'>
-%module AlgLinModule\r
-\r
-%{\r
-#include "alglin.hxx"\r
-#include <string>\r
-static string tampon;\r
-\r
-%}\r
-\r
-class vecteur {\r
- \r
-public:\r
- vecteur(long n);\r
- ~vecteur();\r
- \r
- double * x();\r
- long n();\r
-%addmethods {\r
- double __getitem__(long i) \r
- { double *x_ = self->x(); return x_[i]; }\r
- double __setitem__(long i, double value) \r
- { double *x_ = self->x(); x_[i] = value; }\r
- const char * __str__() {\r
- tampon = "";\r
- double *x_ = self->x();\r
- long n_ = self->n();\r
- char sx[20];\r
- for (long i=0; i<n_; i++) {\r
- sprintf(sx, " %10.4g", x_[i]);\r
- tampon += sx;\r
- }\r
- return tampon.c_str();\r
- }\r
- }\r
-};\r
-\r
-class alglin {\r
-\r
-public:\r
- alglin();\r
- ~alglin();\r
- void addvec(vecteur *C, vecteur *A, vecteur *B);\r
- double prdscl(vecteur *A, vecteur *B);\r
- vecteur * create_vector(long n);\r
- void destroy_vector(vecteur *V);\r
-\r
-};\r
-\r
+%module AlgLinModule
+
+%{
+#include "alglin.hxx"
+#include <string>
+static string tampon;
+
+%}
+
+class vecteur {
+
+public:
+ vecteur(long n);
+ ~vecteur();
+
+ double * x();
+ long n();
+%addmethods {
+ double __getitem__(long i)
+ { double *x_ = self->x(); return x_[i]; }
+ double __setitem__(long i, double value)
+ { double *x_ = self->x(); x_[i] = value; }
+ const char * __str__() {
+ tampon = "";
+ double *x_ = self->x();
+ long n_ = self->n();
+ char sx[20];
+ for (long i=0; i<n_; i++) {
+ sprintf(sx, " %10.4g", x_[i]);
+ tampon += sx;
+ }
+ return tampon.c_str();
+ }
+ }
+};
+
+class alglin {
+
+public:
+ alglin();
+ ~alglin();
+ void addvec(vecteur *C, vecteur *A, vecteur *B);
+ double prdscl(vecteur *A, vecteur *B);
+ vecteur * create_vector(long n);
+ void destroy_vector(vecteur *V);
+
+};
+
->>> import AlgLinModule\r
->>> n = 5\r
->>> C = AlgLinModule.alglin()\r
->>> C\r
-<C alglin instance>\r
->>> v1 = C.create_vector(n)\r
->>> v2 = C.create_vector(n)\r
->>> v1\r
-<C vecteur instance>\r
->>> for i in range(n):\r
-... v1[i] = 2*i\r
-... v2[i] = i*i\r
-...\r
->>> print "v1 =", v1\r
-v1 = 0 2 4 6 8\r
->>> print "v2 =", v2\r
-v2 = 0 1 4 9 16\r
->>> print v1[1]\r
-2\r
->>> S = C.prdscl(v1, v2)\r
->>> print "S = ", S\r
-S = 200.0\r
+>>> import AlgLinModule
+>>> n = 5
+>>> C = AlgLinModule.alglin()
+>>> C
+<C alglin instance>
+>>> v1 = C.create_vector(n)
+>>> v2 = C.create_vector(n)
+>>> v1
+<C vecteur instance>
+>>> for i in range(n):
+... v1[i] = 2*i
+... v2[i] = i*i
+...
+>>> print "v1 =", v1
+v1 = 0 2 4 6 8
+>>> print "v2 =", v2
+v2 = 0 1 4 9 16
+>>> print v1[1]
+2
+>>> S = C.prdscl(v1, v2)
+>>> print "S = ", S
+S = 200.0
-module Distant {\r
-\r
- typedef sequence<double> vecteur;\r
- \r
- interface AlgLin \r
- {\r
- void addvec(out vecteur C, in vecteur A, in vecteur B);\r
- double prdscl(in vecteur A, in vecteur B);\r
- };\r
- \r
-};\r
+module Distant {
+
+ typedef sequence<double> vecteur;
+
+ interface AlgLin
+ {
+ void addvec(out vecteur C, in vecteur A, in vecteur B);
+ double prdscl(in vecteur A, in vecteur B);
+ };
+
+};
-#include "alglin_i.hxx"\r
-#include <iostream>\r
-\r
-AlgLin_i::AlgLin_i()\r
-{\r
-}\r
-\r
-AlgLin_i::~AlgLin_i()\r
-{\r
-}\r
-\r
-void AlgLin_i::addvec(Distant::vecteur_out C,\r
- const Distant::vecteur& A, \r
- const Distant::vecteur& B)\r
-{\r
- long i, n = A.length();\r
-\r
- vecteur A_(n);\r
- vecteur B_(n);\r
- vecteur C_(n);\r
-\r
- double *xA = A_.x();\r
- double *xB = B_.x();\r
- double *xC = C_.x();\r
-\r
- for (i=0; i<n; i++) {\r
- xA[i] = A[i];\r
- xB[i] = B[i];\r
- }\r
-\r
- A_interne.addvec(&C_, &A_, &B_);\r
-\r
- C = new Distant::vecteur;\r
- C->length(n);\r
- for (i=0; i<n; i++) {\r
- (*C)[i] = xC[i];\r
- }\r
-}\r
-\r
-CORBA::Double AlgLin_i::prdscl(const Distant::vecteur& A, \r
- const Distant::vecteur& B)\r
-{\r
- long i, n = A.length();\r
-\r
- vecteur A_(n);\r
- vecteur B_(n);\r
-\r
- double *xA = A_.x();\r
- double *xB = B_.x();\r
-\r
- for (i=0; i<n; i++) {\r
- xA[i] = A[i];\r
- xB[i] = B[i];\r
- }\r
-\r
- return A_interne.prdscl(&A_, &B_); \r
-}\r
-\r
+#include "alglin_i.hxx"
+#include <iostream>
+
+AlgLin_i::AlgLin_i()
+{
+}
+
+AlgLin_i::~AlgLin_i()
+{
+}
+
+void AlgLin_i::addvec(Distant::vecteur_out C,
+ const Distant::vecteur& A,
+ const Distant::vecteur& B)
+{
+ long i, n = A.length();
+
+ vecteur A_(n);
+ vecteur B_(n);
+ vecteur C_(n);
+
+ double *xA = A_.x();
+ double *xB = B_.x();
+ double *xC = C_.x();
+
+ for (i=0; i<n; i++) {
+ xA[i] = A[i];
+ xB[i] = B[i];
+ }
+
+ A_interne.addvec(&C_, &A_, &B_);
+
+ C = new Distant::vecteur;
+ C->length(n);
+ for (i=0; i<n; i++) {
+ (*C)[i] = xC[i];
+ }
+}
+
+CORBA::Double AlgLin_i::prdscl(const Distant::vecteur& A,
+ const Distant::vecteur& B)
+{
+ long i, n = A.length();
+
+ vecteur A_(n);
+ vecteur B_(n);
+
+ double *xA = A_.x();
+ double *xB = B_.x();
+
+ for (i=0; i<n; i++) {
+ xA[i] = A[i];
+ xB[i] = B[i];
+ }
+
+ return A_interne.prdscl(&A_, &B_);
+}
+
-#ifndef ALGLIN_I_\r
-#define ALGLIN_I_\r
-\r
-#include <alglin.hh>\r
-#include "alglin.hxx"\r
-\r
-class AlgLin_i : public POA_Distant::AlgLin,\r
- public PortableServer::RefCountServantBase {\r
-\r
-private:\r
-\r
- alglin A_interne;\r
-\r
-public:\r
-\r
- AlgLin_i();\r
- virtual ~AlgLin_i();\r
-\r
- void addvec(Distant::vecteur_out C, \r
- const Distant::vecteur& A, \r
- const Distant::vecteur& B);\r
-\r
- CORBA::Double prdscl(const Distant::vecteur& A, \r
- const Distant::vecteur& B);\r
-\r
-};\r
-\r
-#endif\r
+#ifndef ALGLIN_I_
+#define ALGLIN_I_
+
+#include <alglin.hh>
+#include "alglin.hxx"
+
+class AlgLin_i : public POA_Distant::AlgLin,
+ public PortableServer::RefCountServantBase {
+
+private:
+
+ alglin A_interne;
+
+public:
+
+ AlgLin_i();
+ virtual ~AlgLin_i();
+
+ void addvec(Distant::vecteur_out C,
+ const Distant::vecteur& A,
+ const Distant::vecteur& B);
+
+ CORBA::Double prdscl(const Distant::vecteur& A,
+ const Distant::vecteur& B);
+
+};
+
+#endif
-module Solveur {\r
-\r
- struct Bord {\r
- string X;\r
- string Y;\r
- long n;\r
- };\r
- typedef sequence<Bord> seqBords;\r
-\r
- interface FreeFem {\r
- \r
- void Bords(in seqBords B);\r
- void Flux(in string u1, in string u2);\r
-\r
- void Convection(in string cond_init, in double dt, in long n);\r
-\r
- };\r
-\r
-};\r
+module Solveur {
+
+ struct Bord {
+ string X;
+ string Y;
+ long n;
+ };
+ typedef sequence<Bord> seqBords;
+
+ interface FreeFem {
+
+ void Bords(in seqBords B);
+ void Flux(in string u1, in string u2);
+
+ void Convection(in string cond_init, in double dt, in long n);
+
+ };
+
+};
-import Solveur__POA\r
-import FreeFem\r
-\r
-class FreeFem_i(Solveur__POA.FreeFem):\r
-\r
- def __init__(self):\r
- self.F = FreeFem.FreeFem();\r
-\r
- def Bords(self, b):\r
- self.F.Bords(b);\r
-\r
- def Flux(self, u1, u2):\r
- self.F.Flux(u1, u2);\r
-\r
- def Convection(self, cond_init, dt, n):\r
- self.F.Convection(cond_init, dt, n)\r
-\r
+import Solveur__POA
+import FreeFem
+
+class FreeFem_i(Solveur__POA.FreeFem):
+
+ def __init__(self):
+ self.F = FreeFem.FreeFem();
+
+ def Bords(self, b):
+ self.F.Bords(b);
+
+ def Flux(self, u1, u2):
+ self.F.Flux(u1, u2);
+
+ def Convection(self, cond_init, dt, n):
+ self.F.Convection(cond_init, dt, n)
+
-#include <CORBA.h>\r
-#include <fstream>\r
-#include <string>\r
-#include "alglin.hh"\r
-\r
-int main(int argc,char **argv)\r
-{\r
- CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);\r
-\r
- string s;\r
- ifstream f("AlgLin.ior");\r
- f >> s;\r
- f.close();\r
-\r
- CORBA::Object_ptr O = orb->string_to_object(s.c_str());\r
- Distant::AlgLin_var A = Distant::AlgLin::_narrow(O);\r
-\r
- long n = 5;\r
-\r
- Distant::vecteur V1;\r
- V1.length(n);\r
-\r
- Distant::vecteur V2;\r
- V2.length(n);\r
-\r
- for (long i=0; i<n; i++) {\r
- V1[i] = i*i;\r
- V2[i] = 2*i;\r
- }\r
-\r
- CORBA::Double S = A->prdscl(V1, V2);\r
- cerr << S << endl;\r
-}\r
+#include <CORBA.h>
+#include <fstream>
+#include <string>
+#include "alglin.hh"
+
+int main(int argc,char **argv)
+{
+ CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);
+
+ string s;
+ ifstream f("AlgLin.ior");
+ f >> s;
+ f.close();
+
+ CORBA::Object_ptr O = orb->string_to_object(s.c_str());
+ Distant::AlgLin_var A = Distant::AlgLin::_narrow(O);
+
+ long n = 5;
+
+ Distant::vecteur V1;
+ V1.length(n);
+
+ Distant::vecteur V2;
+ V2.length(n);
+
+ for (long i=0; i<n; i++) {
+ V1[i] = i*i;
+ V2[i] = 2*i;
+ }
+
+ CORBA::Double S = A->prdscl(V1, V2);
+ cerr << S << endl;
+}
-import CORBA\r
-\r
-orb = CORBA.ORB_init();\r
-\r
-f = open('AlgLin.ior');\r
-s = f.read();\r
-f.close();\r
-\r
-o = orb.string_to_object(s);\r
-\r
-import Distant\r
-o = o._narrow(Distant.AlgLin)\r
-\r
-\r
-v1 = [ 1, 2, 3 ]\r
-v2 = [ 3, 4, 5 ]\r
-\r
-v3 = o.addvec(v1, v2)\r
-print v3\r
-\r
-print o.prdscl(v1, v3)\r
+import CORBA
+
+orb = CORBA.ORB_init();
+
+f = open('AlgLin.ior');
+s = f.read();
+f.close();
+
+o = orb.string_to_object(s);
+
+import Distant
+o = o._narrow(Distant.AlgLin)
+
+
+v1 = [ 1, 2, 3 ]
+v2 = [ 3, 4, 5 ]
+
+v3 = o.addvec(v1, v2)
+print v3
+
+print o.prdscl(v1, v3)
-#include "SALOME_Component.idl"\r
-\r
-module Engines {\r
-\r
- typedef sequence<double> vecteur;\r
- \r
- interface AlgLin : Component \r
- {\r
- void addvec(out vecteur C, in vecteur A, in vecteur B);\r
- double prdscl(in vecteur A, in vecteur B);\r
- };\r
- \r
-};\r
+#include "SALOME_Component.idl"
+
+module Engines {
+
+ typedef sequence<double> vecteur;
+
+ interface AlgLin : EngineComponent
+ {
+ void addvec(out vecteur C, in vecteur A, in vecteur B);
+ double prdscl(in vecteur A, in vecteur B);
+ };
+
+};
-#include "alglin_i.hxx"\r
-#include <iostream>\r
-\r
-\r
-AlgLin_i:: AlgLin_i(CORBA::ORB_ptr orb,\r
- PortableServer::POA_ptr poa,\r
- PortableServer::ObjectId * contId, \r
- const char *instanceName, \r
- const char *interfaceName) :\r
- Engines_Component_i(orb, poa, contId, instanceName, interfaceName, 1)\r
-{\r
- MESSAGE("activate object");\r
- _thisObj = this ;\r
- _id = _poa->activate_object(_thisObj);\r
-}\r
-\r
-\r
-AlgLin_i::~AlgLin_i()\r
-{\r
-}\r
-\r
-void AlgLin_i::addvec(Engines::vecteur_out C,\r
- const Engines::vecteur& A, \r
- const Engines::vecteur& B)\r
-{\r
- beginService("addvec");\r
-\r
- long i, n = A.length();\r
-\r
- if (n != B.length())\r
- sendMessage("warning", "vecteurs de longueur differente");\r
-\r
- vecteur A_(n);\r
- vecteur B_(n);\r
- vecteur C_(n);\r
-\r
- double *xA = A_.x();\r
- double *xB = B_.x();\r
- double *xC = C_.x();\r
-\r
- for (i=0; i<n; i++) {\r
- xA[i] = A[i];\r
- xB[i] = B[i];\r
- }\r
-\r
- A_interne.addvec(&C_, &A_, &B_);\r
-\r
- C = new Engines::vecteur;\r
- C->length(n);\r
- for (i=0; i<n; i++) {\r
- (*C)[i] = xC[i];\r
- }\r
-\r
- endService("addvec");\r
-}\r
-\r
-CORBA::Double AlgLin_i::prdscl(const Engines::vecteur& A, \r
- const Engines::vecteur& B)\r
-{\r
- beginService("prdscl");\r
-\r
- long i, n = A.length();\r
-\r
- if (n != B.length())\r
- sendMessage("warning", "vecteurs de longueur differente");\r
-\r
- vecteur A_(n);\r
- vecteur B_(n);\r
-\r
- double *xA = A_.x();\r
- double *xB = B_.x();\r
-\r
- for (i=0; i<n; i++) {\r
- xA[i] = A[i];\r
- xB[i] = B[i];\r
- }\r
-\r
- CORBA::Double d = A_interne.prdscl(&A_, &B_); \r
-\r
- endService("prdscl");\r
- return d;\r
-}\r
-\r
-extern "C"\r
-{\r
- PortableServer::ObjectId * AlgLinEngine_factory(\r
- CORBA::ORB_ptr orb,\r
- PortableServer::POA_ptr poa,\r
- PortableServer::ObjectId * contId,\r
- const char *instanceName,\r
- const char *interfaceName)\r
- {\r
- MESSAGE("PortableServer::ObjectId * AlgLinEngine_factory()");\r
- AlgLin_i * O\r
- = new AlgLin_i(orb, poa, contId, instanceName, interfaceName);\r
- return O->getId() ;\r
- }\r
-}\r
-\r
+#include "alglin_i.hxx"
+#include <iostream>
+
+
+AlgLin_i:: AlgLin_i(CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName) :
+ Engines_Component_i(orb, poa, contId, instanceName, interfaceName, 1)
+{
+ MESSAGE("activate object");
+ _thisObj = this ;
+ _id = _poa->activate_object(_thisObj);
+}
+
+
+AlgLin_i::~AlgLin_i()
+{
+}
+
+void AlgLin_i::addvec(Engines::vecteur_out C,
+ const Engines::vecteur& A,
+ const Engines::vecteur& B)
+{
+ beginService("addvec");
+
+ long i, n = A.length();
+
+ if (n != B.length())
+ sendMessage("warning", "vecteurs de longueur differente");
+
+ vecteur A_(n);
+ vecteur B_(n);
+ vecteur C_(n);
+
+ double *xA = A_.x();
+ double *xB = B_.x();
+ double *xC = C_.x();
+
+ for (i=0; i<n; i++) {
+ xA[i] = A[i];
+ xB[i] = B[i];
+ }
+
+ A_interne.addvec(&C_, &A_, &B_);
+
+ C = new Engines::vecteur;
+ C->length(n);
+ for (i=0; i<n; i++) {
+ (*C)[i] = xC[i];
+ }
+
+ endService("addvec");
+}
+
+CORBA::Double AlgLin_i::prdscl(const Engines::vecteur& A,
+ const Engines::vecteur& B)
+{
+ beginService("prdscl");
+
+ long i, n = A.length();
+
+ if (n != B.length())
+ sendMessage("warning", "vecteurs de longueur differente");
+
+ vecteur A_(n);
+ vecteur B_(n);
+
+ double *xA = A_.x();
+ double *xB = B_.x();
+
+ for (i=0; i<n; i++) {
+ xA[i] = A[i];
+ xB[i] = B[i];
+ }
+
+ CORBA::Double d = A_interne.prdscl(&A_, &B_);
+
+ endService("prdscl");
+ return d;
+}
+
+extern "C"
+{
+ PortableServer::ObjectId * AlgLinEngine_factory(
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName)
+ {
+ MESSAGE("PortableServer::ObjectId * AlgLinEngine_factory()");
+ AlgLin_i * O
+ = new AlgLin_i(orb, poa, contId, instanceName, interfaceName);
+ return O->getId() ;
+ }
+}
+
-#ifndef ALGLIN_I_\r
-#define ALGLIN_I_\r
-\r
-#include "alglin.hxx"\r
-#include <SALOMEconfig.h>\r
-#include CORBA_SERVER_HEADER(alglin)\r
-#include "SALOME_Component_i.hxx"\r
-\r
-class AlgLin_i : public POA_Engines::AlgLin,\r
- public Engines_Component_i {\r
-\r
-private:\r
-\r
- alglin A_interne;\r
-\r
-public:\r
-\r
- AlgLin_i(CORBA::ORB_ptr orb,\r
- PortableServer::POA_ptr poa,\r
- PortableServer::ObjectId * contId, \r
- const char *instanceName,\r
- const char *interfaceName);\r
-\r
- virtual ~AlgLin_i();\r
-\r
- void addvec(Engines::vecteur_out C, \r
- const Engines::vecteur& A, \r
- const Engines::vecteur& B);\r
-\r
- CORBA::Double prdscl(const Engines::vecteur& A, \r
- const Engines::vecteur& B);\r
-\r
- Engines::vecteur* create_vector(CORBA::Long n);\r
- void destroy_vector(const Engines::vecteur& V);\r
- \r
-};\r
-\r
-\r
-extern "C"\r
-PortableServer::ObjectId * \r
- AlgLinEngine_factory(CORBA::ORB_ptr orb ,\r
- PortableServer::POA_ptr poa , \r
- PortableServer::ObjectId * contId ,\r
- const char *instanceName ,\r
- const char *interfaceName );\r
-\r
-#endif\r
+#ifndef ALGLIN_I_
+#define ALGLIN_I_
+
+#include "alglin.hxx"
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(alglin)
+#include "SALOME_Component_i.hxx"
+
+class AlgLin_i : public POA_Engines::AlgLin,
+ public Engines_Component_i {
+
+private:
+
+ alglin A_interne;
+
+public:
+
+ AlgLin_i(CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName);
+
+ virtual ~AlgLin_i();
+
+ void addvec(Engines::vecteur_out C,
+ const Engines::vecteur& A,
+ const Engines::vecteur& B);
+
+ CORBA::Double prdscl(const Engines::vecteur& A,
+ const Engines::vecteur& B);
+
+ Engines::vecteur* create_vector(CORBA::Long n);
+ void destroy_vector(const Engines::vecteur& V);
+
+};
+
+
+extern "C"
+PortableServer::ObjectId *
+ AlgLinEngine_factory(CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char *instanceName ,
+ const char *interfaceName );
+
+#endif
.. _gui:
*******************************************************
-Utilisation de YACS avec l'interface graphique (GUI)
+Using YACS with the graphical user interface (GUI)
*******************************************************
YACS GUI description
====================
-The YACS GUI document contains several 2D and tree views, one of each per run of a schema. There are different view modes of the schema. The SALOME Object browser is only used to publish the run of the schema as a whole, and under the run, the outputs of the run that are published for the use of other SALOME modules. During the schema design (edition), a dedicated edition tree view of the YACS
-data structure is used for schema building. Modifications are displayed on the 2D view.
+.. _mainwindow:
-Several executions (run) of the same schema can occur at the same time. Dedicated tree in run mode and 2D views are used for each run. The run tree view is used to control the execution (stop, breakpoints) and the 2D view reflects the detailed current state of execution.
+.. image:: images/yacs_gui_description_0.png
+ :align: center
-The Python Console and Log Window in the low part of the desktop permits the user to invoke some YACS functionality from Python (for example, import XML graph from Python - not a normal use) and to display diagnostic messages correspondingly.
+.. centered::
+ Main Window
-For the quick access to basic operations the system of context-dependent popup menu is supported. Popup menu is called by click of the right button of the mouse on the selected object.
+The YACS GUI document contains several 2D and tree views, one of each per run of a schema. There are different view modes of the schema.
+The SALOME Object browser is only used to publish the run of the schema as a whole, and under the run,
+the outputs of the run that are published for the use of other SALOME modules. During the schema design (edition),
+a dedicated edition tree view of the YACS data structure is used for schema building.
+Modifications are displayed on the 2D view.
-The main window look & feel is presented schematically below.
+Several executions (run) of the same schema can occur at the same time. Dedicated tree in run mode and 2D views are used for each run.
+The run tree view is used to control the execution (stop, breakpoints) and the 2D view reflects the detailed current state of execution.
-.. _mainwindow:
+The Python Console and Log Window often present in other SALOME modules are not used in YACS, so, they are not present by default.
-.. figure:: images/yacs_gui_description_0.jpg
- :align: center
+For the quick access to basic operations the system of context-dependent popup menu is supported.
+Popup menu is called by click of the right button of the mouse on the selected object.
- Main Window
-
-.. raw:: LaTeX
+Drag and drop operations are often used in edition, between tree items and/or 2D items, for associations (link creation, for instance).
- \clearpage
+The main window look & feel is presented schematically below.
+Note that SALOME Object browser and Schema tree view are regrouped under tabs by default.
.. toctree::
:maxdepth: 1
The SALOME Object Browser is only used to publish the run of the schema as a whole, i.e. just a name for the run, and under this name, the outputs of the run that are published in study for the use of other SALOME modules.
-To see an example of the Object Browser data structure refer to the :ref:`mainwindow`.
+
+.. image:: images/objectBrowser.png
+ :align: center
+
+.. centered::
+ **SALOME Object Browser tab**
+
+The Object Browser is in a tab, with tree_view: see the :ref:`Main window <mainwindow>`.
.. _tree_view:
-.. image:: images/tree_view_0.jpg
+.. image:: images/tree_view_edition.png
:align: center
- :width: 40ex
.. |stream| image:: images/stream_link.png
-============================================================= ======================================= =====================================
-**Object** **Icon** **Description**
-============================================================= ======================================= =====================================
-Schema_Name [note_] |schema| A schema object, which has the same name as a name of loaded XML file of a graph, or 'Schema1', 'Schema2', etc. if this is a new created schema. The corresponding object is published as SObject in Object Browser for normal operation of SALOMEDS study persistence. The study persistence consists in saving the xml file of the schema.
+==================================== ======================================= =======================================================
+**Object** **Icon** **Description**
+==================================== ======================================= =======================================================
+Schema_Name [note_] |block| A schema object, which has the same name as a name of
+ loaded XML file of a graph, or
+ 'Schema1', 'Schema2', etc. if this is a new
+ created schema. The corresponding object is
+ published as SObject in Object Browser for
+ normal operation of SALOMEDS study persistence.
+ The study persistence consists in saving the xml file
+ of the schema.
+ The list of nodes included into the edited
+ schema is represented.
+
+Types A folder under which a list of data types
+ defined in the schema is represented.
+
+Block_Name [note_] |block| A block node object. This object is published as a
+ label under the schema/another composed node object
+ in which it includes. A block node object is created
+ when the corresponding schema object containing this
+ block node is imported or a new block node is created
+ inside this schema.
+
+Loop_Name [note_] |loop| A loop node object. This object is published as a label
+ under the schema/another composed node object in which it
+ includes. A loop node object is created when the
+ corresponding schema object containing this loop node is
+ imported or a new loop node is created inside this schema.
+
+Switch_Name [note_] |switch| A switch node object. This object is published as a label
+ under the schema/another composed node object in which it
+ includes. A switch node object is created when the
+ corresponding schema object containing this switch node
+ is imported or a new switch node is created inside
+ this schema.
+
+Node_Name [note_] |node| An elementary node object. This object is published as a
+ label under the schema or composed node object in which
+ it includes. An elementary node object is created when
+ the corresponding schema object containing this node is
+ imported or a new elementary node is created inside
+ this schema.
+
+Input_Port_Name |inport| An input port object. It is published in the edition tree
+ view under the node which is belong to.
+
+Output_Port_Name |outport| An output port object. It is published in the edition tree
+ view under the node which is belong to.
+==================================== ======================================= =======================================================
-Data Types A folder under which a list of data types defined in the schema is represented.
-Simple A folder under which simple data types (Double, Int, String, Bool) are published.
-Objref A folder under which object reference data types are published. Objref data type is a predefined YACS data type for reference objects. It is obtained from a Catalog of Data Types.
-Sequence A folder under which sequence data types are published. Sequence data type is a predefined YACS data type for sequence objects.
-Array A folder under which array data types are published. Array data type is a predefined YACS data type for array objects.
-Struct A folder under which struct data types are published. Struct data type is a predefined YACS data type for struct objects.
-Nodes A folder under which a list of nodes included into the edited schema is represented.
+.. _description_of_link_objects:
-Block_Name [note_] |block| A block node object. This object is published as a label under the schema/another composed node object in which it includes. A block node object is created when the corresponding schema object containing this block node is imported or a new block node is created inside this schema.
+Links, containers and components table.
-Loop_Name [note_] |loop| A loop node object. This object is published as a label under the schema/another composed node object in which it includes. A loop node object is created when the corresponding schema object containing this loop node is imported or a new loop node is created inside this schema.
-Switch_Name [note_] |switch| A switch node object. This object is published as a label under the schema/another composed node object in which it includes. A switch node object is created when the corresponding schema object containing this switch node is imported or a new switch node is created inside this schema.
-Node_Name [note_] |node| An elementary node object. This object is published as a label under the schema or composed node object in which it includes. An elementary node object is created when the corresponding schema object containing this node is imported or a new elementary node is created inside this schema.
-Input_Port_Name |inport| An input port object. It is published in the edition tree view under the node which is belong to.
-Output_Port_Name |outport| An output port object. It is published in the edition tree view under the node which is belong to.
-============================================================= ======================================= =====================================
+======================================= ======================================= ==============================================================================
+**Object** **Icon** **Description**
+======================================= ======================================= ==============================================================================
+Links A folder under which links are published. Links internal to a
+ block (composed node) are represented under the block. Three kinds
+ of links (control, dataflow, datastream) can be put directly into
+ the 'Links' folder under the block if they exist.
+ **NB!** A link is called internal to a block if it has its input and
+ output on nodes inside the block. These concept and representation
+ is convenient for cut and paste operations of block.
-.. _description_of_link_objects:
+Node_From -->> Node_To |control| A control link object with a symbolic name. This object is published as
+ a label under the corresponding 'Links' folder.
-Links, containers and components table.
+Node.Port_From -> Node.Port_To |data| A data link object with a symbolic name. This object is published as
+ a label under the corresponding 'Links' folder.
+
+Node.Port_From -> Node.Port_To |stream| A datastream link object with a symbolic name. This object is published as
+ a label under the corresponding 'Links' folder.
+
+Containers A folder under which a set of containers referenced from the currently
+ edited schema is represented.
+
+Container_Name [note_] |container| A container definition (not instanciated during the edition). This object
+ is published as a label under Containers parent object, and gives access
+ by the corresponding property page to its properties (cf. SALOME life
+ cycle CORBA & Container manager).
+
+SALOME_Component_Name [note_] |component| A SALOME component instance definition (not instanciated during the edition).
+ This object is published as a label under the container definition in which
+ it includes.
-============================================================= ======================================= =====================================
-**Object** **Icon** **Description**
-============================================================= ======================================= =====================================
-Links A folder under which links are published. Links internal to a block (composed node) are represented under the block. Three kinds of links (control, dataflow, datastream) can be put directly into the 'Links' folder under the block if they exist. **NB!** A link is called internal to a block if it has its input and output on nodes inside the block. These concept and representation is convenient for cut and paste operations of block.
-Node_From_Name --> Node_To_Name |control| A control link object with a symbolic name. This object is published as a label under the corresponding 'Links' folder.
-Node_From_Name.Port_From_Name --> Node_To_Name.Port_To_Name |data| A data link object with a symbolic name. This object is published as a label under the corresponding 'Links' folder.
-Node_From_Name.Port_From_Name --> Node_To_Name.Port_To_Name |stream| A datastream link object with a symbolic name. This object is published as a label under the corresponding 'Links' folder.
-Containers A folder under which a set of containers referenced from the currently edited schema is represented.
-Container_Name [note_] |container| A container definition (not instanciated during the edition). This object is published as a label under Containers parent object, and gives acces by the corresponding property page to its properties (cf. SALOME life cycle CORBA & Container manager).
-SALOME_Component_Name [note_] |component| A SALOME component instance definition (not instanciated during the edition). This object is published as a label under the container definition in which it includes.
-CORBA_Component_Name [note_] |component| A CORBA component object, which has the same name as a name of created component. This object is published as a label under the 'Containers' folder directly.
-\*Node_Name A reference to the service node published above. This object is published under the component object from which its service is taken.
-============================================================= ======================================= =====================================
+\*Node_Name A reference to the service node published above. This object is published
+ under the component object from which its service is taken.
+======================================= ======================================= ==============================================================================
.. _note:
~~~~~~~~~~~~~~~~~~~~~~~~~
-.. image:: images/tree_view_1.jpg
+.. image:: images/tree_view_1.png
:align: center
- :width: 40ex
.. _viewer:
+
2D Viewer
---------
-The user can display a presentation of the schema in the 2D Viewer based on the Qt drawing capabilities. The high-level 2D Viewer classes from SALOME GUI QxGraph package are used for this purpose. QxGraph classes also support interactive selection/hilighting in 2D View with the mouse, however selection capabilities will not be used in YACS GUI for SALOME 4.1.
+The user can display a presentation of the schema in the 2D Viewer based on the Qt drawing capabilities. The high-level 2D Viewer classes from SALOME GUI QxGraph package are used for this purpose. QxGraph classes also support interactive selection/hilighting in 2D View with the mouse.
-.. image:: images/2d_viewer_0.jpg
+.. image:: images/2d_viewer_0.png
:align: center
+.. centered::
+ **2D Viewer**
.. _view_operations_toolbar:
Input Panel
-----------
-The properties of each object type, such as container, component, schema, node and link (for the future version!), are displayed within the Input Panel placed in the right part of the desktop.
+The properties of each object type, such as container, component, schema, node and link, are displayed within the Input Panel placed in the right part of the desktop.
The Input Panel is a dock window and consists of the several property pages. Each property page allows seeing or modifying the properties of the object with the certain type (see :ref:`edit_object` section). The user can see property pages of the several types of objects at the same time (for example, property page for a service node and for a container).
The selection of an object either in the Tree View or 2D Viewer will display its property page in the Input Panel.
-.. image:: images/input_panel_0.jpg
+.. image:: images/input_panel_0.png
:align: center
- :width: 47ex
.. centered::
-.. image:: images/input_panel_1.jpg
+.. image:: images/input_panel_1.png
:align: center
- :width: 47ex
.. centered::
**Node property page in run mode**
-Python Console
---------------
-The Python Console permits the user to invoke some YACS functionality from Python, for example, import XML graph with old format (SALOME Supervisor) from Python Console. Example of usage:
-
-
-
-.. image:: images/python_console_0.jpg
- :align: center
-
-
+.. _catalogs_tree_view:
-Log Window
-----------
-The Log Window permits the user to follow the execution process of the schema. The YACS engine console output, including error messages, is redirected to the Log Window.
+Catalogs Tree View
+------------------
+The Catalog tree give acces to data types and node types from several catalogs. By default, the Builtin Catalog, the Session Catalog and the
+Preference Catalog are available. Builtin Catalog provides standard data types, standard elementary node types and all the Composed Nodes types.
+Session Catalog is built with all the Module Catalogs defined in the current SALOME Session. Preference Catalog is defined in the preferences.
+Any existing YACS schema file can be imported as a catalog, to allow reutilization of data types or component definition.
-
-.. image:: images/log_window_0.jpg
+.. image:: images/catalogs.png
:align: center
+.. centered::
+ **Catalog Tree View**
+
+++ /dev/null
-/*! \page gui_design GUI design
-
-
-\section Goals
-\arg Provide a general mechanism for the synchronisation of several views (tree views, 2D canvas views, edition dialogs).
-\arg Provide an interface of YACS::ENGINE for edition with a general mechanism for undo-redo.
-\arg Be as independent as possible of Qt (and SALOME), to avoid problems in Qt4 migration, and allow a potential re-use of YACS GUI outside SALOME.
-
-For the first goal, a subject/observers design pattern is used: several observers can attach or detach themselves to/from the subject. The subject send update events to the lists of observers. The subject does not know the implementation of the observers. The observers correspond to the different views in our case.
-If a selection event occurs in a view (select a node, for instance), a select event is sent to the corresponding subject. The subject sends selection events to all its observers.
-If a modification is generated in a view, (request to add a node, for example), the request is sent to the subject. The subject deals with the creation of the node, then sends update events to observers.
-
-For the second goal, a command design pattern is used: each action is stored in a command object witch provides execute() and reverse() methods. All necessary information for execute and undo the action must be stored in the command object.
-Commands are put in a stack of commands. Undo actions consists in depiling the stack.
-
-The following UML graphs corresponds approximately to the actual implementation, however, the generals principles are the same.
-
-\image html classDiagram.png "class diagram: subject/observers and command stack design patterns"
-
-The collaboration diagram below shows all the interactions between objects during a node creation. From left to right, we have 5 groups of objects, which are: YACS Engine, Commands, Subjects, and 2 Observers (a Tree View and a Canvas View).
-
-\image html createNodeCollaboration.png "Collaboration diagram for create node"
-
-\image html sequenceCreateNode.png "Sequence diagram for create node"
-
-\image html undoCreateNodeCollaboration.png "Collaboration diagram for undo create node"
-
-*/
-
.. _hxx2salome:
-hxx2salome : a Salome component generator
+hxx2salome : a SALOME component generator
==========================================
-This document is the following of the HELLO component documentation [R1]_, which presented the basis for the implementation of a Salome Component, and the CALCULATOR component documentation [H1]_, which introduced the use of MED within the Salome context. These two examples showed that implementing a Salome component doesn't require much imagination, it can be done by following some predefined rules. Thus, it is possible, provided a C++ standalone component, to wrap it into a Salome Component automatically. This document presents hxx2salome, a prototype tool for automatic Salome Component generation. This tool starts from the interface of a C++ component (an .hxx file), parse the public API , and use the type information to generate the Salome component (the IDL interface, and its implementation).
+This document is the following of the HELLO component documentation [R1]_, which presented the basis for the implementation of a SALOME Component, and the CALCULATOR component documentation [H1]_, which introduced the use of MED within the SALOME context. These two examples showed that implementing a SALOME component doesn't require much imagination, it can be done by following some predefined rules. Thus, it is possible, provided a C++ standalone component, to wrap it into a SALOME Component automatically. This document presents hxx2salome, a prototype tool for automatic SALOME Component generation. This tool starts from the interface of a C++ component (an .hxx file), parse the public API , and use the type information to generate the SALOME component (the IDL interface, and its implementation).
Getting started
---------------
-In this chapter, we will create from scratch a new Salome component that add and multiply integers, and compute a factorial. We suppose that hxx2salome (and the related tools SA_new_component and SA_build ) have been installed in a directory called $HXX2SALOME_ROOT_DIR , which is present in your $PATH .
+In this chapter, we will create from scratch a new SALOME component that add and multiply integers, and compute a factorial. We suppose that hxx2salome (and the related tools SA_new_component and SA_build ) have been installed in a directory called $HXX2SALOME_ROOT_DIR , which is present in your $PATH .
C++ component implementation
''''''''''''''''''''''''''''
$ SA_new_cpp_component CALC
$ ls CALC_CPP_SRC/
- adm archive AUTHORS build_configure ChangeLog configure.in.base Makefile.am NEWS README rfind root_clean src
+ adm archive AUTHORS build_configure ChangeLog configure.in.base
+ Makefile.am NEWS README rfind root_clean src
-A template python test file was also generated, that can be callable both from python and from salome. You can if you wish edit it and add the tests you want:
+A template python test file was also generated, that can be callable both from python and from SALOME. You can if you wish edit it and add the tests you want:
Before testing the component from python, it was necessary to update LD_LIBRARY_PATH and PYTHON_PATH environment variables.
-Salome component generation
+SALOME component generation
'''''''''''''''''''''''''''
-The C++ engine is finished, and tested - the final step is the integration inside salome. This is done using hxx2salome tool (the options used here are explained in Chapter 8.2 – the tool also has a graphical interface):
+The C++ engine is finished, and tested - the final step is the integration inside SALOME. This is done using hxx2salome tool (the options used here are explained in Chapter 8.2 – the tool also has a graphical interface):
::
- hxx2salome -c -e ${INTEGRATION_ROOT}/my_env_products.sh instalDir/CALC_CPP_INSTALL CALC.hxx libCALCCXX.so ${INTEGRATION_ROOT}
+ hxx2salome -c -e ${INTEGRATION_ROOT}/my_env_products.sh instalDir/CALC_CPP_INSTALL \
+ CALC.hxx libCALCCXX.so ${INTEGRATION_ROOT}
...
$ source ${INTEGRATION_ROOT}/my_env_products.sh
$ runSalome –-modules=CALC # launch salome with CALC compo
-The component can now be used inside salome, from the python embedded console, or from Supervision.
+The component can now be used inside SALOME, from the python embedded console, or from Supervision.
Let's first try to define more generally what components are. They are used to deliver reusable, “off-the-shelf” software unit for incorporation into large applications (such as frameworks) : a component can be deployed independently and is subject to third-party composition. Its aim is to improve efficiency for end-users. It has specified interfaces and explicit context dependencies only. It encapsulates small-scale abstractions within a given domain.
-A C++ component is a “high level” unit of reuse, based upon some source code libraries (developed in FORTRAN, C or C++). It takes the form of a C++ class. Its interface is the public API of this class, and is declared in an include file. It is designed to collaborate with other components . Therefore its API emphasizes the logical chains of computation a user can perform, and the data that may be exchanged with external world conform to standards (for example in the Salome context: basic types, MED types and XDATA types).
+A C++ component is a “high level” unit of reuse, based upon some source code libraries (developed in FORTRAN, C or C++). It takes the form of a C++ class. Its interface is the public API of this class, and is declared in an include file. It is designed to collaborate with other components . Therefore its API emphasizes the logical chains of computation a user can perform, and the data that may be exchanged with external world conform to standards (for example in the SALOME context: basic types, MED types and XDATA types).
For being more concrete, let's take the (simple) example of a steady-state neutronic component developed by CEA to work in collaboration with thermal-hydraulic and fuel-pin mechanics components. The interface of this component is:
.. image:: images/10000000000003210000012BF34ED8EC.png
- :width: 15.39cm
- :height: 5.74cm
+ :align: center
-Salome component architecture (insights)
+SALOME component architecture (insights)
----------------------------------------
-The Salome component architecture is based on CORBA , and has been optimized for big data transfers. The key points of the architecture are:
+The SALOME component architecture is based on CORBA , and has been optimized for big data transfers. The key points of the architecture are:
* Distributed components with the appearance of proximity. There is no difference between local and distant objects, the network exchanges are done by the CORBA bus, or MPI or any other protocol, everything being totally transparent for the end user, who just has to call methods on his “apparently local” objects.
.. image:: images/100000000000030C00000270AD87A128.png
- :width: 15cm
- :height: 12cm
+ :align: center
-The low level libraries are wrapped in a high level C++ component, that is exported to Python using SWIG, and for distribution and coupling to Salome using hxx2salome. Same scripts can be use in Python or within Salome.
+The low level libraries are wrapped in a high level C++ component, that is exported to Python using SWIG, and for distribution and coupling to SALOME using hxx2salome. Same scripts can be use in Python or within SALOME.
-Salome Component generation
+SALOME Component generation
---------------------------
-In this chapter, we explain briefly the approach used to pass from a C++ component (as described in chapter 1) to a Salome component.
+In this chapter, we explain briefly the approach used to pass from a C++ component (as described in chapter 1) to a SALOME component.
-A Salome component is defined by its IDL interface (as explained in ...). It is then implemented using a target language, for example C++ (this step is called the IDL to C++ mapping).
+A SALOME component is defined by its IDL interface (as explained in ...). It is then implemented using a target language, for example C++ (this step is called the IDL to C++ mapping).
-Here we are doing the opposite! We have a C++ component with its interface (the definition of a class in a header), and we want to get a Salome component (with its IDL interface, implemented using the C++ component). For doing this, we have to invert the IDL to C++ mapping. This is not feasible in a most general way (because of course user-defined C++ types don't have their counterpart in IDL). But if we restrict the C++ type to the mapping of the IDL types supported by Salome, then we have a way to go back from C++ to IDL .
+Here we are doing the opposite! We have a C++ component with its interface (the definition of a class in a header), and we want to get a SALOME component (with its IDL interface, implemented using the C++ component). For doing this, we have to invert the IDL to C++ mapping. This is not feasible in a most general way (because of course user-defined C++ types don't have their counterpart in IDL). But if we restrict the C++ type to the mapping of the IDL types supported by SALOME, then we have a way to go back from C++ to IDL .
-The operations performed for the Salome component generation are summed up in the following figure:
+The operations performed for the SALOME component generation are summed up in the following figure:
.. image:: images/1000000000000321000002300A9186FC.png
- :width: 15.401cm
+ :align: center
:height: 10.749cm
-After these operations, the generated files are inserted in a template Salome module (basically a clone of the CALCULATOR component described in ...). We obtain that way a full module ready for compiling.
+After these operations, the generated files are inserted in a template SALOME module (basically a clone of the CALCULATOR component described in ...). We obtain that way a full module ready for compiling.
IDL definition
--------------
-The IDL code generation is based upon the type analysis of the C++ public API . Of course, generation can be done only if there is a CORBA equivalent type. This is the case for all basic types. It is also the case for the MED types, because a CORBA level was developed ( MESH , SUPPORT and FIELD interfaces), and a Client level that allow to create local C++ MED objects from CORBA objects. This last point is important for code generation, because it simplify it greatly! (The only thing to do is to create a client object and pass it to the C++ API ). The last supported types are vectors, they are treated using the Sender/Receiver mechanism of Salome, thus optimizing the data transfer.
+The IDL code generation is based upon the type analysis of the C++ public API . Of course, generation can be done only if there is a CORBA equivalent type. This is the case for all basic types. It is also the case for the MED types, because a CORBA level was developed ( MESH , SUPPORT and FIELD interfaces), and a Client level that allow to create local C++ MED objects from CORBA objects. This last point is important for code generation, because it simplify it greatly! (The only thing to do is to create a client object and pass it to the C++ API ). The last supported types are vectors, they are treated using the Sender/Receiver mechanism of SALOME, thus optimizing the data transfer.
Correspondance for parameters
'''''''''''''''''''''''''''''
As we can see, **it is very important to take great care of the qualifiers used in the C++ interface** because they are interpreted. The determination of the ``in/out`` qualifier of ``IDL`` parameters is based upon the ``const`` and reference qualifier of C++ parameters. Basic types (passed by value in C++) are considered in parameters, references to basic types are considered out parameters. For user defined types, the ``const`` qualifier is interpreted as in parameter, and reference to pointer as out parameter.
-For simplification purpose, Salome doesn't allow the use of ``IDL inout`` parameters. For this reason, **non const pointers or references are not treated** .
+For simplification purpose, SALOME doesn't allow the use of ``IDL inout`` parameters. For this reason, **non const pointers or references are not treated** .
Correspondance for returned type
''''''''''''''''''''''''''''''''
module CoreComponent_ORB
{
- interface CoreComponent_Gen : Engines::Component,
+ interface CoreComponent_Gen : Engines::EngineComponent,
SALOME::MultiCommClass
{
void start();
IDL Implementation
------------------
-As explained in [R2]_ and [H2]_, the IDL implementation consists in writing a servant (an object that will perform the IDL contract). The source of this servant is composed in two files, named in Salome by convention <module_name>.hxx and <module_name>.cxx . The generated code for these two files is also based upon the type analysis of the C++ public API : for each C++ type, we know the IDL type that was associated (cf. Chapter 4), and consequently the code to generate. This code follows always the same scheme. We first generate the header <module_name>.hxx , which contains the class declaration of the servant, and is imposed by the rules of the C++ mapping of CORBA. We then generate <module_name>.cxx, which contains the class definition. For each method, we proceed in three steps :
+As explained in [R2]_ and [H2]_, the IDL implementation consists in writing a servant (an object that will perform the IDL contract). The source of this servant is composed in two files, named in SALOME by convention <module_name>.hxx and <module_name>.cxx . The generated code for these two files is also based upon the type analysis of the C++ public API : for each C++ type, we know the IDL type that was associated (cf. Chapter 4), and consequently the code to generate. This code follows always the same scheme. We first generate the header <module_name>.hxx , which contains the class declaration of the servant, and is imposed by the rules of the C++ mapping of CORBA. We then generate <module_name>.cxx, which contains the class definition. For each method, we proceed in three steps :
* Arguments processing : conversion of the types imposed by C++ mapping rules to the type of the C++ component. Of course, this conversion is always possible, because we have restricted the C++ component type to the one for which this operation is possible!
-* the update of Salome environment file.
+* the update of SALOME environment file.
You may finally also configure the hxx2salome script (it is not mandatory, but may facilitate usage). For configuring the script, you can set the two following variables defined at the beginning :
-* ENVIRON_FILE : salome2 environment file used for compilation. If present, hxx2salome will propose to compile new module (by sourcing ENVIRON_FILE file, and executing build_configure, configure, make & make install). It will also update this file with the new environment variable necessary to run generated module. This environment file can also be passed using **-e** option.
+* ENVIRON_FILE : SALOME environment file used for compilation. If present, hxx2salome will propose to compile new module (by sourcing ENVIRON_FILE file, and executing build_configure, configure, make & make install). It will also update this file with the new environment variable necessary to run generated module. This environment file can also be passed using **-e** option.
-* SALOMEdir : the directory where you want to install generated Salome component.
+* SALOMEdir : the directory where you want to install generated SALOME component.
(Of course, CPP.hxx and libCPP.so have to be found in CPPdir )
**-c** : to compile the component after code generation,
-**-l** : to launch salome with the component after compilation,
+**-l** : to launch SALOME with the component after compilation,
-**-e** : environment_file : to specify an salome environment file to source (for compiling)
+**-e** : environment_file : to specify an SALOME environment file to source (for compiling)
.. image:: images/100000000000021500000199FE12879E.png
- :width: 14.249cm
- :height: 10.82cm
+ :align: center
-Limitations – Advises
+Limitations – Advice
---------------------
-* The standalone C++ component should have a default constructor (a constructor without arguments). This is because there is no mechanism to transmit arguments from Salome to a user-defined component. If your component needs information to be valid, you have to split construction and initialization, by adding a method that does initialization.
+* The standalone C++ component should have a default constructor (a constructor without arguments). This is because there is no mechanism to transmit arguments from SALOME to a user-defined component. If your component needs information to be valid, you have to split construction and initialization, by adding a method that does initialization.
-* Only methods with compatible types (types listed in Chpater 5, for which a conversion from CORBA to C++ is available) are treated. If a method contains non compatible types, it is just ignored (it is not blocking, you'll just get a Salome component without the non compatibles methods).
+* Only methods with compatible types (types listed in Chapter 5, for which a conversion from CORBA to C++ is available) are treated. If a method contains non compatible types, it is just ignored (it is not blocking, you'll just get a SALOME component without the non compatibles methods).
-* The name of the C++ component (the name of the class), which provide the name of the Salome component, should be uppercase. This strange limitation is due to Salome.
+* The name of the C++ component (the name of the class), which provide the name of the SALOME component, should be uppercase. This strange limitation is due to SALOME.
-* The const qualifiers should be carefully analyzed, it impact the way Salome will manage memory. The critical case is if you have an internal field, and you (wrongly) return a non const pointer on it. Because the pointer is non const, it is considered that the Salome component takes ownership of the field, and consequently will delete it after usage – thus invalidating an internal pointer of your C++ component. Crash is the most frequent issue of this case...
+* The const qualifiers should be carefully analyzed, it impact the way SALOME will manage memory. The critical case is if you have an internal field, and you (wrongly) return a non const pointer on it. Because the pointer is non const, it is considered that the SALOME component takes ownership of the field, and consequently will delete it after usage – thus invalidating an internal pointer of your C++ component. Crash is the most frequent issue of this case...
-.. [H1] The MED Calculator component (N. Crouzet) (voir :ref:`calculator`).
-
-.. [H2] Integration de composants dans l'environnement PAL/Salome (M. Tajchman).
+.. [H1] The MED Calculator component (N. Crouzet) (see :ref:`calculator`).
+.. [H2] Integration of components into the SALOME environment (M. Tajchman) (see :ref:`components`)
--- /dev/null
+#FIG 3.2 Produced by xfig version 3.2.5
+Portrait
+Center
+Inches
+Letter
+100.00
+Single
+-2
+1200 2
+0 32 #8b898b
+6 4575 900 6300 1575
+2 1 1 3 1 7 50 0 -1 8.000 0 0 -1 1 1 2
+ 2 1 2.00 90.00 150.00
+ 2 1 2.00 90.00 150.00
+ 4650 1275 6225 1275
+4 0 0 50 0 0 12 0.0000 4 135 1185 4800 1050 CORBA bus\001
+4 0 0 50 0 0 12 0.0000 4 135 510 5100 1575 network\001
+-6
+6 6150 600 9300 4800
+6 6750 1950 9075 2700
+6 6900 2100 8100 2475
+4 0 0 50 0 0 12 0.0000 4 135 1215 6900 2250 CORBA\001
+4 0 0 50 0 0 12 0.0000 4 135 675 6900 2475 client interface\001
+-6
+2 2 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 5
+ 6750 1950 9075 1950 9075 2700 6750 2700 6750 1950
+-6
+2 2 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 5
+ 6450 900 9300 900 9300 4800 6450 4800 6450 900
+2 2 0 3 32 7 50 0 -1 0.000 0 0 -1 0 0 5
+ 6750 3300 9075 3300 9075 4500 6750 4500 6750 3300
+2 1 0 3 1 7 50 0 -1 0.000 0 0 -1 1 1 2
+ 2 1 2.00 90.00 150.00
+ 2 1 2.00 90.00 150.00
+ 8625 2475 8625 3600
+2 1 0 3 1 7 50 0 -1 0.000 0 0 -1 1 1 2
+ 2 1 2.00 90.00 150.00
+ 2 1 2.00 90.00 150.00
+ 8625 1200 8625 2175
+2 1 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 4
+ 6150 1125 9150 1125 9150 1425 6150 1425
+4 0 0 50 0 0 12 0.0000 4 135 1230 6525 750 CORBA client\001
+4 0 0 50 0 0 12 0.0000 4 135 990 6825 3150 Client code\001
+-6
+6 1800 2025 4050 2775
+6 1875 2175 3300 2550
+4 0 0 50 0 0 12 0.0000 4 135 1335 1945 2325 CORBA\001
+4 0 0 50 0 0 12 0.0000 4 135 675 1945 2550 interface server\001
+-6
+2 2 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 5
+ 1800 2025 4050 2025 4050 2775 1800 2775 1800 2025
+-6
+2 2 0 1 0 32 50 0 20 0.000 0 0 -1 0 0 5
+ 1800 3300 4050 3300 4050 4575 1800 4575 1800 3300
+2 2 0 3 1 7 50 0 -1 0.000 0 0 -1 0 0 5
+ 1650 1800 4200 1800 4200 4725 1650 4725 1650 1800
+2 2 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 5
+ 1500 900 4350 900 4350 4875 1500 4875 1500 900
+2 1 0 3 1 7 50 0 -1 0.000 0 0 -1 1 1 2
+ 2 1 2.00 90.00 150.00
+ 2 1 2.00 90.00 150.00
+ 3450 1350 3450 2250
+2 1 0 3 1 7 50 0 -1 0.000 0 0 -1 1 1 2
+ 2 1 2.00 90.00 150.00
+ 2 1 2.00 90.00 150.00
+ 3450 2475 3450 3525
+2 1 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 4
+ 4650 1125 1725 1125 1725 1425 4650 1425
+4 0 0 50 0 0 12 0.0000 4 180 1185 1800 3225 Internal object\001
+4 0 0 50 0 0 12 0.0000 4 180 1455 1725 1650 Corba component\001
+4 0 0 50 0 0 12 0.0000 4 135 1200 1575 750 CORBA server\001
--- /dev/null
+#FIG 3.2\r
+Portrait\r
+Center\r
+Inches\r
+Letter \r
+100.00\r
+Single\r
+-2\r
+1200 2\r
+0 32 #8c8a8c\r
+6 1800 2025 4050 2775\r
+6 1945 2190 3250 2550\r
+4 0 0 50 0 0 12 0.0000 4 135 1305 1945 2325 CORBA server\001\r
+4 0 0 50 0 0 12 0.0000 4 135 630 1945 2550 interface\001\r
+-6\r
+2 2 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 1800 2025 4050 2025 4050 2775 1800 2775 1800 2025\r
+-6\r
+6 4635 915 6240 1575\r
+2 1 1 3 1 7 50 0 -1 8.000 0 0 -1 1 1 2\r
+ 2 1 2.00 90.00 150.00\r
+ 2 1 2.00 90.00 150.00\r
+ 4650 1275 6225 1275\r
+4 0 0 50 0 0 12 0.0000 4 135 1125 4800 1050 CORBA bus\001\r
+4 0 0 50 0 0 12 0.0000 4 135 510 5100 1575 network\001\r
+-6\r
+6 6150 615 9300 4800\r
+6 6750 1950 9075 2700\r
+6 6900 2115 8055 2475\r
+4 0 0 50 0 0 12 0.0000 4 135 1155 6900 2250 CORBA client\001\r
+4 0 0 50 0 0 12 0.0000 4 135 630 6900 2475 interface\001\r
+-6\r
+2 2 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 6750 1950 9075 1950 9075 2700 6750 2700 6750 1950\r
+-6\r
+2 2 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 6450 900 9300 900 9300 4800 6450 4800 6450 900\r
+2 2 0 3 32 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 6750 3300 9075 3300 9075 4500 6750 4500 6750 3300\r
+2 1 0 3 1 7 50 0 -1 0.000 0 0 -1 1 1 2\r
+ 2 1 2.00 90.00 150.00\r
+ 2 1 2.00 90.00 150.00\r
+ 8625 2475 8625 3600\r
+2 1 0 3 1 7 50 0 -1 0.000 0 0 -1 1 1 2\r
+ 2 1 2.00 90.00 150.00\r
+ 2 1 2.00 90.00 150.00\r
+ 8625 1200 8625 2175\r
+2 1 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 4\r
+ 6150 1125 9150 1125 9150 1425 6150 1425\r
+4 0 0 50 0 0 12 0.0000 4 135 1125 6525 750 CORBA client\001\r
+4 0 0 50 0 0 12 0.0000 4 135 885 6825 3150 Client code\001\r
+-6\r
+6 4650 1950 6150 4125\r
+2 1 0 2 4 7 50 0 -1 0.000 0 0 -1 0 0 3\r
+ 6075 3750 5775 3750 5775 4050\r
+2 1 0 2 4 7 50 0 -1 0.000 0 0 -1 0 0 6\r
+ 4725 2025 4725 4050 5775 4050 6075 3750 6075 2025 4725 2025\r
+4 0 0 50 0 0 12 0.0000 4 135 870 4950 2325 IDL file\001\r
+-6\r
+2 2 0 1 0 32 50 0 20 0.000 0 0 -1 0 0 5\r
+ 1800 3300 4050 3300 4050 4575 1800 4575 1800 3300\r
+2 2 0 3 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 1650 1800 4200 1800 4200 4725 1650 4725 1650 1800\r
+2 2 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 1500 900 4350 900 4350 4875 1500 4875 1500 900\r
+2 1 0 3 1 7 50 0 -1 0.000 0 0 -1 1 1 2\r
+ 2 1 2.00 90.00 150.00\r
+ 2 1 2.00 90.00 150.00\r
+ 3450 1350 3450 2250\r
+2 1 0 3 1 7 50 0 -1 0.000 0 0 -1 1 1 2\r
+ 2 1 2.00 90.00 150.00\r
+ 2 1 2.00 90.00 150.00\r
+ 3450 2475 3450 3525\r
+2 1 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 4\r
+ 4650 1125 1725 1125 1725 1425 4650 1425\r
+2 1 0 10 4 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 1 1 6.00 180.00 210.00\r
+ 4725 2400 4050 2400\r
+2 1 0 10 4 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 1 1 6.00 180.00 210.00\r
+ 6075 2400 6750 2400\r
+4 0 0 50 0 0 12 0.0000 4 180 990 1800 3225 Internal object\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1350 1725 1650 Corba component\001\r
+4 0 0 50 0 0 12 0.0000 4 135 1260 1575 750 CORBA server\001\r
--- /dev/null
+#FIG 3.2\r
+Portrait\r
+Center\r
+Inches\r
+Letter \r
+100.00\r
+Single\r
+-2\r
+1200 2\r
+6 1500 825 7200 1425\r
+2 2 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 1500 825 7200 825 7200 1425 1500 1425 1500 825\r
+4 0 0 50 0 0 12 0.0000 4 180 1455 1800 1200 Python interpreter\001\r
+-6\r
+6 1500 3150 3975 4725\r
+6 1725 3300 2625 3675\r
+4 0 0 50 0 0 12 0.0000 4 180 420 1725 3450 C++ internal\001\r
+4 0 0 50 0 0 12 0.0000 4 135 900 1725 3675 object\001\r
+-6\r
+2 2 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 1500 3150 3975 3150 3975 4725 1500 4725 1500 3150\r
+-6\r
+6 4575 3150 7200 4725\r
+6 4725 3300 5850 3750\r
+4 0 0 50 0 0 12 0.0000 4 180 420 4725 3450 Python internal\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1080 4725 3675 object\001\r
+-6\r
+2 2 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 4575 3150 7200 3150 7200 4725 4575 4725 4575 3150\r
+-6\r
+6 1500 2025 3975 2550\r
+2 2 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 1500 2025 3975 2025 3975 2550 1500 2550 1500 2025\r
+4 0 0 50 0 0 12 0.0000 4 180 1770 1725 2325 C++ - python interface\001\r
+-6\r
+2 1 0 5 1 7 50 0 -1 0.000 0 0 -1 1 1 2\r
+ 2 1 2.00 150.00 150.00\r
+ 2 1 2.00 150.00 150.00\r
+ 2700 2550 2700 3150\r
+2 1 0 5 1 7 50 0 -1 0.000 0 0 -1 1 1 2\r
+ 2 1 2.00 150.00 150.00\r
+ 2 1 2.00 150.00 150.00\r
+ 2700 1425 2700 2025\r
+2 1 0 5 1 7 50 0 -1 0.000 0 0 -1 1 1 2\r
+ 2 1 2.00 150.00 150.00\r
+ 2 1 2.00 150.00 150.00\r
+ 5850 1425 5850 3150\r
+2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 1350 1725 4200 1725 4200 5325 1350 5325 1350 1725\r
+2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 4350 1725 7425 1725 7425 5325 4350 5325 4350 1725\r
+4 0 0 50 0 0 12 0.0000 4 180 1260 2700 5175 Local component\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1260 5925 5175 Local component\001\r
--- /dev/null
+#FIG 3.2\r
+Portrait\r
+Center\r
+Inches\r
+Letter \r
+100.00\r
+Single\r
+-2\r
+1200 2\r
+0 32 #8c8a8c\r
+6 3225 2475 4125 3150\r
+4 0 0 50 0 0 12 0.0000 4 135 690 3225 2625 Python/C++\001\r
+4 0 0 50 0 0 12 0.0000 4 180 885 3225 2850 interface\001\r
+4 0 0 50 0 0 12 0.0000 4 180 900 3225 3075 (through SWIG)\001\r
+-6\r
+6 6315 3105 7140 3555\r
+4 0 1 50 0 0 12 0.0000 4 135 645 6315 3255 managed\001\r
+4 0 1 50 0 0 12 0.0000 4 180 765 6315 3480 by SWIG\001\r
+-6\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 4425 2700 5925 2700 5925 3075 4425 3075 4425 2700\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 3600 4200 5025 4200 5025 4575 3600 4575 3600 4200\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 5400 4200 6900 4200 6900 4575 5400 4575 5400 4200\r
+2 1 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 4\r
+ 5100 3075 5100 3525 4275 3525 4275 4200\r
+2 1 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 4\r
+ 5100 3075 5100 3525 6150 3525 6150 4200\r
+2 1 0 2 1 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 1 1 2.00 90.00 150.00\r
+ 5100 3075 5100 3450\r
+2 1 0 2 1 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 1 1 2.00 90.00 150.00\r
+ 4275 3525 4275 4050\r
+2 1 0 2 1 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 1 1 2.00 90.00 150.00\r
+ 6150 3525 6150 4050\r
+2 2 0 2 4 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 3075 1500 7200 1500 7200 2100 3075 2100 3075 1500\r
+2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 3\r
+ 2 1 2.00 75.00 120.00\r
+ 8925 2325 7275 2325 6000 2850\r
+2 2 0 2 4 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 3075 2400 7200 2400 7200 4725 3075 4725 3075 2400\r
+2 1 0 1 1 7 50 0 -1 0.000 0 0 -1 1 0 3\r
+ 2 1 2.00 60.00 90.00\r
+ 7050 3300 5700 3300 4650 4200\r
+2 1 0 1 1 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 2.00 60.00 90.00\r
+ 5700 3300 5850 4200\r
+4 0 0 50 0 0 12 0.0000 4 135 225 4650 3000 A.i\001\r
+4 0 0 50 0 0 12 0.0000 4 180 360 3825 4500 A.py\001\r
+4 0 0 50 0 0 12 0.0000 4 180 915 5625 4500 A_wrap.cxx\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1635 3225 1875 C++ internal object: A\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1635 7350 2250 Written by integrator\001\r
--- /dev/null
+#FIG 3.2\r
+Portrait\r
+Center\r
+Inches\r
+Letter \r
+100.00\r
+Single\r
+-2\r
+1200 2\r
+2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 1950 2625 2850 2625 2850 3225 1950 3225 1950 2625\r
+2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 1575 2325 6000 2325 6000 4950 1575 4950 1575 2325\r
+2 1 0 3 1 7 50 0 -1 0.000 0 0 -1 1 1 2\r
+ 2 1 3.00 120.00 120.00\r
+ 2 1 3.00 120.00 120.00\r
+ 2325 1725 2325 2625\r
+2 1 0 3 1 7 50 0 -1 0.000 0 0 -1 1 1 2\r
+ 2 1 3.00 120.00 120.00\r
+ 2 1 3.00 120.00 120.00\r
+ 2400 3225 2400 4125\r
+2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 1950 4125 5550 4125 5550 4575 1950 4575 1950 4125\r
+2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 1575 1125 6000 1125 6000 1725 1575 1725 1575 1125\r
+2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 4650 2625 5625 2625 5625 3225 4650 3225 4650 2625\r
+2 1 0 3 1 7 50 0 -1 0.000 0 0 -1 1 1 2\r
+ 2 1 3.00 120.00 120.00\r
+ 2 1 3.00 120.00 120.00\r
+ 5175 3225 5175 4125\r
+2 1 0 3 1 7 50 0 -1 0.000 0 0 -1 1 1 2\r
+ 2 1 3.00 120.00 120.00\r
+ 2 1 3.00 120.00 120.00\r
+ 5175 1725 5175 2625\r
+2 1 1 3 1 7 50 0 -1 8.000 0 0 -1 1 1 2\r
+ 2 1 3.00 120.00 120.00\r
+ 2 1 3.00 120.00 120.00\r
+ 3750 1725 3750 2625\r
+2 2 1 2 0 7 50 0 -1 6.000 0 0 -1 0 0 5\r
+ 3225 2625 4275 2625 4275 3225 3225 3225 3225 2625\r
+2 1 1 3 1 7 50 0 -1 8.000 0 0 -1 1 1 2\r
+ 2 1 3.00 120.00 120.00\r
+ 2 1 3.00 120.00 120.00\r
+ 3750 3225 3750 4125\r
+4 0 0 50 0 0 12 0.0000 4 135 825 3150 4425 Common C\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1455 2775 1500 Python interpreter\001\r
+4 0 0 50 0 0 12 0.0000 4 135 150 4875 3000 f2\001\r
+4 0 0 50 0 0 12 0.0000 4 135 825 3300 3150 Common C\001\r
+4 0 0 50 0 0 12 0.0000 4 180 525 3300 2925 set/get\001\r
+4 0 0 50 0 0 12 0.0000 4 135 150 2175 3000 f1\001\r
--- /dev/null
+#FIG 3.2\r
+Portrait\r
+Center\r
+Inches\r
+Letter \r
+100.00\r
+Single\r
+-2\r
+1200 2\r
+6 1875 450 6825 975\r
+6 3450 675 4950 900\r
+4 0 0 50 0 0 12 0.0000 4 180 1455 3450 825 Python interpreter\001\r
+-6\r
+2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 1875 450 6825 450 6825 975 1875 975 1875 450\r
+-6\r
+2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 1875 1575 3750 1575 3750 3300 1875 3300 1875 1575\r
+2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 4950 1575 6825 1575 6825 3300 4950 3300 4950 1575\r
+2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 5100 2700 6675 2700 6675 3150 5100 3150 5100 2700\r
+2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 2025 2700 3600 2700 3600 3150 2025 3150 2025 2700\r
+2 1 0 3 1 7 50 0 -1 0.000 0 0 -1 1 1 2\r
+ 1 1 3.00 120.00 120.00\r
+ 1 1 3.00 120.00 120.00\r
+ 2775 1575 2775 975\r
+2 1 0 3 1 7 50 0 -1 0.000 0 0 -1 1 1 2\r
+ 1 1 3.00 120.00 120.00\r
+ 1 1 3.00 120.00 120.00\r
+ 5775 1575 5775 975\r
+2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 2025 2175 2850 2175 2850 2550 2025 2550 2025 2175\r
+2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 5100 2175 5925 2175 5925 2550 5100 2550 5100 2175\r
+2 1 0 3 0 7 50 0 -1 0.000 0 0 -1 0 0 2\r
+ 2475 2550 2475 2700\r
+2 1 0 3 0 7 50 0 -1 0.000 0 0 -1 0 0 2\r
+ 5550 2550 5550 2700\r
+2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 1650 150 7275 150 7275 3900 1650 3900 1650 150\r
+3 2 0 3 4 7 50 0 -1 0.000 0 1 1 3\r
+ 2 1 3.00 120.00 120.00\r
+ 2 1 3.00 120.00 120.00\r
+ 3600 2925 4350 3375 5100 2925\r
+ 0.000 -1.000 0.000\r
+4 0 0 50 0 0 12 0.0000 4 180 990 2175 1950 Component 1\001\r
+4 0 0 50 0 0 12 0.0000 4 180 990 5250 1950 Component 2\001\r
+4 0 0 50 0 0 12 0.0000 4 135 1185 5175 3000 Common C\001\r
+4 0 0 50 0 0 12 0.0000 4 135 1185 2100 3000 Common C\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1335 3750 3600 Synchronisation ?\001\r
+4 0 0 50 0 0 12 0.0000 4 135 150 2325 2400 f1\001\r
+4 0 0 50 0 0 12 0.0000 4 135 150 5325 2400 f2\001\r
+4 0 0 50 0 0 12 0.0000 4 135 660 6300 3750 Machine\001\r
--- /dev/null
+#FIG 3.2\r
+Portrait\r
+Center\r
+Inches\r
+Letter \r
+100.00\r
+Single\r
+-2\r
+1200 2\r
+6 1275 525 7800 1050\r
+2 1 1 2 0 7 50 0 -1 4.000 0 0 -1 0 0 2\r
+ 2775 975 6300 975\r
+2 1 1 2 0 7 50 0 -1 4.000 0 0 -1 0 0 2\r
+ 2775 600 6300 600\r
+2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 4\r
+ 2775 600 1350 600 1350 975 2775 975\r
+2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 4\r
+ 6300 600 7725 600 7725 975 6300 975\r
+4 0 0 50 0 0 12 0.0000 4 135 1575 3675 825 CORBA/SALOME bus\001\r
+-6\r
+2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 1875 1575 3750 1575 3750 3300 1875 3300 1875 1575\r
+2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 4950 1575 6825 1575 6825 3300 4950 3300 4950 1575\r
+2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 5100 2700 6675 2700 6675 3150 5100 3150 5100 2700\r
+2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 2025 2700 3600 2700 3600 3150 2025 3150 2025 2700\r
+2 1 0 3 1 7 50 0 -1 0.000 0 0 -1 1 1 2\r
+ 1 1 3.00 120.00 120.00\r
+ 1 1 3.00 120.00 120.00\r
+ 2775 1575 2775 975\r
+2 1 0 3 1 7 50 0 -1 0.000 0 0 -1 1 1 2\r
+ 1 1 3.00 120.00 120.00\r
+ 1 1 3.00 120.00 120.00\r
+ 5775 1575 5775 975\r
+2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 3975 1425 1350 1425 1350 3675 3975 3675 3975 1425\r
+2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 4800 1425 7725 1425 7725 3675 4800 3675 4800 1425\r
+2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 2025 2175 2925 2175 2925 2550 2025 2550 2025 2175\r
+2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 5100 2175 6000 2175 6000 2550 5100 2550 5100 2175\r
+2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 2\r
+ 2475 2550 2475 2700\r
+2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 2\r
+ 5550 2550 5550 2700\r
+3 2 0 3 4 7 50 0 -1 0.000 0 1 1 3\r
+ 2 1 3.00 120.00 120.00\r
+ 2 1 3.00 120.00 120.00\r
+ 3375 3150 4350 3825 5550 3150\r
+ 0.000 -1.000 0.000\r
+4 0 0 50 0 0 12 0.0000 4 180 990 2175 1950 Component 1\001\r
+4 0 0 50 0 0 12 0.0000 4 180 990 5250 1950 Component 2\001\r
+4 0 0 50 0 0 12 0.0000 4 135 1185 5175 3000 Common C\001\r
+4 0 0 50 0 0 12 0.0000 4 135 1185 2100 3000 Common C\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1695 1425 3600 Container (machine1)\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1650 6000 3600 Container (machine2)\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1335 3750 4050 Synchronisation ?\001\r
+4 0 0 50 0 0 12 0.0000 4 135 150 2175 2400 f1\001\r
+4 0 0 50 0 0 12 0.0000 4 135 150 5250 2400 f2\001\r
--- /dev/null
+#FIG 3.2\r
+Portrait\r
+Center\r
+Inches\r
+Letter \r
+100.00\r
+Single\r
+-2\r
+1200 2\r
+0 32 #8c8a8c\r
+6 3975 4575 4725 5775\r
+1 2 0 1 0 7 48 0 20 0.000 1 0.0000 4387 4764 338 188 4049 4764 4725 4764\r
+1 2 0 1 0 7 55 0 20 0.000 1 0.0000 4387 5550 338 188 4049 5550 4725 5550\r
+2 2 0 1 7 7 50 0 20 0.000 0 0 -1 0 0 5\r
+ 4050 4801 4725 4801 4725 5550 4050 5550 4050 4801\r
+2 1 0 1 0 7 45 0 -1 0.000 0 0 -1 0 0 2\r
+ 4725 4801 4725 5550\r
+2 1 0 1 0 7 45 0 -1 0.000 0 0 -1 0 0 2\r
+ 4050 4801 4050 5550\r
+-6\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 3600 1050 5925 1050 5925 1800 3600 1800 3600 1050\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 4575 2700 6075 2700 6075 3150 4575 3150 4575 2700\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 5025 3675 6525 3675 6525 4125 5025 4125 5025 3675\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 6900 3675 8325 3675 8325 4125 6900 4125 6900 3675\r
+2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 3600 2100 9075 2100 9075 6000 3600 6000 3600 2100\r
+2 1 0 2 4 7 50 0 -1 0.000 0 0 -1 1 1 2\r
+ 2 1 2.00 90.00 150.00\r
+ 2 1 2.00 90.00 150.00\r
+ 8325 3900 9900 3900\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 4575 2475 8775 2475 8775 4350 4575 4350 4575 2475\r
+2 1 0 2 4 7 50 0 -1 0.000 0 0 -1 0 1 2\r
+ 2 1 2.00 90.00 150.00\r
+ 5925 1350 9825 1350\r
+3 0 0 2 32 7 50 0 -1 0.000 0 1 0 3\r
+ 2 1 2.00 90.00 150.00\r
+ 4725 5250 5700 5250 5700 4125\r
+ 0.000 1.000 0.000\r
+3 2 0 2 32 7 50 0 -1 0.000 0 0 1 4\r
+ 2 1 2.00 90.00 150.00\r
+ 4050 5175 3375 4875 3825 3525 4575 3000\r
+ 0.000 -1.000 -1.000 0.000\r
+3 2 0 2 32 7 50 0 -1 0.000 0 1 0 3\r
+ 2 1 2.00 90.00 150.00\r
+ 3975 1800 3975 2475 4575 2850\r
+ 0.000 -1.000 0.000\r
+4 0 0 50 0 0 12 0.0000 4 135 90 9300 3750 5\001\r
+4 0 0 50 0 0 12 0.0000 4 135 660 8400 1950 Machine\001\r
+4 0 0 50 0 0 12 0.0000 4 135 780 4575 2400 Container\001\r
+4 0 0 50 0 0 12 0.0000 4 180 855 5100 3900 Component\001\r
+4 0 0 50 0 0 12 0.0000 4 180 855 6975 3900 Component\001\r
+4 0 0 50 0 0 12 0.0000 4 180 540 4125 5175 Disk\001\r
+4 0 0 50 0 0 12 0.0000 4 180 585 4650 2925 Factory\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1095 3750 1350 SALOME kernel\001\r
+4 0 0 50 0 0 12 0.0000 4 135 90 5775 4950 4\001\r
+4 0 0 50 0 0 12 0.0000 4 135 90 3750 3375 3\001\r
+4 0 0 50 0 0 12 0.0000 4 135 90 4125 2400 2\001\r
+4 0 0 50 0 0 12 0.0000 4 135 90 7800 1200 1\001\r
--- /dev/null
+#FIG 3.2\r
+Portrait\r
+Center\r
+Inches\r
+Letter \r
+100.00\r
+Single\r
+-2\r
+1200 2\r
+0 32 #8c8a8c\r
+2 3 0 2 4 7 50 0 -1 0.000 0 0 -1 0 0 7\r
+ 375 450 3525 450 3525 2850 5175 2850 5175 4875 375 4875\r
+ 375 450\r
+2 1 0 2 1 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 4.00 75.00 75.00\r
+ 4800 2025 3825 3075\r
+2 1 0 2 1 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 3.00 75.00 75.00\r
+ 4800 2025 5925 3075\r
+2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 3.00 75.00 75.00\r
+ 3832 675 2925 1725\r
+2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 3\r
+ 2 1 3.00 75.00 75.00\r
+ 5700 675 3855 675 4500 1275\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 675 1725 2925 1725 2925 2700 675 2700 675 1725\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 2625 3075 4875 3075 4875 4500 2625 4500 2625 3075\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 5550 3075 7875 3075 7875 4500 5550 4500 5550 3075\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 4350 1275 5700 1275 5700 2025 4350 2025 4350 1275\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 675 675 2925 675 2925 1425 675 1425 675 675\r
+4 0 0 50 0 0 12 0.0000 4 180 1905 450 300 CORBA C++ component\001\r
+4 0 1 50 0 0 12 0.0000 4 180 1635 6000 2400 Managed by CORBA\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1725 3975 600 Written by integrator\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1875 900 2025 Implementation class\001\r
+4 0 0 50 0 0 12 0.0000 4 135 345 5700 3450 Stub\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1425 5700 3675 (CORBA interface\001\r
+4 0 0 50 0 0 12 0.0000 4 180 870 5700 3900 on client end)\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1425 2850 3675 (CORBA interface\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1020 2850 3900 on server end)\001\r
+4 0 0 50 0 0 12 0.0000 4 135 1005 4500 1575 IDL file: \001\r
+4 0 0 50 0 0 12 0.0000 4 135 360 4500 1800 A.idl\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1095 2850 3450 C++ skeleton\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1725 900 2250 C++ : A_i.cxx, A_i.hxx\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1365 900 975 C++ internal object\001\r
--- /dev/null
+#FIG 3.2\r
+Portrait\r
+Center\r
+Inches\r
+Letter \r
+100.00\r
+Single\r
+-2\r
+1200 2\r
+0 32 #8c8a8c\r
+6 600 600 3000 1500\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 675 675 2925 675 2925 1425 675 1425 675 675\r
+4 0 0 50 0 0 12 0.0000 4 180 990 900 975 Python internal\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1005 900 1200 object: A.py\001\r
+-6\r
+6 600 1650 3000 2775\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 675 1725 2925 1725 2925 2700 675 2700 675 1725\r
+4 0 0 50 0 0 12 0.0000 4 180 1875 900 2025 Python implementation\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1140 900 2250 class: A_i.py\001\r
+-6\r
+6 2550 3000 4950 4575\r
+6 2850 3300 4275 3975\r
+4 0 0 50 0 0 12 0.0000 4 180 1275 2850 3450 Python skeleton\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1425 2850 3675 (CORBA interface\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1020 2850 3900 on server end)\001\r
+-6\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 2625 3075 4875 3075 4875 4500 2625 4500 2625 3075\r
+-6\r
+6 5475 3000 7950 4575\r
+6 5700 3300 7125 3975\r
+4 0 0 50 0 0 12 0.0000 4 135 345 5700 3450 Stub\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1425 5700 3675 (CORBA interface\001\r
+4 0 0 50 0 0 12 0.0000 4 180 870 5700 3900 on client end)\001\r
+-6\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 5550 3075 7875 3075 7875 4500 5550 4500 5550 3075\r
+-6\r
+6 4275 1200 5775 2100\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 4350 1275 5700 1275 5700 2025 4350 2025 4350 1275\r
+4 0 0 50 0 0 12 0.0000 4 135 1005 4500 1575 IDL file: \001\r
+4 0 0 50 0 0 12 0.0000 4 135 360 4500 1800 A.idl\001\r
+-6\r
+2 3 0 2 4 7 50 0 -1 0.000 0 0 -1 0 0 7\r
+ 375 450 3525 450 3525 2850 5175 2850 5175 4875 375 4875\r
+ 375 450\r
+2 1 0 2 1 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 4.00 75.00 75.00\r
+ 4800 2025 3825 3075\r
+2 1 0 2 1 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 3.00 75.00 75.00\r
+ 4800 2025 5925 3075\r
+2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 3\r
+ 2 1 3.00 75.00 75.00\r
+ 5700 675 3825 675 4500 1275\r
+2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 3.00 75.00 75.00\r
+ 3802 664 2938 1753\r
+4 0 0 50 0 0 12 0.0000 4 180 2085 450 300 Python CORBA component\001\r
+4 0 1 50 0 0 12 0.0000 4 180 1605 6000 2400 managed by CORBA\001\r
+4 0 0 50 0 0 12 0.0000 4 225 1725 3975 600 Written by integrator\001\r
--- /dev/null
+#FIG 3.2\r
+Portrait\r
+Center\r
+Inches\r
+Letter \r
+100.00\r
+Single\r
+-2\r
+1200 2\r
+6 2400 2700 3900 3375\r
+4 0 0 50 0 0 12 0.0000 4 180 1485 2400 2850 Attributes (common,\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1410 2400 3075 global variables,\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1125 2400 3300 object state)\001\r
+-6\r
+2 1 0 10 0 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 4.00 180.00 180.00\r
+ 1275 3225 2250 3225\r
+2 1 0 10 0 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 4.00 180.00 180.00\r
+ 2250 3525 1275 3525\r
+2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 2250 1500 5850 1500 5850 2400 2250 2400 2250 1500\r
+2 1 0 10 0 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 4.00 180.00 180.00\r
+ 1125 1800 2250 1800\r
+2 1 0 10 0 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 4.00 180.00 180.00\r
+ 2250 2100 1125 2100\r
+2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 2250 2550 4650 2550 4650 3675 2250 3675 2250 2550\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 2250 3825 5925 3825 5925 4500 2250 4500 2250 3825\r
+2 1 0 9 4 7 50 0 -1 0.000 0 0 -1 0 0 2\r
+ 5250 2100 5250 4050\r
+2 1 0 10 4 7 50 0 -1 0.000 0 0 -1 0 0 2\r
+ 4125 2250 4125 2700\r
+2 1 0 10 4 7 50 0 -1 0.000 0 0 -1 0 0 2\r
+ 4125 3525 4125 4050\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 2175 900 6000 900 6000 4575 2175 4575 2175 900\r
+4 0 0 50 0 0 12 0.0000 4 180 990 2325 1275 Internal object\001\r
+4 0 0 50 0 0 12 0.0000 4 135 330 825 3300 SET\001\r
+4 0 0 50 0 0 12 0.0000 4 135 360 825 3600 GET\001\r
+4 0 0 50 0 0 12 0.0000 4 180 720 675 1350 Requests\001\r
+4 0 0 50 0 0 12 0.0000 4 180 750 900 1650 param. IN\001\r
+4 0 0 50 0 0 12 0.0000 4 180 930 825 2475 param. OUT\001\r
+4 0 0 50 0 0 12 0.0000 4 135 855 2400 4125 Initial code\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1605 2400 1800 Methods (services)\001\r
--- /dev/null
+#FIG 3.2\r
+Portrait\r
+Center\r
+Inches\r
+Letter \r
+100.00\r
+Single\r
+-2\r
+1200 2\r
+6 2400 2700 3900 3375\r
+4 0 0 50 0 0 12 0.0000 4 180 1485 2400 2850 Attributes (common,\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1410 2400 3075 global variables,\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1125 2400 3300 object state)\001\r
+-6\r
+2 1 0 10 4 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 4.00 180.00 180.00\r
+ 4650 1800 5625 1800\r
+2 1 0 10 4 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 4.00 180.00 180.00\r
+ 5625 2100 4650 2100\r
+2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 2250 1500 4650 1500 4650 2250 2250 2250 2250 1500\r
+2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 2250 2550 4275 2550 4275 3525 2250 3525 2250 2550\r
+2 1 0 10 4 7 50 0 -1 0.000 0 0 -1 0 0 2\r
+ 3975 2175 3975 2625\r
+2 1 0 10 0 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 4.00 180.00 180.00\r
+ 1125 1725 2250 1725\r
+2 1 0 10 0 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 4.00 180.00 180.00\r
+ 2250 2025 1125 2025\r
+2 1 0 10 0 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 4.00 180.00 180.00\r
+ 1275 2850 2250 2850\r
+2 1 0 10 0 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 4.00 180.00 180.00\r
+ 2250 3150 1275 3150\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 2175 975 4725 975 4725 4050 2175 4050 2175 975\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 5625 975 8325 975 8325 4050 5625 4050 5625 975\r
+4 0 0 50 0 0 12 0.0000 4 180 990 2325 1275 Internal object\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1605 2550 1875 Methods (services)\001\r
+4 0 0 50 0 0 12 0.0000 4 135 570 4950 1575 files\001\r
+4 0 0 50 0 0 12 0.0000 4 135 855 5850 1275 Initial code\001\r
+4 0 0 50 0 0 12 0.0000 4 180 720 675 1275 Requests\001\r
+4 0 0 50 0 0 12 0.0000 4 180 750 900 1575 param. IN\001\r
+4 0 0 50 0 0 12 0.0000 4 180 930 900 2400 param. OUT\001\r
+4 0 0 50 0 0 12 0.0000 4 135 360 825 3225 GET\001\r
+4 0 0 50 0 0 12 0.0000 4 135 330 825 2925 SET\001\r
--- /dev/null
+#FIG 3.2\r
+Portrait\r
+Center\r
+Inches\r
+Letter \r
+100.00\r
+Single\r
+-2\r
+1200 2\r
+6 2475 2625 3975 3300\r
+4 0 0 50 0 0 12 0.0000 4 180 1485 2475 2775 Attributes (common,\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1410 2475 3000 global variables,\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1125 2475 3225 object state)\001\r
+-6\r
+2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 2250 1500 5175 1500 5175 2250 2250 2250 2250 1500\r
+2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 2250 2475 4650 2475 4650 3450 2250 3450 2250 2475\r
+2 1 0 10 4 7 50 0 -1 0.000 0 0 -1 0 0 2\r
+ 4275 2100 4275 2550\r
+2 1 0 10 0 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 4.00 180.00 180.00\r
+ 1125 1800 2250 1800\r
+2 1 0 10 0 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 4.00 180.00 180.00\r
+ 2250 2100 1125 2100\r
+2 1 0 10 0 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 4.00 180.00 180.00\r
+ 1275 3000 2250 3000\r
+2 1 0 10 0 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 4.00 180.00 180.00\r
+ 2250 3300 1275 3300\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 2175 975 5325 975 5325 3825 2175 3825 2175 975\r
+4 0 0 50 0 0 12 0.0000 4 180 990 2325 1275 internal object\001\r
+4 0 0 50 0 0 12 0.0000 4 135 855 3750 1275 initial code\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1605 2475 1800 Methods (services)\001\r
+4 0 0 50 0 0 12 0.0000 4 180 720 675 1350 Requests\001\r
+4 0 0 50 0 0 12 0.0000 4 180 750 900 1650 param. IN\001\r
+4 0 0 50 0 0 12 0.0000 4 180 930 900 2400 param. OUT\001\r
+4 0 0 50 0 0 12 0.0000 4 135 330 825 3075 SET\001\r
+4 0 0 50 0 0 12 0.0000 4 135 360 825 3375 GET\001\r
+4 0 0 50 0 0 12 0.0000 4 45 105 3525 1275 =\001\r
--- /dev/null
+#FIG 3.2\r
+Portrait\r
+Center\r
+Inches\r
+Letter \r
+100.00\r
+Single\r
+-2\r
+1200 2\r
+0 32 #8c8a8c\r
+6 3525 4125 5100 4650\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 3600 4200 5025 4200 5025 4575 3600 4575 3600 4200\r
+4 0 0 50 0 0 12 0.0000 4 135 450 3825 4500 A.hxx\001\r
+-6\r
+6 5325 4125 6975 4650\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 5400 4200 6900 4200 6900 4575 5400 4575 5400 4200\r
+4 0 0 50 0 0 12 0.0000 4 135 450 5625 4500 A.cxx\001\r
+-6\r
+6 7350 3000 9675 3525\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 7425 3075 9600 3075 9600 3450 7425 3450 7425 3075\r
+4 0 0 50 0 0 12 0.0000 4 180 1005 7575 3375 x.f, y.c, z.cxx\001\r
+-6\r
+6 3435 3180 5160 3630\r
+4 0 0 50 0 0 12 0.0000 4 180 1725 3435 3330 Written by integrator\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1155 3435 3555 (if necessary)\001\r
+-6\r
+2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 3\r
+ 2 1 2.00 75.00 120.00\r
+ 3420 3375 5475 3375 4275 4200\r
+2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 2.00 75.00 120.00\r
+ 5512 3369 6187 4194\r
+2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 3\r
+ 2 1 2.00 75.00 120.00\r
+ 5625 2850 6975 2850 7425 3300\r
+2 2 0 2 4 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 2970 2355 10095 2355 10095 4890 2970 4890 2970 2355\r
+4 0 0 50 0 0 12 0.0000 4 135 855 5625 2775 Initial code\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1635 3150 2625 C++ internal object: A\001\r
--- /dev/null
+#FIG 3.2\r
+Portrait\r
+Center\r
+Inches\r
+Letter \r
+100.00\r
+Single\r
+-2\r
+1200 2\r
+0 32 #8c8a8c\r
+2 2 0 2 4 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 2100 1275 9225 1275 9225 3675 2100 3675 2100 1275\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 4350 2925 6450 2925 6450 3450 4350 3450 4350 2925\r
+2 2 0 2 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 6825 1575 8850 1575 8850 2325 6825 2325 6825 1575\r
+2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 3\r
+ 2 1 2.00 75.00 120.00\r
+ 4875 2250 6375 2250 6750 1875\r
+2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 3\r
+ 2 1 2.00 75.00 120.00\r
+ 2400 2475 4125 2475 4875 2925\r
+4 0 0 50 0 0 12 0.0000 4 180 1485 4575 3225 Python class A.py\001\r
+4 0 0 50 0 0 12 0.0000 4 135 1380 7050 1875 Functions/classes\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1365 7050 2100 python : x.py, y.py\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1245 2400 1575 Python object: A\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1635 2400 2400 written by integrator\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1155 2400 2700 (if necessary)\001\r
+4 0 0 50 0 0 12 0.0000 4 135 855 4875 2175 Initial code\001\r
--- /dev/null
+#FIG 3.2\r
+Portrait\r
+Center\r
+Inches\r
+Letter \r
+100.00\r
+Single\r
+-2\r
+1200 2\r
+6 2250 1725 2475 3075\r
+4 0 0 50 0 0 12 0.0000 4 135 180 2250 1875 x1\001\r
+4 0 0 50 0 0 12 0.0000 4 135 180 2250 3075 x2\001\r
+-6\r
+6 4425 1650 4650 3150\r
+4 0 0 50 0 0 12 0.0000 4 180 180 4425 1800 y1\001\r
+4 0 0 50 0 0 12 0.0000 4 180 180 4425 3075 y2\001\r
+-6\r
+6 3375 1950 3600 3300\r
+4 0 0 50 0 0 12 0.0000 4 135 195 3375 2100 S1\001\r
+4 0 0 50 0 0 12 0.0000 4 135 195 3375 3300 S2\001\r
+-6\r
+2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 3075 1800 4125 1800 4125 2325 3075 2325 3075 1800\r
+2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 3075 3000 4125 3000 4125 3525 3075 3525 3075 3000\r
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 1 1 1.00 60.00 120.00\r
+ 2475 3225 3075 3225\r
+2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2\r
+ 2475 3225 1950 3225\r
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 1 1 1.00 60.00 120.00\r
+ 4125 2025 4650 2025\r
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 1 1 1.00 60.00 120.00\r
+ 2475 2025 3075 2025\r
+2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2\r
+ 4650 2025 5250 2025\r
+2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2\r
+ 2475 2025 1950 2025\r
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 1 1 1.00 60.00 120.00\r
+ 4125 3225 4650 3225\r
+2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2\r
+ 4650 3225 5175 3225\r
--- /dev/null
+#FIG 3.2\r
+Portrait\r
+Center\r
+Inches\r
+Letter \r
+100.00\r
+Single\r
+-2\r
+1200 2\r
+6 3600 1425 4575 3825\r
+2 1 0 3 1 7 50 0 -1 0.000 0 0 -1 1 0 4\r
+ 2 1 2.00 60.00 105.00\r
+ 3675 2700 3900 2700 4125 3750 4500 3750\r
+2 1 0 3 1 7 50 0 -1 0.000 0 0 -1 1 0 4\r
+ 2 1 2.00 60.00 105.00\r
+ 3675 2700 3900 2700 4050 1500 4500 1500\r
+-6\r
+6 4500 1050 6300 1950\r
+2 2 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 4500 1050 6300 1050 6300 1950 4500 1950 4500 1050\r
+4 0 0 50 0 0 12 0.0000 4 135 1290 4650 1650 interface\001\r
+4 0 0 50 0 0 12 0.0000 4 135 690 4650 1425 CORBA remote\001\r
+-6\r
+6 4500 3300 5850 4200\r
+2 2 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 4500 3300 5850 3300 5850 4200 4500 4200 4500 3300\r
+4 0 0 50 0 0 12 0.0000 4 180 1005 4650 3975 interface\001\r
+4 0 0 50 0 0 12 0.0000 4 135 690 4650 3750 Python local\001\r
+-6\r
+2 2 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 600 2250 1950 2250 1950 3150 600 3150 600 2250\r
+2 1 0 3 1 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 2.00 60.00 105.00\r
+ 1950 2700 2400 2700\r
+2 2 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 2400 2250 3675 2250 3675 3150 2400 3150 2400 2250\r
+2 1 0 3 1 7 50 0 -1 0.000 0 0 -1 1 0 2\r
+ 2 1 2.00 60.00 105.00\r
+ 6300 1500 6825 1500\r
+2 2 0 1 1 7 50 0 -1 0.000 0 0 -1 0 0 5\r
+ 6825 1050 8100 1050 8100 1950 6825 1950 6825 1050\r
+2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 3\r
+ 2 1 2.00 60.00 105.00\r
+ 1350 1725 3525 1725 3975 2025\r
+2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 3\r
+ 2 1 2.00 60.00 105.00\r
+ 1425 4275 2850 4275 4050 3375\r
+4 0 0 50 0 0 12 0.0000 4 135 855 750 2775 Initial code\001\r
+4 0 0 50 0 0 12 0.0000 4 180 420 2550 2625 Internal\001\r
+4 0 0 50 0 0 12 0.0000 4 135 525 2550 2850 object\001\r
+4 0 0 50 0 0 12 0.0000 4 135 555 6975 1650 integration\001\r
+4 0 0 50 0 0 12 0.0000 4 180 825 6975 1425 SALOME\001\r
+4 0 0 50 0 0 12 0.0000 4 135 870 1425 3975 Access from outside\001\r
+4 0 0 50 0 0 12 0.0000 4 135 1230 1425 4200 SALOME/CORBA\001\r
+4 0 0 50 0 0 12 0.0000 4 180 1035 1350 1425 Access from\001\r
+4 0 0 50 0 0 12 0.0000 4 135 1230 1350 1650 SALOME/CORBA\001\r
-.. YACS documentation master file, created by sphinx-quickstart on Fri Mar 28 11:17:51 2008.
- You can adapt this file completely to your liking, but it should at least
- contain the root `toctree` directive.
-Documentation YACS
-================================
-
-Contents:
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ YACS documentation
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
.. toctree::
:maxdepth: 2
- intro
- rappels
- principes
- gui
- console
- python
- integration
- batch
+ using.rst
+ integration.rst
Indices and tables
==================
* :ref:`genindex`
+* :ref:`modindex`
* :ref:`search`
.. _integration:
**********************************************************
-Intégration de composants dans SALOME pour YACS
+Integration of components into SALOME for YACS
**********************************************************
-Cette partie de la documentation donne les éléments pour créer des composants SALOME couplables avec YACS
-soit en partant de zéro soit en intégrant un code existant.
+This part of the documentation provides information to create SALOME components that can be coupled with YACS, either
+starting from scratch or by including an existing code.
-Les deux premiers chapitres sont des tutoriaux pour créer des modules SALOME avec un composant simple de type
-"Hello World" implémentés en Python (:ref:`pysalome`) ou en C++ (:ref:`cppsalome`).
+The first two chapters are tutorials to create SALOME modules with a single “Hello World” type component, implemented
+in Python (:ref:`pysalome`) or in C++ (:ref:`cppsalome`).
-Le chapitre suivant (:ref:`components`) décrit les opérations à effectuer pour intégrer des codes de calcul
-dans l'architecture SALOME.
-Le quatrième chapitre (:ref:`calculator`) montre comment créer un composant SALOME qui utilise des objets MED.
+The next chapter (:ref:`components`) describes operations to be done to include calculation codes into the SALOME
+architecture.
+The fourth chapter (:ref:`calculator`) shows how to create a SALOME component that uses MED objects.
-Le chapitre suivant présente l'outil :ref:`hxx2salome` qui permet d'automatiser, dans une grande mesure,
-l'intégration d'un code de calcul en C++ à condition de n'utiliser que des ports dataflow.
+The next chapter presents a tool (:ref:`hxx2salome`) that automates much of the work to integrate a C++ calculation
+code, provided that only the dataflow ports are used.
-Le sixième chapitre (:ref:`progdsc`) est réservé à ceux qui veulent développer de nouveaux ports datastream
-sur la base du modèle de programmation DSC.
+The sixth chapter (:ref:`progdsc`) is aimed particularly at persons who would like to develop new datastream ports
+based on the DSC programming model.
-Le chapitre suivant est un :ref:`calcium`. Les ports CALCIUM sont des ports datastream prédéfinis dans SALOME
-qui permettent de mettre en oeuvre simplement des couplages datastream dans YACS.
+The next chapter is a :ref:`calcium`. CALCIUM ports are datastream ports predefined in SALOME that simply implement
+datastream couplings in YACS.
-Enfin le dernier chapitre est un guide d'utilisation de l'outil :ref:`yacsgen` qui permet d'automatiser
-l'intégration de codes de calcul en Fortran, C, Python qui utilisent des ports datastream CALCIUM ce que ne permet
-pas l'outil :ref:`hxx2salome`.
+Finally, the last chapter is a guide for use of a tool (:ref:`yacsgen`) that automates the integration of calculation
+codes in Fortran, C, Python and that use CALCIUM datastream ports, that is not possible with the :ref:`hxx2salome` tool.
.. toctree::
:maxdepth: 2
+++ /dev/null
-
-
-Introduction
-----------------------
-Le module YACS permet de construire et d'exécuter des schémas de calcul. Un schéma de calcul est un assemblage plus ou moins
-complexe de composants de calcul (composants SALOME ou codes de calcul).
-Un schéma de calcul permet donc de définir un enchaînement ou un couplage de codes de calcul (voir :ref:`principes`).
-
-.. figure:: images/ihm.png
- :align: center
-
- GUI YACS
-
-La construction d'un schéma de calcul peut être réalisée soit au moyen d'un outil graphique (voir :ref:`gui`),
-soit en éditant directement un fichier XML (voir :ref:`schemaxml`)
-soit encore en utilisant une interface de programmation (API) en Python (voir :ref:`schemapy`).
-Dans cette phase, on définit l'enchaînement des composants avec les flots de données associés.
-
-
-L'exécution d'un schéma de calcul peut se faire à partir de l'outil graphique (voir :ref:`execution`) mais également
-en mode console (voir :ref:`execxml`) ou encore en utilisant l'interface Python (voir :ref:`execpy`).
-
-L'exécution d'un schéma de calcul prend en charge :
-
- * le lancement et la distribution des composants,
- * la gestion de la distribution des données,
- * le suivi de l'exécution ,
- * l'éventuel arrêt/suspension/reprise de l'exécution.
-
-Il est également possible d'exécuter un schéma de calcul en passant par un système de batch tel que LSF ou PBS (voir :ref:`batch`).
-
-Enfin pour pouvoir coupler des codes de calcul avec YACS, il est indispensable de les transformer en composants SALOME.
-Dans sa plus grande généralité cette opération demande une bonne connaissance des principes de SALOME (voir :ref:`integration`).
-
-Pour les codes de calcul en C++, l'outil :ref:`hxx2salome` permet d'automatiser, dans une grande mesure, cette opération.
-
-Pour les codes de calcul en Fortran, C, Python, qui mettent en oeuvre du couplage de type CALCIUM, l'outil
-:ref:`yacsgen` permet de générer automatiquement l'enrobage SALOME nécessaire à partir d'une
-description succincte de l'interface de couplage retenue.
-
Main Menu
=========
-The menu bar is located on the upper part of the desktop window. Available commands depends on the current selected schema and its mode (edition, run). The menus are specific for each mode and rebuilt as soon as the user changes the current mode. Relevant commands also depends on the item selected in the schema tree view.
+The menu bar is located on the upper part of the desktop window.
-Menu bar configurations in edition and run modes are given below.
-
-
-
-.. image:: images/main_menu_0.jpg
+.. image:: images/main_menu_0.png
:align: center
- :width: 40ex
-
.. centered::
- **Main Menu in edition mode**
-
-
-
-
-.. image:: images/main_menu_1.jpg
- :align: center
- :width: 35ex
-
-
-.. centered::
- **Main Menu in run mode**
-
+ **Main Menu**
Let's consider the available menus in more detail.
File
----
-File menu contains standard operations for creating, opening and saving documents as well as import and export operations. The YACS GUI document is saved in a HDF file with default extension \*.hdf.
-
-If YACS module has been loaded File menu contains the following items:
-
-
-.. image:: images/main_menu_2.jpg
- :align: center
- :width: 40ex
-
-
-
-
-+ Import Schema:
+File menu contains standard operations for creating, opening and saving documents (SALOME studies) as well as schema creation or
+import operations. The SALOME study is saved in a HDF file with default extension \*.hdf. YACS Schema must be saved apart in XML files.
+If YACS module has been loaded, File menu contains the following items:
++ YACS:
+ + :ref:`create_new_schema`
+ :ref:`import_yacs_schema`
-
- + :ref:`import_supervisor_graph`
-
-
-
-
-
-+ :ref:`export_schema`
-
-
-+ :ref:`create_new_schema`
-
-
-
-
+.. image:: images/main_menu_2.png
+ :align: center
Edit
----
-Edit menu supports standard edition operations like copy/paste and undo/redo functionality. Cut, copy, paste, undo/redo should be available in edition mode only. ( **These items are not currently implemented, but will be available in the future version!** )
+In SALOME, Edit menu contains standard edition operations like copy/paste and undo/redo functionality.
+In YACS module, Cut, copy and paste are available but only within context popup menus. Undo/redo are also available, in YACS menu and toolbar.
+Cut, copy, paste and undo/redo are available in edition mode only.
-
-
-.. image:: images/main_menu_3.jpg
+.. image:: images/main_menu_3.png
:align: center
- :width: 20ex
-
-
-
-Other edition operations on different types of objects are available with help of corresponding Input Panel property pages. For more information about this topic see :ref:`edit_object` section.
-The user can :ref:`delete_object` with help of corresponding context popup menu item in the edition Tree View.
+Other edition operations on different types of objects are available with help of corresponding context popup menus or
+Input Panel property pages. For more information about this topic see :ref:`edit_object` section.
+The user can :ref:`delete_object` with help of corresponding context popup menu item in the edition Tree View or 2D view.
View
----
-View menu allows maintaining visibility of the different parts of the desktop like toolbars, status bar, Object Browser, Python Console, Log Window.
+View menu allows maintaining visibility of the different parts of the desktop like toolbars, status bar, Object Browser,
+Tree View, Catalogs, Input Panel.
-
-
-.. image:: images/main_menu_4.jpg
+.. image:: images/main_menu_4.png
:align: center
- :width: 44ex
-
-
-.. centered::
- **Python Console**
-
-
-.. image:: images/main_menu_5.jpg
- :align: center
- :width: 41ex
.. centered::
**Standard Toolbar**
-
-.. _create_menu:
-
-Create
-------
-Create menu contains a set of commands for creation of the YACS GUI objects. It is active only in the edition mode of a schema. Create menu contains the following items:
-
-
-
-
-+ :ref:`create_container_definition`
-
-
-+ :ref:`create_component_instance_definition`
-
-
-
-
-
-
-
-.. image:: images/main_menu_6.jpg
+.. image:: images/main_menu_5.png
:align: center
- :width: 58ex
-
-
-
-
-
-+ :ref:`create_node`
+.. centered::
+ **Windows**
+.. _yacs_menu:
+YACS menu
+---------
+YACS menu contains a set of commands for creating opening and saving of YACS schemas, importing old SUPERV schemas, execute schemas, import catalogs, and set some specific behavior of 2D views.
+When YACS is started, YACS menu contains the following items:
++ :ref:`create_new_schema` : create a new schema from scratch
++ :ref:`import_yacs_schema` : load a YACS schema saved on an XML file
++ :ref:`import_supervisor_graph` : load a SUPERV schema saved on an XML file
++ Load a Schema in run mode (without edition)
++ What's this, detailled help on a few items
-.. image:: images/main_menu_7.jpg
+.. image:: images/main_menu_6a.png
:align: center
- :width: 48ex
-
-
-.. _execute:
-
-Execute
--------
-Execute menu contains a set of commands for execution of the YACS GUI schemas.
-
-If the current mode is the edition mode of a schema, there is only possibility to create a schema run:
+When the active schema is in edition mode, YACS menu contains the following items:
-
-.. image:: images/main_menu_8.jpg
++ :ref:`create_new_schema` : create a new schema from scratch
++ :ref:`import_yacs_schema` : load a YACS schema saved on an XML file
++ :ref:`import_supervisor_graph` : load a SUPERV schema saved on an XML file
++ Save Schema : save in the current opened file
++ :ref:`export_schema` : save with file dialog box to choose a new filename
++ :ref:`execute_schema` : switch from edition to run mode
++ :ref:`save_restore_execution_state` (from a state of execution saved previously)
++ Load a Schema in run mode (without edition)
++ Load a Schema to be executed on a batch system
++ Undo last edition (modification of nodes positions in 2D view are not undoable)
++ Redo last edition
++ Show the stack of undoable edition actions
++ Show the stack of redoable edition actions
++ Import Catalog : to import specific data types or nodes
++ Straight/Orthogonal : toggle between straight lines or orthogonal links
++ Automatic Links: toggle behaviour for automatic link reconstruction when 2D View layout changes
++ Simplify Links: toggle behaviour for link simplification (less segments)
++ Force Ortho Links: toggle behaviour on very simple links (2 segments becomes 3 orthogonals segments)
++ Separate Links: toggle behaviour to try to avoid or not superposition of links
++ Show all links: some links may have been selectively hidden
++ Hide all links
++ What's this, detailled help on a few items
+
+.. image:: images/main_menu_6b.png
:align: center
- :width: 38ex
-
-
-
-
-
-
-+ :ref:`execute_schema`
+When the active schema is in execution mode, YACS menu contains the following items:
++ :ref:`create_new_schema` : create a new schema from scratch
++ :ref:`import_yacs_schema` : load a YACS schema saved on an XML file
++ :ref:`import_supervisor_graph` : load a SUPERV schema saved on an XML file
+ :ref:`save_restore_execution_state` (from a state of execution saved previously)
-
-
-+ New Batch Execution ( **Will be available in the future version!** )
-
-
-
-
-
-Execute menu is active only if we are in the run mode of a schema. Execute menu contains the following items:
-
-
-
-.. image:: images/main_menu_9.jpg
++ Load a Schema in run mode (without edition)
++ :ref:`Start/Resume <start_resume>`
++ :ref:`Abort <pause_abort_reset>`
++ :ref:`Pause <pause_abort_reset>`
++ :ref:`Restart <pause_abort_reset>`
++ Save state
++ Mode without stop
++ Mode breakpoints
++ Mode step by step
++ Stop on error
++ Straight/Orthogonal : toggle between straight lines or orthogonal links
++ Automatic Links: toggle behaviour for automatic link reconstruction when 2D View layout changes
++ Simplify Links: toggle behaviour for link simplification (less segments)
++ Force Ortho Links: toggle behaviour on very simple links (2 segments becomes 3 orthogonals segments)
++ Separate Links: toggle behaviour to try to avoid or not superposition of links
++ Show all links: some links may have been selectively hidden
++ Hide all links
++ What's this, detailled help on a few items
+
+.. image:: images/main_menu_6c.png
:align: center
- :width: 44ex
-
-
-
-
-
-
-+ Without stop Mode
-
-
-+ Breakpoints Mode
-
-
-+ Step by step Mode
-
-
-+ Stop on error Option
-
-
-+ Start/Resume
-
-
-+ Pause
-
-
-+ Abort
-
-
-+ Reset
-
-
-+ Execute in batch ( **Will be available in the future version!** )
-
-
-+ Connect to a running batch session ... ( **Will be available in the future version!** )
-
-
-+ Save execution state ...
-
-
-+ New edition
-
-
-
-
Tools
-----
Tools menu provides two standard Salome useful tools such as XML catalog generator and registry display for supervision over component's processes.
-
-
-.. image:: images/main_menu_10.jpg
+.. image:: images/main_menu_10.png
:align: center
- :width: 44ex
-
-
-
Window
------
-Window menu contains commands to arrange already opened windows in a different ways (split horizontally or vertically) or to create a new window with predefined type.
+Window menu contains commands to arrange already opened windows in a different ways (split horizontally or vertically) or to create
+a new window with predefined type.
-
-
-.. image:: images/main_menu_11.jpg
+.. image:: images/main_menu_11.png
:align: center
- :width: 74ex
-
-
-
Help
----
-Help menu allows reading some basic information about application with help of 'About' dialog box and provides help for YACS module as HTML documents.
-
+Help menu allows reading some basic information about application with help of 'About' dialog box and provides help for YACS module
+as HTML documents.
-
-.. image:: images/main_menu_12.jpg
+.. image:: images/main_menu_12.png
:align: center
- :width: 65ex
-
-
+.. _modification:
Modification of a schema
========================
-
-
-
-
Create an object
----------------
YACS GUI uses the following approach for creation of all kinds of YACS objects:
-
-
-
-#. Optionally, the user selects some item (or items) in the Tree View that acts as input parameter(s) for creation.
-
-
+#. Optionally, the user selects some item (or items) in the Tree View or in the 2D Viewer that acts as input parameter(s) for creation.
#. Then the user activates corresponding GUI command to create an object of required type.
-
-
-#. The new object appears in the Tree View and 2D Viewer of a schema. In order to show Input Panel with the property page of a new created object the user should select a new created object in the Tree View or 2D Viewer of a schema. After that the user can modify properties of a new created object via the corresponding property page on the Input Panel.
-
-
-
-
+#. The new object appears in the Tree View and 2D Viewer of a schema. In order to show Input Panel with the property page of a new
+ created object the user should select a new created object in the Tree View or 2D Viewer of a schema. After that the user can modify
+ properties of a new created object via the corresponding property page on the Input Panel.
More detailed information about the creation of certain objects types is given in sections below.
Create a new schema
~~~~~~~~~~~~~~~~~~~
-The YACS module provides the user with capabilities not only for modification, but also for creation of the graphs. The user can create a new schema by calling **New Schema** command from :ref:`file` or from the corresponding toolbar button on the :ref:`schema`.
-
-
+The YACS module provides the user with capabilities not only for modification, but also for creation of the graphs. The user can
+create a new schema by calling **YACS -> New Schema** command from :ref:`file` or from the corresponding toolbar button on the :ref:`schema`.
.. image:: images/functionality_list_9.jpg
:align: center
- :width: 13ex
-
-
-As a result of this operation, YACS module creates an empty instance of C++ schema object, new schema object is shown in the Object Browser and the Tree View is created for a new empty schema. The schema object is shown as a root of Tree View structure. Schema root object of the Tree View will be used as a parent for the schema sub-trees and all new objects added to the schema will appear under
+As a result of this operation, YACS module creates an empty instance of a schema object, new schema object is shown in the Object
+Browser and the Tree View is created for a new empty schema. The schema object is shown as a root of Tree View structure. Schema root
+object of the Tree View will be used as a parent for the schema sub-trees and all new objects added to the schema will appear under
these sub-trees.
-
-
.. image:: images/functionality_list_10.jpg
:align: center
.. centered::
**New created schema**
-
-New schema object becomes the active one. In order to display Input Panel with schemas' property page containing properties of the schema the user should select schema root object in the Tree View. The property page of a schema allows the user to modify schemas' properties (see :ref:`pp_for_schema` section).
+New schema object becomes the active one. In order to display Input Panel with schemas' property page containing properties of the
+schema the user should select schema root object in the Tree View. The property page of a schema allows the user to modify
+schemas' properties (see :ref:`pp_for_schema` section).
.. _create_container_definition:
Create a container definition
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The command **New container** is accessible from :ref:`create_menu` or from the corresponding toolbar button on the :ref:`creation`.
-
+To create a container use the command **Create container** from the context menu of the folder **Containers** in the Tree View.
.. image:: images/functionality_list_11.jpg
:align: center
- :width: 13ex
-
-
On this command call a SALOME container with a default name and default machine parameters is created.
-As a result of container creation, YACS module creates a new container definition object and shows it in the Tree View under 'Containers' folder. It is used as a parent item for all component instances created in this container.
-
+As a result of container creation, YACS module creates a new container definition object and shows it in the Tree View under 'Containers' folder.
+It is used as a parent item for all component instances created in this container.
.. image:: images/functionality_list_12.jpg
:align: center
- :width: 28ex
-
-
-
-As soon as user selects a container object in the Tree View, Input Panel containing property page of the selected container is shown (for the sample of the property page see :ref:`pp_for_container` section) and allows the user to modify its properties. In the container property page the user can specify parameters of a created container object,
-such as the name of the container and machine parameters.
-
-The user can delete the created container by choosing **Delete** item from container context popup menu in the Tree View (see :ref:`delete_object` section).
-
-
-.. image:: images/functionality_list_13.jpg
- :align: center
- :width: 52ex
-
+As soon as user selects a container object in the Tree View, Input Panel containing property page of the selected container is shown
+(for the sample of the property page see :ref:`pp_for_container` section) and allows the user to modify its properties. In the container
+property page the user can specify parameters of a created container object, such as the name of the container and machine parameters.
.. _create_component_instance_definition:
Create a component instance definition
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-At the current moment YACS module provides a functionality to create one type of component instance definition: SALOME component instance definition.
-
-The user can create a new SALOME component instance definition if at least one container definition is presented in the current study.
-
-The command **New Component --> New SALOME component** is accessible from :ref:`create_menu` or from the corresponding toolbar button on the :ref:`creation`.
-
-
-.. image:: images/functionality_list_14.jpg
- :align: center
- :width: 32ex
-
-
-
-The creation of SALOME component instance definition can be also activated via **Create a component instance definition --> SALOME** item from SALOME container definition context popup menu in the Tree View of a schema.
-
-
-.. image:: images/functionality_list_15.jpg
- :align: center
- :width: 66ex
-
-
-
-Actual creation of Container and component are done by Container manager during execution.
-
-A new SALOME component instance definition is shown in the Tree View under its container object.
+At the current moment YACS module does not provide a functionality to create directly component instance.
+The component instances are created indirectly when nodes are created (see :ref:`create_node`).
+When a component instance is created (following the creation of a node), a new SALOME component instance definition is shown in
+the Tree View under its container object.
.. image:: images/functionality_list_16.jpg
:align: center
- :width: 28ex
-
-
-
-As soon as user selects a component instance definition in the Tree View, Input Panel containing property page of the component instance definition object is shown (for the sample of the property page see :ref:`pp_for_component_instance_definition` section) and allows the user to modify its properties.
-
-The user can delete the created component by choosing **Delete** item from SALOME component instance definition context popup menu in the Tree View (see :ref:`delete_object` section).
-
-
-.. image:: images/functionality_list_17.jpg
- :align: center
- :width: 40ex
+As soon as user selects a component instance definition in the Tree View, Input Panel containing property page of the component instance
+definition object is shown (for the sample of the property page see :ref:`pp_for_component_instance_definition` section).
.. _create_node:
-
Create a node
~~~~~~~~~~~~~
-YACS module provides the user with a specific GUI commands for creation of each type of node.
+YACS module provides the user with a specific GUI command for creation of each type of node.
At the current moment in the frames of the YACS module the user can create nodes of the following types:
-
-
+.. _inline_function:
Inline function
''''''''''''''''''
-.. image:: images/functionality_list_18.jpg
+The node object can be created with help of **Create Node --> Inline Function Node** command from the Tree View context menu
+
+.. image:: images/functionality_list_19a.jpg
:align: center
- :width: 36ex
+or from the 2D Viewer context menu. The context menu must be activated on the chosen parent node.
-.. centered::
- **Inline function node with sample ports**
+.. image:: images/functionality_list_19.jpg
+ :align: center
-The node object can be created with help of **New Node --> Inline function** command from the :ref:`create_menu` or from the corresponding toolbar button on the :ref:`creation`.
+as a result:
-.. image:: images/functionality_list_19.jpg
+.. image:: images/functionality_list_18.jpg
:align: center
- :width: 25ex
+.. centered::
+ **Example of inline function node with ports**
+Now, if you want to modify the settings of this node, use the associated panel :ref:`pp_for_inline_node`.
+.. _inline_script:
Inline script
''''''''''''''''''
-.. image:: images/functionality_list_20.jpg
- :align: center
- :width: 36ex
-
+The node object can be created with help of **Create Node --> Inline Script Node** command from the Tree View context menu or
+from the 2D Viewer context menu. The context menu must be activated on the chosen parent node.
-.. centered::
- **Inline script node with sample ports**
+.. image:: images/functionality_list_21.jpg
+ :align: center
-The node object can be created with help of **New Node --> Inline script** command from the :ref:`create_menu` or from the corresponding toolbar button on the :ref:`creation`.
+as a result:
-.. image:: images/functionality_list_21.jpg
+.. image:: images/functionality_list_20.jpg
:align: center
- :width: 25ex
+.. centered::
+ **Example of inline script node with ports**
+Now, if you want to modify the settings of this node, use the associated panel :ref:`pp_for_inline_node`.
+.. _salome_service:
SALOME service
''''''''''''''''''
-.. image:: images/functionality_list_22.jpg
- :align: center
- :width: 36ex
+This type of node can be created with help of **Create Node -> Node from Catalog** command from the Tree View context menu
+or from the 2D Viewer context menu.
-
-**SALOME service node with sample input ports values**
-This type of node can be created with help of **From catalog** command from :ref:`create_menu` or :ref:`creation`.
+The type of service node is chosen from the catalog of services available in the list of imported catalog, in the :ref:`catalogs_tree_view`.
.. image:: images/functionality_list_23.jpg
:align: center
- :width: 25ex
-As a result of this command call the Input Panel with catalogs' properties is displayed. The displayed property page provides a user with the possibility to choose firstly a catalog type: **Session Catalog** or **Proc Catalog** (i.e. to fill catalog with types of nodes belonging to the predefined schema), and secondly - the type of node from the catalog to add it into the active schema. The
-session catalog contains all SALOME components with its services.
+As a result of this command call the Input Panel with catalogs' properties is displayed. The displayed property page provides a user
+with the possibility to choose firstly a catalog type: **Current Session**, **Built In** or other imported catalog (i.e. to fill catalog
+with types of nodes belonging to a predefined schema), and secondly - the type of node from the catalog to add it into the active schema. The
+**Current Session** catalog contains all SALOME components with its services.
+
+.. note::
+
+ To add a node from catalog to the schema, drag and drop it. Multiple selection is possible in the Catalog, so you can add several
+ nodes to the schema with one drag and drop.
.. image:: images/functionality_list_24.jpg
:align: center
- :width: 38ex
-
.. centered::
- **Create a node from session catalog**
+ **Create a node from current session catalog**
.. image:: images/functionality_list_25.jpg
:align: center
- :width: 38ex
.. centered::
- **Create a node from proc catalog**
+ **Create a node from a user catalog**
-As a result of SALOME service node creation from session catalog, the content of schema Tree View is enlarged with a data type used by a new node, a new node object under **Nodes** folder, the **DefaultContainer** under **Containers** folder, the corresponding SALOME component instance definition and a reference to a new created service node under it.
-.. image:: images/functionality_list_26.jpg
+.. image:: images/functionality_list_22.jpg
:align: center
- :width: 36ex
.. centered::
- **Tree View of new empty schema**
+ **Example of service node**
+
+As a result of SALOME service node creation from **Current Session** catalog, the content of schema Tree View is enlarged with data types
+used by the new node, a new node object under **newSchema_1** folder, the corresponding SALOME component instance definition and a
+reference to a new created service node under it.
.. image:: images/functionality_list_27.jpg
:align: center
- :width: 36ex
.. centered::
**Tree View after SALOME service node creation**
+Now, if you want to modify the settings of this node, use the associated panel :ref:`pp_for_salome_node`.
+.. _block_node:
-CPP node
+Block
''''''''''''''''''
-.. image:: images/functionality_list_28.jpg
- :align: center
- :width: 36ex
+The node object can be created with help of **Create Node --> bloc Node** command from the Tree View context menu or from
+the 2D Viewer context menu.
-.. centered::
- **Sample CPP node from imported schema**
-
-The node object can be created with help of **New Node --> CPP node** command from the :ref:`create_menu` or from the corresponding toolbar button on the :ref:`creation`.
-
-.. image:: images/functionality_list_29.jpg
+.. image:: images/functionality_list_31.jpg
:align: center
- :width: 25ex
-
-
-
-Block
-''''''''''''''''''
+as a result:
.. image:: images/functionality_list_30.jpg
:align: center
- :width: 33ex
-
.. centered::
**Empty Block node**
-The node object can be created with help of **New Node --> Block** command from the :ref:`create_menu` or from the corresponding toolbar button on the :ref:`creation`.
-
-.. image:: images/functionality_list_31.jpg
- :align: center
- :width: 25ex
-
-Child nodes of a block node can be created with help of sub-items of **Create a node** command from block node context popup menu in the Tree View.
+Child nodes of a block node can be created with help of sub-items of **Create Node** command from block node context popup menu in the
+Tree View or in the 2D Viewer.
.. image:: images/functionality_list_32.jpg
:align: center
- :width: 58ex
+as a result:
.. image:: images/functionality_list_33.jpg
:align: center
- :width: 39ex
.. centered::
- **Block node with inline function node as a child node**
-
+ **Example of Block node with inline function node as a child node**
+.. _forloop_node:
-FOR loop
+For Loop
''''''''''''''''''
-.. image:: images/functionality_list_34.jpg
- :align: center
- :width: 38ex
-
+The node object can be created with help of **Create Node --> For Loop Node** command from the Tree View context menu or from the 2D Viewer context menu.
-.. centered::
- **FOR loop node without a body (i.e. new created)**
+.. image:: images/functionality_list_35.jpg
+ :align: center
-The node object can be created with help of **New Node --> FOR loop** command from the :ref:`create_menu` or from the corresponding toolbar button on the :ref:`creation`.
+as a result:
-.. image:: images/functionality_list_35.jpg
+.. image:: images/functionality_list_34.jpg
:align: center
- :width: 25ex
-Body node of a FOR loop node can be created with help of sub-items of **Create a body** command from FOR loop node context popup menu in the Tree View.
+.. centered::
+ **For Loop node without a body (i.e. newly created)**
+
+Body node of a For Loop node can be created with help of sub-items of **Create Node** command from For Loop node context popup menu in the
+Tree View or in the 2D Viewer.
.. image:: images/functionality_list_36.jpg
:align: center
- :width: 59ex
+as a result:
.. image:: images/functionality_list_37.jpg
:align: center
- :width: 69ex
.. centered::
- **FOR loop node with inline script node as a body**
-
+ **For Loop node with inline script node as a body**
+.. _foreachloop_node:
-FOREACH loop
+ForEachLoop
''''''''''''''''''
-.. image:: images/functionality_list_38.jpg
- :align: center
- :width: 38ex
+The node object can be created with help of sub-items of **Create Node --> ForEachLoop** command from the Tree View context menu
+or from the 2D Viewer context menu. There is one sub-item for each data type known in the schema object. If you need another data type,
+you'll have to import it in the schema. In this case we use a double data type as the main type of the loop.
+.. image:: images/functionality_list_39.jpg
+ :align: center
-.. centered::
- **FOREACH loop node without a body (i.e. new created)**
-
-The node object can be created with help of **New Node --> FOREACH loop** command from the :ref:`create_menu` or from the corresponding toolbar button on the :ref:`creation`.
+as a result:
-.. image:: images/functionality_list_39.jpg
+.. image:: images/functionality_list_38.jpg
:align: center
- :width: 25ex
-Body node of a FOREACH loop node can be created with help of sub-items of **Create a body** command from FOREACH loop node context popup menu in the Tree View.
+.. centered::
+ **ForEachLoop (double) node without a body (i.e. new created)**
+
+Body node of a ForEachLoop node can be created with help of sub-items of **Create Node** command from ForEachLoop node context popup menu in the
+Tree View or in the 2D Viewer.
.. image:: images/functionality_list_40.jpg
:align: center
- :width: 68ex
+as a result:
.. image:: images/functionality_list_41.jpg
:align: center
- :width: 78ex
.. centered::
- **FOREACH loop node with SALOME service node as a body**
-
+ **ForEachLoop node with SALOME service node as a body**
+.. _whileloop_node:
-WHILE loop
+While loop
''''''''''''''''''
-.. image:: images/functionality_list_42.jpg
- :align: center
- :width: 38ex
-
+The node object can be created with help of **Create Node --> While Loop Node** command from the Tree View context menu
+or from the 2D Viewer context menu.
-.. centered::
- **WHILE loop node without a body (i.e. new created)**
+.. image:: images/functionality_list_43.jpg
+ :align: center
-The node object can be created with help of **New Node --> WHILE loop** command from the :ref:`create_menu` or from the corresponding toolbar button on the :ref:`creation`.
-.. image:: images/functionality_list_43.jpg
+.. image:: images/functionality_list_42.jpg
:align: center
- :width: 25ex
-Body node of a WHILE loop node can be created with help of sub-items of **Create a body** command from WHILE loop node context popup menu in the Tree View.
+.. centered::
+ **While loop node without a body (i.e. new created)**
+
+Body node of a While Loop node can be created with help of sub-items of **Create Node** command from While Loop node context popup menu in the
+Tree View or in the 2D Viewer.
.. image:: images/functionality_list_44.jpg
:align: center
- :width: 61ex
.. image:: images/functionality_list_45.jpg
:align: center
- :width: 61ex
.. centered::
- **WHILE loop node with Block node as a body**
+ **While Loop node with Block node as a body**
+.. _switch_node:
-
-SWITCH
+Switch
''''''''''''''''''
+The node object can be created with help of **Create Node --> Switch Node** command from the Tree View context menu
+or from the 2D Viewer context menu.
-
+.. image:: images/functionality_list_47.jpg
+ :align: center
.. image:: images/functionality_list_46.jpg
:align: center
- :width: 35ex
-
.. centered::
- **SWITCH node without any cases (i.e. new created)**
+ **Switch node without any cases (i.e. new created)**
-The node object can be created with help of **New Node --> SWITCH** command from the :ref:`create_menu` or from the corresponding toolbar button on the :ref:`creation`.
+Body node of a Switch node can be created with help of sub-items of **Create Node** command from Switch node context popup menu in the
+Tree View or in the 2D Viewer.
+.. image:: images/functionality_list_48.jpg
+ :align: center
-.. image:: images/functionality_list_47.jpg
+
+.. image:: images/functionality_list_49.jpg
:align: center
- :width: 25ex
+.. centered::
+ **Switch node with three cases**
-Body node of a SWITCH node can be created with help of sub-items of **Create a node** command from SWITCH node context popup menu in the Tree View.
+The number of Switch node cases can be changed with help of functionality provided by the property page of Switch node (for the sample
+of the property page see :ref:`Property page for Switch node <pp_for_switch_node>` section).
+.. _optimizerloop_node:
-.. image:: images/functionality_list_48.jpg
+OptimizerLoop
+''''''''''''''''''
+
+The node object can be created with help of **Create Node --> Optimizer Loop** command from the Tree View context menu
+or from the 2D Viewer context menu.
+
+.. image:: images/functionality_list_47a.jpg
:align: center
- :width: 58ex
+Body node of an Optimizer Loop node can be created with help of sub-items of **Create Node** command from Optimizer Loop node context popup menu in the
+Tree View or in the 2D Viewer.
+.. image:: images/functionality_list_47b.jpg
+ :align: center
-.. image:: images/functionality_list_49.jpg
+.. image:: images/functionality_list_47c.jpg
:align: center
- :width: 79ex
.. centered::
- **SWITCH node with three cases**
-
-The numbers of SWITCH node cases can be changed with help of functionality provided by the property page of SWITCH node (for the sample of the property page see :ref:`Property page for Switch node <pp_for_switch_node>` section).
+ **Optimizer Loop with one internal python node**
+The parameters of the Optimizer Loop can then be modified with help of the functionality provided by the property page of Optimizer Loop node
+(see :ref:`Property page for Optimizer Loop <pp_for_optimizer_node>` section).
+.. _datain_node:
Input data node
''''''''''''''''''
+The node object can be created with help of **Create Node --> Input Data Node** command from the Tree View context menu
+or from the 2D Viewer context menu.
-.. image:: images/functionality_list_50.jpg
+.. image:: images/functionality_list_51.jpg
:align: center
- :width: 35ex
+.. image:: images/functionality_list_50.jpg
+ :align: center
+
.. centered::
**Input data node with sample ports**
-The node object can be created with help of **New Node --> Input data node** command from the :ref:`create_menu` or from the corresponding toolbar button on the :ref:`creation`.
-
-.. image:: images/functionality_list_51.jpg
- :align: center
- :width: 25ex
+.. _dataout_node:
+Output data node
+''''''''''''''''''
+The node object can be created with help of **Create Node --> Output Data Node** command from the Tree View context menu
+or from the 2D Viewer context menu.
+.. image:: images/functionality_list_53.jpg
+ :align: center
-Output data node
-''''''''''''''''''
.. image:: images/functionality_list_52.jpg
:align: center
- :width: 35ex
-
.. centered::
**Output data node with sample ports**
-The node object can be created with help of **New Node --> Output data node** command from the :ref:`create_menu` or from the corresponding toolbar button on the :ref:`creation`.
-
-.. image:: images/functionality_list_53.jpg
- :align: center
- :width: 25ex
+.. _studyin_node:
+Input study node
+''''''''''''''''''
+The node object can be created with help of **Create Node --> Input Study Node** command from the Tree View context menu
+or from the 2D Viewer context menu.
+.. image:: images/functionality_list_55.jpg
+ :align: center
-Input study node
-''''''''''''''''''
.. image:: images/functionality_list_54.jpg
:align: center
- :width: 34ex
-
.. centered::
**Input study node with sample ports**
-The node object can be created with help of **New Node --> Input study node** command from the :ref:`create_menu` or from the corresponding toolbar button on the :ref:`creation`.
-
-.. image:: images/functionality_list_55.jpg
- :align: center
- :width: 25ex
-
-
-
+.. _studyout_node:
Output study node
''''''''''''''''''
-.. image:: images/functionality_list_56.jpg
- :align: center
- :width: 34ex
-
-
-.. centered::
- **Output study node with sample ports**
-
-The node object can be created with help of **New Node --> Output study node** command from the :ref:`create_menu` or from the corresponding toolbar button on the :ref:`creation`.
+The node object can be created with help of **Create Node --> Output Study Node** command from the Tree View context menu
+or from the 2D Viewer context menu.
.. image:: images/functionality_list_57.jpg
:align: center
- :width: 25ex
-
-
-
-
-
+.. image:: images/functionality_list_56.jpg
+ :align: center
-The creation of nodes can be also activated via context popup menus in the Tree View. To create a node the user should select object in the Tree View according to :ref:`Table 2 <Table_2>`.
+.. centered::
+ **Output study node with sample ports**
-As a result of node creation, YACS module creates a new node object with a default name and shows it in the Tree View (under the proper parent item) and in 2D Viewer. For service nodes the reference to the created service node is also published under the corresponding component instance definition in the Tree View. For any node object type, the default name has a form of "node_subtype_NNN", where
+As a result of node creation, YACS module creates a new node object with a default name and shows it in the Tree View (under the proper
+parent item) and in 2D Viewer. For service nodes the reference to the created service node is also published under the corresponding
+component instance definition in the Tree View. For any node object type, the default name has a form of "node_subtypeNNN", where
NNN is the smallest integer that produces a unique node name not yet in use.
-The user can delete the created node by choosing **Delete** item from node context popup menu in the Tree View (see :ref:`delete_object` section).
-
+The user can delete the created node by choosing **Delete** command from node context popup menu in the Tree View or in the 2D Viewer
+(see :ref:`delete_object` section).
.. image:: images/functionality_list_58.jpg
:align: center
- :width: 41ex
-
-
-
Create a link
~~~~~~~~~~~~~
-Connecting nodes ports by links means transferring data from output port to input port of a next node. So, only output and input ports of different nodes can be connected by the link.
+Connecting nodes ports by links means transferring data from output port to input port of a next node. So, in general, only output and input
+ports of different nodes can be connected by a link.
There are three types of links to connect nodes with each other in YACS GUI:
-
-
-
+ data flow link (between data ports),
-
+ data stream link (between stream ports),
-
+ control link (between gate ports).
-
-
-
-
The color code of data links differs from the same one of stream links and is taken from the user preferences (see :ref:`set_user_preferences` section).
-The YACS GUI proposes to the user the several view modes of the schema in the 2D Viewer to choose which links he wants to see on the schemas' presentation (see :ref:`change_2d_representation_schema` section).
-
-The link creation can be performed only between nodes including into the same schema object. Therefore, in such a case the schema should contain at least two nodes.
+The link creation can be performed only between nodes included into the same schema object. Therefore, in such a case the schema should
+contain at least two nodes.
-The user can create a link with help of context popup menu on the selected output port (for data flow and data stream links) or node (for control link creation) in the Tree View.
-
-In the first case, after activation of a corresponding item from the output port context popup menu to create a data link the user should select the input port object in the Tree View. This input port is considered as the end of a new created data link. The output port on which the user called the context popup menu is the beginning of a new created link.
-
-It's worth mentioning that there are two possibilities for the user to create data/datastream links with help of context popup menu on the output port selected in the Tree View:
+The user can create a link by dragging the output port to connect and dropping it onto the input port. The action is the same
+for data flow, data stream and control link. The action of drag-and-drop can be done in the Tree View or in the 2D Viewer.
+The input port is considered as the end of the newly created link. The output port is the beginning of the newly created link.
.. image:: images/functionality_list_59.jpg
:align: center
- :width: 32ex
-
-
-
-
+.. centered::
+ **Drag-and-drop between Add16.z output port and Add17.x input port**
-#. **Add dataflow link** popup menu item to add data (flow or stream) and control link simultaneously from the selected output port to the input port which will be selected later.
+It's worth mentioning that there are two possibilities for the user to create data links with Drag-and-Drop:
+#. **Add dataflow link** : standard Drag-and-Drop creates a data link and adds a control link between concerned nodes simultaneously
-#. **Add data link** popup menu item to add a simple data link from the selected output port to the other (selected later) input port **without control link automatically added** . This functionality is needed inside loop nodes. The sample of data link described above is shown on the figure below.
+#. **Add data link** Drag-and-Drop with control key pressed creates a data link **without adding a control link**. This functionality is
+ needed inside loop nodes. An example of such a data link is shown on the figure below.
.. image:: images/functionality_list_60.jpg
:align: center
-
.. centered::
- **Data link sample**
+ **Trying to create a dataflow link between Add21.z and Add20.x with a loop**
In such a case it is needed to separate the flow of data from the flow of control.
+.. image:: images/functionality_list_60a.jpg
+ :align: center
+
+.. centered::
+ **Create a simple data link with control key pressed**
+To create a control link the user should use Drag-and-Drop between output gate port and input gate port. The output gate port is considered
+as the beginning of the newly created control link, and the input gate port as the end of the link.
-In the second case, to create a control link the user should select the output node, activate **Add control link to other node** item from its context popup menu, and then select the input node object in the Tree View. The output gate port of the firstly selected node is considered as the beginning of a new created control link, and the input gate port of the secondly selected node - as the end of
-a new link.
+As a result of link creation, a valid link between ports is created. The link object is published in the Tree View in the **Links** folder
+under the corresponding schema object. The presentation of a new link is shown in the 2D Viewer and colored with the color code according
+to links' type.
-For more information about the context popup menus' commands to create a link object refer to :ref:`Table 2 <Table_2>`.
+A new link object has a default name, which contains names of "from" and "to" nodes and ports and cannot be changed by the user
+(see :ref:`description of link objects in the Tree View <description_of_link_objects>`).
-As a result of link creation, a valid link between ports is created. The link object is published in the Tree View in the **Links** folder under the corresponding schema object. The presentation of a new created link is shown in the 2D Viewer and colored with the color code according to links' type.
+Each link has an associated property page that, in most cases, shows the link name. For datastream links (CALCIUM links), a properties
+editor allows to set and modify link properties (see :ref:`datastreamlinks`).
-A new created link object has a default name, which contains names of "from" and "to" nodes and ports and cannot be changed by the user (see :ref:`description of link objects in the Tree View <description_of_link_objects>`).
+.. image:: images/functionality_list_60b.jpg
+ :align: center
-The user can delete the created link by choosing **Delete** item from link context popup menu in the Tree View (see :ref:`delete_object` section).
+.. centered::
+ datastream link properties editor
+
+The user can delete a link by choosing **Delete** command from link context popup menu in the Tree View or in the
+2D Viewer (see :ref:`delete_object` section).
.. _edit_object:
Edit an object
--------------
-The edition of the object is one of basic point of modification operations as the creation or deletion. The YACS GUI proposes the edition of the object with help of the :ref:`input_panel`. For this purpose the user should select the object, which properties he wants to edit, in the Tree View.
+The edition of an object is one of basic points of modification operations as the creation or deletion. The YACS GUI proposes the edition
+of an object with help of the :ref:`input_panel`. For this purpose the user should select the object, which properties he wants to edit, in
+the Tree View or in the 2D Viewer.
-As a result of this operation, Input Panel is updated and the property page of the selected object (and objects dependable from this one) is opened. Within the property page(s) the user can modify objects' parameters by typing in corresponding input fields or selecting an item in combo box input fields.
+As a result of this operation, Input Panel is updated and the property page of the selected object (and objects dependable from this one)
+is opened. Within the property page(s) the user can modify objects' parameters by typing in corresponding input fields or selecting an item
+in combo box input fields.
-The user can confirm the modifications by pressing "Apply" button on the Input Panel or cancel modifications of the properties with help of "Close" button.
+The user confirm the modifications by pressing **Apply** button on the Input Panel.
+The **Cancel Edition** button can be used to cancel modifications that have not been already applied.
-If the user finishes the edition process, YACS module updates (if its necessary) Tree View and/or 2D representation of the modified object.
+If the user finishes the edition process, YACS module updates (if it is necessary) Tree View and/or 2D representation of the modified object.
-If there is(are) no any object(s) selected in the Tree View, the Input Panel is hidden. It's worth mentioning that if the user selects something in the Tree View or 2D Viewer before applying the changes in the Input Panel, a warning message is shown informing the user that modifications of the object previously selected are about to be lost, and the user can either confirm the previously done
-modifications or discard its before switching to another object.
+It's worth mentioning that if the user selects something in the Tree View or 2D Viewer before applying the changes in the Input Panel,
+the object background color is changed to yellow to remind applying the changes.
.. _pp_for_container:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
The property page for container definition is shown on the figure below.
-
.. image:: images/functionality_list_61.jpg
:align: center
- :width: 38ex
-
.. centered::
**Container property page**
+.. image:: images/functionality_list_61a.jpg
+ :align: center
-The property page for container allows modify the name and a set of machine parameters of the selected container object. At the beginning machine parameters initialized with the default values. The minimum set of the parameters, which the user have to specify in any case contains the host name. For other parameters its default values can be used. The user can select a host from a list obtained
-with help of SALOME computational resource manager.
+.. centered::
+ **Container property page with advanced parameters shown**
-The user can apply modifications to the selected container object by pressing "Apply" button. In such a case YACS module changes properties of the selected container definition according to new values from the Input Panel and updates the Tree View if it is needed.
+The property page for container allows to modify the name and a set of machine parameters of the selected container object.
+At the beginning, machine parameters are initialized with the default values.
+For most parameters, the default values can be used. The user can select a resource from a list obtained with help of SALOME resource manager
+or use the **automatic** option to let SALOME selects computers. The user can only modify resource parameters (Resource tab)
+when the **automatic** option has been choosen. In that case, resource parameters are constraints used by the resource manager
+to select the best resource for the container. In the other case (specific resource selected), the resource parameters come
+from the resource manager, are the effective ones and are only displayed.
-The user can cancel modifications of the container properties and return to its old values by pressing "Close" button in the Input Panel.
+The user can apply modifications to the selected container object by pressing **Apply** button. In such a case YACS module changes
+properties of the selected container definition according to new values from the Input Panel and updates the Tree View if it is needed.
+The **Cancel Edition** button can be used to cancel modifications that have not been already applied.
.. _pp_for_component_instance_definition:
Property page for component instance definition
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The property page for SALOME/SALOME Python components is shown on the figure below.
-
-
+The property page for SALOME components is shown on the figure below.
.. image:: images/functionality_list_62.jpg
:align: center
- :width: 38ex
-
-
-.. centered::
- **Property page for SALOME/SALOME Python component instance definition**
-
-
-The page allows the user to change the container, in which a component is to be loaded. The user selects it in the list of available container definitions in the current schema.
-
-In the Input Panel for SALOME/SALOME Python component instances the user can also see the type of the selected container object. This field is not editable and use only to provide information about component type.
-
-The property page for CORBA component is shown on the figure below.
-
-
-
-.. image:: images/functionality_list_63.jpg
- :align: center
- :width: 38ex
-
.. centered::
- **Property page for CORBA component instance definition**
-
-
-The property page for CORBA component instance definition provides the user with the information about components' properties. There are no editable fields in such a property page.
+ **Property page for SALOME component instance definition**
-The modification of the component instance definition properties can be confirmed by pressing "Apply" button on the Input Panel. In such a case YACS module changes properties of the selected component according to new values from the Input Panel and updates the Tree View if it is needed. For example, if the user changed the container for the selected SALOME component, the component object should
-be republished in the Tree View: it should be moved under the new container object.
-
-The user can discard modifications of the component instance definition properties and return to its old values by pressing "Close" button on the Input Panel.
+In the Input Panel for SALOME component instances the user can see the name of the selected component object.
+This field is not editable and use only to provide information about component name.
+It is also possible to change the associated container (container: combobox) and to add properties to the component instance.
+These properties are converted to environment variables when the schema is executed.
.. _pp_for_schema:
Property page for schema
~~~~~~~~~~~~~~~~~~~~~~~~
-The schema property page allows the user to specify
-
-
-
-
-+ a name of the schema,
-
-
-+ a current view mode of the schema (see :ref:`change_2d_representation_schema` section).
-
-
-
-
+The schema property page allows the user to specify the name of the schema.
The property page for schema is shown on the figure below.
-
-
.. image:: images/functionality_list_64.jpg
:align: center
- :width: 38ex
-
.. centered::
**Property page for schema**
+It is possible to add properties to the schema.
+These are properties for all the nodes defined in the schema.
.. _pp_for_node:
~~~~~~~~~~~~~~~~~~~~~~
The content of the property page for node depends on the type of the node. Here are property page configurations for the different types of nodes.
-
-
+.. _pp_for_inline_node:
Property page for inline nodes
'''''''''''''''''''''''''''''''''
-The property page for **inline function** and **inline script** nodes is shown on the figure below.
+The property pages for **inline function** and **inline script** nodes are shown on the figures below.
.. image:: images/functionality_list_65.jpg
:align: center
- :width: 65ex
-
.. centered::
- **Property page for inline function and inline script nodes**
+ **Property page for inline script nodes**
-The pages allow the user to
-
-
-
- + specify a name of the node,
-
-
- + read a full name of the node (this field is read only and updated if the user changes the node name),
-
-
- + change the list of input and output ports (it is possible to set port name, choose port type and value type from the corresponding combo boxes, set input values for input port, if it is not linked, and put in study the output port (the last one will be available in the future version!)),
+.. image:: images/functionality_list_65a.jpg
+ :align: center
+.. centered::
+ **Property page for inline function nodes**
- + enter or modify a source code of Python function or script in the built-in Python code editor (syntax highlighting, text selection, cut/copy/paste mechanism, search for a string).
+The pages allow the user to:
++ specify the name of the node,
++ read the full name of the node (this field is read only and updated if the user changes the node name),
++ change the list of input and output ports (it is possible to set port name, choose port type and value type from the corresponding
+ combo boxes, set input values for input port, if it is not linked),
++ change the name of the Python function ("Function Name" entry) to execute for Python function node only,
++ enter or modify a source code of Python function or script in the built-in Python code editor (syntax highlighting, text selection,
+ cut/copy/paste mechanism).
++ generate a template of the python function with the **Template** button when all ports are defined and the function name is set.
++ edit the python code with an external editor (**External Editor** button, if set in :ref:`user preferences <set_user_preferences>`).
+An inline node can be executed in a remote container by setting its execution mode to **Remote** and selecting a container
+in the containers list.
+.. image:: images/functionality_list_65b.jpg
+ :align: center
+.. _pp_for_salome_node:
-Property page for SALOME service and CPP nodes
+Property page for SALOME service
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-The property page for **SALOME service** and **CPP** nodes is shown on the figure below.
+The property page for **SALOME service** nodes is shown on the figure below.
.. image:: images/functionality_list_66.jpg
:align: center
- :width: 65ex
-
.. centered::
- **Property page for SALOME service and CPP nodes**
-
-The page allows the user to
-
-
-
- + change a name of the node,
-
-
- + read a full name of the node (this field is read only and updated if the user changes the node name) and its type,
-
-
- + read a name of existing component instance,
-
-
- + change a container with help of built-in property page for component instance definition,
-
-
- + change properties of the container definition (e.g. host name) with help of built-in property page for container,
-
-
- + read a name of method from the specified component, which will be executed by the node,
-
-
- + change values of input ports, if it is not linked, and put in study the output ports (the last one will be available in the future version!)
+ **Property page for SALOME service nodes**
+The page allows the user to:
++ change the name of the node,
++ read the full name of the node (this field is read only and updated if the user changes the node name) and its type,
++ read the name of the associated component instance,
++ change the associated component instance by selecting it in the list of available component instance definitions in the
+ current schema,
++ change the associated container with help of built-in property page for component instance definition. The user selects it in
+ the list of available container definitions in the current schema,
++ change properties of the associated container (e.g. host name) with help of built-in property page for container,
++ read the name of the method from the associated component, which will be executed by the node,
++ change values of input ports, if it is not linked,
++ change or add properties
Property page for Block node
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
.. image:: images/functionality_list_71.jpg
:align: center
- :width: 48ex
-
.. centered::
**Property page for Block node**
-The page allows the user to
+The page allows the user to :
++ change the name of the node,
++ read the full name of the node (this field is read only and updated if the user changes the node name),
- + change a name of the node,
++ change or add properties. These are properties for all the nodes defined in the Block.
-
- + read a full name of the node (this field is read only and updated if the user changes the node name),
-
-
- + specify the list of direct children nodes using "+" and "-" buttons and the selection control in the SWITCH cases table to pick needed node objects in the schema Tree View.
-
-
-At the current moment only expanded view mode of Block node is available in YACS GUI, i.e. detailed view of Block node with its child nodes which can be a Block nodes too.
-
-
-
-
-
-
-
-
-Property page for FOR loop node
+Property page for For Loop node
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-The property page for **FOR loop** node is shown on the figure below.
+The property page for **For Loop** node is shown on the figure below.
.. image:: images/functionality_list_68.jpg
:align: center
- :width: 48ex
-
.. centered::
- **Property page for FOR loop node**
+ **Property page for For Loop node**
-The page allows the user to
+The page allows the user to:
++ change the name of the node,
++ read the full name of the node (this field is read only and updated if the user changes the node name),
- + change a name of the node,
++ specify the value of the "nsteps" input port if it is not connected with a link,
-
- + read a full name of the node (this field is read only and updated if the user changes the node name),
-
-
- + specify the Integer value of the "nsteps" input port if it is not connected with a link,
-
-
- + read the name of the body node belonging to the same schema: read only field; body node is created by context menu on FOR loop node object in the Tree View.
-
-
-At the current moment only expanded view mode of FOR loop node is available in YACS GUI, i.e. detailed view of FOR node with its body which can be a FOR loop node too.
-
-
-
-
-
-
-
-
-Property page for FOREACH loop node
+Property page for ForEachLoop node
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-The property page for **FOREACH loop** node is shown on the figure below.
+The property page for **ForEachLoop** node is shown on the figure below.
.. image:: images/functionality_list_69.jpg
:align: center
- :width: 48ex
-
.. centered::
- **Property page for FOREACH loop node**
-
-The page allows the user to
-
-
-
- + change a name of the node,
-
-
- + read a full name of the node (this field is read only and updated if the user changes the node name),
-
-
- + specify the Integer value of the "nbBranches" input port if it is not connected with a link,
-
-
- + specify the Sequence value of the "SmplsCollection" input port if it is not connected with a link,
-
+ **Property page for ForEachLoop node**
- + read the name of the body node belonging to the same schema: read only field; body node is created by context menu on FOREACH loop node object in the Tree View.
+The page allows the user to:
++ change the name of the node,
- At the current moment only expanded view mode of FOREACH loop node is available in YACS GUI, i.e. detailed view of FOREACH node with its body which can be a FOREACH loop node too.
++ read the full name of the node (this field is read only and updated if the user changes the node name),
++ read the input type of the loop (read only field),
++ specify the value of the "nbBranches" input port if it is not connected with a link,
++ specify the Sequence value of the "SmplsCollection" input port if it is not connected with a link,
-
-
-
-
-Property page for WHILE loop node
+Property page for While Loop node
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-The property page for **WHILE loop** node is shown on the figure below.
+The property page for **While Loop** node is shown on the figure below.
.. image:: images/functionality_list_67.jpg
:align: center
- :width: 48ex
-
.. centered::
- **Property page for WHILE loop node**
-
-The page allows the user to
-
-
-
- + change a name of the node,
-
-
- + read a full name of the node (this field is read only and updated if the user changes the node name),
-
-
- + specify the Boolean value of the "condition" input port if it is not connected with a link,
-
+ **Property page for While Loop node**
- + read the name of the body node belonging to the same schema: read only field; body node is created by context menu on WHILE loop node object in the Tree View.
+The page allows the user to:
++ change the name of the node,
- At the current moment only expanded view mode of WHILE loop node is available in YACS GUI, i.e. detailed view of WHILE node with its body which can be a WHILE loop node too.
++ read the full name of the node (this field is read only and updated if the user changes the node name),
++ specify the Boolean value of the "condition" input port if it is not connected with a link,
-
-
-
-
-
-
-Property page for SWITCH node
+Property page for Switch node
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-The property page for **SWITCH** node is shown on the figure below.
+The property page for **Switch** node is shown on the figure below.
.. _pp_for_switch_node:
.. image:: images/functionality_list_70.jpg
:align: center
- :width: 48ex
-
.. centered::
- **Property page for SWITCH node**
-
-The page allows the user to
-
-
-
- + change a name of the node,
-
-
- + read a full name of the node (this field is read only and updated if the user changes the node name),
-
+ **Property page for Switch node**
- + specify the Integer value of the "select" input port if it is not connected with a link,
+The page allows the user to:
++ change the name of the node,
- + specify the number of cases ("+" and "-" buttons in the SWITCH cases table), presence of the default branch and nodes for each branch (using the selection control in the SWITCH cases table to pick needed node objects in the schema Tree View).
++ read the full name of the node (this field is read only and updated if the user changes the node name),
++ specify the value of the "select" input port if it is not connected with a link,
- At the current moment only expanded view mode of SWITCH node is available in YACS GUI, i.e. detailed view of SWITCH node with its body nodes which can be a SWITCH nodes too.
-
++ change the case value (integer or "default") associated with child nodes.
+.. _pp_for_optimizer_node:
+Property page for Optimizer Loop node
+''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+The property page for **Optimizer Loop** node is shown on the figure below.
+.. image:: images/functionality_list_47d.jpg
+ :align: center
+.. centered::
+ **Property page for Optimizer Loop**
+The page allows the user to:
+- change the name of the node,
+- read the full name of the node (this field is read only and updated if the user changes the node name),
+- read the input data type (this field is read only and updated if the user changes the plugin),
+- change the number of branches
+- change the plugin : parameters lib and entry
+- change the initialization file : parameter FileNameInitAlg
-Property page for Input data node
+Property page for Input Data node
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-The property page for **Input data** node is shown on the figure below.
+The property page for **Input Data** node is shown on the figure below.
.. image:: images/functionality_list_72.jpg
:align: center
- :width: 65ex
-
.. centered::
- **Property page for Input data node**
-
-The page allows the user to
-
-
-
- + change a name of the node,
-
-
- + read a full name of the node (this field is read only and updated if the user changes the node name) and its type,
-
-
- + specify a file name,
-
+ **Property page for Input Data node**
- + change the list of output ports (it is possible to set port name, choose port type and value type from the corresponding combo boxes, set values for output ports and put its in study (the last one will be available in the future version!)).
+The page allows the user to:
++ change the name of the node,
++ read the full name of the node (this field is read only and updated if the user changes the node name) and its type,
++ change the list of output ports (it is possible to set port name, choose port data type from the corresponding
+ combo boxes, set values for output ports).
-
-
-
-
-
-
-
-Property page for Output data node
+Property page for Output Data node
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-The property page for **Output data** node is shown on the figure below.
+The property page for **Output Data** node is shown on the figure below.
.. image:: images/functionality_list_73.jpg
:align: center
- :width: 65ex
-
.. centered::
- **Property page for Output data node**
-
-The page allows the user to
-
-
-
- + change a name of the node,
-
-
- + read a full name of the node (this field is read only and updated if the user changes the node name) and its type,
+ **Property page for Output Data node**
+The page allows the user to:
- + specify a file name,
++ change the name of the node,
++ read the full name of the node (this field is read only and updated if the user changes the node name) and its type,
- + change the list of input ports (it is possible to set port name, choose port type and value type from the corresponding combo boxes).
++ change the list of input ports (it is possible to set port name, choose port data type from the corresponding combo boxes).
-
-
-
-
-
-
-
-
-
-
-Property page for Input study node
+Property page for Input Study node
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-The property page for **Input study** node is shown on the figure below.
+The property page for **Input Study** node is shown on the figure below.
.. image:: images/functionality_list_74.jpg
:align: center
- :width: 65ex
-
.. centered::
- **Property page for Input study node**
-
-The page allows the user to
-
-
+ **Property page for Input Study node**
- + change a name of the node,
+The page allows the user to:
++ change the name of the node,
- + read a full name of the node (this field is read only and updated if the user changes the node name) and its type,
++ read the full name of the node (this field is read only and updated if the user changes the node name) and its type,
++ change the list of output ports. It is possible to set port name, choose port data type from the corresponding combo boxes, set
+ values for output ports. The values must be SALOME study paths.
- + specify a study ID and study name,
-
-
- + change the list of output ports (it is possible to set port name, choose port type and value type from the corresponding combo boxes, set values for output ports and put its in study (the last one will be available in the future version!)).
-
-
-
-
-
-
-
-
-
-
-
-Property page for Output study node
+Property page for Output Study node
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-The property page for **Output study** node is shown on the figure below.
+The property page for **Output Study** node is shown on the figure below.
.. image:: images/functionality_list_75.jpg
:align: center
- :width: 65ex
-
.. centered::
- **Property page for Output study node**
-
-The page allows the user to
-
-
-
- + change a name of the node,
-
-
- + read a full name of the node (this field is read only and updated if the user changes the node name) and its type,
-
-
- + specify a study ID and study name,
-
-
- + change the list of input ports (it is possible to set port name, choose port type and value type from the corresponding combo boxes).
-
+ **Property page for Output Study node**
+The page allows the user to:
++ change the name of the node,
++ read the full name of the node (this field is read only and updated if the user changes the node name) and its type,
++ change the list of input ports. It is possible to set port name, choose port data type from the corresponding combo boxes and
+ set values that must be SALOME study paths.
.. _delete_object:
----------------
The user can remove one or several objects from the current study.
-To perform this operation the user should select object to be deleted in the Tree View and activates **Delete** item from its context popup menu.
-
-With help of Tree View context popup menu the user can delete the following objects:
-
-
-
-
-+ container,
-
-
-+ component instance,
+To perform this operation the user should select object to be deleted in the Tree View or in the 2D Viewer and activates **Delete** item
+from its context popup menu.
+With help of context popup menu the user can delete the following objects:
+ node,
-
+ link.
-
-
-
-
-
-
.. image:: images/functionality_list_76.jpg
:align: center
- :width: 62ex
-
.. centered::
- **An example of link deletion using link context popup menu in the Tree View**
-
+ **An example of link deletion using link context popup menu in the 2D Viewer**
YACS module deletes the selected object with all sub-objects.
-As the result of delete operation, the tree structure of the active schema in the Tree View and its representation in 2D Viewer are updated to reflect deletion of objects.
+As the result of delete operation, the tree structure of the active schema in the Tree View and its representation in 2D Viewer
+are updated to reflect deletion of objects.
-Input/output ports of inline nodes can be deleted by the user with help of the Input Panel for this type of nodes (see the corresponding paragraph from :ref:`pp_for_node` section).
+Input/output ports of inline nodes can also be deleted by the user with help of the Input Panel for this type of
+nodes (see the corresponding paragraph from :ref:`pp_for_node` section).
--------------------
To work with YACS module the user can activate it in two ways:
-
-
-
#. by activating YACS item in :ref:`modules`,
-
#. by click YACS toolbar button on :ref:`modules`.
+For the correct activation of YACS module it is necessary to install YACS GUI libraries and set YACS_ROOT_DIR environment variable
+pointed to the directory with installed binaries.
+If there is no any study opened/created, during the YACS module activation the user has possibility to choose between opening
+an existing study and creating a new one. When YACS module has been activated, YACS GUI :ref:`main_menu` and :ref:`toolbars`
+corresponding to the state when no calculation schema is being edited or run are shown:
-
-
-For the correct activation of YACS module it is necessary to install YACS GUI libraries and set YACS_ROOT_DIR environment variable pointed to the directory with installed binaries.
-
-If there is no any study opened/created, during the YACS module activation the user has possibility to choose between opening an existing study and creating a new one. When YACS module has been activated, YACS GUI :ref:`main_menu` and :ref:`toolbars` corresponding to the state when no calculation schema is being edited or run are shown:
-
-
-
-.. image:: images/functionality_list_0.jpg
+.. image:: images/functionality_list_0.png
:align: center
- :width: 69ex
-
-
In such a case there are only possibilities for the user to create or import (YACS or SUPERV XML) a schema.
Import/Export a schema
----------------------
-To display either in :ref:`viewer` or in the :ref:`object_browser` and :ref:`tree_view` and edit a schema the user can import the schemas' XML file. The modified schema object can be saved into the specified XML file with help of :ref:`export_schema` YACS GUI command.
+To display either in :ref:`viewer` or in the :ref:`object_browser` and :ref:`tree_view` and edit a schema the user
+can import the schemas' XML file. The modified schema object can be saved into the specified XML file with
+help of :ref:`export_schema` YACS GUI command.
.. _import_yacs_schema:
Import YACS calculation schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The command **Import Schema --> YACS XML** is accessible from :ref:`file` or from the corresponding toolbar button on the :ref:`schema`. On this command call a standard open file dialog box appears and lets user to select desirable YACS XML file.
-
+The command **Import Schema --> YACS XML** is accessible from :ref:`file` or from the corresponding toolbar button
+on the :ref:`schema`. On this command call a standard open file dialog box appears and lets user to select desirable YACS XML file.
-
-.. image:: images/functionality_list_1.jpg
+.. image:: images/functionality_list_1.png
:align: center
- :width: 60ex
.. centered::
**Import YACS XML schema dialog**
-
Imported schema is shown as an entry in :ref:`object_browser`.
-If a selected YACS XML file has incorrect structure, a part of a schema that has been imported successfully (before an error occurred) will be represented in :ref:`object_browser` and :ref:`viewer` and the user will be able to work with it. YACS GUI shows an error message with error description in such a
-case.
+If a selected YACS XML file has incorrect structure, a part of a schema that has been imported successfully (before an error occurred)
+will be represented in :ref:`object_browser` and :ref:`viewer` and the user will be able to work with it. YACS GUI shows an error
+message with error description in such a case.
-Dimensions of drawing area occupied by a graph, positions and dimensions of node presentations, positions of internal link points and type of :ref:`change_2d_representation_schema` is retrieved from YACS XML file in order to correct 2D representation of the schema in the 2D Viewer.
+Dimensions of drawing area occupied by a graph, positions and dimensions of node presentations, positions of internal link points
+and type of :ref:`change_2d_representation_schema` is retrieved from YACS XML file in order to correct 2D representation of the
+schema in the 2D Viewer.
.. _import_supervisor_graph:
Import SALOME Supervisor graph
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-This operation is intended for importing an XML files containing description of calculation schema and having logical structure adopted by existing SALOME 4 Supervisor module. The command **Import Schema --> SUPERV XML** is available from :ref:`file` or from the corresponding toolbar button on the :ref:`schema`. On this command
+This operation is intended for importing an XML files containing description of calculation schema and having logical structure
+adopted by old SALOME 4 Supervisor module. The command **Import Schema --> SUPERV XML** is available from :ref:`file`. On this command
call a standard open file dialog box appears and lets user to select desirable SUPERV XML file.
-
-
-.. image:: images/functionality_list_2.jpg
+.. image:: images/functionality_list_2.png
:align: center
- :width: 61ex
.. centered::
**Import SUPERV XML schema dialog**
Imported schema is shown as an entry in Object Browser.
-If a selected SUPERV XML file has incorrect structure, a part of a schema that has been imported successfully (before an error occurred) will be represented in Object Browser and 2D Viewer and the user will be able to work with it. YACS GUI shows an error message with error description in such a case.
+If a selected SUPERV XML file has incorrect structure, a part of a schema that has been imported successfully (before an error occurred)
+will be represented in Object Browser and 2D Viewer and the user will be able to work with it. YACS GUI shows an error message with
+error description in such a case.
After importing of the SUPERV XML file has been completed a 2D representation of the schema (nodes and links) is displayed in the 2D Viewer.
Export a schema to a file
~~~~~~~~~~~~~~~~~~~~~~~~~
-If user wants to store modifications done in the existing schema or save a new created graph into the YACS XML file, it is needed to make the schema active and choose the **Export schema** command from :ref:`file` or the corresponding toolbar button on the :ref:`schema`. As a result a standard save file dialog appears and lets
-user to input or select desirable YACS XML file name to export the active schema in it.
-
+If user wants to store modifications done in the existing schema or save a new created graph into the YACS XML file, it is needed to make
+the schema active and choose the **Export schema** command from :ref:`file` or the corresponding toolbar button on the :ref:`edition_toolbar`.
+As a result a standard save file dialog appears and lets user input or select desirable YACS XML file name to export the active schema in it.
-
-.. image:: images/functionality_list_3.jpg
+.. image:: images/functionality_list_3.png
:align: center
- :width: 60ex
.. centered::
**Export schema dialog**
-
-YACS module writes description of a schema and its child objects into an XML file. Additionally, schema 2D presentation data is saved in new created XML file.
-
+YACS module writes description of a schema and its child objects into an XML file. Additionally, schema 2D presentation data is saved
+in new created XML file.
Open/Save a study
-----------------
-The user can start his work with the saved earlier study document. To open a saved study, the user has to activate common SALOME 4 GUI operation with help of **Open** command from :ref:`file` or **Open document** toolbar button on the :ref:`standard`. SALOME unpacks YACS XML files from the study. YACS module reads them and re-
-creates the study structure. If XML files in a study have incorrect structure, YACS GUI says that the loaded study is incomplete by showing an error message.
-
-
+The user can start his work with the saved earlier study document. To open a saved study, the user has to activate common SALOME GUI
+operation with help of **Open** command from :ref:`file` or **Open document** toolbar button on the :ref:`standard`. SALOME unpacks
+YACS XML files from the study. YACS module reads them and recreates the study structure. If XML files in a study have incorrect
+structure, YACS GUI says that the loaded study is incomplete by showing an error message.
-.. image:: images/functionality_list_4.jpg
+.. image:: images/functionality_list_4.png
:align: center
- :width: 60ex
.. centered::
**Open a study dialog**
+If the user has finished his work, he can save a study by calling **Save** command from :ref:`file` or **Save document** toolbar button
+on the :ref:`standard`. YACS module stores all schemas from the current study to XML files, which are then packed into a single HDF5 study
+file by SALOME.
-If the user finished his work, he can save a study for the future by calling **Save** command from :ref:`file` or **Save document** toolbar button on the :ref:`standard`. YACS module stores all schemas from the current study to XML files, which are then packed into a single HDF5 study file by SALOME.
-
-
-
-.. image:: images/functionality_list_5.jpg
+.. image:: images/functionality_list_5.png
:align: center
- :width: 60ex
.. centered::
**Save a study dialog**
-
.. _set_user_preferences:
Set user preferences
--------------------
-In the frames of the YACS module the user has a possibility to set his own preferences. There are the following preferences in the YACS GUI for SALOME 4.1:
-
-
-
+In the frames of the YACS module the user has a possibility to set his own preferences. The preferences are regrouped in four tabs:
-+ Link draw color
++ General: Font for Python script, user catalog loaded by default, external python editor if needed, arrangement mode for widgets, various options
+ for the display of links and the creation mode for service nodes.
++ Links colors
++ Nodes and ports colors
++ Node States Colors: in edition and execution
+These preferences can be set by the user with help of standard SALOME GUI operation of
+editing preferences: **Preferences ...** command from :ref:`file`.
-+ Stream link draw color
+After the user has changed the preferences in the Preferences dialog box for YACS module, the system applies the new values of
+preferences to relevant objects either immediately, or only to new instance of objects and, at least, when
+the schema or the study is saved and reopened.
+.. image:: images/functionality_list_6.png
+ :align: center
-+ Link select color
-
-
-+ Link highlight color
-
-
-
-
-
-These preferences can be set by the user with help of standard SALOME 4 GUI operation of editing preferences: **Preferences ...** command from :ref:`file`. But in versions after YASC GUI for SALOME 4.1 the set of preferences can be extended by colors for various node types and states during execution, by preferences for external Python code editor and probably some
-others.
-
-After the user changed the preferences in the Preferences dialog box for YACS module
+.. centered::
+ **Preferences dialog for YACS module, General tab**
+.. image:: images/functionality_list_6a.png
+ :align: center
+.. centered::
+ **Preferences dialog for YACS module, Link Color tab**
-.. image:: images/functionality_list_6.jpg
+.. image:: images/functionality_list_6b.png
:align: center
-.. :width: 86ex
.. centered::
- **Preferences dialog for YACS module**
+ **Preferences dialog for YACS module, Nodes tab**
+.. image:: images/functionality_list_6c.png
+ :align: center
-the system applies the new values of preferences to relevant objects immediately.
-
+.. centered::
+ **Preferences dialog for YACS module, Node States tab**
Select an object
----------------
-Object Browser, Tree View and 2D Viewer provides user with the possibility to select an object. The user can select objects in 2D Viewer or Tree View. There is the mechanism to synchronize selection between 2D Viewer and Tree View in YACS module.
-
-
+Object Browser, Tree View and 2D Viewer provides user with the possibility to select an object. The user can select objects
+in 2D Viewer or Tree View. Synchronisation beetwen Tree View, 2D Viewer and Input Panel is automatic.
-.. image:: images/functionality_list_7.jpg
+.. image:: images/functionality_list_7.png
:align: center
-.. :width: 76ex
.. centered::
**Port selection**
+In 2D Viewer the user can select/highlight nodes, ports and links. In the Tree View the user can select containers definitions, component
+instances definitions, nodes, ports, data types and links.
-In 2D Viewer the user can select/hilight nodes, ports and links. In the Tree View the user can select containers definitions, component instances definitions, nodes, ports, data types and links.
-
-At the current moment YACS module supports only single selection, i.e. the user clicks on a single object with the mouse. However, the following kinds of interactive selection will be implemented in further versions:
-
-
-
-
-+ **Multiple** - the user clicks on different objects while holding SHIFT key pressed. This type of selection is needed, for example, for creation of link between two ports selected in the Object Browser.
-
-
-+ **With rectangle** - the user selects one or several objects by clicking first corner of a rectangle in 2D Viewer and dragging the mouse pointer to the opposite corner with the left mouse button pressed. All objects inside the rectangle become selected.
-
-
-+ **SHIFT mode** - the user clicks on the same object or select object(s) with a rectangle holding SHIFT key pressed, and the system deselects objects that were selected and select objects that were not selected before.
-
-
-
+Today, YACS module supports only single selection, i.e. the user clicks on a single object with the mouse.
-
-The 2D Viewer displays selected/hilighted objects in a distinctive way that allows the user to identify the selected/hilighted objects easily.
+The 2D Viewer displays selected/highlighted objects in a distinctive way that allows the user to identify the selected/highlighted objects easily.
The system state after interactive selection depends on the type of selected object(s):
++ **A single editable object is selected:** Input Panel is shown and contains property pages for the selected object and in some
+ cases for its parent objects in a schema hierarchy. For instance, if an inline script node is selected either in 2D Viewer or in
+ the Tree View, the property page for the selected node will be displayed in the Input Panel.
+ If the user selects SALOME service node, property pages for node, its component and container will be shown in the Input Panel.
-
-
-+ **A single editable object is selected:** Input Panel is shown and contains property pages for the selected object and in some cases for its parent objects in a schema hierarchy. For instance, if an inline script node is selected either in 2D Viewer or in the Tree View, the property page for the selected node will be displayed in the Input Panel.
-
-.. image:: images/functionality_list_8.jpg
+.. image:: images/functionality_list_8.png
:align: center
-.. :width: 107ex
.. centered::
**Node selection**
-If the user selects SALOME service node, property pages for node, its component and container will be shown in the Input Panel.
-
-
-+ **Several objects or a single object that has no editable properties is selected:** Input Panel is hidden.
-
-
-+ **Nothing is selected:** Input Panel is hidden.
-
-
-
++ **A single object that has no editable properties is selected:** Input Panel remains inchanged, with the previous selection.
.. _activate_context_popup_menu:
Activate context popup menu
---------------------------
-In the YACS module the user can perform a set of operations on the different types of objects shown in the Object Browser and Tree View of the schema with help of context popup menu. For this purpose, the user has to click the right mouse button in the Object Browser or in the Tree View of the schema to select the object and choose needed menu item from context popup menu, which contains commands
-applicable to the current selection. For empty selection, only commands applicable to the window (Object Browser, schema Tree View or 2D Viewer) in general are shown in context menu:
-
-
-
+In the YACS module the user can perform a set of operations on the different types of objects shown in the Object Browser and Tree
+View of the schema with help of context popup menu. For this purpose, the user has to click the right mouse button in the Object Browser
+or in the Tree View of the schema to select the object and choose needed menu item from context popup menu, which contains commands
+applicable to the current selection. For empty selection, only commands applicable to the window (Object Browser, schema Tree View
+or 2D Viewer) in general are shown in context menu:
+ Object Browser: **Refresh** and **Find** operations are available.
++ Schema Tree View: not applicable, there is always an item selected.
-+ Schema Tree View: nothing.
-
-
-+ 2D Viewer: **Change background color** operation is available.
-
-
-
++ 2D Viewer: nothing.
+When a single object is selected in the **Object Browser**, its context popup menu contains all operations applicable to objects of
+the given type. Additionally, it contains **Expand all** command for expanding all collapsed items in the selected objects' sub-tree.
+There are currently no specific operation for YACS items in Object Browser popup menus.
-When a single object is selected in the Object Browser, its context popup menu contains all operations applicable to objects of the given type. Additionally, it contains **Expand all** command for expanding all collapsed items in the selected objects' sub-tree.
+By double click on a YACS item of the Object Browser (Schema in edition or execution), YACS switches to the corresponding context and
+synchronizes all corresponding views (Tree View, 2D View, Input Panel). Switching context is also possible via 2D Views tabs.
-Specific operations available for each type of objects selected in the Object Browser are given in the Table 1 below.
+When a single object is selected in the **Tree View** of a schema, its context popup menu contains all operations applicable to objects
+of the given type.
-.. |schema| image:: images/schema.png
-.. |yacs| image:: images/yacs.png
-.. |run| image:: images/run.png
-
-+---------------------------+-----------+---------------------------------------------------------------------------------+
-| **Selected object type** | **Icon** | **Available context menu commands** |
-+===========================+===========+=================================================================================+
-| YACS root item | |yacs| | Standard Salome **Refresh** and **Find** popup menu items. |
-+---------------------------+-----------+---------------------------------------------------------------------------------+
-| Schema | |schema| | **New execution** - create a run schema object. |
-| | | |
-| | | **Load execution state** - restore execution state for the |
-| | | selected schema from an XML file. It is useful if the user |
-| | | wants to continue the execution from a state saved |
-| | | previously. For more detailed information see |
-| | | :ref:`save_restore_execution_state` section. |
-| | | |
-| | | Standard Salome **Refresh** and **Find** popup menu items. |
-+---------------------------+-----------+---------------------------------------------------------------------------------+
-|Execution (run) of a schema| |run| | **New edition** - create a run schema copy for edition. |
-| | | For more detailed information see :ref:`create_new_edition` |
-| | | section. |
-| | | |
-| | | Standard Salome **Refresh** and **Find** popup menu items. |
-+---------------------------+-----------+---------------------------------------------------------------------------------+
-
-.. centered::
- **Table 1. Context popup menus in the Object Browser**
-
-When a single object is selected in the Tree View of a schema, its context popup menu contains all operations applicable to objects of the given type.
+.. _Table_2:
Specific operations available in the **edition mode** for each type of objects selected in the Tree View are given in the Table 2 below.
+.. |schema| image:: images/schema.png
.. |container| image:: images/container.png
.. |component| image:: images/component.png
.. |block| image:: images/block_node.png
.. |data| image:: images/data_link.png
.. |stream| image:: images/stream_link.png
-.. _Table_2:
+--------------------------------+-------------+-------------------------------------------------------------------------------------+
| **Selected object type** | **Icon** | **Available context menu commands** |
+================================+=============+=====================================================================================+
-|Schema | |schema| | |
-| | |**Export** - export the selected schema into the |
-| | |YACS XML file. |
+|Schema | |block| | |
+| | |**Run Current Schema** - execute the selected schema, i.e. create a run |
+| | |schema object. |
| | | |
-| | |**Create a Data Type** (further version) - create a user |
-| | |defined data type inside the schema. |
+| | |**Import a Data Type** - add a data type from the session |
+| | |catalog or data types catalog of another schema into the |
+| | |current schema. |
| | | |
| | |**Create a Container definition** - create an empty container |
| | |with the default name **containerN** (where N = 0,1,2,...) |
| | |inside the current schema. |
| | | |
-| | |**Create a node** - menu which contains submenu for creation |
-| | |different types of nodes inside the current schema. |
-| | | |
-| | |**Execute** - execute the selected schema, i.e. create a run |
-| | |schema object. |
+| | |**Create a node** - submenu for creation of different types of nodes |
+| | |inside the current schema. See :ref:`create_node`. |
| | | |
-| | |**Copy** (further version) - copy a schema with all its |
-| | |components to the buffer. |
-| | | |
-| | |**Paste** (further version) - paste items (if any) from the |
+| | |**Paste** - paste items (if any) from the |
| | |buffer into the current schema. |
| | | |
-| | |**Display** (further version) - display the content of the |
-| | |selected schema in the 2D Viewer. |
+| | |**YACS Container log** - in Execution, shows the YACS Container Log, useful for |
+| | |Python Nodes prints. |
| | | |
-| | |**Erase** (further version) - close the 2D Viewer of the |
-| | |selected schema. |
-+--------------------------------+-------------+-------------------------------------------------------------------------------------+
-|Data Types | |**Edit** (further version) - gives the possibility to edit |
-| | |data types inside the current schema. |
+| | |**Arrange Local Nodes** - Compute Nodes disposition whith GraphViz algorithm, |
+| | |Without modification of internal disposition of children Blocs and other Composed |
+| | |Nodes. |
| | | |
-| | |**Import a Data Type** - add a data type from the session |
-| | |catalog or data types catalog of another schema into the |
-| | |current schema. |
-+--------------------------------+-------------+-------------------------------------------------------------------------------------+
-|Containers | |**Create a Container definition** - create an empty container |
-| | |with the default name **containerN** (where N = 0,1,2,...) |
-| | |inside the current schema. |
-+--------------------------------+-------------+-------------------------------------------------------------------------------------+
-|SALOME container definition | |container| | |
-| | |**Create a component instance definition --> SALOME** - create a new SALOME component|
-| | |and publish it in the Tree View. |
+| | |**Arrange Nodes Recursion** - Compute Nodes disposition whith GraphViz algorithm, |
+| | |With recursion on children Blocs and other Composed Nodes. |
| | | |
-| | |**Create a component instance definition --> SALOME Python** (further version) - |
-| | |create a new SALOME Python component and publish it in the Tree View. |
+| | |**Zoom to Bloc** - Center the 2D view on the Schema and resize the view to fit in |
+| | |the screen |
| | | |
-| | |**Copy** (further version) - copy a container object. |
+| | |**Center on Node** - Center the 2D view on selected Node, without resizing. |
| | | |
-| | |**Paste** (further version) - insert copied objects (if any SALOME components have |
-| | |been copied) under the selected container. |
+| | |**Compute Links** - Recompute links, useful for large schemas, when automatic link |
+| | |calculation have been deactivated, see :ref:`edition_toolbar`. |
| | | |
-| | |**Delete** - delete a container object with all its content. |
++--------------------------------+-------------+-------------------------------------------------------------------------------------+
+|Containers | | |
+| | |**Create a Container definition** - create an empty container |
+| | |with the default name **containerN** (where N = 0,1,2,...) |
+| | |inside the current schema. |
+--------------------------------+-------------+-------------------------------------------------------------------------------------+
|SALOME component instance | |component| | |
-| | |**Create a node --> From catalog** - create a SALOME service node within the active |
-| | |schema and publish it in the Tree View. In such a case the type of service node is |
-| | |chosen from the catalog of services available inside the selected component. |
-|SALOME Python component instance| |component| | |
-| | |**Create a node --> Service inline** (further version) - create a service inline |
-| | |node within the active schema and publish it in the Tree View. |
-| | | |
-| | |**Copy** (further version) - copy a component object. |
-| | | |
-| | |**Delete** - delete a component object with all its content. |
+| | |**Select a Component Instance** - When COMPONENT_INSTANCE_NEW is **deselected** in |
+| | |preferences, this component instance is used for next SALOME service node creation |
+| | |refering to the same Component type, until another component instance is selected. |
+| | |If COMPONENT_INSTANCE_NEW is **selected**, this command has no effect, a new |
+| | |component instance is always created with each SALOME service node creation. |
+--------------------------------+-------------+-------------------------------------------------------------------------------------+
-|CORBA component instance | |component| |**Copy** (further version) - copy a component object. |
-| | | |
-| | |**Delete** - delete a component object with all its content. |
+|Node Reference | | |
+| | |**Select reference** - Select the corresponding node and synchronize all the views. |
+--------------------------------+-------------+-------------------------------------------------------------------------------------+
Node objects.
+
+--------------------------------+-------------+-------------------------------------------------------------------------------------+
| **Selected object type** | **Icon** | **Available context menu commands** |
+================================+=============+=====================================================================================+
-|Block node | |block| |**Create a node** - menu which contains submenu for creation different types of |
-| | |nodes inside the selected composed node. |
-|SWITCH node | |switch| | |
-| | |**Create a loop** - menu which contains submenu for creation FOR, FOREACH or WHILE |
-| | |loop nodes inside the corresponding level of the current schema hierarchy. |
-| | |Such new created loop node has the selected node as a body. |
+|Bloc Node | |block| | |
| | | |
-| | |**Add to library** (further version) - save selected node to the selected directory |
-| | |as XML file. |
+|SWITCH Node | |switch| | |
| | | |
-| | |**Add control link to other node** - connect the selected node and the next selected |
-| | |node with the control flow link. The first selected node is the output node and the |
-| | |second selected node is the input node for the new created control link. |
+|FOR Loop Node | |loop| | |
| | | |
-| | |**Copy** (further version) - copy the selected composed node object. |
+|FOREACH Loop Node | |loop| | |
| | | |
-| | |**Delete** - delete the selected composed node object with all its content. |
+|WHILE Loop Node | |loop| | |
+| | |**Create a node** - submenu for creation of different types of nodes |
+| | |inside the current schema. See :ref:`create_node`. |
| | | |
-| | |**Display** (further version) - display the composed node in the 2D Viewer. |
+| | |**Arrange Local Nodes** - Compute Nodes disposition whith GraphViz algorithm, |
+| | |Without modification of internal disposition of children Blocs and other Composed |
+| | |Nodes. |
| | | |
-| | |**Erase** (further version) - erase the composed node from the 2D Viewer |
-+--------------------------------+-------------+-------------------------------------------------------------------------------------+
-|FOR loop node | |loop| |**Create a body** - menu which contains submenu for creation different types of |
-| | |nodes inside the selected loop node. Such new created node becomes a body of the |
-| | |selected loop node. |
-|FOREACH loop node | |loop| | |
-| | |**Create a loop** - menu which contains submenu for creation FOR, FOREACH or WHILE |
-| | |loop nodes inside the corresponding level of the current schema hierarchy. |
-| | |Such new created loop node has the selected node as a body. |
-|WHILE loop node | |loop| | |
-| | |**Add to library** (further version) - save selected node to the selected |
-| | |directory as XML file. |
+| | |**Arrange Nodes Recursion** - Compute Nodes disposition whith GraphViz algorithm, |
+| | |With recursion on children Blocs and other Composed Nodes. |
| | | |
-| | |**Add control link to other node** - connect the selected node and the next selected |
-| | |node with the control flow link. The first selected node is the output node and |
-| | |the second selected node is the input node for the new created control link. |
+| | |**Zoom to Bloc** - Center the 2D view on the Schema and resize the view to fit in |
+| | |the screen |
| | | |
-| | |**Copy** (further version) - copy the selected loop node object. |
+| | |**Center on Node** - Center the 2D view on selected Node, without resizing. |
| | | |
-| | |**Delete** - delete the selected loop node object with all its content. |
+| | |**Compute Links** - Recompute links, useful for large schemas, when automatic link |
+| | |calculation have been deactivated, see :ref:`edition_toolbar`. |
| | | |
-| | |**Display** (further version) - display the loop node in the 2D Viewer. |
+| | |**Delete** - delete the selected composed node object with all its content. |
| | | |
-| | |**Erase** (further version) - erase the loop node from the 2D Viewer. |
-+--------------------------------+-------------+-------------------------------------------------------------------------------------+
-|Node of any other type | |node| |**Create a loop** - menu which contains submenu for creation FOR, FOREACH or WHILE |
-| | |loop nodes inside the corresponding level of the current schema hierarchy. Such new |
-| | |created loop node has the selected node as a body. |
+| | |**Cut** - cut item and keep it in a temporary buffer for paste elsewhere in the |
+| | |current schema. **Warning! All links between this item and external node are lost!** |
| | | |
-| | |**Add to library** (further version) - save selected node to the selected directory |
-| | |as XML file. |
+| | |**Copy** - keep a copy of the item in a temporary buffer for paste elsewhere in |
+| | |the current schema. |
| | | |
-| | |**Add control link to other node** - connect the selected node and the next selected |
-| | |node with the control flow link. The first selected node is the output node and the |
-| | |second selected node is the input node for the new created control link. |
+| | |**Paste** - paste items (if any) from the |
+| | |buffer into the current schema. |
| | | |
-| | |**Copy** (further version) - copy the selected node object. |
++--------------------------------+-------------+-------------------------------------------------------------------------------------+
+| All other types of nodes | |node| | |
+| | |**Delete** - delete the selected composed node object with all its content. |
| | | |
-| | |**Delete** - delete the selected node object. |
+| | |**Cut** - cut item and keep it in a temporary buffer for paste elsewhere in the |
+| | |current schema. **Warning! All links between this item and external node are lost!** |
| | | |
-| | |**Display** (further version) - display the selected node in the 2D Viewer. |
+| | |**Copy** - keep a copy of the item in a temporary buffer for paste elsewhere in |
+| | |the current schema. |
+| | | |
+| | |**Paste** - paste items (if any) from the |
+| | |buffer into the current schema. |
| | | |
-| | |**Erase** (further version) - erase the selected node from the 2D Viewer. |
+| | |**Zoom to Bloc** - Center the 2D view on the Schema and resize the view to fit in |
+| | |the screen |
+| | | |
+| | |**Center on Node** - Center the 2D view on selected Node, without resizing. |
+--------------------------------+-------------+-------------------------------------------------------------------------------------+
Port and link objects.
|Input port | |inport| |**Delete** - delete the selected input port object. This menu item is available only |
| | |for input ports of non-service nodes. |
+--------------------------------+-------------+-------------------------------------------------------------------------------------+
-|Output port | |outport| |**Add dataflow link** - add the data (flow or stream) / control link from the |
-| | |selected port to the other (selected later). |
-| | | |
-| | |**Add data link** - add a simple data link from the selected port to the other |
-| | |(selected later) without control link automatically added. This functionality is |
-| | |needed inside loop nodes. |
-| | | |
-| | |**Delete** - delete the selected output port object. This menu item is available |
+|Output port | |outport| |**Delete** - delete the selected output port object. This menu item is available |
| | |only for output ports of non-service nodes. |
+--------------------------------+-------------+-------------------------------------------------------------------------------------+
|Control link | |control| |**Delete** - delete the selected link object, update Tree View and 2D Viewer content |
+--------------------------------+-------------+-------------------------------------------------------------------------------------+
.. centered::
- **Table 2. Context popup menus in the Tree View of a schema, edition mode**
+ **Table 2. Context popup menus in the Tree View or 2D View of a schema, edition mode**
+
+
+
+
+The popup menus available on the objects selected in the Tree View or 2D View of a schema in the **run mode** does not include edition commands.
+
++--------------------------------+-------------+-------------------------------------------------------------------------------------+
+| **Selected object type** | **Icon** | **Available context menu commands** |
++================================+=============+=====================================================================================+
+|Schema | |block| | |
+| | | |
+| | |**YACS Container log** - in Execution, shows the YACS Container Log, useful for |
+| | |Python Nodes prints. |
+| | | |
+| | |**Arrange Local Nodes** - Compute Nodes disposition whith GraphViz algorithm, |
+| | |Without modification of internal disposition of children Blocs and other Composed |
+| | |Nodes. |
+| | | |
+| | |**Arrange Nodes Recursion** - Compute Nodes disposition whith GraphViz algorithm, |
+| | |With recursion on children Blocs and other Composed Nodes. |
+| | | |
+| | |**Zoom to Bloc** - Center the 2D view on the Schema and resize the view to fit in |
+| | |the screen |
+| | | |
+| | |**Center on Node** - Center the 2D view on selected Node, without resizing. |
+| | | |
+| | |**Compute Links** - Recompute links, useful for large schemas, when automatic link |
+| | |calculation have been deactivated, see :ref:`edition_toolbar`. |
+| | | |
++--------------------------------+-------------+-------------------------------------------------------------------------------------+
+|Composed nodes | | |
+| | | |
+| | |**YACS Container log** - shows the YACS Container Log, useful for Python Nodes |
+| | |prints. |
+| | | |
+| | |**Arrange Local Nodes** - Compute Nodes disposition whith GraphViz algorithm, |
+| | |Without modification of internal disposition of children Blocs and other Composed |
+| | |Nodes. |
+| | | |
+| | |**Arrange Nodes Recursion** - Compute Nodes disposition whith GraphViz algorithm, |
+| | |With recursion on children Blocs and other Composed Nodes. |
+| | | |
+| | |**Zoom to Bloc** - Center the 2D view on the Schema and resize the view to fit in |
+| | |the screen |
+| | | |
+| | |**Center on Node** - Center the 2D view on selected Node, without resizing. |
+| | | |
+| | |**Compute Links** - Recompute links, useful for large schemas, when automatic link |
+| | |calculation have been deactivated, see :ref:`edition_toolbar`. |
+| | | |
++--------------------------------+-------------+-------------------------------------------------------------------------------------+
+|Elementary nodes | | |
+| | | |
+| | |**Node Error report** - shows the Node Error log |
+| | | |
+| | |**Node Error details** - shows the Node Error log |
+| | | |
+| | |**Node Container log** - shows the Node Container Log (only for services nodes) |
+| | | |
+| | |**Zoom to Bloc** - Center the 2D view on the Schema and resize the view to fit in |
+| | |the screen |
+| | | |
+| | |**Center on Node** - Center the 2D view on selected Node, without resizing. |
+| | | |
++--------------------------------+-------------+-------------------------------------------------------------------------------------+
+
+.. centered::
+ **Table 3. Context popup menus in the Tree View or 2D View of a schema, run mode**
+
-There are no any popup menus available on the objects selected in the Tree View of a schema in the **run mode** .
.. _set_active_schema_or_run:
Set active schema or run of a schema
------------------------------------
-Active schema is a YACS schema from the current study that is used implicitly in all YACS GUI operations working with a schema. Typically, a study can contain several YACS schemas and several executions (run) for a schema. For some YACS GUI operations such as creation of a node, it is convenient to add a new object (node) to the currently active schema.
+Active schema is a YACS schema from the current study that is used implicitly in all YACS GUI operations working with a schema.
+Typically, a study can contain several YACS schemas and several executions (run) for a schema. For some YACS GUI operations such as
+creation of a node, it is convenient to add a new object (node) to the currently active schema.
-YACS GUI allows the user to set a schema/run as active by double click on the schema/run object in the Object Browser or by switching between 2D Viewers showing different schemas/runs.
+YACS GUI allows the user to set a schema/run as active by double click on the schema/run object in the Object Browser or by switching
+between 2D Viewers showing different schemas/runs.
The active schema is used in creation/execution operations.
-
--- /dev/null
+
+.. _optimizationplugin:
+
+Definition of an algorithm for the OptimizerLoop
+==========================================================================
+The definition of the optimization algorithm is done by way of plugin.
+The plugin can be a C++ plugin implemented in a dynamic library (.so file) or a Python plugin implemented in a Python module (.py).
+It is possible to implement two kinds of algorithm : synchronous or asynchronous.
+
+Synchronous algorithm
+--------------------------------------------------
+In synchronous mode, the OptimizerLoop calls the algorithm to know what are the types of the input port (sample sent to the internal node),
+and of the output port (data returned by the internal node). Then it calls the algorithm to initialize
+it. At each iteration, it calls the algorithm to produce new sample or to stop the iteration. Finally, it calls the algorithm
+to finalize the optimization process.
+
+A synchronous algorithm is implemented in a class derived from the base class OptimizerAlgSync with several methods that
+must be implemented and some optional methods (in C++ and in Python):
+
+- **getTCForIn**, this method must return the YACS type of the input port of the internal node
+- **getTCForOut**, this method must return the YACS type of the output port of the internal node
+- **initialize** (optional), this method is called during the algorithm initialization
+- **start**, this method is called at the beginning of iterations
+- **takeDecision**, this method is called at each iteration
+- **finish** (optional), this method is called to finish the algorithm at the end of the iteration process
+
+In Python you need to implement another method:
+
+- **setPool**, this method is used to set the data pool that is used to exchange data
+
+C++ plugin example
+''''''''''''''''''''
+Here is a small example of a C++ synchronous algorithm:
+
+.. code-block:: cpp
+
+ #include <cmath>
+
+ #include "OptimizerAlg.hxx"
+
+ using namespace YACS::ENGINE;
+
+ extern "C"
+ {
+ OptimizerAlgBase * createOptimizerAlgSyncExample(Pool * pool);
+ }
+
+ class OptimizerAlgSyncExample : public OptimizerAlgSync
+ {
+ private:
+ int _idTest;
+ TypeCode *_tcIn;
+ TypeCode *_tcOut;
+ public:
+ OptimizerAlgSyncExample(Pool *pool);
+ virtual ~OptimizerAlgSyncExample();
+ TypeCode *getTCForIn() const;
+ TypeCode *getTCForOut() const;
+ void start();
+ void takeDecision();
+ void initialize(const Any *input) throw(YACS::Exception);
+ void finish();
+ };
+
+ OptimizerAlgSyncExample::OptimizerAlgSyncExample(Pool *pool)
+ : OptimizerAlgSync(pool), _tcIn(0), _tcOut(0), _idTest(0)
+ {
+ _tcIn=new TypeCode(Double);
+ _tcOut=new TypeCode(Int);
+ }
+
+ OptimizerAlgSyncExample::~OptimizerAlgSyncExample()
+ {
+ _tcIn->decrRef();
+ _tcOut->decrRef();
+ }
+
+ //! Return the typecode of the expected input type
+ TypeCode * OptimizerAlgSyncExample::getTCForIn() const
+ {
+ return _tcIn;
+ }
+
+ //! Return the typecode of the expected output type
+ TypeCode * OptimizerAlgSyncExample::getTCForOut() const
+ {
+ return _tcOut;
+ }
+
+ //! Start to fill the pool with samples to evaluate
+ void OptimizerAlgSyncExample::start()
+ {
+ _idTest=0;
+ Any *val=AtomAny::New(1.2);
+ _pool->pushInSample(4,val);
+ val=AtomAny::New(3.4);
+ _pool->pushInSample(9,val);
+ }
+
+ //! This method is called each time a sample has been evaluated.
+ /*!
+ * It can either add new samples to evaluate in the pool, do nothing (wait
+ * for more samples), or empty the pool to finish the evaluation.
+ */
+ void OptimizerAlgSyncExample::takeDecision()
+ {
+ if(_idTest==1)
+ {
+ Any *val=AtomAny::New(5.6);
+ _pool->pushInSample(16,val);
+ val=AtomAny::New(7.8);
+ _pool->pushInSample(25,val);
+ val=AtomAny::New(9. );
+ _pool->pushInSample(36,val);
+ val=AtomAny::New(12.3);
+ _pool->pushInSample(49,val);
+ }
+ else if(_idTest==4)
+ {
+ Any *val=AtomAny::New(45.6);
+ _pool->pushInSample(64,val);
+ val=AtomAny::New(78.9);
+ _pool->pushInSample(81,val);
+ }
+ else
+ {
+ Any *tmp= _pool->getCurrentInSample();
+ if(fabs(tmp->getDoubleValue()-45.6)<1.e-12)
+ _pool->destroyAll();
+ }
+ _idTest++;
+ }
+
+ //! Optional method to initialize the algorithm.
+ /*!
+ * For now, the parameter input is always NULL. It might be used in the
+ * future to initialize an algorithm with custom data.
+ */
+ void OptimizerAlgSyncExample::initialize(const Any *input)
+ throw (YACS::Exception)
+ {
+ }
+
+ /*!
+ * Optional method called when the algorithm has finished, successfully or
+ * not, to perform any necessary clean up.
+ */
+ void OptimizerAlgSyncExample::finish()
+ {
+ }
+
+ //! Factory method to create the algorithm.
+ OptimizerAlgBase * createOptimizerAlgSyncExample(Pool *pool)
+ {
+ return new OptimizerAlgSyncExample(pool);
+ }
+
+
+Here, the entry point in the dynamic library is the name of the factory function : createOptimizerAlgSyncExample
+that returns an instance of the OptimizerAlgSyncExample class that implements the algorithm.
+
+Python plugin example
+''''''''''''''''''''''
+Here, the same example of a synchronous algorithm in Python::
+
+ import SALOMERuntime
+
+ class myalgosync(SALOMERuntime.OptimizerAlgSync):
+ def __init__(self):
+ SALOMERuntime.OptimizerAlgSync.__init__(self, None)
+ r=SALOMERuntime.getSALOMERuntime()
+ self.tin=r.getTypeCode("double")
+ self.tout=r.getTypeCode("int")
+
+ def setPool(self,pool):
+ """Must be implemented to set the pool"""
+ self.pool=pool
+
+ def getTCForIn(self):
+ """returns typecode of type expected as Input"""
+ return self.tin
+
+ def getTCForOut(self):
+ """returns typecode of type expected as Output"""
+ return self.tout
+
+ def initialize(self,input):
+ """Optional method called on initialization. Do nothing here"""
+
+ def start(self):
+ """Start to fill the pool with samples to evaluate."""
+ self.iter=0
+ self.pool.pushInSample(4,1.2)
+ self.pool.pushInSample(9,3.4)
+
+ def takeDecision(self):
+ """ This method is called each time a sample has been evaluated. It can
+ either add new samples to evaluate in the pool, do nothing (wait for
+ more samples), or empty the pool to finish the evaluation.
+ """
+ currentId=self.pool.getCurrentId()
+
+ if self.iter==1:
+ self.pool.pushInSample(16,5.6)
+ self.pool.pushInSample(25,7.8)
+ self.pool.pushInSample(36,9.)
+ self.pool.pushInSample(49,12.3)
+ elif self.iter==4:
+ self.pool.pushInSample(64,45.6)
+ self.pool.pushInSample(81,78.9)
+ else:
+ val=self.pool.getCurrentInSample()
+ if abs(val.getDoubleValue()-45.6) < 1.e-12:
+ self.pool.destroyAll()
+ self.iter=self.iter+1
+
+ def finish(self):
+ """Optional method called when the algorithm has finished, successfully
+ or not, to perform any necessary clean up. Do nothing here"""
+
+Here, the entry point in the Python module is directly the name of the class that implements the algorithm : myalgosync.
+
+
+Asynchronous algorithm
+--------------------------------------------------
+In asynchronous mode, all is the same except that after the initialization phase, the OptimizerLoop calls the algorithm only one time
+to start it in a separate thread.
+
+An asynchronous algorithm is implemented in a class derived from the base class OptimizerAlgASync with several methods that
+must be implemented and some optional methods (in C++ and in Python):
+
+- **getTCForIn**, this method must return the YACS type of the input port of the internal node
+- **getTCForOut**, this method must return the YACS type of the output port of the internal node
+- **initialize** (optional), this method is called during the algorithm initialization
+- **startToTakeDecision**, this method is called to start the iteration process in a separate thread. It is the body of the algorithm.
+- **finish** (optional), this method is called to finish the algorithm at the end of the iteration process
+
+In Python you need to implement another method:
+
+- **setPool**, this method is used to set the data pool that is used to exchange data
+
+C++ plugin example
+''''''''''''''''''''
+Here is a small example of a C++ asynchronous algorithm:
+
+.. code-block:: cpp
+
+ #include "OptimizerAlg.hxx"
+
+ using namespace YACS::ENGINE;
+
+ extern "C"
+ {
+ OptimizerAlgBase * createOptimizerAlgASyncExample(Pool * pool);
+ }
+
+ class OptimizerAlgASyncExample : public OptimizerAlgASync
+ {
+ private:
+ TypeCode * _tcIn;
+ TypeCode * _tcOut;
+ public:
+ OptimizerAlgASyncExample(Pool * pool);
+ virtual ~OptimizerAlgASyncExample();
+ TypeCode * getTCForIn() const;
+ TypeCode * getTCForOut() const;
+ void startToTakeDecision();
+ };
+
+ OptimizerAlgASyncExample::OptimizerAlgASyncExample(Pool * pool)
+ : OptimizerAlgASync(pool), _tcIn(0), _tcOut(0)
+ {
+ _tcIn = new TypeCode(Double);
+ _tcOut = new TypeCode(Int);
+ }
+
+ OptimizerAlgASyncExample::~OptimizerAlgASyncExample()
+ {
+ _tcIn->decrRef();
+ _tcOut->decrRef();
+ }
+
+ //! Return the typecode of the expected input type
+ TypeCode *OptimizerAlgASyncExample::getTCForIn() const
+ {
+ return _tcIn;
+ }
+
+ //! Return the typecode of the expected output type
+ TypeCode *OptimizerAlgASyncExample::getTCForOut() const
+ {
+ return _tcOut;
+ }
+
+ //! This method is called only once to launch the algorithm.
+ /*!
+ * It must first fill the pool with samples to evaluate and call
+ * signalMasterAndWait() to block until a sample has been evaluated. When
+ * returning from this method, it MUST check for an eventual termination
+ * request (with the method isTerminationRequested()). If the termination
+ * is requested, the method must perform any necessary cleanup and return
+ * as soon as possible. Otherwise it can either add new samples to evaluate
+ * in the pool, do nothing (wait for more samples), or empty the pool and
+ * return to finish the evaluation.
+ */
+ void OptimizerAlgASyncExample::startToTakeDecision()
+ {
+ double val = 1.2;
+ for (int i=0 ; i<5 ; i++) {
+ // push a sample in the input of the slave node
+ _pool->pushInSample(i, AtomAny::New(val));
+ // wait until next sample is ready
+ signalMasterAndWait();
+ // check error notification
+ if (isTerminationRequested()) {
+ _pool->destroyAll();
+ return;
+ }
+
+ // get a sample from the output of the slave node
+ Any * v = _pool->getCurrentOutSample();
+ val += v->getIntValue();
+ }
+
+ // in the end destroy the pool content
+ _pool->destroyAll();
+ }
+
+ //! Factory method to create the algorithm.
+ OptimizerAlgBase * createOptimizerAlgASyncExample(Pool * pool)
+ {
+ return new OptimizerAlgASyncExample(pool);
+ }
+
+
+Here, the entry point in the dynamic library is the name of the factory function : createOptimizerAlgASyncExample
+that returns an instance of the OptimizerAlgASyncExample class that implements the algorithm.
+
+Python plugin example
+''''''''''''''''''''''''
+Here is an example of an asynchronous algorithm implemented in Python::
+
+ import SALOMERuntime
+
+ class myalgoasync(SALOMERuntime.OptimizerAlgASync):
+ def __init__(self):
+ SALOMERuntime.OptimizerAlgASync.__init__(self, None)
+ r=SALOMERuntime.getSALOMERuntime()
+ self.tin=r.getTypeCode("double")
+ self.tout=r.getTypeCode("int")
+
+ def setPool(self,pool):
+ """Must be implemented to set the pool"""
+ self.pool=pool
+
+ def getTCForIn(self):
+ """returns typecode of type expected as Input"""
+ return self.tin
+
+ def getTCForOut(self):
+ """returns typecode of type expected as Output"""
+ return self.tout
+
+ def startToTakeDecision(self):
+ """This method is called only once to launch the algorithm. It must
+ first fill the pool with samples to evaluate and call
+ self.signalMasterAndWait() to block until a sample has been
+ evaluated. When returning from this method, it MUST check for an
+ eventual termination request (with the method
+ self.isTerminationRequested()). If the termination is requested, the
+ method must perform any necessary cleanup and return as soon as
+ possible. Otherwise it can either add new samples to evaluate in the
+ pool, do nothing (wait for more samples), or empty the pool and
+ return to finish the evaluation.
+ """
+ val=1.2
+ for iter in xrange(5):
+ #push a sample in the input of the slave node
+ self.pool.pushInSample(iter,val)
+ #wait until next sample is ready
+ self.signalMasterAndWait()
+ #check error notification
+ if self.isTerminationRequested():
+ self.pool.destroyAll()
+ return
+
+ #get a sample from the output of the slave node
+ currentId=self.pool.getCurrentId()
+ v=self.pool.getCurrentOutSample()
+ val=val+v.getIntValue()
+
+ #in the end destroy the pool content
+ self.pool.destroyAll()
+
+Here, the entry point in the Python module is directly the name of the class that implements the algorithm : myalgoasync.
+
+
+C++ algorithm calling Python code
+--------------------------------------------------
+
+In some cases, it can be necessary to implement the algorithm as a C++ class but
+nevertheless to call some Python code from this class. This is also possible with the
+OptimizerLoop and even quite simple. To achieve this, your C++ class should inherit from
+PyOptimizerAlgSync for a synchronous algorithm or from PyOptimizerAlgASync for an
+asynchronous algorithm. The guidelines for developing the algorithm are the same as in
+the C++ case, but you can also call any method from the Python C API. You don't need to
+take care of the Python global interpreter lock or of thread states because this is
+already done in the PyOptimizerAlg classes. An example of this kind of algorithm is the
+class OpenTURNSScriptLauncher that can be found in the module OPENTURNS_SRC.
.. _principes:
-Principes généraux de YACS
+YACS general principles
===============================
-La construction d'un schéma de calcul s'appuie sur le concept de noeud de calcul.
-Un noeud de calcul représente un calcul élémentaire qui peut être l'exécution
-locale d'un script Python ou l'exécution distante d'un service de composant SALOME.
+A calculation scheme is constructed based on the calculation node concept.
+A calculation node represents an elementary calculation that can be the local execution of a Python
+script or the remote execution of a SALOME component service.
-Le schéma de calcul est un assemblage de noeuds de calcul plus ou moins complexe.
+The calculation scheme is a more or less complex assembly of calculation nodes.
-Cet assemblage est réalisé par connexion de ports d'entrée et de sortie de ces noeuds
-de calcul.
+This assembly is made by connecting input and output ports of these calculation nodes.
-Les données sont échangées entre noeuds via les ports. Elles sont typées.
+Data are exchanged between nodes through ports. They are typed.
-Les noeuds composés : Bloc, Loop, Switch, permettent de modulariser un schéma de calcul
-et de définir des processus itératifs, des calculs paramétriques ou des débranchements.
+Composite nodes: Block, Loop, Switch are used to modularise a calculation scheme and define
+iterative processes, parametric calculations or branches.
-Enfin les containers permettent de définir où seront exécutés les composants SALOME
-(sur un réseau ou un cluster).
+Finally, containers can be used to define where SALOME components will be executed (on a network or in a cluster).
.. _datatypes:
-Les types de données
+Data types
----------------------
-Les données échangées entre noeuds de calcul via les ports sont typées.
-On a 4 catégories de types : les types de base, les références d'objets, les séquences et les
-structures.
-Il est possible de définir des types utilisateurs par composition de ces éléments de base.
-De nombreux types sont prédéfinis soit par YACS soit par les composants utilisés comme GEOM ou SMESH.
+Data exchanged between calculation nodes through ports are typed.
+There are four categories of types: basic types, object references, sequences and structures.
+User types can be defined by combining these basic elements.
+Many types are predefined either by YACS or by the components used such as GEOM or SMESH.
-Les types de base
+Basic types
'''''''''''''''''''''
-Les types de base sont au nombre de 5 : int, double, bool, string et file. Ils sont prédéfinis par YACS.
+There are 5 basic types: int, double, bool, string and file. They are predefined by YACS.
================= =====================================
-Type YACS Commentaire
+YACS type Comment
================= =====================================
-int pour les entiers
-double pour les réels doubles
-bool pour les booléens
-string pour les chaines de caractères
-file pour les fichiers
+int for integers
+double for double reals
+bool for booleans
+string for character strings
+file for files
================= =====================================
-Les références d'objet
+Python generic type
+...................
+
+YACS adds a special type for exchanging generic Python objects between Python inline nodes (See :ref:`scriptnode`
+and :ref:`functionnode`). The type is named **pyobj** and uses the pickle module to exchange Python objects.
+Consequently only Python objects that are pickable could be used for YACS **pyobj** ports.
+
+It's forbidden to define the object's type into the node, it should be defined in an external Python module. To avoid
+problems with YACS, you should add the module into your **PYTHONPATH** before launching SALOME.
+
+Object references
''''''''''''''''''''''''''
-Les références d'objet sont utilisées pour typer les objets CORBA gérés par les composants SALOME.
-En général, ces types sont définis par les composants qui les utilisent.
-Pour définir un type YACS référence d'objet, il suffit de lui donner un nom et de l'associer
-au Repository ID CORBA. Voici quelques exemples de types prédéfinis.
+Object references are used to type CORBA objects managed by SALOME components. In general, these types
+are defined by the components that use them. All that is necessary to define a YACS object reference type, is to
+give it a name and associate it with the CORBA Repository ID.
+Some examples of pre-defined types are given below.
================= ==============================
-Type YACS Repository ID CORBA
+YACS type CORBA Repository ID
================= ==============================
Study IDL:SALOMEDS/Study:1.0
SObject IDL:SALOMEDS/SObject:1.0
FIELD IDL:SALOME_MED/FIELD:1.0
================= ==============================
-Il est possible de définir des relations d'héritage simple ou multiple entre ces types.
-Voici un exemple extrait du composant MED.
+Simple or multiple inheritance relations can be defined between these types.
+The following gives an example of the MED component.
================= ============================== =====================================
-Type YACS Types de base Repository ID CORBA
+YACS type Base type CORBA Repository ID
================= ============================== =====================================
FIELDDOUBLE FIELD IDL:SALOME_MED/FIELDDOUBLE:1.0
================= ============================== =====================================
-YACS définit également des types pour les ports datastream :
+.. _calciumtypes:
+
+YACS also defines types for datastream ports:
================= =======================================================
-Type YACS Repository ID CORBA
+YACS type CORBA Repository ID
================= =======================================================
CALCIUM_integer IDL:Ports/Calcium_Ports/Calcium_Integer_Port:1.0
CALCIUM_real IDL:Ports/Calcium_Ports/Calcium_Real_Port:1.0
CALCIUM_complex IDL:Ports/Calcium_Ports/Calcium_Complex_Port:1.0
================= =======================================================
-On peut avoir la liste des types disponsibles en consultant les catalogues des composants
-SALOME : GEOMCatalog.xml, SMESHCatalog.xml, MEDCatalog.xml, etc. Ces catalogues sont au format XML
-qui est décrit ici : :ref:`schemaxml`. On peut également en avoir une vue dans l'IHM graphique en
-consultant le catalogue de composants.
+A list of available types can be obtained by consulting catalogs of SALOME components: GEOMCatalog.xml,
+SMESHCatalog.xml, MEDCalatog.xml, etc. These catalogs are in the XML format that is described in :ref:`schemaxml`.
+A view is also possible in the graphic user interface by viewing the components catalog.
-Les séquences
+Sequences
'''''''''''''''
-Un type séquence sert à typer une liste d'éléments homogènes. Le type contenu dans la liste est le même
-pour tous les éléments.
-Pour définir un type séquence, on lui donne un nom et on spécifie le type des éléments de la séquence.
+A sequence type is used to type a list of homogenous elements. The type contained in the list is the same for
+all elements. A sequence type is defined by giving it a name and specifying the type of elements in the sequence.
-Le KERNEL de SALOME définit des types séquences pour les types de base.
+The SALOME KERNEL defines sequence types for basic types.
================= ==============================
-Type YACS Type des éléments
+YACS type Type of elements
================= ==============================
dblevec double
intvec int
boolvec bool
================= ==============================
-Il est possible de définir un type séquence de séquence. Dans ce cas, le type de l'élément est un type séquence.
+A sequence type can be defined for a sequence. In this case, the element type is a sequence type.
-Les structures
+Structures
''''''''''''''''
-Le type structure sert à typer une donnée structurée comme un struct C. Cette donnée contient des membres nommés
-et typés.
-Pour définir un type structure, on lui donne un nom et on spécifie la liste des membres (nom, type).
+The structure type is used to type a data structured as a C structure. This data contains named and typed members.
+A structure type is defined by giving it a name and specifying the list of members (name, type).
-Le composant GEOM définit un type structure de nom "BCError" comportant un seul membre de nom "incriminated" et
-de type "ListOfLong". "ListOfLong" est lui-même une séquence d'"int".
+For example, the GEOM component defines a structure type with name “BCError” comprising a single member with name “incriminated”
+and type “ListOfLong”. “ListOfLong” itself is a sequence of “int”.
-Les ports
+Ports
-------------
-Un port peut être considéré comme une interface d'un noeud avec l'extérieur.
-Il existe trois types de port : les ports de contrôle, les ports de données et les ports datastream.
-Chacun a une sémantique différente.
-
-Les ports de contrôle
+A port can be considered as an interface of a node with the exterior. There are three types of port: control ports,
+data ports and datastream ports. Each has different semantics.
+
+Control ports
''''''''''''''''''''''''
-Ce type de port est utilisé pour mettre des contraintes sur des enchainements d'exécution de noeuds.
-Un noeud élémentaire ou composé dispose, en général, d'un port de contrôle entrant et d'un port
-sortant.
-Un noeud qui a son port de contrôle d'entrée connecté au port de sortie d'un autre noeud ne
-sera exécuté que lorsque ce deuxième noeud sera terminé.
+This type of port is used to apply constraints on node execution chains. An elementary or composite node
+usually has an input control port and an output control port. A node for which the input control port is connected
+to the output control port of another node will not be executed until the second node is terminated.
-Les ports de données
+Data ports
''''''''''''''''''''''''
-Ce type de port est utilisé pour définir les données qui seront utilisées par le noeud lors de son exécution
-et les données qui seront produites par le noeud à la fin de son exécution.
-Un port de données a un nom, un sens (input, output) et les données qu'il portent ont un type.
-L'ordre de définition des ports est important car il est utilisé comme ordre des arguments lors de l'appel
-des services de composants SALOME.
-
-De façon générale, l'exécution d'un noeud de calcul élémentaire se passe comme suit :
- - le contrôle est donné au noeud via le port de contrôle d'entrée
- - les données d'entrée sont acquises par le noeud via les ports de données d'entrée
- - le noeud s'exécute
- - les données de sortie sont fournies aux ports de sortie
- - le contrôle est rendu par le noeud via le port de contrôle de sortie
-
-Un port de données d'entrée peut être initialisé ou connecté à un port de données de sortie.
-
-Les ports datastream
+This type of port is used to define data that will be used by a node when it is executed, and the data that will be produced
+by the node at the end of its execution. A data port has a name, a direction (input, output) and the data contained in it
+have a type. The order in which ports are defined is important because this order is used as the order of the arguments
+during the call for SALOME component services.
+
+In general, an elementary calculation node is executed as follows:
+ - control is given to the node through the input control port
+ - input data are acquired by the node through the input data ports
+ - the node is executed
+ - output data are provided to output ports
+ - control is returned by the node through the output control port.
+
+An input data port can be initialized or connected to an output data port.
+
+.. _datastreamports:
+
+Datastream ports
''''''''''''''''''''''''
-Ce type de port est utilisé pour l'échange de données pendant l'exécution. Tous les noeuds élémentaires ne supportent
-pas ce type de port. Pour le moment seuls les noeuds liés à des composants SALOME supportent ce type de port.
-Un port datastream a un nom, un sens (input, output) et un type.
-Ce type n'est pas directement le type d'une donnée mais plutôt celui d'un objet CORBA qui gère l'échange de
-données (voir ports DSC pour plus d'informations).
+This type of port is used to exchange data during execution. Not all elementary nodes support this type of port.
+For the moment, this type of port is only supported by nodes related to SALOME components. A datastream port has a name,
+a direction (input, output) and a type. This type is not a data type directly but is rather the type of a CORBA object
+that manages the data exchange (see :ref:`progDSC` for further information on how to implement a datastream port).
+
+It is not a simple task to implement a datastream port so SALOME provides a ready made port called CALCIUM datastream
+port. It has been designed to ease scientific code coupling. You can see more about these ports in :ref:`calcium`.
+Only a limited set of data types can be used to define these ports (see :ref:`CALCIUM types<calciumtypes>`).
+
+A CALCIUM port can be configured by way of properties. A property is a pair (name, value), where name is the name of the property and value
+is a character string that gives its value. Following is the list of properties supported by CALCIUM ports :
+
+.. tabularcolumns:: |p{2.5cm}|p{3.5cm}|L|
-Les noeuds de calcul élémentaires
+================= ============================== =====================================
+Property name Default value Description
+================= ============================== =====================================
+DependencyType TIME_DEPENDENCY specify if data exchanged depend on time (TIME_DEPENDENCY) or on iteration (ITERATION_DEPENDENCY)
+================= ============================== =====================================
+
+
+Elementary calculation nodes
-------------------------------------
-Un noeud de calcul élémentaire représente une fonction de calcul particulière (multiplication de 2 matrices, par exemple).
-Tout noeud de calcul a un type.
-On peut avoir un type de noeud qui exécute un service d'un composant Salome et un autre
-type de noeud qui exécute un bout de script Python.
-Les noeuds de calcul élémentaires se répartissent en deux catégories : les noeuds inlines
-qui s'exécutent en local dans le coupleur YACS et les noeuds de service qui s'exécutent à
-distance et correspondent à la mise en oeuvre de composants SALOME.
+An elementary calculation node represents a particular calculation function (for example multiplication of 2 matrices).
+Every calculation node has a type. There can be one node type that executes a service of a SALOME component and another
+node type that executes a piece of Python script.
+Elementary calculation nodes are distributed into two categories: inline nodes that are executed mainly in the YACS coupler,
+and service nodes that are executed remotely and correspond to the use of SALOME components.
+
+Every calculation node has a name used as an identifier. This identifier must be unique in its definition context. A context is
+defined by a calculation scheme or a composite node.
-Tout noeud de calcul a un nom qui sert d'identificateur. Cet identificateur doit etre unique dans son contexte de définition.
-Un schéma de calcul ou un noeud composé définit un contexte.
+A calculation node has an input control port and an output control port. These control ports are connected through the control flow.
-Un noeud de calcul a un port de contrôle d'entrée et un port de contrôle de sortie.
-Ces ports de contrôle sont connectés à travers le flot de contrôle.
+A calculation node usually has input and output data ports. The number and type of data ports is determined by the type of
+calculation node. These data ports are connected through the data flow.
-Un noeud de calcul a, en général, des ports de données d'entrée et de sortie.
-Le nombre et le type des ports de données est déterminé par le type de noeud de calcul.
-Ces ports de données sont connectés à travers le flot de données.
+A calculation node may have properties. A property is a pair (name, value), where name is the name of the property and value
+is a character string that gives its value.
-Un noeud de calcul peut avoir des propriétés. Une propriété est un couple (nom, valeur)
-où nom est le nom de la propriété et valeur une chaine de caractère qui donne sa valeur.
+.. _scriptnode:
-Noeud inline script Python
+Python script inline node
''''''''''''''''''''''''''''''
-Un noeud script Python exécute du code Python dans un contexte où sont présentes des variables
-qui ont pour valeur le contenu des ports de données d'entrée au lancement de cette exécution.
-Par exemple, si le noeud a un port de données d'entrée de nom "matrice", la variable "matrice" sera
-présente dans le contexte d'exécution du script et aura pour valeur le contenu du port de même nom.
-En fin d'exécution du script, les ports de données de sortie sont remplis avec les valeurs des variables
-de même nom présentes dans le contexte d'exécution. Ces variables doivent être obligatoirement présentes.
+A Python script node executes the Python code in a context in which variables are present with a value equal to the content
+of input data ports when this execution is started. For example, if the node has an input data port named “matrix”, the
+variable “matrix” will be present in the execution context of the script and its value will be the content of the port with the
+same name. At the end of execution of the script, the output data ports will contain the values of variables with the same
+name present in the execution context. These variables must necessarily be present.
-Lorsque ce type de noeud est un noeud interne d'une boucle, le contexte d'exécution est réinitialisé
-à chaque tour de boucle.
+When this type of node is an internal node in a loop, the execution context is reinitialised for each iteration of the loop.
-Noeud inline fonction Python
+This type of node is executed mainly in the YACS process but it can be executed in remote
+processes (but only in YACS containers :ref:`containers`).
+
+To create this type of node:
+
+- from the GUI, see :ref:`inline_script`
+- in a XML file, see :ref:`xml_script_node`
+- from python interface, see :ref:`pyscript`
+
+.. _functionnode:
+
+Python function inline node
''''''''''''''''''''''''''''''
-Un noeud fonction Python exécute une fonction Python dont les arguments correspondent aux ports de données
-d'entrée du noeud. Le nom de la fonction à exécuter est donné par un paramètre du noeud.
-Si un tel noeud a 3 ports de données d'entrée de nom 'a', 'b', 'c' et que le nom de la fonction est 'f', l'exécution
-du noeud correspondra à l'appel de f(a,b,c) où a, b et c sont les valeurs des ports de données de même nom.
+A Python function node executes a Python function, for which the arguments correspond to the node input data ports.
+The name of the function to be executed is given by a parameter of the node. If such a node has 3 input data ports
+named 'a', 'b', 'c' and the name of the function is 'f', execution of the node will correspond to calling f(a,b,c) where a, b and c
+are the values of data ports with the same name.
+
+Node output data are expected in return from the function in the form of a Python tuple. For example, if there are three
+output data ports named 'x', 'y', 'z', the function should terminate by "return x,y,z" where x, y and z are values
+for the output ports of the same name.
+
+When this type of node is an internal node in a loop, the execution context is kept for every iteration of the loop, so
+that variables can be reused during iterations.
-Les données de sortie du noeud sont attendues comme un retour de la fonction sous la forme d'un tuple Python.
-Par exemple, si on a 3 ports de données de sortie de nom 'x', 'y', 'z', la fonction devra se terminer
-par "return x,y,z" où x,y et z sont les valeurs pour les ports de sortie de même nom.
+This type of node is executed mainly in the YACS process but it can be executed in remote
+processes (but only in YACS containers :ref:`containers`).
-Lorsque ce type de noeud est un noeud interne d'une boucle, le contexte d'exécution est conservé
-à chaque tour de boucle ce qui permet de réutiliser des variables pendant les itérations.
+To create this type of node:
-Noeud de service SALOME
+- from the GUI, see :ref:`inline_function`
+- in a XML file, see :ref:`xml_function_node`
+- from python interface, see :ref:`pyfunc`
+
+.. _servicenode:
+
+SALOME service node
''''''''''''''''''''''''''''''
-Un noeud de service SALOME exécute un service d'un composant SALOME.
-On peut définir un noeud de service de deux façons :
+A SALOME service node executes a service of a SALOME component.
+A service node can be defined in two ways:
+
+ 1. by indicating the component type (GEOM, SMESH, etc.) and the service to be executed
+ 2. by indicating an existing service node and the service to be executed
- 1. en indiquant le type de composant (GEOM, SMESH, ...) et le service à exécuter
- 2. en indiquant un noeud de service existant et le service à exécuter
+The second form exists because in some cases, it is required to use the state of the component at the end of execution of the
+first service to execute the second service. The state of the component is kept in a component instance that is created
+every time that the first form is used. If the second form is used, the existing instance is reused and a new component
+instance will not be created.
-La deuxième forme existe car, dans certains cas, on veut utiliser l'état du composant à la
-fin de l'exécution du premier service pour exécuter le deuxième service. L'état du composant
-est conservé dans une instance de composant qui est créée à chaque fois qu'on utilise la
-première forme. Si on utilise la deuxième forme, on ne crée pas une nouvelle instance de
-composant mais on réutilise l'instance existante.
+A service node has input and output data ports and it may also have input and output datastream ports.
-Un noeud de service a des ports de données d'entrée et de sortie et peut avoir également
-des ports datastream d'entrée et de sortie.
+A service node is loaded and executed on a SALOME container. This placement is managed using the YACS container concept
+(see :ref:`containers`) that is a slight abstraction of the SALOME container.
+Placement of the SALOME service can be managed by the same name to denote the YACS container on which it is to be placed.
+This is only possible with the first node definition form. If no placement information is given, the service will be placed
+on the default container of the SALOME platform: FactoryServer container on the local machine.
-Un noeud de service est chargé et exécuté sur un container SALOME. Ce placement est géré
-au moyen du concept de container YACS (voir `Les containers`_) qui est une légère abstraction
-du container SALOME.
-Pour gérer le placement du service SALOME, il est possible de désigner par son nom le container
-YACS sur lequel on veut qu'il soit placé. Ceci n'est possible qu'avec la première forme de définition
-du noeud. Si aucune information de placement n'est donnée, le service sera placé sur
-le container par défaut de la plate-forme SALOME : container FactoryServer sur la machine locale.
+The properties of a SALOME service node are converted into environment variables when the service is executed and can be retrieved
+in the component with the method getProperties that returns an Engines::FieldsDict struct. The retrieved properties are the
+properties of the node completed by the properties of the including Blocs.
-Les propriétés d'un noeud de service SALOME sont converties en variable d'environnement
-lors de l'exécution du service.
+To create this type of node:
-Noeud SalomePython
+- from the GUI, see :ref:`salome_service`
+- in a XML file, see :ref:`xml_service_node`
+- from python interface, see :ref:`pyservice`
+
+SalomePython node
''''''''''''''''''''''''''''''
-Un noeud SalomePython est un noeud fonction Python à qui YACS fournit (dans le contexte
-d'exécution Python) les informations nécessaires pour lancer des composants SALOME et exécuter leurs services.
-Il s'agit de l'adresse du container sur lequel il faut charger et exécuter le composant. Cette adresse
-est donnée dans la variable "__container__from__YACS__" qui a la forme <nom machine>/<nom container>.
-Ce noeud est donc paramétrable avec des informations de placement sur un container comme un noeud
-de service SALOME.
+A SalomePython node is a Python function node to which YACS provides the information necessary to run SALOME
+components and execute their services (in the Python execution context). It is the address of the container into
+which the component is to be loaded and executed. This address is given in the "_container_from_YACS_" variable
+in the form <machine name>/<container name>. Therefore, parameters can be set for this node using container placement
+information like a SALOME service node.
-Restriction : ce type de noeud ne peut pas exécuter de service SALOME doté de ports datastream. Le noeud
-est vu par YACS comme un noeud Python. Les ports datastream ne sont pas gérés.
+Restriction: this type of node cannot execute a SALOME service with datastream ports. The node is seen by YACS
+as being a Python node. Datastream ports are not managed.
-Noeuds Data
+Data nodes
''''''''''''''''''''''''''''''
-Un noeud Data sert à définir des données (noeud DataIn) ou à collecter des résultats (noeud DataOut)
-d'un schéma de calcul.
+A Data node is used to define data (DataIn node) or to collect results (DataOut node) of a calculation scheme.
-Noeud DataIn
+DataIn node
++++++++++++++++++
-Un noeud DataIn a uniquement des ports de données sortants qui servent à définir les données d'entrée
-du schéma de calcul.
-Ces données ont un nom (le nom du port), un type (le type du port) et une valeur initiale.
+A DataIn node has output data ports only that are used to define input data for the calculation scheme. These data have a name (the port name), a type (the port type) and an initial value.
+
+To create this type of node:
+
+- from the GUI, see :ref:`datain_node`
+- in a XML file, see :ref:`xml_datain`
+- from python interface, see :ref:`py_datain`
-Noeud DataOut
+DataOut node
++++++++++++++++++
-Un noeud DataOut a uniquement des ports de données entrants qui servent pour stocker les résultats en sortie
-du schéma de calcul.
-Ces résultats ont un nom (le nom du port) et un type (le type du port).
-Si le résultat est un fichier, on peut donner un nom de fichier dans lequel le fichier résultat sera copié.
+A DataOut node only has input data ports that are used to store output results from the calculation scheme. These results have a name (the port name) and a type (the port type). If the result is a file, a name can be given to the file into which the result file will be copied.
-L'ensemble des valeurs des résultats du noeud peut être sauvegardé dans un fichier en fin de calcul.
+All values of node results can be saved in a file at the end of the calculation.
-Noeuds Study
+To create this type of node:
+
+- from the GUI, see :ref:`dataout_node`
+- in a XML file, see :ref:`xml_dataout`
+- from python interface, see :ref:`py_dataout`
+
+Study nodes
''''''''''''''''''''''''''''''
-Un noeud Study sert à relier les éléments d'une étude SALOME aux données et résultats d'un schéma de calcul.
+A Study node is used to relate the elements of a SALOME study to the data and results of a calculation scheme.
-Noeud StudyIn
+StudyIn node
++++++++++++++++++
-Un noeud StudyIn a uniquement des ports de données sortants. Il sert pour définir les données
-du schéma de calcul provenant d'une étude SALOME.
-L'étude associée est donnée par son StudyID SALOME.
+A StudyIn node has output data ports only. It is used to define data in the calculation scheme originating from a SALOME study. The associated study is given by its SALOME StudyID.
+
+A port corresponds to data stored in the associated study. The data has a name (the port name), a type (the port type), and a reference that gives the entry into the study. This reference is either a SALOME Entry (for example 0:1:1:2) or a path in the SALOME study tree (for example, /Geometry/box_1).
-Un port correspond à une donnée stockée dans l'étude associée. La donnée a un nom (le nom du port),
-un type (le type du port) et une référence qui donne l'entrée dans l'étude. Cette référence est
-soit une Entry SALOME (par exemple, 0:1:1:2) soit un chemin dans l'arbre d'étude SALOME (par exemple,
-/Geometry/Box_1).
+To create this type of node:
+- from the GUI, see :ref:`studyin_node`
+- in a XML file, see :ref:`xml_studyin`
+- from python interface, see :ref:`py_studyin`
-Noeud StudyOut
+StudyOut node
++++++++++++++++++
-Un noeud StudyOut a uniquement des ports de données entrants. Il sert pour ranger des
-résultats dans une étude SALOME.
-L'étude associée est donnée par son StudyID SALOME.
+A StudyOut node only has input data ports. It is used to store results in a SALOME study. The associated study is given by its SALOME StudyID.
-Un port correspond à un résultat stocké dans l'étude associée. Le résultat a un nom (le nom du port),
-un type (le type du port) et une référence qui donne l'entrée dans l'étude.
-Cette référence est soit une Entry SALOME (par exemple, 0:1:1:2) soit un chemin dans l'arbre
-d'étude SALOME (par exemple, /Geometry/Box_1).
+A port corresponds to a result to be stored in an associated study. The result has a name (the port name), a type (the port type), and a reference that gives the entry into the study. This reference is either a SALOME Entry (for example 0:1:1:2) or a path in the SALOME study tree (for example, /Geometry/box_1).
-L'étude associée peut être sauvegardée dans un fichier en fin de calcul.
+The associated study may be saved in a file at the end of the calculation.
-Les connexions
+To create this type of node:
+
+- from the GUI, see :ref:`studyout_node`
+- in a XML file, see :ref:`xml_studyout`
+- from python interface, see :ref:`py_studyout`
+
+Connections
-----------------
-Les connexions entre ports d'entrée et de sortie des noeuds élémentaires ou composés sont
-réalisées en établissant des liens entre ces ports.
+Connections between input and output ports of elementary or composite nodes are made by creating links between these ports.
-Les liens de contrôle
+Control links
''''''''''''''''''''''''''''''
-Les liens de contrôle servent à définir un ordre dans l'exécution des noeuds. Ils relient
-un port de sortie d'un noeud à un port d'entrée d'un autre noeud. Ces deux noeuds
-doivent être définis dans le même contexte.
-La définition du lien se réduit à donner le nom du noeud amont et le nom du noeud aval.
+Control links are used to define an order in which nodes will be executed. They relate an output port of one node to an input port of another node. These two nodes must be defined in the same context. The definition of the link consists simply of giving the name of the input side node and the name of the output side node.
-Les liens dataflow
+Dataflow links
''''''''''''''''''''''''''''''
-Les liens dataflow servent à définir un flot de données entre un port de données de sortie d'un noeud
-et un port de données d'entrée d'un autre noeud. Il n'est pas nécessaire que ces noeuds soient définis dans
-le même contexte.
-Un lien dataflow ajoute un lien de contrôle entre les deux noeuds concernés
-ou entre les noeuds parents adéquats pour respecter la règle de définition des liens de
-contrôle. Le lien dataflow garantit la cohérence entre le flot de données et l'ordre d'exécution.
-Pour définir le lien, il suffit de donner les noms du noeud et du port amont et les noms du noeud
-et du port aval.
-Les types des ports doivent être compatibles (voir `Compatibilité des types de données`_).
-
-Les liens data
+Dataflow links are used to define a dataflow between an output data port for one node and an input data
+port for another node. There is no need for these nodes to be defined in the same context. A dataflow link adds a control
+link between the two nodes concerned or between the appropriate parent nodes to respect the rule for definition of the
+control links. The dataflow link guarantees consistency between the dataflow and the execution order.
+All that is necessary to define the link is to give the names of the input side node and port and the names of the output
+side node and port.
+The port types must be compatible (see :ref:`compatibility`).
+
+Data links
''''''''''''''''''''''''''''''
-Dans quelques cas (boucles principalement), il est utile de pouvoir définir des flots de données
-sans définir le lien de contrôle associé comme dans le lien dataflow. On utilise alors le lien
-data.
-La définition est identique à celle du lien dataflow.
-Les types des ports doivent être compatibles (voir `Compatibilité des types de données`_).
+In some cases (mainly loops), it is useful to be able to define dataflows without defining the associated control link
+as in the dataflow link. The datalink is then used. The definition is exactly the same as for the dataflow link.
+The port types must be compatible (see :ref:`compatibility`).
+
+.. _datastreamlinks:
-Les liens datastream
+Datastream links
''''''''''''''''''''''''''''''
-Les liens datastream servent à définir un flot de données entre un port datastream sortant d'un noeud et un
-port datastream entrant d'un autre noeud. Ces deux noeuds doivent être définis dans un même contexte
-et pouvoir être exécutés en parallèle. Il ne doit donc exister aucun lien de contrôle direct
-ou indirect entre eux.
-Pour définir le lien, on donne les noms du noeud et du port sortant et les noms du noeud
-et du port entrant. La définition des liens datastream peut être complétée par des propriétés
-qui paramètrent le comportement du port DSC qui réalise l'échange de données (voir ports DSC).
-Les types des ports doivent être compatibles (voir `Compatibilité des types de données`_).
-
-Compatibilité des types de données
+Datastream links are used to define a data stream between an output datastream port for one node and an input datastream port
+for another node. These two nodes must be defined in the same context and it must be possible to execute them in parallel.
+Therefore, there must not be direct or indirect control link between them. The link is defined by giving output node and port
+names and input node and port names. The definition of the datastream links may be complemented by properties that
+define parameters of the behaviour of the DSC port that makes the data exchange (see :ref:`progDSC`).
+The port types must be compatible (see :ref:`compatibility`).
+
+For CALCIUM datastream ports, links can be configured by way of properties that are listed here (more information about them
+can be found in :ref:`calcium`):
+
+.. tabularcolumns:: |p{3cm}|p{3cm}|L|
+
+==================== ============================== =====================================
+Property name Default value Description
+==================== ============================== =====================================
+DateCalSchem TI_SCHEM specify the temporal scheme (TI_SCHEM, TF_SCHEM, ALPHA_SCHEM) for ports with time dependency
+StorageLevel infinite specify the maximum number of data kept in the destination port
+Alpha 0.0 specify the coefficient of the ALPHA_SCHEM
+DeltaT 1.e-6 tolerance to check if two dates are identical
+InterpolationSchem L1_SCHEM specify the interpolation function (linear:L1_SCHEM or step:L0_SCHEM)
+ExtrapolationSchem not defined specify the extrapolation function (E0_SCHEM or E1_SCHEM) in case of timeout (not implemented)
+==================== ============================== =====================================
+
+As for other ports, CALCIUM port types must be compatible to be connected. But they must also have the same DependencyType
+property (see :ref:`datastreamports`).
+
+.. _compatibility:
+
+Compatibility of data types
'''''''''''''''''''''''''''''''''''''''''
-Un lien data, dataflow ou datastream peut être créé seulement si le type de données du port
-sortant est compatible avec le type de données du port entrant.
-Il y a trois formes de compatibilité :
+A data, dataflow or datastream link may only be created if the data type of the output port is compatible with the data type
+of the input port. There are three forms of compatibility:
- - l'identité des types (par exemple double -> double)
- - la spécialisation des types (par exemple FIELDDOUBLE -> FIELD)
- - la conversion des types (par exemple int -> double)
+ - identity of types (for example double -> double)
+ - specialization of types (for example FIELDDOUBLE -> FIELD)
+ - type conversion (for example int -> double)
-Compatibilité par conversion
+Compatibility by conversion
+++++++++++++++++++++++++++++++
-La compatibilité par conversion s'applique uniquement aux types de base et à leurs dérivés
-(séquence, structure).
-Les conversions acceptées sont les suivantes :
+Compatibility by conversion is applicable to basic types and to their derivatives (sequence, structure).
+The following conversions are accepted:
================= ============================== ====================================
-Type YACS Conversion possible en Commentaire
+YACS type Conversion possible into Comment
================= ============================== ====================================
int double
-int bool true si int != 0 false sinon
+int bool true if int != 0 else false
================= ============================== ====================================
-La conversion s'applique également aux types construits comme une séquence d'int qui
-peut être convertie en une séquence de double. YACS prend en charge la conversion.
-Ceci s'applique également aux structures et aux types imbriqués séquence de séquence,
-structure de structure, séquence de structure, etc.
+The conversion is also applicable to types constructed as a sequence of ints that may be converted into a
+sequence of doubles. YACS controls the conversion. This is also applicable to nested sequence of sequence, structure
+of structure, sequence of structure structures and types, etc.
-Compatibilité par spécialisation
-+++++++++++++++++++++++++++++++++++
-La règle de compatibilité s'exprime différemment pour les liens data (ou dataflow) et les
-liens datastream.
+Compatibility by specialization
++++++++++++++++++++++++++++++++
+The compatibility rule is expressed differently for data (or dataflow) links and datastream links.
-Dans le cas des liens data (ou dataflow), il faut que le type du port de données sortant
-soit dérivé (ou identique) du type du port de données entrant. Par exemple un port de données
-sortant avec un type FIELDDOUBLE pourra être connecté à un port de données entrant avec le
-type FIELD car le type FIELDDOUBLE est dérivé du type FIELD (ou FIELD est type de base de
-FIELDDOUBLE).
+For data (or dataflow) links, the type of output data port must be derived from (or identical to) the type of input
+data port. For example, an output data port with a FIELDDOUBLE type may be connected to an input data port with
+the FIELD type because the FIELDDOUBLE type is derived from the FIELD type (where FIELD is the basic type of FIELDDOUBLE).
-Dans le cas des liens datastream, la règle est l'exact inverse de celle pour les liens data :
-le type du port datastream entrant doit être dérivé de celui du port sortant. Il n'existe
-pour le moment aucun type datastream dérivé. La seule règle qui s'applique est donc l'identité
-des types.
+The rule for datastream links is exactly the opposite of the rule for data links: the type of the input datastream port
+must be derived from the type of the output port.
+At the moment there is no derived datastream type. Therefore the only applicable rule is identity of types.
-Liens multiples
+Multiple links
'''''''''''''''''''
-Les ports de contrôle supportent les liens multiples, aussi bien 1 vers N que N vers 1.
-
-Les ports de données supportent les liens multiples 1 vers N et N vers 1.
-Les liens 1 vers N ne posent pas de problèmes. Les liens N vers 1 sont à utiliser avec
-précaution car le résultat final dépend de l'ordre dans lequel sont réalisés les échanges.
-On réservera ce type de lien pour les rebouclages dans les boucles itératives. Dans ce
-cas l'ordre de réalisation des échanges est parfaitement reproductible.
-
-Les ports datastream supportent également les liens multiples, 1 vers N et N vers 1.
-Les liens datastream 1 vers N ne posent pas de problèmes particuliers : les échanges de données sont
-simplement dupliqués pour tous les ports d'entrée connectés.
-Par contre, pour les liens datastream N vers 1, les échanges de données vont se recouvrir dans
-l'unique port d'entrée. Le résultat final peut dépendre de l'ordre dans lequel seront réalisés
-les échanges.
-
-Les noeuds composés
+Control ports support 1 to N and N to 1 multiple links.
+
+Data ports support 1 to N and N to 1 multiple links. 1 to N links do not create any problem. N to 1 links should be used with
+caution, because the final result depends on the order in which the exchanges are made. This type of link will be reserved
+for looping back in iterative loops. In this case, the order in which exchanges are made is perfectly reproducible.
+
+Datastream ports also support 1 to N and N to 1 multiple links. 1 to N datastream links do not create any particular problems: data
+exchanges are simply duplicated for all connected input ports. However, data exchanges for N to 1 datastream links will be
+overlapped in the single input port. The final result may depend on the order in which exchanges are made.
+
+Composite nodes
--------------------------------
-Les noeuds composés sont de plusieurs types : bloc, boucles, noeud-switch.
-Un noeud composé peut contenir un ou plusieurs noeuds de type quelconque (élémentaires ou composés).
-Par défaut, l'ensemble des entrées et sorties des noeuds constituant le noeud composé sont accessibles de l'extérieur.
-On peut dire que les entrées du noeud composé sont constituées de l'ensemble des entrées des noeuds internes.
-Même chose pour les sorties. C'est le concept de boîte blanche.
+There are several types of composite nodes, namely block, loop and switch nodes.
+A composite node may contain one or several nodes of an arbitrary type (elementary or composite).
+By default, the set of node inputs and outputs making up the composite node are accessible from the outside.
+It can be said that composite node inputs are composed of the set of internal node inputs. The same is applicable for outputs.
+This is the white box concept.
-Le noeud Bloc
+The Bloc node
''''''''''''''
-C'est un regroupement de noeuds avec des liens de dépendance entre les noeuds internes.
-Le Bloc est une boite blanche (les noeuds internes sont visibles).
-Un schéma de calcul est un Bloc.
-Le Bloc se manipule de façon similaire à un noeud élémentaire.
-Il dispose d'un seul port de contrôle en entrée et d'un seul en sortie.
-En conséquence, deux blocs raccordés par un lien de donnée dataflow s'exécutent en séquence, tous les noeuds du premier bloc sont exécutés avant de passer au second bloc.
-
-Le noeud ForLoop
-''''''''''''''''''''''
-Une boucle permet des itérations sur un noeud interne.
-Ce noeud interne peut être un noeud composé ou un noeud élémentaire.
-Certaines des sorties du noeud interne peuvent être explicitement rebouclées sur des entrées de ce même noeud interne.
-Une boucle ForLoop exécute le noeud interne un nombre fixe de fois. Ce nombre est donné par un port
-de donnée de la boucle de nom "nsteps" ou par un paramètre de la boucle de même nom.
+This is a group of nodes with dependency links between internal nodes.
+The Bloc is a white box (internal nodes are visible).
+A calculation scheme is a Bloc. The Bloc is manipulated in a manner similar to an elementary node.
+It is provided with a single input control port and a single output control port.
+Consequently, two blocks connected through a dataflow data link will be executed in sequence, all nodes in the
+first block will be executed before starting the second block.
-Le noeud While
-''''''''''''''''''''''
-Une boucle While exécute le noeud interne tant qu'une condition est vraie. La valeur de la condition
-est donnée par un port de donnée de la boucle de nom "condition".
+A Bloc node may have properties. A property is a pair (name, value), where name is the name of the property and value
+is a character string that gives its value. The properties of a Bloc are inherited by the nodes in the Bloc.
+
+To create this type of node:
+
+- from the GUI, see :ref:`block_node`
+- in a XML file, see :ref:`xml_block`
+- from python interface, see :ref:`py_block`
+
+The ForLoop node
+'''''''''''''''''''''
+A loop is used to make iterations on an internal node.
+This internal node may be a composite node or an elementary node.
+Some internal node outputs may be explicitly looped back onto inputs of this internal node.
+A ForLoop loop executes the internal node a fixed number of times. This number is given by a data port in the loop
+named “nsteps” or by a parameter of the loop of the same name. The current step number is accessible through
+an output port of the loop named "index".
+
+To create this type of node:
-Le noeud ForEach
+- from the GUI, see :ref:`forloop_node`
+- in a XML file, see :ref:`xml_forloop`
+- from python interface, see :ref:`py_forloop`
+
+The While node
+''''''''''''''''''''
+A While loop executes the internal node as long as a condition is true.
+The value of the condition is given by a data port of the loop named “condition”.
+
+To create this type of node:
+
+- from the GUI, see :ref:`whileloop_node`
+- in a XML file, see :ref:`xml_whileloop`
+- from python interface, see :ref:`py_whileloop`
+
+The ForEach node
''''''''''''''''''''''
-Le noeud ForEach est également une boucle mais il sert à exécuter, en parallèle, un corps de boucle en itérant
-sur une et une seule collection de données. Une collection de données est du type séquence.
-Un port de données d'entrée du noeud ForEach de nom "SmplsCollection" reçoit la collection de données sur laquelle la boucle itère.
-Cette collection de données est typée. Le type de donnée sur lequel la boucle itère est unique.
-Le nombre de branches parallèles que la boucle gère est fixé par un paramètre de la boucle. Si la collection est de
-taille 100 et que ce paramètre est fixé à 25, la boucle exécutera 4 paquets de 25 calculs en parallèle.
-Le noeud interne a accès à l'itéré courant de la collection de données via le port de données sortant de la boucle
-de nom "SmplPrt".
-
-En sortie de boucle il est possible de construire des collections de données typées. Il suffit de relier un port de
-données de sortie du noeud interne à un port de données d'entrée d'un noeud hors de la boucle. La collection de
-données est contruite automatiquement par la boucle.
-
-Le noeud Switch
+The ForEach node is also a loop, but it executes a loop body in parallel by iterating on one and only one data collection.
+A data collection is of the sequence type.
+An input data port of the ForEach node named “SmplsCollection” receives the data collection on which the loop iterates.
+This data collection is typed. The data type on which the loop iterates is unique. The number of parallel branches managed
+by the loop is fixed by a parameter of the loop (input port named "nbBranches").
+If the collection size is 100 and this parameter is fixed at 25, the loop will execute 4 packets of 25 calculations in parallel.
+The internal node can access the current iteration of the data collection through the output data port from the loop named “evalSamples”.
+
+Typed data collections can be constructed at the output from the loop. All that is necessary is to connect an output data
+port of the internal node to an input data port of a node outside the loop. The loop automatically constructs the data collection.
+
+To create this type of node:
+
+- from the GUI, see :ref:`foreachloop_node`
+- in a XML file, see :ref:`xml_foreachloop`
+- from python interface, see :ref:`py_foreachloop`
+
+The Switch node
''''''''''''''''''''''
-Le noeud Switch permet l'exécution conditionnelle (parmi N) d'un noeud (composé, élémentaire).
-Ces noeuds doivent avoir un minimum d'entrées et de sorties compatibles.
-La condition de switch (entier, réel) permet d'aiguiller l'exécution d'un noeud parmi n.
-La condition de switch est donné par un port de donnée entrant du noeud Switch de nom "select" ou par un paramètre
-de ce noeud de même nom.
+The Switch node performs the conditional execution (among N) of a node (composite, elementary).
+These nodes must have a minimum number of compatible inputs and outputs.
+The switch condition (integer, real) is used to switch execution of one node among N.
+The switch condition is given by an input data port of the Switch node named “select” or by a parameter of this node with the same name.
-Si les noeuds sont terminaux (rien n'est exécuté à partir de leurs sorties), ils n'ont pas besoin d'avoir des sorties compatibles.
-Les ports de sortie exploités en sortie du noeud doivent être compatibles entre eux (i.e. dériver d'un type générique commun exploitable par un autre noeud en entrée).
+If the nodes are terminal (nothing is executed from their outputs), they do not need to have compatible outputs.
+Output ports used at the node output must be compatible with each other (i.e. they must be derived from a common generic
+type that can be used by another input node).
+To create this type of node:
-Les containers
----------------------
-La plate-forme SALOME exécute ses composants après les avoir chargés dans des containers. Un container SALOME est un
-processus géré par la plate-forme qui peut être exécuté sur toute machine connue.
+- from the GUI, see :ref:`switch_node`
+- in a XML file, see :ref:`xml_switch`
+- from python interface, see :ref:`py_switch`
+
+The OptimizerLoop node
+'''''''''''''''''''''''''
+This node can be used to build an optimization process.
+It has one and only one internal node as all the loop nodes. It is the internal node that is "optimized".
+The optimization algorithm must be defined by the user. The main idea behind is : the OptimizerLoop iterates until
+the user optimization algorithm says the process is ended (convergence or error). At each iteration, the
+OptimizerLoop gives the data provided by the internal node to the algorithm. The algorithm returns a new sample
+that is given by the OptimizerLoop to the internal node and so on until the end. In most optimization processes, the sample
+is the variable (x) and the data that is returned by the internal node is the function to optimize (f(x)). Sometimes, the
+gradient is also returned.
+
+The definition of the optimization algorithm is done by way of plugin.
+The plugin can be a C++ plugin implemented in a dynamic library (.so file) or a Python plugin implemented in a Python module (.py).
+It is possible to implement two kinds of algorithm : synchronous or asynchronous.
+The implementation of an optimization algorithm as a plugin is described in :ref:`optimizationplugin`.
+
+The plugin is defined by 2 parameters :
-Un container YACS sert à définir des contraintes de placement des composants sans pour autant définir précisément
-la machine à utiliser ou le nom du container.
+- **lib** the file name of the dynamic library or of the Python module. The name of the dynamic library must be given without
+ extension (.so) but the name of the Python must be given with extension (.py).
+- **entry**, the name of an entry point in the dynamic library or in the Python module that will return the algorithm plugin
+ factory (see :ref:`optimizationplugin` for more informations)
-Le container YACS a un nom. Les contraintes sont données sous la forme de propriétés du container.
-La liste actuelle des propriétés est la suivante :
+The node has five ports:
+
+- **algoInit**, an input port that takes an object used for the initialization of the algorithm
+- **evalSamples**, an output port that gives the samples in the optimization process
+- **evalResults**, an input port that collects the results given by the internal node
+- **nbBranches**, an input port that can be used to parallelize the optimization process as in the ForEach node (number of
+ branches). Most of a time, the optimization process is sequential so the number of branches will be 1, but in some cases
+ it is possible to parallelize the process so the number of branches will be greater than 1.
+- **algoResults**, an output port that gives the results of the optimization algorithm
+
+To create this type of node:
+
+- from the GUI, see :ref:`optimizerloop_node`
+- in a XML file, see :ref:`xml_optimizerloop`
+- from python interface, see :ref:`py_optimizerloop`
+
+
+
+.. _containers:
+
+Containers
+---------------------
+The SALOME platform executes its components after loading them in containers. A SALOME container is a process managed
+by the platform that may be executed on any known resource.
+A YACS container is used to define component placement constraints without necessarily precisely defining the resource
+to be used or the container name.
+The YACS container has a name. Constraints are given in the form of container properties.
+The current list of properties is as follows:
+
+.. tabularcolumns:: |p{3cm}|p{3cm}|p{10cm}|
=================== ============= =============================================
-Nom Type Type de contrainte
+Name Type Type of constraint
=================== ============= =============================================
-policy "best", Choisit dans la liste des machines, une fois
- "first" ou les autres critères appliqués, la meilleure
- "cycl" ou la première ou la suivante. Par défaut,
- YACS utilise la politique "cycl" qui
- prend la machine suivante dans la liste
- des machines connues.
-container_name string si donné impose le nom du container SALOME
-hostname string si donné impose la machine
-OS string si donné restreint le choix de l'OS
-parallelLib string ??
-workingdir string si donné, spécifie le répertoire d'exécution.
- Par défaut, c'est le répertoire de lancement
- de YACS sur la machine locale et le $HOME
- sur les machines distantes.
-isMPI bool indique si le container doit supporter MPI
-mem_mb int taille mémoire minimale demandée
-cpu_clock int vitesse cpu minimale demandée
-nb_proc_per_node int ??
-nb_node int ??
+name string if given imposes the resource to use. If not given, the resource manager will try
+ to find the best resource according to the constraints given by the other attributes.
+container_name string if given imposes the SALOME container name
+hostname string if given imposes the machine (constraint used if name is not given)
+policy "best", Choose the best or the first or the next in
+ "first" or the list of resources, once other criteria
+ "cycl" have been applied. By default, YACS uses the “altcycl” policy
+ "altcycl" that selects the next resource in the list of known resources (constraint used if name is not given)
+OS string if given restricts the choice of the OS (constraint used if name is not given)
+workingdir string if given specifies the execution directory.
+ By default, the YACS run directory will be used
+ on the local machine and the $HOME directory will be used on remote machines.
+isMPI bool indicates if the container has to support MPI
+mem_mb int minimum requested memory size (constraint used if name is not given)
+cpu_clock int minimum requested CPU speed (constraint used if name is not given)
+nb_proc_per_node int number of processors by node (constraint used if name is not given)
+nb_node int number of nodes (constraint used if name is not given)
nb_component_nodes int ??
+parallelLib string ??
=================== ============= =============================================
-Le catalogue des ressources matérielles
+The resources catalog
''''''''''''''''''''''''''''''''''''''''''
-La liste des ressources matérielles (machines) connues de SALOME est donnée par le catalogue des
-ressources : fichier CatalogResources.xml qui doit se trouver dans le répertoire de l'application SALOME utilisée.
-Ce fichier est au format XML. Chaque machine est décrite avec le tag machine qui a plusieurs attributs
-qui permettent de la caractériser.
+The list of resources (machines and SALOME installations) known to SALOME is given in the resources catalog, the CatalogResources.xml file
+that must be located in the directory of the SALOME application used.
+This file is in the XML format. Each resource is described with the **machine** tag that has several attributes that characterize it.
+
+.. tabularcolumns:: |p{3cm}|p{3cm}|p{10cm}|
================================== =========================== ==============================================
-Caractéristique Attribut XML Description
+Characteristic XML attribute Description
================================== =========================== ==============================================
-nom hostname soit le nom complet : c'est la clef
- qui détermine la machine de manière unique
- (exemple : "nickel.ccc.cea.fr")
-alias alias chaine de caractères qui permet d'identifier
- la machine (exemple : "pluton")
-protocole d'accès protocol "rsh" (défaut) ou "ssh"
-type d'accès mode interactif "i" ou batch "b". Par défaut "i"
-username userName user avec lequel on va se connecter sur
- la machine
-système d'exploitation OS
-taille de la mémoire centrale memInMB
-fréquence d'horloge CPUFreqMHz
-nombre de noeuds nbOfNodes
-nombre de processeurs par noeud nbOfProcPerNode
-application SALOME appliPath répertoire de l'application SALOME à utiliser
- sur cette machine
-implémentation mpi mpi indique quelle implémentation de MPI est
- utilisée sur cette machine ("lam", "mpich1",
+resource name name the resource name
+computer name hostname the complete machine name: this is the key that uniquely determines the machine
+ (for example : "nickel.ccc.cea.fr")
+alias alias character string to identify the machine (for example, “pluton”)
+access protocol protocol "rsh" (default) or "ssh"
+access type mode interactive "i" or batch "b". By default "i"
+user name userName user name to be used to connect to the machine
+operating system OS
+memory size memInMB
+clock frequency CPUFreqMHz
+Number of nodes nbOfNodes
+Number of processors per node nbOfProcPerNode
+SALOME application appliPath directory of the SALOME application to be used on this machine
+mpi implementation mpi indicates which MPI implementation is used on this machine
+ ("lam", "mpich1",
"mpich2", "openmpi")
-gestionnaire de batch batch si la machine doit être utilisée au travers
- d'un système de batch donne le nom du
- gestionnaire de batch ("pbs", "lsf", "slurm").
- Pas de défaut.
+batch manager batch if the machine has to be used through a batch system, gives the
+ name of the batch manager
+ ("pbs", "lsf", "slurm").
+ No default.
================================== =========================== ==============================================
-Il est possible d'indiquer également la liste des modules SALOME présents sur la machine.
-Par défaut, SALOME suppose que tous les composants demandés par YACS sont présents.
-Chaque module présent est donné par le sous tag modules et son attribut moduleName.
+The list of SALOME modules of the resource can also be indicated. By default, SALOME assumes that all components
+requested by YACS are present.
-Voici un exemple de catalogue de ressources::
+If only some components are available within a resource, the list of components must be specified.
+This list can be specified with the sub-tag **component** that has two attributes : **name** (the name of the component)
+and **moduleName** (the name of the module) that is optional. You can use also the sub-tag **modules** that is provided
+for compatibility with older versions. If the **modules** sub-tag is used, a component with the same name as
+the moduleName attribute is added to the list.
+
+The following is an example of a resource catalog:
+
+.. code-block:: xml
<!DOCTYPE ResourcesCatalog>
<resources>
- <machine hostname="is111790" alias="is111790" OS="LINUX" CPUFreqMHz="2992" memInMB="1024"
- protocol="rsh" mode="interactif" nbOfNodes="1" nbOfProcPerNode="1" >
+ <machine hostname="is111790" alias="is111790"
+ OS="LINUX" CPUFreqMHz="2992" memInMB="1024"
+ protocol="rsh" mode="interactif"
+ nbOfNodes="1" nbOfProcPerNode="1" >
</machine>
- <machine hostname="is111915" alias="is111915" OS="LINUX" CPUFreqMHz="2992" memInMB="1024"
- protocol="ssh" mode="interactif" nbOfNodes="1" nbOfProcPerNode="1"
- appliPath="SALOME43/Run">
+ <machine hostname="is111915" alias="is111915"
+ OS="LINUX" CPUFreqMHz="2992" memInMB="1024"
+ protocol="ssh" mode="interactif"
+ nbOfNodes="1" nbOfProcPerNode="1"
+ appliPath="SALOME/Run">
<modules moduleName="GEOM"/>
+ <component name="SMESH"/>
+ <component name="VISU" moduleName="VISU"/>
</machine>
</resources>
.. _etats:
-Les états d'un noeud
+States of a node
-----------------------------
-Au cours de l'édition d'un schéma de calcul, les états possibles d'un noeud sont :
+The possible states of a node when a calculation scheme is being edited are as follows:
=================== =============================================
-Etat Commentaire
+State Comment
=================== =============================================
-READY le noeud est valide, prêt à être exécuté
-INVALID le noeud est invalide, le schéma ne peut
- pas être exécuté
+READY The node is valid, ready to be executed
+INVALID The node is invalid, the scheme cannot be executed
=================== =============================================
-Au cours de l'exécution d'un schéma de calcul, les états possibles d'un noeud sont :
+A node may be in the following states during execution of a calculation scheme:
=================== =============================================================
-Etat Commentaire
+State Comment
=================== =============================================================
-READY le noeud est valide, prêt à être exécuté
-TOLOAD le composant associé au noeud peut être chargé
-LOADED le composant associé au noeud est chargé
-TOACTIVATE le noeud peut être exécuté
-ACTIVATED le noeud est en exécution
-DONE l'exécution du noeud est terminée sans erreur
-ERROR l'exécution du noeud est terminée avec erreur
-FAILED noeud en erreur car des noeuds précédents sont en erreur
-DISABLED l'exécution du noeud est désactivée
-PAUSE l'exécution du noeud est suspendue
+READY the node is valid, ready to be executed
+TOLOAD the component associated with the node can be loaded
+LOADED the component associated with the node is loaded
+TOACTIVATE the node can be executed
+ACTIVATED the node is being executed
+DONE execution of the node is finished with no error
+ERROR execution of the node is finished with error
+FAILED node in error because previous nodes were in error
+DISABLED execution of the node is disabled
+PAUSE execution of the node is paused
=================== =============================================================
.. _nommage:
-Le nommage contextuel des noeuds
+Context sensitive naming of nodes
-------------------------------------
-On a vu que les noeuds élémentaires et composés ont un nom unique dans le contexte de définition
-qui correspond au noeud parent (schéma de calcul ou noeud composé). Pour pouvoir désigner les noeuds
-dans toutes les situations possibles, on utilise plusieurs sortes de nommage :
+We have seen that elementary and composite nodes have a unique name in the definition context that corresponds
+to the parent node (calculation scheme or composite node). Several sorts of naming are used to denote nodes in all
+possible situations:
+
+ - local naming: this is the name of the node in its definition context
+ - absolute naming: this is the name of the node seen from the highest level of the calculation scheme
+ - relative naming: this is the name of a node seen from a parent composite node.
+
+The general rule is that absolute and relative names are constructed by concatenating local names of the node and
+its parents, and separating them with dots.
+
+Consider the example of an elementary node with name “n” defined in a block name “b”, that is itself defined in a block name “c”
+itself defined at the highest level of the scheme. The local name of the node is “n”. The absolute name is “c.b.n”.
+The relative name in block “c” is “b.n”.
+
+The same rule is applied for naming ports. If node “n” has a port name “p”, then all that is necessary to obtain the port
+name is to add “.p” to the node name.
- - le nommage local : c'est le nom du noeud dans son contexte de définition
- - le nommage absolu : c'est le nom du noeud vu depuis le niveau le plus haut du schéma de calcul
- - le nommage relatif : c'est le nom du noeud vu d'un noeud composé parent
+There is an exception to this rule that concerns the Switch node. In this case, it is necessary to take account of case
+that is not a genuine node. If it is said that block “b” in the previous example is a switch that has a case with a
+value of 1 and a default case, then the absolute name of node “n” in the case 1 will be “c.b.p1_n” and the absolute name of the node in
+the default case will be “c.b.default_n”.
-La règle générale est que les noms absolu et relatif sont construits en concaténant les noms locaux
-du noeud et de ses parents en les séparant par des points.
+Active study
+--------------
+A schema can be executed without using the SALOME study manager. But when a schema must be executed in the context
+of a SALOME study, it is possible to specify the studyId to use.
-Prenons l'exemple d'un noeud élémentaire de nom "n" défini dans un bloc de nom "b" qui lui même est défini
-dans un bloc de nom "c" lui même défini au niveau le plus haut du schéma. Le nom local du noeud est "n".
-Le nom absolu est "c.b.n". Le nom relatif dans le bloc "c" est "b.n". On applique la même règle pour
-nommer les ports. Si le noeud "n" a un port de nom "p". Il suffit d'ajouter ".p" au nom du noeud
-pour avoir le nom du port.
+The way to do that is to set the schema property **DefaultStudyID** to the study id.
-Il y a une exception à cette règle. Elle concerne le noeud Switch. Dans ce cas, il faut tenir compte du case
-qui n'est pas un vrai noeud. Si on dit que le bloc "b" de l'exemple précédent est un switch qui a un case avec
-une valeur de 1 et un default, alors le nom absolu du noeud "n" dans le case sera "c.b.p1_n" et celui dans
-le default sera "c.b.default_n".
+In the GUI, this is set automatically to the current active studyId.
+For execution in console mode, see :ref:`xml_active_study`
.. _errorreport:
-Rapport d'erreur
+Error report
-------------------
-Chaque noeud a un rapport d'erreur associé si son état est INVALID, ERROR ou FAILED.
-Ce rapport est au format XML.
+Every node has an associated error report if its state is INVALID, ERROR or FAILED. This report is in the XML format.
-Les noeuds élémentaires produisent un rapport simple qui contient un seul tag (error)
-avec 2 attributs :
+Elementary nodes produce a simple report that contains a single (error) tag with 2 attributes:
-- node : qui donne le nom du noeud
-- state : qui indique son état
+- node: that gives the node name
+- state: that indicates its state.
-Le contenu du tag est le texte de l'erreur. Pour un noeud script python ce sera la plupart du temps,
-le traceback de l'exception rencontrée. Pour un noeud de service, ce sera soit le contenu d'une
-exception SALOME soit le contenu d'une exception CORBA.
+The tag content is the text of the error. For a Python script node, this will usually be the traceback of the exception
+encountered. For a service node, it will be either the content of a SALOME exception or the content of a CORBA exception.
-Les noeuds composés produisent un rapport composite contenu dans un tag de même nom (error) avec
-les 2 mêmes attributs node et state.
-Le tag contient l'ensemble des rapports d'erreur des noeuds fils erronés.
+Composite nodes produce a composite report contained in a tag with the same name (error) with the same two node and state
+attributes. The tag contains all error reports for erroneous child nodes.
-Voici un exemple de rapport d'erreur pour une division par zéro dans un noeud python
-contenu dans une boucle::
+The following shows an error report for a division by zero in a Python node contained in a loop:
+
+.. code-block:: xml
<error node= proc state= FAILED>
<error node= l1 state= FAILED>
</error>
</error>
-Trace d'exécution
-------------------
-Pour chaque exécution une trace d'exécution est produite dans un fichier de nom traceExec_<nom du schema>
-où <nom du schema> est le nom donné au schéma.
+Execution trace files
+--------------------------
+For each execution several trace files are produced:
+
+- the ouput file of the YACS process that executes the scheme
+- a trace file that reports all the events that have occured during the execution
+- the output files of all launched containers
+
+YACS process output file
+''''''''''''''''''''''''''''''''''''''''''
+In this file you will find all the outputs of the inline nodes and error reports (:ref:`errorreport`).
+
+YACS events trace file
+''''''''''''''''''''''''''''''''''''''''''
+The file name is: traceExec_<scheme name>, in which <scheme name> is the name given to the scheme.
-Chaque ligne du fichier représente un évènement relatif à un noeud. Elle contient deux
-chaines de caractères. La première est le nom du noeud. La deuxième décrit l'évènement.
+Each line of the file represents an event related to a node. It contains two character strings.
+The first is the node name. The second describes the event.
-Voici une trace pour le même exemple que ci-dessus::
+The following shows a trace for the same example as above::
n load
n initService
l1.node2 end execution ABORT, Error during execution
l1.node2 disconnectService
-Exécution des branches concurrentes
+Container output file
+''''''''''''''''''''''''''''''''''''''''''
+In this file you will find all the outputs of the SALOME components (calculation codes).
+Most of the time, the file name is : /tmp/<yacs pid>_<container name>_<container id>_<computer name>_<user name>.log, where:
+
+- <yacs pid> is the id of the YACS process
+- <container name> is the name given to the container in :ref:`containers`.
+- <container id> is an internal id for the container
+- <computer name> is the name of the computer on which the container runs
+- <user name> is the login name of the user on the container computer
+
+By default this file is put in the /tmp directory. It is possible to change that default by setting the SALOME_TMP_DIR environment
+variable to a different location.
+
+If the SALOME component uses CALCIUM datasream ports, this file will also contain a trace of all the calls
+to the CALCIUM library.
+This trace has the following form::
+
+ Elapsed time | Request | Container | Instance | Port | Error | Infos
+ 34:54:23:112 | CP_CD | clic6_23_B_0x1e080 | SOL_inst_1 | | |
+ 34:54:23:134 | WRITE | clic6_23_B_0x1e080 | SOL_inst_1 | temp | | i=0
+ 34:54:23:162 | WRITE | clic6_23_B_0x1e080 | SOL_inst_1 | tpi | | i=0
+ 34:54:23:162 | BEGIN_READ | clic6_23_B_0x1e080 | SOL_inst_1 | puis | | i=0
+ 34:54:23:174 | END_READ | clic6_23_B_0x1e080 | SOL_inst_1 | puis | | read i=0
+ 34:54:23:174 | BEGIN_READ | clic6_23_B_0x1e080 | SOL_inst_1 | tfi | | i=0
+
+- column "Elapsed time" gives the elapsed time since a reference time that is given by the computer system (January 1, 1970 on Linux).
+ The time format is: hours:minutes:seconds:milliseconds.
+- column "Request" gives the name of the CALCIUM call.
+- column "Container" gives the container identification (<computer name>_<yacs pid>_<container name>_<container_id>)
+- column "Instance" gives the name of the SALOME component that has issued the call
+- column "Port" gives the name of the port on which the request is done
+- column "Error" gives the error description if there is one
+- column "Infos" gives more information about the request or the error
+
+By default, the trace is produced in the container output file. It is possible to disable the trace by setting
+the DSC_TRACELEVEL environment variable to 0 (export DSC_TRACELEVEL=0, for bash shell). It is also possible to redirect
+the trace in an another file by setting the DSC_TRACE environment variable to 1 (export DSC_TRACE=1, for bash shell).
+In this case the trace is written in a file with name : $SALOME_TMP_DIR/<container identification>.tce.
+
+
+Execution of concurrent branches
-------------------------------------
-YACS peut exécuter simultanément les noeuds de calcul d'un schéma.
-Cependant l'exécution simultanée d'un grand nombre de noeuds peut saturer le système.
-Il est possible de controler le nombre maximum
-d'exécutions simultanées en fixant le nombre maximum de threads utilisés avec
-la variable d'environnement YACS_MAX_THREADS. Par défaut, cette valeur vaut 50.
+YACS can execute calculation nodes of a scheme simultaneously.
+However, simultaneous execution of a large number of nodes can saturate the system.
+The maximum number of simultaneous executions can be controlled by fixing the maximum number of threads used with the
+YACS_MAX_THREADS environment variable. By default, this value is equal to 50.
+
+Schema shutdown
+-----------------
+When YACS executes a schema, it starts new containers or uses existing containers. When the execution is finished, YACS can shutdown (or stop)
+containers but the user can control how these containers are shutdown.
+
+There are several level of shutdown:
+
+- level 0: nothing is shutdown
+- level 1: shutdown all new containers not named by the user
+- level 2: same as level 1 plus all new containers named by the user
+- level 3: same as level 2 plus all existing containers used by the schema
+
+To shutdown a schema:
+
+- from GUI, see :ref:`shutdown`
+- from console, see :ref:`xml_shutdown`
.. _archi:
YACS general architecture
------------------------------
-YACS module implements API of a full SALOME module only for the schema execution. The schema edition is done in the GUI process alone. For execution, YACS has a CORBA servant that implements Engines::Component CORBA interface (see SALOME 4 KERNEL IDL interfaces). YACS GUI and YACS CORBA engine share YACS core libraries (engine and runtime): GUI uses them at schema design time, then a schema XML file is saved and passed to YACS CORBA API, and finally YACS core libraries execute the schema at YACS CORBA server side.
+YACS module implements API of a full SALOME module only for the schema execution. The schema edition is done in the GUI process alone.
+For execution, YACS has a CORBA servant that implements Engines::EngineComponent CORBA interface (see SALOME KERNEL IDL interfaces).
+YACS GUI and YACS CORBA engine share YACS core libraries (engine and runtime): GUI uses them at schema design time, then a schema XML
+file is saved and passed to YACS CORBA API, and finally YACS core libraries execute the schema at YACS CORBA server side.
-YACS GUI differs from standard full SALOME modules (such as Geometry or Mesh) in that it does not use SALOMEDS objects to create Object Browser representation of its data, and creates this representation in a way light SALOME modules do. This is done in order to avoid publishing lots of objects in SALOMEDS study just to create visual representation of data and thus to improve GUI performance.
+YACS GUI differs from standard full SALOME modules (such as Geometry or Mesh) in that it does not use SALOMEDS objects to create
+Object Browser representation of its data, and creates this representation in a way light SALOME modules do.
+This is done in order to avoid publishing lots of objects in SALOMEDS study just to create visual representation of data and
+thus to improve GUI performance.
YACS architecture scheme is shown on the picture below.
.. image:: images/general_architecture_0.jpg
:align: center
-The YACS module will be developed as a Salome module with one document (study) per desktop.
+The YACS module is a SALOME module with one document (study) per desktop.
YACS is composed of several packages. The main things are mentioned in the next sections.
Engine package
'''''''''''''''''''''''
-Engine package consists of calculation schema generic classes (calculation nodes, control nodes, control and data flow links, etc.) Engine is in charge to
+Engine package consists of calculation schema generic classes (calculation nodes, control nodes, control and data
+flow links, etc.).
+
+Engine is in charge to:
* edit,
* check consistency,
SALOME Runtime package
'''''''''''''''''''''''
-Runtime package provides implementation of YACS generic calculation nodes for SALOMR platform. Runtime exists in a given Context. Runtime is in charge to:
+Runtime package provides implementation of YACS generic calculation nodes for SALOME platform.
+Runtime exists in a given Context.
+
+Runtime is in charge to:
* treat physically the basic execution of elementary tasks in a given context,
* transfer data in this context,
* perform the physical deployment of the execution.
Runtime simply appears in Engine as an interface that a concrete Runtime must implement to be piloted by Engine.
-SALOME Runtime nodes
-
-The SALOME Runtime implements following nodes.
+The SALOME Runtime implements following nodes:
* Inline function node. A function inline node is implemented by a Python function.
* Inline script node. A script inline node is implemented by a Python script.
- * Component service node. This is a calculation node associated with a component service.
+ * Component service node. This is a calculation node associated with a SALOME component service.
* CORBA reference service node. Reference service node for CORBA objects. This is a node that executes a CORBA service.
* CPP node. This is a C++ node (in process component), i.e. local C++ implementation - single process.
XML file loader provides
* a possibility to load a calculation schema in memory by reading and parsing a XML file describing it,
- * an executable named driver that can be used to load and execute (see Using YACS driver) a calculation schema given as a XML file (see Writing XML file).
+ * an executable named driver that can be used to load and execute (see :ref:`execxml`) a calculation
+ schema given as a XML file (see :ref:`schemaxml`).
GUI design
''''''''''''''''''''''''''''''''
-Goals of Graphic User Interface design are the following.
-
- * Provide a general mechanism for the synchronisation of several views (tree views, 2D canvas views, edition dialogs). For this goal, a subject/observers design pattern is used: several observers can attach or detach themselves to/from the subject. The subject send update events to the lists of observers and does not know the implementation of the observers. The observers correspond to the different views in case of YACS.
- * Provide an interface of Engine for edition with a general mechanism for undo-redo (future version!).
- * Be as independent as possible of Qt (and SALOME), to avoid problems in Qt4 migration, and allow a potential re-use of YACS GUI outside SALOME.
-
+Goals of Graphic User Interface design are the following:
+
+ * Provide a general mechanism for the synchronisation of several views (tree views, 2D canvas views, edition dialogs).
+ For this goal, a subject/observers design pattern is used: several observers can attach or detach themselves to/from the subject.
+ The subject send update events to the lists of observers and does not know the implementation of the observers. The observers
+ correspond to the different views in case of YACS.
+ * Provide an interface of Engine for edition with a general mechanism for undo-redo.
+ * Be as independent as possible of Qt (and SALOME) to allow a potential re-use of YACS GUI outside SALOME.
.. _progdsc:
-Introduction au modèle de programmation DSC pour les composants Salomé
+Introduction to the DSC programming model for SALOME components
======================================================================
-Cette introduction a pour objectif de fournir les notions essentielles pour utiliser
-l'extension DSC (Dynamic Software Component) dans des composants Salomé. Il est
-destiné aux développeurs d'applications Salomé qui doivent intégrer des codes de
-calculs sous la forme de composants Salomé ou de services du superviseur.
+The purpose of this introduction is to provide essential concepts about how to use the DSC (Dynamic Software Component)
+extension in SALOME components. It is intended for SALOME application developers who need to integrate calculation
+codes in the form of SALOME components or supervisor services.
-Le principe du modèle de programmation
+The principle of the programming model
----------------------------------------
-
-Le modèle de programmation DSC est fourni par le noyau Salomé et est disponible
-non seulement pour les services mais aussi pour des composants Salomé sans supervision.
-Une application Salomé qui souhaite utiliser l'extension DSC suit toujours ce principe :
-
-1. Les différents programmes, codes, services qui composent l'application déclare
- dans la phase d'initialisation les différents ports disponibles.
-2. Ensuite le système (par exemple YACS ou un script utilisateur) connecte les
- différents ports pour mettre en place les différentes communications entre les codes.
-3. Les codes sont lancés. Lorsqu'ils souhaitent utiliser un de leur port DSC, le code
- demande au système un pointeur vers son port. Le système vérifie alors que le port
- a été bien connecté et/ou bien déclaré.
-4. Les codes utilisent les ports DSC.
-
-Apports de l'extension DSC
+The DSC programming model is provided by the SALOME kernel and is available not only for services but also for
+SALOME components without supervision. A SALOME application that would like to use the DSC extension always
+follows this principle:
+
+1. The different programs, codes and services that make up the application declare the various available ports
+ during the initialization phase.
+2. The system (for example YACS or a user script) then connects the different ports to set up the different
+ communications between the codes.
+3. The codes are run. When they want to use one of their DSC ports, the code asks to the system for a pointer
+ to its port. The system then checks that the port has been properly connected and/or properly declared.
+4. The codes use the DSC ports.
+
+Benefits of the DSC extension
---------------------------------
+The main benefits of the DSC extension to the SALOME programming model are as follows:
-Les apports principaux de l'extension DSC au modèle de programmation de Salomé sont les
-suivants:
+#. It enables use of datastream ports in SALOME
+#. It enables use of the Calcium coupling tool in a calculation scheme without depending on the implementation of
+ Calcium outside SALOME. This results in better integration of this type of port, and greater flexibility in possible data types.
+#. It offers the possibility of adding interface type ports into services.
-1. Il permet de mettre en oeuvre les ports datastream dans Salomé.
-2. Il permet d'utiliser l'outil de couplage Calcium au sein d'un schéma de calcul sans
- dépendre de l'implémentation de Calcium hors Salomé. Une meilleure intégration de ce
- type de ports est ainsi obtenue ainsi qu'une plus grande flexibilité dans les types de
- données possibles.
-3. Il offre la possibilité d'ajouter des ports de type interface dans des services.
-
-Les ports de type interface
+Interface type ports
+++++++++++++++++++++++++++++
+DSC can add interface type ports to components and therefore to services. The datastream ports are nothing more
+than a specialization of these interface ports. This interface is described through a CORBA interface.
+Therefore it must be implemented by a CORBA object that may be either the component itself or an object that the
+component uses. Properties may be attached to each interface port through a specific configuration object.
-DSC permet d'ajouter des ports de type interface à des composants et donc à des
-services. Les ports datastream ne sont qu'une spécialisation de ces ports d'interfaces.
-Cette interface est décrite par le biais d'une interface CORBA. Elle doit donc être
-implémentée par un objet CORBA qui peut soit être le composant lui même ou un objet que
-le composant utilise. A chaque port d'interface, des propriétés peuvent lui être
-attachées grace à un objet spécifique de configuration.
-
-Les ports datastream Calcium
+Calcium datastream ports
+++++++++++++++++++++++++++++
+The SALOME kernel proposes a new implementation of Calcium ports. These ports are interface ports, therefore they can
+be used like other interface ports by means through the C ++ API, or they can be used in the same way as with Calcium
+through a C or FORTRAN interface. Finally, this new implementation was made with the objective of being able to port a
+Calcium application into SALOME very quickly.
-Le noyau Salomé propose une nouvelle implémentation des ports Calcium. Ces ports
-sont des ports d'interfaces, ils peuvent donc être utilisés comme les autres ports
-d'interfaces par le biais de l'API C++ ou ils peuvent être utilisés comme avec Calcium
-par le biais d'une interface C ou FORTRAN. Enfin, cette nouvelle implémentation a été
-réalisé avec le soucis de pouvoir porter une application Calcium très rapidement dans
-Salomé.
-Les connexions entre les ports DSC
+Connections between DSC ports
------------------------------------
+DSC ports may be input or output ports. Output ports are called <<uses>> because they enable the use of an interface
+external to the component or the service. Input ports are called <<provides>> because they provide the implementation
+of the port interface.
-Les ports DSC peuvent être entrant ou sortant. Les ports sortant sont appelés
-<< uses >> car ils permettent l'utilisation d'une interface externe au composant ou au
-service. Les ports entrant sont appelés << provides >> car ils fournissent l'implémentation
-de l'interface du port.
-
-Les ports des services sont décrits dans un fichier XML que le gestionnaire de
-catalogues lit lors de la création d'un schéma de calcul. En revanche les ports ne
-sont pas décrits dans la déclaration CORBA du service. C'est pourquoi ils sont créés
-et ajoutés dynamiquement lors de la création et de l'exécution du service (en comparaison
-avec des modèles plus statiques tel que le CORBA Component Model). DSC ajoute des méthodes
-aux composants pour déclarer des ports d'interfaces.
+Service ports are described in an XML file that the catalog manager reads during creation of a calculation scheme.
+On the other hand, ports are not described in the CORBA declaration of the service. This is why they are created and
+added dynamically when the service is created and executed (in comparison with more static models like the CORBA Component Model).
+DSC adds methods to components to declare interface ports.
::
Ports::Port get_provides_port(...);
uses_port get_uses_port(...);
-Des méthodes sont fournies pour permettre la connexion de ports uses avec des ports
-provides du même type (c'est à dire de la même interface CORBA). De plus, DSC averti
-le code utilisateur des modifications des connexions des ses ports par le biais de méthodes
-de callback.
+Methods are provided to enable the connection of uses ports with provides ports of the same type (in other words
+with the same CORBA interface). Furthermore, DSC notifies the user code about modifications to connections of
+its ports through callback methods.
::
void provides_port_changed(...);
void uses_port_changed(...);
-Les connexions entre les ports uses et provides permettent différentes combinaisons. Un port
-uses peut être connecté à plusieurs ports provides. De même un port provides peut être connecté
-à plusieurs ports uses. Enfin, les ports uses connaissent les ports provides auxquels ils
-s'adressent tandis que les ports provides ne connaissent pas à priori les ports uses qui les
-ont appelés (Il est évidemment possible de rajouter des informations applicatives).
+Different combinations of connections between uses ports and provides ports are possible. A uses port may be connected
+to several provides ports. Similarly, a provides port may be connected to several uses ports. Finally, uses ports know
+the provides ports that they address, while a priori provides ports do not know the uses ports that called
+them (obviously, application information can be added).
-Les deux couches de programmation
+The two programming layers
------------------------------------------------
-
-Le modèle de composant DSC est divisé en deux parties : DSC_Basic et DSC_User.
-
-DSC_Basic est la couche basse de DSC. Elle fournit les fonctions de bases pour ajouter
-la notion de ports à un objet CORBA. Elle permet d'enregistrer les servants des ports provides,
-déclarer des ports uses et les connecter. Il s'agit d'une couche dite basique car elle n'offre
-que peu de confort d'utilisation. Notamment, un port uses se présente sous la forme d'une
-séquence de références vers les ports provides auquel le port a été connecté. A charge à
-l'utilisateur de gérer cette séquence et d'appeler manuellement les différentes ports provides
-lors de l'utilisation du port uses.
-
-La couche DSC_User permet d'obtenir un plus haut niveau de programmation et d'encapsulation
-des ports. Tout d'abord, elle permet la création de services Salomé avec des ports datastream
-(ou d'interface) fournis par la plate-forme Salomé. Elle fournit une méthode d'initialisation
-que le superviseur va appeler avant l'exécution du service, méthode qui permet de déclarer
-correctement les ports des services. Enfin, elle offre une abstraction pour les ports uses et
-provides. Les deux types de ports sont implémentés par des classes et l'utilisateur a ainsi
-une vue uniforme des deux types ports : 2 classes (et non une séquence et une référence CORBA
-comme dans la couche DSC_Basic). Un autre apport est la gestion automatique de la liste des
-ports provides connecté à un port uses. Le code utilisateur a une unique référence sur son
-port uses; à charge à l'implémentation du port uses de transmettre un appel vers les
-différentes connexions du port.
-
-DSC par l'exemple
+The DSC component model is divided into two parts: DSC_Basic and DSC_User.
+
+DSC_Basic is the lower layer of DSC. It provides the basic functions to add the concept of ports to a CORBA object.
+It can be used to record servants of provides ports, declare uses ports and connect them. It is a so-called basic layer
+because it does not provide much user convenience. In particular, a uses port is in the form of a sequence of references
+to provides ports to which the uses port has been connected. The user is responsible for managing this sequence and
+manually calling the different provides ports when uses ports are being used.
+
+The DSC_User layer give a higher programming and encapsulation level of ports. Firstly, it enables the creation of
+SALOME services with datastream (or interface) ports supplied by the SALOME platform. It provides an initialisation
+method that the supervisor will call before the service is executed, which makes it possible to declare service ports
+correctly. Finally, it offers abstraction for uses and provides ports. The two types of ports are implemented
+by classes and the user thus has a uniform view of the two port types: 2 classes (and not one sequence and
+one CORBA reference as in the DSC_Basic layer). Another benefit is the automatic management of the list of provides ports
+connected to a uses port. The user code has a unique reference on its uses port; the uses port implementation is then
+responsible for transmitting a call to the different port connections.
+
+DSC through examples
------------------------------------------------
+We will now discover the principles of DSC programming through different examples.
-Nous allons maintenant découvrir les principes de la programmation DSC par le biais de
-différents exemples.
-
-Le premier exemple met en place un composant avec un port provides.
-Le deuxième exemple met en place un deuxième composant avec un port uses qui va être
-connecté au port provides de l'exemple Hello World.
-Le troisième exemple montre comment utiliser les ports datastream dans des services.
-Le quatrième exemple montre comment utiliser le système de fabrique des ports datastream
-pour ajouter sa propre famille dans le modèle de programmation.
-Enfin le cinquième exemple montre comment utiliser la nouvelle implémentation Calcium dans le
-cadre de Salomé.
+The first example sets up a component with a provides port. The second example sets up a second component
+with a uses port that will be connected to the provides port in the Hello World example.
+The third example shows how datastream ports are used in services.
+The fourth example shows how the datastream ports factory system is used to add its own family in the programming model.
+Finally, the fifth example shows how the new Calcium implementation is used in the SALOME context.
-Les exemples ci-dessous montre des exemples de programmation des composants. En revanche,
-ils ne contiennent pas tout le code, seule les nouvelles parties seront décrites dans ce
-document. Vous pourrez trouver tout le code des exemples dans le module Salomé DSC_EXEMPLE_SRC.
+The following examples show examples of component programming. On the other hand, they do not contain the entire code, this
+document only describes the new parts. The entire code for the examples is contained in the SALOME DSC_EXAMPLE_SRC module.
-Les deux premiers exemples ont pour objectif de faire comprendre comment manipuler des ports
-DSC par le biais de la couche DSC_Basic. En revanche, il faut étudier le troisième exemple
-pour pouvoir créer des services avec des ports DSC par le biais de la couche DSC_User.
+The first two examples are intended to help understand how the DSC ports are manipulated through the DSC_Basic layer.
+On the other hand, the third example will have to be studied to see how services can be created with DSC ports through the DSC_User layer.
-Pour récupérer les exemples, il faut être autoriser à accéder à la base subversion du projet pal.
-Il suffit ensuite dans un shell unix de taper la ligne suivante :
+Access to the subversion base of the pal project must be authorised before the examples can be retrieved.
+Then type the following line in a Unix shell::
-svn co svn://<nom>@nepal/PAL/DSC_EXEMPLES_SRC/trunk DSC_EXEMPLES_SRC
+ svn co svn://<nom>@nepal/PAL/DSC_EXEMPLES_SRC/trunk DSC_EXEMPLES_SRC
Hello World
+++++++++++++
-Les sources de cet exemple se trouve dans le répertoire src/Ex_Serveur.
+The sources for this example are given in the src/Ex_Serveur directory.
-L'objectif de cet exemple est de créer un composant qui fournit un port provides.
-La figure ci-dessous illustre ce que nous allons faire. Le composant s'appelle Ex_Serveur
-et il fournit un port provides nommé Ex_Hello. Ce port provides fournit l'interface HelloWorld.
+The objective of this example is to create a component that provides a provides port. The following figure
+illustrates the procedure. The component is called Ex_Serveur and it provides a provides port named Ex_Hello.
+This provides port provides the HelloWorld interface.
.. image:: images/progdsc_img1.png
+ :align: center
-La première étape est de définir les interfaces du composant et l'interface du port :
+The first step is to define interfaces of the component and the port interface:
::
Interface Ex_Serveur : Engines::DSC {};
-Le fichier IDL comprend tout d'abord la déclaration de l'interface du port provides que
-le composant va fournir. Il s'agit ici de l'interface HelloWorld. Cette interface est une
-interface CORBA classique. En revanche, cette interface doit hériter de Ports ::Port pour
-pouvoir être un port DSC. Le composant Ex_Serveur est aussi déclaré comme une interface CORBA
-qui hérite de l'interface Engines::DSC au lieu de Engines::Component. Il faut noter que le port
-provides n'apparaît pas dans la définition IDL du composant. Le port est ajouté et déclaré
-dans les sources de l'implémentation du composant. Il est ajouté dynamiquement lors de
-l'exécution du composant.
-
-Il s'agit maintenant d'implémenter le composant et le port provides. Le port provides est
-implémenté par le biais d'une classe C++ que nous appellerons HelloWorld_impl (voir dans
-les sources). Cette implémentation ne diffère en rien de celle d'un objet CORBA. Voici
-l'implémentation de la méthode say_hello :
+The IDL file comprises firstly the declaration of the provides port interface that the component will provide.
+In this case it is the HelloWorld interface. This interface is a classical CORBA interface. On the other hand, this
+interface must inherit from Ports::Port if it is to be a DSC port. The Ex_Serveur component is also declared
+as a CORBA interface that inherits from the Engines::DSC interface instead of Engines::EngineComponent.
+Note that the provides port does not appear in the IDL definition of the component. The port is added and
+declared in implementation sources of the component. It is added dynamically when the component is executed.
+
+The objective now is to implement the component and the provides port. The provides port is implemented
+through a C++ class that we will call HelloWorld_impl (see in the sources). This implementation is in no way
+different from the implementation of a CORBA object. See the implementation of the say_hello method:
::
}
-Il nous reste ensuite à implémenter le composant. Nous allons nous intéresser à la déclaration
-du port du composant et à la classe que le composant doit hériter. L'implémentation d'un
-composant (classe Ex_Serveur_i) qui veut utiliser des ports DSC doit hériter de la classe nommé
-Engines_DSC_i.. Bien entendu, elle doit aussi hériter de POA_Ex_Serveur.
-Voici la déclaration de la classe Ex_Serveur_i :
+The next step is to implement the component. We will be interested in the declaration of the component port
+and the class that the component must inherit. The implementation of a component (Ex_Serveur_i class) that wants
+to use DSC ports must inherit from the class named Engines_DSC_i. Obviously, it must also inherit from POA_Ex_Serveur.
+See the declaration for Ex_Serveur_i class:
::
public:
Ex_Serveur_i(CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- PortableServer::ObjectId * contId,
- const char * instanceName,
- const char * interfaceName);
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char * instanceName,
+ const char * interfaceName);
virtual ~Ex_Serveur_i();
...
};
-Pour que le port provides soit utilisable, nous devons faire deux actions :
-- Créer le port.
-- Enregistrer le port dans le composant.
+Two actions have to be performed before the provides port can be used:
+
+1. Create the port
+2. Save the port in the component.
-Pour réaliser ces deux étapes, nous ajoutons une méthode à la classe Ex_Serveur_i nommée
-register_ports() qui est appelé dans la fabrique du composant avant que celle-ci ne retourne
-la référence du composant au container. Cette méthode est implémentée de la façon suivante :
+These two steps are implemented by adding a method called register_ports() to the Ex_Serveur_i class that is
+called in the component factory before the factory returns the reference of the component to the container.
+This method is implemented as follows:
::
void
Ex_Serveur_i::register_ports() {
- // Création du port provides
+ // Create the provides port
_Ex_Hello_port = new HelloWorld_i();
- _Ex_Hello_port_properties = PortProperties_i();
+ _Ex_Hello_port_properties = new PortProperties_i();
- // Enregistrement du port provides
+ // Save the provides port
add_provides_port(_Ex_Hello_port->_this(),
- "Ex_Hello",
- _Ex_Hello_port_properties->_this());
+ "Ex_Hello",
+ _Ex_Hello_port_properties->_this());
}
-La méthode commence par la création du port provides. Il s'agit ici de créer le servant de
-l'interface CORBA du port. Il faut aussi créer un objet pour les propriétés du port. Dans
-cet exemple, l'objet par défaut est utilisé (fourni par le noyau). Ensuite le port est
-enregistré dans le composant par le biais de la méthode add_provides_port fourni par DSC.
-
-Le fait d'hériter de Engines_DSC_i oblige le composant à implémenter deux méthodes qui se
-nomment provides_port_changed() et uses_port_changed(). Ces deux méthodes sont des callbacks
-que le système utilise pour avertir le composant lorsque les connexions de ses ports ont
-évolués. La méthode provides_port_changed() permet d'être averti lorsque quelqu'un se connecte
-ou se déconnecte sur un de ses ports provides. Le callback indique notamment combien de
-client utilise le port provides (argument connection_nbr). Pour cet exemple, nous ne tenons
-pas compte de cette information. La méthode uses_port_changed() a quand à elle la même
-fonction que provides_port_changed(), mais pour les ports uses. Nous verrons dans le deuxième
-exemple ses spécificités.
-
-La documentation des différentes méthodes Engines_DSC_i sont fournis dans la documentation
-Doxygen du noyau de Salomé.
-
-Cet exemple peut être exécuté par le biais du fichier de test src/tests/test_Ex_Serveur.py
-dans l'intrepréteur Salomé en mode terminal. Ce script illustre l'utilisation des ports DSC :
-
+The method begins with creation of the provides port. The objective is to create the servant of the CORBA
+interface of the port. An object also has to be created for port properties. The default object is used in
+this example (supplied by the kernel). The port is then registered in the component through the
+add_provides_port method provided by DSC.
+
+The fact of inheriting from Engines_DSC_i obliges the component to implement two methods that are called
+provides_port_changed() and uses_port_changed(). These two methods are callbacks that the system uses to notify
+the component when the connections of its ports have changed. With the provides_port_changed() method, a warning
+can be obtained when someone connects or disconnects on one of its provides ports.
+In particular, the callback indicates how many clients use the provides port (connection_nbr argument).
+This information is not used in this example. The uses_port_changed() method performs the same function as
+the provides_port_changed() function, but for uses ports. The specific features will be described in the second example.
+
+The documentation for the different Engines_DSC_i methods are provided in the Doxygen documentation of the SALOME kernel.
+
+This example can be executed through the src/tests/test_Ex_Serveur.py test file, in the SALOME interpreter in terminal mode.
+This script illustrates the use of DSC ports:
+
::
import LifeCycleCORBA
hello_port = component.get_provides_port("Ex_Hello", 0)
hello_port.say_hello("andre")
-Après la création du composant par le biais du LifeCycleCORBA, le script utilise la
-méthode get_provides_port pour obtenir une référence sur le port provides du composant.
-La référence obtenue est ensuite utilisée pour exécuter la méthode say_hello du port.
+After the component has been created through LifeCycleCORBA , the script uses the get_provides_port method
+to obtain a reference on the provides port of the component.
+The reference obtained is then used to execute the say_hello method for the port.
-Hello World Client
+Client Hello World
+++++++++++++++++++++
+The sources in this example are located in the src/Ex_Client directory and in src/Ex_Serveur.
-Les sources de cet exemple se trouve dans le répertoire src/Ex_Client et dans src/Ex_Serveur.
+The purpose of this example is to create a new component that will use the Ex_Hello port in the previous example, through a uses port.
-L'objectif de cet exemple est de créer un nouveau composant qui va utiliser le port Ex_Hello
-du précédent exemple par le biais d'un port uses.
-
-Voici une figure qui représente l'application:
+The following figure represents the application:
.. image:: images/progdsc_img2.png
+ :align: center
-Le composant Ex_Client est décrit comme le composant Ex_Serveur dans le fichier IDL.
-La seule différence est l'ajout dans son interface d'une méthode start(). Un composant
-ne contenant pas de fonction main lors de sa création, il nous faut une méthode pour lancer
-l'exécution du composant, d'où la définition de la méthode start.
+The Ex_Client component is described in the same way as the Ex_Serveur (Ex_Server) component in the IDL file.
+The only difference is that a start() method is added in its interface. Since a component does not contain a
+main function when it is created, a method to start execution of the component is required, which is why the
+start method is defined.
-Voici la définition IDL du composant Ex_Client :
+The following is the IDL definition of the Ex_Client component:
::
void start() ;
} ;
-Il faut maintenant implémenter le composant. Comme pour un port provides, un port uses
-doit être enregistré dans le composant avant qu'il ne soit utilisable par le composant.
-Un port uses correspond à une séquence de références vers les ports provides auxquels il
-a été connecté ; c'est pourquoi il n'est pas implémenté par une classe comme un port
-provides. En revanche, il est toujours possible d'ajouter des propriétés au port.
-Voici le code de la méthode register_ports() pour le composant Ex_Client :
+The component now has to be implemented. As for a provides port, a uses port must be recorded in a component before
+it can be used by the component. The uses port corresponds to a sequence of references to the provides ports to which
+it has been connected: this is why it is not implemented by a class like a provides port. On the other hand, it is
+always possible to add properties to the port.
+The code for the register_ports() method for the Ex_Client component is given below:
::
void
Ex_Client_i::register_ports() {
- // Création de l'objet propriété pour le port uses.
+ // Create the properties object for the uses port.
_U_Ex_Hello_port_properties = new PortProperties_i();
- // Ajout du port uses dans le composant
+ // Add the uses port into the component
add_uses_port("IDL:HelloWorld:1.0",
"U_Ex_Hello",
_U_Ex_Hello_port_properties->_this());
}
-Un port uses est associé à un type d'objet CORBA. La déclaration de ce type permet de
-vérifier si le port uses est connecté à un port provides compatible. Dans cet exemple,
-le type du port (déclaré dans l'IDL) est HelloWorld. CORBA propose pour chaque type IDL
-une chaîne de caractère correspondant à ce type. Dans cet exemple il s'agit de :
-IDL:HelloWorld:1.0.
+A uses port is associated with a CORBA object type. Declaration of this type verifies if the uses port is
+connected to a compatible provides port. In this example, the type of port (declared in the IDL) is HelloWorld.
+CORBA proposes a character string corresponding to this type for each IDL type.
+In this example, it is IDL:HelloWorld:1.0.
-Il faut maintenant pouvoir utiliser le port uses. Pour cela, le composant demande au
-système de récupérer le port uses par le biais de la méthode get_uses_port(). Le port
-prend la forme d'une séquence de référence sur les différents ports provides. Les références
-contenues dans cette séquence sont les ports provides auxquels le port uses a été connecté
-à l'instant de l'appel de la méthode get_uses_port(). A chaque changement sur cette liste
-de référence, que ce soit un ajout ou un retrait, le système utilise la
-méthode use_port_changed() pour avertir le code utilisateur.
+We now need to be able to use the uses port. To achieve this, the component asks the system to retrieve
+the uses port using the get_uses_port() method. The port is in the form of a reference sequence on the different
+provides ports. The references contained in this sequence are the provides ports to which the uses port has been
+connected at the time that the get_uses_port() was called. The system uses the use_port_changed() method to
+notify the user code every time that this reference list is changed to include an addition or a removal.
-La méthode start() du composant Ex_Client va récupérer le port uses U_Ex_Hello et va
-appeler la méthode say_hello() sur la première référence. Voici le code de cette méthode :
+The Ex_Client component start() method will retrieve the U_Ex_Hello uses port and will call the say_hello() method
+on the first reference. The code for this method is given below:
::
void
Ex_Client_i::start() {
- // Récupération du port ues U_Ex_Hello
+ // Retrieve the uses port U_Ex_Hello
Engines::DSC::uses_port * uport = get_uses_port("U_Ex_Hello");
- // Récupération de la première référence de la séquence
+ // Retrieve the first reference in the sequence
_Ex_Hello_provides_port = HelloWorld::_narrow((* uport)[0]);
- // Appel de la méthode sur le port
+ // Call the method on the port
_Ex_Hello_provides_port->say_hello(_instanceName.c_str());
}
-Il faut noter qu'il faut transformer par le biais de la méthode _narrow les références
-contenues dans le port uses dans le type du port provides pour pouvoir utiliser le port provides.
+Note that the _narrow method has to be used to transform the references contained in the uses port
+into the provides port type, before the provides port can be used.
-Ports datastream et services
+Datastream ports and services
++++++++++++++++++++++++++++++
+The sources in this example are located in the src/Ex_ProducteurConsommateur directory.
-Les sources de cet exemple se trouve dans le répertoire src/Ex_ProducteurConsommateur.
-
-L'objectif de cet exemple est double. Tout d'abord, l'exemple montre comment mettre en
-oeuvre un service qui veut utiliser des ports DSC. Ensuite, il montre comment utiliser
-les ports datastream inclus dans le noyau de Salomé.
+There are two purposes to this example. Firstly, the example shows how a service that wants to use DSC ports
+is implemented. It then shows how datastream ports included in the SALOME kernel are used.
-Cet exemple met en place deux services qui vont être connectés par un port datastream.
-Le service produit du composant Producteur va produire un flux de donnée, et le composant
-consomme du composant Consommateur va afficher des données.
+This example sets up two services that will be connected through a datastream port. The "produit" service of the
+"Producteur" component will produce a dataflow, and the "consomme" service of the "Consommateur" component will display data.
-Le service produit se termine lorsqu'il a envoyé toutes les données qu'il doit produire.
-Le nombre de données à produire est déterminé par le port dataflow nombre. Le service
-consommateur a quand à lui besoin de connaître combien de données il doit récupérer avant
-de se terminer. Ce nombre est, comme pour le service produit, déterminé par le port dataflow
-nombre.
+The "produit" service terminates when it has sent all data that it has to produce. The number of data to be produced
+is determined by the "nombre" dataflow port. The "consommateur" service needs to know how many data it has to retrieve before
+it can terminate. As for the product service, this number is determined by the "nombre" dataflow port.
-Voici la définition IDL des deux composants :
+The following is the IDL definition of the two components:
::
void consomme(in long nombre);
};
-Pour déclarer un composant qui va contenir des services utilisant des ports DSC, le composant
-doit hériter de l'interface Engines::Superv_Component et non plus de l'interface
-Engines::Component. En plus d'ajouter au composant l'interface de DSC,
-Engines::Superv_Component ajoute la méthode init_service() qui est appelé par le
-superviseur avant l'exécution du service. L'objectif de cette méthode est de permettre au
-concepteur du service d'initialiser les ports du service en vu de leur connexion avant le
-lancement effectif du service. Par rapport aux exemples précédents, init_service() a la même
-fonction que register_ports().
+In order to declare a component that will contain services using DSC ports, the component must inherit
+from the Engines::Superv_Component interface and no longer from the Engines::EngineComponent interface.
+In addition to adding the DSC interface to the component, Engines::Superv_Component adds the
+init_service() method that the supervisor calls before the service is executed. The purpose of this
+method is to enable the service designer to initialise ports for the service for connection before
+the service is actually started. init_service() performs the same function as register_ports() in
+the previous examples.
-Il s'agit maintenant d'implémenter ces deux composants. La première différence avec un
-composant classique est qu'il faut hériter de la classe Superv_Component_i. De plus, il
-faut implémenter la méthode init_service().
+The next step is to implement these two components. The first difference from a classical component is that it
+must inherit from the Superv_Component_i class. It must also implement the init_service() method.
-Voici l'implémentation de la méthode init_service du composant Producteur :
+The following is the implementation of the init_service method for the "Producteur" component:
::
return rtn;
}
-La couche DSC_User qui implémente la classe Superv_Component_i fournit de nouvelles méthodes
-pour l'ajout des ports uses et provides. Il s'agit des méthodes de la famille add_port (Voir
-la documentation doxygen de Salomé). Ces méthodes ont pour objectif de permettre la création
-et l'enregistrement d'un port du service en une seule étape. De plus, elles permettent
-d'utiliser les ports datastream prédéfinis dans le noyau Salomé.
-
-Dans le cas du service produit, nous avons choisi d'utiliser le port datastream BASIC_short.
-Lorsque le noyau Salomé fournit un port datastream, il fournit toujours l'implémentation pour
-le port provides et pour le port uses. La première partie du nom (BASIC) identifie la famille
-de port datastream (comme CALCIUM ou PALM par exemple). La deuxième partie du nom contient le
-type de donnée transmis, dans cet exemple, un short. Ce type de port constitue le premier
-paramètre de la méthode add_port. Les deux autres arguments sont le type de port DSC (uses ou
-provides) et le nom du port dans le composant.
-
-Lorsqu'il va s'agir d'utiliser ce port dans le service, il va falloir, comme dans les exemples
-précédent, récupérer une référence sur le port. Pour cela de nouvelles méthodes nommées
-get_port sont disponibles (à l'image des add_port). Voici un exemple de code pour utiliser
-la méthode get_port :
+The DSC_User layer that implements the Superv_Component_i class provides new methods for adding uses and provides ports.
+They are methods of the add_port family (See the SALOME doxygen documentation). The purpose of these methods
+is to enable creation and recording of a service port in a single step. They also enable the use of
+datastream ports predefined in the SALOME kernel.
+
+We chose to use the BASIC_short datastream port for the "produit" service. When the SALOME kernel provides
+a datastream port, it always provides the implementation for the provides port and for the uses port.
+The first part of the name (BASIC) identifies the datastream port family (for example like CALCIUM or PALM).
+The second part of the name contains the transmitted data type, in this case a short. This port type forms
+the first parameter of the add_port method. The other two arguments are the type of DSC port (uses or provides)
+and the name of the port in the component.
+
+When the objective is to use this port in the service, it will be necessary to retrieve a reference on the port, in the
+same way as in the previous examples. New methods (like add_port) called get_port are available for this purpose.
+The following is an example of code to use the get_port method:
::
}
}
-La méthode get_port a deux arguments. Le premier va contenir un pointeur vers le port et le
-deuxième indique le nom du port demandé. Après l'appel de la méthode get_port, un pointeur
-générique est obtenu. On change ensuite son type avec le type de port attendu par le biais
-d'un dynamic_cast. Il est alors possible d'utiliser le port.
+The get_port method has two arguments. The first will contain a pointer to the port and the second indicates
+the requested port name. A generic pointer is obtained after calling the get_port method. The next step
+is to change its type with the expected port type through a dynamic_cast. The port can then be used.
-Pour permettre plus de commodité dans la programmation, la couche DSC_User propose plusieurs
-signatures pour les méthodes get_port et add_port. Par exemple, le composant Consommateur
-utilise les versions template de ces méthodes pour l'ajout et la récupération du code.
+The DSC_User layer offers several signatures for the get_port and add_port methods, to make programming
+more convenient. For example, the "Consommateur" component uses the template versions of these methods
+to add and retrieve code.
::
}
}
-La liste des différents types de ports fournis par le Noyau de Salomé est disponible dans
-la documentation Doxygen du noyau Salomé.
+The list of the different port types supplied by the SALOME kernel is available in the
+Doxygen documentation for the SALOME kernel.
-Ajouter des ports datastream et/ou d'interfaces
+Add datastream ports and/or interfaces
+++++++++++++++++++++++++++++++++++++++++++++++++
+The sources for this example are located in the src/Ex_ProducteurConsommateur_Adv directory.
-Les sources de cet exemple se trouve dans le répertoire src/Ex_ProducteurConsommateur_Adv.
-
-L'objectif de cet exemple est de montrer les mécanismes pour ajouter ces propres types de
-ports dans la couche DSC_User. Pour cela, cet exemple explique comment remplacer le port
-BASIC_short de l'exemple précédent par son propre port. Etant donné que cet exemple est
-quasiment identique au niveau des composants, nous nous intéresserons uniquement dans ce
-document à la déclaration et l'implémentation du port.
+The purpose of this example is to show mechanisms used to add your specific types of ports into
+the DSC_User layer. To do this, this example explains how to replace the BASIC_short port in the previous
+example by its own port. Considering that the components in this example are practically identical, we will
+only describe the declaration and implementation of the port in this document.
-Une famille de port Datastream (ou d'interface) contient deux types d'objets différents:
+A Datastream port (or interface) family contains two different types of objects:
-1. Une fabrique.
-2. L'implémentation des ports.
+1. A factory
+2. The implementation of ports
-La couche DSC_User connaît les types de port Datastream par le biais du design pattern
-fabrique. Pour chaque famille, une fabrique est enregistrée à la création du composant.
-Elle est ensuite utilisée par le composant dans les méthodes add_port(...) pour créer et
-enregistrer les ports.
+The DSC_User layer knows the types of Datastream ports through the factory pattern design.
+For each family, a factory is recorded when the component is created. It is then used by
+the component in the add_port(...) methods to create and save ports.
-Tout d'abord, il faut déclarer dans un fichier IDL (MesPorts.idl dans l'exemple) son ou ses
-ports :
+Firstly, its port(s) must be declared in an IDL file (MesPorts.idl in the example):
::
};
};
-Dans cet exemple on déclare un port : Short_Mes_Ports. Il s'agit d'un port qui permet
-d'envoyer un short, mais également qui peut être interrogé pour savoir si une nouvelle
-donnée est arrivée. En revanche la méthode get() n'est pas déclaré dans l'IDL (bien que
-ce soit possible) car elle uniquement destinée à être utilisé en local.
+In this example, a port is declared: Short_Mes_Ports. This is the port that is used to send a short, but
+that can also be queried to find out if new data have arrived. On the other hand, the get() method has not
+been declared in the IDL (although it is possible) because it is intended to be used locally.
-Il faut maintenant implémenter le type de port. Pour cela, il faut implémenter la fabrique
-et la partie uses et la partie provides du type de port.
+The next step is to implement the port type. This is done by implementing the factory and the uses part
+and the provides part of the port type.
-Une fabrique de port est un objet qui implémente l'interface de la classe abstraite
-port_factory (voir la documentation Doxygen). La fabrique est appelée à chaque fois qu'un
-service ajoute un port dans le composant (uses ou provides). La fabrique est identifiée par
-une chaîne de caractère qui l'identifie auprès du composant. L'enregistrement des fabriques
-doit se faire au plus tôt. C'est pourquoi les fabriques sont enregistrées dans le constructeur
-du composant.
+A port factory is an object that implements the interface of the port_factory abstract class (see the Doxygen documentation).
+The factory is called every time that a service adds a port in the component (uses or provides).
+The factory is identified by a character string that identifies it to the component. The factories
+must be recorded as early as possible. This is why factories are recorded in the component constructor.
-La figure suivante montre l'enregistrement de la fabrique dans le composant ProducteurAdv :
+The following figure shows how the factory is registered in the ProducteurAdv component:
::
register_factory("MESPORTS", new mes_ports_factory());
}
-Dans cet exemple, le nouveau type de port est identifié par la chaîne MESPORTS. Il faut
-noter qu'il est interdit d'utiliser le symbole << _ >> dans le nom. En effet, il sert de
-séparateur entre le nom de la famille et le type du port dans la famille (Ex : MESPORTS_short).
+In this example, the new port type is identified by the MESPORTS string. Note that the <<_>> symbol
+may not be used in the name. It is used as a separator between the family name and the port type in the family (Eg: MESPORTS_short).
-Il reste à implémenter les ports. Pour chaque port défini dans l'IDL, il faut implémenter
-la partie uses port et la partie provides port. L'implémentation côté uses doit hériter de
-la classe uses_port. Du côté provides, il faut hériter de la classe provides_port.
+The next step is to implement the ports. The uses port part and the provides port part have to be implemented
+for each port defined in the IDL. The implementation at the uses end must inherit from the uses_port class.
+At the provides end, it must inherit from the provides_port class.
-Les classes uses_port et provides_port sont des classes abstraites. Elles proposent des
-méthodes qui permettent d'automatiser l'enregistrement et la gestion des ports. Dans la couche
-DSC_Basic, c'est le développeur du composant qui doit implémenter ces mécanismes tandis que
-dans la couche DSC_User c'est au développeur des ports de se charger de ces fonctionnalités.
+The uses_port and provides_port classes are abstract classes. They propose methods to automate registering
+and management of ports. The component developer must implement these mechanisms in the DSC_Basic layer, while
+the ports developer is responsible for these functions in the DSC_User layer.
-Les méthodes sont les suivantes :
+The following methods are used:
::
- Pour le côté uses :
+ For the uses end:
virtual const char * get_repository_id() = 0;
virtual void uses_port_changed(Engines::DSC::uses_port * new_uses_port,
const Engines::DSC::Message message) = 0;
- Pour le côté provides :
+ For the provides end:
virtual Ports::Port_ptr get_port_ref() = 0;
virtual void provides_port_changed(int connection_nbr,
const Engines::DSC::Message message) {};
-Du côté uses, il y a tout d'abord la méthode get_repository_id(). Elle permet d'obtenir
-le typecode CORBA du port. Il s'agit de fournir la même information que le premier argument
-de add_uses_port de la couche Basic. La méthode uses_port_changed(…) permet au port d'être
-averti des nouvelle connexions avec des port provides et de gérer la liste des connexions.
+The first step at the uses end is to use the get_repository_id() method. This obtains the CORBA typecode of the port.
+The objective is to provide the same information as the first add_uses_port argument in the Basic layer.
+The uses_port_changed(...) method enables the port to be notified about new connections with the provides port
+and to manage the list of connections.
-Du côté provides, get_port_ref() permet d'obtenir une référence CORBA sur le servant. Enfin
-la méthode provides_port_changed(…) peut être surdéfini si le port provides utilise
-l'information provenant des connexions/déconnexions.
+At the provides end, get_port_ref() obtains a CORBA reference on the servant. Finally, the provides_port_changed(...) method
+can be overdefined if the provides port uses the information originating from connections / disconnections.
-Dans l' exemple, le port provides est implémenté par la classe data_short_mes_ports_provides
-et le port uses est implémenté par la classe data_short_mes_ports_uses.
+In the example, the provides port is implemented by the data_short_mes_ports_provides class and
+the uses port is implemented by the data_short_mes_ports_uses class.
-
.. _pysalome:
================================================================
-Guide pour le développement d'un module SALOME en Python
+Guide for the development of a SALOME module in Python
================================================================
-Ce document a pour objectif de décrire les différentes étapes
-du développement d'un module SALOME en Python.
-Il commence par un bref rappel des principes de SALOME. Puis, il décrit
-les étapes successives qui seront suivies pour arriver à une configuration
-de module complète.
+The purpose of this document is to describe briefly the different steps in the development of a SALOME module
+in Python.
-Les étapes de construction du module exemple
+Steps in construction of the example module
====================================================
-Le module exemple choisi pour illustrer le processus de construction d'un
-module est extrèmement simple. Il contiendra un seul composant et ce composant
-aura un seul service nommé getBanner qui acceptera une chaine de caractères
-comme unique argument et qui retournera une chaine de caractères obtenue
-par concaténation de "Hello " et de la chaine d'entrée. Ce composant sera
-complété par un GUI graphique écrit en PyQt.
-
-Les différentes étapes du développement seront les suivantes :
-
- - créer une arborescence de module
- - créer un composant SALOME chargeable par un container Python
- - configurer le module pour que le composant soit connu de SALOME
- - ajouter un GUI graphique
- - rendre le composant utilisable dans le superviseur
-
-Création de l'arborescence du module
+The example module chosen to illustrate the process to construct a module is extremely simple.
+It will contain a single component and this component will have a single service called getBanner that
+will accept a character string as the sole argument and that will return a character string obtained by
+concatenation of “Hello” and the input chain. This component will be completed by a graphic GUI written in PyQt.
+
+The different steps in the development will be as follows:
+
+ - create a module tree structure
+ - create a SALOME component that can be loaded by a Python container
+ - configure the module so that the component is known to SALOME
+ - add a graphic GUI
+
+Create the module tree structure
=======================================
-Dans un premier temps, on se contentera de mettre dans le module exemple un composant
-SALOME écrit en Python qui sera chargeable par un container Python.
-Il suffit donc d'une interface idl et d'une implémentation Python du composant.
-Pour mettre en oeuvre ceci dans un module SALOME , il faut l'arborescence de
-fichier suivante::
+Firstly, we will simply put a SALOME component written in Python and that can be loaded by a Python
+container, into the example module. An idl interface and a Python implementation of the component will be
+all that are necessary.
+The following file structure is necessary so that this can be implemented in a SALOME module::
+ PYHELLO1_SRC
+ build_configure
+ PYHELLO.py
+ doc
-Le module a pour nom PYHELLO1_SRC et le composant PYHELLO.
-Tous les fichiers sont indispensables à l'exception de VERSION.in, runAppli.in et runSalome.py.
-VERSION.in sert pour documenter le module, il doit donner sa version et ses compatibilités ou
-incompatibilités avec les autres modules. Il est donc fortement recommandé mais pas indispensable
-au fonctionnement.
-Les fichiers runAppli.in et runSalome.py ne sont pas indispensables mais facilitent la mise en
-oeuvre de l'exemple.
+The module name is PYHELLO, the component name is PYHELLO and all the files will be put in a directory named PYHELLO1_SRC.
+All files are essential except for VERSION.in, runAppli.in and runSalome.py.
+VERSION.in is used to document the module, it must give its version and its compatibilities or
+incompatibilities with other modules. Therefore, it is strongly recommended but is not essential for operation.
+The runAppli.in and runSalome.py files are not essential but make the example easier to use.
+
+.. warning::
+
+ the files of the basic platform (KERNEL) must not be copied to initialise a module tree structure.
+ It is usually preferable to copy files from another module such as GEOM or MED.
+
+Implementation of automake, configure
+--------------------------------------
+SALOME uses autoconf and automake to build the configure script that is used for the installation to test
+the system configuration and to preconfigure the module construction Makefile files.
+The build_configure file contains a procedure that starts from configure.ac and uses automake to build
+the configure script.
+automake starts from Makefile.am files to build Makefile.in files.
+All files with an "in" extension are skeletons that will be transformed by the configure process.
+
+Almost all files used for this process are located in the basic platform that is referenced by the
+KERNEL_ROOT_DIR environment variable as well as GUI_ROOT_DIR for the graphical user interface (GUI).
+However, some files must be modified as a function of the target
+module. This is the case for build_configure and configure.ac files that usually need to be adapted.
+
+The basic files for configuration of the KERNEL module and other modules are collected in the salome_adm
+directory of the KERNEL module. However, in order to be able to use the CORBA objects of the KERNEL module,
+the files in the salome_adm directory have to be overwritten, using the make_common_starter.am file in
+the adm_local directory of the example module.
+
+config_files is a directory in which the m4 files that are used to test the configuration of the system in the
+configure process can be placed. If the salome_adm files are not sufficient, others can be added in adm_local.
+
+The idl directory
+--------------------------------------
+The idl directory requires a Makefile.am that must make the compilation of the idl PYHELLO_Gen.idl file
+and install all the generated files in the right module installation directories. The BASE_IDL_FILES target has
+to be modified to reach this goal.
-Mise en garde : il ne faut pas copier les fichiers de la plate-forme de base (KERNEL) pour
-initialiser une arborescence de module. Il est, en général, préférable de copier les fichiers
-d'un autre module comme GEOM ou MED.
+The idl file itself must define a CORBA module for which the name must be different from the module
+name to avoid name conflicts and define a CORBA interface that is derived at least from the EngineComponent interface of the Engines module.
+The name of the CORBA module will be PYHELLO_ORB and the name of the interface will be PYHELLO_Gen.
-Mise en oeuvre d'automake, configure
+The src directory
--------------------------------------
-SALOME utilise autoconf et automake pour construire le script configure qui sert à l'installation pour
-tester la configuration du système et pour préconfigurer les fichiers Makefile de contruction
-du module.
-Le fichier build_configure contient une procédure qui à partir de configure.ac et au moyen
-d'automake construit le script configure.
-Tous les fichiers dont l'extension est in sont des squelettes qui seront transformés par le
-processus de configure.
-
-Presque tous les fichiers utilisés pour ce processus sont localisés dans la plate-forme de
-base qui est référencée par la variable d'environnement KERNEL_ROOT_DIR. Cependant quelques
-fichiers doivent être modifiés en fonction du module cible. C'est le cas bien sur de build_configure
-et de configure.ac qui doivent en général être adaptés.
-
-Les fichiers de base pour le configure du module KERNEL et des autres modules sont rassemblés
-dans le répertoire salome_adm du module KERNEL. Il faut cependant, pour pouvoir utiliser les objets
-CORBA du module KERNEL surcharger les fichiers du répertoire
-salome_adm. Cette surcharge est réalisée avec le fichier make_common_starter.am
-dans le répertoire adm_local du module exemple.
-
-config_files est un répertoire dans lequel on peut mettre les fichiers m4 qui servent à tester
-la configuration du système dans le processus de configure. Si les fichiers de salome_adm ne sont pas
-suffisants, on peut en ajouter dans adm_local.
-
-Répertoire idl
-------------------
-Dans le répertoire idl, il faut un Makefile qui doit mettre en oeuvre la compilation
-du fichier idl PYHELLO_Gen.idl et installer tous ces fichiers dans les bons répertoires
-de l'installation du module. Il suffit de modifier la cible BASE_IDL_FILES pour obtenir
-un fichier adapté.
-
-Concernant le fichier idl lui-même, il doit définir un module CORBA dont le nom
-doit être différent du nom du module pour éviter les conflits de nom et définir une
-interface CORBA qui dérive à minima de l'interface Component du module Engines.
-Le nom du module CORBA sera PYHELLO_ORB et le nom de l'interface PYHELLO_Gen.
-
-Répertoire src
-------------------
-Le répertoire src contiendra tous les composants et GUI graphiques du module. Chacune
-de ces entités doit avoir son propre répertoire.
-
-Le module ne contiendra pour le moment qu'un seul répertoire pour le moteur du
-composant PYHELLO et son nom sera PYHELLO.
-
-Le Makefile se contente de déclencher le parcours des sous répertoires qui sont
-décrits par la cible SUBDIRS.
-
-Répertoire PYHELLO
+The src directory will contain all components and the GUI for the module. Each of these entities must have
+its own directory.
+
+For the moment, the module will only contain a single directory for the engine of the PYHELLO component
+and its name will be PYHELLO.
+
+The Makefile.am will simply trigger the path of sub-directories described by the SUBDIRS target.
+
+The PYHELLO directory
'''''''''''''''''''''''
-Le répertoire contient le module Python qui représente le composant et donc contient la classe PYHELLO
-et un fichier Makefile dont le rôle est simplement d'exporter le module PYHELLO.py
-dans le répertoire d'installation du module SALOME.
+This directory contains the Python module that represents the component and therefore contains the PYHELLO class
+and a Makefile.am file that simply exports the PYHELLO.py module into the installation directory of the SALOME module.
-Le module PYHELLO.py contient la classe PYHELLO qui dérive de l'interface PYHELLO_Gen du
-module CORBA PYHELLO_ORB__POA et de la classe SALOME_ComponentPy_i du module SALOME_ComponentPy.
+The PYHELLO.py module contains the PYHELLO class that is derived from the PYHELLO_Gen interface of the CORBA
+PYHELLO_ORB_POA module and the SALOME_ComponentPy_i class of the SALOME_ComponentPy module.
-Répertoire doc
-------------------
-Il ne contient rien pour le moment. Il pourrait contenir ce document.
+The doc directory
+--------------------------------------
+This contains nothing for the moment. It could contain this document.
-Répertoire bin
-------------------
-VERSION.in sert pour documenter le module, il doit donner sa version et ses compatibilités ou
-incompatibilités avec les autres modules. Il est donc fortement recommandé mais pas indispensable
-au fonctionnement.
+The bin directory
+--------------------------------------
+VERSION.in is used to document the module, it must define its version and its compatibilities
+or incompatibilities with other modules. Therefore, it is strongly recommended but is not essential for operation.
-Le fichier runAppli.in est l'équivalent du runSalome du module KERNEL configuré pour mettre
-en oeuvre le module KERNEL et ce module PYHELLO.
+The runAppli.in file is the equivalent of the runSalome in the KERNEL module configured to implement the KERNEL
+module and this PYHELLO module.
-Le fichier runSalome.py est le fichier du module KERNEL avec une correction de bug pour
-tourner seulement avec un container Python, une modification de la fonction test qui crée
-le composant PYHELLO au lieu d'un composant MED et un développement pour disposer de
-la complétion automatique en Python.
+The myrunSalome.py file is the file of the KERNEL module modified to run only with a Python container,
+with the test function that creates the PYHELLO component instead of a MED component,
+and automatic completion in Python.
-Création d'un composant chargeable par un container
+Creating a component that can be loaded by a container
======================================================
-Les fichiers présentés ci-dessus suffisent pour construire et installer le module PYHELLO1_SRC,
-lancer la plate-forme SALOME constituée des modules KERNEL et PYHELLO1 et demander au container
-Python le chargement d'un composant PYHELLO.
+The files presented above are sufficient to build and install the PYHELLO1_SRC module, to start
+the SALOME platform composed of the KERNEL and PYHELLO1 modules, and to request the Python container
+to load a PYHELLO component.
-Toutes les étapes suivantes supposent que les logiciels prérequis de SALOME sont accessibles dans l'environnement
-du développeur de modules.
+All the following steps are only possible if the SALOME prerequisite software is accessible in the module
+developer environment.
Construction, installation
---------------------------------
-Dans PYHELLO1_SRC, faire::
+In PYHELLO1_SRC, enter::
- export KERNEL_ROOT_DIR=<chemin d'installation du module KERNEL>
+ export KERNEL_ROOT_DIR=<KERNEL installation path>
./build_configure
-Aller dans ../PYHELLO1_BUILD et faire::
+Go into ../PYHELLO1_BUILD and enter::
- ../PYHELLO1_SRC/configure --prefix=<chemin d'installation du module PYHELLO1>
+ ../PYHELLO1_SRC/configure --prefix=<PYHELLO1 installation path>
make
make install
-Lancement de la plate-forme
+Running the platform
-------------------------------
-Aller dans <chemin d'installation du module PYHELLO1> et faire::
-
- ./bin/salome/runAppli
+Move into the <PYHELLO1 module installation path> and enter::
-Cette commande lance SALOME configurée pour KERNEL et le module PYHELLO1. A la fin de ce
-lancement l'utilisateur est devant un interpréteur Python configuré pour SALOME et qui
-donne accès aux objets CORBA de SALOME.
+ ./bin/salome/runAppli
-runAppli est un shell qui exécute un script Python en lui passant des arguments en ligne de
-commande::
+This command runs SALOME configured for KERNEL and the PYHELLO1 module. At the end of running,
+the user sees a Python interpreter configured for SALOME that provides access to SALOME CORBA objects.
- python -i $PYHELLO_ROOT_DIR/bin/salome/runSalome.py --modules=PYHELLO --xterm --containers=cpp,python --killall
+runAppli is a shell that executes a Python script, by passing arguments to it in a command line::
-Ces arguments indiquent que l'on prendra le script runSalome.py situé dans le module PYHELLO, que l'on
-activera le composant PYHELLO, les impressions seront redirigées dans une fenêtre xterm, on lancera un
-container Python et tous les processus SALOME existant avant le lancement seront tués.
+ python -i $PYHELLO_ROOT_DIR/bin/salome/myrunSalome.py --modules=PYHELLO --killall
-Pour que cette commande fonctionne, il faut préalablement avoir positionné les variables d'environnement
-suivantes::
+These arguments state that the myrunSalome.py script located in the PYHELLO module will be used, that the PYHELLO
+component will be activated and all SALOME processes that existed before the run will be killed.
- export KERNEL_ROOT_DIR=<chemin d'installation du module KERNEL>
- export PYHELLO_ROOT_DIR=<chemin d'installation du module PYHELLO>
+This command will not function unless the following environment variables have previously been set::
-Cette méthode d'activation des modules et composants de SALOME tend à confondre module et composant.
-Dans ce cas (1 composant par module), il n'y a pas de difficulté à paramétrer le lancement. Il suffit d'indiquer derrière
-l'option --modules la liste des composants demandés (KERNEL est inutile) et de fournir autant de variables
-d'environnement qu'il y a de composants. Le nom de ces variables doit être <Composant>_ROOT_DIR et doit donner le chemin
-du module contenant le composant. Dans le cas où on a plusieurs composants par module, c'est un peu plus
-compliqué. Ce sera présenté ultérieurement.
+ export KERNEL_ROOT_DIR=<KERNEL installation path>
+ export PYHELLO_ROOT_DIR=<PYHELLO installation path>
-Mise en garde: il est possible que le lancement de SALOME n'aille pas jusqu'au bout. En effet
-dans certaines circonstances, le temps de lancement des serveurs CORBA peut être long et dépasser
-le timeout fixé à 21 secondes. Si la raison en est le temps de chargement important des
-bibliothèques dynamiques, il est possible qu'un deuxième lancement dans la foulée aille
-jusqu'au bout.
+.. warning::
-Chargement du composant exemple
+ it is possible that the SALOME run will not reach the end. In some circumstances, the time to
+ start CORBA servers may be long and could exceed the timeout. If the reason for
+ this is that the time to load dynamic libraries is long, it is possible that a second run immediately
+ afterwards will be successful.
+
+Loading the example component
------------------------------------
-Pour avoir accès aux méthodes du composant, il faut importer le module PYHELLO_ORB avant
-de demander le chargement du composant au container Python. Ce container Python
-a été rendu accessible dans runSalome.py au moyen de la variable container::
+The PYHELLO_ORB module has to be imported before making a request to load the component into the Python
+container, to obtain access to methods of the component. This Python container was made accessible
+in the runSalome.py by means of the container variable::
import PYHELLO_ORB
c=container.load_impl("PYHELLO","PYHELLO")
c.makeBanner("Christian")
-La dernière instruction doit retourner 'Hello Christian'.
-Pour voir les objets CORBA créés par ces actions, faire::
+The last instruction must return ‘Hello Christian’.
+
+Proceed as follows to see CORBA objects created by these actions::
clt.showNS()
-Composant SALOME déclaré
+Declared SALOME component
==============================
-Pour le moment, le composant PYHELLO a été chargé en faisant une requête directe au container
-Python. Ce n'est pas la méthode standard pour charger un composant. La voie normale passe
-par le service LifeCycle qui utilise les services du catalogue pour identifier le composant
-et ses propriétés puis appelle le container demandé pour charger le composant.
+For the moment, the PYHELLO component was loaded by making a direct request to the Python container. This is
+not the standard method for loading a component. The normal method uses the LifeCycle service that uses
+catalog services to identify the component and its properties and then calls the requested container to load the component.
-Pour pouvoir utiliser cette méthode, il faut déclarer le composant dans un catalogue au format XML dont le
-nom doit être <Composant>Catalog.xml. Dans notre cas ce sera PYHELLOCatalog.xml. Ce catalogue sera rangé
-dans le répertoire resources. Arborescence actualisée::
+Before this method can be used, the component must be declared in a catalog in the XML format, for which
+the name must be <Module>Catalog.xml. In our case, it will be PYHELLOCatalog.xml. This catalog will be stored in
+the resources directory.
+
+Updated tree structure::
+ PYHELLO1_SRC
+ build_configure
+ resources
+ PYHELLOCatalog.xml
-En dehors de l'ajout du répertoire resources et du fichier PYHELLOCatalog.xml, le reste des fichiers
-est identique. Il faut cependant modifier le Makefile.am de tête pour que le catalogue soit bien installé
-dans le répertoire d'installation. Il suffit de le spécifier dans la cible RESOURCES_FILES.
+The remainder of the files are identical, apart from adding the resources directory and the PYHELLOCatalog.xml file.
+However, the Makefile.am has to be modified so that the catalog is actually installed in the installation
+directory. It simply needs to be specified in the salomeres_SCRIPTS target.
Construction, installation
---------------------------------
-Il n'est pas nécessaire de refaire un configure pour prendre en compte cette modification. Il
-suffit d'aller dans PYHELLO1_BUILD et de faire::
-
+There is no need to do another configure to take account of this modification.
+All that is necessary is to enter PYHELLO1_BUILD and then::
+
./config.status
make
make install
-Lancement de la plate-forme
+Starting the platform
-------------------------------
-Le lancement de la plate-forme se passe de la même manière que précédemment. Aller dans PYHELLO1_INSTALL et faire::
+The platform is started in the same way as before. Go into PYHELLO1_INSTALL and do::
./bin/salome/runAppli
-Chargement du composant exemple
+Loading the example component
------------------------------------
-La méthode de chargement du composant n'est pas très différente de la fois précédente. On
-utiilise maintenant les services du module LifeCycle au lieu d'appeler directement le container.
-La séquence d'appel est contenue dans la fonction test de runSalome.Py. ::
+The method of loading the component is not very different from that described above. The services of the
+LifeCycle module are used in this case instead of calling the container directly.
+The call sequence is contained in the runSalome.Py test function. ::
c=test(clt)
c.makeBanner("Christian")
-La fonction test crée le LifeCycle. Puis elle demande le chargement du composant PYHELLO
-dans le container FactoryServerPy::
+The test function creates the LifeCycle. It then asks for the PYHELLO component to be loaded in the FactoryServerPy container::
def test(clt):
"""
pyhello = lcc.FindOrLoadComponent("FactoryServerPy", "PYHELLO")
return pyhello
-Chargement depuis l'interface applicative (IAPP)
+Loading from the application interface (IAPP)
----------------------------------------------------------
-Pour pouvoir charger dynamiquement un composant en utilisant la barre à composants
-de l'IAPP, il faut déclarer l'icone représentative du composant dans le catalogue.
-Pour la déclarer il suffit d'ajouter une ligne pour l'icone au catalogue du composant::
-
- <component-icone>PYHELLO.png</component-icone>
+Before a component can be loaded dynamically using the IAPP components bar, the icon representing the
+component will have to be declared in the catalog.
+It is declared by simply adding a line for the icon to the component catalog::
-et de mettre le fichier correspondant dans le répertoire resources du module.
+ <component-icon>PYHELLO.png</component-icon>
-Pour tester la bonne configuration de la barre à composants, lancer SALOME comme
-précédemment puis à partir de l'interpréteur Python lancer l'IAPP par::
+and putting the corresponding file in the module resources directory.
- startGUI()
-
-et charger le composant en cliquant sur l'icone de PYHELLO après avoir ouvert une étude. L'IAPP doit
-signaler que le GUI du composant n'est pas correctement configuré mais le composant sera quand
-même créé après un temps d'attente. On peut le constater en tapant::
-
- clt.showNS()
-
-Ajout d'un GUI graphique
+Adding a graphic GUI
===========================
-L'étape suivante pour compléter le module consiste à ajouter au composant PYHELLO
-une interface graphique qui sera écrite en Python en utilisant la bibliothèque de
-widgets Qt. Cette interface graphique doit s'intégrer dans l'interface applicative
-de SALOME (IAPP) et doit donc respecter certaines contraintes que nous allons voir.
-
-Tout d'abord, précisons le contour du GUI d'un composant.
-Le comportement du GUI est
-donné par un module Python dont le nom est normalisé <Composant>GUI.py. Il doit
-proposer des points d'entrée conventionnels qui seront utilisés par l'IAPP pour activer
-ce GUI ou l'informer de certains évènements.
-L'activation des commandes du GUI est réalisée au moyen d'une barre de menu et d'une barre
-à boutons qui s'intègrent dans la barre à menus et dans la barre à boutons de l'IAPP.
-
-
-Module Python implantant le comportement du GUI
+The next step to complete the module consists of adding a graphic interface to the PYHELLO component, that will
+be written in Python using the Qt widgets library. This graphic interface must be integrated into the SALOME
+application interface (IAPP), and therefore must respect some constraints that we will see.
+
+Firstly note the contour of the GUI of a component. The behaviour of the GUI is given by a Python module
+that has a standard name <Module>GUI.py. It must propose conventional entry points that the IAPP will use to
+activate this GUI or to inform it of specific events. GUI commands are activated through a menu bar and a
+button bar that are integrated into the menu bar and into the IAPP button bar.
+
+Python module implanting the behaviour of the GUI
-----------------------------------------------------
-Le comportement du GUI du composant PYHELLO est implanté dans le module Python PYHELLOGUI.py
-du sous-répertoire PYHELLOGUI.
-Le Makefile.in localisé dans le répertoire src doit être actualisé pour parcourir le sous-répertoire PYHELLOGUI.
-Un Makefile.in doit être ajouté dans le sous-répertoire PYHELLOGUI. Les cibles
-importantes sont PO_FILES et EXPORT_PYSCRIPTS.
+The behaviour of the PYHELLO component GUI is implanted in the Python PYHELLOGUI.py module in the
+PYHELLOGUI sub-directory. The Makefile.am located in the src directory must be updated to include
+the PYHELLOGUI subdirectory. A Makefile.am must be added into the PYHELLOGUI subdirectory.
+Important targets are salomescript_SCRIPTS and salomeres_DATA.
-La cible EXPORT_PYSCRIPTS doit être mise à jour avec le nom des modules Python à rendre visible
-dans Salome, c'est à dire principalement pour qu'ils soient importables (commande import de Python).
+The salomescript_SCRIPTS target must be updated with the name of the Python modules to be made visible in Salome, in other
+words mainly so that they are importable (Python import command).
-La cible PO_FILES doit être mise à jour avec les noms des fichiers qui sont utilisés pour le multi-linguisme.
-Pour le moment le fichier PYHELLO_msg_en.po (traduction pour langue anglaise) est vide car le multi-linguisme
-n'est pas mis en oeuvre dans cet exemple.
+The salomeres_DATA target must be updated with the names of files that are used for multi-linguism.
-Barre à menus et barre à boutons
+Menu bar and button bar
----------------------------------
-Les barres à menus et à boutons du composant PYHELLO sont décrites dans un fichier au format XML
-pour permettre leur chargement dynamique dans l'IAPP. Ce fichier est localisé dans le répertoire resources
-du module et a un nom standardisé <Composant>_en.xml pour la langue anglaise. Pour la langue française, il
-faut également un fichier de nom <Composant>_fr.xml.
-Pour le composant PYHELLO, le fichier PYHELLO_en.xml contient un menu avec un item et un bouton.
-L'icone du bouton est fournie par le fichier ExecPYHELLO.png localisé dans le répertoire resources du module.
+The menu bar and button bar for the PYHELLO component are dynamically added when importing the PYHELLOGUI module.
+They are created by calling the Python functions createMenu, createAction and createTool from the sgPyQt SALOME
+interface object. Every action must have a unique id.
+Some icons are used. They must be installed in the resources directory.
+++ /dev/null
-/*! \page python Python wrapping
-
-
-The main classes and methods are wrapped in Python with
-the SWIG tool (at least version 1.3.24)
-
-\section python_modules Multi modules
-As in C++ the wrapping is split in 3 modules : engine, runtime, loader
-so that other runtime or loader can be used with the same engine.
-We need to be careful with definitions shared by the 3 modules : put
-them in a unique dynamic library and link the modules with it.
-
-\section python_exception Exception wrapping
-In swig, exception can be wrapped either by declaring throw in interface
-file (.i) or by declaring an exception handler.
-A generic exception handler has been declared and automatic generation has been
-desactivated (SWIG option -noexcept).
-
-\section python_gil Global Interpreter Lock
-For some methods we need to release the Python GIL.
-This is done by using a swig exception handler that releases the lock
-on entry and reacquires it on exit.
-
-\section python_ownership Ownership
-Some methods (factory mainly) don't give ownership to python. For example,
-createNode from runtime object returns a newly created node to python but
-python has not ownership so when it disappears from python, the C++ object
-is not destroyed.
-To give ownership to python we use %newobject macro.
-
-*/
.. _python:
********************************************************
-Utilisation de YACS avec l'interface Python (TUI)
+Using YACS with the python interface (TUI)
********************************************************
.. toctree::
.. _rappels:
================================================================
-Rappels sur la plate-forme SALOME
+Reminders about the SALOME platform
================================================================
-Définitions
+Definitions
================================================================
- - **Module SALOME** : un module SALOME est un regroupement de composants SALOME. Il réside dans un répertoire
- dont la structure est standardisée. Ses composants sont décrits dans un fichier XML de nom <module>Catalog.xml.
-
- - **Composant SALOME** : c'est l'équivalent SALOME d'un code de calcul. Il peut prendre la forme d'une bibliothèque dynamique ou
- d'un module Python.
-
- - **Service SALOME** : chaque composant a un ou plusieurs services. Un service est l'équivalent d'une subroutine Fortran, d'une
- fonction C, d'une méthode C++ ou Python. Seuls les services de composant peuvent être couplés avec le coupleur YACS.
- Le couplage est réalisé en connectant les ports d'entrée-sortie dont sont dotés les services.
- Ces ports peuvent être de deux types : dataflow ou datastream.
-
- - **Port dataflow** : un port dataflow est un point de connexion pour l'échange de données. Il a un nom qui est le
- nom de la variable échangée, un type qui indique le type de donnée (double, long, string, ...) et un sens (entrée
- ou sortie). On peut connecter un port dataflow entrant avec un port dataflow sortant d'un type compatible.
- La variable portée par le port est échangée en fin de service (port sortant) et en début de service (port entrant).
- Aucun échange de donnée n'a lieu pendant l'exécution du service.
-
- - **Port datastream** : un port datastream permet l'échange de données pendant l'exécution. Comme un port dataflow, il
- a un nom, un type et un sens mais il a en plus un mode de dépendance itératif (I) ou temporel (T).
- On peut connecter un port datastream entrant uniquement avec un port datastream sortant de même type.
- Il peut exister plusieurs classes de port datastream.
- Ici, on ne traitera que des ports datastream CALCIUM.
-
- - **Coupleur YACS** : c'est un module SALOME qui permet d'éditer et d'exécuter des schémas de couplage qui sont
- principalement sous la forme d'un fichier XML. Le module fournit une interface utilisateur graphique pour
- éditer un schéma, l'exécuter et suivre son exécution.
-
- - **Instance de composant** : on peut avoir plusieurs exemplaires du même composant qui sont exécutés par SALOME
- dans une même session. Pour distinguer ces exemplaires, on parle d'instance de composant. On peut faire un parallèle
- avec les termes code de calcul (composant) et exécution (instance de composant).
-
- - **Container** : Processus SALOME qui exécute les composants. Il a la responsabilité de charger (bibliothèque dynamique
- ou module Python) et d'enregistrer les composants. Le choix des containers peut avoir de l'importance si on veut
- qu'un composant ne soit pas dans le même exécutable qu'un autre.
-
- - **Application SALOME** : ensemble de modules SALOME intégrés dans la plate-forme SALOME. Cette plate-forme
- est batie sur les modules de base KERNEL et GUI qui fournissent les services de lancement des composants
- et d'intégration dans l'IHM graphique. Une application SALOME fournit plusieurs scripts qui permettent
- de lancer l'application (runAppli), de se mettre dans l'environnement de l'application (runSession) et d'autres
- plus internes comme le lancement distant (runRemote)
-
-Modules et composants SALOME
+ - **SALOME module**: a SALOME module is a group of SALOME components. It is located in a directory with a standard structure.
+ Its components are described in an XML file named <module>Catalog.xml.
+ - **SALOME component**: this is the SALOME equivalent of a calculation code. It may be in the form of a dynamic
+ library or a Python module.
+ - **SALOME service**: each component has one or several services. A service is the equivalent of a Fortran
+ subroutine, a C function, a C++ method or a Python method. Only component services can be coupled with the YACS coupler.
+ Coupling is done connecting input-output ports with which services are provided. There are two types of these
+ ports, dataflow and datastream.
+ - **Dataflow port**: a dataflow port is a connection port for exchanging data. It has a name that is the name of the
+ exchanged variable, a type that indicates the data type (double, long, string, etc.) and a direction (input or output).
+ An input dataflow port can be connected with an output dataflow port of a compatible type. The variable carried by
+ the port is exchanged at the end of the service (output port) or at the beginning of the service (input port).
+ No data exchange takes place during execution of the service.
+ - **Datastream port**: a datastream port is used to exchange data during execution. Like a dataflow port, it has a name,
+ a type and a direction but it also has an iterative (I) or time (T) dependence mode. An input datastream port can only
+ be connected with an output datastream port of the same type. There may be several classes of datastream port.
+ In this description, we only deal with CALCIUM datastream ports.
+ - **YACS coupler**: this is a SALOME module that edits and executes coupling schemes that are mainly in the form of an
+ XML file. The module provides a graphic user interface to edit a scheme, to execute it and monitor its execution.
+ - **Component instance**: there can be several copies of the same component and they can be executed by SALOME in a
+ single session. A distinction between these copies is made by referring to a component instance. A parallel can be
+ made with the terms calculation code (component) and execution (component instance).
+ - **Container**: SALOME process that executes components. It loads (dynamic library or Python module) and saves
+ components. The choice of containers may be important if it is required that one component should not be in the same
+ executable as another.
+ - **SALOME application**: set of SALOME modules integrated into the SALOME platform. This platform is built on KERNEL
+ and GUI basic modules that provide component running and integration services in the graphic user interface. A SALOME application
+ provides several scripts to run the application (runAppli), enter the application environment (runSession) and other
+ more internal scripts such as remote run (runRemote).
+
+SALOME modules and components
==================================================
-Dans son principe, la plate-forme SALOME est décomposée en une plate-forme
-de base nommée module KERNEL et une collection de modules divers.
-
-Un module est un produit compilable et installable qui se concrétise par une arborescence source qui doit
-respecter les règles générales SALOME et qui comprend une procédure de construction, installation qui
-respecte également les règles SALOME.
-Chaque module est géré en configuration dans un module CVS
-indépendant. Chaque module peut livrer des versions à son rythme dans le respect des règles de
-cohérence de SALOME. A chaque module est associée une base de tests de non régression.
-
-Un module a des dépendances avec les autres modules (utilise, est utilisé).
-Le module KERNEL constitue la base de la plate-forme SALOME.
-Tous les autres modules dépendent du module KERNEL.
-
-===================================== ========= ============= ==================================
-Thèmes Modules Utilise Est utilisé par
-===================================== ========= ============= ==================================
-Architecture KERNEL MED, GEOM, SMESH, VISU,YACS
-Architecture MED KERNEL SMESH, VISU
-Géométrie GEOM KERNEL SMESH
-Maillage SMESH KERNEL, MED
-Supervision YACS KERNEL
-Visualisation VISU KERNEL, MED
-===================================== ========= ============= ==================================
-
-Un module contient un ou plusieurs composants SALOME. Un composant SALOME est un objet CORBA qui
-respecte les règles SALOME et qui est déclaré à SALOME au moyen d'un catalogue. Un composant SALOME
-peut être doté d'une interface utilisateur graphique (GUI) qui doit elle-même respecter les règles
-SALOME.
-
-Les containers
+In principle, the SALOME platform is broken down into a basic platform (composed of a KERNEL and a GUI modules)
+and a collection of various modules.
+
+A module is a compilable and installable product that is materialised by a source tree structure that must respect
+SALOME general rules and that includes a construction and installation procedure that also respects SALOME rules.
+Each module is managed in configuration in an independent CVS module. Each module can deliver versions at it own rate
+respecting SALOME consistency rules. A non-regression tests base is associated with each module.
+
+A module has dependencies with other modules (uses, is used). The KERNEL and GUI modules makes up the base of the SALOME platform.
+All other modules depend on these modules.
+
+===================================== ========= ======================= ==================================
+Theme Module Uses Is used by
+===================================== ========= ======================= ==================================
+Architecture KERNEL GUI, MED, GEOM, SMESH, VISU,YACS
+Architecture GUI KERNEL MED, GEOM, SMESH, VISU,YACS
+Architecture MED KERNEL, GUI SMESH, VISU
+Geometry GEOM KERNEL, GUI SMESH
+Mesh SMESH KERNEL, GUI, GEOM, MED
+Supervision YACS KERNEL, GUI
+Visualization VISU KERNEL, GUI, MED
+===================================== ========= ======================= ==================================
+
+A module contains one or several SALOME components. A SALOME component is a CORBA object that respects SALOME rules
+and that is declared to SALOME using a catalog. A SALOME component may be provided with a graphic user interface (GUI)
+that must itself respect SALOME rules.
+
+Containers
======================
-Dans SALOME, les composants sont dynamiquement chargeables. Cette propriété est obtenu
-en utilisant un mécanisme de container.
+In SALOME, components are dynamically loaded. This property is obtained by using a container mechanism.
-Dans ses grandes lignes, un container est un serveur CORBA dont l'interface dispose
-des méthodes nécessaires pour effectuer le chargement déchargement de l'implémentation
-d'un composant SALOME. Pour effectuer le chargement d'un composant, on appellera la méthode
-load_impl du container.
+In general, a container is a CORBA server with an interface that is provided with methods necessary to load
+and unload the implementation of a SALOME component. A component is loaded by calling the container load_impl method.
-La mécanique de base du chargement d'un composant est dépendante du langage d'implémentation choisi.
+The basic mechanism for loading a component depends on the chosen implementation language.
-En C++, la plate-forme utilise le chargement dynamique de bibliothèque (dlopen) et un mécanisme de fonction
-factory dont le nom doit être <Module>Engine_factory (par exemple GEOMEngine_factory, pour GEOM).
-Cette fonction doit retourner l'objet CORBA effectif qui est le composant SALOME.
+In C++, the platform uses dynamic library loading (dlopen) and a factory function mechanism that must be
+named <Component>Engine_factory (for example GEOMEngine_factory, for GEOM component type).
+This function must return the effective CORBA object that is the SALOME component.
-En Python, la plate-forme utilise le mécanisme d'import de Python (import <Module>) et instancie
-le composant SALOME Python en utilisant une classe (ou une factory) de même nom (<Module>) pour
-ce faire.
+In Python, the platform uses the Python import mechanism (import <Component>) and instantiates the Python SALOME
+component using a class (or a factory) with the same name (<Component>).
.. _appli:
-Construction et utilisation d'une application SALOME
+Construction and use of a SALOME application
=========================================================
-Ce document explique comment configurer, installer et utiliser votre propre
-application SALOME à partir d'une liste de modules préinstallés.
+This section explains how to configure, install and use your own SALOME application starting from a list of
+pre-installed modules (see more details in the on line documentation for the KERNEL module defining the
+application concept).
-Principes
+Principles
------------
+A SALOME application is built up from a list of platform basic modules (GEOM, SMESH, ASTER, etc.) or users.
+It consists of a set of shell scripts and directories used to execute the application in different contexts.
-Une application SALOME est construite à partir d'une liste de modules (GEOM, SMESH, ASTER...) de
-base de la plate-forme ou utilisateurs.
-Elle consiste en un jeu de scripts shell et de répertoires qui permettent d'exécuter l'application
-dans différents contextes.
-
-Un utilisateur peut définir plusieurs applications SALOME. Ces applications
-sont utilisables à partir d'un même compte utilisateur. Elles peuvent utiliser
-les mêmes modules (KERNEL ou autre). L'application SALOME est indépendante de KERNEL
-et **ne doit pas être installée dans KERNEL_ROOT_DIR**.
-
-Les prérequis utilisés par chaque application peuvent être différents.
-
-Une session SALOME lancée à partir d'une application SALOME peut s'exécuter
-sur plusieurs calculateurs.
+A user can define several SALOME applications. These applications can be used from several user accounts.
+They can use the same modules (KERNEL or other). The SALOME application is independent of KERNEL
+and **it must not be installed in KERNEL_ROOT_DIR**.
-Pour une installation d'application multi-machines, les modules et les prérequis
-doivent être installés sur toutes les machines impliquées. Il n'est pas nécessaire
-d'installer tous les modules sur toutes les machines à part KERNEL.
-L'utilisateur SALOME doit avoir un compte sur chaque machine. L'accès aux machines
-distantes est réalisé par rsh ou ssh. Ces accès doivent être configurés pour
-un usage sans password. Les comptes peuvent être différents sur les différentes
-machines.
+Prerequisites for each application may be different.
-.. raw:: latex
+A SALOME session run from a SALOME application can be executed on several computers.
- \makeatletter
- \g@addto@macro\@verbatim\small
- \makeatother
+For the installation of a multi-machine application, the modules and prerequisites must be installed on
+all machines involved. There is no need to install all modules on all machines except for KERNEL.
+The SALOME user must have an account on each machine. Remote machines are accessed by rsh or ssh.
+These accesses must be configured for use without a password. The accounts may be different on the different machines.
-
-Créer une application SALOME
+Creating a SALOME application
------------------------------
-On crée une application SALOME avec l'outil appli_gen.py que l'on trouve dans l'installation du module KERNEL.
-Cet outil construit l'application en partant d'un fichier de configuration au format XML qui décrit la liste
-des modules à utiliser (nom, chemin d'installation), le fichier qui positionne l'environnement
-pour les prérequis de SALOME et optionnellement le répertoire des exemples SALOME (SAMPLES_SRC).
+A SALOME application is created using the appli_gen.py tool located in the installation of the KERNEL module.
+This tool builds the application starting from a configuration file in the XML format that describes the list
+of modules to be used (name, installation path), the file that sets the environment for SALOME pre-requisites
+and optionally the SALOME examples directory (SAMPLES_SRC) and a catalog of resources.
+
+The following command is used:
-La commande à utiliser est la suivante::
+.. code-block:: sh
- python <KERNEL_ROOT_DIR>/bin/salome/appli_gen.py --prefix=<install directory> --config=<configuration file>
+ python <KERNEL_ROOT_DIR>/bin/salome/appli_gen.py --prefix=<install directory> \
+ --config=<configuration file>
-où <configuration file> est le nom du fichier de configuration et <install directory> est le nom du répertoire
-dans lequel on veut créer l'application. <KERNEL_ROOT_DIR> indique le répertoire d'installation du module KERNEL.
+where <configuration file> is the name of the configuration file and <install directory> is the name of the
+directory in which the application is to be created. <KERNEL_ROOT_DIR> indicates the directory in which
+the KERNEL module is installed.
-On peut créer le fichier de configuration en modifiant une copie du fichier ${KERNEL_ROOT_DIR}/bin/salome/config_appli.xml.
+The configuration file can be created by modifying a copy of the ${KERNEL_ROOT_DIR}/bin/salome/config_appli.xml file.
+For example:
-En voici un exemple::
+.. code-block:: xml
<application>
- <prerequisites path="/data/tmplgls/secher/SALOME_V4.1.1_MD08/env_products.sh"/>
+ <prerequisites path="/data/SALOME_V5/env_products.sh"/>
+ <resources path="myCata.xml"/>
<modules>
- <!-- variable name <MODULE>_ROOT_DIR is built with <MODULE> == name attribute value -->
+ <!-- variable name <MODULE>_ROOT_DIR is built
+ with <MODULE> == name attribute value -->
<!-- <MODULE>_ROOT_DIR values is set with path attribute value -->
- <!-- attribute gui (defaults = yes) indicates if the module has a gui interface -->
- <module name="KERNEL" gui="no" path="/data/SALOME_V4.1.1/KERNEL_INSTALL"/>
- <module name="GUI" gui="no" path="/data/SALOME_V4.1.1/GUI_4.1.1"/>
- <module name="MED" path="/data/SALOME_V4.1.1/MED_4.1.1"/>
- <module name="GEOM" path="/data/SALOME_V4.1.1/GEOM_4.1.1"/>
- <module name="SMESH" path="/data/SALOME_V4.1.1/SMESH_4.1.1"/>
- <module name="YACS" path="/data/SALOME_V4.1.1/YACS_4.1.1"/>
- <module name="VISU" path="/data/SALOME_V4.1.1/VISU_4.1.1"/>
- <module name="HELLO" path="/data/SALOME_V4.1.1/HELLO1_4.1.1"/>
- <module name="PYHELLO" path="/data/SALOME_V4.1.1PYHELLO1_4.1.1"/>
- <module name="NETGENPLUGIN" path="/data/SALOME_V4.1.1/NETGENPLUGIN_4.1.1"/>
+ <!-- attribute gui (defaults = yes) indicates if the module
+ has a gui interface -->
+ <module name="KERNEL" gui="no" path="/data/SALOME_V5/KERNEL_INSTALL"/>
+ <module name="GUI" gui="no" path="/data/SALOME_V5/GUI_5"/>
+ <module name="MED" path="/data/SALOME_V5/MED_5"/>
+ <module name="GEOM" path="/data/SALOME_V5/GEOM_5"/>
+ <module name="SMESH" path="/data/SALOME_V5/SMESH_5"/>
+ <module name="YACS" path="/data/SALOME_V5/YACS_5"/>
+ <module name="VISU" path="/data/SALOME_V5/VISU_5"/>
+ <module name="HELLO" path="/data/SALOME_V5/HELLO1_5"/>
+ <module name="PYHELLO" path="/data/SALOME_V5/PYHELLO1_5"/>
+ <module name="NETGENPLUGIN" path="/data/SALOME_V5/NETGENPLUGIN_5"/>
</modules>
- <samples path="/data/SALOME_V4.1.1/SAMPLES/4.1.1/SAMPLES_SRC"/>
+ <samples path="/data/SALOME_V5/SAMPLES/SAMPLES_SRC"/>
</application>
-Quelques règles à suivre
+Some rules to be followed
------------------------------
-
-Le répertoire d'application doit être créé sur tous les calculateurs qui devront exécuter des composants de cette application.
-La méthode la plus simple est de créer le répertoire d'application en utilisant le même chemin relatif par rapport au
-répertoire HOME sur chaque machine. Si ce n'est pas souhaité, il est possible d'utiliser des chemins différents suivant
-les calculateurs mais il faudra le préciser dans le fichier de configuration CatalogRessources.xml.
-
-Le répertoire d'application contient des scripts pour initialiser les variables d'environnement et faire des exécutions.
-
-L'environnement est initialisé par des scripts placés dans le sous répertoire env.d. Les scripts pour SALOME sont créés
-au moment de la création de l'application mais l'utilisateur peut ajouter ses propres scripts. Il suffit qu'ils aient
-comme suffixe .sh. Ces scripts doivent être installés sur toutes les machines de l'application.
-
-L'application SALOME fournit à l'utilisateur 4 scripts d'exécution :
-
- - **runAppli** lance une session SALOME (à la manière de ${KERNEL_ROOT_DIR}/bin/salome/runSalome).
- - **runSession** permet de se connecter, dans un shell avec un environnement conforme, à une session SALOME lancée
- précédemment. Sans argument, le script ouvre un shell interactif. Avec arguments, il exécute la commande
- fournie dans l'environnement de l'application SALOME.
- - **runConsole** ouvre une console python connectée à la session SALOME courante. Il est également possible d'utiliser
- runSession puis de lancer python.
-
-
-Les fichiers de configuration de l'application sont :
-
- - **SALOMEApp.xml** : ce fichier est semblable au fichier par défaut qui se trouve dans ${GUI_ROOT_DIR}/share/SALOME/resources/gui.
- Il peut être adapté aux besoins de l'utilisateur.
- - **CatalogRessources.xml** : ce fichier décrit tous les calculateurs que l'application peut utiliser. Le fichier initial
- ne contient que la machine locale. L'utilisateur doit ajouter les machines à utiliser. Si on veut utiliser
- des répertoires d'application quelconques sur les différents calculateurs, il faut préciser dans ce fichier
- leur localisation avec l'attribut appliPath::
-
- appliPath="my/specific/path/on/this/computer"
-
+The application directory must be created on all computers on which components of this application are to be executed.
+The simplest method is to create the application directory using the same relative path from the HOME directory on each machine.
+If this is not wanted, then different paths can be used on different computers, but these paths will have to be specified
+in the CatalogRessources.xml configuration file.
+
+The application directory contains scripts to initialize environment variables and to make executions.
+
+The environment is initialized by scripts placed in the env.d sub-directory. Scripts for SALOME are created at
+the time that the application is created but the user can add his own scripts. All that is necessary is that
+they have the .sh suffix. These scripts must be installed on all machines used by the application.
+
+The SALOME application provides the user with 3 execution scripts:
+ - **runAppli** runs a SALOME session (in the same way as ${KERNEL_ROOT_DIR}/bin/Salome/runSalome).
+ - **runSession** connects to a running SALOME session, in a shell with a conforming environment. If there is no argument, the
+ script opens an interactive shell. If there are arguments, it executes the command supplied in the environment of the SALOME application.
+ - **runConsole** opens a python console connected to the current SALOME session. Another option is to use **runSession** and then to run Python.
+
+The application configuration files are:
+ - **SALOMEApp.xml**: this file is similar to the default file located in ${GUI_ROOT_DIR}/share/SALOME/resources/gui.
+ It can be adapted to the user’s needs.
+ - **CatalogResources.xml**: this file describes all computers that the application might use. The initial file only
+ contains the local machine. The user must add the machines to be used. If it is required to use arbitrary
+ application directories on the different computers, their location must be specified in this file using the appliPath attribute::
+
+ appliPath="/my/specific/path/on/this/computer"
+
+Configuring a SALOME application for remote components
+----------------------------------------------------------
+If you have a multi-machine application, it is possible that some modules (and components) are only available on remote
+computers. In this case, you need to configure your application for this situation by using the **update_catalogs.py** script provided by the
+SALOME application.
+
+The first thing to do is to create a file named **CatalogResources.base.xml** that will contain all information about your multi-machine
+configuration.
+
+Example of **CatalogResources.base.xml** file:
+
+.. code-block:: xml
+
+ <!DOCTYPE ResourcesCatalog>
+ <resources>
+ <machine name="res1" hostname="localhost" >
+ <component name="GEOM_Superv" moduleName="GEOM"/>
+ <modules moduleName="YACS"/>
+ </machine>
+
+ <machine name="res2" hostname="computer1" userName="user" protocol="ssh" appliPath="/home/user/SALOME514/appli_V5_1_4" >
+ <modules moduleName="AddComponent"/>
+ </machine>
+ </resources>
+
+In this file, we say that we have 2 resources **res1** and **res2** on localhost and computer1. On the remote machine, we give
+the SALOME application path and we give, for each resource, the list of available components or modules : GEOM_Superv and YACS on localhost
+and AddComponent on computer1.
+
+Starting from this file, the **update_catalogs.py** script gets all remote catalogs, puts them in local directories (remote_catalogs/<resource name>),
+builds an updated **CatalogResource.xml** file and adds a new environment variable (**SALOME_CATALOGS_PATH** in env.d/configRemote.sh) to the
+SALOME application. With these 3 elements the application is now correctly configured for a multi-machine use.
+++ /dev/null
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-#
-# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-# Doxyfile 1.4.2
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-#
-PROJECT_NAME = YACS
-PROJECT_NUMBER = 0.1
-OUTPUT_DIRECTORY = .
-CREATE_SUBDIRS = NO
-OUTPUT_LANGUAGE = English
-USE_WINDOWS_ENCODING = NO
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-ALWAYS_DETAILED_SEC = NO
-INLINE_INHERITED_MEMB = NO
-FULL_PATH_NAMES = YES
-STRIP_FROM_PATH =
-STRIP_FROM_INC_PATH =
-SHORT_NAMES = NO
-JAVADOC_AUTOBRIEF = NO
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP = NO
-INHERIT_DOCS = YES
-DISTRIBUTE_GROUP_DOC = NO
-SEPARATE_MEMBER_PAGES = NO
-TAB_SIZE = 8
-ALIASES =
-OPTIMIZE_OUTPUT_FOR_C = NO
-OPTIMIZE_OUTPUT_JAVA = NO
-SUBGROUPING = YES
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL = YES
-EXTRACT_PRIVATE = YES
-EXTRACT_STATIC = YES
-EXTRACT_LOCAL_CLASSES = YES
-EXTRACT_LOCAL_METHODS = NO
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-HIDE_FRIEND_COMPOUNDS = NO
-HIDE_IN_BODY_DOCS = NO
-INTERNAL_DOCS = NO
-CASE_SENSE_NAMES = YES
-HIDE_SCOPE_NAMES = NO
-SHOW_INCLUDE_FILES = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = YES
-SORT_BRIEF_DOCS = NO
-SORT_BY_SCOPE_NAME = NO
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 30
-SHOW_USED_FILES = YES
-SHOW_DIRECTORIES = YES
-FILE_VERSION_FILTER =
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = NO
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = YES
-WARN_IF_DOC_ERROR = YES
-WARN_NO_PARAMDOC = NO
-WARN_FORMAT = "$file:$line: $text"
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = \
- @top_srcdir@/doc \
- @top_srcdir@/idl \
- @top_srcdir@/src/bases \
- @top_srcdir@/src/engine \
- @top_srcdir@/src/runtime \
- @top_srcdir@/src/yacsloader \
- @top_srcdir@/src/yacsorb \
- @top_srcdir@/src/gui \
- @top_srcdir@/src/hmi \
- @top_srcdir@/src/lineconn2d \
- @top_srcdir@/src/prs \
- @top_srcdir@/src/pyqt
-
-FILE_PATTERNS = *.c \
- *.cc \
- *.cxx \
- *.cpp \
- *.c++ \
- *.py \
- *.d \
- *.java \
- *.ii \
- *.ixx \
- *.ipp \
- *.i++ \
- *.inl \
- *.h \
- *.hh \
- *.hxx \
- *.hpp \
- *.h++ \
- *.idl \
- *.odl \
- *.cs \
- *.php \
- *.php3 \
- *.inc \
- *.m \
- *.mm \
- *.dox \
- *.C \
- *.CC \
- *.C++ \
- *.II \
- *.I++ \
- *.H \
- *.HH \
- *.H++ \
- *.CS \
- *.PHP \
- *.PHP3 \
- *.M \
- *.MM
-RECURSIVE = YES
-EXCLUDE = @top_srcdir@/src/yacsloader/tools
-EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS = */Test/*
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS = *
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH = @top_srcdir@/doc
-INPUT_FILTER =
-FILTER_PATTERNS =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = YES
-INLINE_SOURCES = YES
-STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-VERBATIM_HEADERS = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = YES
-COLS_IN_ALPHA_INDEX = 2
-IGNORE_PREFIX =
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT = html
-HTML_FILE_EXTENSION = .html
-HTML_HEADER = @top_srcdir@/doc/sources/header.html
-HTML_FOOTER = @top_srcdir@/doc/sources/footer.html
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = NO
-CHM_FILE =
-HHC_LOCATION =
-GENERATE_CHI = NO
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = YES
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = NO
-LATEX_OUTPUT = latex
-LATEX_CMD_NAME = latex
-MAKEINDEX_CMD_NAME = makeindex
-COMPACT_LATEX = NO
-PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = NO
-LATEX_HIDE_INDICES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-RTF_OUTPUT = rtf
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = NO
-MAN_OUTPUT = man
-MAN_EXTENSION = .3
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = NO
-XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
-XML_PROGRAMLISTING = YES
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD = NO
-PERLMOD_LATEX = NO
-PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE =
-ALLEXTERNALS = NO
-EXTERNAL_GROUPS = YES
-PERL_PATH = /usr/bin/perl
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = YES
-HIDE_UNDOC_RELATIONS = YES
-HAVE_DOT = NO
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
-GROUP_GRAPHS = YES
-UML_LOOK = NO
-TEMPLATE_RELATIONS = NO
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
-CALL_GRAPH = NO
-GRAPHICAL_HIERARCHY = YES
-DIRECTORY_GRAPH = YES
-DOT_IMAGE_FORMAT = png
-DOT_PATH =
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-MAX_DOT_GRAPH_DEPTH = 1000
-DOT_TRANSPARENT = NO
-DOT_MULTI_TARGETS = NO
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
+++ /dev/null
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-</head>
-<body>
-<hr style="width: 100%; height: 2px;">
-<div style="text-align: center;">Copyright © 2003-2007 CEA, EDF<br>
-</div>
-</body>
-</html>
+++ /dev/null
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>$title</title>
- <link href="tabs.css" rel="stylesheet" type="text/css">
- <link href="doxygen.css" rel="stylesheet" type="text/css">
-</head>
-<hr>
-<center>
-SALOME documentation central
-</center>
-<hr>
-Références
+References
==============
.. [BOOST] Librairies utilitaires Boost (http://www.boost.org), interfaçage C++-python : Boost.Python (http://www.boost.org/libs/python/doc/)
Change 2D representation of a schema
------------------------------------
-The schema consists of several nodes of control and computation types. These nodes have input and output data, stream and control ports. Connecting these ports by links means transferring data from output port to input port of a next node.
+The schema consists of several nodes of control and computation types. These nodes have input and output data, stream and control ports.
+Connecting these ports by links means transferring data from output port to input port of a next node.
-At the current moment YACS GUI for SALOME 4.1 provides the user with two view modes of a schema.
+At the current moment YACS GUI for SALOME provides the user with only one view mode of a schema.
.. _full_view_of_a_schema:
.. image:: images/functionality_list_77.jpg
:align: center
-
.. centered::
**Full view of a schema**
-.. _control_view_of_a_schema:
+Within YACS module the user can zoom-in and zoom-out 2D schema presentation interactively with the mouse,
+fit 2D presentation of a schema into 2D Viewer bounds (**Fit all** operation) and pan content of 2D Viewer (**Panning** operation)
+interactively with the mouse.
+These commands are accessible from :ref:`View Operations toolbar <view_operations_toolbar>`.
-+ **Control view.** Only control links between connected ports are shown. presentation of nodes are simplified in order to show only the name of a node and its input/output gate ports.
+The user can also use the mouse wheel button to zoom in and out and the arrow key for panning.
-.. image:: images/functionality_list_78.jpg
- :align: center
+The user can also zoom inside a composed node by using the **zoom to bloc** command from the node context menu.
+.. image:: images/functionality_list_77a.jpg
+ :align: center
.. centered::
- **Control view of a schema**
-
-
-
-
-
-
-It's worth mentioning about two additional view modes of a schema which is planned to implement in the future version of YACS module.
-
-
+ **A zoom inside loopIter composed node**
-
-+ **Data Flow view.** Only data links between connected ports are shown.
-
-
-+ **Data Stream view.** Only stream links between connected ports are shown.
-
-
-
-
-
-To change the current view mode of the active schema the user should activate Input Panel with the :ref:`pp_for_schema`, choose **Full** or **Control** view mode inside the "View Mode" radio button group and press "Apply" button on the Input Panel. The easier way to change view mode of the active schema is to click **Full View** or **Control View**
-buttons on the :ref:`visualization`.
-
-Within YACS module the user also can zoom-in and zoom-out 2D schema presentation interactively with the mouse, fit 2D presentation of a schema into 2D Viewer bounds ("Fit all" operation) and pan content of 2D Viewer ("Panning" operation) interactively with the mouse. These commands are accessible from :ref:`View Operations toolbar <view_operations_toolbar>`.
+Use **Fit all** operation to go back to full view.
.. _auto-arrange_nodes:
Auto-arrange schema nodes
-------------------------
-It is a very useful operation, because of it simplifies the schema presentation in the schema 2D Viewer and makes it easier for the user perception. This operation is applicable to the whole graph.
-
-The auto-arrange graph nodes operation can be performed with help of **Arrange nodes** command from :ref:`visualization` and is applicable to the active schema (see :ref:`set_active_schema_or_run` section). YACS module arranges graph nodes automatically with help of an algorithm bases
-on the usage of dot algorithm from Graphviz C API library.
+It is a very useful operation, because it simplifies the schema presentation in the schema 2D Viewer and makes it easier for the user perception.
+This operation is applicable to the whole schema (**arrange nodes recursion** command from the schema context menu) or only to some parts
+of the schema (**arrange local nodes** command from a composed node context menu).
.. _rebuild_links:
Rebuild links between nodes
---------------------------
-It is a very useful operation, because of it simplifies the schema presentation in the schema 2D Viewer and makes it easier for the user perception. This operation constructs links in orthogonal mode.
+It is a very useful operation, because it simplifies the schema presentation in the schema 2D Viewer and makes it easier for the user perception.
+This operation constructs links in orthogonal mode.
-The rebuild links between nodes operation can be performed with help of **Rebuild links** command from :ref:`visualization` and is applicable to the active schema (see :ref:`set_active_schema_or_run` section). YACS GUI rebuilds graph links automatically with help of LineConn2D algorithm
-already implemented by OCC.
+The rebuild links between nodes operation is performed automatically when **automatic link** option is activated in the YACS main menu or
+in the toolbar :ref:`edition_toolbar`. To force links computation, use the **compute links** command from the node context menu.
+The user can change the links representation with the options **simplify links** which tries to make the links as direct as possible with
+a slight CPU cost and **separate links** which tries to avoid links superposition with again a CPU cost.
+++ /dev/null
-/*! \page runtime SALOME Runtime
-
-\section toc Table of contents
-
- - \ref runtime_intro
- - \ref runtime_elements
-
-\section runtime_intro Introduction
-
-The runtime package provides implementation of %YACS generic nodes
-for SALOME platform.
-
-
-\section runtime_elements SALOME runtime nodes
-
-The SALOME runtime implements following nodes :
-
- - function inline node in python
- - script inline node in python
- - component service node for SALOME components
- - reference service node for CORBA objects
- - reference service node for script shell with inputs/outputs in XML files
-
-
-\subsection runtime_funcnode Inline function node
-A function inline node is implemented by a Python function.
-
-\subsection runtime_scriptnode Inline script node
-A script inline node is implemented by a Python script.
-
-\subsection runtime_componentnode Component service node
-...
-
-\subsection runtime_corbanode CORBA reference service node
-...
-
-\subsection runtime_xmlnode XML reference service node
-...
-
-*/
-Composant Salomé
+SALOME component
================
-
-
-Principe
---------
-
-Un composant Salomé est un composant CORBA tel que décrit au chapitre
-précédent, utilisant des services du noyau Salomé. Il faut également "déclarer"
-ce composant auprès de Salomé (i.e. fournir ou compléter des fichiers de
-ressources Salomé avec des informations relatives à ce composant). Les
-différentes opérations à effectuer sont :
-
-1. adapter le fichier IDL,
-
-2. déclarer le composant auprès du catalogue de modules de Salomé,
-
-3. modifier la classe d'implémentation (C++ ou python) pour
-
- - suivre l'adaptation du fichier IDL (point 1),
- - permettre la supervision du composant par Salomé, dans les différents services du composant.
- - préparer l'utilisation du service de notification (envoi de messages pour suivre
- le déroulement des calculs dans le composant) - optionel (mais utile),
-
-4. déclarer les éventuelles ressources graphiques.
-
-
-Fichier IDL
+Principle
-----------
+A SALOME component is a CORBA component as described in the previous chapter, using services of the SALOME kernel.
+This component also has to be “declared” to SALOME (i.e. SALOME resource files need to be supplied or completed with
+information about this component). The following operations need to be carried out:
+1. adapt the IDL file
+2. declare the component to the SALOME modules catalog
+3. modify the implementation class (C++ or python) to
-Principe
-^^^^^^^^
-
-La description IDL est semblable à celle d'un composant CORBA standard avec les
-particularités :
-
-* le composant doit faire partie du module (CORBA) de base ``Engines``,
-
-* le composant doit hériter du composant de base de Salomé :
- ``Engines::Component`` (défini dans le fichier IDL ``"SALOME_Component.idl"``),
-
-* les services du composant peuvent avoir des paramètres ``in``, ``out``
- et/ou une valeur de retour, mais pas de paramètres ``inout``.
+ - monitor adaptation of the IDL file (point 1)
+ - enable supervision of the component by SALOME, in the different component services
+ - prepare use of the notification service (send messages to monitor execution of calculations in the component) – optional (but useful)
+4. Declare any graphic resources
-**Remarques**
-
- #. Le module ``Engines`` regroupe tous les composants de Salomé, autres que les
- composants centraux de Salomé.
+IDL file
+-----------
+Principle
+^^^^^^^^^^^^
+The IDL description is similar to the description of a standard CORBA component with the following special features:
- #. Le composant de base ``Engines::Component`` permet de ne pas devoir
- redéfinir pour chaque composant ajouté au système, les services communs (arrêt,
- reprise, etc.).
+- the component must form part of the basic ``Engines`` module (CORBA)
+- the component must inherit from the SALOME basic component: ``Engines::EngineComponent`` (defined in the IDL ``“SALOME_Component.idl”`` file)
+- the services of the component may have ``in``, ``out`` parameters and /or a return value, but no ``inout`` parameters.
- #. Ceci n'est pas une limitation, un paramètre ``inout`` peut se découpler en
- un paramètre ``in`` et un paramètre ``out`` (de toute façon, c'est sous cette
- forme que le verront les clients python).
+**Notes**
+#. The ``Engines`` module includes all SALOME components other than the SALOME central components
+#. The ``Engines::EngineComponent`` basic component avoids the need to redefine common services (stop, restart, etc.) for each
+ component added to the system
+#. This is not a limitation, an ``inout`` parameter can be decoupled into an ``in`` parameter and an ``out``
+ parameter (in any case, this is the form in which python clients will see it).
-Exemple 9 (début)
+Example 9 (start)
^^^^^^^^^^^^^^^^^
-
-Reprenons le fichier IDL ``alglin.idl`` et adaptons-le :
-
+We will reuse the ``alglin.idl`` file and adapt it:
``alglin.idl``
.. include:: ./exemples/exemple9/alglin.idl
:literal:
-**Remarque**
- Il faut faire attention quand on définit des structures dans l'IDL (comme la
- structure ``vecteur`` dans ``alglin.idl``). Le nom choisi ``vecteur`` risque
- d'être déjà "réservé" par un autre composant Salomé.
-
-
-Exemple 10 (début)
+**Note**
+ It is important to take care when structures are defined in the IDL (like the ``vecteur`` structure in ``algin.idl``).
+ The chosen name ``vecteur`` might be “reserved” by another SALOME component.
+
+Example 10 (start)
^^^^^^^^^^^^^^^^^^
-
-Des modifications analogues sont effectuées sur le fichier IDL ``FreeFem.idl`` :
-
+Similar modifications are made on the IDL ``FreeFem.idl`` file:
``FreeFem.idl``
:literal:
-Inscription au catalogue de modules
------------------------------------
-
-Pour être utilisables dans Salomé, les composants doivent s'inscrire auprès de
-l'un des catalogues de modules de Salomé. Ce catalogue est réparti entre
-plusieurs fichiers (catalogue général, catalogue utilisateur). On supposera
-que le composant sera déclaré dans le catalogue personnel d'un utilisateur.
-Le fichier de catalogue de composants est un fichier XML qui contient
-
-#. la liste des services du composant et leurs paramètres,
-
-#. la (les) machine(s) où le composant peut être chargé en mémoire, le nom du
- fichier contenant l'icone du composant, des informations de version,
- commentaires, service par défaut, etc (ces informations sont optionelles).
+Registration into the modules catalog
+--------------------------------------------
+Before they can be used in SALOME, components must be registered in one of the SALOME modules catalogs. This catalog is
+distributed in several files (general catalog, user catalog). It will be assumed that the component will be declared in
+a user's personal catalog. The component catalog file is an XML file that contains:
-On peut compléter à la main ce catalogue ou utiliser un utilitaire fourni par
-Salomé qui génère les informations du point 1 ci-dessus (il faudra malgré tout
-éditer le fichier pour entrer les informations du point 2). Cet outil est
-disponible dans l'interface graphique Salomé (menu ``Tools->Catalog Generator``)
-en indiquant le nom du catalogue (fichier XML) et le nom du fichier IDL du
-composant.
+#. the list of services of the component and their parameters
+#. the name of the file containing the icon of the component, version information, comments, default service, etc. (this information is optional).
+This catalog can be completed by hand or a utility supplied by SALOME can be used that generates information in
+point 1 above (nevertheless, this file must be edited to enter information in point 2). This tool is available in
+the SALOME graphic interface (``Tools->Catalog Generator`` menu) indicating the name of the catalog (XML file) and
+the name of the IDL file of the component.
-Classe d'implémentation C++
+C++ implementation class
---------------------------
+**In this section, it will be assumed that the IDL file defines a CORBA class: A and that the C++ implementation class A_impl will be used.**
-**On supposera dans ce paragraphe, que le fichier IDL définit une classe CORBA :
-A et qu'on utilisera la classe d'implémentation C++ : A_impl.**
-
-
-Mise en conformité avec l'IDL du composant
+Making conforming with the component IDL
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Proceed as follows to adapt the standard CORBA / C++ implementation classes (as seen in the previous chapter):
-Pour adapter les classes d'implémentation CORBA/C++ standards (telles que vues
-au chapitre précédent), il faut :
-
-#. insérer le fichier ``SALOMEconfig.h`` : ::
+#. Insert the ``SALOMEconfig.h`` file that contains a number of useful definitions to make the code of the implementation
+ class independent from the CORBA version used::
- #include <SALOMEconfig.h>
+ #include <SALOMEconfig.h>
- Le fichier ``SALOMEconfig.h`` contient un certain nombre de définitions utiles
- pour assurer l'indépendance du code de la classe d'implémentation par rapport à
- la version de CORBA utilisée.
+#. then insert the ``SALOME_Component_i.hxx`` file that contains the interface of the C++ implementation class of the SALOME basic component::
-#. insérer ensuite le fichier ``SALOME_Component_i.hxx`` ::
+ #include "SALOME_Component_i.hxx"
- #include "SALOME_Component_i.hxx"
+#. for the CORBA class that is implemented, add the following line::
- qui contient l'interface de la classe d'implémentation C++ du composant de base
- de Salomé
+ #include CORBA_SERVER_HEADER(A)
-#. pour la classe CORBA qui est implémentée, ajouter la ligne : ::
+ ``CORBA_SERVER_HEADER`` is a macro defined in ``SALOMEconfig.h`` that makes CORBA inclusion file names independent
+ from the CORBA implementation used.
- #include CORBA_SERVER_HEADER(A)
+#. for each CORBA class used in the implementation class, add the following line::
- ``CORBA_SERVER_HEADER`` est une macro définie dans ``SALOMEconfig.h`` et qui
- assure l'indépendance des noms de fichiers d'inclusion CORBA par rapport à
- l'implémentation de CORBA utilisée.
+ #include CORBA_CLIENT_HEADER(<CORBA class name>)
-#. pour chaque classe CORBA qui est utilisée dans la classe d'implémentation,
- ajouter la ligne : ::
+ ``CORBA_CLIENT_HEADER`` is a macro defined in ``SALOMEconfig.h`` that makes CORBA inclusion file names independent
+ from the CORBA implementation used.
- #include CORBA_CLIENT_HEADER(<nom de la classe CORBA>)
-
- ``CORBA_CLIENT_HEADER`` est une macro définie dans ``SALOMEconfig.h`` et qui
- assure l'indépendance des noms de fichiers d'inclusion CORBA par rapport à
- l'implémentation de CORBA utilisée.
-
-#. faire dériver la classe d'implémentation de celle du composant Salome de
- base : ::
+#. derive the implementation class from the class of the basic SALOME component::
class A_impl :
public POA_Engines::A,
public Engines_Component_i {
-#. définir le (seul) constructeur de la façon suivante dans le fichier d'entête
- C++ (.hxx) : ::
+#. define the (sole) constructor as follows in the C++ header file (.hxx)::
A_impl(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
const char *instanceName,
const char *interfaceName);
- et dans le fichier d'implémentation C++ (.cxx) : ::
+ and in the C++ implementation file (.cxx)::
A_impl:: A_impl
(CORBA::ORB_ptr orb,
_id = _poa->activate_object(_thisObj);
}
- Ce constructeur sera éventuellement responsable de la création et de
- l'initialisation de l'objet interne associé au composant CORBA.
+ This constructor may possibly be responsible for creation and initialisation of the internal object associated with the CORBA component.
-#. si des structures sont définies par le fichier IDL dans le module Engines,
- adapter les déclarations des méthodes de la classe d'implémentation.
-
-L'exemple ci-dessus illustre les modifications effectuées sur l'exemple 6.
+#. If structures are defined by the IDL file in the Engines module, adapt declarations of the implementation class methods.
+The above example illustrates the modifications made on example 6.
+
.. _remsuper:
-
-Permettre la supervision du composant
+Enable component supervision
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+The following needs to be inserted in each service of the component (i.e. in each method of the implementation class
+called during a CORBA request), before the component can be controlled from supervision.
-Pour pouvoir piloter le composant depuis la supervision, il faut insérer dans
-chaque service du composant (i.e. dans chaque méthode de la classe
-d'implémentation qui est appelée lors d'une requète CORBA),
-
-* au début, l'instruction : ::
+- at the beginning, the instruction::
beginService(<nom du service>);
-* à la fin, l'instruction : ::
+- at the end, the instruction::
endService(<nom du service>);
-Ces deux instructions signalent à la supervision de Salomé que le service du
-composant a bien reçu la requète CORBA (beginService) et que l'exécution du
-service s'est bien terminée (endService).
+These two instructions notify the SALOME supervision that the component service has actually received the CORBA request (beginService)
+and that execution of the service has actually terminated (endService).
-**Remarque**
- Mettre beginService et endService
- dans les méthodes de la classe d'implémentation d'un composant déclare à Salomé
- que le composant est "supervisable". Ce n'est pas une assurance que l'on pourra
- utiliser ce composant sans précautions dans le cas où le composant possède un
- état interne modifié par un ou plusieurs services.
-
- **Exemple**
- On considère un composant ayant une variable interne ``Quantite`` et deux services :
+**Note**
+ Put beginService and endService in the methods of the implementation class of a component declares to SALOME that the component
+ is "supervisable”. This is not an assurance that this component can be used without precautions in the case in which the
+ component has an internal state modified by one or more services.
- * ``S1(x) : Quantite = Quantite + x;`` retourne ``Quantite`` et
+ **Example**:
+ Consider a component with an internal variable ``Quantity`` and two services:
- * ``S2(x) : Quantite = Quantite * x;`` retourne ``Quantite``.
+ * ``S1(x): Quantity = Quantity + x;`` returns ``Quantity`` and
+ * ``S2(x) : Quantity = Quantity * x ;`` returns ``Quantity``.
- Il n'est pas possible *a priori* de connaître la valeur de ``Quantite`` après
- exécution du graphe de calcul sur la figure suivante.
+ *A priori*, it is impossible to know the value of ``Quantity`` after the calculation graph on the following figure has been executed.
.. _figpara:
.. image:: images/parallele.png
- :width: 26ex
:align: center
.. centered::
- Graphe de calcul contenant des branches parallèles
+ Calculation graph containing parallel branches
-Utilisation de la notification
+Using the notification
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Pour signaler l'utilisation de la notification (qui provoquera l'ouverture
-d'une connexion à un canal d'événements), il faut modifier le constructeur de
-la classe d'implémentation comme suit : ::
+The constructor of the implementation class must be modified as follows, so as to signal use of the notification (that will
+cause opening of a connection to an events channel)::
A_impl:: A_impl
(CORBA::ORB_ptr orb,
_id = _poa->activate_object(_thisObj);
}
-où on a ajouté le paramètre "1" à la fin de l'appel du constructeur de
-``Engines_Component_i``. Le composant pourra ensuite utiliser l'instruction
-::
+in which the parameter “1” has been added to the end of the call to the ``Engines_Component_i`` of the constructor.
+The component can then use the instruction::
void sendMessage(const char *event_type, const char *message);
-pour envoyer des messages indiquant le déroulement du calcul ou une situation
-anormale, etc. Ces messages seront visibles de l'utilisateur de Salomé. Le
-premier paramètre indique le type de message ("warning", "step", "trace",
-"verbose"), le second paramètre, le contenu (chaîne de caractères) du message.
-
+to send messages indicating progress with the calculation or an abnormal situation, etc. These messages will be visible to the
+SALOME user. The first parameter indicates the message type (“warning”, “step”, “trace”, “verbose”), and the second parameter
+indicates the message contents (character string).
-Connexion à l'objet "fabrique" d'un conteneur
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Afin de permettre le chargement et l'initialisation d'un composant par un
-conteneur, il faut fournir une fonction C dont le nom et le code sont imposés :
-::
+Connection to the “factory” object of a container
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+A “C” function has to be provided with an imposed name and code, for a component to be loaded and initialised by a container::
extern "C"
{
}
}
-``<nom du composant>`` (ou nom de la classe CORBA, ``A`` ici) et ``<classe
-d'implementation>`` (``A_impl`` ici) sont spécifiques à chaque composant.
-Cette fonction est appelée par le conteneur lors du chargement d'un composant.
-Elle crée un objet CORBA qui réceptionnera les requètes au composant et les
-transmettra au différents services du composant.
-
-
-Exemple 9 (suite)
-^^^^^^^^^^^^^^^^^
-
-Reprenons les fichiers d'implémentation ``alglin_i.hxx`` et ``alglin_i.cxx``
-et adaptons-les :
+``<component name>`` (or CORBA class name, ``A`` in this case) and ``<implementation class>`` (``A_impl`` here) are specific
+to each component. This function is called by the container when a component is loaded. It creates a CORBA object that
+will receive requests to the component and will forward them to the different services of the component.
+Example 9 (continued)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+We will use the implementation files ``algin_i.hxx`` and ``algin_i.cxx`` again and adapt them:
``alglin_i.hxx``
.. include:: ./exemples/exemple9/alglin_i.cxx
:literal:
-
-Classe d'implémentation python
+Python implementation class
------------------------------
+**In this section, it is assumed that the IDL file defines a CORBA class: B and that we will use the python implementation class: B.**
-**On supposera dans ce paragraphe, que le fichier IDL définit une classe CORBA :
-B et qu'on utilisera la classe d'implémentation python : B.** La démarche
-est analogue au cas de l'interface serveur C++ :
-
+The procedure is similar to the case of the C++ server interface:
-Mise en conformité avec l'IDL du composant
+Making conforming with the component IDL
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#. importer la classe du composant de base : ::
+#. import the class of the basic component::
from SALOME_ComponentPy import *
-#. faire dériver la classe d'implémentation de celle du composant Salome de
- base : ::
+#. derive the implementation class from the class of the basic SALOME component::
class B(Engines__POA.B,
SALOME_ComponentPy_i):
-#. le constructeur de la classe d'implémentation doit débuter par : ::
+#. The constructor of the implementation class must begin by::
def __init__(self, orb, poa, this, containerName,
instanceName, interfaceName):
containerName, instanceName,
interfaceName, 0)
-
-Permettre la supervision du composant
+Enable supervision of the component
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Before the component can be controlled from supervision, the following have to be inserted in each service of the
+component (i.e. in each method of the implementation class called during a CORBA request).
-Pour pouvoir piloter le composant depuis la supervision, il faut insérer dans
-chaque service du composant (i.e. dans chaque méthode de la classe
-d'implémentation qui est appelée lors d'une requète CORBA),
-
-* au début, l'instruction : ::
+* at the beginning, the instruction::
- beginService(<nom du service>);
+ beginService(<service name>);
-* à la fin, l'instruction : ::
+* at the end, the instruction::
- endService(<nom du service>);
+ endService(<service name>);
-Ces deux instructions signalent à la supervision de Salomé que le service du
-composant a bien reçu la requète CORBA (beginService) et que l'exécution du
-service s'est bien terminée (endService). Même remarque que dans le cas C++
-(:ref:`remsuper`)
+These two instructions notify the SALOME supervision that the component service has actually received the CORBA
+request (beginService) and that execution of the service has actually terminated (endService).
+Same comment as in the C++ case (:ref:`remsuper`).
-
-Utilisation de la notification
+Using the notification
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Pour signaler l'utilisation de la notification, il faut modifier le
-constructeur de la classe d'implémentation comme suit : ::
+The implementation class constructor should be modified as follows to signal use of the notification::
def __init__(self, orb, poa, this, containerName,
instanceName, interfaceName):
containerName, instanceName,
interfaceName, 1)
-où on a ajouté le paramètre "1" à la fin de l'appel du constructeur de
-``SALOME_ComponentPy_i``. Le composant pourra ensuite utiliser l'instruction
-::
+in which the parameter “1” is added to the end of the call to the ``SALOME_ComponentPy_i`` of the constructor.
+The component can then use the following instruction::
sendMessage(event_type, message);
-pour envoyer des messages indiquant le déroulement du calcul ou une situation
-anormale, etc. Ces messages seront visibles de l'utilisateur de Salomé. Le
-premier paramètre indique le type de message ("warning", "step", "trace",
-"verbose"), le second paramètre, le contenu (chaîne de caractères) du message.
+to send messages providing information about progress with the calculation or an abnormal situation, etc.
+These messages will be visible to the SALOME user. The first parameter indicates the message
+type (“warning”, “step”, “trace”, “verbose”), and the second parameter indicates the message contents (character string).
-Exemple 10 (suite)
-^^^^^^^^^^^^^^^^^^
-
-Reprenons le fichier d'implémentation ``FreeFem.py`` et adaptons le :
-
+Example 10 (continued)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Consider the ``FreeFem.py`` implementation file and adapt it:
``FreeFemComponent.py``
:literal:
-Utilisation de l'environnement de compilation et d'exécution de Salomé
+Using the SALOME compilation and execution environment
-----------------------------------------------------------------------
+Autotools like SALOME will be used.
-On utilisera les autotools comme Salomé.
-
-Utilisation des structures de données fournies par Salomé ou renvoyées par le composant
+Using data structures provided by SALOME or returned by the component
---------------------------------------------------------------------------------------
+This part will be done with reference to CORBA [CORBA]_ specifications, and particularly IDL specifications – languages [LANG]_
+or the different CORBA manuals, for example [HENVIN]_ (C++) and [PyCorba]_ (python).
-Pour cette partie, on se référera aux spécifications CORBA [CORBA]_, et en
-particulier les spécifications IDL - langages [LANG]_ ou aux différents
-manuels CORBA, par exemple [HENVIN]_ (C++) et [PyCorba]_ (python).
-
-
-Maillages et champs MED
+Meshes and MED fields
^^^^^^^^^^^^^^^^^^^^^^^
-
-Pour cette partie, on se réfèrera à la documentation de MED et MEDMemory
-[MEDDoc]_ et [MEDMemory]_.
+This part will be done with reference to MED and MEDMemory documentation [MEDDoc]_ and [MEDMemory]_.
.. _schemapy:
-Définition d'un schéma de calcul avec l'interface de programmation Python
+Defining a calculation scheme with the Python programming interface
============================================================================
-Un schéma de calcul YACS peut être défini à partir d'un programme écrit en langage Python (http://www.python.org/).
-Pour une initiation au langage, on consultera le `tutorial Python <http://docs.python.org/tut/tut.html>`_.
+A YACS calculation scheme can be defined from a program written in the Python language (http://www.python.org/).
+Refer to the `Python tutorial <http://docs.python.org/tut/tut.html>`_ for an introduction to the language.
-L'interface de programmation (API) est portée par trois modules Python : pilot, SALOMERuntime et loader.
+The programming interface (API) is carried on three Python modules: pilot, SALOMERuntime and loader.
-Le module SALOMERuntime sert pour initialiser YACS pour SALOME.
+The SALOMERuntime module is used to initialise YACS for SALOME.
-Le module loader sert pour créer des schémas de calcul en chargeant des fichiers au format XML.
+The loader module is used to create calculation schemes by loading files in the XML format.
-Le module pilot est celui qui sert à créer des schémas de calcul.
+The pilot module is used to create calculation schemes.
-Ces modules doivent être importés au début du programme Python et YACS doit être initialisé::
+These modules must be imported at the beginning of the Python program and YACS must be initialised::
import sys
import pilot
import loader
SALOMERuntime.RuntimeSALOME_setRuntime()
-Pour pouvoir importer les modules YACS, l'environnement doit être correctement configuré ce qui est le
-cas si on utilise l'application SALOME. Sinon, il faut positionner la variable d'environnement PYTHONPATH
-à <YACS_ROOT_DIR>/lib/lib/pythonX.Y/site-packages/salome.
+Before YACS modules can be imported, the environment must be correctly configured, as it will be if the
+SALOME application is used. Otherwise, the PYTHONPATH environment variable has to be set to
+<YACS_ROOT_DIR>/lib/pythonX.Y/site-packages/salome.
.. _loadxml:
-Créer un schéma de calcul par chargement d'un fichier XML
+Create a calculation scheme by loading an XML file
--------------------------------------------------------------
-C'est la façon la plus simple de créer un schéma de calcul. Si on a un fichier conforme à la syntaxe YACS
-(voir :ref:`schemaxml`), il suffit de créer un chargeur de fichier XML puis d'utiliser sa méthode load
-pour obtenir un objet schéma de calcul en Python.
+This is the easiest way of creating a calculation scheme. If there is a file conforming with the YACS syntax (see :ref:`schemaxml`),
+then all that is necessary is to create an XML file loader and then to use its load method to obtain a calculation scheme object in Python.
-Voici le code Python suffisant pour charger un fichier XML::
+The following shows the sufficient Python code to load an XML file::
xmlLoader = loader.YACSLoader()
try:
print "IO exception:",ex
sys.exit(1)
-Ensuite, si on met dans un fichier de nom testLoader.py le code de l'initialisation et le code
-du chargement, il suffit de faire::
-
+Then, if the initialisation code and the loading code are put into a file named testLoader.py, proceed as follows::
+
python testLoader.py
-pour exécuter le programme. L'exception IOError peut être levée par l'opération de chargement
-principalement si le fichier n'existe pas ou ne peut pas être lu.
-Dans le cas où aucune exception n'a été levé, il faut vérifier que l'analyse du fichier s'est
-bien passée. Ceci est fait en utilisant l'objet Logger associé au schéma de calcul::
+to execute the program. The IOError exception can be raised by the loading operation principally if the file does not exist
+or if it cannot be read. If no exception has been raised, it is necessary to make sure that the file analysis took place correctly.
+This is done using the Logger object associated with the calculation scheme::
logger=p.getLogger("parser")
if not logger.isEmpty():
print logger.getStr()
sys.exit(1)
-Enfin, si l'analyse du fichier s'est bien passée, il faut vérifier la validité du schéma (complétude
-des connexions, pas de port d'entrée non connecté, ...). On utilise pour celà la méthode isValid de
-l'objet schéma de calcul puis la méthode p.checkConsistency de ce même objet comme ci-dessous::
+Finally, if the file analysis took place correctly, the validity of the scheme (completeness of connections, no unconnected
+input port, etc.) has to be checked. This is done using the isValid method of the calculation scheme object, and
+then the p.checkConsistency method of this object as below::
if not p.isValid():
print "The schema is not valid and can not be executed"
sys.exit(1)
-Si tous ces tests se sont bien passés, le schéma est prêt à être exécuté (voir :ref:`execpy`).
-
-Créer un schéma de calcul de zéro
------------------------------------
-On suivra ici la même progression que dans :ref:`schemaxml`.
+If all these tests took place correctly, the scheme is ready to be executed (see :ref:`execpy`).
-La première chose à faire avant de créer les objets constitutifs du schéma est d'obtenir
-l'objet runtime qui va servir pour leur création::
+Create a calculation scheme from scratch
+-------------------------------------------
+We will use the same sequence as in :ref:`schemaxml`.
+The first step is to obtain the runtime object that will be used for creation of objects making up the scheme, before they are created::
r = pilot.getRuntime()
-Création d'un schéma vide
+Creating an empty scheme
''''''''''''''''''''''''''''
-On l'obtient par en utilisant la méthode createProc de l'objet runtime avec le nom
-du schéma en argument::
-
+An empty scheme is obtained using the createProc method of the runtime object with the name of the scheme as an argument::
+
p=r.createProc("pr")
-L'objet schéma de nom "pr" a été créé. Il est représenté par l'objet Python p.
+The scheme object named “pr” was created. It is represented by the Python variable p.
-Définition des types de données
+Definition of data types
'''''''''''''''''''''''''''''''''
-Types de base
-++++++++++++++++
-On ne peut définir de type de base. Ils sont définis par YACS. Il faut cependant pouvoir
-récupérer un objet Python équivalent à un type de base pour pouvoir créer par la suite des
-ports.
-On récupère un type de données de base en utilisant la méthode getTypeCode du schéma de calcul
-avec le nom du type en argument. Par exemple::
+.. _basictypes:
+
+Basic types
+++++++++++++++++
+A basic type cannot be defined. These types are defined by YACS. However, it must be possible to retrieve a Python object
+equivalent to a basic type so as to be able to subsequently create ports.
+
+A basic data type is recovered using the getTypeCode method in the calculation scheme with the name of the type as an argument.
+For example::
td=p.getTypeCode("double")
-permet d'obtenir le type double (objet Python td).
-Les autres types de base s'obtiennent par::
+will obtain a double type (Python td object). Other basic types are obtained by::
ti=p.getTypeCode("int")
ts=p.getTypeCode("string")
tb=p.getTypeCode("bool")
tf=p.getTypeCode("file")
-
-Référence d'objet
+Object reference
+++++++++++++++++++++
-Pour définir un type référence d'objet, on utilise la méthode createInterfaceTc du schéma de calcul. Cette méthode
-prend trois arguments : le repository id de l'objet SALOME correspondant, le nom du type, une liste de types
-qui seront des types de base de ce type. Si le repository id vaut "", la valeur par défaut sera utilisée.
+The createInterfaceTc method in the calculation scheme is used to define an object reference type.
+This method accepts three arguments: the repository id of the corresponding SALOME object, the name of the type, and a
+list of types that will be basic types of this type. If the repository id is equal to “”, the default value will be used.
-Voici un exemple minimal de définition de référence d'objet de nom Obj (repository id par défaut, pas de type de base)::
+The following is a minimal example for a reference definition of an object name Obj (default repository id, no basic type)::
tc1=p.createInterfaceTc("","Obj",[])
-On peut définir le même type Obj, en donnant le repository id::
+The same Obj type can be defined giving the repository id::
tc1=p.createInterfaceTc("IDL:GEOM/GEOM_Object","Obj",[])
-Pour définir un type référence d'objet dérivé d'un autre type, on fournit en plus une liste de types de base.
+A list of basic types is also provided so as to define a reference object type derived from another type.
-Voici la définition du type MyObj dérivé du type Obj::
+The following gives a definition of the MyObj type derived from the Obj type::
tc2=p.createInterfaceTc("","MyObj",[tc1])
-Séquence
-+++++++++++
-Pour définir un type séquence, on utilise la méthode createSequenceTc du schéma de calcul. Cette méthode
-prend trois arguments : le repository id, le nom du type, le type des éléments de la séquence. Il n'est
-généralement pas utile de spécifier le repository id. On donnera la valeur "".
+Sequence
++++++++++++++++++++++
+The createSequenceTc method in the calculation scheme is used to define a sequence type.
+This method accepts three arguments, namely the repository id, the type name, and the type of elements in the sequence.
+There is generally no point in specifying the repository id. The value “” will be given.
-Voici un exemple de définition du type séquence de double seqdbl::
+The following gives an example definition of the seqdbl double sequence type::
tc3=p.createSequenceTc("","seqdbl",td)
-td est le type double que l'on obtiendra comme ci-dessus : `Types de base`_.
+td is the double type that is obtained as above in the section on :ref:`basictypes`.
-Pour définir un type séquence de séquence, on écrit::
+A sequence type of sequence is defined as follows::
tc4=p.createSequenceTc("","seqseqdbl",tc3)
-Pour définir un type séquence de référence, on écrit::
+A reference sequence type is defined as follows::
tc5=p.createSequenceTc("","seqobj",tc1)
-
Structure
++++++++++++
-Pour définir un type structure, on utilise la méthode createStructTc du schéma de calcul. Cette méthode
-prend deux arguments : le repository id, le nom du type. Pour une utilisation standard, le repository
-id prendra la valeur "". Le type structure est le seul qui se définit en deux étapes. Il est créé
-vide suite à l'appel de la méthode createStructTc. Pour définir ses membres, il faut ensuite
+A structure type is defined using the createStructTc method in the calculation scheme.
+This method accepts two arguments, namely the repository id and the type name. For standard use, the repository id is
+equal to the value “”. The structure type is the only type that is defined in two steps. It is created empty after
+calling the createStructTc method. Its members are then defined by adding them with the addMember method.
-Voici un exemple de définition du type structure s1 avec 2 membres (m1 et m2) de types double et séquence de doubles::
+The following shows an example definition of an s1 type structure with 2 members (m1 and m2) of the double and double sequence types::
ts1=p.createStructTc("","s1")
- ts1.addMember("m1",td);
- ts1.addMember("m2",tc3);
+ ts1.addMember("m1",td)
+ ts1.addMember("m2",tc3)
-Récupérer les types prédéfinis
+Retrieve predefined types
+++++++++++++++++++++++++++++++++
-Par défaut, YACS définit seulement les types de base. Pour obtenir plus de types prédéfinis, il faut
-les demander à SALOME. Ces autres types prédéfinis sont contenus dans les catalogues des modules
-comme GEOM ou SMESH.
+By default, YACS only defines the basic types. If more predefined types are required, they must be requested from SALOME.
+These other predefined types are contained in module catalogs such as GEOM or SMESH.
-La séquence de code qui permet d'obtenir une image des catalogues SALOME dans YACS est la suivante::
+The following code sequence is used to obtain an image of SALOME catalogs in YACS::
try:
- cata=r.loadCatalog("session","corbaname::localhost:2810/NameService#Kernel.dir/ModulCatalog.object")
+ cata=r.loadCatalog("session",
+ "corbaname::localhost:2810/NameService#Kernel.dir/ModulCatalog.object")
except CORBA.TRANSIENT,ex:
print "Unable to contact server:",ex
except CORBA.SystemException,ex:
print ex,CORBA.id(ex)
-Il faut que l'application SALOME ait été lancée pour que le catalogue soit accessible.
-Ensuite, les types prédéfinis sont accessibles dans le dictionnaire cata._typeMap.
-Si on connait le nom du type voulu ('GEOM_Shape', par exemple), on l'obtient par::
+The SALOME application must be running before the catalog is accessible.
+Predefined types are then accessible in the cata._typeMap dictionary.
+If the name of the required type is known (for example ‘GEOM_Shape’), it is obtained as follows::
tgeom=cata._typeMap['GEOM_Shape']
.. _typedict:
-Ajouter un type dans le dictionnaire des types du schéma
+Add a type into the scheme types dictionary
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Certaines opérations nécessitent d'avoir les types définis dans le dictionnaire du schéma.
-Pour mettre un type dans le dictionnaire, on fait, par exemple pour le type seqobj défini ci-dessus::
+Some operations require that types are defined in the scheme dictionary. Proceed as follows if you want to add a type
+into the dictionary, for example for the seqobj type defined above::
p.typeMap["seqobj"]=tc5
-avec le nom du type comme clé du dictionnaire et le type comme valeur.
+where the type name is the dictionary key and the type is the value.
-Définition des noeuds de calcul élémentaires
+Definition of elementary calculation nodes
''''''''''''''''''''''''''''''''''''''''''''''
-Noeud script Python
+
+.. _pyscript:
+
+Python script node
+++++++++++++++++++++
-Pour définir un noeud script dans un contexte donné (le schéma de calcul, par exemple), on
-procède en plusieurs étapes.
-La première étape consiste à créer l'objet noeud par appel à la méthode createScriptNode du runtime.
-Cette méthode a 2 arguments dont le premier doit valoir "" en utilisation standard et le deuxième
-est le nom du noeud. Voici un exemple de création du noeud node1::
+Several steps are used to define a script node in a given context (for example the calculation scheme).
+The first step consists of creating the node object by calling the runtime createScriptNode method.
+This method uses 2 arguments, the first of which in standard use must be equal to “” and the second is the node name.
+The following is an example to create node node1::
n=r.createScriptNode("","node1")
-
-La deuxième étape consiste à rattacher le noeud à son contexte de définition par appel à la méthode
-edAddChild de l'objet contexte. Cette méthode a un argument : le noeud à rattacher. Voici un exemple
-de rattachement du noeud node1 au schéma de calcul::
+
+The second step consists of attaching the node to its definition context by calling the edAddChild method for the context object.
+This method has one argument, namely the node to be attached. The following is an example of the attachment of the node node1
+to the calculation scheme::
p.edAddChild(n)
-Attention, le nom de la méthode à utiliser dépend du type de noeud contexte. On verra plus tard pour d'autres
-types de noeud quelle méthode utiliser.
+Warning: the name of the method to be used depends on the type of context node. We will see which method should be used for other
+node types later.
-La troisième étape consiste à définir le script Python associé au noeud. On utilise pour celà la méthode setScript
-du noeud avec un argument chaine de caractères qui contient le code Python. Voici un exemple de définition
-du code associé::
+The third step consists of defining the Python script associated with the node. This is done using the setScript method for the node
+with a character string argument that contains the Python code. The following shows an example definition of the associated code::
n.setScript("p1=p1+2.5")
-La quatrième étape consiste à définir les ports de données d'entrée et de sortie. Un port d'entrée est créé par appel
-à la méthode edAddInputPort du noeud. Un port de sortie est créé par appel à la méthode edAddOutputPort du noeud.
-Ces deux méthodes ont deux arguments : le nom du port et le type de données du port. Voici un exemple de création
-d'un port d'entrée p1 de type double et d'un port de sortie p1 de type double::
+The fourth step consists of defining input and output data ports. An input port is created by calling the edAddInputPort method
+for the node. An output port is created by calling the edAddOutputPort method for the node.
+These two methods have two arguments: the port name and the port data type. The following is an example creating a double
+type input port p1 and a double type output port p1::
n.edAddInputPort("p1",td)
n.edAddOutputPort("p1",td)
-Maintenant notre noeud est complètement défini avec son nom, son script, ses ports et son contexte. Il récupère
-un double dans le port d'entrée p1, lui ajoute 2.5 et met le résultat dans le port de sortie p1.
+Our node is now fully defined with its name, script, ports and context. It retrieves the double in the input port p1, adds 2.5 to it
+and puts the result into the output port p1.
+
+If you want to execute your script node on a remote container, you have to set the execution mode of the node to **remote**
+and to assign a container (see :ref:`py_container` to define a container) to the node as in the following example::
+
+ n.setExecutionMode("remote")
+ n.setContainer(cont1)
-Noeud fonction Python
+.. _pyfunc:
+
+Python function node
++++++++++++++++++++++
-Pour définir un noeud fonction, on procède de la même manière. Les seules différences concernent la création :
-utiliser la méthode createFuncNode et la définition de la fonction : il faut en plus appeler la méthode setFname
-pour donner le nom de la fonction à exécuter. Voici un exemple complet de définition d'un noeud fonction
-qui est fonctionnellement identique au noeud script précédent::
+The same procedure is used to define a function node. The only differences apply to creation, in using the createFuncNode
+method and defining the function: the setFname method must also be called to give the name of the function to be executed.
+The following is a complete example for the definition of a function node that is functionally identical to the previous script node::
n2=r.createFuncNode("","node2")
p.edAddChild(n2)
n2.edAddInputPort("p1",td)
n2.edAddOutputPort("p1",td)
+If you want to execute your function node on a remote container, you have to set the execution mode of the node to **remote**
+and to assign a container (see :ref:`py_container` to define a container) to the node as in the following example::
+
+ n2.setExecutionMode("remote")
+ n2.setContainer(cont1)
+
+.. _pyservice:
-Noeud de service SALOME
+SALOME service node
++++++++++++++++++++++++++
-On a deux formes de définition d'un noeud de service SALOME.
+There are two definition forms for a SALOME service node.
-La première forme dans laquelle on donne le nom du composant utilise la méthode createCompoNode
-pour la création du noeud. Le nom du composant est donné en argument de la méthode setRef du noeud.
-Le nom du service est donné en argument de la méthode setMethod du noeud. Le reste de la définition est
-identique à celui des noeuds Python précédents.
+The first form in which the component name is given, uses the createCompoNode method to create the node. The name of the
+component is given as an argument to the setRef method for the node. The service name is given as an argument for the
+setMethod method for the node. The remainder of the definition is exactly the same as for the previous Python nodes.
-Voici un exemple de noeud qui appelle le service makeBanner d'un composant PYHELLO::
+The following is an example of a node that calls the makeBanner service for a PYHELLO component::
n3=r.createCompoNode("","node3")
p.edAddChild(n3)
n3.edAddInputPort("p1",ts)
n3.edAddOutputPort("p1",ts)
-La deuxième forme qui permet de définir un noeud qui utilise le même composant qu'un autre noeud
-utilise la méthode createNode de ce dernier noeud. Cette méthode n'a qu'un argument, le nom du noeud.
-Le reste de la définition est identique à celui de la précédente forme.
+The second form is used to define a node that uses the same component as another node uses the createNode method of this other node.
+This method only has one argument, which is the node name.
+The remainder of the definition is identical to the definition for the previous form.
-Voici un exemple de noeud de service qui appelle une deuxième fois le service makeBanner de la même
-instance de composant que le noeud précédent::
+The following gives an example of a service node that makes a second call to the makeBanner service for the same component
+instance as the previous node::
n4=n3.createNode("node4")
p.edAddChild(n4)
n4.edAddInputPort("p1",ts)
n4.edAddOutputPort("p1",ts)
-Définition des connexions
+Definition of connections
''''''''''''''''''''''''''''
-Obtenir un port d'un noeud
+Obtaining a node port
++++++++++++++++++++++++++++
-Pour pouvoir définir des liens, il faut presque toujours disposer des objets Python représentant
-le port de sortie à connecter au port d'entrée.
-Il y a deux façons de disposer de cet objet.
+Before links can be defined, it is almost always necessary to have Python objects representing the output port to be
+connected to the input port. There are two ways of obtaining this object.
-La première façon est de récupérer le port lors de sa création avec les méthodes edAddInputPort et
-edAddOutputPort. On écrira alors, par exemple::
+The first way is to retrieve the port when it is created using the edAddInputPort and edAddOutputPort methods.
+For example, we can then write::
pin=n4.edAddInputPort("p1",ts)
pout=n4.edAddOutputPort("p1",ts)
-pin et pout sont alors les objets nécessaires pour définir des liens.
+pin and pout are then the objects necessary to define links.
-La deuxième façon est d'interroger le noeud et de lui demander un de ses ports par son nom. On utilise pour
-celà les méthodes getInputPort et getOutputPort.
-
-On pourra alors obtenir pin et pout comme suit::
+The second way is to interrogate the node and ask it for one of its ports by its name.
+This is done using the getInputPort and getOutputPort methods.
+pin and pout can then be obtained as follows::
pin=n4.getInputPort("p1")
pout=n4.getOutputPort("p1")
-Lien de contrôle
-++++++++++++++++++
-Pour définir un lien de contrôle entre deux noeuds, on utilise la méthode edAddCFLink du contexte en lui passant
-en arguments les deux noeuds à connecter.
-Par exemple, un lien de contrôle entre les noeuds n3 et n4 s'écrira::
+Control link
+++++++++++++++++++++++++++++
+The edAddCFLink method for the context is used to define a control link between two nodes, transferring the two nodes to be
+connected to it as arguments. For example, a control link between nodes n3 and n4 will be written::
p.edAddCFLink(n3,n4)
-Le noeud n3 sera exécuté avant le noeud n4.
+Node n3 will be executed before node n4.
-Lien dataflow
-++++++++++++++
-Pour définir un lien dataflow, il faut tout d'abord obtenir les objets ports par une des méthodes vues
-ci-dessus. Ensuite on utilise la méthode edAddDFLink du noeud contexte en lui passant les deux ports à connecter.
-
-Voici un exemple de lien dataflow entre le port de sortie p1 du noeud n3 et le port d'entrée du noeud n4::
+Dataflow link
+++++++++++++++++++++++++++++
+The first step in defining a dataflow link is to obtain port objects using one of the methods described above.
+The edAddDFLink method for the context node is then used, transferring the two ports to be connected to it.
+The following gives an example of a dataflow link between the output port p1 of node n3 and the input port of node n4::
pout=n3.getOutputPort("p1")
pin=n4.getInputPort("p1")
p.edAddDFLink(pout,pin)
-Lien data
-++++++++++++
-Un lien data se définit comme un lien dataflow en utilisant la méthode edAddLink au lieu de edAddDFLink.
-Le même exemple que ci-dessus avec un lien data::
+Data link
+++++++++++++++++++++++++++++
+A data link is defined as being a dataflow link using the edAddLink method instead of edAddDFLink.
+The same example as above with a data link::
pout=n3.getOutputPort("p1")
pin=n4.getInputPort("p1")
p.edAddLink(pout,pin)
-Initialisation d'un port de données d'entrée
+Initialising an input data port
'''''''''''''''''''''''''''''''''''''''''''''''
-Pour initialiser un port de données d'entrée, il faut tout d'abord obtenir l'objet port correspondant. Ensuite, il existe
-deux méthodes pour l'initialiser.
+An input data port is initialised firstly by obtaining the corresponding port object. There are then two methods of initialising it.
-La première initialise le port avec une valeur encodée en XML-RPC. On utilise alors la méthode edInitXML du
-port. Voici un exemple qui initialise un port avec la valeur entière 5::
+The first method initialises the port with a value encoded in XML-RPC. The edInitXML method for the port is then used.
+The following is an example that initialises the port with the integer value 5::
pin.edInitXML("<value><int>5</int></value>")
-La deuxième méthode initialise le port avec une valeur Python. On utilise alors la méthode edInitPy. Voici
-un exemple qui initialise ce même port avec la même valeur::
+The second method initialises the port with a Python value. The edInitPy method is then used.
+The following is an example that initialises this port with the same value::
pin.edInitPy(5)
-On peut également utiliser des méthodes spécifiques pour les types de base :
-
-- ``edInitInt`` pour le type int
-- ``edInitDbl`` pour le type double
-- ``edInitBool`` pour le type bool
-- ``edInitString`` pour le type string
+Specific methods can also be used for basic types:
-Premier exemple à partir des éléments précédents
+- ``edInitInt`` for the int type
+- ``edInitDbl`` for the double type
+- ``edInitBool`` for the bool type
+- ``edInitString`` for the string type
+
+First example starting from the previous elements
'''''''''''''''''''''''''''''''''''''''''''''''''''
-En rassemblant tous les éléments de définition précédents, un schéma de calcul complet identique à celui
-du chapitre :ref:`schemaxml` se présentera comme suit::
+By collecting all previous definition elements, a complete calculation scheme identical to that given in the :ref:`schemaxml` chapter
+will appear as follows::
import sys
import pilot
#initialisation ports
n1.getInputPort("p1").edInitPy(5)
-
-Définition de noeuds composés
+Definition of composite nodes
'''''''''''''''''''''''''''''''''
-Bloc
+
+.. _py_block:
+
+Block
+++++++
-Pour définir un Bloc, on utilise la méthode createBloc du runtime en lui passant le nom du Bloc en argument. Ensuite,
-on rattache le noeud à son contexte de définition comme un noeud élémentaire. Voici un exemple de définition de Bloc
-dans un schéma de calcul::
+A block is defined using the runtime createBloc method transferring the Block name to it as an argument. The node is then
+attached to its definition context as an elementary node. The following is an example Block definition in a calculation scheme::
b=r.createBloc("b1")
p.edAddChild(b)
-Une fois le Bloc créé, il est possible d'ajouter tous les noeuds et liens possibles dans son contexte. En reprenant une partie
-de l'exemple ci-dessus, on aura::
+Once the block has been created, all nodes and links possible in its context can be added.
+Repeating a part of the example above, we will get::
n1=r.createScriptNode("","node1")
b.edAddChild(n1)
b.edAddCFLink(n1,n2)
b.edAddDFLink(n1.getOutputPort("p1"),n2.getInputPort("p1"))
+.. _py_forloop:
+
ForLoop
++++++++
-Pour définir une ForLoop, on utilise la méthode createForLoop du runtime en lui passant le nom du noeud en argument.
-Ensuite on rattache le noeud à son contexte de définition. Voici un exemple de définition de ForLoop
-dans un schéma de calcul::
+A Forloop is defined using the runtime createForLoop method, transferring the node name to it as an argument.
+The node is then attached to its definition context. The following is an example ForLoop definition in a calculation scheme::
l=r.createForLoop("l1")
p.edAddChild(l)
-Pour initialiser le nombre de tours de boucle à exécuter, on utilise le port "nsteps" que l'on initialise
-avec un entier. Par exemple::
+The number of iterations in the loop to be executed will be initialised using the “nsteps” port that is initialised
+with an integer. For example::
ip=l.getInputPort("nsteps")
ip.edInitPy(3)
-Il existe une méthode spéciale pour obtenir le port "nsteps" de la boucle : edGetNbOfTimesInputPort. On pourrait donc
-l'écrire également ainsi::
+There is a special method for obtaining the “nsteps” port for the loop, namely edGetNbOfTimesInputPort. Therefore, it can also be
+written as follows::
ip=l.edGetNbOfTimesInputPort()
ip.edInitPy(3)
-Enfin, pour ajouter un noeud (et un seul) dans le contexte d'une boucle, on n'utilisera pas la méthode edAddChild
-mais une méthode différente de nom edSetNode. Voici un petit exemple de définition d'un noeud interne de boucle::
+Finally, a method called edSetNode will be used in the context of a loop, instead of the edAddChild method, so as to add one (and only one) node.
+The following is a small example definition of a node inside a loop::
n1=r.createScriptNode("","node1")
l.edSetNode(n1)
n1.edAddInputPort("p1",ti)
n1.edAddOutputPort("p1",ti)
+.. _py_whileloop:
+
WhileLoop
++++++++++
-Un noeud WhileLoop se définit presque comme un noeud ForLoop. Les seules différences concernent la création et
-l'affectation de la condition de fin de boucle. Pour la création on utilise la méthode createWhileLoop. Pour la
-condition, on utilise le port "condition". Si on fait un rebouclage sur un noeud, il ne faut pas oublier d'utiliser
-un lien data et non un lien dataflow.
-Voici un exemple de définition de noeud WhileLoop avec un noeud interne script Python. La condition est initialisée
-à True puis passée à False par le noeud interne. On a donc un rebouclage::
+WhileLoop node is defined in practically the same way as a ForLoop node. The only differences apply to creation and assignment
+of the end of loop condition. The createWhileLoop method is used for creation. The “condition” port is used for the condition.
+If looping takes place on a node, it is important to use a data link instead of a dataflow link.
+The following is an example of WhileLoop node definition with a Python script internal node.
+The condition is initialised to True and is then changed to False by the internal node. This results in a link loop::
wh=r.createWhileLoop("w1")
p.edAddChild(wh)
cport.edInitBool(True)
p.edAddLink(n.getOutputPort("p1"),cport)
-Il existe une méthode spéciale pour obtenir le port "condition" de la boucle : edGetConditionPort.
+There is a special method for obtaining the loop “condition” port: edGetConditionPort.
-Boucle ForEach
+.. _py_foreachloop:
+
+ForEach loop
++++++++++++++++
-Un noeud ForEach se définit à la base comme un autre noeud boucle. Il y a plusieurs différences. Le noeud
-est créé avec la méthode createForEachLoop qui prend un argument de plus : le type de données géré par le ForEach.
-Le nombre de branches du ForEach est spécifié avec le port "nbBranches". La gestion de la collection sur
-laquelle itère le ForEach est faite par connexion des ports "SmplPrt" et "SmplsCollection".
+A ForEach node is basically defined in the same way as any other loop node. There are several differences.
+The node is created with the createForEachLoop method that has an additional argument, namely the data type managed by the ForEach.
+The number of ForEach branches is specified with the “nbBranches” port. The collection on which the ForEach iterates is managed by
+connection of the “evalSamples” and “SmplsCollection” ports.
-Voici un exemple de définition de noeud ForEach avec un noeud interne script Python qui incrémente l'élément
-de la collection de 3.::
+The following is an example definition of the ForEach node with a Python script internal node that increments
+the element of the collection by 3::
fe=r.createForEachLoop("fe1",td)
p.edAddChild(fe)
n.edAddInputPort("p1",td)
n.edAddOutputPort("p1",td)
fe.edSetNode(n)
- p.edAddLink(fe.getOutputPort("SmplPrt"),n.getInputPort("p1"))
+ p.edAddLink(fe.getOutputPort("evalSamples"),n.getInputPort("p1"))
fe.getInputPort("nbBranches").edInitPy(3)
fe.getInputPort("SmplsCollection").edInitPy([2.,3.,4.])
-Pour obtenir les ports spéciaux du ForEach, on peut utiliser les méthodes suivantes à la place de getInputPort et
-getOutputPort :
+Special ports for the ForEach can be obtained using the following methods instead of getInputPort and getOutputPort:
+
+- edGetNbOfBranchesPort for the “nbBranches” port
+- edGetSamplePort for the “evalSamples” port
+- edGetSeqOfSamplesPort for the “SmplsCollection” port
-- edGetNbOfBranchesPort pour le port "nbBranches"
-- edGetSamplePort pour le port "SmplPrt"
-- edGetSeqOfSamplesPort pour le port "SmplsCollection"
+.. _py_switch:
Switch
++++++++
-La définition d'un noeud Switch se fait en plusieurs étapes. Les deux premières sont la création et le rattachment
-au noeud de contexte. Le noeud est créé par appel de la méthode createSwitch du runtime avec le nom du noeud
-en argument. Le noeud est rattaché au noeud contexte par appel de la méthode edAddChild pour un schéma ou un bloc
-ou edSetNode pour un noeud boucle.
+A switch node is defined in several steps. The first two steps are creation and attachment to the context node.
+The node is created by calling the runtime createSwitch method with the name of the node as an argument. The node is attached
+to the context node by calling the edAddChild method for a scheme or a block or edSetNode for a loop node.
-Voici un exemple de création suivi du rattachement::
+The following is an example of a creation followed by an attachment::
sw=r.createSwitch("sw1")
p.edAddChild(sw)
-Ensuite on crée un noeud interne élémentaire ou composé par cas. Le noeud pour le cas par défaut est
-rattaché au switch avec la méthode edSetDefaultNode. Les noeuds pour les autres cas sont rattachés au switch
-avec la méthode edSetNode qui prend en premier argument la valeur du cas (entier) et en deuxième argument
-le noeud interne.
+The next step is to create an internal elementary or composite node by case. The node for the default case is attached to
+the switch using the edSetDefaultNode method. Nodes for other cases are attached to the switch using the edSetNode method, in
+which the first argument is equal to the value of the case (integer) and the second argument is equal to the internal node.
-Voici un exemple de switch avec un noeud script pour le cas "1" et un autre noeud script
-pour le cas "default" et un noeud script pour initialiser une variable échangée::
+The following is an example of a switch with one script node for case “1” and another script node for the “default” case
+and a script node to initialise an exchanged variable::
#init
n=r.createScriptNode("","node3")
ndef.edAddInputPort("p1",td)
ndef.edAddOutputPort("p1",td)
sw.edSetDefaultNode(ndef)
- #initialisation port select
+ #initialise the select port
sw.getInputPort("select").edInitPy(1)
- #connexion des noeuds internes
+ #connection of internal nodes
p.edAddDFLink(n.getOutputPort("p1"),nk1.getInputPort("p1"))
p.edAddDFLink(n.getOutputPort("p1"),ndef.getInputPort("p1"))
-Pour obtenir le port spécial "select" du Switch, on peut utiliser la méthode edGetConditionPort à la place de getInputPort.
-
-Définition de containers
+The edGetConditionPort method can be used instead of getInputPort, to obtain the special “select” port for the Switch.
+
+.. _py_optimizerloop:
+
+OptimizerLoop
++++++++++++++++++++
+
+The following is an example of OptimizerLoop with one python script as internal node. The algorithm
+is defined by the class async in the python module myalgo2.py::
+
+ ol=r.createOptimizerLoop("ol1","myalgo2.py","async",True)
+ p.edAddChild(ol)
+ n=r.createScriptNode("","node3")
+ n.setScript("p1=3")
+ n.edAddInputPort("p1",td)
+ n.edAddOutputPort("p1",ti)
+ ol.edSetNode(n)
+ ol.getInputPort("nbBranches").edInitPy(3)
+ ol.getInputPort("algoInit").edInitPy("coucou")
+ p.edAddLink(ol.getOutputPort("evalSamples"),n.getInputPort("p1"))
+ p.edAddLink(n.getOutputPort("p1"),ol.getInputPort("evalResults"))
+
+.. _py_container:
+
+Definition of containers
''''''''''''''''''''''''''''
-Pour définir un container, on utilise la méthode createContainer du runtime puis on lui donne un nom avec sa méthode
-setName. Enfin on lui affecte des contraintes en lui ajoutant des propriétés.
-Voici un exemple de création d'un container de nom "A"::
+A container is defined using the runtime createContainer method and it is then given a name using its setName method.
+The next step is to assign constraints to it by adding properties.
+The following is an example creation of a container named “A”::
c1=r.createContainer()
c1.setName("A")
-On ajoute une propriété à un container en utilisant sa méthode setProperty qui prend 2 arguments (chaines de caractères).
-Le premier est le nom de la propriété. Le deuxième est sa valeur.
-Voici un exemple du même container "A" avec des contraintes::
+A property is added to a container using its setProperty method that uses 2 arguments (character strings).
+The first is the property name. The second is its value.
+The following is an example of this container “A” with constraints::
c1=r.createContainer()
c1.setName("A")
c1.setProperty("hostname","localhost")
c1.setProperty("mem_mb","1000")
-Une fois que les containers sont définis, on peut placer des composants SALOME sur ce container.
-Pour placer le composant d'un noeud de service SALOME, il faut tout d'abord obtenir l'instance de
-composant de ce noeud de service en utilisant la méthode getComponent de ce noeud. Puis on affecte le container
-précédemment défini à cette instance de composant en utilisant la méthode setContainer de l'instance
-de composant.
+Once the containers have been defined, SALOME components can be placed on this container. The first step to place the component
+of a SALOME service node is to obtain the component instance of this service node using the getComponent method for this node.
+The previously defined container is then assigned to this component instance using the setContainer method of the component instance.
-Si on veut placer le service SALOME défini plus haut (noeud "node3") sur le container "A", on écrira::
+If it is required to place the SALOME service defined above (node “node3”) on container “A”, we will write::
n3.getComponent().setContainer(c1)
-
-Les propriétés de noeuds
+Node properties
'''''''''''''''''''''''''''
-On ajoute (ou modifie) une propriété à un noeud élémentaire ou composé en utilisant sa méthode
-setProperty qui prend 2 arguments (chaines de caractères).
-Le premier est le nom de la propriété. Le deuxième est sa valeur.
-
-Voici un exemple pour le noeud "node3" précédent::
+A property is added to an elementary or composite node (or is modified) using its setProperty method that has two
+arguments (character strings). The first is the name of the property. The second is its value.
+The following is an example for the previous node “node3”::
n3.setProperty("VERBOSE","2")
-Les connexions datastream
-''''''''''''''''''''''''''''
-Les connexions datastream ne sont possibles que pour des noeuds de service SALOME comme on l'a vu dans Principes.
-Il faut tout d'abord définir les ports datastream dans le noeud de service. Un port datastream d'entrée se définit
-en utilisant la méthode edAddInputDataStreamPort. Un port datastream de sortie se définit
-en utilisant la méthode edAddOutputDataStreamPort.
-Ces méthodes prennent en arguments le nom du port et le type du datastream.
-
-Certains ports datastream (par exemple les ports CALCIUM) doivent être configurés avec des propriétés.
-On utilise la méthode setProperty du port pour les configurer.
+Datastream connections
+'''''''''''''''''''''''''''
+Datastream connections are only possible for SALOME service nodes as we have seen in :ref:`principes`.
+We firstly need to define the datastream ports in the service node. An input datastream port is defined using
+the edAddInputDataStreamPort method. An output datastream port is defined using the edAddOutputDataStreamPort method.
+These methods use the port name and the datastream type as arguments.
-Voici un exemple de définition de noeud de service SALOME avec des ports datastream.
-Il s'agit du composant DSCCODC que l'on peut trouver dans le module DSCCODES de la base EXAMPLES.
-Les ports datastream sont de type "CALCIUM_integer" avec dépendance temporelle::
+Some datastream ports (for example CALCIUM ports) must be configured with properties. The port setProperty method will
+be used to configure them.
+The following is an example definition of the SALOME service node with datastream ports. This is the DSCCODC component
+located in the DSCCODES module in the EXAMPLES base. The datastream ports are of the “CALCIUM_integer” type
+with time dependency::
calcium_int=cata._typeMap['CALCIUM_integer']
n5=r.createCompoNode("","node5")
pout=n5.edAddOutputDataStreamPort("STP_EN",calcium_int)
pout.setProperty("DependencyType","TIME_DEPENDENCY")
-Une fois les noeuds de service dotés de ports datastream, il ne reste plus qu'à les connecter.
-Cette connexion est réalisée en utilisant la méthode edAddLink du noeud contexte comme pour
-les liens data. Seul le type des ports passés en arguments est différent.
+Once the service nodes have been provided with datastream ports, all that remains is to connect them.
+This connection is made using the edAddLink method for the context node in the same way as for data links.
+The only difference is the type of ports transferred as arguments.
-Pour compléter notre exemple on définit un deuxième noeud de service et on connecte les
-ports datastream de ces services::
+To complete our example, we will define a second service node and connect the datastream ports for these services::
n6=r.createCompoNode("","node6")
p.edAddChild(n6)
p.edAddLink(n5.getOutputDataStreamPort("STP_EN"),n6.getInputDataStreamPort("ETP_EN"))
p.edAddLink(n6.getOutputDataStreamPort("STP_EN"),n5.getInputDataStreamPort("ETP_EN"))
-D'autres noeuds élémentaires
+Other elementary nodes
'''''''''''''''''''''''''''''''
-Noeud SalomePython
+SalomePython node
+++++++++++++++++++
-La définition d'un noeud SalomePython est quasiment identique à celle d'un `Noeud fonction Python`_. On utilise
-la méthode createSInlineNode du runtime à la place de createFuncNode et on ajoute une information de
-placement sur un container comme pour un noeud de service SALOME (méthode setContainer).
+A SalomePython node is defined in practically exactly the same way as a :ref:`pyfunc`. The runtime createSInlineNode method is used
+instead of the createFuncNode and information about placement on a container is added in the same way as for a
+SALOME service node (setContainer method).
-Voici un exemple semblable à celui de :ref:`schemaxml`::
+The following is an example similar to that given in :ref:`schemaxml`::
n2=r.createSInlineNode("","node2")
p.edAddChild(n2)
n2.edAddInputPort("p1",ts)
n2.getComponent().setContainer(c1)
-Noeud DataIn
+.. _py_datain:
+
+DataIn node
+++++++++++++++
-Pour définir un noeud DataIn, on utilise la méthode createInDataNode du runtime. Elle prend deux arguments
-dont le premier doit être "" et le deuxième le nom du noeud.
-Pour définir les données du noeud, on lui ajoute des ports de données de sortie avec la méthode edAddOutputPort
-en lui passant le nom de la donnée et son type en arguments.
-Pour initialiser la valeur de la donnée, on utilise la méthode setData du port ainsi créé en lui passant
-la valeur encodée en XML-RPC (voir :ref:`initialisation`).
+A DataIn node is defined using the runtime createInDataNode method. It uses two arguments, the first of which must be “” and
+the second the node name. Node data are defined by adding output data ports to it using the edAddOutputPort method
+and transferring the data name and its type to it as arguments.
+The value of the data is initialised using the port setData method thus created by transferring the value encoded in
+XML-RPC to it (see :ref:`initialisation`).
-Voici un exemple de noeud DataIn qui définit 2 données de type double (b et c) et une donnée de type fichier (f)::
+The following is an example of the DataIn node that defines 2 double type data (b and c) and one file type data (f)::
n=r.createInDataNode("","data1")
p.edAddChild(n)
pout=n.edAddOutputPort('f',tf)
pout.setData("<value><objref>f.data</objref></value>")
-Il est possible d'affecter une valeur à une donnée directement avec un objet Python en utilisant
-la méthode setDataPy. Exemple pour une séquence::
+A value can be directly assigned to a data with a Python object, using the setDataPy method. Example for a sequence::
pout.setDataPy([1.,5.])
-Noeud DataOut
+.. _py_dataout:
+
+DataOut node
+++++++++++++++++
-Pour définir un noeud DataOut, on utilise la méthode createOutDataNode du runtime. Elle prend deux arguments
-dont le premier doit être "" et le deuxième le nom du noeud.
-Pour définir les résultats du noeud, on lui ajoute des ports de données d'entrée en utilisant la
-méthode edAddInputPort avec le nom du résultat et son type en arguments.
-Pour sauvegarder les résultats dans un fichier on utilise la méthode setRef du noeud avec le nom
-du fichier en argument.
-Pour recopier un résultat fichier dans un fichier local, on utilise la méthode setData du port correspondant
-au résultat avec le nom du fichier en argument.
-
-Voici un exemple de noeud DataOut qui définit des résultats (a, b, c, d, f) de différents
-types (double, int, string, vecteur de doubles, fichier) et écrit les valeurs correspondantes
-dans le fichier g.data. Le fichier résultat sera copié dans le fichier local monfich::
+A DataOut node is defined using the runtime createOutDataNode method. It uses two arguments, the first of which
+must be “” and the second the node name . Node results are defined by adding input data ports to it using the edAddInputPort
+method with the result name and its type as arguments. The results are saved in a file using the node setRef method with the
+file name as an argument.
+A result file is copied into a local file using the setData method for the port corresponding to the result with the
+file name as an argument.
+
+The following is an example of the DataOut node that defines different types (double, int, string, doubles vector, file) of
+results (a, b, c, d, f) and writes the corresponding values in the g.data file.
+The result file will be copied into the local file myfile::
n=r.createOutDataNode("","data2")
n.setRef("g.data")
pin=n.edAddInputPort('f',tf)
pin.setData("monfich")
-Noeud StudyIn
+.. _py_studyin:
+
+StudyIn node
++++++++++++++
-Pour définir un noeud StudyIn, on utilise la méthode createInDataNode du runtime. Elle prend deux arguments
-dont le premier doit être "study" et le deuxième le nom du noeud.
-Pour spécifier l'étude associée, on ajoute la propriété "StudyID" au noeud en utilisant sa méthode setProperty.
-Pour définir les données du noeud, on lui ajoute des ports de données de sortie avec la méthode edAddOutputPort
-en lui passant le nom de la donnée et son type en arguments.
-Pour initialiser la donnée avec la référence dans l'étude, on utilise la méthode setData du port ainsi créé
-en lui passant une chaine de caractères qui contient soit l'Entry SALOME soit le chemin dans l'arbre d'étude.
-
-Voici un exemple de noeud StudyIn qui définit 2 données de type GEOM_Object (a et b).
-L'étude est supposée chargée en mémoire par SALOME sous le StudyID 1.
-La donnée a est référencée par une Entry SALOME. La donnée b est référencée par un chemin dans l'arbre d'étude::
+A StudyIn node is defined using the runtime createInDataNode method. It uses two arguments, the first of which must be “study”
+and the second the node name. The associated study is specified by adding the “StudyID” property to the node using
+its setProperty method. Node data are defined by adding output data ports using the edAddOutputPOrt method, transferring
+the name of the data and its type as arguments. The data is initialised with the reference in the study, using the setData method
+for the port thus created, transferring a character string to it containing either the SALOME Entry or the path in the study
+tree structure.
+
+The following is an example of the StudyIn node that defines 2 GEOM_Object type data (a and b). The study is assumed to be
+loaded into memory by SALOME as StudyID 1. Data a is referenced by one SALOME Entry. Data b is referenced by a path in the
+study tree structure::
n=r.createInDataNode("study","study1")
p.edAddChild(n)
pout=n.edAddOutputPort('b',tgeom)
pout.setData("/Geometry/Sphere_1")
+.. _py_studyout:
-Noeud StudyOut
-++++++++++++++++
-Pour définir un noeud StudyOut, on utilise la méthode createOutDataNode du runtime. Elle prend deux arguments
-dont le premier doit être "study" et le deuxième le nom du noeud.
-Pour spécifier l'étude associée, on ajoute la propriété "StudyID" au noeud en utilisant sa méthode setProperty.
-Pour spécifier un nom de fichier dans lequel sera sauvegardée l'étude, on utilise la méthode setRef du noeud
-avec le nom du fichier en argument.
-Pour définir les résultats du noeud, on lui ajoute des ports de données d'entrée avec la méthode edAddInputPort
-en lui passant le nom de la donnée et son type en arguments.
-Pour associer l'entrée dans l'étude au résultat, on utilise la méthode setData du port
-en lui passant une chaine de caractères qui contient soit l'Entry SALOME soit le chemin dans l'arbre d'étude.
-
-Voici un exemple de noeud StudyOut qui définit 2 résultats (a et b) de type GEOM_Object.
-L'étude utilisée a le studyId 1. Le résultat a est référencé par une Entry SALOME.
-Le résultat b est référencé par un chemin.
-L'étude complète est sauvegardée en fin de calcul dans le fichier study1.hdf::
+StudyOut node
+++++++++++++++
+A StudyOut node is defined using the runtime createOutDataNode method. It uses two arguments, the first of
+which must be “study” and the second the node name. The associated study is specified by adding
+the “StudyID” property to the node using its setProperty method. The name of the file in which the study will be
+saved is specified using the node SetRef method with the file name as an argument.
+The node results are defined by adding input data ports to it using the edAddInputPort method, transferring the data name
+and type as arguments. The setData method for the port is used to associate the entry into the study to the result, transferring
+a character string to it that contains either the SALOME Entry or the path in the study tree structure.
+
+The following contains an example of the StudyOut node that defines two GEOM_Object type results (a and b).
+The studyId of the study used is 1. Result a is referenced by a SALOME Entry. The result b is referenced by a path.
+The complete study is saved in the study1.hdf file at the end of the calculation::
n=r.createOutDataNode("study","study2")
n.setRef("study1.hdf")
pout=n.edAddInputPort('b',tgeom)
pout.setData("/Save/Sphere_2")
-
-Sauvegarder un schéma de calcul dans un fichier XML
+Save a calculation scheme in an XML file
------------------------------------------------------
-Pour sauvegarder un schéma de calcul dans un fichier au format XML, il faut utiliser la méthode saveSchema
-du schéma de calcul en lui passant le nom du fichier en argument.
-Pour qu'un schéma de calcul, construit en Python, puisse être sauvegardé sous une forme cohérente
-dans un fichier XML, il ne faut pas oublier d'ajouter dans le dictionnaire des types du schéma
-tous les types qui ont été définis en Python (voir :ref:`typedict`). La sauvegarde ne le fait pas automatiquement.
+A calculation scheme is saved in a file in the XML format using the saveSchema method for the calculation
+scheme, transferring the file name to it as an argument. Before a calculation scheme constructed under Python
+can be saved in a consistent form in an XML file, all types defined in Python have to be added to the scheme types
+dictionary (see :ref:`typedict`). The save will not do this automatically.
-Pour sauver le schéma p construit ci-dessus, dans le fichier monschema.xml, il faut écrire::
+Proceed as follows to save the scheme p constructed above in the myscheme.xml file::
p.saveSchema("monschema.xml")
-Le fichier ainsi obtenu pourra ensuite être chargé comme dans :ref:`loadxml`.
-
+The file thus obtained can then be loaded as in :ref:`loadxml`.
-Quelques opérations utiles
+Several useful operations
------------------------------
-Retrouver un noeud par son nom
+
+Finding a node by its name
'''''''''''''''''''''''''''''''''''
-Pour retrouver un noeud (objet Python) quand on n'a que l'objet schéma de calcul et le nom absolu du noeud, il
-suffit d'appeler la méthode getChildByName du schéma en lui passant le nom absolu.
+A node (Python object) can be found, when all that is available is the calculation scheme object and
+the absolute name of the node, by calling the scheme getChildByName method, transferring the absolute name to it.
-Pour retrouver le noeud script Python défini en `Noeud script Python`_::
+To find the Python script node defined in :ref:`pyscript`::
n=p.getChildByName("node1")
-Pour retrouver le noeud "node1" dans le bloc "b1"::
+To find node “node1” node in block “b1”::
n=p.getChildByName("b1.node1")
-Cette opération est également utilisable à partir d'un noeud composé à condition d'utiliser le nom
-relatif du noeud.
-On peut réécrire l'exemple précédent::
+This operation can also be used starting from a composite node provided that the relative node name is used.
+The previous example can be rewritten::
n=b.getChildByName("node1")
-Retrouver un port par son nom
-''''''''''''''''''''''''''''''''
-Pour retrouver un port d'un noeud par son nom, il faut d'abord récupérer le noeud par son nom. Puis
-on retrouve un port de données d'entrée avec la méthode getInputPort et un port de données de sortie
-avec la méthode getOutputPort.
+Finding a port by its name
+'''''''''''''''''''''''''''''''''''
+The first step to find a node port by its name is to retrieve the node by its name. An input data port is then found
+using the getInputPort method, and an output data port is found using the getOutputPort method.
-Voici un exemple à partir du noeud n précédent::
+The following is an example starting from the previous node n::
pin=n.getOutputPort("p1")
pout=n.getInputPort("p2")
-Obtenir la valeur d'un port
-''''''''''''''''''''''''''''''''
-Pour obtenir la valeur d'un port on utilise sa méthode getPyObj.
-Exemple::
+Obtaining a port value
+'''''''''''''''''''''''''''''''''''
+The value of a port is obtained using its getPyObj method. For example::
print pin.getPyObj()
print pout.getPyObj()
-Obtenir l'état d'un noeud
-''''''''''''''''''''''''''''
-Pour obtenir l'état d'un noeud on utilise sa méthode getEffectiveState (voir les valeurs
-posssibles dans :ref:`etats`)
+Obtaining the state of a node
+'''''''''''''''''''''''''''''''''''
+The state of a node is obtained using its getEffectiveState method (see possible values in :ref:`etats`).
-Retirer un noeud de son contexte
-''''''''''''''''''''''''''''''''''
-Il est possible de retirer un noeud de son noeud contexte en utilisant une méthode du contexte.
-Le nom de la méthode diffère selon le type de contexte.
+Removing a node from its context
+'''''''''''''''''''''''''''''''''''
+A node can be removed from its context node using a context method. The method name will be different
+depending on the context type.
-- Pour un Bloc ou un schéma de calcul on utilisera la méthode edRemoveChild avec le noeud à retirer en argument::
+- For a block or a calculation scheme, the edRemoveChild method will be used with the node to be removed as an argument::
p.edRemoveChild(n)
-- Pour une boucle (ForLoop, WhileLoop ou ForEachLoop) on utilisera la méthode edRemoveNode sans argument::
-
+- For a loop (ForLoop, WhileLoop or ForEachLoop) the edRemoveNode method will be used without any argument::
+
l.edRemoveNode()
-- Pour un Switch, on utilisera la méthode edRemoveChild avec le noeud interne concerné en argument::
+- The edRemoveChild method will be used for a Switch, with the internal node concerned as an argument::
sw.edRemoveChild(nk1)
.. _schemaxml:
-Définition d'un schéma de calcul au format XML
+Defining a calculation scheme in the XML format
=================================================
-Un fichier XML qui décrit un schéma de calcul peut contenir les informations suivantes:
+An XML file that describes a calculation scheme can contain the following information:
- * des définitions de types de données
- * des définitions de containers
- * des définitions de noeuds de calcul élémentaires
- * des définitions de noeuds composés
- * des définitions de connexions entre noeuds
- * des initialisations
+ - definitions of data types
+ - definitions of containers
+ - definitions of elementary calculation nodes
+ - definitions of composite nodes
+ - definitions of connections between nodes
+ - initialisations
-La présentation de ces définitions sera faite progressivement. On commence
-dans un premier temps par :
+These definitions will be presented progressively. We will start with:
- - la définition des types de données
- - la définition d'un sous ensemble de noeuds élémentaires
- - la définition des connexions non datastream
- - la définition des noeuds composés
+ - the definition of data types
+ - the definition of a sub-set of elementary nodes
+ - the definition of non-datastream connections
+ - the definition of composite nodes
-Dans un deuxième temps, on ajoute des compléments sur :
+We will then add complements on:
- - la définition des containers
- - la définition des propriétés de noeuds
- - la définition des connexions datastream
- - la définition du reste des noeuds élémentaires
+ - the definition of containers
+ - the definition of node properties
+ - the definition of datastream connections
+ - the definition of the remaining elementary nodes.
-Un schéma de calcul est défini en utilisant le tag XML proc.
-Le schéma de calcul le plus simple est le suivant::
+A calculation scheme is defined using the XML proc tag. The simplest calculation scheme is as follows:
+
+.. code-block:: xml
<proc>
</proc>
-Il ne contient aucune définition et ne fait rien.
+It contains no definition and it does nothing.
-Définition des types de données
+Definition of data types
---------------------------------
-Il n'est pas possible de définir de types de base autres que ceux existants.
-Tous les types de base sont prédéfinis par YACS.
-Il est cependant possible de définir des alias. Par exemple, un alias pour
-le type double s'écrira::
+It is impossible to define basic types other than existing types. All basic types are predefined by YACS.
+However, aliases can be defined. For example, an alias for the double type can be written:
- <type name="mydble" kind="double"/>
+.. code-block:: xml
-On peut ensuite utiliser mydble à la place de double.
+ <type name="mydble" kind="double"/>
+we can then write mydble instead of double.
-Référence d'objet
+Object reference
'''''''''''''''''''''
-La forme la plus simple pour définir un type référence d'objet est::
+The simplest way of defining an object reference type is:
+
+.. code-block:: xml
<objref name="mesh"/>
-L'attribut name du tag objref donne le nom du nouveau type.
-La forme complète pour définir ce type serait::
+The name attribute of the objref tag gives the name of the new type.
+The complete form to define this type would be:
+
+.. code-block:: xml
<objref name="mesh" id="IDL:mesh:1.0/>
-où id est le repository id CORBA de l'objet SALOME correspondant. Cet attribut
-a une valeur par défaut qui est IDL:<nom du type>:1.0.
+where id is the CORBA repository id of the corresponding SALOME object. This attribute has a default value
+that is IDL:<type name>:1.0.
+
+All that is necessary to define an object reference type derived from another type is to add the name of the basic type(s).
+For example, for a derived mesh type, we can write:
-Pour définir un type référence d'objet dérivé d'un autre type, il suffit
-d'ajouter le nom du ou des types de base.
-Par exemple, pour un type dérivé de mesh, on écrira::
+.. code-block:: xml
<objref name="refinedmesh">
<base>mesh</base>
</objref>
-Si on a plusieurs types de base, on écrira::
+If there are several basic types, we will write:
+
+.. code-block:: xml
<objref name="refinedmesh">
<base>mesh</base>
<base>unautretype</base>
</objref>
-On peut, comme pour CORBA, utiliser des namespaces pour définir les types.
-Par exemple, si le type mesh SALOME est défini dans le namespace myns, on écrira::
+As for CORBA, we can use namespaces to define types.
+For example, if the SALOME mesh type is defined in the myns namespace, we will write:
+
+.. code-block:: xml
<objref name="myns/mesh"/>
-Séquence
+Sequence
''''''''''
-Pour définir une séquence de double, on écrira::
+To define a double sequence, we will write:
+
+.. code-block:: xml
<sequence name="myseqdble" content="double"/>
-Tous les attributs du tag sequence sont obligatoires. L'attribut name
-donne le nom du nouveau type. L'attribut content donne le nom du type
-des éléments de la séquence.
-On peut définir une séquence de séquence par::
+All attributes of the sequence tag are compulsory. The name attribute gives the name of the new type.
+The content attribute gives the name of the type of elements in the sequence.
+A sequence of sequences can be defined by:
+
+.. code-block:: xml
<sequence name="myseqseqdble" content="myseqdble"/>
-On peut également définir une séquence de références d'objet par::
+We can also define a sequence of object references by:
- <sequence name="myseqmesh" content="refinedmesh"/>
+.. code-block:: xml
+ <sequence name="myseqmesh" content="refinedmesh"/>
+
Structure
'''''''''''''
-Pour définir une structure, on utilise un tag struct avec des sous tags member
-pour la définition des membre de la structure.
-Voici un exemple de définition::
+A structure is defined using a struct tag with member sub-tags for the definition of structure members.
+The following is an example definition:
+
+.. code-block:: xml
<struct name="S1" >
<member name="x" type="double"/>
<member name="vd" type="dblevec"/>
</struct>
-Le tag member a 2 attributs obligatoires : name qui donne le nom du membre
-et type qui donne son type. Le tag struct a un attribut obligatoire name
-qui donne le nom du type.
+The member tag has 2 compulsory attributes, firstly name that gives the member name and secondly type that gives its type.
+The struct tag has a compulsory "name" attribute that gives the name of the type.
-Définition des noeuds de calcul élémentaires
+Definition of elementary calculation nodes
-----------------------------------------------
-Noeud script Python
+.. _xml_script_node:
+
+Python script node
'''''''''''''''''''''
-Pour définir un noeud inline script Python on utilise le tag inline avec le sous tag
-script comme dans l'exemple suivant::
+A Python script inline node is defined using the inline tag with the script sub-tag as in
+the following example:
+
+.. code-block:: xml
<inline name="node1" >
<script>
<outport name="p1" type="int"/>
</inline>
-L'attribut name (obligatoire) du tag inline est le nom du noeud.
-Le script Python est donné au moyen du sous tag code. On met autant de lignes code
-que nécessaire. Si le script contient des caractères inhabituels on peut utiliser
-une section CDATA. Ceci permet également de n'utiliser qu'un tag code pour un script complet.
-Par exemple::
+The name attribute (compulsory) of the inline tag is the node name. The Python script is given using the code sub-tag. As many code
+lines as necessary are added. A CDATA section can be used if the script contains unusual characters. This also makes it possible
+to assure that only one code tag is used for a complete script.
+For example:
+
+.. code-block:: xml
<script>
<code><![CDATA[a=0
</code>
</script>
-Le script calcule la variable p1 que l'on veut mettre en variable de sortie du noeud.
-Le port de sortie "p1" du noeud est défini avec le sous tag outport. Ce tag a 2 attributs
-obligatoires : name qui donne le nom du port et type qui donne le type de données
-supporté. Ce type doit être déjà défini.
-Pour ajouter un port de données d'entrée, on utilisera le tag inport à la place
-du tag outport.
+The script calculates the variable p1 that is to be set as a node output variable. The output port “p1” of the node is defined
+with the outport sub-tag. This tag has two compulsory attributes: name that gives the port name, and type that gives the supported
+data type. This type must already be defined.
+To add an input data port, the import tag will be used instead of the output tag.
-Un exemple de noeud avec des ports d'entrée et de sortie::
+An example node with input and output ports:
+
+.. code-block:: xml
<inline name="node1" >
<script>
<outport name="p1" type="int"/>
</inline>
-Maintenant le noeud reçoit p1 comme variable d'entrée, lui ajoute 10 et l'exporte
-comme variable de sortie.
+The node now receives p1 as the input variable, adds 10 to it and exports it as an output variable.
+
+If you want to execute your script node on a remote container, you have to change the tag from **inline** to **remote**
+and to add a tag **load** in the definition of the node as in the following example:
+
+.. code-block:: xml
+
+ <remote name="node1" >
+ <script>
+ <code>p1=p1+10</code>
+ </script>
+ <load container="cont1" />
+ <inport name="p1" type="int"/>
+ <outport name="p1" type="int"/>
+ </remote>
-Noeud fonction Python
+.. _xml_function_node:
+
+Python function node
''''''''''''''''''''''''
-Pour définir un noeud fonction Python on utilise le tag inline et le sous tag function
-comme dans l'exemple suivant::
+A Python function node is defined using the inline tag and the function sub-tag as in the following example:
+
+.. code-block:: xml
<inline name="node1" >
<function name="f">
<outport name="p1" type="int"/>
</inline>
-L'attribut name (obligatoire) du tag inline est le nom du noeud.
-Par rapport au noeud script Python seule la partie exécution change (tag function
-à la place du tag script).
-Le tag function a un attribut obligatoire name qui donne le nom de la fonction à
-exécuter. Le corps de la fonction est donné avec les tags code comme pour le script.
+The name attribute (compulsory) of the inline tag is the node name. The only difference from the Python script node is in
+the execution part (function tag instead of the script tag). The function tag has a compulsory name attribute that gives
+the name of the function to be executed. The body of the function is given with code tags as for the script.
-Noeud de service SALOME
-''''''''''''''''''''''''''
-Comme il est dit dans :ref:`principes`, on a deux façons de décrire un noeud
-de service SALOME.
+If you want to execute your function node on a remote container, you have to change the tag from **inline** to **remote**
+and to add a tag **load** in the definition of the node as in the following example:
-La première forme de définition utilise le tag service et les sous tags component
-et method comme dans l'exemple suivant::
+.. code-block:: xml
+
+ <remote name="node1" >
+ <function name="f">
+ <code>def f(p1):</code>
+ <code> p1=p1+10</code>
+ <code> return p1</code>
+ </function>
+ <load container="cont1" />
+ <inport name="p1" type="int"/>
+ <outport name="p1" type="int"/>
+ </remote>
+
+.. _xml_service_node:
+
+SALOME service node
+''''''''''''''''''''''''
+As stated in :ref:`principes`, there are two ways of describing a SALOME service node.
+
+The first definition form uses the service tag and the component and method sub-tags as in the following example:
+
+.. code-block:: xml
<service name="node4" >
<component>AddComponent</component>
<outport name="z" type="double"/>
</service>
-L'attribut obligatoire name du tag service donne le nom du noeud.
-Le tag component donne le nom du composant SALOME à utiliser et method
-le nom du service à exécuter. Ici on veut exécuter le service Add du
-composant AddComponent que l'on trouve dans les composants exemples
-de SALOME.
+The compulsory name attribute of the service tag gives the node name. The component tag gives the name of the SALOME
+component to be used and method gives the name of the service to be executed. The objective in this case is to execute
+the AddComponent (Add component) service that is located in SALOME example components.
+
+The second definition form uses the service tag and the node and method sub-tags as in the following example:
-La deuxième forme de définition utilise le tag service et les sous tags node
-et method comme dans l'exemple suivant::
+.. code-block:: xml
<service name="node5" >
<node>node4</node>
<inport name="x" type="double"/>
</service>
-Le tag node référence le noeud node4 précédemment défini de façon à utiliser
-la même instance de composant pour noeud4 et noeud5.
+The node tag references the previously defined node4 so as to use the same component instance for node4 and node5.
-Définition des connexions
+Definition of connections
-----------------------------
-Dans tout ce qui suit concernant les connexions et les initialisations de port,
-on est amené à identifier un noeud origine et/ou un noeud cible. Dans tous
-les cas, le nom qui sera utilisé est le nom relatif du noeud par rapport
-au contexte de définition de la connexion.
+We will need to define a source node and/or a target node for all of the following concerning port connections and initialisations.
+In all cases, the name that will be used is the relative node name, considering the connection definition context.
-Lien de contrôle
+Control link
''''''''''''''''''
-Un lien de contrôle est défini en utilisant le tag control comme dans l'exemple
-suivant::
+A control link is defined using the control tag as in the following example:
+
+.. code-block:: xml
<control>
<fromnode>node1</fromnode>
<tonode>node2</tonode>
</control>
-Le sous tag fromnode donne le nom du noeud qui sera exécuté avant le noeud
-dont le nom est donné par le sous tag tonode.
+The fromnode sub-tag gives the name of the node that will be executed before the node with the name given by the tonode sub-tag.
-Lien dataflow
+Dataflow link
''''''''''''''''
-Un lien dataflow est défini en utilisant le tag datalink comme dans l'exemple
-suivant::
+A dataflow link is defined using the datalink tag as in the following example:
+
+.. code-block:: xml
<datalink>
<fromnode>node1</fromnode> <fromport>p1</fromport>
<tonode>node2</tonode> <toport>p1</toport>
</datalink>
-Les sous tags fromnode et fromport donne le nom du noeud et du port de données
-sortant qui sera connecté au noeud et au port dont les noms sont donnés pat les
-sous tags tonode et toport.
-L'exemple de lien ci-dessus dit que la variable de sortie p1 du noeud node1
-sera envoyé au noeud node2 et utilisée comme variable d'entrée p1.
+The fromnode and fromport sub-tags give the name of the node and the output data port that will be connected to the node
+and to the port for which the names are given by the tonode and toport sub-tags. The above link example states that the output
+variable p1 of node node1 will be sent to node node2 and used as an input variable p1.
-Lien data
+Data link
''''''''''
-Un lien data est défini en utilisant le même tag datalink mais en ajoutant
-l'attribut control avec false comme valeur. Exemple::
+A data link is defined using the same datalink tag, but adding the control attribute and setting the value equal to false.
+Example:
+
+.. code-block:: xml
<datalink control="false">
<fromnode>node1</fromnode> <fromport>p1</fromport>
<tonode>node2</tonode> <toport>p1</toport>
</datalink>
-Le lien dataflow ci-dessus peut donc être aussi écrit comme suit::
+Therefore the above dataflow link can also be written as follows:
+
+.. code-block:: xml
<control>
<fromnode>node1</fromnode>
.. _initialisation:
-Initialisation d'un port de données d'entrée
+Initialising an input data port
-----------------------------------------------
-Pour initialiser un port de données d'entrée avec des constantes on utilise le tag parameter
-et les sous tags tonode, toport et value.
-Le tag toport donne le nom du port d'entrée du noeud de nom tonode à initialiser.
-La constante d'initialisation est donnée par le tag value.
-La constante est encodée en utilisant la convention de codage XML-RPC (http://www.xmlrpc.com/).
+An input data port can be initialised with constants by using the parameter tag, and the tonode, toport and value sub-tags.
+The toport tag gives the name of the input port of the node with the name tonode to be initialised.
+The initialisation constant is given by the value tag.
+The constant is encoded using the XML-RPC coding convention (http://www.xmlrpc.com/).
+Example initialisation:
-Exemple d'initialisation::
+.. code-block:: xml
<parameter>
<tonode>node1</tonode> <toport>p1</toport>
<value><string>coucou</string></value>
</parameter>
-On initialise le port p1 du noeud node1 avec une constante de type chaine de
-caractères ("coucou").
+Port p1 of node node1 is initialised with a character string type constant (“coucou”).
-Voici quelques exemples d'encodage XML-RPC:
+The following gives some examples of XML-RPC coding:
============================ ==============================================
-Constante Encodage XML-RPC
+Constant XML-RPC coding
============================ ==============================================
string "coucou" ``<string>coucou</string>``
double 23. ``<double>23</double>``
-entier 0 ``<int>0</int>``
-booléen true ``<boolean>1</boolean>``
-fichier ``<objref>/tmp/forma01a.med</objref>``
-liste d'entiers ::
-
- <array> <data>
- <value><int>1</int> </value>
- <value><int>0</int> </value>
- </data> </array>
-structure (2 membres) ::
-
- <struct>
- <member> <name>s</name>
- <value><int>1</int> </value>
- </member>
- <member> <name>t</name>
- <value><int>1</int> </value>
- </member>
- </struct>
+integer 0 ``<int>0</int>``
+boolean true ``<boolean>1</boolean>``
+file ``<objref>/tmp/forma01a.med</objref>``
+list of integers .. code-block:: xml
+
+ <array> <data>
+ <value><int>1</int> </value>
+ <value><int>0</int> </value>
+ </data> </array>
+structure (2 members) .. code-block:: xml
+
+ <struct>
+ <member> <name>s</name>
+ <value><int>1</int> </value>
+ </member>
+ <member> <name>t</name>
+ <value><int>1</int> </value>
+ </member>
+ </struct>
============================ ==============================================
-Premier exemple à partir des éléments précédents
+First example starting from previous elements
------------------------------------------------------
-Il est maintenant possible de définir un schéma de calcul complet
-avec des définitions de noeuds, des connexions et des initialisations. ::
+A complete calculation scheme can be defined with definitions of nodes, connections and initialisations.
+
+.. code-block:: xml
<proc>
<inline name="node1" >
</parameter>
</proc>
-Le schéma comprend 2 noeuds python (node1, node2) et un noeud SALOME (node4).
-Les noeuds node2 et node4 peuvent être exécutés en parallèle comme on peut le
-voir sur le diagramme ci-dessous.
+The scheme includes 2 Python nodes (node1, node2) and one SALOME node (node4).
+Nodes node2 and node4 can be executed in parallel as can be seen on the following diagram.
.. image:: images/ex1.png
:align: center
-Définition de noeuds composés
+Definition of composite nodes
-----------------------------------
-L'étape suivante est la définition de noeuds composés soit pour modulariser le schéma (Bloc)
-soit pour introduire des structures de contrôle (Loop, Switch).
+The next step is to define composite nodes, either to modularise the scheme (Block) or to introduce control structures (Loop, Switch).
+
+.. _xml_block:
-Bloc
+Block
''''''''
-Tous les éléments de définition précédents (à l'exception des types de données) peuvent être
-mis dans un noeud Bloc. Pour créer un Bloc, il suffit d'utiliser un tag bloc avec un attribut name
-obligatoire qui portera le nom du bloc. Ensuite, on ajoute des définitions dans ce tag et on obtient
-un noeud composé qui est un Bloc.
+All the previous definition elements (except for data types) can be put into a Block node.
+A Block can be created simply by using a bloc tag with a compulsory name attribute, the name of which will be the block name.
+The next step is to add definitions in this tag to obtain a composite node that is a Block.
-Voici un exemple de Bloc qui reprend une partie de l'exemple ci-dessus::
+The following is an example of a Block that uses part of the above example:
+
+.. code-block:: xml
<bloc name="b">
<inline name="node1" >
</datalink>
</bloc>
-Ce bloc peut maintenant être connecté à d'autres noeuds comme un simple noeud élémentaire.
-Il faut respecter quelques règles :
+This block can now be connected to other nodes like a simple elementary node.
+A few rules have to be respected:
+
+- a control link crossing a block boundary cannot be created
+- input and output data links crossing the boundary can be created provided that a context sensitive naming system is used (see :ref:`nommage`)
- - il n'est pas possible de créer un lien de contrôle qui traverse la frontière d'un bloc
- - il est possible de créer des liens data qui traverse la frontière aussi bien en entrée
- qu'en sortie à condition d'utiliser un nommage contextuel (voir :ref:`nommage`)
+.. _xml_forloop:
ForLoop
'''''''''''
+A Forloop is defined using a forloop tag. This tag has a compulsory name attribute, the name of which is the node name and an
+optional nsteps attribute that gives the number of loop iterations to be executed. If this attribute is not specified, the node will
+use the value given in its input port named nsteps. The forloop tag must contain the definition of one and only one internal node
+that can be an elementary node or a composite node. Forloops can be nested on several levels, for example. If we would like to have
+more than one calculation node in the ForLoop, a Block will have to be used as the internal node.
-Une ForLoop est définie en utilisant un tag forloop. Ce tag a un attribut obligatoire name qui porte le nom du noeud
-et un attribut facultatif nsteps qui donne le nombre de tours de boucle à exécuter. Si cet attribut n'est pas spécifié,
-le noeud utilisera la valeur donnée dans son port d'entrée de nom nsteps.
-Le tag forloop doit contenir la définition d'un et d'un seul noeud interne qui peut être un noeud élémentaire
-ou un noeud composé. On peut imbriquer des ForLoop sur plusieurs niveaux, par exemple. Si on veut avoir
-plus d'un noeud de calcul dans la ForLoop, il faut utiliser un Bloc comme noeud interne.
+Consider an example:
-Passons à un exemple::
+.. code-block:: xml
<forloop name="l1" nsteps="5">
<inline name="node2" >
</inline>
</forloop>
-On fait ici une boucle qui exécutera 5 tours sur un noeud script python.
-Les règles à respecter pour la création de liens sont les mêmes que pour les blocs. Pour faire des calculs
-itératifs, il faut pouvoir connecter un port de sortie d'un noeud interne avec un port d'entrée de
-ce même noeud interne. On utilise pour ce faire un lien data qui est défini dans le contexte du
-noeud ForLoop.
+This represents a loop that will be executed 5 times on a Python script node.
+The rules to be respected to create links are the same as for the blocks. To make iterative calculations, it must be possible
+to connect an output port of an internal node with an input port of this internal node. This is done using a data link that is
+defined in the context of the Forloop node.
+
+The following example applies to looping on port p1:
-Voici un exemple avec rebouclage sur le port p1::
+.. code-block:: xml
<forloop name="l1" nsteps="5">
<inline name="node2" >
</datalink>
</forloop>
-Enfin si le nombre de pas de la boucle est calculé, on utilisera le port d'entrée nsteps de la boucle
-comme dans l'exemple suivant::
+If the number of steps in the loop is calculated, the nsteps input port of the loop will be used as in the following example:
+
+.. code-block:: xml
<inline name="n" >
<script>
<tonode>l1</tonode> <toport>nsteps</toport>
</datalink>
+Finally, if the internal node needs to known the current step of the loop it can use the loop output port
+named "index".
+
+.. _xml_whileloop:
+
WhileLoop
''''''''''''
-Une WhileLoop est définie en utilisant le tag while. Il a un seul attribut obligatoire name qui porte le
-nom du noeud. Le port d'entrée de nom "condition" doit être connecté pour que la boucle soit valide.
+A WhileLoop is defined using the while tag. It has a single compulsory attribute “name”, that carries the node name.
+The input port with name “condition” must be connected for the loop to be valid.
+
+The following is an example of a While loop that increments the variable p1 until it exceeds the value 40:
-Voici un exemple de boucle while qui incrémente la variable p1 jusqu'à ce qu'elle dépasse la valeur 40::
+.. code-block:: xml
<while name="l1" >
<bloc name="b">
<value><int>23</int> </value>
</parameter>
-On peut bien sûr définir des boucles while imbriquées.
+Obviously, nested while loops can be defined.
-Boucle ForEach
+.. _xml_foreachloop:
+
+ForEach loop
''''''''''''''''
-Une boucle ForEach est définie en utilisant le tag foreach. Il a 2 attributs obligatoires :
-name qui porte le nom du noeud ForEach et type qui donne le type des éléments de la collection sur lequel
-la boucle va itérer. Un troisième attribut facultatif nbranch permet de fixer le nombre de branches
-parallèles que la boucle va gérer. Si cet attribut n'est pas fourni, il faut connecter le port de données
-d'entrée de la boucle nbBranches.
-Le tag foreach doit contenir la définition d'un et d'un seul noeud interne (élémentaire ou composé).
+The ForEach loop is defined using the foreach tag. It has 2 compulsory attributes: name that bears the name of the ForEach
+node and type that gives the type of elements in the collection on which the loop will iterate. A third optional attribute
+nbranch is used to fix the number of parallel branches that the loop will manage. If this attribute is not supplied, the input
+data port of the loop named "nbBranches" must be connected.
+The foreach tag must contain the definition of one and only one internal node (elementary or composite).
+
+The following is a minimal example of the ForEach loop:
-Voici un exemple minimal de boucle ForEach::
+.. code-block:: xml
<inline name="node0" >
<script>
<tonode>b1</tonode> <toport>SmplsCollection</toport>
</datalink>
<datalink>
- <fromnode>b1</fromnode><fromport>SmplPrt</fromport>
+ <fromnode>b1</fromnode><fromport>evalSamples</fromport>
<tonode>b1.node2</tonode> <toport>p1</toport>
</datalink>
<datalink>
<tonode>node1</tonode> <toport>p1</toport>
</datalink>
-Un premier noeud script Python construit une liste de double. Cette liste sera utilisée par la boucle ForEach
-pour itérer (connexion au port d'entrée SmplsCollection). Le noeud interne de la boucle est un noeud fonction
-Python qui ajoute 10 à l'élément qu'il traite. Enfin les résultats sont collectés et reçus par le noeud Python
-node1 sous la forme d'une liste de doubles.
+A first Python script node constructs a list of doubles. This list will be used by the ForEach loop to iterate (connection
+to the SmplsCollection input port). The internal node of the loop is a Python function node that adds 10 to the element that it processes.
+Finally, the results are collected and received by the Python node node1 in the form of a list of doubles.
+
+.. _xml_switch:
Switch
''''''''''
-Un noeud Switch est défini avec le tag switch. Il a un seul attribut obligatoire name qui porte le nom du noeud.
-Chaque cas est défini avec le sous tag case. Le cas par défaut est défini avec le sous tag default.
-Le tag case a un attribut obligatoire id qui doit être un entier.
-Le tag default n'a aucun attribut.
+A Switch node is defined with the switch tag. It has a single compulsory name attribute that carries the name of the node.
+Each case is defined with the case sub-tag. The default case is defined with the default sub-tag.
+The case tag has a compulsory id attribute that must be an integer. The default tag has no attribute.
-Un exemple minimal de switch::
+A minimal switch example:
+
+.. code-block:: xml
<inline name="n" >
<script>
<value><double>54</double> </value>
</parameter>
+.. _xml_optimizerloop:
+
+OptimizerLoop
+''''''''''''''''
+An OptimizerLoop node is defined with the **optimizer** tag. It has a compulsory name attribute that carries the name of the node.
+It has two other compulsory attributes (**lib** and **entry**) that define the C++ or Python plugin (parameters with same names).
+It can have the attribute **nbranch** or an input port **nbBranches** to define the number of branches of the loop.
+The OptimizerLoop ports (**nbBranches**, **algoInit**, **evalSamples**, **evalResults** and **algoResults**) need not be defined as they
+are already defined at the creation of the node.
+
+A minimal OptimizerLoop example:
+
+.. code-block:: xml
+
+ <optimizer name="b1" nbranch="1" lib="myalgo2.py" entry="async" >
+ <inline name="node2" >
+ <script>
+ <code><![CDATA[print "input node:",p1
+ p1=5
+ ]]></code>
+ </script>
+ <inport name="p1" type="double"/>
+ <outport name="p1" type="int"/>
+ </inline>
+ </optimizer>
+ <datalink>
+ <fromnode>b1</fromnode><fromport>evalSamples</fromport>
+ <tonode>b1.node2</tonode> <toport>p1</toport>
+ </datalink>
+ <datalink control="false" >
+ <fromnode>b1.node2</fromnode><fromport>p1</fromport>
+ <tonode>b1</tonode> <toport>evalResults</toport>
+ </datalink>
+
+
-Définition de containers
+Definition of containers
--------------------------------
-Les containers YACS doivent être définis juste après avoir défini les types de données
-avant la définition des noeuds de calcul. Un container est défini en utilisant le tag conatiner.
-Ce tag a un seul attribut obligatoire qui est le nom du container.
-Les contraintes sur le placement du container sont spécifiées au moyen de propriétés définies
-avec le sous tag property. Ce tag a 2 attributs obligatoires name et value qui donnent le nom
-de la contrainte et sa valeur sous forme de chaine de caractères.
+YACS containers must be defined immediately after data types have been defined and before calculation nodes are defined.
+A container is defined using the container tag. This tag has a single compulsory attribute that is the container name.
+Constraints on placement of the container are specified using properties defined with the property sub-tag.
+This tag has two compulsory attributes, the name and the value, that give the name of the constraint and its value in the
+form of a character string.
-Voici un exemple de container défini par l'IHM graphique::
+The following is an example of a container defined by the graphic user interface:
+
+.. code-block:: xml
<container name="DefaultContainer">
<property name="container_name" value="FactoryServer"/>
<property name="workingdir" value=""/>
</container>
-Une fois que les containers sont définis, on peut placer des composants SALOME sur ce container.
-Il suffit d'ajouter cette information dans la définition du noeud de service SALOME en utilisant
-le sous tag load. Ce tag a un seul attribut obligatoire de nom container qui donne le nom du container
-sur lequel le composant SALOME sera placé.
+Once containers have been defined, SALOME components can be placed on this container.
+This information simply has to be added into the definition of the SALOME service node using the load sub-tag.
+This tag has a single compulsory attribute named container that gives the name of the container on which the SALOME component will be located.
+
+If the SALOME service defined above is to be placed on the DefaultContainer container, we will write:
-Si on veut placer le service SALOME défini plus haut sur le container DefaultContainer, on écrira::
+.. code-block:: xml
<service name="node4" >
<component>AddComponent</component>
<outport name="z" type="double"/>
</service>
-Les propriétés de noeuds
+Node properties
-----------------------------
-On peut définir des propriétés pour tous les noeuds élémentaires ou composés.
-Cependant elles ne sont réellement utiles que pour les noeuds de service SALOME.
+Properties can be defined for all elementary and composite nodes.
+However, they will only really be useful for SALOME service nodes.
-Une propriété se définit en ajoutant un sous tag property dans la définition d'un noeud.
-Le tag property a 2 attributs obligatoires name et value qui portent le nom de la propriété
-et sa valeur sous la forme d'une chaine de caractères.
+A property is defined by adding a property sub-tag in the definition of a node.
+The property tag has 2 compulsory attributes, name and value, that carry the name of the property and its value in the form of a character string.
-Exemple avec un noeud de service SALOME::
+Example with a SALOME service node:
+
+.. code-block:: xml
<service name="node4" >
<component>AddComponent</component>
<outport name="z" type="double"/>
</service>
-Dans le cas d'un noeud de service SALOME la propriété est transmise au composant
-et, par défaut, positionnée en tant que variable d'environnement.
+In the case of a SALOME service node, the property is transmitted to the component and by default is set as an environment variable.
+
+.. _xml_active_study:
+
+Active study
+--------------
+To execute a schema in the context of a SALOME study, you have to set the **DefaultStudyID** property of the schema.
+
+Example to execute the schema in the study with studyId 5:
+
+.. code-block:: xml
-Les connexions datastream
+ <proc name="myschema">
+ <property name="DefaultStudyID" value="5"/>
+ ...
+ </proc>
+
+
+Datastream connections
----------------------------
-Les connexions datastream ne sont possibles que pour des noeuds de service SALOME comme
-on l'a vu dans :ref:`principes`. Il faut tout d'abord définir les ports datastream dans
-le noeud de service.
-Un port datastream d'entrée se définit avec le sous tag instream. Ce tag a 2 attributs
-obligatoires : name qui donne le nom du port et type qui donne le type de données
-supporté (voir :ref:`principes` pour les types datastream).
-Pour définir un port datastream sortant, on utilise le tag outstream à la place de instream.
-Pour définir une propriété associée au port, on utilise le sous tag property avec ses deux attributs
-name et value. Pour avoir la liste des propriétés possibles, voir la documentation CALCIUM.
-
-Voici un exemple de définition de noeud de service SALOME avec des ports datastream. Il s'agit du
-composant DSCCODC que l'on peut trouver dans le module DSCCODES de la base EXAMPLES.
-Les ports datastream sont de type entier avec dépendance temporelle. ::
+Datastream connections are only possible for SALOME service nodes, as we have seen in :ref:`principes`. Firstly, datastream ports
+have to be defined in the service node. An input datastream port is defined with the instream subtag.
+This tag has 2 compulsory attributes, firstly name that gives the port name and secondly type that gives the supported data
+type (see :ref:`principes` for datastream types).
+The outstream tag is used instead of the instream tag to define an output datastream port.
+The property sub-tag is used with its two attributes name and value to define a property associated with the port.
+See :ref:`calcium` for a list of possible properties.
+
+The following gives an example definition of the SALOME service node with datastream ports. It is the DSCCODC component
+that can be found in the DSCCODES module in the EXAMPLES base. Datastream ports are of the integer type with time dependence.
+
+.. code-block:: xml
<service name="node1" >
<component>DSCCODC</component>
</outstream>
</service>
-Pour définir des liens datastream, on utilise le tag stream.
-Les sous tags fromnode et fromport donne le nom du noeud et du port datastream
-sortant qui sera connecté au noeud et au port dont les noms sont donnés pat les
-sous tags tonode et toport.
-Un lien datastream peut être paramétré avec des propriétés (voir la documentation CALCIUM). Une propriété
-est définie avec le sous tag property.
+The stream tag is used to define datastream links. Fromnode and fromport sub-tags give the name of the node and the output
+datastream port that will be connected to the node and to the port, the names of which are given by the tonode and toport sub-tags.
+The parameters for a datastream link can be set with properties (see :ref:`calcium`).
+A property is defined with the property sub-tag.
+
+The following is a more complete example with parameters set for datastream links. There are two SALOME components with
+integer type datastream ports with time dependency (TIME_DEPENDENCY).
+The datastream connections use an explicit time scheme (TI_SCHEM).
-Voici un exemple plus complet avec des liens datastream paramétrés. On a deux composants SALOME
-avec ports datastream de type entier, avec dépendance temporelle (TIME_DEPENDENCY).
-Les connexions datastream utilisent un schéma temporel explicite (TI_SCHEM). ::
+.. code-block:: xml
<service name="node1" >
<component>DSCCODC</component>
<property name="DateCalSchem" value="TI_SCHEM"/>
</stream>
-D'autres noeuds élémentaires
+Other elementary nodes
--------------------------------
-Noeud SalomePython
+SalomePython node
'''''''''''''''''''''''
-Ce type de noeud se définit avec le tag sinline. Il a un attribut obligatoire name qui porte le nom
-du noeud. Pour le définir, on utilise les mêmes sous tags que pour le noeud fonction Python : function
-pour le code Python à exécuter, inport et outport pour définir ses ports de données entrants et sortants.
-Pour définir le placement sur un container, on utilise le sous tag load comme pour le noeud de service
-SALOME.
+This type of node is defined with the sinline tag. It has a compulsory attribute name that carries the node name.
+It is defined using the same sub-tags as for the Python function node: function for the Python code to be executed, inport
+and outport to define its input and output data ports.
+The placement on a container is defined using the load sub-tag as for the SALOME service node.
-Voici un exemple d'appel du composant PYHELLO depuis un noeud SalomePython::
+The following is an example of a call to the PYHELLO component from a SalomePython node:
+
+.. code-block:: xml
<sinline name="node1" >
<function name="f">
<inport name="p1" type="string"/>
</sinline>
-Le composant PYHELLO sera placé sur le container A. Le choix du container est du ressort de YACS.
-Le résultat du choix est accessible dans la variable python __container__from__YACS__ et est utilisé
-par le noeud pour charger le composant en utilisant le LifeCycle de SALOME.
+The PYHELLO component will be placed on container A. YACS selects the container. The result of the choice is accessible
+in the python __container_from_YACS__ variable and is used by the node to load the component using the SALOME LifeCycle.
+
+.. _xml_datain:
-Noeud DataIn
+Datain node
''''''''''''''''
-Ce type de noeud se définit avec le tag datanode. Il a un attribut obligatoire name qui porte le nom
-du noeud. Pour définir les données du noeud, on utilisera le sous tag parameter. Ce tag a deux
-attributs obligatoires name et type qui donnent respectivement le nom de la donnée et son type.
-La valeur initiale de la donnée est fournie par le sous tag value du tag parameter en utilisant
-l'encodage XML-RPC (voir :ref:`initialisation`)
+This type of node is defined with the datanode tag. It has a compulsory attribute name that carries the node name.
+Node data are defined using the parameter sub-tag. This tag has two compulsory attributes, name and type, that give
+the data name and its type respectively. The initial value of the data is supplied by the value sub-tag of the parameter tag
+using the XML-RPC coding (see :ref:`initialisation`).
+
+The following is an example of a DataIn node that defines two double type data (b and c) and a file type data (f):
-Voici un exemple de noeud DataIn qui définit 2 données de type double (b et c) et
-une donnée de type fichier (f)::
+.. code-block:: xml
<datanode name="a">
<parameter name="f" type="file">
<parameter name="c" type="double" ><value><double>-1.</double></value></parameter>
</datanode>
-Noeud DataOut
+.. _xml_dataout:
+
+DataOut node
''''''''''''''''
-Ce type de noeud se définit avec le tag outnode. Il a un attribut obligatoire name et un attribut facultatif ref.
-L'attribut name porte le nom du noeud. L'attribut ref donne le nom du fichier dans lequel
-les valeurs des résultats seront sauvegardées.
-Pour définir les résultats du noeud, on utilisera le sous tag parameter. Ce tag a deux
-attributs obligatoires name et type qui donnent respectivement le nom du résultat et son type
-et un attribut facultatif ref. Ce dernier attribut n'est utile que pour les résultats fichiers.
-S'il est renseigné, le fichier résultat sera copié dans le fichier dont le nom est donné par l'attribut. Sinon
-le fichier sera un fichier temporaire généralement localisé dans le répertoire /tmp (éventuellement
-sur une machine distante).
-
-Voici un exemple de noeud DataOut qui définit 5 résultats (a, b, c, d, f) de différents types (double,
-int, string, vecteur de doubles, fichier) et écrit les valeurs correspondantes dans le fichier g.data.
-Le fichier résultat sera copié dans le fichier local monfich::
+This type of node is defined with the outnode tag. It has a compulsory attribute, name and an optional attribute, ref.
+The name attribute carries the node name. The ref attribute gives the file name in which the values of results will be saved.
+The parameter sub-tag is used to define results of the node. This tag has two compulsory attributes, name and type, that
+give the result name and its type respectively, and one optional attribute, ref.
+The ref attribute is only useful for file results. If it is defined, the result file will be copied into the file with the
+name given by the attribute. Otherwise, the file will be a temporary file usually located in the /tmp directory (possibly on a remote machine).
+
+The following is an example of a DataOut node that defines 5 results (a, b, c, d, f) of different types (double, int,
+string, doubles vector, file) and writes the corresponding values in the g.data file.
+The result file will be copied into the local file myfile:
+
+.. code-block:: xml
<outnode name="out" ref="g.data">
<parameter name="a" type="double" />
<parameter name="b" type="int" />
<parameter name="c" type="string" />
<parameter name="d" type="dblevec" />
- <parameter name="f" type="file" ref="monfich"/>
+ <parameter name="f" type="file" ref="myfile"/>
</outnode>
-Noeud StudyIn
+.. _xml_studyin:
+
+StudyIn node
'''''''''''''''
-Ce type de noeud se définit comme un noeud DataIn avec le tag datanode. Il suffit d'ajouter l'attribut
-kind avec la valeur "study".
-L'étude associée est donnée par une propriété (tag property) de nom StudyID (dont la valeur est un entier).
+This type of node is defined as a DataIn node with the datanode tag. All that is necessary is to add the kind attribute
+with the “study” value. The associated study is given by a property (property tag) named StudyID (the value of which is an integer).
-Pour définir les données du noeud, on utilisera le sous tag parameter. Ce tag a deux
-attributs obligatoires name et type qui donnent respectivement le nom de la donnée et son type.
-L'attribut ref donne l'entrée dans l'étude sous la forme d'une Entry SALOME ou d'un chemin dans l'arbre d'étude.
+The parameter sub-tag will be used to define the node data. This tag has two compulsory attributes, name and type, that give the
+data name and type respectively. The ref attribute gives the input into the study in the form of a SALOME Entry, or a
+path in the study tree structure.
+
+The following is an example of a StudyIn node that defines 2 data (b and c) with types GEOM_Object and Boolean. It is assumed
+that SALOME has loaded the study (with StudyID 1) into memory. Data b is referenced by a SALOME Entry.
+The data c is referenced by a path in the study tree structure.
+
+.. code-block:: xml
-Voici un exemple de noeud StudyIn qui définit 2 données (b et c) de types GEOM_Object et booléen. L'étude
-est supposée chargée en mémoire par SALOME sous le StudyID 1. La donnée b est référencée par une Entry SALOME.
-La donnée c est référencée par un chemin dans l'arbre d'étude. ::
-
<datanode name="s" kind="study" >
<property name="StudyID" value="1" />
<parameter name="b" type="GEOM/GEOM_Object" ref="0:1:2:2"/>
<parameter name="c" type="bool" ref="/Geometry/Box_1"/>
</datanode>
-Noeud StudyOut
+.. _xml_studyout:
+
+StudyOut node
''''''''''''''''''
-Ce type de noeud se définit comme un noeud DataOut avec le tag outnode et l'attribut name.
-Il suffit d'ajouter l'attribut kind avec la valeur "study".
-L'attribut facultatif ref donne le nom du fichier dans lequel sera sauvegardée l'étude à la fin du calcul.
-L'étude associée est donnée par une propriété (tag property) de nom StudyID (dont la valeur est un entier).
+This type of node is defined as a DataOut node with the outnode tag and the name attribute.
+All that is necessary is to add the kind attribute with the value “study”.
+The optional ref attribute gives the name of the file in which the study will be saved at the end of the calculation.
+The associated study is given by a property (property tag) with name StudyID (the value of which is an integer).
+
+The parameter sub-tag will be used to define the node results. This tag has two compulsory attributes, name and type, that
+give the data name and type respectively. The ref attribute gives the entry into the study in the form of a SALOME Entry, or
+a path in the study tree structure.
-Pour définir les résultats du noeud, on utilisera le sous tag parameter. Ce tag a deux
-attributs obligatoires name et type qui donnent respectivement le nom du résultat et son type.
-L'attribut ref donne l'entrée dans l'étude sous la forme d'une Entry SALOME ou d'un chemin dans l'arbre d'étude.
+The following gives an example of the StudyOut node that defines 2 results (a and b) of the GEOM_Object type. The study used has
+the studyId 1. The complete study is saved in the study1.hdf file at the end of the calculation:
-Voici un exemple de noeud StudyOut qui définit 2 résultats (a et b) de type GEOM_Object. L'étude utilisée
-a le studyId 1. L'étude complète est sauvegardée en fin de calcul dans le fichier study1.hdf::
+.. code-block:: xml
<outnode name="o" kind="study" ref="stud1.hdf">
<property name="StudyID" value="1"/>
---------------------------------
In order to describe each main action let's describe step by step the creation of a simple schema from scratch.
-After launching of Salome 4.1 activate YACS module with help of :ref:`modules`. In order to create a new schema it is needed to choose **New Schema** command from :ref:`file` or from the corresponding toolbar button on the :ref:`schema`. Having these operations done the state of the Salome
-4.1 application would be like the following:
+After launching of SALOME activate YACS module with help of :ref:`modules`. In order to create a new schema it is needed to choose **New Schema** command from :ref:`file` or from the corresponding toolbar button on the :ref:`schema`. Having these operations done the state of the SALOME
+application would be like the following:
**A new empty schema is created**
-Create an inline script node by calling **Inline script** command from :ref:`creation`. As a result a new inline script node ( **PyScript0** in our example) without ports will be displayed in the 2D Viewer and the corresponding node object will be published in **Nodes** folder in the edition Tree View under the schema object.
+Create an inline script node by using the context menu on the **newSchema_1** node.
+.. image:: images/scratch1.jpg
+ :align: center
+As a result a new inline script node ( **PyScript0** in our example) without ports will be displayed in the 2D Viewer
+and the corresponding node object will be published in the edition Tree View under the schema object **newSchema_1**.
.. image:: images/functionality_list_84.jpg
:align: center
**Schema with a new created inline script node**
-Further by the same way it is easy to create, for example, FOR loop node by choosing **FOR loop** command from :ref:`creation`. To simplify schema presentation in the 2D Viewer and makes it easier for the user perception it is recommended to use auto-arrange graph nodes operation which is accessible from :ref:`visualization`.
-
-
+Further by the same way it is easy to create, for example, a FOR loop node by choosing **For Loop Node** entry
+in the context menu. To simplify schema presentation in the 2D Viewer and makes it easier for the user perception
+it is recommended to use auto-arrange graph nodes operation which is accessible from the context menu : entry **arrange local nodes**
+for an automatic placement on one level of nodes or entry **arrange nodes recursion** for an automatic placement
+on all levels.
.. image:: images/functionality_list_85.jpg
:align: center
.. centered::
- **FOR loop node has been added into the schema and 'Arrange nodes' operation has been applied**
+ **FOR loop node has been added into the schema**
-Let's create a block node as a body of a new FOR loop node. For this purpose it is needed to select this node object ( **ForLoop0** in our example) in the Tree View and call **Create a body --> Block** item from its context popup menu.
+Let's create a block node as a body of the new FOR loop node. For this purpose it is needed to select this node object ( **ForLoop1**
+in our example) in the Tree View and call **Create Node --> bloc Node** item from its context popup menu. This operation is also possible
+from the node context menu in the 2D Viewer.
**Creation of a body node**
-As a result of this operation a block node with empty content will be added inside FOR loop node as its body node. The presentation of the schema in the 2D Viewer will be changed and block node item ( **Bloc0** in our example) will appear in the Tree View structure under its father FOR loop node.
+As a result of this operation a block node with empty content will be added inside FOR loop node as its body node. The presentation of
+the schema in the 2D Viewer will be changed and block node item ( **Bloc2** in our example) will appear in the Tree View structure
+under its father FOR loop node.
**Tree View structure and presentation in the 2D Viewer after body block node creation**
-Now it's time to fill in created block node with a child nodes. Select block node item in the Tree View and call **Create a node --> From catalog** item from context popup menu.
+Now it's time to fill in created block node with a child nodes. Select block node item in the Tree View and call
+**Create Node --> Node from Catalog** item from context popup menu.
**Fill in block node content**
-Input Panel with catalogs' content is displayed on the right side of the applications' desktop. Choose **Add** method from **AddComponent** component and press "Apply" button.
+Input Panel with catalogs' content is displayed on the right side of the applications' desktop. Choose **Add** service
+from **AddComponent** component and drag and drop it onto the bloc node.
**Choose a SALOME service node from the session catalog**
-After closing the Input Panel we can see the following representation of a schema in the 2D Viewer.
+After the drag and drop, we can see the following representation of a schema in the 2D Viewer.
**SALOME service node is created inside the block**
-Tree View structure is changed and now block node contains one SALOME service node ( **SalomeNode0** in our case), which executes the method named **Add** from **AddComponent** component of Salome.
+Tree View structure is changed and now block node contains one SALOME service node ( **Add3** in our case), which executes
+the service named **Add** from **AddComponent** component of SALOME.
-So, the structure of the schema is defined and now it is the time to create input/output ports of schemas' nodes.
+So, the structure of the schema is defined and now it is time to create input/output ports of schemas' nodes.
-Firstly, let's consider inline script node **PyScript0** . To show Input Panel with node properties select **PyScript0** object either in the Tree View or in the 2D Viewer. Then activate "Output Ports" tab in the "Edit Ports" group of the Input Panel and click **+** button above the table of output ports. A new line corresponding to a new output port is added to the table. By default a new port is
-a dataflow port and has a type of double. Let's input **stepNum** in the "Name" column as a name of a new port, change the type of port to **int** with help of pull-down list of the "Type" column and type
+Firstly, let's consider inline script node **PyScript0**. To show Input Panel with node properties select **PyScript0** node
+either in the Tree View or in the 2D Viewer. Then activate "Output Ports" tab in the "Edit Ports" group of the Input Panel
+and choose a data type (**int**) in the drop down menu. A new line corresponding to a new output port is added to the table.
+This new port is a dataflow port and has a type of int. Let's input **stepNum** in the "Name" column as the name of the
+new port and type
.. sourcecode:: python
stepNum=3
-in the built-in python code editor as an inline python script of the node.
-
-
-
-.. image:: images/functionality_list_91.jpg
- :align: center
-
-
-.. centered::
- **Addition of output port and fill in python script for the PyScript0 node**
-
-
-After pressing "Apply" button on the Input Panel a new output port **stepNum** is added to the **PyScript0** node and the structure of the Tree View and nodes' presentation in the 2D Viewer are changed in order to reflect these modifications.
-
+in the built-in python code editor as an inline python script of the node. Finally, click on the **Apply** button to validate all
+the changes. The structure of the Tree View and nodes’ presentation in the 2D Viewer are changed in order to reflect these modifications.
.. image:: images/functionality_list_92.jpg
**2D Viewer and Tree View updates after port addition**
-Further, link **stepNum** output port of the **PyScript0** node with **nsteps** input port of the **ForLoop0** node. For this purpose the user should to select **stepNum** output port object in the Tree View and call **Add dataflow link** command from its context popup menu.
-
-
-
-.. image:: images/functionality_list_93.jpg
- :align: center
-
-
-.. centered::
- **Activate command for dataflow link addition**
-
-
-After that select the **nsteps** input port of the **ForLoop0** node either in the Tree View or in the 2D Viewer. This port is considered as the end port of a new created link. Now the state of the Salome 4.1 application should be as the following:
+Further, link **stepNum** output port of the **PyScript0** node with **nsteps** input port of the **ForLoop1** node. For this purpose
+the user should select **stepNum** output port object in the 2D Viewer and drag and drop it onto input port **nsteps** of the **ForLoop1** node.
+This port is considered as the end port of the newly created link. Now the state of the SALOME application should be as the following:
**A dataflow link is added**
-In order to make the presentation of the schema more convenient from the user point of view the links can be rebuilt with help of **Rebuild links** command from :ref:`visualization`.
+In order to make the presentation of the schema more convenient from the user point of view the links and nodes can be
+automatically placed with help of **arrange nodes recursion** command from the context menu of **newShema_1** node.
.. centered::
- **A schema 2D Viewer representation after links rebuilding**
+ **A schema 2D Viewer representation after nodes placement**
-To create a valid schema it is needed also to set the values for input ports of the **SalomeNode0** node. For this purpose the user should to activate the Input Panel with SALOME service node properties by selecting **SalomeNode0** node either in the Tree View or in the 2D Viewer and change the content of "Value" column to, for example, **4.4** and **-3.1** double values for **x** and **y** input
+To create a valid schema it is needed also to set the values for input ports of the **Add3** node. For this purpose the user should
+activate the Input Panel with SALOME service node properties by selecting **Add3** node either in the Tree View or in the 2D Viewer
+and change the content of "Value" column to, for example, **4.4** and **-3.1** double values for **x** and **y** input
port correspondingly.
.. centered::
**Set input ports values for SALOME service node**
-
-On the figure below the presentation of the schema after applying these changes is represented.
-
-
-
-.. image:: images/functionality_list_97.jpg
- :align: center
-
-
-.. centered::
- **Completely created schema**
-
-
-Now the schema is completely created. The user, for example, can export the schema into XML file (see :ref:`export_schema` section) for future import or execute this schema immediately (see :ref:`execute_schema` section).
+Now the schema is completely created. The user, for example, can export the schema into XML file (see :ref:`export_schema` section)
+for future import or execute this schema immediately (see :ref:`execute_schema` section).
</head>
<body>
<hr style="width: 100%; height: 2px;">
-<div style="text-align: center;">Copyright © 2003-2007 CEA, EDF<br>
+<div style="text-align: center;">Copyright © 2006-2011 CEA DEN, EDF R&D<br>
</div>
</body>
</html>
-.. image:: images/main_menu_5.jpg
+.. image:: images/main_menu_4.png
:align: center
- :width: 41ex
-.. image:: images/toolbars_0.jpg
+.. image:: images/toolbars_0.png
:align: center
- :width: 17ex
Module toolbar contains SALOME GUI module selector with a list of available modules and a set of toolbar buttons, one per module,
to activate the module.
-.. image:: images/toolbars_1.jpg
+.. image:: images/toolbars_1.png
:align: center
- :width: 33ex
.. _schema:
-Schema toolbar
---------------
+YACS toolbar, no schema loaded
+------------------------------
-.. image:: images/toolbars_2.jpg
+.. image:: images/toolbars_2.png
:align: center
- :width: 19ex
-Schema toolbar contains functions to import and export a schema. Schema toolbar contains the following toolbar buttons:
+YACS toolbar contents depends on the edition or execution mode. Without any schema loaded, the toolbar is restricted to functions to import and export a schema. Schema toolbar contains the following toolbar buttons:
-+ :ref:`create_new_schema`
++ :ref:`create_new_schema` : create a new schema from scratch
-+ Import Schema
++ :ref:`import_yacs_schema` : load a YACS schema saved on an XML file
- + :ref:`import_yacs_schema`
++ Load a Schema in run mode (without edition)
- + :ref:`import_supervisor_graph`
++ What's this mode : detailled help on a few items
+.. _edition_toolbar:
-+ :ref:`export_schema`
+YACS toolbar, edition mode
+------------------------------
-
-
-
-.. _creation:
-
-Creation toolbar
-----------------
-
-.. image:: images/toolbars_3.jpg
+.. image:: images/toolbars_3.png
:align: center
- :width: 9ex
-
-Creation toolbar contains functions for creation of container, component and node objects. Creation toolbar contains the following toolbar buttons:
-
+YACS toolbar in edition mode contains functions to import and export schemas, to switch to execution mode, to import catalogs, and to adjust behaviour of the 2D view:
-+ :ref:`create_container_definition`
++ :ref:`create_new_schema` : create a new schema from scratch
-+ :ref:`create_component_instance_definition`
++ :ref:`import_yacs_schema` : load a YACS schema saved on an XML file
++ Save Schema : save in the current opened file
++ :ref:`export_schema` : save with file dialog box to choose a new filename
-
-.. image:: images/toolbars_4.jpg
- :align: center
- :width: 32ex
-
-
++ :ref:`execute_schema` : switch from edition to run mode
++ :ref:`save_restore_execution_state` (from a state of execution saved previously)
-+ :ref:`create_node`
++ Load a Schema in run mode (without edition)
++ Load a Schema to be executed on a batch system
++ Undo last edition (modification of nodes positions in 2D view are not undoable)
++ Redo last edition
-.. image:: images/toolbars_5.jpg
- :align: center
- :width: 19ex
++ Import Catalog : to import specific data types or nodes
-.. _execution_toolbar:
++ Straight/Orthogonal : toggle between straight lines or orthogonal links
-Execution toolbar
------------------
-Execution toolbar provides the means to control schemas' execution process. The content of the Execution toolbar depends on the current schema mode.
-.. image:: images/toolbars_6.jpg
- :align: center
- :width: 9ex
++ Automatic Links: toggle behaviour for automatic link reconstruction when 2D View layout changes
-If the current mode is edition schema mode, the Execution toolbar consists of the following toolbar buttons:
++ Simplify Links: toggle behaviour for link simplification (less segments)
++ Separate Links: toggle behaviour to try to avoid or not superposition of links
++ Show all links: some links may have been selectively hidden
-+ :ref:`execute_schema`
++ Hide all links
-+ :ref:`save_restore_execution_state` (from a state of execution saved previously)
++ What's this mode : detailled help on a few items
-+ New Batch Execution ( **Will be available in the future version!** )
+.. _execution_toolbar:
-In such a case there are only possibilities to create execution or load execution state. 'Load execution state' operation means loading state of schemas' execution saved previously into XML file. After that the user has a possibility to continue execution of a schema from the loaded execution state.
+YACS toolbar, execution mode
+------------------------------
-If a run schema mode is currently activated, the Execution toolbar looks like
+.. image:: images/toolbars_4.png
+ :align: center
+YACS toolbar in execution mode contains functions to import and export schemas, to execute the schema, step by step, with breakpoints or straightforward, to save state of execution, to reedit the schema:
-.. image:: images/toolbars_7.jpg
- :align: center
- :width: 25ex
++ :ref:`create_new_schema` : create a new schema from scratch
-Here is a list of operations available from the Execution toolbar in the run schema mode. Operations are enumerated corresponding to its positions in the toolbar.
++ :ref:`import_yacs_schema` : load a YACS schema saved on an XML file
++ Load a Schema in run mode (without edition)
+ :ref:`Start/Resume <start_resume>`
-+ :ref:`Pause <pause_abort_reset>`
-
-
+ :ref:`Abort <pause_abort_reset>`
-+ :ref:`Reset <pause_abort_reset>`
-
-
-+ Execute in batch ( **Will be available in the future version!** )
++ :ref:`Pause <pause_abort_reset>`
-+ Connect to a running batch session ... ( **Will be available in the future version!** )
++ :ref:`Restart <pause_abort_reset>`
+ :ref:`save_restore_execution_state`
-+ :ref:`create_new_edition`
-
-
-
-.. _visualization:
-
-Visualization toolbar
----------------------
-Visualization toolbar contains functions to manage representation of a schema object and access to algorithms to simplify schemas' view (such as arrange nodes and rebuild links algorithms).
-
-.. image:: images/toolbars_8.jpg
- :align: center
- :width: 19ex
++ Set/reset Execution mode without stops
-Visualization toolbar has the same content both in the edition schema mode and run schema mode. It contains the following toolbar buttons:
++ Set/reset Execution mode with breakpoints
++ Set/reset Execution mode step by step
++ Set/reset Stop execution on the first error
-+ :ref:`Full View <full_view_of_a_schema>`
++ Straight/Orthogonal : toggle between straight lines or orthogonal links
-+ :ref:`Control View <control_view_of_a_schema>`
++ Automatic Links: toggle behaviour for automatic link reconstruction when 2D View layout changes
-+ Data Flow View ( **Will be available in the future version!** )
++ Simplify Links: toggle behaviour for link simplification (less segments)
-+ Data Stream View ( **Will be available in the future version!** )
++ Separate Links: toggle behaviour to try to avoid or not superposition of links
-+ :ref:`auto-arrange_nodes`
++ Show all links: some links may have been selectively hidden
-+ :ref:`rebuild_links`
++ Hide all links
+
++ What's this mode : detailled help on a few items
--- /dev/null
+
+.. _using-index:
+
+###############################
+ The YACS User Guide
+###############################
+
+There is an increasing need for multidisciplinary parametric simulations in various research and engineering fields.
+Examples are fluid-structure interaction and thermal coupling.
+The simulation tools have become very sophisticated in their own domains, so multidisciplinary simulation can be achieved
+by coupling the existing codes.
+
+YACS is a tool for managing multidisciplinary simulations through calculation schemes.
+
+The YACS module can be used to build and execute calculation schemes. A calculation scheme is a more or less complex
+assembly of calculation components (SALOME components or calculation codes or python scripts).
+Therefore, a calculation scheme provides a means of defining a chain or coupling of calculation codes (see :ref:`principes`).
+
+.. image:: images/ihm.png
+ :align: center
+
+.. centered::
+ YACS GUI
+
+A calculation scheme can be built either using a graphic tool (see :ref:`gui`),
+or by editing an XML file directly (see :ref:`schemaxml`), or by using
+an application programming interface (API) in Python (see :ref:`schemapy`).
+In this phase, chaining of components is defined with the associated dataflows.
+
+The calculation scheme can be executed from the graphic tool (see :ref:`execution`), but also in console
+mode (see :ref:`execxml`), or by using the Python interface (see :ref:`execpy`).
+
+Executing a calculation scheme includes:
+
+ - running and distributing components
+ - managing data distribution
+ - monitoring execution
+ - stopping / suspending / restarting the execution
+
+A calculation scheme can also be executed using a batch system such as LSF or PBS (see :ref:`batch`).
+
+Finally, it is essential that calculation codes should be transformed into SALOME components, so that they can
+be coupled with YACS. In general, this operation requires good knowledge of SALOME principles (see :ref:`integration`).
+
+For C++ calculation codes, the :ref:`hxx2salome` tool automates this operation to a large extent.
+
+For Fortran, C and Python calculation codes that use CALCIUM type coupling, the :ref:`yacsgen` tool automatically
+generates the necessary SALOME embedment starting from a brief description of the selected coupling interface.
+
+
+.. toctree::
+ :maxdepth: 2
+
+ rappels
+ principes
+ gui
+ console
+ python
+ batch
+ optimizer
+
+++ /dev/null
-//----------------------------------------------------------------------------------
-/*!
-// \file yacs.dox
-// \author Christian Caremoli
-// \date 2006-11
-*/
-//----------------------------------------------------------------------------------
-
-/*!
-\mainpage
-
- \section Introduction
-
- \b %YACS is a tool to supervise execution of complex interconnected
- scientific applications on computer networks and clusters.
- Interconnected scientific applications can be seen as a collection
- of computational tasks that are executed in a known order.
-
- In %YACS such a kind of application is described by a calculation schema.
- %A calculation schema can be defined with an XML syntax and is mainly
- a graph of nodes that refer to computational tasks or control structures.
- Nodes are connected by control and data flow links.
-
- \section Features
-
- - Build calculation schemas from XML files
- - Execute calculation schema (batch, step by step)
- - Can manage mainly Salome component nodes, inline python nodes but
- also to a lesser extent : C++ component nodes, XML component nodes
-
- \section Packages
-
- %YACS is composed of several packages
- - \subpage bases : common base classes (threads,...) and constants
- - \subpage engine : calculation schema generic classes (calculation nodes, control nodes,
- control and data flow links, ...)
- - \subpage runtime : implementation of generic calculation nodes for Salome platform
- - \subpage xml_loader : XML reader for generic calculation schema
- - \subpage gui_design : Graphic User Interface design
-
- A Python API is provided by wrapping with swig : \subpage python
-
- \section Building
-
- For building %YACS, you need some prerequisites
- - g++ 4.1 or more (mandatory)
- - libxml2 (mandatory)
- - expat (mandatory)
- - omniorb 4.1 or more (mandatory)
- - python 2.3 and + (mandatory)
- - swig 1.3.31 (mandatory)
- - cppunits (optional, for unit tests only)
- - Salome 4.1.x (optional)
-
- If you want to install %YACS for SALOME, you need to set environment
- variable: \b KERNEL_ROOT_DIR.
-
- If you want to install %YACS with SALOME GUI, you need to set environment
- variable: \b GUI_ROOT_DIR.
-
- The building process is the traditional configure/make/make install:
- - configure --prefix=path_to_install
- - make
-
- Then you can run unit tests if cppunits is installed :
- - make check
-
- Then you can run a small demo in Demo directory:
- - cd Demo
- - make
- - launch the echoSrv server : ./echoSrv& (if the omniorb name server is not
- running you need to launch it : omniNames -start -logdir /tmp & should be enough)
- - run yacs supervisor with the schema.xml file : ../src/yacsloader/driver schema.xml
-
- Finally you can install yacs:
- - make install
- - read the doc in doc directory
- - go to src/yacsloader/samples directory for XML examples
-
- \section TODOs
-
- Many things but mainly:
- - add resource management features
- - add GUIs
-
-*/
-
-/*! \defgroup TypeCodes TypeCodes
- */
-
-/*! \defgroup Nodes Nodes
- */
-
-/*! \defgroup Ports Ports
- */
-
-/*! \defgroup AdaptorPorts AdaptorPorts
- */
-
-/*! \defgroup Executors Executor objects
- */
-
:tocdepth: 3
-.. raw:: latex
-
- \makeatletter
- \g@addto@macro\@verbatim\small
- \makeatother
-
-
.. _yacsgen:
-YACSGEN : Générateur automatique de module SALOME
+YACSGEN: SALOME module generator
==================================================
-YACSGEN est un module python (module_generator.py) qui permet de fabriquer un module
-SALOME automatiquement à partir d'une description synthétique des composants
-qu'il contiendra. Cette description est faite en langage Python.
+YACSGEN is a python package (module_generator) that automatically fabricates a SALOME module starting
+from a synthetic description of the components that it will contain. This description is made in the python language.
-Les caractéristiques de ces composants ne sont pas générales mais devraient
-faciliter l'intégration de nombreux composants de calcul scientifique.
+YACSGEN includes since version 6.5 the HXX2SALOME functionalities, and is therefore able to also generate the
+implementation of C++ dataflow components.
-Ce générateur ne prend pas en charge l'intégration d'une IHM graphique mais seulement
-la partie calcul. L'objectif principal est l'intégration d'une bibliothèque Fortran dans laquelle
-on peut faire des appels aux ports datastream (Calcium, en particulier).
+The characteristics of these components are not general but they should facilitate integration of many scientific
+calculation components.
-Obtenir module_generator.py
-------------------------------------------------------------
-Voir site PAL : http://pal.der.edf.fr/pal/projets/pal/superv/modulegenerator
+How to get it
+-----------------------------------------------------------------
+It is a module (named YACSGEN) in the SALOME CVS TOOLS base that is distributed with main SALOME modules.
-Versions et architectures supportées
+Supported versions and architectures
-----------------------------------------------------------------
-Module_generator.py utilise des fonctionnalités de python 2.4 mais a un mode de compatibilité avec python 2.3.
-Il fonctionne sur architecture 32 bits et 64 bits (testé sur machine Aster).
+YACSGEN needs a Python version >= 2.4 and < 3.0. It runs on a 32-bit and 64-bit
+architecture.
Installation
----------------------------
-Il n'y a pas de procédure d'installation particulière. Il suffit de décompresser et détarrer l'archive
-obtenue à partir du site PAL (YACSGEN-x.y.tar.gz) et d'ajouter le répertoire ainsi créé au PYTHONPATH.
+If you get the source archive, simply decompress and untar the archive (YACSGEN-x.y.tar.gz)
+and add the directory thus created to PYTHONPATH. YACSGEN is also provided with binaries installation of SALOME.
-Description d'un module SALOME
+Description of a SALOME module
--------------------------------------------------------
-Un module SALOME est décrit au moyen d'instructions Python et en utilisant des définitions contenues
-dans le module Python module_generator.py.
+A SALOME module is described using Python instructions and definitions contained in the Python module_generator package.
-La première action à réaliser est d'importer ces définitions::
+The first action to be done is to import these definitions::
from module_generator import Generator,Module,PYComponent
from module_generator import CPPComponent,Service,F77Component
-Pour décrire un module SALOME, on donne son nom <nommodule>, la liste de ses composants (<liste des composants>)
-et le nom du répertoire dans lequel il sera installé (<prefix>).
+If you want to import all definitions, you can do that::
-Sa description prend la forme suivante ::
+ from module_generator import *
- m=Module(<nommodule>,components=<liste des composants>,prefix=<prefix>)
+A SALOME module is described by giving its name <modulename> together with the list of its
+components (<components list>) and the name of the directory in which it will be installed (<prefix>).
-Pour un module de nom "toto" avec un composant c1 (voir ci-dessous pour la description des composants) qui sera installé dans le
-répertoire "Install", on aura ::
+Its description is in the following form::
- m=Module("toto",components=[c1],prefix="Install")
+ m=Module(<modulename>,components=<components list>,prefix=<prefix>)
+The statement for a module named "mymodule" with a component c1 (see below for a description of components) that
+will be installed in the "Install" directory will be::
+ m=Module("mymodule",components=[c1],prefix="Install")
-Description des composants
+Description of components
------------------------------------------------
+Several types of components can be created:
-Il est possible de créer plusieurs types de composants :
-
- - le type C/C++
- - le type Fortran 77
- - le type Python
- - le type Aster
+- the C / C++ type
+- the Fortran 77 type
+- the Python type
+- the Aster type.
-Tous ces types ont une description semblable. On commencera par le type C++ puis
-on décrira les différences principales pour les autres types.
+All these types have a similar description. We will begin with the C++ type and then describe the main differences for the other types.
-Composant C/C++
+C / C++ component
++++++++++++++++++++++++++++++++++++++++
-Tout d'abord, un composant C++ a un nom. Ce nom sera utilisé par la suite quand on voudra créer
-des instances de ce composant. Le module SALOME, une fois compilé et installé contiendra une
-librairie dynamique de nom lib<compo>Engine.so, où <compo> est le nom du composant.
-Un composant C++ est implémenté comme un objet C++ exécutable à distance.
+Firstly, a C++ component has a name. This name will be used subsequently when it is required to create instances of this component.
+Once compiled and installed, the SALOME module will contain a dynamic library named lib<compo>Engine.so, in which <compo> is the component name.
+A C++ component is implemented as a remote executable C++ object.
-Un composant C++ a un ou plusieurs services. Chaque service a un nom qui est le nom de
-la méthode de l'objet C++ qui correspond au composant.
-Chaque service a, éventuellement, des ports dataflow d'entrée et de sortie et des ports datastream
-d'entrée et de sortie.
+A C++ component has one or several services. Each service has a name that is the name of the method of the C++ object
+that corresponds to the component. Each service may have input and output dataflow ports and input and output datastream ports.
-Un premier service avec des ports dataflow
+A first service with dataflow ports
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
-Pour le moment, les seuls types possibles pour les ports dataflow sont :
+The only possible types for dataflow ports for the moment are:
-- double : scalaire équivalent à un double C
-- long : scalaire équivalent à un long C
-- string : équivalent à un char* C (chaine de caractères de longueur quelconque)
-- dblevec : vecteur de doubles
-- stringvec : vecteur de string
-- intvec : vecteur de longs
-- pyobj : objet python serialisé avec pickle (ne marche qu'avec des composants implémentés en Python)
+- double: scalar equivalent to a C double
+- long: scalar equivalent to a C long
+- string: equivalent to a C char* (character string with arbitrary length)
+- file: a file object
+- dblevec: doubles vector
+- stringvec: strings vector
+- intvec: longs vector
+- pyobj: python object serialised with pickle (only works with components implemented in Python).
-Un port est décrit par un tuple python de longueur 2 dont la première valeur est le nom du port
-et la deuxième le nom du type. Les ports d'entrée sont décrits par une liste de ces tuples
-ainsi que les ports de sortie.
+A port is described by a python tuple with length 2, the first value is the name of the port and the second value is the type name.
+Input ports are described by a list of these tuples as well as the output ports.
-Un petit exemple vaut mieux qu'un long discours. Un composant de nom "moncompo" avec un service
-de nom "monservice" qui a un port dataflow d'entrée de nom "portentrant" de type double
-et un port dataflow de sortie de nom "portsortant" de type double aura la description suivante ::
+A small example is better than a long description. A component named “mycompo” with a service named “myservice” which has
+an input dataflow port named “inputport” of the double type and an output data flow port with name “outputport” of the double
+type will have the following description::
- c1=CPPComponent("moncompo",
+
+ c1=CPPComponent("mycompo",
services=[
- Service("monservice",
- inport=[("portentrant","double"),],
- outport=[("portsortant","double")],
+ Service("myservice",
+ inport=[("inputport","double"),],
+ outport=[("outputport","double")],
),
]
)
-c1 est une variable intermédiaire Python qui sera utilisée pour décrire la liste des composants d'un module : (components=[c1])
-pour un module avec un seul composant.
+c1 is an intermediate Python variable that will be used to describe the list of components of a
+module: (components=[c1]) for a module with a single component.
+
+In fact, this component is not particularly useful because during execution, it will take a double at the input to the
+execution and will provide a double at the output from the execution, but it does nothing in the meantime.
+Therefore, a content has to be added to it. This content will be specified in two service attributes, **defs** and **body**.
+- defs will contain the C++ definition code (for example, #include<iostream>)
+- body will contain the C++ code that will be executed between the input and the output (for example, outputport=2*inputport).
-En fait ce composant n'a pas grand intérêt car lors de l'exécution, il va prendre un double en entrée
-d'exécution et fournir un double en sortie d'exécution mais il ne fait rien entre temps.
-Il faut donc lui ajouter un contenu. Ce contenu sera spécifié dans 2 attributs du service : defs et body.
-defs contiendra du code C++ de définition (par exemple, #include <iostream>) et body contiendra le code C++
-qui sera exécuté entre l'entrée et la sortie (par exemple, portsortant=2*portentrant;).
-Au final notre description devient ::
+The final description becomes::
- c1=CPPComponent("moncompo",
+ c1=CPPComponent("mycompo",
services=[
- Service("monservice",
- inport=[("portentrant","double"),],
- outport=[("portsortant","double")],
+ Service("myservice",
+ inport=[("inputport","double"),],
+ outport=[("outputport","double")],
defs="#include <iostream>",
- body="portsortant=2*portentrant;",
+ body="outputport=2*inputport;",
),
]
)
-Ajouter des ports datastream au service
+Adding datastream ports to the service
""""""""""""""""""""""""""""""""""""""""""""""
-Pour ajouter des ports datastream au service "monservice", on ajoute à la description les attributs instream et outstream.
-Ces attributs doivent être des listes de triplets dont les éléments sont :
+Datastream ports are added to the “myservice” service by adding **instream** and **outstream** attributes to the description.
+These attributes must be lists of triplets with the following elements:
- 1. le nom du port
- 2. le type du port.
- 3. le mode de dépendance temporelle ("T") ou itérative ("I") (se référer à la documentation Calcium pour plus de détails)
+1. the port name
+2. the port type
+3. the time (“T”) or iteration (“I”) dependency mode (refer to :ref:`calcium` for further details)
-Les types possibles sont "CALCIUM_double", "CALCIUM_integer", "CALCIUM_real", "CALCIUM_string", "CALCIUM_logical"
-et "CALCIUM_complex".
+Possible types are “CALCIUM_double”, “CALCIUM_integer”, "CALCIUM_long", “CALCIUM_real”, “CALCIUM_string”, “CALCIUM_logical” and “CALCIUM_complex”.
-Avec un port datastream entrant et un port sortant en dépendance temporelle, la description devient ::
+The description for an input datastream port and an output port in time dependency becomes::
- c1=CPPComponent("moncompo",
+ c1=CPPComponent("mycompo",
services=[
- Service("monservice",
- inport=[("portentrant","double"),],
- outport=[("portsortant","double")],
+ Service("myservice",
+ inport=[("inputport","double"),],
+ outport=[("outputport","double")],
instream=[("porta","CALCIUM_double","T")],
outstream=[("portb","CALCIUM_double","T")],
defs="#include <iostream>",
- body="portsortant=2*portentrant;",
+ body="ouputport=2*inputport;",
),
]
)
-Il faudrait bien sûr ajouter dans body des appels à la bibliothèque CALCIUM pour que le service soit vraiment fonctionnel.
+Obviously, calls to the CALCIUM library have to be added into body to make the service genuinely functional.
-Ajouter un deuxième service au composant
+Adding a second service to the component
"""""""""""""""""""""""""""""""""""""""""""""""""
-Si on veut un deuxième service pour le composant il suffit d'ajouter une autre description de service ::
+If a second service has to be added for the component, simply add another service description::
- c1=CPPComponent("moncompo",
+ c1=CPPComponent("mycompo",
services=[
- Service("monservice",
- inport=[("portentrant","double"),],
- outport=[("portsortant","double")],
+ Service("myservice",
+ inport=[("inputport","double"),],
+ outport=[("outputport","double")],
instream=[("porta","CALCIUM_double","T")],
outstream=[("portb","CALCIUM_double","T")],
defs="#include <iostream>",
- body="portsortant=2*portentrant;",
- ),
+ body="ouputport=2*inputport;",
+ ),
Service("serv2",
inport=[("a","double"),("b","long")],
outport=[("c","double")],
]
)
-Ici, on a ajouté un deuxième service de nom "serv2" avec 2 ports dataflow d'entrée (a et b) et un port dataflow de sortie (c).
-Le service est réduit à sa plus simple expression : il retourne le produit de ses 2 entrées.
+In this description, a second service name “serv2” has been added with 2 input dataflow ports (a and b) and an output dataflow port (c).
+The service is reduced to its simplest expression: it returns the product of its 2 inputs.
-Assembler avec des bibliothèques externes
+Link with external libraries
""""""""""""""""""""""""""""""""""""""""""""""""""""
-On a vu que les attributs *defs* et *body* permettent de définir le corps du service mais il est souvent plus pratique d'utiliser des bibliothèques
-externes plutôt que de tout mettre dans ces 2 attributs.
-Ceci est possible à condition d'indiquer dans les attributs *libs* et *rlibs* du composant, tout ce qui est nécessaire pour l'étape de link
-du composant.
+We have seen that the **defs** and **body** attributes are sufficient to define the body of the service but it is often more practical
+to use external libraries rather than put everything into these 2 attributes. This is possible provided that everything necessary
+for the component link step is indicated in the **libs** and **rlibs** attributes of the component.
+
+For example, we can have::
-On pourra avoir, par exemple::
- c1=CPPComponent("moncompo",
+ c1=CPPComponent("mycompo",
services=[
- Service("monservice",
- inport=[("portentrant","double"),],
- outport=[("portsortant","double")],
+ Service("myservice",
+ inport=[("inputport","double"),],
+ outport=[("outputport","double")],
defs="extern double myfunc(double);",
- body="portsortant=myfunc(portentrant);",
+ body="outputport=myfunc(inputport);",
),
],
libs="-L/usr/local/mysoft -lmybib",
rlibs="-Wl,--rpath -Wl,/usr/local/mysoft"
)
-L'attribut *rlibs* n'est pas obligatoire mais peut être utilisé pour indiquer un path de recherche pour des bibliothèques
-dynamiques à l'exécution.
-*libs* est utilisé pendant la phase de link. *rlibs* est utilisé uniquement à l'exécution, il évite d'avoir à positionner
-la variable d'environnement LD_LIBRARY_PATH pour trouver la librairie dynamique.
+The **rlibs** attribute is not compulsory but it can be used to indicate a search path for dynamic libraries in execution.
+**libs** is used during the link phase. **rlibs** is only used during execution, it avoids the need to set the LD_LIBRARY_PATH
+environment variable to find the dynamic library.
-Ajouter des includes
+Adding includes
""""""""""""""""""""""""""""""""""""""""""""""""""""
-Les includes seront ajoutés au moyen de l'attribut *defs*. Par exemple ::
+Includes will be added using the **defs** attribute. For example::
- defs="#include "moninclude.h"
+ defs="""#include "myinclude.h" """
-Le chemin des includes sera spécifié dans l'attribut *includes* du composant, sous la forme suivante ::
+The includes path will be specified in the **includes** attribute of the component in the following form::
- defs="""#include "moninclude.h"
+
+ defs="""#include "myinclude.h"
extern double myfunc(double);
"""
- c1=CPPComponent("moncompo",
+ c1=CPPComponent("mycompo",
services=[
- Service("monservice",
- inport=[("portentrant","double"),],
- outport=[("portsortant","double")],
+ Service("myservice",
+ inport=[("inputport","double"),],
+ outport=[("outputport","double")],
defs=defs,
- body="portsortant=myfunc(portentrant);",
+ body="outputport=myfunc(inputport);",
),
],
libs="-L/usr/local/mysoft -lmybib",
includes="-I/usr/local/mysoft/include",
)
+Adding sources
+""""""""""""""""""""""""""""""""""""""""""""""""""""
+It is possible to add some source files with the **sources** attribute (a list of source files will be given).
+
+For example, instead of using an external library, we could implement the function myfunc in a file
+named myfunc.cpp. The description will be::
+
+ defs="""#include "myinclude.h"
+ extern double myfunc(double);
+ """
+ c1=CPPComponent("mycompo",
+ services=[
+ Service("myservice",
+ inport=[("inputport","double"),],
+ outport=[("outputport","double")],
+ defs=defs,
+ body="outputport=myfunc(inputport);",
+ ),
+ ],
+ sources=["myfunc.cpp"],
+ includes="-I/usr/local/mysoft/include",
+ )
+
+
+HXX2SALOME components
++++++++++++++++++++++
+
+For computational codes which exchange arrays, MED meshes and fields, the implementation of the SALOME component is more complex.
+hxx2salome is a Salome generation tool for dataflow C++ components, which is available in SALOME since version 4.
+
+Its principle is to start the integration of a code (written in Fortran/C/C++ or any C-compatible language)
+by writing a C++ layer (a class), which purpose is to drive the underlying code, and exchange data at C++ standard
+(c++ integral types, STL strings and vectors) and MED types for numerical meshes and fields.
+
+Then the Salome CORBA layer (a SALOME C++ component) is generated automatically by the tool.
+The implementation of the component, which has to be provided in standard YACSGEN through the defs and body attributes,
+is generated here through analysing the interface of the c++ layer written above the code.
+
+hxx2salome tool, although still available in Salome 6 as a standalone tool, was merged within YACSGEN.
+For the general principles of HXX2SALOME, and the detailed documentation, please refer to
+the HXX2SALOME chapter of this documentation (:ref:`hxx2salome`). We will only present here the embedded use of HXX2SALOME within YACSGEN.
+
+
+The tool can be used in two different ways:
+
+ - within a YACSGEN python script, by using the **HXX2SALOMEComponent** class combined with other YACSGEN CLASSES.
+ - with the **hxx2salome.py** script, a python executable which use YACSGEN classes to reproduce the interface of the former former hxx2salome bash script.
+
+
+using the **HXX2SALOMEComponent** class
+"""""""""""""""""""""""""""""""""""""""
+
+The merge of hxx2salome within YACSGEN was done by adding a new class, called **HXX2SALOMEComponent**, to the YACSGEN package.
+Given a C++ component (a C++ layer which wraps a computational code), HXX2SALOMEComponent class parses its interface
+(as defined in its .hxx header), extracts the public methods, analyses the types of these methods,
+and uses this type information to generate the implementation. All the information is then given to YACSGEN which generate a ready-to-use component.
+
+As an example, let's suppose we have a code called mycode, wrapped by a C++ layer
+(a dynamic library libmycodeCXX.so, and its interface "mycode.hxx", both located in directory mycodecpp_root_dir).
+To generate the SALOME C++ component, one should add in his YACS script: ::
+
+ from module_generator HXX2SALOMEComponent
+ c1=HXX2SALOMEComponent("mycode.hxx",
+ "libmycodeCXX.so",
+ mycodecpp_root_dir ) )
+
+The HXX2SALOMEComponent takes three arguments : the C++ header, the C++ library, and the path where to find them. The class does the parsing of c++ and generate all the necessary information for YACSGEN to generate the SALOME module.
-Composant Fortran
+Finally, if the code is parallel (mpi), one has to use instead the **HXX2SALOMEParaComponent**. This class work exactly in the same way, but generates also
+the mpi code necessary for a parallel SALOME component.
+
+
+Using **hxx2salome.py** executable
+""""""""""""""""""""""""""""""""""
+
+**hxx2salome.py** script is a python executable which use YACSGEN classes to reproduce the interface of the former hxx2salome bash script.
+The script takes optional arguments, followed by four mandatory arguments: ::
+
+ hxx2salome.py --help
+
+ usage:
+ hxx2salome.py [options] <CPPCOMPO>_root_dir lib<CPPCOMPO>.hxx <CPPCOMPO>.so installDir
+
+ generate a SALOME component that wrapps given the C++ component
+
+ Mandatory arguments:
+
+ - <CPPCOMPO>_root_dir : install directory (absolute path) of the c++ component
+ - <CPPCOMPO>.hxx : header of the c++ component"
+ - lib<CPPCOMPO>.so : the shared library containing the c++ component
+ - installDir : directory where the generated files and the build should be installed
+
+ Note that <CPPCOMPO>.hxx and lib<CPPCOMPO>.so should be found in <CPPCOMPO>_root_dir)
+
+
+
+ options:
+ -h, --help show this help message and exit
+ -e ENVIRON_FILE specify the name of a environment file (bash/sh) that will
+ be updated
+ -g to create a generic gui in your component building tree
+ -c to compile after generation
+
+
+The mandatory argument are respectively :
+ - the path where the C++ component was installed,
+ - within this path the name of the interface header,
+ - the name of the dynamic library,
+ - and finally the location where to generate and compile the Salome component.
+
+As an example, the command to generate the mycode component would be: ::
+
+ hxx2salome.py -c -g -e salome.sh
+ mycodecpp_root_dir mycode.hxx
+ libmycodeCXX.so <absolute path where to install generated component>
+
+
+
+
+Fortran component
++++++++++++++++++++++++++++++++++++++++
-Un composant Fortran se décrit comme un composant C++ à quelques différences près.
-Tout d'abord, on utilise l'objet de définition F77Component au lieu de CPPComponent.
-Ensuite, un interfaçage supplémentaire spécial au Fortran est réalisé. On suppose que les fonctionnalités Fortran
-sont implémentées dans une librairie (dynamique ou statique) qui sera linkée avec le composant et qui dispose de
-plusieurs points d'entrée de mêmes noms que les services du composant. L'appel à ce point d'entrée sera ajouté
-automatiquement après le code C++ fourni par l'utilisateur dans l'attribut body.
+A Fortran component is described like a C++ component, except that there are a few differences. Firstly, the F77Component
+definition object is used instead of the CPPComponent. Then, a special additional interface is made in Fortran.
+It is assumed that Fortran functions are implemented in a library (dynamic or static) that will be linked with the component and
+that will have several entry points with the same names as the component services. The call to this entry point will be added
+automatically after the C++ code supplied by the user in the **body** attribute.
-Ceci permet de découpler presque totalement l'implémentation du composant Fortran qui sera dans la bibliothèque
-externe, de l'implémentation du composant SALOME qui ne sert que pour l'encapsulation.
+This makes it possible to decouple practically the entire implementation of the Fortran component that will be in
+the external library or sources, from the implementation of the SALOME component that will only be used for encapsulation.
-L'exemple suivant permettra de préciser ces dernières notions ::
+The following example will be used to specify these final concepts::
c3=F77Component("compo3",
services=[
Service("s1",
- inport=[("a","double"),("b","long"),("c","string")],
- outport=[("d","double"),("e","long"),("f","string")],
+ inport=[("a","double"),("b","long"),
+ ("c","string")],
+ outport=[("d","double"),("e","long"),
+ ("f","string")],
instream=[("a","CALCIUM_double","T"),
("b","CALCIUM_double","I")],
outstream=[("ba","CALCIUM_double","T"),
rlibs="-Wl,--rpath -Wl,/usr/local/fcompo"
)
-Le composant Fortran "compo3" a des ports dataflow et datastream comme le composant C++. La bibliothèque dynamique Fortran
-qui contient le point d'entrée Fortran s1 sera linkée grâce aux attributs libs et rlibs de la description. Le composant
-Fortran supporte également l'attribut *includes*.
+The Fortran “compo3” component has dataflow and datastream ports like the C++ component. The Fortran dynamic library
+that contains the Fortran entry point *s1* will be linked by means of the **libs** and **rlibs** attributes of the description.
+The Fortran component also supports the **includes** and **sources** attributes.
+
+The Fortran subroutine with name **s1** must have a signature with a first argument that is used to transmit the address of
+the component and all following arguments that are used to transmit the values of the inport and outport ports. The instream and
+outstream ports are managed internally to the subroutine through calls to the CALCIUM API with the address of the component
+as first argument.
+
+An example of subroutine for the above definition follows:
+
+.. code-block:: fortran
+
+ SUBROUTINE S1(compo,A,B,C,D,E,F)
+ C implementation of service s1 with inport a,b,c and outport d,e,f and stream ports
+ include 'calcium.hf'
+ integer compo
+ real*8 a,d
+ integer b,e
+ character*(*) c,f
+
+ CALL cpldb(COMPO,CP_TEMPS,t0,t1,iter,'aa',1,n,ss,info)
+ CALL cpldb(COMPO,CP_ITERATION,t0,t1,iter,'ab',1,n,zz,info)
+ CALL cplen(COMPO,CP_ITERATION,t0,t1,iter,'ac',1,n,zn,info)
+ CALL cplre(COMPO,CP_ITERATION,t0,t1,iter,'ad',1,n,yr,info)
+ CALL cplch(COMPO,CP_ITERATION,t0,t1,iter,'ae',1,n,tch,info)
+ CALL cplcp(COMPO,CP_ITERATION,t0,t1,iter,'af',1,n,tcp,info)
+ CALL cpllo(COMPO,CP_ITERATION,t0,t1,iter,'ag',3,n,tlo,info)
+
+ CALL cpeDB(COMPO,CP_TEMPS,t0,1,'ba',1,tt,info)
+ CALL cpeDB(COMPO,CP_ITERATION,t0,1,'bb',1,tp,info)
+
+ d=4.5
+ e=3
+ f="zzzzzzzzzzzzzzz"
+
+ END
+
+As a special case, since version 5.1.4, the first argument (address of the component) is not included, if there is no
+instream and outstream ports.
+
+Same example without stream ports:
-Il est possible d'ajouter un bout de code C++ avant l'appel au point d'entrée Fortan. Ce bout de code doit être mis
-dans l'attribut body avec des définitions éventuelles dans defs. Ici, on utilise la variable dataflow entrante "c"
-pour faire un changement de répertoire avec l'appel à chdir.
+.. code-block:: fortran
-Composant Python
+ SUBROUTINE S1(A,B,C,D,E,F)
+ C implementation of service s1 with inport a,b,c and outport d,e,f
+ real*8 a,d
+ integer b,e
+ character*(*) c,f
+ d=4.5
+ e=3
+ f="zzzzzzzzzzzzzzz"
+ END
+
+A piece of C++ code can be added before the call to the Fortran entry point. This piece of code must be put into the **body**
+attribute with any definitions in **defs**. In this case, we use the “c” input dataflow variable to change the directory with the call to chdir.
+
+Python component
++++++++++++++++++++++++++++++++++++++++
-Un composant Python se décrit également comme un composant C++. Les seules différences portent sur l'objet Python
-à utiliser pour le définir : PYComponent au lieu de CPPComponent et sur le contenu des attributs *defs* et *body*
-qui doivent contenir du code Python et non C++ (attention à l'indentation, elle n'est pas prise en charge automatiquement).
+A Python component is also described like a C++ component. The only differences are in the Python object to be used to
+define it: PYComponent instead of CPPComponent and in the content of the **defs** and **body** attributes that must contain
+Python code and not C++.
+
+.. warning::
+ The indentation of the complete block of code is automatically handled but not the internal indentation of the block.
-Exemple de composant Python ::
+Example Python component::
- pyc1=PYComponent("moncompo",
+ pyc1=PYComponent("mycompo",
services=[
- Service("monservice",
- inport=[("portentrant","double"),],
- outport=[("portsortant","double")],
+ Service("myservice",
+ inport=[("inputport","double"),],
+ outport=[("outputport","double")],
defs="import sys",
- body=" portsortant=2*portentrant;",
+ body=" outputport=2*inputport;",
),
]
)
-L'équivalent de l'assemblage avec des bibliothèques externes est réalisé ici avec la possibilité d'importer des modules
-Python externes. Il suffit d'ajouter l'attribut *python_path* à la description du composant pour avoir cette possibilité. La valeur
-à donner est une liste de répertoires susceptibles de contenir des modules à importer.
+The equivalent of the assembly with external libraries is done in this case with the possibility of importing external
+Python modules. Simply add the **python_path** attribute to the description of the component to obtain this possibility.
+The value to be given is a list of directories that might contain modules to be imported.
-Exemple::
+Example::
- pyc1=PYComponent("moncompo",
+ pyc1=PYComponent("mycompo",
services=[
- Service("monservice",
- inport=[("portentrant","double"),],
- outport=[("portsortant","double")],
+ Service("myservice",
+ inport=[("inputport","double"),],
+ outport=[("outputport","double")],
),
],
python_path=["/usr/local/mysoft","/home/chris/monsoft"],
)
-Composant Aster
+.. _aster:
+
+Aster component
++++++++++++++++++++++++++++++++++++++++
-Un composant Aster est un composant un peu particulier car les fonctionnalités du logiciel sont implémentées en Fortran mais elles
-sont activées par un superviseur de commandes écrit en Python. Au final ce superviseur exécute un script Python mais il faut gérer le transfert
-des données entre Python et Fortran et l'intégration du superviseur de commandes dans un composant SALOME.
+*Code_Aster* is a software package for finite element analysis and numeric simulation in structural mechanics developed by EDF.
+
+An Aster component is a component that is a little bit special because the software functions are implemented in Fortran but
+they are activated by a command supervisor written in Python. Finally, this supervisor executes a Python script but the data
+transfer between Python and Fortran and the integration of the command supervisor into a SALOME component have to be managed.
-Le point de départ est le suivant : on suppose que l'on dispose d'une installation d'Aster qui fournit un module python aster
-sous la forme d'une bibliothèque dynamique importable (astermodule.so) et non comme c'est le cas dans l'installation actuelle
-d'un interpréteur Python spécifique linké avec ce même module.
+The start point is that it is assumed that there is an Aster installation that provides an aster python module in the form of
+an importable dynamic library (astermodule.so) and not a specific Python interpreter linked with this module, as is the case
+in the existing installation.
-Un composant Aster se décrit comme un composant Python auquel il faut ajouter plusieurs attributs
-importants.
+An Aster component is described as a Python component to which several important attributes have to be added.
- - l'attribut *python_path* : il indique le chemin du répertoire contenant le module aster (astermodule.so)
- - l'attribut *aster_dir* : il indique le chemin du répertoire d'installation d'Aster
- - l'attribut *argv* : il initialise les paramètres de la ligne de commande. On y mettra, par exemple la valeur
- de memjeveux (``argv=["-memjeveux","10"]``) ou de rep_outils.
+- the **python_path** attribute: this indicates the path of the directory containing the aster module (astermodule.so)
+- the **aster_dir** attribute: this indicates the path of the Aster installation directory
+- the **argv** attribute: this initialises command line parameters. For example, it will be set equal to the value
+ of memjeveux (``argv=[“-memjeveux”,”10”]``) or rep_outils.
-Voici un petit exemple de description de composant Aster avec un seul service doté de 3 ports dataflow d'entrée,
-d'un port dataflow de sortie, de 7 ports datastream d'entrée et d'un port datastream de sortie::
+The following shows a small example description of an Aster component with a single service provided with 3 input dataflow
+ports, one output dataflow port, 7 input datastream ports and one output datastream port::
c1=ASTERComponent("caster",
services=[
Service("s1",
- inport=[("a","double"),("b","long"),("c","string")],
+ inport=[("a","double"),("b","long"),
+ ("c","string")],
outport=[("d","double")],
instream=[("aa","CALCIUM_double","T"),
("ab","CALCIUM_double","I"),
"-rep_outils","/local/chris/ASTER/instals/outils"],
)
-Attention à ne pas appeler le composant "aster" car ce nom est réservé au module python de Code_Aster. En cas
-d'utilisation du nom "aster", le comportement est complètement erratique.
+.. warning::
+ Do not use the name “aster” for the component because this name is reserved for the *Code_Aster* python module.
+ If the name “aster” is used, the behaviour will be completely erratic.
-Bien que sa description soit très semblable à celle d'un composant Python, il y a une différence importante à l'utilisation.
-En effet, le composant Aster a besoin de la description d'un jeu de commandes pour fonctionner. Ce jeu de commandes
-est passé sous la forme d'un texte à chaque service du composant dans un port dataflow d'entrée de nom "jdc" et
-de type "string".
-Après génération, ce composant Aster aura donc 4 ports dataflow d'entrée ("jdc","a","b","c") et non 3 comme indiqué
-dans la description. Il ne faut pas oublier d'initialiser le port "jdc" dans le fichier de couplage avec un jeu de commandes.
+Although its description is very similar to the behaviour of a Python component, there is an important difference in use.
+The Aster component needs the description of a command set to run. This command set is transferred to each service of the
+component in the form of a text in an input dataflow port named “jdc” with type “string”. Therefore after generation, this
+Aster component will have four input dataflow ports (“jdc”, “a”, “b”, “c”) and not three as indicated in the description.
+It is important not to forget to initialise the “jdc” port in the coupling file with a command set.
-Le superviseur de commandes a été intégré dans un composant SALOME et les variables reçues dans les ports dataflow
-sont disponibles lors de l'exécution du jeu de commandes.
-De même pour les ports dataflow de sortie, ils sont alimentés par les valeurs des variables issues de l'exécution
-du jeu de commandes.
+The command supervisor has been integrated into a SALOME component and the variables received in the dataflow ports are available
+during execution of the command set. Similarly, values for output dataflow ports are defined by values of variables derived
+from execution of the command set.
-**Attention au mode d'exécution**. Le superviseur de commandes a 2 modes d'exécution (PAR_LOT="OUI" ou PAR_LOT="NON"
-que l'on spécifie dans la commande DEBUT). En mode PAR_LOT="OUI", il est obligatoire de terminer le jeu de commandes
-par une commande FIN ce qui a pour effet d'interrompre l'exécution. Ce n'est pas le fonctionnement à privilégier
-avec YACS. Il est préférable d'utiliser le mode PAR_LOT="NON" sans mettre de commande FIN ce qui évite d'interrompre
-l'exécution prématurément.
+.. warning::
+ **Beware with the execution mode**. The command supervisor has 2 execution modes (PAR_LOT=”OUI” or PAR_LOT=”NON” that are
+ specified in the DEBUT command) (PAR_LOT = BY_BATCH). In PAR_LOT=”OUI” mode, it is compulsory to terminate the command set
+ with a FIN (END) command which has the effect of interrupting execution. This is not the preferred method of operation with YACS.
+ It is preferable to use PAR_LOT=”NON” mode without adding the FIN command, which avoids interrupting the execution prematurely.
-Module Aster dynamiquement importable et lien avec YACS
+Dynamically importable Aster module and link with YACS
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-Ces deux points ne sont pas pris en charge par *module_generator.py*. Ils doivent être traités séparément dans un contexte
-proche de celui d'un développeur Aster.
+These two points are not handled by YACSGEN. They must be processed separately in a context similar to the context of an Aster developer.
-On suppose que l'on dispose d'une installation d'Aster, que l'on veut créer un module Python aster dynamiquement importable
-et que l'on veut ajouter à Aster quelques commandes pour échanger des données via des ports datastream de YACS.
+It is assumed that there is an Aster installation, that it is required to create a dynamically importable Python Aster module, and
+that a few commands are to be added to Aster to exchange data through YACS datastream ports.
-Pour rester simple, on ajoute 3 commandes : YACS_INIT, ECRIRE_MAILLAGE et LECTURE_FORCE dont les catalogues sont::
+To remain simple, three commands: YACS_INIT, ECRIRE_MAILLAGE and LECTURE_FORCE are added, for which the catalogs are::
- YACS_INIT=PROC(nom="YACS_INIT",op=181, fr="Initialisation YACS",
+ YACS_INIT=PROC(nom="YACS_INIT",op=181, fr="YACS initialisation",
COMPO=SIMP(statut='o',typ='I'),
)
- ECRIRE_MAILLAGE=PROC(nom="ECRIRE_MAILLAGE",op=78, fr="Ecriture du maillage")
- LECTURE_FORCE=PROC(nom="LECTURE_FORCE",op=189, fr="Lecture de la force")
+ ECRIRE_MAILLAGE=PROC(nom="ECRIRE_MAILLAGE",op=78, fr="write mesh")
+ LECTURE_FORCE=PROC(nom="LECTURE_FORCE",op=189, fr="read force")
+
+The first YACS_INIT command initialises Aster in the YACS context. It has a single simple keyword COMPO (integer type) that
+will be used to transfer the SALOME component identifier to other commands. This identifier will be stored in a Fortran COMMON.
+It is essential for calls to subprograms CPLxx and CPExx that will be used in the other two ECRIRE_MAILLAGE and LECTURE_FORCE commands.
-La première commande YACS_INIT sert à initialiser Aster dans le contexte YACS. Elle a un seul mot-clé simple COMPO
-(de type entier) qui sera utilisé pour passer aux autres commandes l'identificateur du composant SALOME. Cet
-identificateur sera stocké dans un COMMON fortran. Il est indispensable pour les appels aux sous programmes
-CPLxx et CPExx qui seront utilisés dans les 2 autres commandes ECRIRE_MAILLAGE et LECTURE_FORCE.
+The other two commands do not have any keyword and they retrieve the identifier from the COMMON.
-Les 2 autres commandes ne prennent n'ont aucun mot-clé et récupèrent l'identificateur dans le COMMON.
+The operators will be written as follows (without the declarations):
-Les opérateurs seront écrits comme suit (sans les déclarations)::
+.. code-block:: fortran
SUBROUTINE OP0189 ( IER )
C COMMANDE: LECTURE_FORCE
CALL cpeDB(ICOMPO,CP_ITERATION,t0,1,'bb',1,tp,info)
END
-Enfin, il faut construire une bibliothèque dynamique astermodule.so, et placer tous les modules Python
-nécessaires dans un répertoire que l'on indiquera dans l'attribut *python_path*.
-On peut utiliser différentes méthodes pour obtenir ce résultat. Le Makefile suivant en est une::
+Finally, an astermodule.so dynamic library must be constructed, and all necessary Python modules must be placed in a directory
+that will be indicated in the **python_path** attribute. Different methods can be used to obtain this result.
+The following Makefile is one of them:
- #compilateur
+.. code-block:: make
+
+ #compiler
FC=gfortran
#SALOME
- KERNEL_ROOT_DIR=/local/chris/SALOME2/RELEASES/Install/KERNEL_V4_0
+ KERNEL_ROOT_DIR=/local/chris/SALOME/RELEASES/Install/KERNEL_V5
KERNEL_INCLUDES=-I$(KERNEL_ROOT_DIR)/include/salome
KERNEL_LIBS= -L$(KERNEL_ROOT_DIR)/lib/salome -lCalciumC -lSalomeDSCSuperv \
-lSalomeDSCContainer -lSalomeDatastream -lSalomeDSCSupervBasic \
astermodule.so: $(SOURCES)
$(FC) -shared -o $@ $(SOURCES) $(KERNEL_INCLUDES) $(ASTER_LIBS) $(KERNEL_LIBS)
-Modifier les paramètres de la ligne de commande à l'exécution
+Modify command line parameters during execution
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-L'attribut *argv* permet de donner des valeurs initiales aux arguments comme "memjeveux" mais
-ces valeurs sont utilisées par le générateur pour construire le composant et restent donc constantes
-par la suite, à l'exécution.
+The **argv** attribute gives initial values to arguments such as “memjeveux” but these values are used by the generator to
+build the component and therefore remain constant afterwards during execution.
-Pour modifier ces valeurs à l'exécution, il faut ajouter un port d'entrée de nom "argv" et de type "string".
-La chaine de caractère qui sera donnée comme valeur de ce port sera utilisée par le composant pour
-modifier les arguments de la ligne de commande (voir `Exemple d'exécution de composant Aster`_
-pour un exemple d'utilisation).
+If you want to modify these values during execution, you need to add an input port named “argv” with type “string”. The character
+string that will be given as the value of this port will be used by the component to modify the arguments of the command
+line (see :ref:`execaster` for an example use).
-Gestion du fichier elements
+Management of the elements file
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-Le fichier des éléments finis est copié automatiquement dans le répertoire de travail sous le
-nom elem.1. Le composant utilise l'attribut *aster_dir* pour localiser le fichier d'origine.
+The finite elements file is automatically copied into the working directory under the name elem.1.
+The component uses the **aster_dir** attribute to locate the origin file.
-Version d'Aster supportées
+Supported Aster versions
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-Module_generator.py peut fonctionner avec Aster 9.0 et 9.2 (probablement avec 9.1 mais
-ce n'est pas testé).
+YACSGEN can function with Aster 9 and higher versions.
-Générateur de module SALOME
+SALOME module generator
-----------------------------------------------------------
-Le module SALOME est créé par un générateur construit à partir de la description du module SALOME (m) vue
-précédemment et d'un dictionnaire Python (context) qui fournit quelques paramètres d'environnement ::
+The SALOME module is created by a generator constructed from the description of the SALOME module (m) seen previously
+and a Python dictionary (context) that provides some environment parameters::
- g=Generator(m,context)
+ g=Generator(m,context)
-Les paramètres indispensables pour context sont :
+The following parameters are mandatory for this context:
- - "prerequisites" : indique le chemin d'un shell script qui positionne les variables d'environnement
- des prérequis de SALOME
- - "kernel" : indique le chemin d'installation du module KERNEL de SALOME
- - "update" : mettre à 1 pour le moment (futurs développements)
+- **prerequisites**: indicates the path of a shell script that sets the environment variables of SALOME prerequisites
+- **kernel**: indicates the installation path of the SALOME KERNEL module
+- **update**: set equal to 1 at the moment (future development)
-Exemple de création de générateur ::
+Example creation of generator::
context={'update':1,
- "prerequisites":"/local/cchris/.packages.d/envSalome40",
- "kernel":"/local/chris/SALOME2/RELEASES/Install/KERNEL_V4_0"
+ "prerequisites":"/local/cchris/.packages.d/envSalome",
+ "kernel":"/local/chris/SALOME/RELEASES/Install/KERNEL_V5"
}
g=Generator(m,context)
-Une fois ce générateur créé, il suffit d'appeler ses commandes pour réaliser les opérations nécessaires.
+Once this generator has been created, simply call its commands to perform the necessary operations.
- - génération du module SALOME : ``g.generate()``
- - initialisation d'automake : ``g.bootstrap()``
- - exécution du script configure : ``g.configure()``
- - compilation : ``g.make()``
- - installation dans le répertoire <prefix> : ``g.install()``
- - création d'une application SALOME dans le répertoire appli_dir ::
+- SALOME module generation: ``g.generate()``
+- initialise automake: ``g.bootstrap()``
+- execute the configure script: ``g.configure()``
+- compilation: ``g.make()``
+- installation in the directory <prefix>: ``g.install()``
+- create a SALOME application in the directory **appli_dir**::
g.make_appli(appli_dir,restrict=<liste de modules>,
altmodules=<dictionnaire de modules>)
-Ces commandes ne prennent pas de paramètres sauf make_appli qui en prend 3 :
+These commands do not use any parameters except for make_appli that uses 3 parameters:
- - **appliname** : le nom du répertoire qui contiendra l'application SALOME
- - **restrict** : une liste de noms de modules SALOME à mettre dans l'application. Par défaut, make_appli
- met dans l'application tous les modules SALOME qu'il est capable de détecter (répertoire voisins de
- KERNEL avec le même suffixe que KERNEL. Si le répertoire du module KERNEL s'appelle KERNEL_V41, il
- retiendra GUI_V41, GEOM_V41, etc.). Si restrict est fourni, make_appli ne retiendra que les modules listés.
- - **altmodules** : un dictionnaire de modules autres. La clé donne le nom du module. La valeur correspondante
- donne le chemin du répertoire d'installation du module. Exemple : ``altmodules={"monmodule":"/local/chris/unmodule"}``
+- **appliname**: the name of the directory that will contain the SALOME application
+- **restrict**: a list of SALOME module names to put into the application. By default, make_appli puts all SALOME modules
+ that it can detect into the application (neighbour directories of KERNEL with the same suffix as KERNEL. If the directory
+ of the KERNEL module is called KERNEL_V5, then it will use GUI_V5, GEOM_V5, etc.). If restrict is provided, make_appli will
+ only use the modules listed.
+- **altmodules**: a dictionary of other modules. The key gives the name of the module. The corresponding value gives the path
+ of the module installation directory. For example ``altmodules={"mymodule":"/local/chris/amodule"}``
-
-Fabrication du module SALOME
+Fabrication of the SALOME module
-----------------------------------------------------
-Le module sera fabriqué en exécutant un fichier Python qui contient sa description, la mise en données du
-générateur et les commandes du générateur.
+The module will be fabricated by executing a Python file that contains its description, by inputting data into the generator
+and generator commands.
+
+This gives something like the following for a module with a single Fortran component:
-Ce qui donne quelque chose comme ce qui suit pour un module avec un seul composant Fortran::
+.. code-block:: python
from module_generator import Generator,Module
from module_generator import PYComponent,CPPComponent,Service,F77Component
context={"update":1,
- "prerequisites":"/local/cchris/.packages.d/envSalome40",
- "kernel":"/local/chris/SALOME2/RELEASES/Install/KERNEL_V4_0"
- }
- c3=F77Component("compo",
+ "prerequisites":"/local/cchris/.packages.d/envSalome",
+ "kernel":"/local/chris/SALOME/RELEASES/Install/KERNEL_V5"
+ }
+
+
+ c1=F77Component("compo",
services=[
Service("s1",
- inport=[("a","double"),("b","long"),("c","string")],
- outport=[("d","double"),("e","long"),("f","string")],
+ inport=[("a","double"),
+ ("b","long"),
+ ("c","string")],
+ outport=[("d","double"),("e","long"),
+ ("f","string")],
instream=[("a","CALCIUM_double","T"),
("b","CALCIUM_double","I")],
outstream=[("ba","CALCIUM_double","T"),
body="chdir(c);"
),
],
- libs="-L/local/chris/modulegen/YACSGEN/fcompo -lfcompo"
+ libs="-L/local/chris/modulegen/YACSGEN/fcompo -lfcompo",
rlibs="-Wl,--rpath -Wl,/local/chris/modulegen/YACSGEN/fcompo")
- m=Module("toto",components=[c1],prefix="Install")
+ m=Module("mymodule",components=[c1],prefix="Install")
g=Generator(m,context)
g.generate()
g.bootstrap()
g.install()
g.make_appli("appli",restrict=["KERNEL","GUI","YACS"])
-Si cette description est dans le fichier monmodule.py, il suffit d'exécuter::
+If this description is in the mymodule.py file, all that is required is to execute::
- python monmodule.py
+ python mymodule.py
-ce qui a pour effet de créer le répertoire source du module (toto_SRC), le répertoire d'installation du module (Instal)
-et un répertoire d'application SALOME (appli).
+which has the effect of creating the module source directory (mymodule_SRC), the module installation directory (Install) and a
+SALOME application directory (appli).
-Il faut bien sûr que le module module_generator.py puisse être importé soit en étant dans le répertoire courant soit en étant
-dans le PYTHONPATH.
+Obviously, it must be possible to import the **module_generator** package either while being in the current directory or in the PYTHONPATH.
-Il est toujours préférable (bien que non indispensable) de faire le ménage dans le répertoire de travail avant d'exécuter
-le générateur.
+It is always preferable (although not essential) to clean up the working directory before executing the generator.
-Mise en oeuvre du composant dans un couplage
+Using the component in a coupling
-----------------------------------------------------------------------------------------
-Creation du fichier de couplage YACS
+Create the YACS coupling file
++++++++++++++++++++++++++++++++++++++++
-Un fichier de couplage YACS est un fichier XML qui décrit la façon dont des composants SALOME préalablement
-installés dans une application SALOME sont couplés et exécutés.
+A YACS coupling file is an XML file that describes how SALOME components previously installed in a SALOME application are coupled and executed.
-Pour une documentation sur la façon d'écrire un fichier XML YACS, voir :ref:`schemaxml`.
+See :ref:`schemaxml` for documentation about how to write a YACS XML file.
-Voici un exemple de fichier YACS mettant en oeuvre le composant Fortran défini ci-dessus ::
+The following is an example of a YACS file using the Fortran component defined above:
+
+.. code-block:: xml
<proc>
<container name="A"> </container>
</parameter>
<parameter>
<tonode>pipo1</tonode> <toport>c</toport>
- <value><string>/local/cchris/SALOME2/SUPERV/YACS/modulegen/data1</string> </value>
+ <value><string>/local/cchris/SALOME/SUPERV/YACS/modulegen/data1</string> </value>
</parameter>
<parameter>
<tonode>pipo2</tonode> <toport>a</toport>
</parameter>
<parameter>
<tonode>pipo2</tonode> <toport>c</toport>
- <value><string>/local/cchris/SALOME2/SUPERV/YACS/modulegen/data2</string> </value>
+ <value><string>/local/cchris/SALOME/SUPERV/YACS/modulegen/data2</string> </value>
</parameter>
</proc>
-Dans les grandes lignes, le couplage fait intervenir 2 instances du composant compo (pipo1 et pipo2) dont on exécute
-le service s1. Les ports datastream de ces services sont connectés au moyen des informations fromnode, fromport, tonode, toport
-dans les sections stream.
-Les ports dataflow sont initialisés par les sections parameter. En particulier, le répertoire de travail de chaque instance
-de composant est initialisé à travers le port d'entrée "c" de chaque instance de composant.
-Chaque instance de composant est exécuté dans un container différent (A et B). Ces noms sont virtuels. C'est SALOME qui au
-moment du lancement décidera du nom effectif des containers. On ne donne ici que des contraintes sur les containers à utiliser.
-En l'occurrence, il n'y en a qu'une : containers différents.
+In general terms, coupling uses two instances of the component compo (pipo1 and pipo2) of which the service s1 is executed.
+The datastream ports of these services are connected using fromnode, fromport, tonode, toport information in the stream sections.
+The dataflow ports are initialised by the parameter sections. In particular, the working directory of each component instance
+is initialised through input port “c” of each component instance. Each component instance is executed in a different container (A and B).
+These names are virtual. SALOME will decide on the effective name of the containers at the time of the startup. The following simply
+describes constraints on containers to be used. In fact, there is only one constraint, which is that the containers have to be different.
-Exécution du couplage
+Executing coupling
+++++++++++++++++++++++++++++++++++++++++++++
-Une fois le fichier de couplage écrit au moyen d'un éditeur classique ou de l'éditeur graphique YACS, il est possible
-de lancer l'exécution.
+Once the coupling file has been written using a classical editor or the YACS graphic editor, execution can be started.
-Elle se passe en plusieurs temps :
+It takes place in several steps:
- - le lancement de SALOME : exécution du script runAppli de l'application SALOME (``./appli/runAppli -t``). L'application tourne
- en tâche de fond jusqu'à ce qu'elle soit arrêtée.
- - le lancement du couplage : exécution du coupleur YACS dans l'environnement de l'application SALOME
- lancée (``./appli/runSession driver test.xml``) avec test.xml le fichier de couplage.
- - l'arrêt de l'application : ``./appli/runSession killSalome.py``
+- start SALOME: execute the runAppli script of the SALOME application (``./appli/runAppli –t``). The application runs
+ as a background task until it is stopped.
+- start coupling: execute the YACS coupler in the environment of the running SALOME application (``./appli/runSession driver test.xml``)
+ with test.xml as the coupling file.
+- stop the application: ``./appli/runSession killSalome.py``
-Les sorties du couplage sont multiples :
+There are many coupling outputs:
- - la sortie du coupleur lui-même. Si aucune erreur d'exécution ne remonte jusqu'à lui, elle ne contient qu'une information
- utile : le nom des containers lancé par SALOME pour exécuter les composants. Si des erreurs d'exécution sont remontées
- jusqu'au coupleur elles sont listées en fin d'exécution.
- - les sorties des containers. Elles se retrouvent dans le répertoire /tmp avec un nom construit sur la base du nom du container
- lu dans la sortie du coupleur.
+- the output from the coupler itself. If no execution error is returned to the coupler, the output will only contain one useful
+ item of information: the name of containers started by SALOME to execute the components. If execution errors are returned to
+ the coupler, they will be listed at the end of execution.
+- container outputs: these outputs are located in the /tmp directory with a name constructed based on the container name read
+ in the coupler output.
-Attention : lors de l'arrêt de l'application les containers sont arrêtés brutalement ce qui peut provoquer des pertes d'informations
-dans leurs fichiers de sortie.
+.. warning::
+ When the application is stopped, the containers are killed, and this can cause information losses in their output files.
-La question du répertoire de travail
+The working directory
++++++++++++++++++++++++++++++++++++++
-Chaque instance de composant est hébergée par un container. Toutes les instances hébergées par un container s'exécutent donc
-dans un même répertoire qui est celui du container. A partir de la version 4.1.1 de SALOME il est possible de spécifier le répertoire
-de travail d'un container dans le fichier de couplage. Il suffit d'ajouter la propriété *workingdir* au container. Voici quelques
-exemples::
+Each component instance is hosted in a container. Therefore all instances hosted in a container are executed in the same
+directory, which is the container directory. Starting from version 4.1.1 of SALOME, the working directory of a container
+can be specified in the coupling file. All that is necessary is to add the **workingdir** property to the container.
+The following gives a few examples:
+
+.. code-block:: xml
<container name="A">
<property name="workingdir" value="/home/user/w1"/>
<property name="workingdir" value="a/b"/>
</container>
-Le container A s'exécutera dans le répertoire "/home/user/w1". S'il n'existe pas il sera créé.
-Le container B s'exécutera dans un nouveau répertoire temporaire.
-Le container C s'exécutera dans le répertoire relatif "a/b" (par rapport au répertoire de l'application utilisée pour l'exécution).
-S'il n'existe pas il sera créé.
+The container A is executed in directory “/home/user/w1”. This directory will be created if it does not exist.
+The container B will be executed in a new temporary directory.
+Container C will be executed in the relative directory “a/b” (starting from the directory of the application used
+for the execution). This directory will be created if it does not already exist.
-La question des fichiers
+Files management
++++++++++++++++++++++++++++
-Les composants sont des bibliothèques dynamiques ou des modules Python, il n'est pas possible de les lancer dans des scripts shell.
-Pour les composants qui utilisent des fichiers en entrée et en sortie, il est possible de spécifier dans le fichier de couplage
-des ports "fichiers" qui effectueront le transfert des fichiers et le nommage local adéquat.
-Par exemple, un service qui utilise un fichier d'entrée a et produit un fichier de sortie b sera déclaré comme suit::
+Components are dynamic libraries or Python modules, and they cannot be run in shell scripts. For components that use input and
+output files, “files” ports can be specified in the coupling file through which file transfers will be made and appropriate
+local names will be given. For example, a service that uses an input file a and produces an output file b will be declared as follows:
+
+.. code-block:: xml
<service name="pipo1">
<component>caster</component>
<outport name="b" type="file"/>
</service>
-Ces ports pourront être initialisés ou connectés à d'autres ports "fichiers" comme des ports ordinaires.
-Par exemple, l'initialisation pour le fichier d'entrée prendra la forme suivante::
+These ports can be initialised or connected to other “files” ports like ordinary ports. For example, initialisation for the input
+file will be in the following form:
+
+.. code-block:: xml
<parameter>
<tonode>pipo1</tonode> <toport>a</toport>
<value><objref>/local/chris/tmp/unfichier</objref> </value>
</parameter>
-Il n'est pas possible d'initialiser directement un port fichier de sortie. Il faut passer par un noeud spécial qui
-collecte les sorties. On créera un noeud "dataout" et un lien entre le noeud "pipo1" et le noeud "dataout"::
+It is impossible to initialise an output file port directly. A special node has to be used that collects outputs.
+A “dataout” node and the link between node “pipo1” and node “dataout” will be created:
+
+.. code-block:: xml
<outnode name="dataout" >
- <parameter name="f1" type="file" ref="monfichier"/>
+ <parameter name="f1" type="file" ref="myfile"/>
</outnode>
<datalink>
<fromnode>pipo1</fromnode><fromport>b</fromport>
<tonode>dataout</tonode> <toport>f1</toport>
</datalink>
-ATTENTION: il n'est pas possible d'utiliser le caractère '.' dans les noms des ports. Ceci interdit l'utilisation de noms
-tels que fort.8 qui sont assez fréquents. Un contournement existe : il suffit de remplacer le '.' par le caractère ':' (donc
-fort:8 dans notre exemple) pour obtenir le résultat attendu. Bien entendu, les noms contenant des caractères ':' ne sont pas
-utilisables. Ils devraient être très rares.
+.. warning::
+ It is impossible to use the “.” character in port names. This prevents the use of names such as fort.8 that are
+ fairly frequent. There is a simple workaround solution, which is to replace the “.” by the “:”character (therefore fort:8 in
+ our example) to obtain the expected result.
+ Obviously, names containing the “:” characters cannot be used. They must be very rare.
-Exemple d'exécution de composant Aster
+.. _execaster:
+
+Example execution of an Aster component
+++++++++++++++++++++++++++++++++++++++++++
-L'exécution d'un composant Aster présente quelques particularités qui sont exposées ici.
+There are a few unusual features when executing an Aster component that are presented below:
+
+- handling the command set
+- specification of parameters in the command line
+- specification of a mesh file (.mail)
+- specification of environment variables (also valid for other component types).
- - prise en charge du jeu de commande
- - spécification des paramètres de la ligne de commande
- - spécification d'un fichier maillage (.mail)
- - spécification de variables d'environnement (également valable pour les autres types de composant)
+The following is a simplified example of a YACS scheme comprising a calculation node that should execute service s1 of
+the caster component (type Aster) with an environment variable, a mail file, a comm file and command line parameters.
+A more complete example is given in the directory Examples/ast1 in the distribution:
-Voici un exemple simplifié de schéma YACS comportant un noeud de calcul devant exécuter le service s1 du
-composant caster (de type Aster) avec une variable d'environnement, un fichier mail un fichier comm
-et des paramètres de la ligne de commande. Pour un exemple plus complet, voir les fichiers aster.xml et f.comm
-de la distribution::
+.. code-block:: xml
<service name="pipo1" >
<component>caster</component>
<parameter>
<tonode>pipo1</tonode> <toport>fort:20</toport>
- <value><objref>/local/chris/ASTER/instals/NEW9/astest/forma01a.mmed</objref> </value>
+ <value>
+ <objref>/local/chris/ASTER/instals/NEW9/astest/forma01a.mmed</objref>
+ </value>
</parameter>
-Tout d'abord, il faut spécifier le jeu de commande. Comme indiqué ci-dessus (`Composant Aster`_), il faut
-déclarer un port supplémentaire "jdc" de type "string" et l'initialiser ou le connecter. Ici, le port jdc est connecté à
-un port de sortie d'un noeud python (ljdc) qui lira le fichier .comm dont le chemin lui est donné par
-son port d'entrée comm. Le transfert de l'identificateur du composant à la commande YACS_INIT est réalisé au moyen
-de la variable "component" qui est ajoutée automatiquement par le générateur et est disponible
-pour écrire le fichier .comm.
+Firstly, the command set has to be specified. As mentioned above (:ref:`aster`), an additional “jdc” “string” type port
+has to be declared and it has to be initialised or connected. In this case, the jdc port is connected to an output port
+from a python node (ljdc) that will read the .comm file, for which the path is given to it by its comm input port.
+The component identifier is transferred to the YACS_INIT command by means of the “component” variable that is
+automatically added by the generator and is available to write the .comm file.
-Exemple succinct de .comm ::
+Brief example of .comm::
DEBUT(PAR_LOT="NON")
YACS_INIT(COMPO=component)
ECRIRE_MAILLAGE()
LECTURE_FORCE()
-Pour spécifier des valeurs de paramètres de la ligne de commande, il faut avoir créer un composant
-avec un port de nom "argv" de type "string". Il suffit alors de donner une valeur à ce port. Ici, on modifie
-le chemin du répertoire des outils avec le paramètre rep_outils.
+Before values of command line parameters can be specified, a component must have been created with a “string” type port named “argv”.
+A value then has to be given to this port. In this case, we modify the tools directory path using the **rep_outils** parameter.
+
+A mesh file (.mail) is specified to an Aster component by adding a file port to the calculation node:
-Pour spécifier un fichier de maillage (.mail) à un composant Aster, il faut ajouter un port fichier au noeud de
-calcul::
+.. code-block:: xml
<inport name="fort:20" type="file"/>
-Ce port fichier doit avoir comme nom le nom local du fichier tel qu'attendu par Aster. En général Aster utilise
-le fichier fort.20 comme entrée de LIRE_MAILLAGE. Comme indiqué plus haut, le point de fort.20 ne peut pas être
-utilisé dans un nom de port, on donnera donc comme nom fort:20. Il faut ensuite donner une valeur à ce port
-qui correspond au chemin du fichier à utiliser. Ceci est réalisé par une directive parameter::
+The name of this file port must be the same as the local file name as expected by Aster. Usually, Aster uses
+the fort.20 file as an input to LIRE_MAILLAGE. As mentioned above, the dot in fort.20 cannot be used in a port
+name, and therefore it will be given the name fort:20. A value will then have to be given to this port that will
+correspond to the path of the file to be used. This is done by a parameter directive:
+
+.. code-block:: xml
<parameter>
<tonode>pipo1</tonode> <toport>fort:20</toport>
- <value><objref>/local/chris/ASTER/instals/NEW9/astest/forma01a.mmed</objref> </value>
+ <value>
+ <objref>/local/chris/ASTER/instals/NEW9/astest/forma01a.mmed</objref>
+ </value>
</parameter>
-Pour spécifier des variables d'environnement, on passe par les properties du noeud de calcul. Ici, on
-définit la variable d'environnement MYENVAR de valeur 25.
+Environment variables are specified by using properties of the calculation node. In this case, we define
+the MYENVAR environment variable with value 25.
-Composants standalone
+Standalone components
--------------------------------------------------
-Jusqu'à la version 4.1 de Salome, la seule méthode pour intégrer un composant était de produire
-une bibliothèque dynamique (\*.so) ou un module python (\*.py). Ce composant est chargé par un
-exécutable Salome nommé Container soit par dlopen dans le cas de la bibliothèque soit par
-import dans le cas du module python. Cette méthode est un peu contraignante pour les codes de
-calcul comme Code_Aster ou Code_Saturne qui sont exécutés dans un environnement particulier
-de préférence à partir d'un shell script.
-
-A partir de la version 4.1.3, il est possible d'intégrer un composant en tant qu'exécutable ou shell
-script. Cette nouvelle fonctionnalité est pour le moment expérimentale et demande à être testée
-plus complètement. Elle est cependant utilisable et module_generator a été adapté (à partir de
-la version 0.3) pour générer des composants standalone. On décrit ci-après les opérations à réaliser
-pour passer au mode standalone pour chaque type de composant (C/C++, Python, Fortran ou Aster).
-
-Composant C/C++
+Before SALOME version 4.1, the only method for integrating a component was to produce a dynamic library (\*.so) or a python
+module (\*.py). This component is loaded by a SALOME executable named Container, either by dlopen in the case of the
+library or by import in the case of the Python module. This method is a little constraining for calculation codes
+like *Code_Aster* or *Code_Saturne* that are executed in a particular environment, and preferably from a shell script.
+
+Starting from version 4.1.3, a component can be integrated as an executable or shell script. This new function is
+experimental at the moment and it will have to be tested more completely. However, it can be used and module_generator
+was adapted (starting from version 0.3) to generate standalone components. The following describes operations to be carried out
+to change to standalone mode for each type of component (C/C++, Python, Fortran or Aster).
+
+C/C++ component
++++++++++++++++++++++++++++++++++++++++
-Pour transformer un composant C/C++ qui se présente de façon standard sous forme d'une
-bibliothèque dynamique en composant standalone, il suffit d'ajouter deux attributs à sa
-description :
+All that is necessary to transform a standard C/C++ component in the form of a dynamic library into a standalone component, is
+to add two attributes to its description:
- - l'attribut **kind** : en lui donnant la valeur "exe"
- - l'attribut **exe_path** : en lui donnant comme valeur le chemin de l'exécutable ou du script shell
- qui sera utilisé au lancement du composant
+- the **kind** attribute: by setting the value “exe”
+- the **exe_path** attribute: by setting its value equal to the path of the executable or the shell script that will be used
+ when the component is started
-Voici un exemple de composant C++ modifié pour en faire un composant standalone::
+The following is an example of a C++ component modified to make it a standalone component::
c1=CPPComponent("compo1",services=[
- Service("monservice",inport=[("portentrant","double"),],
- outport=[("portsortant","double")],
+ Service("myservice",inport=[("inputport","double"),],
+ outport=[("outputport","double")],
),
],
kind="exe",
- exe_path="/local/chris/SALOME2/SUPERV/YACS/modulegen/execpp_essai/prog",
+ exe_path="/local/SALOME/execpp/prog",
)
-Le chemin donné pour exe_path correspond à un exécutable dont le source est le suivant::
+The path given for **exe_path** corresponds to an executable with the following source:
+
+.. code-block:: cpp
#include "compo1.hxx"
return 0;
}
-Il doit être compilé et linké en utilisant l'include compo1.hxx et la librairie libcompo1Exelib.so
-que l'on trouvera dans l'installation du module généré respectivement dans include/salome
-et dans lib/salome. On pourra consulter un exemple plus complet dans les sources de la distribution
-dans le répertoire cppcompo.
+It must be compiled and linked using the compo1.hxx include and the libcompo1Exelib.so library that are given
+in the installation of the module generated in include/salome and in lib/salome respectively.
+
+.. note::
+
+ the SALOME module must be generated before compiling and linking the standalone component.
+
+A more complete example is given in the distribution sources in the Examples/cpp2 directory.
-Il est possible de remplacer l'exécutable par un script shell intermédiaire mais il est bon de savoir que l'appel
-à yacsinit récupère dans 3 variables d'environnement ( *SALOME_CONTAINERNAME*, *SALOME_INSTANCE*,
-*SALOME_CONTAINER*), les informations nécessaires à l'initialisation du composant.
+The executable can be replaced by an intermediary shell script, but it is good to know that the call to yacsinit
+retrieves information necessary to initialise the component in the three environment variables (*SALOME_CONTAINERNAME*,
+*SALOME_INSTANCE*, *SALOME_CONTAINER*).
-Composant Fortran
+Fortran component
++++++++++++++++++++++++++++++++++++++++
-Pour un composant Fortran, la méthode est identique. On ajoute les deux mêmes attributs :
+The method for a Fortran component is exactly the same. The same two attributes are added:
- - l'attribut **kind** : en lui donnant la valeur "exe"
- - l'attribut **exe_path** : en lui donnant comme valeur le chemin de l'exécutable ou du script shell
- qui sera utilisé au lancement du composant
+- The **kind** attribute: by setting the value “exe”
+- The **exe_path** attribute: by setting its value equal to the path of the executable or the shell script that will
+ be used when the component is started
-Voici un exemple de composant Fortran standalone::
+The following is an example of a standalone Fortran component::
c3=F77Component("compo3",services=[
Service("s1",inport=[("a","double"),("b","long"),
),
],
kind="exe",
- exe_path="/local/chris/SALOME2/SUPERV/YACS/modulegen/YACSGEN/fcompo/prog",
+ exe_path="/local/SALOME/fcompo/prog",
)
-Le chemin donné pour exe_path correspond à un exécutable dont le source est le suivant::
+The path given for **exe_path** corresponds to an executable with the following source:
+
+.. code-block:: fortran
PROGRAM P
CALL YACSINIT()
END
-Il doit être compilé et linké en utilisant la librairie libcompo3Exelib.so que l'on trouvera dans l'installation
-du module généré dans lib/salome ainsi qu'avec le source Fortran contenant la subroutine S1.
-On pourra consulter un exemple plus complet dans les sources de la distribution
-dans le répertoire fcompo.
+It must be compiled and linked using the libcompo3Exelib.so library that is located in the installation of the module
+generated in lib/salome, and with the Fortran source containing subroutine S1.
+Refer to a more complete example in distribution sources in the Examples/fort2 directory.
-Composant Python
+Python component
++++++++++++++++++++++++++++++++++++++++
-Pour un composant Python, un générateur très rudimentaire a été codé. Il n'est possible que
-d'ajouter l'attribut **kind** avec la valeur "exe". L'exécutable est automatiquement généré dans l'installation
-du module. Il n'est pas possible, sauf à modifier l'installation, de le remplacer par un script.
+A very rudimentary generator has been coded for a Python component. The only possible action is to add the **kind**
+attribute (with the value "exe"). The executable is automatically generated in the module installation.
+It cannot be replaced by a script, unless the installation is modified.
-Composant Aster standalone
+Standalone Aster component
++++++++++++++++++++++++++++++++++++++++
-Pour un composant Aster, il faut un peu plus de travail. Il faut spécifier 4 attributs :
+Slightly more work is necessary for an Aster component. Three attributes have to be specified:
- - l'attribut **aster_dir** : qui donne le chemin de l'installation de Code_Aster
- - l'attribut **kind** : avec la valeur "exe"
- - l'attribut **asrun** : qui donne le chemin d'accès au lanceur as_run
- - l'attribut **exe_path** : qui donne le chemin d'un REPERTOIRE dans lequel le générateur va
- produire plusieurs fichiers qui serviront au lancement de l'exécution de Code_Aster.
+- the **aster_dir** attribute: that gives the path of the *Code_Aster* installation
+- the **kind** attribute: with the “exe” value
+- the **exe_path** attribute: that gives the path of the shell script that will be used when the component is started
-Voici un exemple de description d'un composant Aster standalone::
+The following is an example description of a standalone Aster component::
c1=ASTERComponent("caster",services=[
Service("s1",inport=[("argv","string"),("a","double"),
),
],
aster_dir="/aster/NEW9",
- exe_path="/home/pora/CCAR/SALOME4/exeaster_essai",
- asrun="/aster/ASTK/ASTK_SERV/bin/as_run",
kind="exe",
+ exe_path="/home/SALOME5/exeaster",
)
-Le générateur produit les fichiers suivants, dans le répertoire **exe_path** :
-
- - **aster_component.py** : qui est l'exécutable python qui remplace l'exécutable standard
- E_SUPERV.py. Il n'a pas à être modifié.
- - **E_SUPERV.py** : une modification du fichier original contenu dans
- ``bibpyt/Execution``. Il n'a pas à être modifié.
- - **config.txt** : le fichier config.txt de l'installation de Code_Aster modifié pour changer
- l'exécutable python (ARGPYT). Il peut être modifié en dehors de ARGPYT.
- - **profile.sh** : une copie du fichier profile.sh de l'installation de Code_Aster (pour que çà marche).
- - **caster.comm** : un fichier de commande d'amorçage qui ne contient que la commande DEBUT
- en mode PAR_LOT="NON". Il n'a pas à être modifié.
- - **make_etude.export** : un fichier de commande pour as_run simplifié. Il est complété
- dynamiquement au lancement pour rediriger les fichiers 6,8 et 9 dans REP/messages, REP/resu
- et REP/erre. REP est le répertoire d'exécution du composant standalone qui a pour
- nom : <composant>_inst_<N>. <N> est un numéro d'exécution qui démarre à 1.
- <composant> est le nom du composant (caster, dans notre exemple). Ce fichier peut être
- modifié en particulier si on a modifié ou ajouté des commandes Aster.
-
-Bien que l'exécution soit lancée avec un fichier de commandes (caster.comm), il est toujours
-nécessaire de spécifier le fichier de commandes "effectif" dans le fichier de couplage xml.
-La seule différence avec un composant sous forme de bibliothèque est que ce dernier fichier de
-commandes NE DOIT PAS contenir de commande DEBUT (sinon, plantage inexplicable).
-
-Exemple de couplage avec composants standalone
+The “effective” command file always has to be specified in the XML coupling file.
+
+Example coupling with standalone components
++++++++++++++++++++++++++++++++++++++++++++++++++++
-En rassemblant tous les éléments ci-dessus, le couplage d'un composant Aster standalone avec un composant
-Fortran standalone s'écrit comme suit (fichier astexe.py dans la distribution) ::
+By collecting all the above elements, coupling of a standalone Aster component with a standalone Fortran component is
+written as follows::
from module_generator import Generator,Module
from module_generator import ASTERComponent,Service,F77Component
- context={'update':1,"prerequisites":"/home/caremoli/pkg/env.sh",
- "kernel":"/home/pora/CCAR/SALOME4/Install/KERNEL_V4_1"}
+ context={'update':1,"prerequisites":"/home/SALOME5/env.sh",
+ "kernel":"/home/SALOME5/Install/KERNEL_V5"}
install_prefix="./exe_install"
appli_dir="exe_appli"
("bb","CALCIUM_double","I")],
),
],
- aster_dir="/aster/NEW9",
- exe_path="/home/pora/CCAR/SALOME4/exeaster_essai",
- asrun="/aster/ASTK/ASTK_SERV/bin/as_run",
kind="exe",
+ aster_dir="/aster/NEW9",
+ exe_path="/home/SALOME5/exeaster",
)
- c2=F77Component("cedyos",services=[
+ c2=F77Component("cfort",services=[
Service("s1",inport=[("a","double"),("b","long"),
("c","string")],
outport=[("d","double"),("e","long"),
defs="",body="",
),
],
- exe_path="/home/pora/CCAR/SALOME4/exeedyos_essai/prog",
+ exe_path="/home/SALOME5/fcompo/prog",
kind="exe")
- g=Generator(Module("titi",components=[c1,c2],prefix=install_prefix),context)
+ g=Generator(Module("astmod",components=[c1,c2],prefix=install_prefix),context)
g.generate()
g.bootstrap()
g.configure()
g.install()
g.make_appli(appli_dir,restrict=["KERNEL","YACS"])
-Le fichier de couplage xml et le fichier de commandes Aster correspondants peuvent être consultés
-dans la distribution (asterexe.xml et fexe.xml).
-On trouvera les éléments complémentaires d'implantation dans le répertoire fcompo (composant cedyos)
-et dans le répertoire aster (composant caster).
+The corresponding xml coupling file and Aster command file may be viewed in the distribution (Examples/ast2 directory).
+The complementary implantation elements are located in the fcompo directory (cfort component) and in the myaster directory (caster component).
+
+Miscellaneous
+-----------------------------------------------------------------
+YACSGEN is mainly targeted to the integration of Python, C++ or Fortran calculation codes.
+Nevertheless, if you want to generate a complete module with GUI, documentation and persistence,
+there are some minimal options to do that.
+
+Add a GUI
+++++++++++++++++++++++++++++++++++++++++
+It is possible to add a C++ or a Python GUI to the module with the *gui* parameter of the module.
+This parameter must be a list of file names. These files can be source files (\*.cxx, \*.hxx or \*.h for C++, \*.py for python),
+image files (\*.png, ...) and qt designer files (\*.ui). You can't mix python and C++ source files.
+In C++, include files with .h extension are processed with the moc qt tool.
+
+Here is an excerpt from pygui1 example that shows how to add a python GUI to a module::
+
+ modul=Module("pycompos",components=[c1],prefix="./install",
+ gui=["pycomposGUI.py","demo.ui","*.png"],
+ )
+
+The GUI is implemented in the pycomposGUI.py (that must be named <module name>GUI.py) python module. It uses a qt designer
+file demo.ui that is dynamically loaded and several images in PNG files.
+
+Here is an excerpt from cppgui1 example that shows how to add a C++ GUI to a module::
+
+ modul=Module("cppcompos",components=[c1],prefix="./install",
+ gui=["cppcomposGUI.cxx","cppcomposGUI.h","demo.ui","*.png"],
+ )
+
+The C++ GUI is very similar to the python GUI except that the cppcomposGUI.h file is processed by the moc and the demo.ui
+is processed by the uic qt tool.
+
+By default, a Makefile.am and a SalomeApp.xml files are generated but you can put your own Makefile.am or SalomeApp.xml
+in the list to override this default.
+
+Add an online documentation
+++++++++++++++++++++++++++++++++++++++++
+It is possible to add an online documentation that is made with the sphinx tool (http://sphinx.pocoo.org). You need a well installed
+sphinx tool (1.0.x or 0.6.x).
+To add a documentation use the *doc* parameter of the module. It must be a list of file names. These files can be text files
+(name with extension .rst) in the reStructured format (see http://docutils.sourceforge.net/) and image files (\*.png, ...).
+The main file must be named index.rst.
+
+By default, a sphinx configuration file conf.py and a Makefile.am are generated but you can put your own Makefile.am or conf.py
+in the list to override this default.
+
+Here is an excerpt from pygui1 example that shows how to add a documentation to a module::
+
+ modul=Module("pycompos",components=[c1],prefix="./install",
+ doc=["*.rst","*.png"],
+ )
+
+.. warning::
+ The online documentation will only appear in the SALOME GUI, if your module has a minimal GUI but not if it has no GUI.
+
+Add extra methods to your components
+++++++++++++++++++++++++++++++++++++++++
+If you have a C++ or Python class or some methods that you want to add to your components, it is possible to do that by
+using the *compodefs* and *inheritedclass* parameters of the component (:class:`module_generator.CPPComponent` or
+:class:`module_generator.PYComponent`).
+
+The *inheritedclass* parameter gives the name of the class that will be included in the parent classes of the component and
+the *compodefs* parameter is a fragment of code that will be inserted in the definition section of the component. It can be used
+to add definitions such as include or even a complete class.
+
+Here is an excerpt from pygui1 example that shows how to add a method named createObject to the component pycompos::
+
+ compodefs=r"""
+ class A:
+ def createObject( self, study, name ):
+ "Create object. "
+ builder = study.NewBuilder()
+ father = study.FindComponent( "pycompos" )
+ if father is None:
+ father = builder.NewComponent( "pycompos" )
+ attr = builder.FindOrCreateAttribute( father, "AttributeName" )
+ attr.SetValue( "pycompos" )
+ object = builder.NewObject( father )
+ attr = builder.FindOrCreateAttribute( object, "AttributeName" )
+ attr.SetValue( name )
+ """
+
+ c1=PYComponent("pycompos",services=[
+ Service("s1",inport=[("a","double"),("b","double")],
+ outport=[("c","double"),("d","double")],
+ ),
+ ],
+ compodefs=compodefs,
+ inheritedclass="A",
+ )
+
+.. note::
+
+ If you have special characters in your code fragments such as backslash, think about using python raw strings (r"...")
+
+For a C++ component, the method is exactly the same. There is only one case that can be handled in Python with this method and not in C++.
+It's when you want to redefine one of the component methods (DumpPython, for example). In this case, adding a class in the inheritance tree
+does not override the default implementation. So, for this special case, there is another parameter (*addmethods*) that is a code
+fragment that will be included in the component class to effectively redefine the method.
+
+Here is an excerpt from cppgui1 example that shows how to redefine the DumpPython method in a C++ component::
+
+ compomethods=r"""
+ Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy, CORBA::Boolean isPublished,
+ CORBA::Boolean& isValidScript)
+ {
+ SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy);
+ if(CORBA::is_nil(aStudy))
+ return new Engines::TMPFile(0);
+ SALOMEDS::SObject_var aSO = aStudy->FindComponent("cppcompos");
+ if(CORBA::is_nil(aSO))
+ return new Engines::TMPFile(0);
+ std::string Script = "import cppcompos_ORB\n";
+ Script += "import salome\n";
+ Script += "compo = salome.lcc.FindOrLoadComponent('FactoryServer','cppcompos')\n";
+ Script += "def RebuildData(theStudy):\n";
+ Script += " compo.SetCurrentStudy(theStudy)\n";
+ const char* aScript=Script.c_str();
+ char* aBuffer = new char[strlen(aScript)+1];
+ strcpy(aBuffer, aScript);
+ CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer;
+ int aBufferSize = strlen(aBuffer)+1;
+ Engines::TMPFile_var aStreamFile = new Engines::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1);
+ isValidScript = true;
+ return aStreamFile._retn();
+ }
+ """
+
+ c1=CPPComponent("cppcompos",services=[ Service("s1",
+ inport=[("a","double"),("b","double")],
+ outport=[("c","double")],
+ ),
+ ],
+ addedmethods=compomethods,
+ )
+
+
+Add extra idl corba interfaces to your components
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
+If you want to add pure CORBA methods (not SALOME services) to your components or even complete IDL interface (SALOMEDS::Driver, for
+example), you can do that by using the *idls*, *interfacedefs* and *inheritedinterface* parameters of the component.
+
+The *idls* parameter must be a list of CORBA idl file names. The *inheritedinterface* parameter gives the name of the CORBA
+interface that will be included in the parent interfaces of the component interface. The *interfacedefs* parameter is a fragment
+of code that will be inserted in the idl file of the module. It can be used to add definitions such as include or even a complete interface.
+
+Here is an excerpt from pygui1 example that shows how to add the SALOMEDS::Driver interface (with its default
+implementation from SALOME KERNEL) and an extra method (createObject) to a python component::
+
+ idldefs="""
+ #include "myinterface.idl"
+ """
+
+ compodefs=r"""
+ import SALOME_DriverPy
+
+ class A(SALOME_DriverPy.SALOME_DriverPy_i):
+ def __init__(self):
+ SALOME_DriverPy.SALOME_DriverPy_i.__init__(self,"pycompos")
+ return
+
+ def createObject( self, study, name ):
+ "Create object. "
+ builder = study.NewBuilder()
+ father = study.FindComponent( "pycompos" )
+ if father is None:
+ father = builder.NewComponent( "pycompos" )
+ attr = builder.FindOrCreateAttribute( father, "AttributeName" )
+ attr.SetValue( "pycompos" )
+
+ object = builder.NewObject( father )
+ attr = builder.FindOrCreateAttribute( object, "AttributeName" )
+ attr.SetValue( name )
+ """
+
+ c1=PYComponent("pycompos",services=[ Service("s1",
+ inport=[("a","double"),("b","double")],
+ outport=[("c","double"),("d","double")],
+ ),
+ ],
+ idls=["*.idl"],
+ interfacedefs=idldefs,
+ inheritedinterface="Idl_A",
+ compodefs=compodefs,
+ inheritedclass="A",
+ )
+
+The idl file names can contain shell-style wildcards that are accepted by the python glob module. Here, there is only
+one file (myinterface.idl) that contains the definition of interface Idl_A::
+
+ #include "SALOMEDS.idl"
+ #include "SALOME_Exception.idl"
+
+ interface Idl_A : SALOMEDS::Driver
+ {
+ void createObject(in SALOMEDS::Study theStudy, in string name) raises (SALOME::SALOME_Exception);
+ };
+
+In this simple case, it is also possible to include directly the content of the file with the *interfacedefs* parameter.
+
+For a C++ component, the method is exactly the same, except that there is no default implementation of the Driver interface
+so you have to implement it.
+
+Add YACS type definition to YACSGEN
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
+If you define a port, you need to give a type name. YACSGEN knows about a limited set of types (see :ref:`yacstypes`).
+If you want to add more types either because they have been forgotten or you want to use one from a new module, it is possible
+to add them with the function :func:`module_generator.add_type`. This function can also overload an existing type.
+
+For example, to overload the definition of type GEOM_Object in GEOM module::
+
+ from module_generator import add_type
+ add_type("GEOM_Object", "GEOM::GEOM_Object_ptr", "GEOM::GEOM_Object_out", "GEOM", "GEOM::GEOM_Object","GEOM::GEOM_Object_ptr")
+
+Add YACS module definition to YACSGEN
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
+Now if you want to add a new type from a new module (unknown to YACSGEN), you need to add a module definition to YACSGEN.
+You can add it with the function :func:`module_generator.add_module`. This function can also overload the definition
+of an existing module.
+
+For example, to overload the definition of module GEOM::
+
+ from module_generator import add_module
+
+ idldefs="""
+ #include "GEOM_Gen.idl"
+ """
+
+ makefiledefs="""
+ #module GEOM
+ GEOM_IDL_INCLUDES = -I$(GEOM_ROOT_DIR)/idl/salome
+ GEOM_INCLUDES= -I$(GEOM_ROOT_DIR)/include/salome
+ GEOM_IDL_LIBS= -L$(GEOM_ROOT_DIR)/lib/salome -lSalomeIDLGEOM
+ GEOM_LIBS= -L$(GEOM_ROOT_DIR)/lib/salome
+ SALOME_LIBS += ${GEOM_LIBS}
+ SALOME_IDL_LIBS += ${GEOM_IDL_LIBS}
+ SALOME_INCLUDES += ${GEOM_INCLUDES}
+ IDL_INCLUDES += ${GEOM_IDL_INCLUDES}
+ """
+
+ configdefs="""
+ if test "x${GEOM_ROOT_DIR}" != "x" && test -d ${GEOM_ROOT_DIR} ; then
+ AC_MSG_RESULT(Using GEOM installation in ${GEOM_ROOT_DIR})
+ else
+ AC_MSG_ERROR([Cannot find module GEOM. Have you set GEOM_ROOT_DIR ?],1)
+ fi
+ """
+
+ add_module("GEOM",idldefs,makefiledefs,configdefs)
+
+
+Reference guide
+-----------------------------------------------------------------
+
+.. automodule:: module_generator
+ :synopsis: YACSGEN interface
+
+The module provides the following classes:
+
+.. autoclass:: Service
+
+.. autoclass:: CPPComponent
+
+.. autoclass:: PYComponent
+
+.. autoclass:: F77Component
+
+.. autoclass:: ASTERComponent
+
+.. autoclass:: Module
+
+.. autoclass:: Generator
+ :members: generate, bootstrap, configure, make, install, make_appli
+
+.. autofunction:: add_type
+
+.. autofunction:: add_module
+
+.. _yacstypes:
+
+Supported SALOME types
+----------------------------
+======================= =============================== ================================ ===================== ==========================
+ SALOME module YACS type name IDL type name Implementation Comment
+======================= =============================== ================================ ===================== ==========================
+ GEOM GEOM_Object GEOM::GEOM_Object C++, Python
+ SMESH SMESH_Mesh SMESH::SMESH_Mesh C++, Python
+ SMESH SMESH_Hypothesis SMESH::SMESH_Hypothesis C++, Python
+ MED SALOME_MED/MED SALOME_MED::MED C++, Python
+ MED SALOME_MED/MESH SALOME_MED::MESH C++, Python
+ MED SALOME_MED/SUPPORT SALOME_MED::SUPPORT C++, Python
+ MED SALOME_MED/FIELD SALOME_MED::FIELD C++, Python
+ MED SALOME_MED/FIELDDOUBLE SALOME_MED::FIELDDOUBLE C++, Python
+ MED SALOME_MED/FIELDINT SALOME_MED::FIELDINT C++, Python
+ KERNEL double double C++, Python, F77
+ KERNEL long long C++, Python, F77
+ KERNEL string string C++, Python, F77
+ KERNEL dblevec dblevec C++, Python, F77 list of double
+ KERNEL stringvec stringvec C++, Python, F77 list of string
+ KERNEL intvec intvec C++, Python, F77 list of long
+ KERNEL pyobj Python a pickled python object
+ KERNEL file C++, Python, F77 to transfer a file
+ KERNEL SALOME_TYPES/Parameter SALOME_TYPES::Parameter C++, Python
+ KERNEL SALOME_TYPES/ParameterList SALOME_TYPES::ParameterList C++, Python
+ KERNEL SALOME_TYPES/Variable SALOME_TYPES::Variable C++, Python
+ KERNEL SALOME_TYPES/VariableSequence SALOME_TYPES::VariableSequence C++, Python
+ KERNEL SALOME_TYPES/StateSequence SALOME_TYPES::StateSequence C++, Python
+ KERNEL SALOME_TYPES/TimeSequence SALOME_TYPES::TimeSequence C++, Python
+ KERNEL SALOME_TYPES/VarList SALOME_TYPES::VarList C++, Python
+ KERNEL SALOME_TYPES/ParametricInput SALOME_TYPES::ParametricInput C++, Python
+ KERNEL SALOME_TYPES/ParametricOutput SALOME_TYPES::ParametricOutput C++, Python
+======================= =============================== ================================ ===================== ==========================
+++ /dev/null
-/*! \page xml_loader XML file loader
-
-\section toc Table of contents
-
- - \ref loader_intro
- - \ref loader_use
- - \ref loader_file
- - \ref loader_programming
-
-
-\section loader_intro Introduction
-
-The yacsloader module provides several software elements :
- - a C++ class that can be used to load a calculation schema in memory by reading and parsing a XML file
- describing it (see \ref loader_programming).
- - an executable named driver that can be used to load and execute (see \ref loader_use) a calculation
- schema given as a XML file (see \ref loader_file).
-
-\section loader_use Using the yacs driver
-
-The driver program is a program that loads a schema file and executes it
-until its end. It is possible to display the schema state during the
-execution by specifying the --display option. An exemple of use is:
-
-\code
-driver --display=1 schema.xml
-\endcode
-
-Internally, it uses the loader class, the Salome runtime, the standard
-executor with all is necessary to catch exceptions.
-
-\section loader_file Writing a XML file
-
-To write a XML file describing a calculation schema, you need to define
-several objects that are listed here :
-
- - the calculation schema
- - data types
- - elementary calculation nodes
- - connections between nodes
- - initialization parameters
- - composed calculation nodes
-
-
-\subsection loader_schema Defining calculation schema
-To define a calculation schema, simply open a proc tag
-\code
-<proc>
-</proc>
-\endcode
-
-All following definitions must be put between these tags.
-
-\subsection loader_types Defining data types
-A calculation schema is composed of interconnected calculation nodes.
-These nodes exchange data through data ports (in and out). The first
-thing you need to do is to define all types that can be exchanged
-in the schema.
-
-Some types are already defined by the runtime you use. For example, the
-Salome runtime defines : int, double, string and bool types. It can also
-define all types used by the declared components. At the moment, the
-Salome runtime knows nothing about the types used by the declared components
-so it is mandatory to define all data types except the four basic ones.
-
-It is possible to define three kind of types : basic, sequence and objref.
-
-A basic type is an atomic one so it can only be int, double, string and bool.
-They are already defined so what can be defined is only alias to these types.
-
-A definition of an alias to the double data type :
-\code
-<type name="mydble" kind="double"/>
-\endcode
-
-A sequence type is a constructed type that is built on already existing
-types. A sequence type defines a list of elements. The definition
-gives the name of the type and the type of the elements of the sequence.
-
-To define a sequence of double type, add :
-\code
-<sequence name="myseqdble" content="double"/>
-\endcode
-
-All attributes in the sequence tag are mandatory.
-
-You can then define a sequence of sequence by :
-\code
-<sequence name="myseqseqdble" content="myseqdble"/>
-\endcode
-
-An objref data type is an equivalent of a class in object languages.
-Salome components use objects which have types such as Mesh, Field, ...
-All these types can be related by inheritance relations.
-
-Defining a base objref :
-\code
-<objref name="mesh"/>
-\endcode
-
-Defining a derived objref from mesh :
-\code
-<objref name="refinedmesh">
- <base>mesh</base>
-</objref>
-\endcode
-
-It is possible to derive an objref from multiple base objref and objref names
-can use name spaces. Just use a / as separator.
-\code
-<objref name="myns/mesh"/>
-\endcode
-It is useful for Salome components because objref must be mapped to
-CORBA types which can use name spaces.
-
-Finally, it is possible to define a sequence of objref :
-\code
-<sequence name="myseqmesh" content="refinedmesh"/>
-\endcode
-
-\b RESTRICTION : struct type is not supported
-
-\subsection loader_nodes Defining elementary calculation nodes
-The next step is to define calculation nodes : service nodes or inline
-nodes.
-
-There are three kinds of inline nodes : script inline node, function
-inline node and clone inline node,
-and three kinds of service nodes : component service node, reference
-service node and node service node.
-
-The definition of all these nodes is described below.
-
-- Script inline node
-
-This kind of node corresponds to the execution of a python script with input
-and output parameters. Input and output parameters are passed to the
-script through data ports.
-A very simple example of an script inline node is :
-\code
- <inline name="node1" >
- <script>
- <code>p1=10</code>
- </script>
- <outport name="p1" type="int"/>
- </inline>
-\endcode
-
-The inline node has a mandatory name as all kind of nodes.
-The script tag indicates that it is a script inline node.
-The python script appears in as much lines as necessary between code tags in the script
-section.
-If your script contains a lot of "<" or "&" characters - as program code often does -
-the XML element can be defined as a CDATA section.
-A CDATA section starts with "<![CDATA[" and ends with "]]>":
-
-In the example above the script calculates p1 that is an output parameter.
-An output data port must then be defined. A output data port is defined
-in an outport tag with two mandatory attributes : name and type that references
-an already defined data type.
-To define an input data port use the inport tag in place of outport.
-
-Example of an inline node with input and output arguments :
-\code
- <inline name="node1" >
- <script>
- <code>p1=p1+10</code>
- </script>
- <inport name="p1" type="int"/>
- <outport name="p1" type="int"/>
- </inline>
-\endcode
-Now the calculation node receives p1 as an input argument adds 10 to it
-and sends it as an output argument.
-
-- Function inline node
-
-This kind of node corresponds to the execution of a python function with input
-and output parameters. Input and output parameters are passed to the
-script through data ports.
-The main difference with the script node is the execution part. The definition
-of input and output ports is unchanged. In the execution part use the function
-tag in place of the script tag and add a name (mandatory) which must be the same
-as that of the function.
-
-An example of an function inline node is :
-\code
- <inline name="node1" >
- <function name="f">
- <code>def f(p1):</code>
- <code> p1=p1+10</code>
- <code> return p1</code>
- </script>
- <inport name="p1" type="int"/>
- <outport name="p1" type="int"/>
- </inline>
-\endcode
-
-- Clone inline node
-
-This node is a convenience node to avoid repeating an inline definion.
-It allows to create an inline calculation by using the definition
-of another inline node. Such a kind of node is defined in a node tag
-with two mandatory attributes : name (the node name) and type that indicates the name
-of the already existing inline node to use for the definition. Example :
-
-\code
- <node name="node2" type="node1"/>
-\endcode
-
-- Reference service node
-
-A service node corresponds to the execution of a service available from a
-calculation server. It can thought of as the execution of an object method.
-A service node is defined in a service tag in place of the inline tag for
-the inline node.
-
-In a reference service node the calculation server is known by its address (which
-is a string meaningful for the runtime) and is supposed to exists
-before executing the calculation schema. The service is known by its name.
-Then the service has input and output arguments that are passed through ports
-in the same way as the inline nodes.
-The server address is defined as a string in a ref tag and the service name is
-defined in a method tag.
-Example :
-\code
- <service name="node4" >
- <ref>corbaname:rir:#test.my_context/Echo.Object</ref>
- <method>echoDouble</method>
- <inport name="p1" type="double"/>
- <outport name="p1" type="double"/>
- </service>
-\endcode
-
-The service node node4 is a reference service node because it has a ref
-section. The address of the calculation server to use is a CORBA address
-that must be meaningful to the runtime. The service to use is the
-CORBA operation echoDouble that just gets the input and returns it.
-
-- Component service node
-
-This kind of node is similar to the previous one but the server does not
-exist before the beginning of the execution. It's the runtime that is in charge
-of loading the calculation server or component for Salome platform.
-Instead of defining the address of the server we give the name of the
-component that will be loaded through the runtime by the platform.
-This name is given in a component tag in place of the ref tag.
-Example :
-\code
- <service name="node4" >
- <component>ECHO</component>
- <method>echoDouble</method>
- <inport name="p1" type="double"/>
- <outport name="p1" type="double"/>
- </service>
-\endcode
-
-- Node service node
-
-It's a special node that gives the possibility to create a service node that calls
-a service of an already loaded component. To define such a node you need to
-indicate the name of an already existing component service node in a node tag
-in place of the previous component tag.
-
-A short example is better than a long speech :
-\code
- <service name="node5" >
- <node>node4</node>
- <method>echoString</method>
- <inport name="p1" type="string"/>
- <outport name="p1" type="string"/>
- </service>
-\endcode
-Here, node5 is a service node that executes the echoString service of the
-component that has been loaded by the component service node node4.
-
-\subsection loader_connections Defining connections between nodes
-After having defined all the calculation nodes needed, it is necessary
-to connect them to define the order of execution (control flow)
- and the exchanges of data (data flow).
-
-- Control flow
-
-The order of execution is defined by means of control links between
-nodes.
-These links are defined in a control tag with subtags fromnode and tonode
-which give the names of precedent node and following node.
-Example of control link :
-\code
- <control>
- <fromnode>node1</fromnode>
- <tonode>node2</tonode>
- </control>
-\endcode
-This control link indicates that execution of node2 must be after complete
-execution of node1.
-
-- Data flow
-
-Exchange of data between nodes is defined by means of data links between
-output ports and input ports.
-These links are defined in a datalink tag with subtags fromnode, tonode, fromport
-and toport. The output port is specified with the node name and the output port
-name. It's similar for the input port.
-
-Example of data link :
-\code
- <datalink>
- <fromnode>node1</fromnode> <fromport>p1</fromport>
- <tonode>node2</tonode> <toport>p1</toport>
- </datalink>
-\endcode
-This data link indicates that the output argument p1 of node node1
-will be sent to node node2 and used as input argument p1.
-By default, with this datalink definition, a control link is automatically defined between node1 and node2,
-to ensure a complete execution of node1 before node2 starts.
-Sometimes, this control link must not be created, for instance with loops (see below).
-With most simple cases, yacs loader is able to decide to create or not the control link. It is always
-possible to ask explicitely a data link without control link:
-\code
- <datalink control="false">
- <fromnode>node1</fromnode> <fromport>p1</fromport>
- <tonode>node2</tonode> <toport>p1</toport>
- </datalink>
-\endcode
-
-So, it is equivalent to write:
-\code
- <datalink>
- <fromnode>node1</fromnode> <fromport>p1</fromport>
- <tonode>node2</tonode> <toport>p1</toport>
- </datalink>
-\endcode
-Or:
-\code
- <control>
- <fromnode>node1</fromnode>
- <tonode>node2</tonode>
- </control>
- <datalink control="false">
- <fromnode>node1</fromnode> <fromport>p1</fromport>
- <tonode>node2</tonode> <toport>p1</toport>
- </datalink>
-\endcode
-Control links may be defined implicitely several times without problem.
-
-\subsection loader_parameters Defining initialization parameters
-It is possible to initialize directly input ports with constants.
-This is done with a definition put in a parameter tag with subtags tonode,
-toport and value.
-tonode is the name of the node and toport the name of the port to initialize.
-value gives the constant to use to initialize the port. This constant is
-given in XML-RPC coding convention (http://www.xmlrpc.com/).
-
-Example of parameter initialization :
-\code
- <parameter>
- <tonode>node1</tonode> <toport>p1</toport>
- <value><string>coucou</string></value>
- </parameter>
-\endcode
-
-
-This parameter initialization indicates that the input argument p1
-of node1 is initialized with a string constant ("coucou").
-
-\subsection loader_example1 Putting all this together
-Now that we are able to define data types, calculation nodes and links, we
-can define a complete calculation schema with interconnected calculation.
-
-\code
- <proc>
- <inline name="node1" >
- <script>
- <code>p1=p1+10</code>
- </script>
- <inport name="p1" type="int"/>
- <outport name="p1" type="int"/>
- </inline>
- <inline name="node2" >
- <script>
- <code>p1=2*p1</code>
- </script>
- <inport name="p1" type="int"/>
- <outport name="p1" type="int"/>
- </inline>
- <service name="node4" >
- <ref>corbaname:rir:#test.my_context/Echo.Object</ref>
- <method>echoDouble</method>
- <inport name="p1" type="double"/>
- <outport name="p1" type="double"/>
- </service>
- <control>
- <fromnode>node1</fromnode> <tonode>node2</tonode>
- </control>
- <control>
- <fromnode>node1</fromnode> <tonode>node4</tonode>
- </control>
- <datalink>
- <fromnode>node1</fromnode> <fromport>p1</fromport>
- <tonode>node2</tonode> <toport>p1</toport>
- </datalink>
- <datalink>
- <fromnode>node1</fromnode> <fromport>p1</fromport>
- <tonode>node4</tonode> <toport>p1</toport>
- </datalink>
- <parameter>
- <tonode>node1</tonode> <toport>p1</toport>
- <value><int>5</int></value>
- </parameter>
- </proc>
-\endcode
-We have put together 2 inline nodes and one reference service node
-with nodes node2 and node4 that will be concurrently executed as can
-be seen on the control flow diagram below.
-
-\image html schema.jpeg
-
-\subsection loader_composed Defining composed calculation nodes
-The next step is to define composed nodes either to modularize the calculation
-schema or to introduce control nodes like loop or switch.
-
-- Using block to modularize the schema
-
-All the previously defined elements (except the data types) can be put
-in block nodes. It is easy : create a bloc tag with an attribute name
-that contains all the definitions and you have a composed node that is
-a block.
-
-Example of block :
-\code
-<bloc name="b">
- <inline name="node1" >
- <script>
- <code>p1=p1+10</code>
- </script>
- <inport name="p1" type="int"/>
- <outport name="p1" type="int"/>
- </inline>
- <service name="node4" >
- <ref>corbaname:rir:#test.my_context/Echo.Object</ref>
- <method>echoDouble</method>
- <inport name="p1" type="double"/>
- <outport name="p1" type="double"/>
- </service>
- <control>
- <fromnode>node1</fromnode> <tonode>node4</tonode>
- </control>
- <datalink>
- <fromnode>node1</fromnode> <fromport>p1</fromport>
- <tonode>node4</tonode> <toport>p1</toport>
- </datalink>
-</bloc>
-\endcode
-This block can now be linked with other nodes of any kind in the same way
-as elementary nodes.
-The rules are : it is not possible to set control links that cross the boundary
-of the block. On the other end, it is possible to set data links that cross
-this boundary either on input or on output.
-
-- Defining a For Loop
-
-If you want to execute a calculation n times, you can use a ForLoop node
-to define this kind of computation.
-A for loop is defined in a forloop tag that has 2 attributes : name and nsteps.
-name is as always the name of the node and nsteps is the number of steps of the
-loop. The for loop must contain one and only one node that can be an elementary
-calculation node or a composed node. It is possible to have a for loop in a for loop, for
-example. If you want to put more than one calculation node in a for loop, use
-a block.
-
-Example :
-\code
- <forloop name="l1" nsteps="5">
- <inline name="node2" >
- <script>
- <code>p1=p1+10</code>
- </script>
- <inport name="p1" type="int"/>
- <outport name="p1" type="int"/>
- </inline>
- </forloop >
-\endcode
-The rules are the same as for the block node. But inside loops, to be able to perform
-iterative computation, it is allowed to link an output port of an internal node
-with an input port of a previous node in control flow. The only limitation is that
-you have to put the node and the data link in a block node as links can't be defined
-in a forloop section.
-
-Here is an example :
-\code
- <forloop name="l1" nsteps="5">
- <bloc name="b">
- <inline name="node2" >
- <script>
- <code>p1=p1+10</code>
- </script>
- <inport name="p1" type="int"/>
- <outport name="p1" type="int"/>
- </inline>
- <datalink control="false">
- <fromnode>node2</fromnode> <fromport>p1</fromport>
- <tonode>node2</tonode> <toport>p1</toport>
- </datalink>
- </bloc>
- </forloop >
-\endcode
-
-Last point : it is possible to link the nsteps entry of the for loop
-with an output port that produces integer data. The input port
-of the loop has the same name as the attribute (nsteps).
-
-- Defining a While Loop
-
-This kind of loop is mainly similar to the for loop. The only difference is that
-the loop executes as long as a condition is true. A while loop is defined in
-a whileloop tag and has only one attribute : name as usual.
-The condition value is set through an input port (which name is condition)
-that accepts boolean value.
-
-Example of a while loop:
-\code
- <whileloop name="l1" >
- <bloc name="b">
- <inline name="node2" >
- <script>
- <code>p1=p1+10</code>
- <code><![CDATA[ condition=p1 < 40.]]> </code>
- </script>
- <inport name="p1" type="int"/>
- <outport name="p1" type="int"/>
- <outport name="condition" type="bool"/>
- </inline>
- <datalink control="false">
- <fromnode>node2</fromnode> <fromport>p1</fromport>
- <tonode>node2</tonode> <toport>p1</toport>
- </datalink>
- </bloc>
- </whileloop >
- <datalink control="false">
- <fromnode>l1.b.node2</fromnode> <fromport>condition</fromport>
- <tonode>l1</tonode> <toport>condition</toport>
- </datalink>
- <parameter>
- <tonode>l1.b.node2</tonode> <toport>p1</toport>
- <value><int>23</int> </value>
- </parameter>
-\endcode
-
-It is here again possible to define composed node of any kind as internal
-node to define loops in loops.
-
-- Defining a Switch Loop
-
-A switch node is equivalent to a switch C. It has an input port (which name
-is select) that accepts integer data. According to the value in the select
-port one or another case node is selected for execution. Each case is defined
-in a case tag with one attribute id that must be an integer or default. If no case
-is defined for the select value the switch node uses the default case.
-A case can contain one and only one internal node.
-
-A minimal but almost complete example :
-\code
- <inline name="n" >
- <script>
- <code>select=3</code>
- </script>
- <outport name="select" type="int"/>
- </inline>
-
- <switch name="b1">
- <case id="3">
- <inline name="n2" >
- <script><code>print p1</code></script>
- <inport name="p1" type="double"/>
- <outport name="p1" type="double"/>
- </inline>
- </case>
- <default>
- <inline name="n2" >
- <script><code>print p1</code></script>
- <inport name="p1" type="double"/>
- <outport name="p1" type="double"/>
- </inline>
- </default>
- </switch>
-
- <control> <fromnode>n</fromnode> <tonode>b1</tonode> </control>
- <datalink> <fromnode>n</fromnode><fromport>select</fromport>
- <tonode>b1</tonode> <toport>select</toport> </datalink>
- <parameter>
- <tonode>b1.3.n2</tonode> <toport>p1</toport>
- <value><double>54</double> </value>
- </parameter>
- <parameter>
- <tonode>b1.default.n2</tonode> <toport>p1</toport>
- <value><double>54</double> </value>
- </parameter>
-\endcode
-
-\section loader_programming Programming with the yacs loader class
-
-To use the yacs loader class, first create a specific runtime (here a Salome one).
-
-Then you can create an instance of the yacsloader class and call
-the load method with the name of the XML file as argument.
-
-The call to the method will return a calculation schema (instance of the Proc class).
-
-\code
-#include "RuntimeSALOME.hxx"
-#include "parser.hxx"
-
-YACS::ENGINE::RuntimeSALOME::setRuntime();
-YACS::YACSLoader loader;
-
-YACS::ENGINE::Proc* p=loader.load("file.xml");
-
-\endcode
-
-You can then dump to a file a graphviz diagram by calling the writeDot
-method on the schema.
-
-\code
-#include <fstream>
-
-std::ofstream f("proc.dot");
-p->writeDot(f);
-f.close();
-\endcode
-
-You can display the diagram with: dot -Tpng proc.dot |display.
-
-And then execute the schema with an Executor.
-
-\code
-#include "Executor.hxx"
-
-YACS::ENGINE::Executor executor;
-executor.RunW(p);
-\endcode
-
-
-*/
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm/unix/make_begin.am
IDL_FILES = yacsgui.idl
EXTRA_DIST = $(IDL_FILES)
+lib_LTLIBRARIES = libSalomeIDLYACS.la
+
+libSalomeIDLYACS_la_SOURCES = $(IDL_SRC)
+
+libSalomeIDLYACS_la_LIBADD = \
+ $(OMNIORB_LIBS)
+
+libSalomeIDLYACS_la_CXXFLAGS = \
+ $(OMNIORB_INCLUDES) \
+ -I$(KERNEL_ROOT_DIR)/include/salome \
+ $(OMNIORB_CXXFLAGS)
+
install-exec-local: install-pyidl
uninstall-local:
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __YACSGUI_IDL__
#define __YACSGUI_IDL__
long getNodeState(in long numid);
string getXMLState(in long numid);
string getInPortValue(in long nodeNumid, in string portName);
+ string setInPortValue(in string nodeName, in string portName, in string value);
string getOutPortValue(in long nodeNumid, in string portName);
string getErrorDetails(in long nodeNumid);
string getErrorReport(in long nodeNumid);
string getContainerLog(in long nodeNumid);
+ void shutdownProc(in long level);
long getExecutorState();
void getIds(out longArray numids,out stringArray names);
longArray getNumIds();
void Run();
void RunFromState(in string xmlfile);
+ void RestartFromState(in string xmlfile);
void addObserver(in Observer obs,in long numid, in string event);
void setExecMode(in executionMode mode);
void setListOfBreakPoints(in stringArray listOfBreakPoints);
void unsetStopOnError();
};
- interface YACS_Gen : Engines::Component, SALOMEDS::Driver
+ interface YACS_Gen : Engines::EngineComponent, SALOMEDS::Driver
{
ProcExec LoadProc(in string xmlFile);
string convertSupervFile(in string xmlFile);
};
-#endif
+#endif
#! /bin/sh
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
#! /bin/sh
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
# --
# Author : Erwan ADAM (CEA)
# --
+++ /dev/null
-#!/bin/sh
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-#
-# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
-cd ${CONF_DIR}
-
-TO_CLEAN=
-TO_CLEAN=${TO_CLEAN}' build_configure.log'
-TO_CLEAN=${TO_CLEAN}' Makefile.am.list'
-TO_CLEAN=${TO_CLEAN}' aclocal.m4'
-TO_CLEAN=${TO_CLEAN}' autom4te*'
-TO_CLEAN=${TO_CLEAN}' configure'
-TO_CLEAN=${TO_CLEAN}' configure.in'
-TO_CLEAN=${TO_CLEAN}' missing'
-TO_CLEAN=${TO_CLEAN}' install-sh'
-TO_CLEAN=${TO_CLEAN}' ltmain.sh'
-TO_CLEAN=${TO_CLEAN}' config.guess'
-TO_CLEAN=${TO_CLEAN}' config.sub'
-TO_CLEAN=${TO_CLEAN}' depcomp'
-TO_CLEAN=${TO_CLEAN}' yacs_config.h.in'
-
-rm -rf $TO_CLEAN > /dev/null
-
-l=`find . -name "Makefile.in" -or -name "*~"`
-
-if test X"$l" != X ; then
- rm -f $l
-fi
-
-find . -name "semantic.cache" -print -exec rm {} \;
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
+MAIN_SUBDIRS = bases engine engine_swig runtime runtime_swig wrappergen yacsloader yacsloader_swig yacsorb salomeloader
+
+if WITH_QT4
if HAS_GUI
-SUBDIRS = bases engine runtime wrappergen yacsloader yacsorb salomeloader pyqt hmi salomewrap genericgui salomegui
-else
-SUBDIRS = bases engine runtime wrappergen yacsloader yacsorb salomeloader hmi
+GUI_SUBDIRS = pyqt hmi salomewrap genericgui salomegui salomegui_swig
endif
+endif
+
+SUBDIRS = $(MAIN_SUBDIRS) $(GUI_SUBDIRS)
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#include "AlternateThread.hxx"
+
+#if defined(YACS_PTHREAD)
+
+#include "AlternateThreadPT.cxx"
+
+#else
+#error
+#endif
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef __ALTERNATETHREAD_HXX__
+#define __ALTERNATETHREAD_HXX__
+
+#if defined(YACS_PTHREAD)
+#include "AlternateThreadPT.hxx"
+
+namespace YACS
+{
+ namespace BASES
+ {
+ typedef AlternateThreadPT AlternateThread;
+ }
+}
+#else
+#error
+#endif
+
+#endif
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <iostream>
+#include <typeinfo>
+
+#include "AlternateThreadPT.hxx"
+
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
+using namespace std;
+using namespace YACS::BASES;
+
+AlternateThreadPT::AlternateThreadPT()
+ : _threadStatus(UNEXISTING)
+{
+ YASSERT(pthread_cond_init(&_pingPongCond, NULL) == 0)
+ YASSERT(pthread_mutex_init(&_pingPongMutex, NULL) == 0)
+}
+
+AlternateThreadPT::~AlternateThreadPT()
+{
+ try {
+ terminateSlaveThread();
+ YASSERT(pthread_mutex_destroy(&_pingPongMutex) == 0)
+ YASSERT(pthread_cond_destroy(&_pingPongCond) == 0)
+ } catch (const exception & e) {
+ cerr << "Exception happened in AlternateThreadPT destructor: " << e.what() << endl;
+ } catch (...) {
+ cerr << "Unknown exception happened in AlternateThreadPT destructor." << endl;
+ }
+}
+
+void AlternateThreadPT::start()
+{
+ // This method must not be called if a slave thread is running
+ YASSERT(_threadStatus == UNEXISTING)
+
+ YASSERT(pthread_mutex_lock(&_pingPongMutex) == 0)
+ DEBTRACE("Starting thread")
+ YASSERT(pthread_create(&_threadId, 0, runThread, this) == 0)
+ DEBTRACE("Master waiting for slave")
+ YASSERT(pthread_cond_wait(&_pingPongCond, &_pingPongMutex) == 0)
+ DEBTRACE("Master running again")
+}
+
+void AlternateThreadPT::terminateSlaveThread()
+{
+ // This method must not be called by the slave thread
+ YASSERT(_threadStatus == UNEXISTING || !pthread_equal(pthread_self(), _threadId))
+
+ switch (_threadStatus) {
+ case UNEXISTING:
+ return;
+ case READY_TO_JOIN:
+ break;
+ case NORMAL_CYCLE:
+ {
+ // First try to signal the slave thread to end properly
+ DEBTRACE("Master is trying to terminate slave by signaling error")
+ _threadStatus = TERMINATION_REQUESTED;
+ signalSlaveAndWait();
+
+ if (_threadStatus != READY_TO_JOIN) {
+ // Try to cancel the thread
+ cerr << "Warning: Slave thread in AlternateThread did not end properly. "
+ "Thread will be canceled." << endl;
+ YASSERT(pthread_cancel(_threadId) == 0)
+ YASSERT(pthread_cond_wait(&_pingPongCond, &_pingPongMutex) == 0)
+
+ if (_threadStatus != READY_TO_JOIN) {
+ // If cancel failed, we can do nothing more, throw an exception
+ YASSERT(false);
+ }
+ }
+ break;
+ }
+ default:
+ YASSERT(false)
+ }
+
+ // Finally join the thread
+ YASSERT(pthread_mutex_unlock(&_pingPongMutex) == 0)
+ YASSERT(pthread_join(_threadId, NULL) == 0)
+ _threadStatus = UNEXISTING;
+ DEBTRACE("AlternateThread terminated")
+}
+
+void AlternateThreadPT::signalSlaveAndWait()
+{
+ YASSERT(!pthread_equal(pthread_self(), _threadId))
+ DEBTRACE("Master signaling slave and waiting");
+ signalAndWait();
+ DEBTRACE("Master running again");
+}
+
+void AlternateThreadPT::signalMasterAndWait()
+{
+ YASSERT(pthread_equal(pthread_self(), _threadId))
+ DEBTRACE("Slave signaling master and waiting");
+ signalAndWait();
+ DEBTRACE("Slave running again");
+}
+
+void AlternateThreadPT::signalAndWait()
+{
+ YASSERT(_threadStatus == NORMAL_CYCLE || _threadStatus == TERMINATION_REQUESTED)
+ YASSERT(pthread_cond_signal(&_pingPongCond) == 0)
+ YASSERT(pthread_cond_wait(&_pingPongCond, &_pingPongMutex) == 0)
+}
+
+bool AlternateThreadPT::isTerminationRequested() const
+{
+ return (_threadStatus == TERMINATION_REQUESTED);
+}
+
+AlternateThreadPT::ThreadStatus AlternateThreadPT::getThreadStatus() const
+{
+ return _threadStatus;
+}
+
+void * AlternateThreadPT::runThread(void * instance)
+{
+ try {
+ AlternateThreadPT * instanceCst = (AlternateThreadPT *)instance;
+ YASSERT(pthread_mutex_lock(&instanceCst->_pingPongMutex) == 0)
+ DEBTRACE("Slave thread is now running")
+ instanceCst->_threadStatus = NORMAL_CYCLE;
+ pthread_cleanup_push(threadCleanupFct, instance);
+ instanceCst->run();
+ pthread_cleanup_pop(1);
+ } catch (const exception & e) {
+ cerr << "Unrecoverable error: an exception was caught in AlternateThread "
+ "(exceptions should normally be caught before getting here). "
+ "Exception type is: " << typeid(e).name() << ", message is: " <<
+ e.what() << endl;
+ threadCleanupFct(instance);
+ }
+ // We can't catch (...) here because it causes problems with thread cancellation, at least
+ // with gcc 4.1.2 and older. With newer versions it should be possible to do something like
+ // catch (abi::__forced_unwind e) { throw; }. See
+ // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28145 for details.
+ // The problem is that no exception should get out of the thread scope without being caught
+ // (otherwise the program aborts). So for now the user has to take care of catching all
+ // exceptions, but he cannot use catch (...).
+ return NULL;
+}
+
+void AlternateThreadPT::threadCleanupFct(void * instance)
+{
+ // Beware of not throwing exceptions in this method
+ DEBTRACE("Cleaning up slave thread")
+ AlternateThreadPT * instanceCst = (AlternateThreadPT *)instance;
+ instanceCst->_threadStatus = READY_TO_JOIN;
+ pthread_cond_signal(&instanceCst->_pingPongCond);
+ pthread_mutex_unlock(&instanceCst->_pingPongMutex);
+}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef __ALTERNATETHREADPT_HXX__
+#define __ALTERNATETHREADPT_HXX__
+
+#include <pthread.h>
+
+#include "YACSBasesExport.hxx"
+
+namespace YACS
+{
+ namespace BASES
+ {
+ //! This class provides a mechanism to run two threads alternately.
+ /*!
+ * Alternate threads can be necessary when two pieces of code must run alternately
+ * and communicate but are difficult or impossible to synchronize explicitly
+ * (e.g. asynchronous algorithms in optimizer loop). This class guarantees that the
+ * two threads NEVER run concurrently, so no lock mechanism is necessary when sharing
+ * data between them.
+ *
+ * The two threads are called "master thread" and "slave thread". The master thread is
+ * the one that calls the method start() and that will continue to run after the
+ * destruction of this object. The slave thread is created when the method start() is
+ * called. It will run the code in the method run() and will be destroyed when the
+ * master thread calls terminateSlaveThread() or at the destruction of this object.
+ *
+ * When the master thread calls start(), it will block and the slave thread will begin
+ * to execute the code in the method run(). The two threads can then alternate by
+ * calling the method signalMasterAndWait() (in the slave thread) and signalSlaveAndWait()
+ * (in the master thread). Finally, the master thread must call terminateSlaveThread()
+ * to terminate the slave thread. There is no explicit mechanism for the slave thread to
+ * request its own termination, but this can be done with an external flag (see the pool
+ * object in OptimizerLoop for instance).
+ *
+ * This class is purely virtual. Subclasses must implement the run() method that will
+ * be executed in the slave thread.
+ */
+ class YACSBASES_EXPORT AlternateThreadPT
+ {
+ public:
+ enum ThreadStatus {UNEXISTING, NORMAL_CYCLE, TERMINATION_REQUESTED, READY_TO_JOIN};
+
+ AlternateThreadPT();
+ virtual ~AlternateThreadPT();
+
+ //! Create and launch the slave thread.
+ /*!
+ * This method must not be called by the slave thread or
+ * if a slave thread is already running.
+ */
+ void start();
+
+ //! Block the master thread and release the slave thread.
+ virtual void signalSlaveAndWait();
+
+ //! Terminate the slave thread.
+ void terminateSlaveThread();
+
+ //! Block the slave thread and release the master thread.
+ virtual void signalMasterAndWait();
+
+ //! Return true if the master requested the slave thread termination.
+ bool isTerminationRequested() const;
+
+ //! Return the thread status.
+ ThreadStatus getThreadStatus() const;
+
+ protected:
+ //! This method must be implemented in subclasses and will be run in the slave thread.
+ /*!
+ * The slave thread must call signalMasterAndWait() when necessary to give the control
+ * back to the master thread. When returning from this method, the slave thread MUST
+ * check for an eventual termination request (with the method isTerminationRequested()).
+ * If the termination is requested, the slave thread must perform any necessary cleanup
+ * and finish as soon as possible.
+ */
+ virtual void run()=0;
+
+ private:
+ void signalAndWait();
+
+ static void * runThread(void * instance);
+ static void threadCleanupFct(void * instance);
+
+ pthread_t _threadId;
+ ThreadStatus _threadStatus;
+ pthread_cond_t _pingPongCond;
+ pthread_mutex_t _pingPongMutex;
+
+ };
+ }
+}
+
+#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Cstr2d.hxx"
#include "Exception.hxx"
{
std::stringstream msg;
msg << "problem in conversion from string to double: " << s ;
- throw YACS::Exception::Exception(msg.str());
+ throw YACS::Exception(msg.str());
}
return d;
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __CSTR2D_HXX__
#define __CSTR2D_HXX__
-double Cstr2d(const char* s);
+#include "YACSBasesExport.hxx"
+
+YACSBASES_EXPORT double Cstr2d(const char* s);
#endif
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#include "DrivenCondition.hxx"
-
-#if defined(YACS_PTHREAD)
-#include "DrivenConditionPT.cxx"
-#else
-#error
-#endif
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#ifndef __DRIVENCONDITION_HXX__
-#define __DRIVENCONDITION_HXX__
-
-// --- Interface is:
-
-// class DrivenCondition
-// {
-// public:
-// DrivenCondition();
-// ~DrivenCondition();
-// //On master thread
-// void waitForAWait();
-// void notifyOneSync();
-// //On slave thread
-// void wait();
-// };
-
-
-#if defined(YACS_PTHREAD)
-#include "DrivenConditionPT.hxx"
-
-namespace YACS
-{
- namespace BASES
- {
- typedef DrivenConditionPT DrivenCondition;
- }
-}
-#else
-#error
-#endif
-
-
-#endif
-
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#include "DrivenConditionPT.hxx"
-
-using namespace YACS::BASES;
-
-DrivenConditionPT::DrivenConditionPT()
-{
- pthread_mutex_init(&_mutexDesc1, NULL);
- pthread_mutex_init(&_mutexDesc2, NULL);
- pthread_cond_init(&_cond1, NULL);
- pthread_cond_init(&_cond2, NULL);
- pthread_mutex_lock(&_mutexDesc1);
- pthread_mutex_lock(&_mutexDesc2);
-}
-
-DrivenConditionPT::~DrivenConditionPT()
-{
- pthread_cond_destroy(&_cond1);
- pthread_cond_destroy(&_cond2);
- pthread_mutex_destroy(&_mutexDesc1);
- pthread_mutex_destroy(&_mutexDesc2);
-}
-
-void DrivenConditionPT::notifyOneSync()
-{
- pthread_mutex_lock(&_mutexDesc1);
- pthread_cond_signal(&_cond1);
- pthread_mutex_unlock(&_mutexDesc1);
- pthread_cond_wait(&_cond2, &_mutexDesc2);
-}
-
-void DrivenConditionPT::waitForAWait()
-{
- pthread_cond_wait(&_cond2, &_mutexDesc2);
-}
-
-void DrivenConditionPT::wait()
-{
- pthread_mutex_lock(&_mutexDesc2);
- pthread_cond_signal(&_cond2);
- pthread_mutex_unlock(&_mutexDesc2);
- pthread_cond_wait(&_cond1,&_mutexDesc1);
-}
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#ifndef __DRIVENCONDITIONPT_HXX__
-#define __DRIVENCONDITIONPT_HXX__
-
-#include <pthread.h>
-
-namespace YACS
-{
- namespace BASES
- {
- class DrivenConditionPT
- {
- public:
- DrivenConditionPT();
- ~DrivenConditionPT();
- //On master thread
- void waitForAWait();
- void notifyOneSync();
- //On slave thread
- void wait();
- private:
- pthread_cond_t _cond1;
- pthread_cond_t _cond2;
- pthread_mutex_t _mutexDesc1;
- pthread_mutex_t _mutexDesc2;
- };
- }
-}
-
-#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "DynLibLoader.hxx"
#if defined(YACS_PTHREAD)
+#if defined(WNT)
+#include "DynLibLoaderWin.cxx"
+#else
#include "DynLibLoaderGNU.cxx"
+#endif
#else
#error
#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __DYNLIBLOADER_HXX__
#define __DYNLIBLOADER_HXX__
+#include "YACSBasesExport.hxx"
+
#include <string>
// --- Interface is:
#if defined(YACS_PTHREAD)
+#if defined(WNT)
+#include "DynLibLoaderWin.hxx"
+#else
#include "DynLibLoaderGNU.hxx"
+#endif
namespace YACS
{
namespace BASES
{
+#if defined(WNT)
+ typedef DynLibLoaderWin DynLibLoader;
+#else
typedef DynLibLoaderGNU DynLibLoader;
+#endif
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "DynLibLoaderGNU.hxx"
#include <iostream>
#include <dlfcn.h>
+#include "Exception.hxx"
using namespace YACS::BASES;
{
std::string fullLibName(_libName);
fullLibName+=_extForDynLib;
+ dlerror();
_handleOnLoadedLib=dlopen(fullLibName.c_str(),RTLD_LAZY | RTLD_GLOBAL);
+ char *message=dlerror();
+ if (message != NULL)
+ {
+ std::string error = "Error while trying to load library with name " + fullLibName +
+ " with the following internal message: " + message;
+ throw YACS::Exception(error);
+ }
return _handleOnLoadedLib != NULL;
}
char *message=dlerror();
if(stopOnError && (NULL != message))
{
- std::cerr << "Error detected on symbol " << symbName << " search in library with name " << _libName << _extForDynLib;
- std::cerr << " with the following internal message"<< std::endl;
- std::cerr << message << std::endl;
- return 0;
+ std::string error="Error detected on symbol ";
+ error=error+symbName +" search in library with name "+_libName+_extForDynLib+" with the following internal message "+message;
+ throw YACS::Exception(error);
}
else
return ret;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __DYNLIBLOADERGNU_HXX__
#define __DYNLIBLOADERGNU_HXX__
private:
void loadLib() { load(); }//! load lib without regarding that _libName is reachable
void *resolveSymb(const std::string& symbName, bool stopOnError);
+
+ // Forbid the use of copy constructor and assignment operator to avoid messing up
+ // with the library handle
+ DynLibLoaderGNU(const DynLibLoaderGNU & orig) {}
+ DynLibLoaderGNU& operator=(const DynLibLoaderGNU & orig) { return *this; }
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "DynLibLoaderWin.hxx"
#include <iostream>
#include <Windows.h>
DynLibLoaderWin::~DynLibLoaderWin()
{
if(_handleOnLoadedLib)
- dlclose(_handleOnLoadedLib);
+ FreeLibrary(_handleOnLoadedLib);
}
bool DynLibLoaderWin::isLibFileFindable() const
return true;
}
+std::string DynLibLoaderWin::getLibNameWithoutExt() const
+{
+ return _libName;
+}
+
/*!
Append a directory with name \b dirName to the searching paths.
\return If append succeeds 0 is returned.
return 0;
}
-void *DynLibLoaderWin::getHandleOnSymbolWithName(const std::string& symbName)
+void *DynLibLoaderWin::getHandleOnSymbolWithName(const std::string& symbName, bool stopOnError)
{
if(!_handleOnLoadedLib)
if(!isLibFileFindable())
}
else
loadLib();
- return resolveSymb(symbName);
+ return resolveSymb(symbName, stopOnError);
}
-void DynLibLoaderWin::loadLib()
+bool DynLibLoaderWin::load()
{
std::string fullLibName(_libName);
fullLibName+=_extForDynLib;
_handleOnLoadedLib=LoadLibrary(fullLibName.c_str());
+ return _handleOnLoadedLib != NULL;
+}
+
+bool DynLibLoaderWin::unload()
+{
+ if (_handleOnLoadedLib)
+ {
+ FreeLibrary(_handleOnLoadedLib);
+ _handleOnLoadedLib = NULL;
+ }
+ return 0;
+}
+
+bool DynLibLoaderWin::reload()
+{
+ unload();
+ return load();
}
-void *DynLibLoaderWin::resolveSymb(const std::string& symbName)
+void *DynLibLoaderWin::resolveSymb(const std::string& symbName, bool stopOnError)
{
- void *ret=GetProcAddress(_handleOnLoadedLib,symbName.c_str());
- return ret;
+ void *ret=(void*)GetProcAddress(_handleOnLoadedLib,symbName.c_str());
+ char *message="Not available here !";
+ if(stopOnError && (NULL != message))
+ {
+ std::cerr << "Error detected on symbol " << symbName << " search in library with name " << _libName << _extForDynLib;
+ std::cerr << " with the following internal message"<< std::endl;
+ std::cerr << message << std::endl;
+ return 0;
+ }
+ else
+ return ret;
}
const char *DynLibLoaderWin::getExtensionForDynLib()
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __DYNLIBLOADERWIN_HXX__
#define __DYNLIBLOADERWIN_HXX__
+#include "YACSBasesExport.hxx"
+
#include <string>
+#include <windows.h>
namespace YACS
{
namespace BASES
{
- class DynLibLoaderWin
+ class YACSBASES_EXPORT DynLibLoaderWin
{
private:
- void *_handleOnLoadedLib;
+ HMODULE _handleOnLoadedLib;
std::string _libName;
static const char _extForDynLib[];
public:
DynLibLoaderWin(const std::string& libNameWithoutExtension);
~DynLibLoaderWin();
bool isLibFileFindable() const;
+ std::string getLibNameWithoutExt() const;
int appendDirInSearchPath(const std::string& dirName);
int removeDirInSearchPath(const std::string& dirName);
- void *getHandleOnSymbolWithName(const std::string& symbName);
+ void *getHandleOnSymbolWithName(const std::string& symbName, bool stopOnError=true);
static const char *getExtensionForDynLib();
+ bool load();
+ bool reload();
+ bool unload();
+
private:
- void loadLib();//! load lib without regarding that _libName is reachable
- void *resolveSymb(const std::string& symbName);
+ void loadLib() { load(); }//! load lib without regarding that _libName is reachable
+ void *resolveSymb(const std::string& symbName, bool stopOnError);
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Exception.hxx"
+#include <stdlib.h>
using namespace YACS;
-Exception::Exception(const std::string& what):_what(what)
+//#define _DEVDEBUG_
+
+#ifdef _DEVDEBUG_
+#include <execinfo.h>
+#endif
+
+Exception::Exception(const std::string& what,int errNumber):_what(what),errNumber(errNumber)
{
+#ifdef _DEVDEBUG_
+ void *array[20];
+ size_t size=10;
+ char **strings;
+ size_t i;
+
+ size = backtrace (array, 10);
+ strings = backtrace_symbols (array, size);
+
+ _what=_what+'\n';
+ for (i = 0; i < size; i++)
+ _what=_what+strings[i]+'\n';
+
+ free (strings);
+#endif
}
const char *Exception::what( void ) const throw ()
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __EXCEPTION_HXX__
#define __EXCEPTION_HXX__
+#include "YACSBasesExport.hxx"
+
#include <string>
#include <exception>
namespace YACS
{
- class Exception : public std::exception
+ class YACSBASES_EXPORT Exception : public std::exception
{
protected:
std::string _what;
public:
- Exception(const std::string& what);
+ Exception(const std::string& what,int errNumber=0);
const char *what( void ) const throw ();
virtual ~Exception() throw ();
+ int errNumber;
};
}
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm/unix/make_begin.am
SUBDIRS = Test
noinst_LTLIBRARIES = libYACSBases.la
-libYACSBases_la_SOURCES = Exception.cxx Thread.cxx Mutex.cxx Semaphore.cxx \
- DynLibLoader.cxx DrivenCondition.cxx \
- Cstr2d.cxx YacsTrace.cxx chrono.cxx \
+libYACSBases_la_SOURCES = \
+ Exception.cxx Thread.cxx AlternateThread.cxx \
+ Mutex.cxx Semaphore.cxx DynLibLoader.cxx \
+ Cstr2d.cxx YacsTrace.cxx chrono.cxx \
$(__dummy__)
-EXTRA_libYACSBases_la_SOURCES =
+EXTRA_libYACSBases_la_SOURCES = \
Thread.hxx ThreadPT.hxx ThreadPT.cxx \
+ AlternateThread.hxx AlternateThreadPT.hxx \
+ AlternateThreadPT.cxx \
Mutex.hxx MutexPT.cxx MutexPT.hxx \
Semaphore.hxx SemaphorePT.cxx SemaphorePT.hxx \
- DynLibLoader.hxx DynLibLoaderGNU.hxx \
- DrivenCondition.hxx DrivenConditionPT.hxx \
- Exception.hxx \
+ DynLibLoader.hxx Exception.hxx chrono.hxx \
$(__dummy__)
-salomeinclude_HEADERS = \
+if WINDOWS
+EXTRA_libYACSBases_la_SOURCES += DynLibLoaderWin.hxx
+else
+EXTRA_libYACSBases_la_SOURCES += DynLibLoaderGNU.hxx
+endif
+
+libYACSBases_la_LIBADD = $(PTHREAD_LIBS)
+
+salomeinclude_HEADERS = \
+ YACSBasesExport.hxx \
Cstr2d.hxx \
define.hxx \
- DrivenCondition.hxx \
- DrivenConditionPT.hxx \
DynLibLoaderGNU.hxx \
DynLibLoader.hxx \
DynLibLoaderWin.hxx \
SemaphorePT.hxx \
Thread.hxx \
ThreadPT.hxx \
+ AlternateThread.hxx \
+ AlternateThreadPT.hxx \
YacsTrace.hxx \
yacsconfig.h \
+ chrono.hxx \
$(__dummy__)
AM_CXXFLAGS = $(THREAD_DEF)
-EXTRA_DIST=ThreadPT.cxx DrivenConditionPT.cxx MutexPT.cxx SemaphorePT.cxx DynLibLoaderGNU.cxx
+EXTRA_DIST=ThreadPT.cxx AlternateThreadPT.cxx MutexPT.cxx \
+ SemaphorePT.cxx DynLibLoaderGNU.cxx
include $(top_srcdir)/adm/unix/make_end.am
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Mutex.hxx"
#if defined(YACS_PTHREAD)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __MUTEX_HXX__
#define __MUTEX_HXX__
{
typedef MutexPT Mutex;
typedef ConditionPT Condition;
+ struct Lock
+ {
+ YACS::BASES::Mutex * _mutex;
+ Lock(YACS::BASES::Mutex * mutex) : _mutex(mutex) {_mutex->lock();};
+ ~Lock() {_mutex->unlock();};
+ };
}
}
#else
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "MutexPT.hxx"
using namespace YACS::BASES;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __MUTEXPT_HXX__
#define __MUTEXPT_HXX__
+#include "YACSBasesExport.hxx"
+
#include <pthread.h>
namespace YACS
{
class ConditionPT;
- class MutexPT
+ class YACSBASES_EXPORT MutexPT
{
public:
MutexPT();
};
- class ConditionPT
+ class YACSBASES_EXPORT ConditionPT
{
public:
ConditionPT();
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Semaphore.hxx"
#if defined(YACS_PTHREAD)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __SEMAPHORE_HXX__
#define __SEMAPHORE_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SemaphorePT.hxx"
using namespace YACS::BASES;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __SEMAPHOREPT_HXX__
#define __SEMAPHOREPT_HXX__
+#include "YACSBasesExport.hxx"
+
#include <semaphore.h>
namespace YACS
{
namespace BASES
{
- class SemaphorePT
+ class YACSBASES_EXPORT SemaphorePT
{
public:
SemaphorePT(int initValue=0);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _BASICMAINTEST_HXX_
#define _BASICMAINTEST_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
extern "C" double myYacsFct(double d)
{
return 7.*d*d;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "UnitTestsResult.hxx"
#include <stdlib.h>
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm/unix/make_begin.am
AM_CXXFLAGS = $(THREAD_DEF) -I$(srcdir)/..
-check_PROGRAMS = InitTests TestBases
+check_PROGRAMS = InitTests
+if CPPUNIT_IS_OK
+check_PROGRAMS += TestBases
+endif
lib_LTLIBRARIES = libYACSDLTest.la
TestBases_CXXFLAGS = $(THREAD_DEF) $(CPPUNIT_INCLUDES) -I$(srcdir)/..
-TESTS = InitTests TestBases
+TESTS = InitTests
+if CPPUNIT_IS_OK
+TESTS += TestBases
+endif
EXTRA_DIST = BasicMainTest.hxx basesTest.hxx UnitTestsResult.hxx
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#define UNIT_TEST_HEADER " --- TEST src/bases"
#include "basesTest.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _UNITTESTSRESULT_HXX_
#define _UNITTESTSRESULT_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "basesTest.hxx"
#include <iostream>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _BASESTEST_HXX_
#define _BASESTEST_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Thread.hxx"
#if defined(YACS_PTHREAD)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __THREAD_HXX__
#define __THREAD_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "ThreadPT.hxx"
#include "Exception.hxx"
+#ifdef WNT
+#include <windows.h>
+#define usleep(A) Sleep(A/1000)
+#else
#include <unistd.h>
+#endif
using namespace YACS::BASES;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __THREADPT_HXX__
#define __THREADPT_HXX__
+#include "YACSBasesExport.hxx"
+
#include <pthread.h>
namespace YACS
{
namespace BASES
{
- class ThreadPT
+ class YACSBASES_EXPORT ThreadPT
{
public:
typedef void *(*ThreadJob)(void*);
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _YACSBASESEXPORT_HXX_
+#define _YACSBASESEXPORT_HXX_
+
+#ifdef WNT
+// # if defined YACSBases_EXPORTS
+// # define YACSBASES_EXPORT __declspec( dllexport )
+// # else
+// # define YACSBASES_EXPORT __declspec( dllimport )
+// # endif
+# define YACSBASES_EXPORT // noinst ...
+#else
+# define YACSBASES_EXPORT
+#endif
+
+#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include <iostream>
#include <sstream>
#include "YacsTrace.hxx"
#include <cstdlib>
+#ifdef WNT
+#include <process.h>
+#define getpid _getpid
+#else
+#include <unistd.h>
+#endif
+
+namespace YACS{
+ int traceLevel=0;
+}
+
void AttachDebugger()
{
if(getenv ("YACSDEBUGGER"))
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __YACSTRACE_HXX__
#define __YACSTRACE_HXX__
+#include "YACSBasesExport.hxx"
+#include "Exception.hxx"
+
#include <iostream>
+#include <sstream>
#ifdef _DEVDEBUG_
#define DEBTRACE(msg) {std::cerr<<std::flush<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<std::endl<<std::flush;}
#define DEBTRACE(msg)
#endif
+namespace YACS{
+extern YACSBASES_EXPORT int traceLevel;
+}
+
+//! YACSTRACE macro for dynamic trace: print only if YACS_TRACELEVEL environment variable is set and level is less than its value
+#define YACSTRACE(level,msg) {if(YACS::traceLevel >=level)std::cerr<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<std::endl;}
+
+//! YASSERT macro is always defined, used like assert, but throw a YACS::Exception instead of abort
+
+#define YASSERT(val) {if(!(val)){std::stringstream mess; mess<<__FILE__<<" ["<<__LINE__<<"] : assertion "<<#val<<" failed"; throw YACS::Exception(mess.str());}}
+
void AttachDebugger();
#endif
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#include "chrono.hxx"
-#define _DEVDEBUG_
+//#define _DEVDEBUG_
#include "YacsTrace.hxx"
using namespace std;
for (int i=0; i < _nbChrono; i++)
if (_ctrs[i]._ctrOccur)
{
- DEBTRACE("Compteur[" << i << "]: "<< _ctrs[i]._ctrNames << "[" << _ctrs[i]._ctrLines << "]");
- DEBTRACE(" " << _ctrs[i]._ctrOccur);
- DEBTRACE(" " << _ctrs[i]._ctrCumul);
+ std::cerr << "Compteur[" << i << "]: "<< _ctrs[i]._ctrNames << "[" << _ctrs[i]._ctrLines << "]" << std::endl;
+ std::cerr << " " << _ctrs[i]._ctrOccur << std::endl;
+ std::cerr << " " << _ctrs[i]._ctrCumul << std::endl;
}
}
chrono::chrono(int i) : _ctr(i), _run(true)
{
+ //DEBTRACE("chrono::chrono " << _ctr << " " << _run);
_start = clock();
}
void chrono::stop()
{
+ //DEBTRACE("chrono::stop " << _ctr << " " << _run);
if (_run)
{
_run = false;
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
#ifndef _CHRONO_HXX_
#define _CHRONO_HXX_
+#include "YACSBasesExport.hxx"
+
#include <vector>
#include <string>
#include <iostream>
#include <ctime>
+#ifdef WIN32
+#else
+#include <sys/time.h>
+#endif
typedef struct acnt
{
double _ctrCumul;
} cntStruct;
-class counters
+class YACSBASES_EXPORT counters
{
public:
static cntStruct *_ctrs;
int _nbChrono;
};
-class chrono
+class YACSBASES_EXPORT chrono
{
public:
chrono(int i);
clock_t _start, _end;
};
+#ifndef START_TIMING
+static long tcount=0;
+static long cumul;
+#ifdef WIN32
+static time_t tv;
+#else
+static timeval tv;
+#endif
+#define START_TIMING gettimeofday(&tv,0);long tt0=tv.tv_usec+tv.tv_sec*1000000;
+#define END_TIMING(NUMBER) \
+ tcount=tcount+1;gettimeofday(&tv,0);cumul=cumul+tv.tv_usec+tv.tv_sec*1000000 -tt0; \
+ if(tcount==NUMBER){ std::cerr << __FILE__<<":"<<__LINE__<<" temps CPU(mus): "<<cumul<< std::endl; tcount=0 ;cumul=0; }
+#endif
+
#ifdef CHRONODEF
-#define CHRONO(i) counters::_ctrs[i]._ctrNames = __FILE__; \
+#define CHRONO(i) counters::_ctrs[i]._ctrNames = (char *)__FILE__; \
counters::_ctrs[i]._ctrLines = __LINE__; \
chrono aChrono##i(i);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __DEFINE_HXX__
#define __DEFINE_HXX__
LOADFAILED = 108,
EXECFAILED = 109,
PAUSE = 110,
+ TORECONNECT = 111,
INTERNALERR = 666,
DISABLED = 777,
FAILED = 888,
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __yacsconfig_h__
#define __yacsconfig_h__
+#ifdef CMAKE_BUILD
+#else
#include <yacs_config.h>
+#endif
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Any.hxx"
#include "Runtime.hxx"
#include "TypeCode.hxx"
}
/*!
- * \Note : no copy is performed if a deallocator is given.
+ * \note : no copy is performed if a deallocator is given.
* \param val : String in C format that is NOT copied if
* deAlloc != 0
* \param deAlloc : pointer on function to deallocate val after
return new AtomAny(val,dealloc);
}
-AnyPtr AtomAny::operator[](int i) const throw(Exception)
+AnyPtr AtomAny::operator[](int i) const throw(YACS::Exception)
{
throw InvalidExtractionException(_type->kind(),Sequence);
}
-AnyPtr AtomAny::operator[](const char *key) const throw(Exception)
+AnyPtr AtomAny::operator[](const char *key) const throw(YACS::Exception)
{
throw Exception("AtomAny::operator[] : try to get a part of a partitionned data whereas atomical.");
}
return false;
}
-int AtomAny::getIntValue() const throw(Exception)
+int AtomAny::getIntValue() const throw(YACS::Exception)
{
if(_type->isA(Runtime::_tc_int))
return _value._i;
throw Exception("Value is not an int");
}
-bool AtomAny::getBoolValue() const throw(Exception)
+bool AtomAny::getBoolValue() const throw(YACS::Exception)
{
if(_type->isA(Runtime::_tc_bool))
return _value._b;
throw Exception("Value is not a bool");
}
-double AtomAny::getDoubleValue() const throw(Exception)
+double AtomAny::getDoubleValue() const throw(YACS::Exception)
{
if(_type->isA(Runtime::_tc_double))
return _value._d;
throw Exception("Value is not a double");
}
-std::string AtomAny::getStringValue() const throw(Exception)
+std::string AtomAny::getStringValue() const throw(YACS::Exception)
{
if(_type->isA(Runtime::_tc_string))
return string(_value._s->cStr());
* For memory space minimal use, not all of '*this' is pushed at data location.
* 'deepCpy' param is not used here because by definition of AtomAny deep copy is performed.
* \param data : already allocated memory zone where to put compressed content of 'this'
+ * \param src :
+ * \param type :
+ * \param deepCpy :
*/
void AtomAny::putReprAtPlace(char *data, const char *src, const TypeCode *type, bool deepCpy)
{
AtomAny::~AtomAny()
{
- if(_type->isA(Runtime::_tc_string))
+ if(_type->kind() == String)
delete _value._s;
}
_type->decrRef();
}
-AnyPtr ComposedAny::operator[](const char *key) const throw(Exception)
+AnyPtr ComposedAny::operator[](const char *key) const throw(YACS::Exception)
{
throw Exception("AtomAny::operator[] : try to get a part of a partitionned data not localizable by a string.");
}
-void ComposedAny::checkTypeOf(const Any *elem) const throw(Exception)
+void ComposedAny::checkTypeOf(const Any *elem) const throw(YACS::Exception)
{
if(!elem->getType()->isA(_type->contentType()))
throw Exception("ComposedAny::checkTypeOf : invalid type.");
}
-int ComposedAny::getIntValue() const throw(Exception)
+int ComposedAny::getIntValue() const throw(YACS::Exception)
{
throw InvalidExtractionException(_type->kind(),Runtime::_tc_int->kind());
}
-bool ComposedAny::getBoolValue() const throw(Exception)
+bool ComposedAny::getBoolValue() const throw(YACS::Exception)
{
throw InvalidExtractionException(_type->kind(),Runtime::_tc_bool->kind());
}
-double ComposedAny::getDoubleValue() const throw(Exception)
+double ComposedAny::getDoubleValue() const throw(YACS::Exception)
{
throw InvalidExtractionException(_type->kind(),Runtime::_tc_double->kind());
}
-std::string ComposedAny::getStringValue() const throw(Exception)
+std::string ComposedAny::getStringValue() const throw(YACS::Exception)
{
throw InvalidExtractionException(_type->kind(),Runtime::_tc_string->kind());
}
/*!
* \note: This performs the placement new or zip info into pt.
+ * \param pt :
* \param val : the source from which the construction will be performed.
+ * \param tc :
* \param deepCpy : If true in pt place a deep copy pointed by val will be put.
*/
void SeqAlloc::construct(char *pt, const char *val, const TypeCode *tc, bool deepCpy)
return true;
}
-void SequenceAny::setEltAtRank(int i, const Any *elem) throw(Exception)
+void SequenceAny::setEltAtRank(int i, const Any *elem) throw(YACS::Exception)
{
checkTypeOf(elem);
_alloc.destroy(_alloc._start+i*_alloc._sizeOf1Elm,_type->contentType());
_alloc.construct(_alloc._start+i*_alloc._sizeOf1Elm,elem);
}
-AnyPtr SequenceAny::operator[](int i) const throw(Exception)
+AnyPtr SequenceAny::operator[](int i) const throw(YACS::Exception)
{
return _type->contentType()->getOrBuildAnyFromZippedData(_alloc._start+i*_alloc._sizeOf1Elm);
}
}
}
-void ArrayAny::setEltAtRank(int i, const Any *elem) throw(Exception)
+void ArrayAny::setEltAtRank(int i, const Any *elem) throw(YACS::Exception)
{
checkTypeOf(elem);
const TypeCode *subType=_type->contentType();
return true;
}
-AnyPtr ArrayAny::operator[](int i) const throw(Exception)
+AnyPtr ArrayAny::operator[](int i) const throw(YACS::Exception)
{
const TypeCode *subType=_type->contentType();
unsigned sizePerContent=subType->getSizeInByteOfAnyReprInSeq();
return true;
}
-AnyPtr StructAny::operator[](int i) const throw(Exception)
+AnyPtr StructAny::operator[](int i) const throw(YACS::Exception)
{
const char what[]="StructAny::operator[](int i) : Struct key are strings not integers.";
throw Exception(what);
}
-AnyPtr StructAny::operator[](const char *key) const throw(Exception)
+AnyPtr StructAny::operator[](const char *key) const throw(YACS::Exception)
{
const TypeCodeStruct *typeC=(const TypeCodeStruct *)_type;
char *whereToGet=_data;
return (*iter).second->getOrBuildAnyFromZippedData(whereToGet);
}
-void StructAny::setEltAtRank(int i, const Any *elem) throw(Exception)
+void StructAny::setEltAtRank(int i, const Any *elem) throw(YACS::Exception)
{
const char what[]="Struct key are strings not integers.";
throw Exception(what);
}
-void StructAny::setEltAtRank(const char *key, const Any *elem) throw(Exception)
+void StructAny::setEltAtRank(const char *key, const Any *elem) throw(YACS::Exception)
{
const TypeCodeStruct *typeC=(const TypeCodeStruct *)_type;
unsigned offset;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __YACSANY_HXX__
#define __YACSANY_HXX__
+#include "YACSlibEngineExport.hxx"
#include "RefCounter.hxx"
#include "Exception.hxx"
#include "SharedPtr.hxx"
class TypeCodeStruct;
typedef void (*Deallocator)(void *);
- class StringOnHeap
+ class YACSLIBENGINE_EXPORT StringOnHeap
{
friend class Any;
friend class AtomAny;
* \brief: Interface for management of storage of data formated dynamically in its TypeCode.
* Warning virtual inheritance on Any daughter classes NOT supported.
*/
- class Any : public RefCounter
+ class YACSLIBENGINE_EXPORT Any : public RefCounter
{
friend class SeqAlloc;
friend class ArrayAny;
virtual std::string getStringValue() const throw(Exception) = 0;
//
protected:
+#ifndef SWIG
virtual ~Any();
+#endif
Any(TypeCode* type);
Any(const Any& other);
virtual void putMyReprAtPlace(char *data) const = 0;
typedef SharedPtr<AtomAny> AtomAnyPtr;
- class AtomAny : public Any
+ class YACSLIBENGINE_EXPORT AtomAny : public Any
{
friend class TypeCode;
ValueContainer _value;
};
- class SeqAlloc
+ class YACSLIBENGINE_EXPORT SeqAlloc
{
friend class SequenceAny;
unsigned int size() const;
};
- class ComposedAny : public Any
+ class YACSLIBENGINE_EXPORT ComposedAny : public Any
{
public:
virtual void setEltAtRank(int i, const Any *elem) throw(Exception) = 0;
typedef SharedPtr<SequenceAny> SequenceAnyPtr;
- class SequenceAny : public ComposedAny
+ class YACSLIBENGINE_EXPORT SequenceAny : public ComposedAny
{
friend class TypeCodeSeq;
public:
typedef SharedPtr<ArrayAny> ArrayAnyPtr;
- class ArrayAny : public ComposedAny
+ class YACSLIBENGINE_EXPORT ArrayAny : public ComposedAny
{
friend class TypeCodeArray;
public:
typedef SharedPtr<StructAny> StructAnyPtr;
- class StructAny : public ComposedAny
+ class YACSLIBENGINE_EXPORT StructAny : public ComposedAny
{
friend class TypeCodeStruct;
public:
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "AnyInputPort.hxx"
#include "TypeCode.hxx"
#include <iostream>
#include <sstream>
+#include "Mutex.hxx"
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
using namespace YACS::ENGINE;
using namespace std;
-AnyInputPort::AnyInputPort(const std::string& name, Node *node, TypeCode* type):InputPort(name,node,type),DataPort(name,node,type),Port(node),_value(0)
+AnyInputPort::AnyInputPort(const std::string& name, Node *node, TypeCode* type, bool canBeNull)
+ : InputPort(name, node, type, canBeNull),
+ DataPort(name, node, type),
+ Port(node),
+ _value(0)
{
}
-AnyInputPort::AnyInputPort(const AnyInputPort& other, Node *newHelder):InputPort(other,newHelder),DataPort(other,newHelder),Port(other,newHelder),_value(0)
+AnyInputPort::AnyInputPort(const AnyInputPort& other, Node *newHelder)
+ : InputPort(other, newHelder),
+ DataPort(other, newHelder),
+ Port(other, newHelder),
+ _value(0)
{
if(other._value)
_value=other._value->clone();
void AnyInputPort::put(Any *data)
{
- if(_value)
+ YACS::BASES::Lock lock(&_mutex);
+ if(_value)
_value->decrRef();
_value=data;
- _value->incrRef();
- DEBTRACE("value ref count: " << _value->getRefCnt());
+ if (_value) {
+ _value->incrRef();
+ DEBTRACE("value ref count: " << _value->getRefCnt());
+ }
}
bool AnyInputPort::isEmpty()
return (void *)_value;
}
-std::string AnyInputPort::getAsString()
+std::string AnyInputPort::getAsString()
{
+ YACS::BASES::Lock lock(&_mutex);
return getRuntime()->convertNeutralAsString(edGetType(),_value);
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __ANYINPUTPORT_HXX__
#define __ANYINPUTPORT_HXX__
+#include "YACSlibEngineExport.hxx"
#include "InputPort.hxx"
+#include "Mutex.hxx"
+
#include <string>
namespace YACS
{
namespace ENGINE
{
- class AnyInputPort : public InputPort
+ class YACSLIBENGINE_EXPORT AnyInputPort : public InputPort
{
public:
- AnyInputPort(const std::string& name, Node *node, TypeCode* type);
+ AnyInputPort(const std::string& name, Node *node, TypeCode* type, bool canBeNull = false);
AnyInputPort(const AnyInputPort& other, Node *newHelder);
virtual ~AnyInputPort();
void exSaveInit();
virtual std::string typeName() {return "YACS__ENGINE__AnyInputPort";}
protected:
Any *_value;
+ private:
+ YACS::BASES::Mutex _mutex;
};
}
}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "AnyOutputPort.hxx"
+#include "Any.hxx"
+#include "Runtime.hxx"
+
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
+using namespace std;
+using namespace YACS::ENGINE;
+
+AnyOutputPort::AnyOutputPort(const std::string& name, Node *node, TypeCode *type):OutputPort(name,node,type),
+ DataPort(name,node,type),Port(node),_data(0)
+{
+}
+
+AnyOutputPort::AnyOutputPort(const AnyOutputPort& other, Node *newHelder):OutputPort(other,newHelder),
+ DataPort(other,newHelder),
+ Port(other,newHelder),_data(0)
+{
+}
+
+AnyOutputPort::~AnyOutputPort()
+{
+ if(_data)
+ _data->decrRef();
+}
+
+//! store the current dispatched value
+void AnyOutputPort::setValue(Any *data)
+{
+ YACS::BASES::Lock lock(&_mutex);
+ if(_data)
+ _data->decrRef();
+ _data = data;
+ if(_data)
+ _data->incrRef();
+}
+
+OutputPort *AnyOutputPort::clone(Node *newHelder) const
+{
+ return new AnyOutputPort(*this,newHelder);
+}
+
+void AnyOutputPort::put(const void *data) throw(ConversionException)
+{
+ put((YACS::ENGINE::Any *)data);
+}
+
+void AnyOutputPort::put(YACS::ENGINE::Any *data) throw(ConversionException)
+{
+ setValue(data);
+ OutputPort::put(data);
+}
+
+std::string AnyOutputPort::getAsString()
+{
+ YACS::BASES::Lock lock(&_mutex);
+ return getRuntime()->convertNeutralAsString(edGetType(),_data);
+}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef __ANYOUTPUTPORT_HXX__
+#define __ANYOUTPUTPORT_HXX__
+
+#include "YACSlibEngineExport.hxx"
+#include "OutputPort.hxx"
+#include "Mutex.hxx"
+
+namespace YACS
+{
+ namespace ENGINE
+ {
+ class Any;
+
+ class YACSLIBENGINE_EXPORT AnyOutputPort : public OutputPort
+ {
+ public:
+ AnyOutputPort(const std::string& name, Node *node, TypeCode *type);
+ AnyOutputPort(const AnyOutputPort& other, Node *newHelder);
+ virtual ~AnyOutputPort();
+ virtual void setValue(Any *data);
+ virtual void put(const void *data) throw(ConversionException);
+ void put(Any *data) throw(ConversionException);
+ //! get the current dispatched value for update port value
+ Any* getValue() const { return _data; }
+ virtual std::string getAsString();
+ virtual std::string typeName() {return "YACS__ENGINE__AnyOutputPort";}
+ private:
+ Any* _data; // the data dispatched from port on the current moment
+ private:
+ OutputPort *clone(Node *newHelder) const;
+ YACS::BASES::Mutex _mutex;
+ };
+ }
+}
+
+#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Bloc.hxx"
#include "LinkInfo.hxx"
#include "InputPort.hxx"
+#include "InputDataStreamPort.hxx"
#include "OutputPort.hxx"
+#include "OutputDataStreamPort.hxx"
#include "ElementaryNode.hxx"
#include "Visitor.hxx"
using namespace YACS::ENGINE;
using namespace std;
+/*! \class YACS::ENGINE::Bloc
+ * \brief Composed node to group elementary and composed nodes
+ *
+ * \ingroup Nodes
+ */
+
Bloc::Bloc(const Bloc& other, ComposedNode *father, bool editionOnly):StaticDefinedComposedNode(other,father),_fwLinks(0),_bwLinks(0)
{
for(list<Node *>::const_iterator iter=other._setOfNode.begin();iter!=other._setOfNode.end();iter++)
_setOfNode.push_back((*iter)->simpleClone(this,editionOnly));
+
//CF Linking
vector< pair<OutGate *, InGate *> > cfLinksToReproduce=other.getSetOfInternalCFLinks();
vector< pair<OutGate *, InGate *> >::iterator iter1=cfLinksToReproduce.begin();
for(;iter1!=cfLinksToReproduce.end();iter1++)
edAddCFLink(getChildByName(other.getChildName((*iter1).first->getNode())),getChildByName(other.getChildName((*iter1).second->getNode())));
+
//Data + DataStream linking
vector< pair<OutPort *, InPort *> > linksToReproduce=other.getSetOfInternalLinks();
vector< pair<OutPort *, InPort *> >::iterator iter2=linksToReproduce.begin();
for(;iter2!=linksToReproduce.end();iter2++)
- edAddLink(getOutPort(other.getPortName((*iter2).first)),getInPort(other.getPortName((*iter2).second)));
+ {
+ OutPort* pout = iter2->first;
+ InPort* pin = iter2->second;
+ edAddLink(getOutPort(other.getPortName(pout)),getInPort(other.getPortName(pin)));
+ }
}
//! Create a Bloc node with a given name
void Bloc::exUpdateState()
{
if(_state == YACS::DISABLED)return;
+ if(_state == YACS::DONE)return;
if(_inGate.exIsReady())
{
- setState(YACS::TOACTIVATE);
+ setState(YACS::ACTIVATED);
for(list<Node *>::iterator iter=_setOfNode.begin();iter!=_setOfNode.end();iter++)
if((*iter)->exIsControlReady())
(*iter)->exUpdateState();
* If node name already used in bloc, throw exception.
* Publish inputPorts in current bloc and ancestors.
*/
-bool Bloc::edAddChild(Node *node) throw(Exception)
+bool Bloc::edAddChild(Node *node) throw(YACS::Exception)
{
if(isNodeAlreadyAggregated(node))
{
* @exception If 'node' is NOT the son of 'this'.
*/
-void Bloc::edRemoveChild(Node *node) throw(Exception)
+void Bloc::edRemoveChild(Node *node) throw(YACS::Exception)
{
StaticDefinedComposedNode::edRemoveChild(node);
list<Node *>::iterator iter=find(_setOfNode.begin(),_setOfNode.end(),node);
}
}
-Node *Bloc::getChildByShortName(const std::string& name) const throw(Exception)
+Node *Bloc::getChildByShortName(const std::string& name) const throw(YACS::Exception)
{
for (list<Node *>::const_iterator iter = _setOfNode.begin(); iter != _setOfNode.end(); iter++)
if ((*iter)->getName() == name)
* \b WARNING : When using this method 'node' has to be checked in order to be part of direct children of 'this'.
*
*/
-void Bloc::checkNoCyclePassingThrough(Node *node) throw(Exception)
+void Bloc::checkNoCyclePassingThrough(Node *node) throw(YACS::Exception)
{
set<Node *> currentNodesToTest;
//don't insert node to test in set.
insertNodeChildrenInSet(node,currentNodesToTest);
//try to insert node
if(!(currentNodesToTest.insert(node)).second)
- throw Exception("Cycle has been detected");
+ throw Exception("Cycle has been detected",1);
}
std::vector< std::pair<OutGate *, InGate *> > Bloc::getSetOfInternalCFLinks() const
* Perform updates of containers regarding attributes of link 'start' -> 'end' and check the correct linking.
* The output is in info struct.
*
- * \param fw out parameter beeing append if start -> end link is a forward link \b without cross type DF/DS.
- * \param fwCross out parameter beeing append if start -> end link is a forward link \b with cross type DF/DS.
- * \param bw out parameter beeing append if start -> end link is a backward link.
- * \param info out parameter beeing informed about eventual errors.
+ * \param start : start port
+ * \param end : end port
+ * \param cross :
+ * \param fw out parameter being append if start -> end link is a forward link \b without cross type DF/DS.
+ * \param fwCross out parameter being append if start -> end link is a forward link \b with cross type DF/DS.
+ * \param bw out parameter being append if start -> end link is a backward link.
+ * \param info out parameter being informed about eventual errors.
*/
void Bloc::checkControlDependancy(OutPort *start, InPort *end, bool cross,
std::map < ComposedNode *, std::list < OutPort * >, SortHierarc >& fw,
info.pushErrLink(start,end,E_DS_LINK_UNESTABLISHABLE);
}
+//! Check if two nodes are linked
/*!
* 'start' and 'end' \b must be direct son of 'this'.
* Typically used for data link.
+ * \param start : start node
+ * \param end : end node
* \param fw indicates if it is a forward link searched (true : default value) or a backward link serach.
+ * \return if true or false
*/
bool Bloc::areLinked(Node *start, Node *end, bool fw) const
{
return nexts.find(end)!=nexts.end();
}
+//! Check if two nodes can run in parallel
/*!
* Typically used for stream link.
* 'start' and 'end' \b must be direct son of 'this'.
+ * \param start : start node
+ * \param end : end node
+ * \return true or false
*/
bool Bloc::arePossiblyRunnableAtSameTime(Node *start, Node *end) const
{
return nexts.find(end)==nexts.end() && preds.find(end)==preds.end();
}
+//! Check control flow links
/*!
* \param starts If different of 0, must aggregate at leat \b 1 element.
+ * \param end : end port
* \param alreadyFed in/out parameter. Indicates if 'end' ports is already and surely set or fed by an another port.
* \param direction If true : forward direction else backward direction.
+ * \param info : collected information
*/
void Bloc::checkCFLinks(const std::list<OutPort *>& starts, InputPort *end, unsigned char& alreadyFed, bool direction, LinkInfo& info) const
{
/*!
* Part of final step for CF graph anylizing. This is the part of non collapse nodes.
+ * \param pool :
+ * \param end :
+ * \param candidates :
* \param alreadyFed in/out parameter. Indicates if 'end' ports is already and surely set or fed by an another port.
+ * \param direction
+ * \param info : collected information
*/
-void Bloc::verdictForOkAndUseless1(const std::map<Node *,std::list <OutPort *> >& pool, InputPort *end, const std::vector<Node *>& candidates, unsigned char& alreadyFed,
+void Bloc::verdictForOkAndUseless1(const std::map<Node *,std::list <OutPort *> >& pool, InputPort *end,
+ const std::vector<Node *>& candidates, unsigned char& alreadyFed,
bool direction, LinkInfo& info)
{
for(vector<Node *>::const_iterator iter=candidates.begin();iter!=candidates.end();iter++)
/*!
* Part of final step for CF graph anylizing. This is the part of collapses nodes.
+ * \param pool :
+ * \param end :
+ * \param candidates :
* \param alreadyFed in/out parameter. Indicates if 'end' ports is already and surely set or fed by an another port.
+ * \param direction
+ * \param info : collected information
*/
-void Bloc::verdictForCollapses(const std::map<Node *,std::list <OutPort *> >& pool, InputPort *end, const std::set<Node *>& candidates, unsigned char& alreadyFed,
+void Bloc::verdictForCollapses(const std::map<Node *,std::list <OutPort *> >& pool, InputPort *end,
+ const std::set<Node *>& candidates, unsigned char& alreadyFed,
bool direction, LinkInfo& info)
{
info.startCollapseTransac();
/*!
* Internal method : Given a succeful path : updates 'fastFinder'
*/
-void Bloc::updateWithNewFind(const std::vector<Node *>& path, map<Node *, std::set<Node *> >& fastFinder)
+void Bloc::updateWithNewFind(const std::vector<Node *>& path, std::map<Node *, std::set<Node *> >& fastFinder)
{
if(path.size()>=3)
{
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __BLOC_HXX__
#define __BLOC_HXX__
+#include "YACSlibEngineExport.hxx"
#include "StaticDefinedComposedNode.hxx"
namespace YACS
{
namespace ENGINE
{
-/*! \brief Class for bloc node
- *
- * \ingroup Nodes
- *
- *
- * \see ComposedNode
- */
- class Bloc : public StaticDefinedComposedNode
+ class YACSLIBENGINE_EXPORT Bloc : public StaticDefinedComposedNode
{
protected:
std::list<Node *> _setOfNode;//OWNERSHIP OF ALL NODES
}
template<bool direction>
- void Bloc::findAllNodesStartingFrom(Node *start, std::set<Node *>& result, std::map<Node *, std::set<Node *> >& accelStr, LinkInfo& info) const
+ void Bloc::findAllNodesStartingFrom(Node *start, std::set<Node *>& result,
+ std::map<Node *, std::set<Node *> >& accelStr, LinkInfo& info) const
{
std::list< std::vector<Node *> > li;
findAllPathsStartingFrom<direction>(start,li,accelStr);
/*!
* Method for CF computation.DFS visitor is used.
+ * if direction is true forward visiting is performed, if false backward is performed.
* \param start \b must be a direct descendant of 'this'.
- * \param direction if true forward visiting is perform, false backward is used.
+ * \param vec :
+ * \param accelStr
*/
template<bool direction>
- void Bloc::findAllPathsStartingFrom(Node *start, std::list< std::vector<Node *> >& vec, std::map<Node *, std::set<Node *> >& accelStr) const
+ void Bloc::findAllPathsStartingFrom(Node *start, std::list< std::vector<Node *> >& vec,
+ std::map<Node *, std::set<Node *> >& accelStr) const
{
initComputation();
Node *current=start;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Catalog.hxx"
#include "ComponentDefinition.hxx"
#include "TypeCode.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __CATALOG_HXX__
#define __CATALOG_HXX__
+#include "YACSlibEngineExport.hxx"
+#include "RefCounter.hxx"
+
#include <string>
#include <map>
*
*
*/
- class Catalog
+ class YACSLIBENGINE_EXPORT Catalog : public RefCounter
{
public:
Catalog(const std::string& name);
std::map<std::string,ComponentDefinition*> _componentMap;
std::map<std::string,Node*> _nodeMap;
std::map<std::string,ComposedNode*> _composednodeMap;
+ Node* getNodeFromNodeMap(std::string name) {return _nodeMap[name];}
protected:
std::string _name;
std::string _errors;
/*! \brief class for YACS catalog loader.
*
*/
- class CatalogLoader
+ class YACSLIBENGINE_EXPORT CatalogLoader
{
public:
CatalogLoader();
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "ComponentDefinition.hxx"
#include "ServiceNode.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __COMPONENTDEFINITION_HXX__
#define __COMPONENTDEFINITION_HXX__
+#include "YACSlibEngineExport.hxx"
+
#include <map>
#include <string>
*
*
*/
- class ComponentDefinition
+ class YACSLIBENGINE_EXPORT ComponentDefinition
{
public:
ComponentDefinition(const std::string& name);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "ComponentInstance.hxx"
#include "Container.hxx"
using namespace YACS::ENGINE;
using namespace std;
+/*! \class YACS::ENGINE::ComponentInstance
+ * \brief Base class for all component instances.
+ *
+ * This is an abstract class that must be specialized in runtime.
+ * Specialized classes must provide implementation for loading of
+ * a component (load method) unloading (unload method) and an
+ * information method (isLoaded) about the state of the component
+ *
+ * A component instance is used by one or more ServiceNode to execute
+ * services of this component instance
+ *
+ * \see ServiceNode
+ */
+
const char ComponentInstance::KIND[]="";
int ComponentInstance::_total = 0;
_container->incrRef();
}
-ComponentInstance::ComponentInstance(const std::string& name):_compoName(name),_isAttachedOnCloning(false),_container(0)
+ComponentInstance::ComponentInstance(const std::string& name):_compoName(name),_isAttachedOnCloning(false),_container(0),_anonymous(true)
{
_numId = _total++;
stringstream instName;
ComponentInstance::ComponentInstance(const ComponentInstance& other):_compoName(other._compoName),
_container(0),
- _isAttachedOnCloning(other._isAttachedOnCloning)
+ _isAttachedOnCloning(other._isAttachedOnCloning),
+ _anonymous(true)
{
_numId = _total++;
stringstream instName;
_isAttachedOnCloning=true;
}
+//! For dump in file
std::string ComponentInstance::getFileRepr() const
{
return NULL_FILE_REPR;
return _isAttachedOnCloning;
}
+//! Return the component kind
+/*!
+ * A runtime can provide several implementations of a component instance.
+ * Each implementation has a different kind. A ComponentInstance can be
+ * associated to a ServiceNode is they have the same kind.
+ */
string ComponentInstance::getKind() const
{
return KIND;
}
+
+void ComponentInstance::shutdown(int level)
+{
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __COMPONENTINSTANCE_HXX__
#define __COMPONENTINSTANCE_HXX__
+#include "YACSlibEngineExport.hxx"
#include "RefCounter.hxx"
+#include "PropertyInterface.hxx"
#include <list>
#include <string>
class Container;
class ServiceNode;
-/*! \brief Base class for all component instances.
- *
- *
- * This is an abstract class that must be specialized in runtime.
- * Specialized classes must provide implementation for loading of
- * a component (load method) unloading (unload method) and an
- * information method (isLoaded) about the state of the component
- *
- * A component instance is used by one or more ServiceNode to execute
- * services of this component instance
- *
- * \see ServiceNode
- */
- class ComponentInstance : public RefCounter
+ class YACSLIBENGINE_EXPORT ComponentInstance : public PropertyInterface, public RefCounter
{
protected:
virtual ~ComponentInstance();
ComponentInstance(const ComponentInstance& other);
const std::string& getCompoName() const { return _compoName; }
const std::string& getInstanceName() const { return _instanceName; }
+ void setName(const std::string& name) { _instanceName = name; };
+ virtual void setAnonymous(bool anon) { _anonymous = anon; };
+ virtual bool isAnonymous() { return _anonymous; };
int getNumId() const { return _numId; }
virtual void setContainer(Container *cont);
Container *getContainer() const { return _container; }
virtual void attachOnCloning() const;
virtual void dettachOnCloning() const;
bool isAttachedOnCloning() const;
-//! For dump in file
virtual std::string getFileRepr() const;
virtual ServiceNode* createNode(const std::string& name)=0;
virtual ComponentInstance *clone() const = 0;
-//! Return the component kind
-/*!
- * A runtime can provide several implementations of a component instance.
- * Each implementation has a different kind. A ComponentInstance can be
- * associated to a ServiceNode is they have the same kind.
- */
virtual std::string getKind() const;
static const char KIND[];
+ virtual void shutdown(int level);
protected:
//! \b WARNING : _compoName identify only the component type.
std::string _compoName;
protected:
static const char NULL_FILE_REPR[];
static int _total;
+ bool _anonymous;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "ComposedNode.hxx"
#include "LinkInfo.hxx"
#include "Container.hxx"
#include "InputPort.hxx"
#include "OutputPort.hxx"
#include "ServiceNode.hxx"
+#include "InlineNode.hxx"
#include "DataFlowPort.hxx"
#include "DataStreamPort.hxx"
#include "ElementaryNode.hxx"
using namespace YACS::ENGINE;
using namespace std;
+/*! \class YACS::ENGINE::ComposedNode
+ * \brief Base class for all composed nodes.
+ *
+ * This is an abstract class that must be specialized.
+ *
+ * \ingroup Nodes
+ */
+
const char ComposedNode::SEP_CHAR_BTW_LEVEL[]=".";
ComposedNode::ComposedNode(const std::string& name):Node(name)
DeploymentTree treeToDup=otherC.getDeploymentTree();
list< ElementaryNode * > clones=otherC.getRecursiveConstituents();
vector<Container *> conts=treeToDup.getAllContainers();
+ //iterate on all containers
for(vector<Container *>::iterator iterCt=conts.begin();iterCt!=conts.end();iterCt++)
{
vector<ComponentInstance *> comps=treeToDup.getComponentsLinkedToContainer(*iterCt);
Container *contCloned=0;
if((*iterCt))
contCloned=(*iterCt)->clone();
+
+ //iterate on all component instances linked to the container
for(vector<ComponentInstance *>::iterator iterCp=comps.begin();iterCp!=comps.end();iterCp++)
{
vector<Task *> tasks=treeToDup.getTasksLinkedToComponent(*iterCp);
}
curCloned->decrRef();
}
+
+ // iterate on all tasks linked to the container
+ vector<Task *> tasks=treeToDup.getTasksLinkedToContainer(*iterCt);
+ for(vector<Task *>::iterator iterT=tasks.begin();iterT!=tasks.end();iterT++)
+ {
+ std::list< ElementaryNode * >::iterator res=find(clones.begin(),clones.end(),(ElementaryNode *)(*iterT));
+ InlineFuncNode *nodeC=(InlineFuncNode *)getChildByName(otherC.getChildName(*res));
+ nodeC->setContainer(contCloned);
+ }
+
+ // ended with current container
if(contCloned)
contCloned->decrRef();
}
/*!
* \param deep if \b true a deep check is perfomed. Typically has to be called by an executor before any attempt to launch an execution.
*/
-DeploymentTree ComposedNode::checkDeploymentTree(bool deep) const throw(Exception)
+DeploymentTree ComposedNode::checkDeploymentTree(bool deep) const throw(YACS::Exception)
{
DeploymentTree ret;
list< ElementaryNode * > tasks=getRecursiveConstituents();
case DeploymentTree::DUP_TASK_NOT_COMPATIBLE_WITH_EXISTING_TREE:
{
string what("ComposedNode::checkDeploymentTree : ServiceNode with name \""); what+=(*iter)->getName();
- what+="\" coexists in a component with an another Task which context is incorrect with it.";
+ what+="\" coexists in a component with an another Task which context is incompatible with it.";
throw Exception(what);
}
- case DeploymentTree::DEPLOYABLE_BUT_NOT_SPECIFIED :
- {
- if(deep)
- {
- string what("ComposedNode::checkDeploymentTree : ServiceNode with name \""); what+=(*iter)->getName();
- what+="\" is deployable but no component is specified on it.";
- throw Exception(what);
- }
- }
+ case DeploymentTree::DEPLOYABLE_BUT_NOT_SPECIFIED :
+ {
+ if(deep)
+ {
+ string what("ComposedNode::checkDeploymentTree : ServiceNode with name \""); what+=(*iter)->getName();
+ what+="\" is deployable but no component is specified on it.";
+ throw Exception(what);
+ }
+ }
}
}
return ret;
* \return true if a new link has been created, false otherwise.
*/
-bool ComposedNode::edAddLink(OutPort *start, InPort *end) throw(Exception)
+bool ComposedNode::edAddLink(OutPort *start, InPort *end) throw(YACS::Exception)
{
DEBTRACE("ComposedNode::edAddLink");
set<OutPort *> represented;
* \param end : the InPort to connect
* \return true if a new link has been created, false otherwise.
*/
-bool ComposedNode::edAddDFLink(OutPort *start, InPort *end) throw(Exception)
+bool ComposedNode::edAddDFLink(OutPort *start, InPort *end) throw(YACS::Exception)
{
Node* n1=start->getNode();
Node* n2=end->getNode();
* supporting it.
* \return true if a new link has been created, false otherwise.
*/
-bool ComposedNode::edAddLink(OutGate *start, InGate *end) throw(Exception)
+bool ComposedNode::edAddLink(OutGate *start, InGate *end) throw(YACS::Exception)
{
Node* n1=start->getNode();
Node* n2=end->getNode();
if(n1==n2)
- throw Exception("ComposedNode::edAddLink: can not add a control link to a node with itself");
+ throw Exception("ComposedNode::edAddLink: can not add a control link to a node with itself",1);
ComposedNode* father=checkHavingCommonFather(start->getNode(),end->getNode());
if(father==0)
throw Exception("ComposedNode::edAddLink: Trying to add CF link on orphan nodes.");
/*!
* Add a controlflow link between two nodes by calling edAddLink on their control ports
*/
-bool ComposedNode::edAddCFLink(Node *nodeS, Node *nodeE) throw(Exception)
+bool ComposedNode::edAddCFLink(Node *nodeS, Node *nodeE) throw(YACS::Exception)
{
return edAddLink(nodeS->getOutGate(),nodeE->getInGate());
}
//! Remove a controlflow link.
-void ComposedNode::edRemoveCFLink(Node *nodeS, Node *nodeE) throw(Exception)
+void ComposedNode::edRemoveCFLink(Node *nodeS, Node *nodeE) throw(YACS::Exception)
{
edRemoveLink(nodeS->getOutGate(),nodeE->getInGate());
}
* implies DF/DS gateway.
*/
-void ComposedNode::edRemoveLink(OutPort *start, InPort *end) throw(Exception)
+void ComposedNode::edRemoveLink(OutPort *start, InPort *end) throw(YACS::Exception)
{
if(!start->isAlreadyLinkedWith(end))
throw Exception("ComposedNode::edRemoveLink : unexisting link");
{
iterS=nodeOTemp->_father;
while(iterS!=lwstCmnAnctr)
- {
- if (!iterS)
- {
- stringstream what;
- what << "ComposedNode::edRemoveLink: "
- << start->getNode()->getName() << "." <<start->getName() << "->"
- << end->getNode()->getName() << "." << end->getName();
- throw Exception(what.str());
- }
- OutPort *tmp=currentPortO.first;
- iterS->getDelegateOf(currentPortO, end, allAscendanceOfNodeEnd);
- needsToDestroyO.push_back(pair< ComposedNode * , pair < OutPort* , OutPort *> >(iterS,pair<OutPort* , OutPort *> (tmp,currentPortO.first)));
- iterS=iterS->_father;
- }
+ {
+ if (!iterS)
+ {
+ stringstream what;
+ what << "ComposedNode::edRemoveLink: "
+ << start->getNode()->getName() << "." <<start->getName() << "->"
+ << end->getNode()->getName() << "." << end->getName();
+ throw Exception(what.str());
+ }
+ OutPort *tmp=currentPortO.first;
+ iterS->getDelegateOf(currentPortO, end, allAscendanceOfNodeEnd);
+ needsToDestroyO.push_back(pair< ComposedNode * , pair < OutPort* , OutPort *> >(iterS,pair<OutPort* , OutPort *> (tmp,currentPortO.first)));
+ iterS=iterS->_father;
+ }
}
Node *nodeTemp=end->getNode();
InPort * currentPortI=end;
}
//! Remove a controlflow link.
-void ComposedNode::edRemoveLink(OutGate *start, InGate *end) throw(Exception)
+void ComposedNode::edRemoveLink(OutGate *start, InGate *end) throw(YACS::Exception)
{
ComposedNode* father=checkHavingCommonFather(start->getNode(),end->getNode());
if(father!=this)
start->edRemoveInGate(end);
}
-bool ComposedNode::edAddChild(Node *DISOWNnode) throw(Exception)
+bool ComposedNode::edAddChild(Node *DISOWNnode) throw(YACS::Exception)
{
return false; // --- reimplemented in derived classes
}
//! Remove a child node.
-void ComposedNode::edRemoveChild(Node *node) throw(Exception)
+void ComposedNode::edRemoveChild(Node *node) throw(YACS::Exception)
{
if(!node)
return;
* separator was not found).
*/
bool ComposedNode::splitNamesBySep(const std::string& globalName, const char separator[],
- std::string& firstPart, std::string& lastPart, bool priority) throw(Exception)
+ std::string& firstPart, std::string& lastPart, bool priority) throw(YACS::Exception)
{
const string delims(separator);
string portName, nodeName;
}
firstPart = globalName.substr(0,idx);
lastPart = globalName.substr(idx+1);
- if ((firstPart.empty()) or (lastPart.empty()))
+ if ((firstPart.empty()) || (lastPart.empty()))
{
string what("the name "); what+= globalName ; what+=" is not a valid port name";
throw Exception(what);
return ret;
}
-void ComposedNode::checkConsistency(LinkInfo& info) const throw(Exception)
+void ComposedNode::checkConsistency(LinkInfo& info) const throw(YACS::Exception)
{
info.clearAll();
info.setPointOfView((ComposedNode *)this);
}
if(!candidateForAdvCheck.empty())
//End of filtering. Now regarding CF constraints for the current InPutPort.
- checkLinksCoherenceRegardingControl(candidateForAdvCheck,*iter1,info);
+ try
+ {
+ checkLinksCoherenceRegardingControl(candidateForAdvCheck,*iter1,info);
+ }
+ catch(YACS::Exception& ex)
+ {
+ std::string what=ex.what();
+ what += "\nfor input port: ";
+ what += (*iter1)->getNode()->getName();
+ what += ".";
+ what += (*iter1)->getName();
+
+ destructCFComputations(info);
+ throw YACS::Exception(what);
+ }
else
//No backlinks
- if(!(*iter1)->edIsManuallyInitialized())
+ if(!(*iter1)->canBeNull() && !(*iter1)->edIsManuallyInitialized())
info.pushErrLink(0,*iter1,E_NEVER_SET_INPUTPORT);
}
destructCFComputations(info);
* This method check that G1 <- G2 <- G3 <- G1 does not happened.
* Typically called by methods that set a hierarchy (Bloc::edAddChild, Loop::edSetNode, ...).
*/
-void ComposedNode::checkNoCrossHierachyWith(Node *node) const throw (Exception)
+void ComposedNode::checkNoCrossHierachyWith(Node *node) const throw(YACS::Exception)
{
ComposedNode *nodeC=dynamic_cast<ComposedNode *>(node);
if(!nodeC)
/*!
* call it only for 'starts' to 'end' links \b DEALED by 'this'.
*/
-void ComposedNode::checkLinksCoherenceRegardingControl(const std::vector<OutPort *>& starts, InputPort *end, LinkInfo& info) const throw(Exception)
+void ComposedNode::checkLinksCoherenceRegardingControl(const std::vector<OutPort *>& starts, InputPort *end, LinkInfo& info) const throw(YACS::Exception)
{
map < ComposedNode *, list<OutPort *>, SortHierarc > outputs;//forward link classical
vector<OutPort *> outputsCross;//forward link cross
}
/*!
- * Internal method during CF links. This méthode is in charge to statuate on links consistency in the case that no control flow defined by user
- * is set.
+ * Internal method during CF links. This methode is in charge to statuate on links consistency in the case
+ * that no control flow defined by user is set.
*/
void ComposedNode::solveObviousOrDelegateCFLinks(const std::list<OutPort *>& starts, InputPort *end, unsigned char& alreadyFed, bool direction, LinkInfo& info) const
{
}
}
+//! check control flow links
/*!
* \param starts If different of 0, must aggregate at leat \b 1 element.
+ * \param end :
* \param alreadyFed in/out parameter. Indicates if 'end' ports is already and surely set or fed by an another port.
* \param direction If true : forward direction else backward direction.
+ * \param info : informations collectedduring the check
*/
void ComposedNode::checkCFLinks(const std::list<OutPort *>& starts, InputPort *end, unsigned char& alreadyFed, bool direction, LinkInfo& info) const
{
//This case is typically dedicated when direct son is ElementaryNode and self link is defined on this.
if(!dynamic_cast<ElementaryNode *>(nodeEnd))
throw Exception(what);
+
list< OutPort *>::const_iterator iter=starts.begin();
Node *nodeStart=(*iter)->getNode();
iter++;
if(nodeEnd!=nodeStart)
throw Exception(what);
+
for(;iter!=starts.end();iter++)
if((*iter)->getNode()!=nodeStart)
throw Exception(what);
{
set<OutPort *> temp2=(*iter2)->edSetOutPort();
for(set<OutPort *>::iterator iter3=temp2.begin();iter3!=temp2.end();iter3++)
- if(!isInMyDescendance((*iter3)->getNode()))
- ret.push_back(pair<InPort *, OutPort *>(*iter2,*iter3));
+ {
+ if(isInMyDescendance((*iter3)->getNode()))continue;
+ std::set<OutPort *> trueOutPorts;
+ (*iter3)->getAllRepresented(trueOutPorts);
+ for(std::set<OutPort *>::iterator iter4=trueOutPorts.begin();iter4!=trueOutPorts.end();++iter4)
+ ret.push_back(pair<InPort *, OutPort *>(*iter2,*iter4));
+ }
}
return ret;
}
}
}
-ComposedNode *ComposedNode::getRootNode() const throw(Exception)
+ComposedNode *ComposedNode::getRootNode() const throw(YACS::Exception)
{
if(!_father)
return (ComposedNode *)this;
return 0;
}
-string ComposedNode::getChildName(const Node* node) const throw(Exception)
+string ComposedNode::getChildName(const Node* node) const throw(YACS::Exception)
{
string nodeName=node->getQualifiedName();
if (!isNodeAlreadyAggregated(node))
return directSon->getName();
}
-Node *ComposedNode::getChildByName(const std::string& name) const throw(Exception)
+Node *ComposedNode::getChildByName(const std::string& name) const throw(YACS::Exception)
{
string potentiallyDirectSonName, remainsPath;
bool forwardNeeded=ComposedNode::splitNamesBySep(name, SEP_CHAR_BTW_LEVEL,
* \exception Exception : If 'nodeToTest' is NOT in descendance of 'this' AND not equal to 'this'
* \param nodeToTest : the node to check
*/
-void ComposedNode::checkInMyDescendance(Node *nodeToTest) const throw(Exception)
+void ComposedNode::checkInMyDescendance(Node *nodeToTest) const throw(YACS::Exception)
{
const char whatC[]=" is not the descendance of node ";
if(nodeToTest==0)
* \return The lowest common ancestor if it exists.
*
*/
-ComposedNode *ComposedNode::getLowestCommonAncestor(Node *node1, Node *node2) throw(Exception)
+ComposedNode *ComposedNode::getLowestCommonAncestor(Node *node1, Node *node2) throw(YACS::Exception)
{
const char what[]="2 nodes does not share the same genealogy";
if(node1==0 || node2==0)
* get the input port name used by the current node, recursively built with children names.
*/
-string ComposedNode::getInPortName(const InPort * inPort) const throw (Exception)
+string ComposedNode::getInPortName(const InPort * inPort) const throw(YACS::Exception)
{
return getPortName<InPort>(inPort);
}
-string ComposedNode::getOutPortName(const OutPort *outPort) const throw (Exception)
+string ComposedNode::getOutPortName(const OutPort *outPort) const throw(YACS::Exception)
{
return getPortName<OutPort>(outPort);
}
return ret;
}
-OutPort *ComposedNode::getOutPort(const std::string& name) const throw(Exception)
+OutPort *ComposedNode::getOutPort(const std::string& name) const throw(YACS::Exception)
{
string portName, nodeName;
if(splitNamesBySep(name,Node::SEP_CHAR_IN_PORT,nodeName,portName,false))
* and so the leaf of type ElementaryNode aggregating
* this InputPort is directly invoked.
*/
-InputPort * ComposedNode::getInputPort(const std::string& name) const throw(Exception)
+InputPort * ComposedNode::getInputPort(const std::string& name) const throw(YACS::Exception)
{
+ try {
+ return Node::getInputPort(name);
+ }
+ catch(Exception& e) {}
+
string portName, nodeName;
if(splitNamesBySep(name,Node::SEP_CHAR_IN_PORT,nodeName,portName,true))
{
* Contrary to YACS::ENGINE::ComposedNode::getInputPort, this method is recursive and go
* down hierarchy step by step to complete its work.
*/
-OutputPort * ComposedNode::getOutputPort(const std::string& name) const throw(Exception)
+OutputPort * ComposedNode::getOutputPort(const std::string& name) const throw(YACS::Exception)
{
string portName, nodeName;
if(splitNamesBySep(name,Node::SEP_CHAR_IN_PORT,nodeName,portName,false))
}
}
-InputDataStreamPort *ComposedNode::getInputDataStreamPort(const std::string& name) const throw(Exception)
+InputDataStreamPort *ComposedNode::getInputDataStreamPort(const std::string& name) const throw(YACS::Exception)
{
string portName, nodeName;
if(splitNamesBySep(name,Node::SEP_CHAR_IN_PORT,nodeName,portName,true))
}
}
-OutputDataStreamPort *ComposedNode::getOutputDataStreamPort(const std::string& name) const throw(Exception)
+OutputDataStreamPort *ComposedNode::getOutputDataStreamPort(const std::string& name) const throw(YACS::Exception)
{
string portName, nodeName;
if(splitNamesBySep(name,Node::SEP_CHAR_IN_PORT,nodeName,portName,true))
//unexpected exception: probably a bug in engine
//try to keep a consistent global state
DEBTRACE( "updateStateFrom: " << ex.what() );
+ _errorDetails="Internal error: ";
+ _errorDetails=_errorDetails + ex.what();
setState(YACS::ERROR);
exForwardFailed();
return YACS::ABORT;
}
void ComposedNode::checkLinkPossibility(OutPort *start, const std::list<ComposedNode *>& pointsOfViewStart,
- InPort *end, const std::list<ComposedNode *>& pointsOfViewEnd) throw(Exception)
+ InPort *end, const std::list<ComposedNode *>& pointsOfViewEnd) throw(YACS::Exception)
{
- if((dynamic_cast<DataFlowPort *>(start) or dynamic_cast<DataFlowPort *>(end))
- and (dynamic_cast<DataStreamPort *>(start) or dynamic_cast<DataStreamPort *>(end)))
+ if((dynamic_cast<DataFlowPort *>(start) || dynamic_cast<DataFlowPort *>(end))
+ && (dynamic_cast<DataStreamPort *>(start) || dynamic_cast<DataStreamPort *>(end)))
{//cross protocol required : deeper check needed
bool isOK=false;
list<ComposedNode *>::const_iterator iter;
- for(iter=pointsOfViewStart.begin();iter!=pointsOfViewStart.end() and !isOK;iter++)
+ for(iter=pointsOfViewStart.begin();iter!=pointsOfViewStart.end() && !isOK;iter++)
isOK=(*iter)->isRepeatedUnpredictablySeveralTimes();
- for(iter=pointsOfViewEnd.begin();iter!=pointsOfViewEnd.end() and !isOK;iter++)
+ for(iter=pointsOfViewEnd.begin();iter!=pointsOfViewEnd.end() && !isOK;iter++)
isOK=(*iter)->isRepeatedUnpredictablySeveralTimes();
if(!isOK)
throw Exception("ComposedNode::checkLinkPossibility : Request for cross protocol link impossible.");
{
}
-void ComposedNode::getDelegateOf(InPort * & port, OutPort *initialStart, const std::list<ComposedNode *>& pointsOfView) throw(Exception)
+void ComposedNode::getDelegateOf(InPort * & port, OutPort *initialStart, const std::list<ComposedNode *>& pointsOfView) throw(YACS::Exception)
{
}
-void ComposedNode::getDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView) throw(Exception)
+void ComposedNode::getDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView) throw(YACS::Exception)
{
}
-void ComposedNode::releaseDelegateOf(InPort * & port, OutPort *initialStart, const std::list<ComposedNode *>& pointsOfView) throw(Exception)
+void ComposedNode::releaseDelegateOf(InPort * & port, OutPort *initialStart, const std::list<ComposedNode *>& pointsOfView) throw(YACS::Exception)
{
}
-void ComposedNode::releaseDelegateOf(OutPort *portDwn, OutPort *portUp, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView) throw(Exception)
+void ComposedNode::releaseDelegateOf(OutPort *portDwn, OutPort *portUp, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView) throw(YACS::Exception)
{
}
-void ComposedNode::checkBasicConsistency() const throw(Exception)
+void ComposedNode::checkBasicConsistency() const throw(YACS::Exception)
{
DEBTRACE("ComposedNode::checkBasicConsistency");
std::list<InputPort *>::const_iterator iter;
for(iter=inports.begin();iter!=inports.end();iter++)
(*iter)->checkBasicConsistency();
}
+
+//! Stop all pending activities of the composed node
+/*!
+ * This method should be called when a Proc is finished and must be deleted from the YACS server
+ */
+void ComposedNode::shutdown(int level)
+{
+ if(level==0)return;
+ DEBTRACE("ComposedNode::shutdown");
+ list<Node *> nodes=edGetDirectDescendants();
+ for(list<Node *>::iterator iter=nodes.begin();iter!=nodes.end();iter++)
+ (*iter)->shutdown(level);
+}
+
+//! Clean the composed node in case of not clean exit
+/*!
+ * This method should be called on a control-c or sigterm
+ */
+void ComposedNode::cleanNodes()
+{
+ DEBTRACE("ComposedNode::cleanNodes");
+ list<Node *> nodes=edGetDirectDescendants();
+ for(list<Node *>::iterator iter=nodes.begin();iter!=nodes.end();iter++)
+ (*iter)->cleanNodes();
+}
+
+//! Reset the state of the node and its children depending on the parameter level
+void ComposedNode::resetState(int level)
+{
+ if(level==0)return;
+
+ DEBTRACE("ComposedNode::resetState " << level << "," << _state);
+ if( _state==YACS::ERROR || _state==YACS::FAILED || _state==YACS::ACTIVATED )
+ {
+ Node::resetState(level);
+ std::list<Node *> nodes=edGetDirectDescendants();
+ for(std::list<Node *>::iterator iter=nodes.begin();iter!=nodes.end();iter++)
+ (*iter)->resetState(level);
+ }
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __COMPOSEDNODE_HXX__
#define __COMPOSEDNODE_HXX__
+#include "YACSlibEngineExport.hxx"
#include "Node.hxx"
#include "Scheduler.hxx"
class LinkInfo;
class ElementaryNode;
- class ComposedNode : public Node, public Scheduler
+ class YACSLIBENGINE_EXPORT ComposedNode : public Node, public Scheduler
{
friend class Bloc;
friend class Loop;
virtual ~ComposedNode();
bool isFinished();
void init(bool start=true);
+ virtual void shutdown(int level);
+ virtual void resetState(int level);
std::string getName() const;
std::string getTaskName(Task *task) const;
DeploymentTree getDeploymentTree() const;
void loaded();
void connected();
void accept(Visitor *visitor);
+ virtual void cleanNodes();
protected:
struct SortHierarc
{
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "ConditionInputPort.hxx"
#include "WhileLoop.hxx"
#include "OutputPort.hxx"
if(_outOfScopeBackLink)
throw Exception("ConditionInputPort::edNotifyReferenced : already linked from outside");
_outOfScopeBackLink=fromPort;
- return ;
}
InputPort::edNotifyReferencedBy(fromPort);
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __CONDITIONINPUTPORT_HXX__
#define __CONDITIONINPUTPORT_HXX__
+#include "YACSlibEngineExport.hxx"
#include "InputPort.hxx"
namespace YACS
{
class WhileLoop;
- class ConditionInputPort : public InputPort
+ class YACSLIBENGINE_EXPORT ConditionInputPort : public InputPort
{
friend class WhileLoop;
private:
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Container.hxx"
#include "ComponentInstance.hxx"
using namespace std;
using namespace YACS::ENGINE;
-Container::Container():_isAttachedOnCloning(false)
+Container::Container():_isAttachedOnCloning(false),_proc(0)
{
}
setProperty((*it).first, (*it).second); // setProperty virtual and derived
}
}
+
+void Container::shutdown(int level)
+{
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __CONTAINER_HXX__
#define __CONTAINER_HXX__
+#include "YACSlibEngineExport.hxx"
#include "Exception.hxx"
#include "RefCounter.hxx"
namespace ENGINE
{
class ComponentInstance;
+ class Proc;
/*!
* This is an abstract class, that represents an abstract process in which ComponentInstances can be launched and run.
*/
- class Container : public RefCounter
+ class YACSLIBENGINE_EXPORT Container : public RefCounter
{
protected:
Container();
#endif
public:
//Execution only methods
- virtual bool isAlreadyStarted() const = 0;
- virtual void start() throw(Exception) = 0;
- virtual std::string getPlacementId() const = 0;
+ virtual bool isAlreadyStarted(const ComponentInstance *inst) const = 0;
+ virtual void start(const ComponentInstance *inst) throw(Exception) = 0;
+ virtual std::string getPlacementId(const ComponentInstance *inst) const = 0;
+ virtual std::string getFullPlacementId(const ComponentInstance *inst) const = 0;
//Edition only methods
virtual void attachOnCloning() const;
virtual void dettachOnCloning() const;
std::string getName() const { return _name; };
//! \b WARNING ! name is used in edition to identify different containers, it is not the runtime name of the container
void setName(std::string name) { _name = name; };
+ void setProc(Proc* proc) { _proc = proc; };
+ Proc* getProc() { return _proc; };
+ virtual void shutdown(int level);
+ virtual std::map<std::string,std::string> getResourceProperties(const std::string& name) { return _propertyMap; };
+
protected:
std::string _name;
mutable bool _isAttachedOnCloning;
std::map<std::string,std::string> _propertyMap;
+ Proc* _proc;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "ConversionException.hxx"
using namespace YACS::ENGINE;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __CONVERSIONEXCEPTION_HXX__
#define __CONVERSIONEXCEPTION_HXX__
+#include "YACSlibEngineExport.hxx"
#include "Exception.hxx"
#include <string>
{
namespace ENGINE
{
- class ConversionException : public Exception
+ class YACSLIBENGINE_EXPORT ConversionException : public Exception
{
public:
ConversionException(const std::string& what,bool prefix=true);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "DataFlowPort.hxx"
using namespace YACS::ENGINE;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __DATAFLOWPORT_HXX__
#define __DATAFLOWPORT_HXX__
+#include "YACSlibEngineExport.hxx"
#include "DataPort.hxx"
#include <string>
{
namespace ENGINE
{
- class DataFlowPort : public virtual DataPort
+ class YACSLIBENGINE_EXPORT DataFlowPort : public virtual DataPort
{
public:
static const char NAME[];
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "DataNode.hxx"
namespace YACS
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __DATANODE_HXX__
#define __DATANODE_HXX__
+#include "YACSlibEngineExport.hxx"
#include "ElementaryNode.hxx"
+
#include <string>
namespace YACS
* \ingroup Nodes
*
*/
- class DataNode : public ElementaryNode
+ class YACSLIBENGINE_EXPORT DataNode : public ElementaryNode
{
protected:
DataNode(const DataNode& other, ComposedNode *father)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "DataPort.hxx"
#include "TypeCode.hxx"
#include <iostream>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __DATAPORT_HXX__
#define __DATAPORT_HXX__
+#include "YACSlibEngineExport.hxx"
#include "Port.hxx"
#include "Exception.hxx"
+
#include <vector>
namespace YACS
DATASTREAM
} TypeOfChannel;
- class DataPort : public virtual Port
+ class YACSLIBENGINE_EXPORT DataPort : public virtual Port
{
protected:
TypeCode *_type;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "DataStreamPort.hxx"
#include <iostream>
return NAME;
}
+//! Set a new value for a property of the port
+/*!
+ * \param name : the name property
+ * \param value : the value property
+ */
void DataStreamPort::setProperty(const std::string& name, const std::string& value)
{
_propertyMap[name]=value;
}
+//! Get the value of a property of the port
+/*!
+ * \param name : the name property
+ * \return the value property
+ */
std::string DataStreamPort::getProperty(const std::string& name)
{
return _propertyMap[name];
}
-void DataStreamPort::initPortProperties()
-{
-}
+//! Set the values of all properties of the port
+/*!
+ * \param properties : a map containing the values of properties
+ */
void DataStreamPort::setProperties(std::map<std::string,std::string> properties)
{
_propertyMap.clear();
setProperty((*it).first, (*it).second); // setProperty virtual and derived
}
}
+
+//! Initialize port properties at the start of calculation phase
+/*!
+ * This method is called before the execution of the parent node.
+ * It is not used when the user sets properties
+ */
+void DataStreamPort::initPortProperties()
+{
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __DATASTREAMPORT_HXX__
#define __DATASTREAMPORT_HXX__
+#include "YACSlibEngineExport.hxx"
#include "DataPort.hxx"
#include <string>
{
namespace ENGINE
{
- class DataStreamPort : public virtual DataPort
+ class YACSLIBENGINE_EXPORT DataStreamPort : public virtual DataPort
{
public:
static const char NAME[];
virtual void setProperty(const std::string& name,const std::string& value);
virtual void setProperties(std::map<std::string,std::string> properties);
virtual std::string getProperty(const std::string& name);
- std::map<std::string,std::string> getPropertyMap() const { return _propertyMap; }
+ std::map<std::string,std::string> getProperties() const { return _propertyMap; }
virtual void initPortProperties();
virtual ~DataStreamPort();
virtual std::string typeName() {return "YACS__ENGINE__DataStreamPort";}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "DeploymentTree.hxx"
#include "ComponentInstance.hxx"
#include "Container.hxx"
#include "Scheduler.hxx"
#include "Task.hxx"
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
using namespace std;
using namespace YACS::ENGINE;
unsigned char DeploymentTreeOnHeap::appendTask(Task *task, Scheduler *cloner)
{
+ DEBTRACE( "DeploymentTreeOnHeap::appendTask: " << task );
if(!task)
return DeploymentTree::NULL_TASK;
if(!task->isDeployable())//Task not needed to be placed.
return DeploymentTree::NOT_DEPLOYABLE_TASK;
ComponentInstance *ci=task->getComponent();
- if(!ci)//Task is not attached to a Component -> not needed to be placed.
+ Container *cont=task->getContainer();
+ DEBTRACE( "DeploymentTreeOnHeap::appendTask component: " << ci );
+ DEBTRACE( "DeploymentTreeOnHeap::appendTask container: " << cont );
+ if(!ci && !cont)//Task is not attached to a Component or a Container -> not needed to be placed.
{
_freePlacableTasks.push_back(pair<Task *,Scheduler *>(task,cloner));
return DeploymentTree::DEPLOYABLE_BUT_NOT_SPECIFIED;
}
- Container *cont=ci->getContainer();
+ DEBTRACE( "DeploymentTreeOnHeap::appendTask container: " << cont );
+
+ // an iterator for Container level
vector< vector< vector< pair<Task *, Scheduler *> > > >::iterator iter1;
+ // an iterator for Component instance level
vector< vector< pair<Task *, Scheduler * > > >::iterator iter2;
+ // an iterator for a vector of tasks with same container and component instance
vector< pair<Task *, Scheduler *> >::iterator iter3;
+
+ // search an existing vector of tasks with container == cont
for(iter1=_tree.begin();iter1!=_tree.end();iter1++)
- if(((*iter1)[0][0]).first->getComponent()->getContainer()==cont)
- break;
+ {
+ Task* task=(*iter1)[0][0].first;
+ if(task->getContainer() == cont)
+ break;
+ }
if(iter1==_tree.end())
{
+ // the vector does not exist : create it
+ DEBTRACE("create a vector of vector of tasks for container " << cont);
_tree.push_back(vector< vector< pair< Task *, Scheduler *> > >());
iter1=_tree.end();
iter1--;
}
+
+ // search a vector of tasks with component instance == ci
for(iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
if(((*iter2)[0]).first->getComponent()==ci)
break;
if(iter2==(*iter1).end())
{
+ // the vector does not exist : create it
+ DEBTRACE("create a vector of tasks for component instance " << ci);
(*iter1).push_back(vector< pair< Task *, Scheduler *> >());
iter2=(*iter1).end();
iter2--;
}
+
+ // search the task in the vector. If it exists return
for(iter3=(*iter2).begin();iter3!=(*iter2).end();iter3++)
if((*iter3).first==task)
return DeploymentTree::ALREADY_IN_TREE;
+
+ // if the task is not in the vector add it under condition
if(!isConsistentTaskRegardingShCompInst(*iter2,cloner))
return DeploymentTree::DUP_TASK_NOT_COMPATIBLE_WITH_EXISTING_TREE;
+ DEBTRACE("add task to vector of tasks " << task);
(*iter2).push_back(pair<Task *,Scheduler *>(task,cloner));
return DeploymentTree::APPEND_OK;
}
unsigned DeploymentTreeOnHeap::getNumberOfCTDefContainer() const
{
+ DEBTRACE("getNumberOfCTDefContainer ");
vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
vector< vector< pair<Task *, Scheduler * > > >::const_iterator iter2;
vector< pair<Task *, Scheduler *> >::const_iterator iter3;
isCTDefSurely2=false;
if(isCTDefSurely2)
isCTDefSurely1=true;
- else
+ else if(((*iter2)[0].first)->getComponent())
isCTDefSurely1=(((*iter2)[0].first)->getComponent()->isAttachedOnCloning());
+ else
+ isCTDefSurely1=false;
}
- Container *cont=((*iter1)[0][0].first)->getComponent()->getContainer();
+ Container *cont=((*iter1)[0][0].first)->getContainer();
if(isCTDefSurely1)
{
if(cont)
unsigned DeploymentTreeOnHeap::getNumberOfRTODefContainer() const
{
+ DEBTRACE("getNumberOfRTODefContainer");
vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
vector< vector< pair<Task *, Scheduler * > > >::const_iterator iter2;
vector< pair<Task *, Scheduler *> >::const_iterator iter3;
if((*iter3).second==0)
isRTODefSurely2=false;
if(isRTODefSurely2)
- isRTODefSurely1=!(((*iter2)[0].first)->getComponent()->isAttachedOnCloning());
+ if(((*iter2)[0].first)->getComponent())
+ isRTODefSurely1=!(((*iter2)[0].first)->getComponent()->isAttachedOnCloning());
+ else
+ isRTODefSurely1=false;
else
isRTODefSurely1=false;
}
if(isRTODefSurely1)
- if(((*iter1)[0][0].first)->getComponent()->getContainer())
- if(!((*iter1)[0][0].first)->getComponent()->getContainer()->isAttachedOnCloning())
+ if(((*iter1)[0][0].first)->getContainer())
+ if(!((*iter1)[0][0].first)->getContainer()->isAttachedOnCloning())
ret++;
}
return ret;
unsigned DeploymentTreeOnHeap::getNumberOfCTDefComponentInstances() const
{
+ DEBTRACE("getNumberOfCTDefComponentInstances");
vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
vector< vector< pair<Task *, Scheduler * > > >::const_iterator iter2;
vector< pair<Task *, Scheduler *> >::const_iterator iter3;
if(isCTDefSurely)
ret++;
else
- if(((*iter2)[0].first)->getComponent()->isAttachedOnCloning())
+ if(((*iter2)[0].first)->getComponent() && ((*iter2)[0].first)->getComponent()->isAttachedOnCloning())
ret++;
}
return ret;
unsigned DeploymentTreeOnHeap::getNumberOfRTODefComponentInstances() const
{
+ DEBTRACE("getNumberOfRTODefComponentInstances");
vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
vector< vector< pair<Task *, Scheduler * > > >::const_iterator iter2;
vector< pair<Task *, Scheduler *> >::const_iterator iter3;
for(iter3=(*iter2).begin();iter3!=(*iter2).end() && !isRTODef;iter3++)
if((*iter3).second!=0)
isRTODef=true;
- if(isRTODef && !((*iter2)[0].first)->getComponent()->isAttachedOnCloning())
+ if(isRTODef && ((*iter2)[0].first)->getComponent() && !((*iter2)[0].first)->getComponent()->isAttachedOnCloning())
ret++;
}
return ret;
vector<Container *> ret;
vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
for(iter1=_tree.begin();iter1!=_tree.end();iter1++)
- ret.push_back(((*iter1)[0][0].first)->getComponent()->getContainer());
+ {
+ Task* task=(*iter1)[0][0].first;
+ ret.push_back(task->getContainer());
+ }
return ret;
}
std::vector<Container *> DeploymentTreeOnHeap::getAllCTDefContainers() const
{
+ DEBTRACE("getAllCTDefContainers");
vector<Container *> ret;
vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
vector< vector< pair<Task *, Scheduler * > > >::const_iterator iter2;
isCTDefSurely2=false;
if(isCTDefSurely2)
isCTDefSurely1=true;
- else
+ else if(((*iter2)[0].first)->getComponent())
isCTDefSurely1=(((*iter2)[0].first)->getComponent()->isAttachedOnCloning());
+ else
+ isCTDefSurely1=false;
}
- Container *cont=((*iter1)[0][0].first)->getComponent()->getContainer();
+ Container *cont=((*iter1)[0][0].first)->getContainer();
if(isCTDefSurely1)
{
if(cont)
std::vector<Container *> DeploymentTreeOnHeap::getAllRTODefContainers() const
{
+ DEBTRACE("getAllRTODefContainers");
vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
vector< vector< pair<Task *, Scheduler * > > >::const_iterator iter2;
vector< pair<Task *, Scheduler *> >::const_iterator iter3;
if((*iter3).second==0)
isRTODefSurely2=false;
if(isRTODefSurely2)
- isRTODefSurely1=!(((*iter2)[0].first)->getComponent()->isAttachedOnCloning());
+ {
+ if(((*iter2)[0].first)->getComponent())
+ isRTODefSurely1=!(((*iter2)[0].first)->getComponent()->isAttachedOnCloning());
+ else
+ isRTODefSurely1=false;
+ }
else
isRTODefSurely1=false;
}
if(isRTODefSurely1)
- if(((*iter1)[0][0].first)->getComponent()->getContainer())
- if(!((*iter1)[0][0].first)->getComponent()->getContainer()->isAttachedOnCloning())
- ret.push_back(((*iter1)[0][0].first)->getComponent()->getContainer());
+ {
+ Container* cont= (*iter1)[0][0].first->getContainer();
+ if(cont)
+ if(!cont->isAttachedOnCloning())
+ ret.push_back(cont);
+ }
+ }
+ return ret;
+}
+
+std::vector<Task *> DeploymentTreeOnHeap::getTasksLinkedToContainer(Container *cont) const
+{
+ vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
+ vector< vector< pair<Task *, Scheduler * > > >::const_iterator iter2;
+ vector< pair<Task *, Scheduler *> >::const_iterator iter3;
+
+ std::vector<Task *> ret;
+ for(iter1=_tree.begin();iter1!=_tree.end();iter1++)
+ {
+ if(((*iter1)[0][0].first)->getContainer()==cont)
+ for(iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
+ if(((*iter2)[0].first)->getComponent()==0)
+ for(iter3=(*iter2).begin();iter3!=(*iter2).end();iter3++)
+ ret.push_back((*iter3).first);
}
return ret;
}
std::vector<ComponentInstance *> DeploymentTreeOnHeap::getComponentsLinkedToContainer(Container *cont) const
{
+ DEBTRACE("DeploymentTreeOnHeap::getComponentsLinkedToContainer ");
vector<ComponentInstance *> ret;
vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
vector< vector< pair<Task *, Scheduler * > > >::const_iterator iter2;
- for(iter1=_tree.begin();iter1!=_tree.end();iter1++)
- if(((*iter1)[0][0].first)->getComponent()->getContainer()==cont)
- for(iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
- ret.push_back(((*iter2)[0].first)->getComponent());
+ //iterate on containers
+ for(iter1=_tree.begin();iter1!=_tree.end();++iter1)
+ {
+ //iterate on components
+ for(iter2=(*iter1).begin();iter2!=(*iter1).end();++iter2)
+ {
+ ComponentInstance *compo=(*iter2)[0].first->getComponent();
+ if(compo)
+ {
+ //it's a real component, add it if its container is the right one
+ if(compo->getContainer()==cont)
+ ret.push_back(compo);
+ else
+ break;
+ }
+ }
+ }
+
return ret;
}
bool DeploymentTreeOnHeap::presenceOfDefaultContainer() const
{
+ DEBTRACE("presenceOfDefaultContainer");
vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
for(iter1=_tree.begin();iter1!=_tree.end();iter1++)
- if(!((*iter1)[0][0].first)->getComponent()->getContainer())
+ if(!((*iter1)[0][0].first)->getContainer())
return true;
return false;
}
if(!coexistenceOfDifferentSched)
return true;
//In this case the component is duplicated on cloning raising on runtime on different policy (schedulers) than other tasks in tasksSharingSameCompInst
- return (tasksSharingSameCompInst[0].first)->getComponent()->isAttachedOnCloning();
+ if((tasksSharingSameCompInst[0].first)->getComponent())
+ return (tasksSharingSameCompInst[0].first)->getComponent()->isAttachedOnCloning();
+ else
+ return (tasksSharingSameCompInst[0].first)->getContainer()->isAttachedOnCloning();
}
DeploymentTree::DeploymentTree():_treeHandle(0)
return vector<Container *>();
}
+std::vector<Task *> DeploymentTree::getTasksLinkedToContainer(Container *cont) const
+{
+ if(_treeHandle)
+ return _treeHandle->getTasksLinkedToContainer(cont);
+ return vector<Task *>();
+}
+
std::vector<Task *> DeploymentTree::getTasksLinkedToComponent(ComponentInstance *comp) const
{
if(_treeHandle)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __DEPLOYMENTTREE_HXX__
#define __DEPLOYMENTTREE_HXX__
+#include "YACSlibEngineExport.hxx"
+
#include <vector>
namespace YACS
class Scheduler;
class ComponentInstance;
- class DeploymentTreeOnHeap
+ class YACSLIBENGINE_EXPORT DeploymentTreeOnHeap
{
public:
DeploymentTreeOnHeap();
std::vector<Container *> getAllCTDefContainers() const;
std::vector<Container *> getAllRTODefContainers() const;
std::vector<Task *> getTasksLinkedToComponent(ComponentInstance *comp) const;
+ std::vector<Task *> getTasksLinkedToContainer(Container *cont) const;
std::vector<ComponentInstance *> getComponentsLinkedToContainer(Container *cont) const;
//
bool presenceOfDefaultContainer() const;
std::vector< std::vector< std::vector< std::pair<Task *, Scheduler * > > > > _tree;
};
- class DeploymentTree
+ class YACSLIBENGINE_EXPORT DeploymentTree
{
public:
DeploymentTree();
std::vector<Container *> getAllCTDefContainers() const;
std::vector<Container *> getAllRTODefContainers() const;
std::vector<Task *> getTasksLinkedToComponent(ComponentInstance *comp) const;
+ std::vector<Task *> getTasksLinkedToContainer(Container *cont) const;
std::vector<ComponentInstance *> getComponentsLinkedToContainer(Container *cont) const;
//
bool isNull() const;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Dispatcher.hxx"
#include "Node.hxx"
#include <iostream>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __DISPATCHER_HXX__
#define __DISPATCHER_HXX__
+#include "YACSlibEngineExport.hxx"
+
#include <set>
#include <string>
#include <map>
* information from the emitting object.
*
*/
- class Observer
+ class YACSLIBENGINE_EXPORT Observer
{
public:
virtual void notifyObserver(Node* object,const std::string& event);
* Limitation : emitting objects can be only Node
*
*/
- class Dispatcher
+ class YACSLIBENGINE_EXPORT Dispatcher
{
public:
virtual void dispatch(Node* object,const std::string& event);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "DynParaLoop.hxx"
#include "LinkInfo.hxx"
#include "OutPort.hxx"
+#include "Container.hxx"
+#include "ComponentInstance.hxx"
+#include "ServiceNode.hxx"
+#include "InlineNode.hxx"
+#include "ElementaryNode.hxx"
+#include "Visitor.hxx"
+
+#include <list>
+#include <vector>
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
using namespace std;
using namespace YACS::ENGINE;
-const char DynParaLoop::NAME_OF_SPLITTED_SEQ_OUT[]="SmplPrt";
+const char DynParaLoop::NAME_OF_SPLITTED_SEQ_OUT[] = "evalSamples";
+const char DynParaLoop::OLD_NAME_OF_SPLITTED_SEQ_OUT[] = "SmplPrt"; // For backward compatibility with 5.1.4
const char DynParaLoop::NAME_OF_NUMBER_OF_BRANCHES[]="nbBranches";
-AnyOutputPort::AnyOutputPort(const std::string& name, Node *node, TypeCode *type):OutputPort(name,node,type),
- DataPort(name,node,type),Port(node),_data(0)
-{
-}
-
-AnyOutputPort::AnyOutputPort(const AnyOutputPort& other, Node *newHelder):OutputPort(other,newHelder),
- DataPort(other,newHelder),
- Port(other,newHelder),_data(0)
-{
-}
-
-AnyOutputPort::~AnyOutputPort()
-{
- if(_data)
- _data->decrRef();
-}
-
-void AnyOutputPort::setValue(Any *data)
-{
- if(_data)
- _data->decrRef();
- _data = data;
- if(_data)
- _data->incrRef();
-}
-
-OutputPort *AnyOutputPort::clone(Node *newHelder) const
-{
- return new AnyOutputPort(*this,newHelder);
-}
-
-DynParaLoop::DynParaLoop(const std::string& name, TypeCode *typeOfDataSplitted):ComposedNode(name),_node(0),_initNode(0),_nbOfEltConsumed(0),
- _nbOfBranches(NAME_OF_NUMBER_OF_BRANCHES,this,Runtime::_tc_int),
- _splittedPort(NAME_OF_SPLITTED_SEQ_OUT,this,typeOfDataSplitted)
+DynParaLoop::DynParaLoop(const std::string& name, TypeCode *typeOfDataSplitted)
+ : ComposedNode(name),_node(0),_initNode(0),_finalizeNode(0),_nbOfEltConsumed(0),
+ _nbOfBranches(NAME_OF_NUMBER_OF_BRANCHES,this,Runtime::_tc_int),
+ _splittedPort(NAME_OF_SPLITTED_SEQ_OUT,this,typeOfDataSplitted)
{
}
{
delete _node;
delete _initNode;
+ delete _finalizeNode;
}
-DynParaLoop::DynParaLoop(const DynParaLoop& other, ComposedNode *father, bool editionOnly):ComposedNode(other,father),
- _nbOfBranches(other._nbOfBranches,this),
- _splittedPort(other._splittedPort,this),
- _node(0),_initNode(0),_nbOfEltConsumed(0)
+DynParaLoop::DynParaLoop(const DynParaLoop& other, ComposedNode *father, bool editionOnly)
+ : ComposedNode(other,father), _nbOfBranches(other._nbOfBranches,this),
+ _splittedPort(other._splittedPort,this), _node(0), _initNode(0), _finalizeNode(0),
+ _nbOfEltConsumed(0)
{
if(other._node)
_node=other._node->clone(this,editionOnly);
if(other._initNode)
_initNode=other._initNode->clone(this,editionOnly);
+ if(other._finalizeNode)
+ _finalizeNode = other._finalizeNode->clone(this,editionOnly);
const AnyOutputPort& startOfLinksToReproduce=other._splittedPort;
set<InPort *> endsOfLinksToReproduce=startOfLinksToReproduce.edSetInPort();
for(set<InPort *>::iterator iter=endsOfLinksToReproduce.begin();iter!=endsOfLinksToReproduce.end();iter++)
Node *DynParaLoop::edSetNode(Node *node)
{
- if(_node==node)
+ return checkConsistencyAndSetNode(_node, node);
+}
+
+//! This method is used to factorize methods edSetNode, edSetInitNode and edSetFinalizeNode
+Node * DynParaLoop::checkConsistencyAndSetNode(Node* &nodeToReplace, Node* node)
+{
+ if (node == NULL || nodeToReplace == node)
return 0;
- if(node)
- {
- if(node->_father)
- {
- std::string what = "DynParaLoop::edSetNode: node "; what += node->getName(); what += " is not orphan ! ";
- throw Exception(what);
- }
- if(_initNode)
- if(_initNode->getName()==node->getName())
- {
- std::string what = "DynParaLoop::edSetNode: node "; what += node->getName(); what += " has the same name than init node already in "; what+=_name; what+="! ";
- throw Exception(what);
- }
- }
+ if (node->_father)
+ throw Exception(string("Can't set node: node ") + node->getName() + " is not orphan.");
+ if (_node && _node != nodeToReplace && _node->getName() == node->getName())
+ throw Exception(string("Can't set node: node ") + node->getName() +
+ " has the same name than exec node already in " + _name + ".");
+ if (_initNode && _initNode != nodeToReplace && _initNode->getName() == node->getName())
+ throw Exception(string("Can't set node: node ") + node->getName() +
+ " has the same name than init node already in " + _name + ".");
+ if (_finalizeNode && _finalizeNode != nodeToReplace && _finalizeNode->getName() == node->getName())
+ throw Exception(string("Can't set node: node ") + node->getName() +
+ " has the same name than finalize node already in " + _name + ".");
checkNoCrossHierachyWith(node);
- ComposedNode::edRemoveChild(_node);
- Node *ret=_node;
- _node=node;
- _node->_father=this;
- //set _modified flag so that edUpdateState can refresh state
+ ComposedNode::edRemoveChild(nodeToReplace);
+ Node * ret = nodeToReplace;
+ nodeToReplace = node;
+ nodeToReplace->_father = this;
+ // set _modified flag so that edUpdateState can refresh state
modified();
return ret;
}
string what("DynParaLoop::init : no node specified for ForEachLoop with name "); what +=_name;
throw Exception(what);
}
+ _node->init(start);
+ if (_initNode) _initNode->init(start);
+ if (_finalizeNode) _finalizeNode->init(start);
_nbOfBranches.exInit(start);
_splittedPort.exInit();
_nbOfEltConsumed=0;
Node *DynParaLoop::edSetInitNode(Node *node)
{
- if(_initNode==node)
- return 0;
- if(node)
- {
- if(node->_father)
- {
- std::string what = "DynParaLoop::edSetInitNode : node "; what += node->getName(); what += " is not orphan ! ";
- throw Exception(what);
- }
- if(_node)
- if(_node->getName()==node->getName())
- {
- std::string what = "DynParaLoop::edSetInitNode : node "; what += node->getName(); what += " has the same name than node already in "; what+=_name; what+="! ";
- throw Exception(what);
- }
- }
- checkNoCrossHierachyWith(node);
- edRemoveChild(_initNode);
- Node *ret=_initNode;
- _initNode=node;
- _initNode->_father=this;
- modified();
- return ret;
+ return checkConsistencyAndSetNode(_initNode, node);
+}
+
+Node * DynParaLoop::edSetFinalizeNode(Node * node)
+{
+ return checkConsistencyAndSetNode(_finalizeNode, node);
+}
+
+//! Connect an OutPort to an InPort and add control link if necessary
+/*!
+ * Connect the ports with a data link (edAddLink)
+ * In a Loop don't add control flow link : use this only to add data back links
+ *
+ * \param start : the OutPort to connect
+ * \param end : the InPort to connect
+ * \return true if a new link has been created, false otherwise.
+ */
+bool DynParaLoop::edAddDFLink(OutPort *start, InPort *end) throw(YACS::Exception)
+{
+ return edAddLink(start,end);
}
int DynParaLoop::getNumberOfInputPorts() const
return ret;
}
-OutPort *DynParaLoop::getOutPort(const std::string& name) const throw(Exception)
+std::list<OutputPort *> DynParaLoop::getLocalOutputPorts() const
{
- if(name==NAME_OF_SPLITTED_SEQ_OUT)
- return (OutPort *)&_splittedPort;
- return ComposedNode::getOutPort(name);
+ list<OutputPort *> ret=ComposedNode::getLocalOutputPorts();
+ ret.push_back((OutputPort *)&_splittedPort);
+ return ret;
}
-InputPort *DynParaLoop::getInputPort(const std::string& name) const throw(Exception)
+OutPort *DynParaLoop::getOutPort(const std::string& name) const throw(YACS::Exception)
{
- if(name==NAME_OF_NUMBER_OF_BRANCHES)
- return (InputPort *)&_nbOfBranches;
- return ComposedNode::getInputPort(name);
+ if (name == NAME_OF_SPLITTED_SEQ_OUT || name == OLD_NAME_OF_SPLITTED_SEQ_OUT)
+ return (OutPort *)&_splittedPort;
+ return ComposedNode::getOutPort(name);
}
-OutputPort *DynParaLoop::getOutputPort(const std::string& name) const throw(Exception)
+
+OutputPort *DynParaLoop::getOutputPort(const std::string& name) const throw(YACS::Exception)
{
- if(name==NAME_OF_SPLITTED_SEQ_OUT)
+ if (name == NAME_OF_SPLITTED_SEQ_OUT || name == OLD_NAME_OF_SPLITTED_SEQ_OUT)
return (OutputPort *)&_splittedPort;
return ComposedNode::getOutputPort(name);
}
Node *DynParaLoop::edRemoveNode()
{
- if(!_node)
- return 0;
- ComposedNode::edRemoveChild(_node);
- Node *ret=_node;
- _node=0;
+ return removeNode(_node);
+}
+
+//! This method is used to factorize methods edRemoveNode, edRemoveInitNode and edRemoveFinalizeNode
+Node * DynParaLoop::removeNode(Node* &nodeToRemove)
+{
+ if (!nodeToRemove)
+ return NULL;
+ ComposedNode::edRemoveChild(nodeToRemove);
+ Node * ret = nodeToRemove;
+ nodeToRemove = NULL;
modified();
return ret;
}
Node *DynParaLoop::edRemoveInitNode()
{
- if(!_initNode)
- return 0;
- ComposedNode::edRemoveChild(_initNode);
- Node *ret=_initNode;
- _initNode=0;
- return ret;
+ return removeNode(_initNode);
+}
+
+Node * DynParaLoop::edRemoveFinalizeNode()
+{
+ return removeNode(_finalizeNode);
}
-void DynParaLoop::edRemoveChild(Node *node) throw(Exception)
+void DynParaLoop::edRemoveChild(Node *node) throw(YACS::Exception)
{
ComposedNode::edRemoveChild(node);
if(node==_node)
_node=0;
if(node==_initNode)
_initNode=0;
+ if(node==_finalizeNode)
+ _finalizeNode=0;
modified();
}
+bool DynParaLoop::edAddChild(Node *node) throw(YACS::Exception)
+{
+ return edSetNode(node);
+}
+
std::list<Node *> DynParaLoop::edGetDirectDescendants() const
{
list<Node *> ret;
ret.push_back(_node);
if(_initNode)
ret.push_back(_initNode);
+ if(_finalizeNode)
+ ret.push_back(_finalizeNode);
return ret;
}
return ret;
}
+InputPort *DynParaLoop::getInputPort(const std::string& name) const throw(YACS::Exception)
+{
+ if(name==NAME_OF_NUMBER_OF_BRANCHES)
+ return (InputPort *)&_nbOfBranches;
+ return ComposedNode::getInputPort(name);
+}
+
std::list<InputPort *> DynParaLoop::getLocalInputPorts() const
{
list<InputPort *> ret=ComposedNode::getLocalInputPorts();
return ret;
}
-unsigned DynParaLoop::getNumberOfBranchesCreatedDyn() const throw(Exception)
+unsigned DynParaLoop::getNumberOfBranchesCreatedDyn() const throw(YACS::Exception)
{
if(_execNodes.empty())
throw Exception("ForEachLoop::getNumberOfBranches : No branches created dynamically ! - ForEachLoop needs to run or to be runned to call getNumberOfBranches");
return _execNodes.size();
}
-Node *DynParaLoop::getChildByShortName(const std::string& name) const throw(Exception)
+Node *DynParaLoop::getChildByShortName(const std::string& name) const throw(YACS::Exception)
{
- if(_node)
- if(name==_node->getName())
- return _node;
- if(_initNode)
- if(name==_initNode->getName())
- return _initNode;
+ if (_node && name == _node->getName())
+ return _node;
+ if (_initNode && name == _initNode->getName())
+ return _initNode;
+ if (_finalizeNode && name == _finalizeNode->getName())
+ return _finalizeNode;
std::string what("node "); what+= name ; what+=" is not a child of DynParaLoop node "; what += getName();
throw Exception(what);
}
-Node *DynParaLoop::getChildByNameExec(const std::string& name, unsigned id) const throw(Exception)
+Node *DynParaLoop::getChildByNameExec(const std::string& name, unsigned id) const throw(YACS::Exception)
{
if(id>=getNumberOfBranchesCreatedDyn())
throw Exception("ForEachLoop::getChildByNameExec : invalid id - too large compared with dynamically created branches.");
- if(_node)
- if(name==_node->getName())
- return _execNodes[id];
- if(_initNode)
- if(name==_initNode->getName())
- return _execInitNodes[id];
+ if (_node && name == _node->getName())
+ return _execNodes[id];
+ if (_initNode && name == _initNode->getName())
+ return _execInitNodes[id];
+ if (_finalizeNode && name == _finalizeNode->getName())
+ return _execFinalizeNodes[id];
std::string what("node "); what+= name ; what+=" is not a child of DynParaLoop node "; what += getName();
throw Exception(what);
}
void DynParaLoop::cleanDynGraph()
{
- for(vector<Node *>::iterator iter=_execNodes.begin();iter!=_execNodes.end();iter++)
+ vector<Node *>::iterator iter;
+ for(iter=_execNodes.begin() ; iter!=_execNodes.end() ; iter++)
delete *iter;
_execNodes.clear();
- for(vector<Node *>::iterator iter2=_execInitNodes.begin();iter2!=_execInitNodes.end();iter2++)
- delete *iter2;
- _execNodes.clear();
+ for(iter=_execInitNodes.begin() ; iter!=_execInitNodes.end() ; iter++)
+ delete *iter;
+ _execInitNodes.clear();
+ for(iter=_execFinalizeNodes.begin() ; iter!=_execFinalizeNodes.end() ; iter++)
+ delete *iter;
+ _execFinalizeNodes.clear();
}
/*!
void DynParaLoop::prepareInputsFromOutOfScope(int branchNb)
{
set< InPort * > portsToSetVals=getAllInPortsComingFromOutsideOfCurrentScope();
- portsToSetVals.erase(&_nbOfBranches);//_nbOfBranches inport is not a candidate of dynamically duplicated inport.
+
+ // This tweak is to fix problems with nested dynamic loops where links are not cloned properly
+ list<InPort *> temp = getSetOfInPort();
+ for(list<InPort *>::iterator iter2=temp.begin();iter2!=temp.end();iter2++)
+ {
+ if ((*iter2)->edSetOutPort().size() == 1 && *(*iter2)->edSetOutPort().begin() == NULL)
+ {
+ portsToSetVals.insert(*iter2);
+ }
+ }
+
+ // local input ports are not candidates for dynamically duplicated inport.
+ list<InputPort *> localPorts = getLocalInputPorts();
+ for(list<InputPort *>::iterator iter = localPorts.begin() ; iter != localPorts.end() ; iter++)
+ portsToSetVals.erase(*iter);
for(set< InPort * >::iterator iter=portsToSetVals.begin();iter!=portsToSetVals.end();iter++)
{
InputPort *curPortCasted=(InputPort *) *iter;//Cast granted by ForEachLoop::buildDelegateOf(InPort)
InputPort *traducer=getRuntime()->adapt(portOnGivenBranch,
Runtime::RUNTIME_ENGINE_INTERACTION_IMPL_NAME,_splittedPort.edGetType());
traducer->put((const void *)val);
- isDispatched = true;
+ isDispatched = true;
if(traducer!=portOnGivenBranch)
delete traducer;
}
DynParaLoop::TypeOfNode DynParaLoop::getIdentityOfNotifyerNode(const Node *node, unsigned& id)
{
+ vector<Node *>::iterator iter;
id=0;
- for(vector<Node *>::iterator iter=_execNodes.begin();iter!=_execNodes.end();iter++,id++)
- if(*iter==node)
+ for (iter=_execNodes.begin() ; iter!=_execNodes.end() ; iter++,id++)
+ if (*iter==node)
return WORK_NODE;
id=0;
- for(vector<Node *>::iterator iter2=_execInitNodes.begin();iter2!=_execInitNodes.end();iter2++,id++)
- if(*iter2==node)
+ for (iter=_execInitNodes.begin() ; iter!=_execInitNodes.end() ; iter++,id++)
+ if (*iter==node)
return INIT_NODE;
+ id=0;
+ for (iter=_execFinalizeNodes.begin() ; iter!=_execFinalizeNodes.end() ; iter++,id++)
+ if (*iter==node)
+ return FINALIZE_NODE;
}
bool DynParaLoop::isMultiplicitySpecified(unsigned& value) const
}
/*!
+ * \param start : start port
+ * \param end : end port
* \param cross indicates if start -> end link is a DS link behind.
* \param fw out parameter.
* \param fwCross out parameter storing links where a cross has been detected.
* \param bw out parameter where backward links are stored.
+ * \param info : collected information
*/
void DynParaLoop::checkControlDependancy(OutPort *start, InPort *end, bool cross,
std::map < ComposedNode *, std::list < OutPort * >, SortHierarc >& fw,
}
/*!
- * \note : For a given name 'name' of port in absolute form from this, returns the corresponding InputPort instance of the
- * port for the branch # 'branchNb'. The port can be part of _node or _initNode if it exists (if 'initNodeAdmitted' is true).
+ * \note : For a given name 'name' of port in absolute form from this, returns the corresponding InputPort
+ * instance of the port for the branch # 'branchNb'.
+ * The port can be part of _node or _initNode if it exists (if 'initNodeAdmitted' is true).
* \b WARNING : no check performed on 'branchNb' value to see if it is compatible with size of '_execNodes'.
* This method is called to dispatch value on each InputPort linked to this->._splitterNode._splittedPort
*/
return 0;
}
-void DynParaLoop::checkBasicConsistency() const throw(Exception)
+void DynParaLoop::checkBasicConsistency() const throw(YACS::Exception)
{
DEBTRACE("DynParaLoop::checkBasicConsistency");
ComposedNode::checkBasicConsistency();
throw Exception("For a dynamic loop, internal node is mandatory");
}
+std::string DynParaLoop::getErrorReport()
+{
+ DEBTRACE("DynParaLoop::getErrorReport: " << getName() << " " << _state);
+ YACS::StatesForNode effectiveState=getEffectiveState();
+
+ if(effectiveState != YACS::INVALID && effectiveState != YACS::ERROR && effectiveState != YACS::FAILED)
+ return "";
+
+ std::string report="<error node= " + getName();
+ switch(effectiveState)
+ {
+ case YACS::INVALID:
+ report=report+" state= INVALID";
+ break;
+ case YACS::ERROR:
+ report=report+" state= ERROR";
+ break;
+ case YACS::FAILED:
+ report=report+" state= FAILED";
+ break;
+ default:
+ break;
+ }
+ report=report + ">\n" ;
+ if(_errorDetails != "")
+ report=report+_errorDetails+"\n";
+
+ if(_execNodes.empty())
+ {
+ // edition node
+ list<Node *> constituents=edGetDirectDescendants();
+ for(list<Node *>::iterator iter=constituents.begin(); iter!=constituents.end(); iter++)
+ {
+ std::string rep=(*iter)->getErrorReport();
+ if(rep != "")
+ {
+ report=report+rep+"\n";
+ }
+ }
+ }
+ else
+ {
+ // execution nodes
+ for(vector<Node *>::iterator iter=_execInitNodes.begin();iter!=_execInitNodes.end();iter++)
+ {
+ std::string rep=(*iter)->getErrorReport();
+ if(rep != "")
+ {
+ report=report+rep+"\n";
+ }
+ }
+ for(vector<Node *>::iterator iter=_execNodes.begin();iter!=_execNodes.end();iter++)
+ {
+ std::string rep=(*iter)->getErrorReport();
+ if(rep != "")
+ {
+ report=report+rep+"\n";
+ }
+ }
+ for(vector<Node *>::iterator iter=_execFinalizeNodes.begin();iter!=_execFinalizeNodes.end();iter++)
+ {
+ std::string rep=(*iter)->getErrorReport();
+ if(rep != "")
+ {
+ report=report+rep+"\n";
+ }
+ }
+ }
+
+ report=report+"</error>";
+ return report;
+}
+
+void DynParaLoop::forwardExecStateToOriginalBody(Node *execNode)
+{
+ unsigned int id;
+ Node * origNode = NULL;
+ switch (getIdentityOfNotifyerNode(execNode,id))
+ {
+ case INIT_NODE:
+ {
+ origNode = _initNode;
+ break;
+ }
+ case WORK_NODE:
+ {
+ origNode = _node;
+ break;
+ }
+ case FINALIZE_NODE:
+ {
+ origNode = _finalizeNode;
+ break;
+ }
+ default:
+ YASSERT(false)
+ }
+
+ YASSERT(origNode != NULL)
+ origNode->setState(execNode->getState());
+ origNode->setErrorDetails(execNode->getErrorDetails());
+
+ ComposedNode* compNode = dynamic_cast<ComposedNode*>(origNode);
+ ComposedNode* compNodeExe = dynamic_cast<ComposedNode*>(execNode);
+ if (compNode && compNodeExe)
+ {
+ list<Node *> aChldn = compNodeExe->getAllRecursiveConstituents();
+ list<Node *>::iterator iter=aChldn.begin();
+ for(;iter!=aChldn.end();iter++)
+ {
+ Node* node=compNode->getChildByName(compNodeExe->getChildName(*iter));
+ node->setState((*iter)->getState());
+ node->setErrorDetails((*iter)->getErrorDetails());
+ }
+ }
+}
+
+//! Method used to notify the node that a child node has failed
+/*!
+ * Update the current state and return the change state
+ *
+ * \param node : the child node that has failed
+ * \return the state change
+ */
+YACS::Event DynParaLoop::updateStateOnFailedEventFrom(Node *node)
+{
+ DEBTRACE("DynParaLoop::updateStateOnFailedEventFrom " << node->getName());
+ setState(YACS::FAILED);
+ forwardExecStateToOriginalBody(node);
+ unsigned int id;
+ switch (getIdentityOfNotifyerNode(node,id))
+ {
+ case INIT_NODE:
+ {
+ _node->setState(YACS::FAILED);
+ if (_finalizeNode != NULL) _finalizeNode->setState(YACS::FAILED);
+ break;
+ }
+ case WORK_NODE:
+ {
+ if (_finalizeNode != NULL) _finalizeNode->setState(YACS::FAILED);
+ break;
+ }
+ }
+ return YACS::ABORT;
+}
+
+//! Clone nodes and make their placement consistent with the placement of the original ones.
+/*!
+ * For instance, if two original nodes are placed on a component comp1 in a container cont1
+ * and a third one is placed on a component comp2 in the container cont1, the clones of the two
+ * first nodes will be placed on a component comp3 in a container cont2 and the third clone
+ * will be placed on a component comp4 in the container cont2.
+ */
+vector<Node *> DynParaLoop::cloneAndPlaceNodesCoherently(const vector<Node *> & origNodes)
+{
+ DEBTRACE("Begin cloneAndPlaceNodesCoherently")
+ vector<Node *> clones;
+ DeploymentTree treeToDup;
+ vector<list<ElementaryNode *> > origElemNodeList;
+ for (int i=0 ; i<origNodes.size() ; i++)
+ {
+ DEBTRACE("Cloning node " << i)
+ if (origNodes[i] == NULL)
+ {
+ DEBTRACE("Cloning node " << i << ", NULL" )
+ clones.push_back(NULL);
+ origElemNodeList.push_back(list<ElementaryNode *>());
+ }
+ else
+ {
+ DEBTRACE("Cloning node " << i << "," << origNodes[i]->getName())
+ clones.push_back(origNodes[i]->simpleClone(this, false));
+ list<ElementaryNode *> tasks = origNodes[i]->getRecursiveConstituents();
+ origElemNodeList.push_back(tasks);
+ for (list< ElementaryNode *>::iterator iter=tasks.begin() ; iter!=tasks.end() ; iter++)
+ treeToDup.appendTask(*iter, (*iter)->getDynClonerIfExists(this));
+ }
+ }
+
+ DEBTRACE("Placing nodes...")
+ vector<Container *> conts=treeToDup.getAllContainers();
+
+ //iterate on all containers
+ for(vector<Container *>::iterator iterCt=conts.begin();iterCt!=conts.end();iterCt++)
+ {
+ DEBTRACE("Container " << ((*iterCt)?(*iterCt)->getName():"NULL"))
+ vector<ComponentInstance *> comps=treeToDup.getComponentsLinkedToContainer(*iterCt);
+ Container *contCloned=0;
+ if((*iterCt))
+ contCloned=(*iterCt)->clone();
+
+ //iterate on all component instances linked to the container
+ for(vector<ComponentInstance *>::iterator iterCp=comps.begin();iterCp!=comps.end();iterCp++)
+ {
+ DEBTRACE("Component " << (*iterCp)->getCompoName())
+ vector<Task *> tasks=treeToDup.getTasksLinkedToComponent(*iterCp);
+ ComponentInstance *curCloned=(*iterCp)->clone();
+ DEBTRACE("Assign container " << (*iterCp)->getCompoName())
+ curCloned->setContainer(contCloned);
+ for(vector<Task *>::iterator iterT=tasks.begin();iterT!=tasks.end();iterT++)
+ {
+ DEBTRACE("Task " << ((ElementaryNode *)(*iterT))->getName())
+ int i = 0;
+ ElementaryNode * origElemNode = NULL;
+ for (i=0 ; i<origNodes.size() ; i++)
+ if (origNodes[i] != NULL)
+ {
+ DEBTRACE("Looking in original node " << i)
+ list<ElementaryNode *>::iterator res=find(origElemNodeList[i].begin(),
+ origElemNodeList[i].end(),
+ (ElementaryNode *)(*iterT));
+ if (res != origElemNodeList[i].end()) {
+ origElemNode = *res;
+ break;
+ }
+ }
+
+ YASSERT(origElemNode != NULL)
+ DEBTRACE("Found task in node " << i)
+ ServiceNode * nodeC = NULL;
+ if (origNodes[i] == origElemNode)
+ nodeC = (ServiceNode *)clones[i];
+ else
+ {
+ string childName = ((ComposedNode *)origNodes[i])->getChildName(origElemNode);
+ nodeC = (ServiceNode *)clones[i]->getChildByName(childName);
+ }
+ DEBTRACE("Assign component: " << (*iterCp)->getCompoName() << "," << nodeC->getName())
+ nodeC->setComponent(curCloned);
+ }
+ curCloned->decrRef();
+ }
+
+ // iterate on all tasks linked to the container
+ vector<Task *> tasks=treeToDup.getTasksLinkedToContainer(*iterCt);
+ for(vector<Task *>::iterator iterT=tasks.begin();iterT!=tasks.end();iterT++)
+ {
+ DEBTRACE("Task " << ((ElementaryNode *)(*iterT))->getName())
+ int i = 0;
+ ElementaryNode * origElemNode = NULL;
+ for (i=0 ; i<origNodes.size() ; i++)
+ if (origNodes[i] != NULL)
+ {
+ DEBTRACE("Looking in original node " << i)
+ list<ElementaryNode *>::iterator res=find(origElemNodeList[i].begin(),
+ origElemNodeList[i].end(),
+ (ElementaryNode *)(*iterT));
+ if (res != origElemNodeList[i].end())
+ {
+ origElemNode = *res;
+ break;
+ }
+ }
+ YASSERT(origElemNode != NULL)
+ DEBTRACE("Found task in node " << i)
+ InlineFuncNode * nodeC = NULL;
+ if (origNodes[i] == origElemNode)
+ {
+ nodeC = (InlineFuncNode *)clones[i];
+ }
+ else
+ {
+ string childName = ((ComposedNode *)origNodes[i])->getChildName(origElemNode);
+ nodeC = (InlineFuncNode *)clones[i]->getChildByName(childName);
+ }
+ DEBTRACE("Assign container " << nodeC->getName() << "," << contCloned->getName())
+ nodeC->setContainer(contCloned);
+ }
+
+ // ended with current container
+ if(contCloned)
+ contCloned->decrRef();
+ }
+
+ DEBTRACE("End cloneAndPlaceNodesCoherently")
+ return clones;
+}
+
+void DynParaLoop::accept(Visitor *visitor)
+{
+ visitor->visitDynParaLoop(this);
+}
+
+Node * DynParaLoop::getInitNode()
+{
+ return _initNode;
+}
+
+Node * DynParaLoop::getExecNode()
+{
+ return _node;
+}
+
+Node * DynParaLoop::getFinalizeNode()
+{
+ return _finalizeNode;
+}
+
+void DynParaLoop::shutdown(int level)
+{
+ if(level==0)return;
+ if(!_node) return;
+
+ std::vector<Node *>::iterator iter;
+ for (iter=_execNodes.begin() ; iter!=_execNodes.end() ; iter++)
+ (*iter)->shutdown(level);
+ for (iter=_execInitNodes.begin() ; iter!=_execInitNodes.end() ; iter++)
+ (*iter)->shutdown(level);
+ for (iter=_execFinalizeNodes.begin() ; iter!=_execFinalizeNodes.end() ; iter++)
+ (*iter)->shutdown(level);
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __DYNPARALOOP_HXX__
#define __DYNPARALOOP_HXX__
+#include "YACSlibEngineExport.hxx"
#include "ComposedNode.hxx"
#include "AnyInputPort.hxx"
+#include "AnyOutputPort.hxx"
#include "OutputPort.hxx"
namespace YACS
{
namespace ENGINE
{
- class DynParaLoop;
-
- class AnyOutputPort : public OutputPort
- {
- friend class DynParaLoop;
- public:
- //! store the current dispatched value
- virtual void setValue(Any *data);
- //! get the current dispatched value for update port value
- Any* getValue() const { return _data; }
- virtual std::string typeName() {return "YACS__ENGINE__AnyOutputPort";}
- private:
- Any* _data; // the data dispatched from port on the current moment
- private:
- AnyOutputPort(const std::string& name, Node *node, TypeCode *type);
- AnyOutputPort(const AnyOutputPort& other, Node *newHelder);
- virtual ~AnyOutputPort();
- OutputPort *clone(Node *newHelder) const;
- };
-
/*!
* \brief Base class for dynamically (fully or semifully) built graphs.
+ * \ingroup Nodes
*/
- class DynParaLoop : public ComposedNode
+ class YACSLIBENGINE_EXPORT DynParaLoop : public ComposedNode
{
protected:
typedef enum
{
INIT_NODE = 5,
- WORK_NODE = 6
+ WORK_NODE = 6,
+ FINALIZE_NODE = 7
} TypeOfNode;
protected:
Node *_node;
Node *_initNode;
+ Node *_finalizeNode;
unsigned _nbOfEltConsumed;
std::vector<int> _execIds;
AnyInputPort _nbOfBranches;
AnyOutputPort _splittedPort;
std::vector<Node *> _execNodes;
std::vector<Node *> _execInitNodes;
+ std::vector<Node *> _execFinalizeNodes;
+ int _initializingCounter;
+ int _unfinishedCounter;
protected:
static const char NAME_OF_SPLITTED_SEQ_OUT[];
+ static const char OLD_NAME_OF_SPLITTED_SEQ_OUT[];
static const char NAME_OF_NUMBER_OF_BRANCHES[];
protected:
DynParaLoop(const std::string& name, TypeCode *typeOfDataSplitted);
public:
Node *edRemoveNode();
Node *edRemoveInitNode();
+ Node *edRemoveFinalizeNode();
//Node* DISOWNnode is a SWIG notation to indicate that the ownership of the node is transfered to C++
Node *edSetNode(Node *DISOWNnode);
Node *edSetInitNode(Node *DISOWNnode);
+ Node *edSetFinalizeNode(Node *DISOWNnode);
+ virtual bool edAddDFLink(OutPort *start, InPort *end) throw(Exception);
void init(bool start=true);
InputPort *edGetNbOfBranchesPort() { return &_nbOfBranches; }
int getNumberOfInputPorts() const;
int getNumberOfOutputPorts() const;
unsigned getNumberOfEltsConsumed() const { return _nbOfEltConsumed; }
std::list<OutputPort *> getSetOfOutputPort() const;
+ std::list<OutputPort *> getLocalOutputPorts() const;
OutputPort *edGetSamplePort() { return &_splittedPort; }
OutPort *getOutPort(const std::string& name) const throw(Exception);
InputPort *getInputPort(const std::string& name) const throw(Exception);
//! For the moment false is returned : impovement about it coming soon.
bool isPlacementPredictableB4Run() const;
void edRemoveChild(Node *node) throw(Exception);
+ virtual bool edAddChild(Node *node) throw(Exception);
std::list<Node *> edGetDirectDescendants() const;
std::list<InputPort *> getSetOfInputPort() const;
std::list<InputPort *> getLocalInputPorts() const;
bool isMultiplicitySpecified(unsigned& value) const;
void forceMultiplicity(unsigned value);
virtual void checkBasicConsistency() const throw(Exception);
+ virtual std::string getErrorReport();
+ void accept(Visitor *visitor);
+ Node * getInitNode();
+ Node * getExecNode();
+ Node * getFinalizeNode();
protected:
void buildDelegateOf(InPort * & port, OutPort *initialStart, const std::list<ComposedNode *>& pointsOfView);
void buildDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView);
void putValueOnBranch(Any *val, unsigned branchId, bool first);
TypeOfNode getIdentityOfNotifyerNode(const Node *node, unsigned& id);
InputPort *getDynInputPortByAbsName(int branchNb, const std::string& name, bool initNodeAdmitted);
+ virtual void forwardExecStateToOriginalBody(Node *execNode);
+ virtual YACS::Event updateStateOnFailedEventFrom(Node *node);
+ std::vector<Node *> cloneAndPlaceNodesCoherently(const std::vector<Node *> & origNodes);
+ Node * checkConsistencyAndSetNode(Node* &nodeToReplace, Node* DISOWNnode);
+ Node * removeNode(Node* &nodeToRemove);
+ virtual void shutdown(int level);
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "ElementaryNode.hxx"
#include "Runtime.hxx"
#include "InputPort.hxx"
#include "InputDataStreamPort.hxx"
#include "OutputDataStreamPort.hxx"
#include "Visitor.hxx"
+#include "Proc.hxx"
+#include "Container.hxx"
#include <iostream>
+#include <sstream>
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
using namespace YACS::ENGINE;
using namespace std;
-ElementaryNode::ElementaryNode(const std::string& name):Node(name)
+/*! \class YACS::ENGINE::ElementaryNode
+ * \brief Base class for all calculation nodes.
+ *
+ * This is an abstract class that must be specialized.
+ *
+ * \ingroup Nodes
+ */
+
+ElementaryNode::ElementaryNode(const std::string& name):
+ Node(name),
+ _createDatastreamPorts(false),
+ _multi_port_node(false)
{
}
ElementaryNode::ElementaryNode(const ElementaryNode& other, ComposedNode *father):Node(other,father)
{
+ _createDatastreamPorts = other._createDatastreamPorts;
+ _multi_port_node = other._multi_port_node;
for(list<InputPort *>::const_iterator iter1=other._setOfInputPort.begin();iter1!=other._setOfInputPort.end();iter1++)
_setOfInputPort.push_back((InputPort *)(*iter1)->clone(this));
for(list<OutputPort *>::const_iterator iter2=other._setOfOutputPort.begin();iter2!=other._setOfOutputPort.end();iter2++)
void ElementaryNode::init(bool start)
{
+ DEBTRACE("ElementaryNode::init " << getName() << " " << start << " " << _state);
+
for(list<OutputPort *>::iterator iter=_setOfOutputPort.begin();iter!=_setOfOutputPort.end();iter++)
(*iter)->exInit();
for(list<InputPort *>::iterator iter2=_setOfInputPort.begin();iter2!=_setOfInputPort.end();iter2++)
}
if(start) //complete initialization
setState(YACS::READY);
- else //partial initialization (inside a loop)
- setState(YACS::LOADED);
+ else if(_state > YACS::LOADED)//partial initialization (inside a loop)
+ setState(YACS::TORECONNECT);
}
bool ElementaryNode::isDeployable() const
return 0;
}
+Container *ElementaryNode::getContainer()
+{
+ return 0;
+}
+
YACS::StatesForNode ElementaryNode::getState() const
{
return Node::getState();
return _setOfOutputPort.size();
}
-InputPort *ElementaryNode::getInputPort(const std::string& name) const throw(Exception)
+InputPort *ElementaryNode::getInputPort(const std::string& name) const throw(YACS::Exception)
{
+ try {
+ return Node::getInputPort(name);
+ }
+ catch(Exception& e) {}
return getPort<InputPort>(name,_setOfInputPort);
}
-OutputPort *ElementaryNode::getOutputPort(const std::string& name) const throw(Exception)
+OutputPort *ElementaryNode::getOutputPort(const std::string& name) const throw(YACS::Exception)
{
return getPort<OutputPort>(name,_setOfOutputPort);
}
{
set<OutPort *> temp2=(*iter2)->edSetOutPort();
for(set<OutPort *>::iterator iter3=temp2.begin();iter3!=temp2.end();iter3++)
- ret.push_back(pair<InPort *, OutPort *>(*iter2,*iter3));
+ {
+ std::set<OutPort *> trueOutPorts;
+ (*iter3)->getAllRepresented(trueOutPorts);
+ for(std::set<OutPort *>::iterator iter4=trueOutPorts.begin();iter4!=trueOutPorts.end();++iter4)
+ ret.push_back(pair<InPort *, OutPort *>(*iter2,*iter4));
+ }
}
return ret;
}
-InputDataStreamPort *ElementaryNode::getInputDataStreamPort(const std::string& name) const throw(Exception)
+InputDataStreamPort *ElementaryNode::getInputDataStreamPort(const std::string& name) const throw(YACS::Exception)
{
return getPort<InputDataStreamPort>(name,_setOfInputDataStreamPort);
}
-OutputDataStreamPort *ElementaryNode::getOutputDataStreamPort(const std::string& name) const throw(Exception)
+OutputDataStreamPort *ElementaryNode::getOutputDataStreamPort(const std::string& name) const throw(YACS::Exception)
{
return getPort<OutputDataStreamPort>(name,_setOfOutputDataStreamPort);
}
return ret;
}
+/*
+ This method is used by the "multi" property of ElementaryNode to create
+ to create duplicated input and ouput datastream ports.
+*/
+void
+ElementaryNode::createMultiDatastreamPorts()
+{
+ if (!_createDatastreamPorts)
+ {
+ _createDatastreamPorts = true;
+ for(list<InputDataStreamPort *>::const_iterator iter3 = _setOfInputDataStreamPort.begin(); iter3!=_setOfInputDataStreamPort.end();iter3++)
+ {
+ InputDataStreamPort * port = *iter3;
+ std::string port_name = port->getName();
+ std::map<std::string,std::string>::iterator it=_propertyMap.find(port_name);
+ int multi = 1;
+ if(it != _propertyMap.end())
+ {
+ std::string multi_str = it->second;
+ std::istringstream iss(multi_str);
+ if (!(iss >> multi))
+ throw Exception("Property multi port should be set with a stringified int not an: " + multi_str);
+ }
+
+ if (multi > 1)
+ {
+ addDatastreamPortToInitMultiService(port_name, multi);
+ // Change name of first port
+ port->setName(port_name + "_0");
+ for (int i = 2; i <= multi; i++)
+ {
+ InputDataStreamPort * new_port = port->clone(this);
+ std::ostringstream number;
+ number << i-1;
+ new_port->setName(port_name + "_" + number.str());
+ _setOfInputDataStreamPort.push_back(new_port);
+ _multi_port_node = true;
+ }
+ }
+ }
+ for(list<OutputDataStreamPort *>::const_iterator iter4 = _setOfOutputDataStreamPort.begin(); iter4!=_setOfOutputDataStreamPort.end();iter4++)
+ {
+ OutputDataStreamPort * port = *iter4;
+ std::string port_name = port->getName();
+ std::map<std::string,std::string>::iterator it=_propertyMap.find(port_name);
+ int multi = 1;
+ if(it != _propertyMap.end())
+ {
+ std::string multi_str = it->second;
+ std::istringstream iss(multi_str);
+ if (!(iss >> multi))
+ throw Exception("Property multi port should be set with a stringified int not an: " + multi_str);
+ }
+
+ if (multi > 1)
+ {
+ addDatastreamPortToInitMultiService(port_name, multi);
+ // Change name of first port
+ port->setName(port_name + "_0");
+ for (int i = 2; i <= multi; i++)
+ {
+ OutputDataStreamPort * new_port = port->clone(this);
+ std::ostringstream number;
+ number << i-1;
+ new_port->setName(port_name + "_" + number.str());
+ _setOfOutputDataStreamPort.push_back(new_port);
+ _multi_port_node = true;
+ }
+ }
+ }
+ }
+}
+
/**
* add this node task to a given set of ready tasks, if this task is ready to activate
*/
void ElementaryNode::getReadyTasks(std::vector<Task *>& tasks)
{
DEBTRACE("ElementaryNode::getReadyTasks: " << getName() << " " << _state);
- if(_state==YACS::TOACTIVATE or _state==YACS::TOLOAD)
- tasks.push_back(this);
+
+ int multi = 1;
+ std::map<std::string,std::string>::iterator it=_propertyMap.find("multi");
+ if(it != _propertyMap.end())
+ {
+ std::string multi_str = it->second;
+ std::istringstream iss(multi_str);
+ if (!(iss >> multi))
+ throw Exception("Property multi should be set with a stringified int not an: " + multi_str);
+ }
+
+ if(_state==YACS::TOACTIVATE || _state==YACS::TOLOAD || _state==YACS::TORECONNECT)
+ {
+ if (multi == 1)
+ {
+ std::map<std::string,std::string>::iterator it=_propertyMap.find("multi_working_dir");
+ if(it != _propertyMap.end())
+ {
+ std::string working_dir_base = it->second;
+ std::ostringstream working_dir_stream;
+ working_dir_stream << working_dir_base;
+ working_dir_stream << 1;
+ this->getContainer()->setProperty("workingdir", working_dir_stream.str());
+ }
+ tasks.push_back(this);
+ }
+ else
+ {
+
+ // Check output port -> cannot clone an Elementary Node with Output Ports connected
+ std::list<OutputPort *>::iterator it_output = _setOfOutputPort.begin();
+ for (;it_output != _setOfOutputPort.end(); it_output++)
+ {
+ if ((*it_output)->isConnected())
+ {
+ throw Exception("Property multi cannot be set on nodes with dataflow output ports connected");
+ }
+ }
+
+ // Add my instance
+ std::map<std::string,std::string>::iterator it=_propertyMap.find("multi_working_dir");
+ if(it != _propertyMap.end())
+ {
+ std::string working_dir_base = it->second;
+ std::ostringstream working_dir_stream;
+ working_dir_stream << working_dir_base;
+ working_dir_stream << 1;
+ this->getContainer()->setProperty("workingdir", working_dir_stream.str());
+ }
+ tasks.push_back(this);
+
+ // Step 1: Create clones
+ for (int i = 1; i < multi; i++)
+ {
+ // Clone
+ YACS::ENGINE::ElementaryNode * new_node = static_cast<YACS::ENGINE::ElementaryNode *>(clone(_father, false));
+ new_node->createMultiDatastreamPorts();
+
+ // Change name
+ std::string iname;
+ std::stringstream inamess;
+ inamess << getName() << "_" << i;
+ iname=inamess.str();
+ DEBTRACE("Create clone "<< iname << " of node " << getName());
+ new_node->setName(iname);
+
+ // For each input port connect it with the original output port
+ std::list<InputPort *> clone_list_inputPorts = new_node->getSetOfInputPort();
+ for(list<InputPort *>::const_iterator iter1=clone_list_inputPorts.begin(); iter1!=clone_list_inputPorts.end(); iter1++)
+ {
+ std::string input_port_name = (*iter1)->getName();
+ // Get Port Name in master node
+ InputPort * master_port = getInputPort(input_port_name);
+ for (std::set<OutPort *>::const_iterator itt=master_port->_backLinks.begin(); itt!=master_port->_backLinks.end();itt++)
+ {
+ // Connect dataflow
+ getProc()->edAddDFLink((*itt),(*iter1));
+ }
+ }
+
+ // InputDataStreamPort connections
+ std::list<InputDataStreamPort *> clone_list_inputDatastreamPorts = new_node->getSetOfInputDataStreamPort();
+ for(list<InputDataStreamPort *>::iterator iter = clone_list_inputDatastreamPorts.begin(); iter != clone_list_inputDatastreamPorts.end(); iter++)
+ {
+ std::string port_name = (*iter)->getName();
+ InputDataStreamPort * orig_port = getInputDataStreamPort(port_name);
+
+ std::set<OutputDataStreamPort *> connected_ports = orig_port->getConnectedOutputDataStreamPort();
+
+ // Create datastream ports if not created
+ std::set<OutputDataStreamPort *>::const_iterator iter3;
+ for(iter3=connected_ports.begin();iter3!=connected_ports.end();iter3++)
+ {
+ ElementaryNode * node = (ElementaryNode *) (*iter3)->getNode();
+ node->createMultiDatastreamPorts();
+
+ std::string good_port_name;
+ std::stringstream temp_name;
+ std::string out_name = (*iter3)->getName();
+ out_name.erase(out_name.end()-1);
+ temp_name << out_name << i;
+ good_port_name = temp_name.str();
+ getProc()->edAddLink(node->getOutputDataStreamPort(good_port_name), (*iter));
+ }
+ }
+
+ // OutputDataStreamPort connections
+ std::list<OutputDataStreamPort *> clone_list_outputDatastreamPorts = new_node->getSetOfOutputDataStreamPort();
+ for(list<OutputDataStreamPort *>::iterator iter = clone_list_outputDatastreamPorts.begin(); iter != clone_list_outputDatastreamPorts.end(); iter++)
+ {
+ std::string port_name = (*iter)->getName();
+ OutputDataStreamPort * orig_port = getOutputDataStreamPort(port_name);
+ std::set<InputDataStreamPort *> dest_input_port = orig_port->_setOfInputDataStreamPort;
+ for(set<InputDataStreamPort *>::iterator dest_port = dest_input_port.begin(); dest_port != dest_input_port.end(); dest_port++)
+ {
+ ElementaryNode * dest_node = (ElementaryNode *)(*dest_port)->getNode();
+ // Add InputPort to dest node
+ dest_node->createMultiDatastreamPorts();
+
+ std::string good_port_name;
+ std::stringstream temp_name;
+ std::string in_name = (*dest_port)->getName();
+ in_name.erase(in_name.end()-1);
+ temp_name << in_name << i;
+ good_port_name = temp_name.str();
+ getProc()->edAddLink((*iter), dest_node->getInputDataStreamPort(good_port_name));
+ }
+ }
+
+ // Init node
+ new_node->init(false);
+ new_node->exUpdateState();
+
+ // Set Control Link to done
+ std::list<OutGate *> clone_cl_back = new_node->getInGate()->getBackLinks();
+ for(std::list<OutGate *>::const_iterator iter=clone_cl_back.begin(); iter!=clone_cl_back.end(); iter++)
+ new_node->getInGate()->exNotifyFromPrecursor((*iter));
+
+ // Add clone
+ std::map<std::string,std::string>::iterator it=_propertyMap.find("multi_working_dir");
+ if(it != _propertyMap.end())
+ {
+ std::string working_dir_base = it->second;
+ std::ostringstream working_dir_stream;
+ working_dir_stream << working_dir_base;
+ working_dir_stream << i+1;
+ new_node->getContainer()->setProperty("workingdir", working_dir_stream.str());
+ }
+ tasks.push_back(new_node);
+ }
+ }
+ }
}
/**
* remove port from node at edition. Ports are typed.
*/
-void ElementaryNode::edRemovePort(Port *port) throw(Exception)
+void ElementaryNode::edRemovePort(Port *port) throw(YACS::Exception)
{
DEBTRACE("ElementaryNode::edRemovePort ");
if(port->getNode()!=this)
return ret;
}
-Node *ElementaryNode::getChildByName(const std::string& name) const throw(Exception)
+Node *ElementaryNode::getChildByName(const std::string& name) const throw(YACS::Exception)
{
string what("ElementaryNode does not agregate any nodes particullary node with name "); what+=name;
throw Exception(what);
}
-void ElementaryNode::checkBasicConsistency() const throw(Exception)
+void ElementaryNode::checkBasicConsistency() const throw(YACS::Exception)
{
DEBTRACE("ElementaryNode::checkBasicConsistency");
list<InputPort *>::const_iterator iter;
* WARNING: CHECK CASE OF BLOC: ONLY INPUT PORTS NOT INTERNALLY CONNECTED MUST BE VISIBLE.
*/
-InputPort *ElementaryNode::edAddInputPort(const std::string& inputPortName, TypeCode* type) throw(Exception)
+InputPort *ElementaryNode::edAddInputPort(const std::string& inputPortName, TypeCode* type) throw(YACS::Exception)
{
+
+ // Cannot create an InputPort defined with InPropertyPort name.
+ if (inputPortName == "__InPropertyPort__Node__YACS_")
+ {
+ string what("ElementaryNode::edAddInputPort: it is forbidden to add an InputPort with the name __InPropertyPort__Node__YACS_\"");
+ throw Exception(what);
+ }
+
InputPort *ret = 0;
if (edCheckAddPort<InputPort, TypeCode*>(inputPortName,_setOfInputPort,type))
{
* for now, publication is done the same way as input ports
*/
-OutputPort *ElementaryNode::edAddOutputPort(const std::string& outputPortName, TypeCode* type) throw(Exception)
+OutputPort *ElementaryNode::edAddOutputPort(const std::string& outputPortName, TypeCode* type) throw(YACS::Exception)
{
OutputPort *ret =0;
if (edCheckAddPort<OutputPort, TypeCode*>(outputPortName,_setOfOutputPort,type))
return getRuntime()->createInputDataStreamPort(inputPortDSName, this, type);
}
-InputDataStreamPort *ElementaryNode::edAddInputDataStreamPort(const std::string& inputPortDSName, TypeCode* type) throw(Exception)
+InputDataStreamPort *ElementaryNode::edAddInputDataStreamPort(const std::string& inputPortDSName, TypeCode* type) throw(YACS::Exception)
{
InputDataStreamPort *ret = 0;
if (edCheckAddPort<InputDataStreamPort, TypeCode*>(inputPortDSName,_setOfInputDataStreamPort,type))
return getRuntime()->createOutputDataStreamPort(outputPortDSName, this, type);
}
-OutputDataStreamPort *ElementaryNode::edAddOutputDataStreamPort(const std::string& outputPortDSName, TypeCode* type) throw(Exception)
+OutputDataStreamPort *ElementaryNode::edAddOutputDataStreamPort(const std::string& outputPortDSName, TypeCode* type) throw(YACS::Exception)
{
OutputDataStreamPort *ret = 0;
if (edCheckAddPort<OutputDataStreamPort, TypeCode*>(outputPortDSName,_setOfOutputDataStreamPort,type))
* get the input port name used by the current node (see composed nodes)
*/
-string ElementaryNode::getInPortName(const InPort * inPort) const throw (Exception)
+string ElementaryNode::getInPortName(const InPort * inPort) const throw(YACS::Exception)
{
Node *node = inPort->getNode();
if ( node != this )
return inPort->getName();
}
-string ElementaryNode::getOutPortName(const OutPort *outPort) const throw (Exception)
+string ElementaryNode::getOutPortName(const OutPort *outPort) const throw(YACS::Exception)
{
Node *node = outPort->getNode();
if ( node != this )
}
}
}
+
+//! Calls getCoupledNodes for Task interface
+void ElementaryNode::getCoupledTasks(std::set<Task*>& coupledSet)
+{
+ getCoupledNodes(coupledSet);
+}
+
+//! Put all nodes that are coupled to this node in coupledSet
+void ElementaryNode::getCoupledNodes(std::set<Task*>& coupledSet)
+{
+ if(coupledSet.find(this) != coupledSet.end())return;
+
+ coupledSet.insert(this);
+
+ std::list<OutputDataStreamPort *>::iterator iterout;
+ for(iterout = _setOfOutputDataStreamPort.begin(); iterout != _setOfOutputDataStreamPort.end(); iterout++)
+ {
+ OutputDataStreamPort *port=(OutputDataStreamPort *)*iterout;
+ std::set<InPort *> ports=port->edSetInPort();
+ std::set<InPort *>::iterator iter;
+ for(iter=ports.begin();iter != ports.end(); iter++)
+ {
+ Node* node= (*iter)->getNode();
+ node->getCoupledNodes(coupledSet);
+ }
+ }
+}
+
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __ELEMENTARYNODE_HXX__
#define __ELEMENTARYNODE_HXX__
+#include "YACSlibEngineExport.hxx"
#include "Node.hxx"
#include "Task.hxx"
#include "define.hxx"
+
#include <string>
#include <algorithm>
class InputDataStreamPort;
class OutputDataStreamPort;
- class ElementaryNode : public Node, public Task
+ class YACSLIBENGINE_EXPORT ElementaryNode : public Node, public Task
{
friend class ComposedNode;
protected:
std::list<OutputPort *> _setOfOutputPort;
std::list<InputDataStreamPort *> _setOfInputDataStreamPort;
std::list<OutputDataStreamPort *> _setOfOutputDataStreamPort;
+
+ // Management of multi property
+ bool _createDatastreamPorts;
+ bool _multi_port_node;
protected:
ElementaryNode(const std::string& name);
ElementaryNode(const ElementaryNode& other, ComposedNode *father);
void init(bool start=true);
bool isDeployable() const;
ComponentInstance *getComponent();
+ Container *getContainer();
YACS::StatesForNode getState() const;
void getReadyTasks(std::vector<Task *>& tasks);
void edRemovePort(Port *port) throw(Exception);
virtual void connectService() { }
virtual void disconnectService() { }
virtual void load() { }
+ virtual void getCoupledTasks(std::set<Task*>& coupledSet);
+ virtual void getCoupledNodes(std::set<Task*>& coupledSet);
void accept(Visitor *visitor);
+
+ // Used for runtime nodes that need
+ // to configure their services for the multi property
+ virtual void addDatastreamPortToInitMultiService(const std::string & port_name,
+ int number) {}
protected:
+ // Management of multi property
+ virtual void createMultiDatastreamPorts();
+
void edDisconnectAllLinksWithMe();
bool areAllInputPortsValid() const;
template<class PORT>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Executor.hxx"
#include "Task.hxx"
#include "Scheduler.hxx"
#include "Dispatcher.hxx"
+#include "Container.hxx"
+#include "ComponentInstance.hxx"
#include "VisitorSaveState.hxx"
#include "ComposedNode.hxx"
#include <iostream>
#include <fstream>
#include <sys/stat.h>
-#include <cassert>
+#ifndef WIN32
+#include <sys/time.h>
+#include <unistd.h>
+#endif
+
#include <cstdlib>
#include <algorithm>
+#ifdef WNT
+#define usleep(A) _sleep(A/1000)
+#if !defined(S_ISCHR) || !defined(S_ISREG)
+# ifndef S_IFMT
+# ifdef _S_IFMT
+# define S_IFMT _S_IFMT
+# define S_IFCHR _S_IFCHR
+# define S_IFREG _S_IFREG
+# else
+# ifdef __S_IFMT
+# define S_IFMT __S_IFMT
+# define S_IFCHR __S_IFCHR
+# define S_IFREG __S_IFREG
+# endif
+# endif
+# endif
+# define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
+# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
+#endif
+#endif
+
using namespace YACS::ENGINE;
using namespace std;
/*!
* \param graph : schema to execute
* \param debug : display the graph with dot if debug == 1
+ * \param fromScratch : if true the graph is reinitialized
*
* Calls Scheduler::getNextTasks and Scheduler::selectRunnableTasks to select tasks to execute
*
_execMode = YACS::CONTINUE;
_isWaitingEventsFromRunningTasks = false;
_numberOfRunningTasks = 0;
+ _runningTasks.clear();
_numberOfEndedTasks=0;
while(_toContinue)
{
* To be launch in a thread (main thread controls the progression).
* \param graph : schema to execute
* \param debug : display the graph with dot if debug >0
- * \param fromscratch : if false, state from a previous partial exection is already loaded
+ * \param fromScratch : if false, state from a previous partial exection is already loaded
*
* Calls Scheduler::getNextTasks and Scheduler::selectRunnableTasks to select tasks to execute
*
_errorDetected = false;
_isWaitingEventsFromRunningTasks = false;
_numberOfRunningTasks = 0;
+ _runningTasks.clear();
_numberOfEndedTasks = 0;
string tracefile = "traceExec_";
tracefile += _mainSched->getName();
_trace.open(tracefile.c_str());
+#ifdef WIN32
+ _start = timeGetTime();
+#else
+ gettimeofday(&_start, NULL);
+#endif
+
_mutexForSchedulerUpdate.unlock();
} // --- End of critical section
{ // --- Critical section
DEBTRACE("---");
_mutexForSchedulerUpdate.lock();
- _toContinue = !graph->isFinished();
+ //It is possible that the graph is finished but it remains running tasks (it's an error but we must take it into account)
+ if(_numberOfRunningTasks == 0)
+ _toContinue = !graph->isFinished();
+ DEBTRACE("_numberOfRunningTasks: " << _numberOfRunningTasks);
+ DEBTRACE("_numberOfEndedTasks: " << _numberOfEndedTasks);
+ DEBTRACE("_toContinue: " << _toContinue);
if(_toContinue && numberAllTasks==0)
{
//Problem : no running tasks and no task to launch ??
bool Executor::setStepsToExecute(std::list<std::string> listToExecute)
{
DEBTRACE("Executor::setStepsToExecute(std::list<std::string> listToExecute)");
- bool ret = false;
+ bool ret = true;
vector<Task *>::iterator iter;
vector<Task *> restrictedTasks;
{ // --- Critical section
DEBTRACE("selected node to execute " << readyNode);
}
+ return ret;
}
//! suspend pilot execution until Executor is in pause or waiting tasks completion mode.
vst.openFileDump(xmlFile.c_str());
_root->accept(&vst);
vst.closeFileDump();
+ return true;
}
//! not yet implemented
{
DEBTRACE("Executor::loadState()");
_isRunningunderExternalControl=true;
+ return true;
}
for(iter=tasks.begin();iter!=tasks.end();iter++)
{
YACS::StatesForNode state=(*iter)->getState();
- if(state != YACS::TOLOAD)continue;
+ if(state != YACS::TOLOAD && state != YACS::TORECONNECT)continue;
try
{
(*iter)->connectService();
_mutexForSchedulerUpdate.unlock();
}//End of critical section
}
+ if((*iter)->getState() == YACS::ERROR)
+ {
+ //try to put all coupled tasks in error
+ std::set<Task*> coupledSet;
+ (*iter)->getCoupledTasks(coupledSet);
+ for (std::set<Task*>::iterator it = coupledSet.begin(); it != coupledSet.end(); ++it)
+ {
+ Task* t=*it;
+ if(t == *iter)continue;
+ if(t->getState() == YACS::ERROR)continue;
+ try
+ {
+ t->disconnectService();
+ traceExec(t, "disconnectService");
+ }
+ catch(...)
+ {
+ // Disconnect has failed
+ traceExec(t, "disconnectService failed, ABORT");
+ }
+ {//Critical section
+ _mutexForSchedulerUpdate.lock();
+ t->aborted();
+ _mainSched->notifyFrom(t,YACS::ABORT);
+ _mutexForSchedulerUpdate.unlock();
+ }//End of critical section
+ traceExec(t, "state:"+Node::getStateName(t->getState()));
+ }
+ }
traceExec(*iter, "state:"+Node::getStateName((*iter)->getState()));
}
+
//Second phase, execute each task in a thread
for(iter=tasks.begin();iter!=tasks.end();iter++)
{
}
}
+struct threadargs {
+ Task *task;
+ Scheduler *sched;
+ Executor *execInst;
+};
+
//! Execute a Task in a thread
/*!
* \param task : Task to execute
void Executor::launchTask(Task *task)
{
DEBTRACE("Executor::launchTask(Task *task)");
+ struct threadargs *args;
if(task->getState() != YACS::TOACTIVATE)return;
- traceExec(task, "state:TOACTIVATE");
DEBTRACE("before _semForMaxThreads.wait " << _semThreadCnt);
+ if(_semThreadCnt == 0)
+ {
+ //check if we have enough threads to run
+ std::set<Task*> tmpSet=_runningTasks;
+ std::set<Task*>::iterator it = tmpSet.begin();
+ std::string status="running";
+ std::set<Task*> coupledSet;
+ while( it != tmpSet.end() )
+ {
+ Task* tt=*it;
+ coupledSet.clear();
+ tt->getCoupledTasks(coupledSet);
+ status="running";
+ for (std::set<Task*>::iterator iter = coupledSet.begin(); iter != coupledSet.end(); ++iter)
+ {
+ if((*iter)->getState() == YACS::TOACTIVATE)status="toactivate";
+ tmpSet.erase(*iter);
+ }
+ if(status=="running")break;
+ it = tmpSet.begin();
+ }
+
+ if(status=="toactivate")
+ {
+ std::cerr << "WARNING: maybe you need more threads to run your schema (current value="<< _maxThreads << ")" << std::endl;
+ std::cerr << "If it is the case, set the YACS_MAX_THREADS environment variable to a bigger value (export YACS_MAX_THREADS=xxx)" << std::endl;
+ }
+ }
+
_semForMaxThreads.wait();
_semThreadCnt -= 1;
- void **args=new void *[3];
- args[0]=(void *)task;
- args[1]=(void *)_mainSched;
- args[2]=(void *)this;
+ args= new threadargs;
+ args->task = task;
+ args->sched = _mainSched;
+ args->execInst = this;
+
traceExec(task, "launch");
{ // --- Critical section
_mutexForSchedulerUpdate.lock();
_numberOfRunningTasks++;
+ _runningTasks.insert(task);
task->begin(); //change state to ACTIVATED
_mutexForSchedulerUpdate.unlock();
} // --- End of critical section
Thread(functionForTaskExecution,args);
- traceExec(task, "state:"+Node::getStateName(task->getState()));
}
//! wait until a running task ends
void *Executor::functionForTaskExecution(void *arg)
{
DEBTRACE("Executor::functionForTaskExecution(void *arg)");
- void **argT=(void **)arg;
- Task *task=(Task *)argT[0];
- Scheduler *sched=(Scheduler *)argT[1];
- Executor *execInst=(Executor *)argT[2];
- delete [] argT;
+
+ struct threadargs *args = (struct threadargs *) arg;
+ Task *task=args->task;
+ Scheduler *sched=args->sched;
+ Executor *execInst=args->execInst;
+ delete args;
+ execInst->traceExec(task, "state:"+Node::getStateName(task->getState()));
+
Thread::detach();
// Execute task
// Disconnect task
try
{
+ DEBTRACE("task->disconnectService()");
task->disconnectService();
execInst->traceExec(task, "disconnectService");
}
}
task->aborted();
}
+ execInst->traceExec(task, "state:"+Node::getStateName(task->getState()));
sched->notifyFrom(task,ev);
}
catch(Exception& ex)
std::cerr << "Notification failed" << std::endl;
}
execInst->_numberOfRunningTasks--;
+ execInst->_runningTasks.erase(task);
DEBTRACE("_numberOfRunningTasks: " << execInst->_numberOfRunningTasks
<< " _execMode: " << execInst->_execMode
<< " _executorState: " << execInst->_executorState);
void Executor::traceExec(Task *task, const std::string& message)
{
string nodeName = _mainSched->getTaskName(task);
+ Container *cont = task->getContainer();
+ string containerName = "---";
+ string placement = "---";
+ if (cont)
+ {
+ containerName = cont->getName();
+ ComponentInstance *compo = task->getComponent();
+ //if (compo)
+ placement = cont->getFullPlacementId(compo);
+ }
+#ifdef WIN32
+ DWORD now = timeGetTime();
+ double elapse = (now - _start)/1000.0;
+#else
+ timeval now;
+ gettimeofday(&now, NULL);
+ double elapse = (now.tv_sec - _start.tv_sec) + double(now.tv_usec - _start.tv_usec)/1000000.0;
+#endif
_mutexForTrace.lock();
- _trace << nodeName << " " << message << endl;
+ _trace << elapse << " " << containerName << " " << placement << " " << nodeName << " " << message << endl;
_trace << flush;
_mutexForTrace.unlock();
}
void Executor::sendEvent(const std::string& event)
{
Dispatcher* disp=Dispatcher::getDispatcher();
- assert(disp);
- assert(_root);
+ YASSERT(disp);
+ YASSERT(_root);
disp->dispatch(_root,event);
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __EXECUTOR_HXX__
#define __EXECUTOR_HXX__
+#include "YACSlibEngineExport.hxx"
#include "Mutex.hxx"
#include "Thread.hxx"
#include "Semaphore.hxx"
#include "Exception.hxx"
#include "define.hxx"
+#ifdef WIN32
+#include <windows.h>
+#pragma comment(lib,"winmm.lib")
+#endif
#include <list>
#include <vector>
+#include <set>
#include <string>
#include <fstream>
+#include <ctime>
namespace YACS
{
*
*
*/
- class Executor
+ class YACSLIBENGINE_EXPORT Executor
{
protected:
Scheduler *_mainSched;
bool _isRunningunderExternalControl;
bool _isWaitingEventsFromRunningTasks;
int _numberOfRunningTasks;
+ std::set<Task *> _runningTasks;
int _numberOfEndedTasks;
int _semThreadCnt;
YACS::ExecutorState _executorState;
std::list< YACS::BASES::Thread * > _groupOfAllThreadsCreated;
std::ofstream _trace;
std::string _dumpErrorFile;
+#ifdef WIN32
+ DWORD _start;
+#else
+ timeval _start;
+#endif
public:
Executor();
~Executor();
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#include <Python.h>
-#include "ExecutorSwig.hxx"
-#include "Scheduler.hxx"
-
-#include <iostream>
-
-using namespace YACS::ENGINE;
-using namespace std;
-
-//#define _DEVDEBUG_
-#include "YacsTrace.hxx"
-
-void ExecutorSwig::RunPy(Scheduler *graph,int debug, bool isPyThread, bool fromscratch)
-{
- DEBTRACE("ExecutorSwig::RunPy(Scheduler *graph,int debug, bool isPyThread, bool fromscratch) "
- << debug << " " << isPyThread << " " << fromscratch);
- PyThreadState *_save;
- if (isPyThread) _save = PyEval_SaveThread(); // allow Python threads when embedded in a Python thread
- try
- {
- RunB(graph, debug, fromscratch);
- }
- catch (YACS::Exception& e)
- {
- DEBTRACE("YACS exception caught: ");
- DEBTRACE(e.what());
- }
- catch (const std::ios_base::failure&)
- {
- DEBTRACE("io failure");
- }
- catch(...)
- {
- DEBTRACE("Caught unknown exception.");
- }
- if (isPyThread) PyEval_RestoreThread(_save); // restore thread state and lock at the end of Python thread
-}
-
-void ExecutorSwig::waitPause()
-{
- DEBTRACE("ExecutorSwig::waitPause()");
- PyThreadState *_save;
- _save = PyEval_SaveThread(); // allow Python threads when embedded in a Python thread
- Executor::waitPause();
- PyEval_RestoreThread(_save); // restore thread state and lock at the end of Python thread
-}
-
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#ifndef _EXECUTOR_SWIG_HXX_
-#define _EXECUTOR_SWIG_HXX_
-
-#include "Executor.hxx"
-
-namespace YACS
-{
- namespace ENGINE
- {
- class ExecutorSwig: public Executor
- {
- public:
- void RunPy(Scheduler *graph,
- int debug=0,
- bool isPyThread = true,
- bool fromscratch=true);
- void waitPause();
- };
- }
-}
-
-#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "ForEachLoop.hxx"
#include "TypeCode.hxx"
#include "Visitor.hxx"
using namespace YACS::ENGINE;
using namespace std;
+/*! \class YACS::ENGINE::ForEachLoop
+ * \brief Loop node for parametric calculation
+ *
+ * \ingroup Nodes
+ */
+
const char FakeNodeForForEachLoop::NAME[]="thisIsAFakeNode";
const char SplitterNode::NAME_OF_SEQUENCE_INPUT[]="SmplsCollection";
{
}
-bool AnySplitOutputPort::addInPort(InPort *inPort) throw(Exception)
+bool AnySplitOutputPort::addInPort(InPort *inPort) throw(YACS::Exception)
{
bool ret=OutputPort::addInPort(inPort);
if(_repr)
_repr->getAllRepresented(represented);
}
-int AnySplitOutputPort::removeInPort(InPort *inPort, bool forward) throw(Exception)
+int AnySplitOutputPort::removeInPort(InPort *inPort, bool forward) throw(YACS::Exception)
{
bool ret=OutputPort::removeInPort(inPort,forward);
if(_repr)
SplitterNode::SplitterNode(const std::string& name, TypeCode *typeOfData,
ForEachLoop *father):ElementaryNode(name),
_dataPortToDispatch(NAME_OF_SEQUENCE_INPUT,
- this,(TypeCodeSeq *)TypeCode::sequenceTc("","",typeOfData))
+ this,(TypeCodeSeq *)TypeCode::sequenceTc("","",typeOfData))
{
_father=father;
}
{
}
-InputPort *SplitterNode::getInputPort(const std::string& name) const throw(Exception)
+InputPort *SplitterNode::getInputPort(const std::string& name) const throw(YACS::Exception)
{
if(name==NAME_OF_SEQUENCE_INPUT)
return (InputPort *)&_dataPortToDispatch;
void FakeNodeForForEachLoop::exForwardFailed()
{
_loop->exForwardFailed();
- FakeNodeForForEachLoop *normallyThis=_loop->_nodeForSpecialCases;
- _loop->_nodeForSpecialCases=0;
- delete normallyThis;
}
void FakeNodeForForEachLoop::exForwardFinished()
{
_loop->exForwardFinished();
- FakeNodeForForEachLoop *normallyThis=_loop->_nodeForSpecialCases;
- _loop->_nodeForSpecialCases=0;
- delete normallyThis;
}
void FakeNodeForForEachLoop::execute()
void ForEachLoop::exUpdateState()
{
+ DEBTRACE("ForEachLoop::exUpdateState");
if(_state == YACS::DISABLED)
return;
if(_inGate.exIsReady())
{
- //setState(YACS::TOACTIVATE); // call this method below
//internal graph update
int i;
int nbOfBr=_nbOfBranches.getIntValue();
int nbOfElts=_splitterNode.getNumberOfElements();
+
+ DEBTRACE("nbOfElts=" << nbOfElts);
+ DEBTRACE("nbOfBr=" << nbOfBr);
+
if(nbOfElts==0)
{
prepareSequenceValues(0);
delete _nodeForSpecialCases;
_nodeForSpecialCases=new FakeNodeForForEachLoop(this,true);
+ setState(YACS::ACTIVATED);
return ;
}
if(nbOfBr<=0)
{
delete _nodeForSpecialCases;
_nodeForSpecialCases=new FakeNodeForForEachLoop(this,getAllOutPortsLeavingCurrentScope().empty());
+ setState(YACS::ACTIVATED);
return ;
}
if(nbOfBr>nbOfElts)
prepareSequenceValues(nbOfElts);
if(_initNode)
_execInitNodes.resize(nbOfBr);
+ _initializingCounter = 0;
+ if (_finalizeNode)
+ _execFinalizeNodes.resize(nbOfBr);
+
+ vector<Node *> origNodes;
+ origNodes.push_back(_initNode);
+ origNodes.push_back(_node);
+ origNodes.push_back(_finalizeNode);
//Conversion exceptions can be thrown by createOutputOutOfScopeInterceptors
//so catch them to control errors
{
for(i=0;i<nbOfBr;i++)
{
- DEBTRACE( "-------------- 1" );
+ DEBTRACE( "-------------- 1 " << i << " " << _execCurrentId);
_execIds[i]=_execCurrentId;
DEBTRACE( "-------------- 2" );
- _execNodes[i]=_node->clone(this,false);
- DEBTRACE( "-------------- 3" );
+ vector<Node *> clonedNodes = cloneAndPlaceNodesCoherently(origNodes);
if(_initNode)
- _execInitNodes[i]=_initNode->clone(this,false);
+ _execInitNodes[i] = clonedNodes[0];
+ _execNodes[i] = clonedNodes[1];
+ if(_finalizeNode)
+ _execFinalizeNodes[i] = clonedNodes[2];
DEBTRACE( "-------------- 4" );
prepareInputsFromOutOfScope(i);
DEBTRACE( "-------------- 5" );
throw;
}
- setState(YACS::TOACTIVATE); // move the calling of setState method there for adding observers for clone nodes in GUI part
+ setState(YACS::ACTIVATED); // move the calling of setState method there for adding observers for clone nodes in GUI part
//let's go
for(i=0;i<nbOfBr;i++)
if(_initNode)
- _execInitNodes[i]->exUpdateState();
+ {
+ _execInitNodes[i]->exUpdateState();
+ _initializingCounter++;
+ }
else
{
_nbOfEltConsumed++;
_execNodes[i]->exUpdateState();
}
- if (_node) {
- _node->setState(_execNodes[nbOfBr-1]->getState());
- forwardExecStateToOriginalBody(_execNodes[nbOfBr-1]);
- }
+
+ forwardExecStateToOriginalBody(_execNodes[nbOfBr-1]);
}
}
{
if(!_node)
return;
+ if(_state==YACS::TOACTIVATE) setState(YACS::ACTIVATED);
if(_state==YACS::TOACTIVATE || _state==YACS::ACTIVATED)
{
if(_nodeForSpecialCases)
_nodeForSpecialCases->getReadyTasks(tasks);
return ;
}
- for(vector<Node *>::iterator iter=_execNodes.begin();iter!=_execNodes.end();iter++)
+ vector<Node *>::iterator iter;
+ for (iter=_execNodes.begin() ; iter!=_execNodes.end() ; iter++)
+ (*iter)->getReadyTasks(tasks);
+ for (iter=_execInitNodes.begin() ; iter!=_execInitNodes.end() ; iter++)
+ (*iter)->getReadyTasks(tasks);
+ for (iter=_execFinalizeNodes.begin() ; iter!=_execFinalizeNodes.end() ; iter++)
(*iter)->getReadyTasks(tasks);
- for(vector<Node *>::iterator iter2=_execInitNodes.begin();iter2!=_execInitNodes.end();iter2++)
- (*iter2)->getReadyTasks(tasks);
}
}
return DynParaLoop::getNumberOfInputPorts()+1;
}
-void ForEachLoop::checkNoCyclePassingThrough(Node *node) throw(Exception)
+void ForEachLoop::checkNoCyclePassingThrough(Node *node) throw(YACS::Exception)
{
//TO DO
}
return ret;
}
-InputPort *ForEachLoop::getInputPort(const std::string& name) const throw(Exception)
+InputPort *ForEachLoop::getInputPort(const std::string& name) const throw(YACS::Exception)
{
if(name==SplitterNode::NAME_OF_SEQUENCE_INPUT)
return (InputPort *)&_splitterNode._dataPortToDispatch;
return DynParaLoop::getInputPort(name);
}
-OutputPort *ForEachLoop::getOutputPort(const std::string& name) const throw(Exception)
+OutputPort *ForEachLoop::getOutputPort(const std::string& name) const throw(YACS::Exception)
{
for(vector<AnySplitOutputPort *>::const_iterator iter=_outGoingPorts.begin();iter!=_outGoingPorts.end();iter++)
{
return DynParaLoop::getOutputPort(name);
}
-OutPort *ForEachLoop::getOutPort(const std::string& name) const throw(Exception)
+OutPort *ForEachLoop::getOutPort(const std::string& name) const throw(YACS::Exception)
{
for(vector<AnySplitOutputPort *>::const_iterator iter=_outGoingPorts.begin();iter!=_outGoingPorts.end();iter++)
{
return DynParaLoop::getOutPort(name);
}
-Node *ForEachLoop::getChildByShortName(const std::string& name) const throw(Exception)
+Node *ForEachLoop::getChildByShortName(const std::string& name) const throw(YACS::Exception)
{
if(name==NAME_OF_SPLITTERNODE)
return (Node *)&_splitterNode;
return DynParaLoop::getChildByShortName(name);
}
+//! Method used to notify the node that a child node has finished
+/*!
+ * Update the current state and return the change state
+ *
+ * \param node : the child node that has finished
+ * \return the state change
+ */
YACS::Event ForEachLoop::updateStateOnFinishedEventFrom(Node *node)
{
+ DEBTRACE("updateStateOnFinishedEventFrom " << node->getName() << " " << node->getState());
unsigned int id;
switch(getIdentityOfNotifyerNode(node,id))
{
case INIT_NODE:
_execNodes[id]->exUpdateState();
_nbOfEltConsumed++;
+ _initializingCounter--;
+ if (_initializingCounter == 0) _initNode->setState(DONE);
break;
case WORK_NODE:
storeOutValsInSeqForOutOfScopeUse(_execIds[id],id);
_execIds[id]=NOT_RUNNING_BRANCH_ID;
//analyzing if some samples are still on treatment on other branches.
bool isFinished=true;
- for(int i=0;i<_execIds.size() and isFinished;i++)
+ for(int i=0;i<_execIds.size() && isFinished;i++)
isFinished=(_execIds[i]==NOT_RUNNING_BRANCH_ID);
if(isFinished)
{
try
{
pushAllSequenceValues();
- setState(YACS::DONE);
-
- if (_node)
- {
- _node->setState(YACS::DONE);
-
- ComposedNode* compNode = dynamic_cast<ComposedNode*>(_node);
- if (compNode)
- {
- list<Node *> aChldn = compNode->getAllRecursiveConstituents();
- list<Node *>::iterator iter=aChldn.begin();
- for(;iter!=aChldn.end();iter++)
- (*iter)->setState(YACS::DONE);
- }
- }
-
- return YACS::FINISH;
+
+ if (_node)
+ {
+ _node->setState(YACS::DONE);
+
+ ComposedNode* compNode = dynamic_cast<ComposedNode*>(_node);
+ if (compNode)
+ {
+ std::list<Node *> aChldn = compNode->getAllRecursiveConstituents();
+ std::list<Node *>::iterator iter=aChldn.begin();
+ for(;iter!=aChldn.end();iter++)
+ (*iter)->setState(YACS::DONE);
+ }
+ }
+
+ if (_finalizeNode == NULL)
+ {
+ // No finalize node, we just finish the loop at the end of exec nodes execution
+ setState(YACS::DONE);
+ return YACS::FINISH;
+ }
+ else
+ {
+ // Run the finalize nodes, the loop will be done only when they all finish
+ _unfinishedCounter = 0; // This counter indicates how many branches are not finished
+ for (int i=0 ; i<_execIds.size() ; i++)
+ {
+ YASSERT(_execIds[i] == NOT_RUNNING_BRANCH_ID);
+ DEBTRACE("Launching finalize node for branch " << i);
+ _execFinalizeNodes[i]->exUpdateState();
+ _unfinishedCounter++;
+ }
+ return YACS::NOEVENT;
+ }
}
catch(YACS::Exception& ex)
{
}
}
}
- else
- {//more elements to do
+ else if(_state == YACS::ACTIVATED)
+ {//more elements to do and loop still activated
_execIds[id]=_execCurrentId;
node->init(false);
_splitterNode.putSplittedValueOnRankTo(_execCurrentId++,id,false);
node->exUpdateState();
- if (_node)
- {
- _node->setState(node->getState());
- forwardExecStateToOriginalBody(node);
- }
+ forwardExecStateToOriginalBody(node);
_nbOfEltConsumed++;
}
+ else
+ {//elements to process and loop no more activated
+ DEBTRACE("foreach loop state " << _state);
+ }
break;
+ case FINALIZE_NODE:
+ {
+ DEBTRACE("Finalize node finished on branch " << id);
+ _unfinishedCounter--;
+ DEBTRACE(_unfinishedCounter << " finalize nodes still running");
+ if (_unfinishedCounter == 0)
+ {
+ _finalizeNode->setState(YACS::DONE);
+ setState(YACS::DONE);
+ return YACS::FINISH;
+ }
+ else
+ return YACS::NOEVENT;
+ break;
+ }
+ default:
+ YASSERT(false);
}
return YACS::NOEVENT;
}
throw Exception("ForEachLoop::buildDelegateOf : not implemented for DS because not specified");
}
-void ForEachLoop::getDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView) throw(Exception)
+void ForEachLoop::getDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView) throw(YACS::Exception)
{
string typeOfPortInstance=(port.first)->getNameOfTypeOfCurrentInstance();
if(typeOfPortInstance==OutputPort::NAME)
throw Exception("ForEachLoop::getDelegateOf : not implemented because not specified");
}
-void ForEachLoop::releaseDelegateOf(OutPort *portDwn, OutPort *portUp, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView) throw(Exception)
+void ForEachLoop::releaseDelegateOf(OutPort *portDwn, OutPort *portUp, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView) throw(YACS::Exception)
{
string typeOfPortInstance=portDwn->getNameOfTypeOfCurrentInstance();
if(typeOfPortInstance==OutputPort::NAME)
//ASSERT(portUp==*iter.second)
if((*iter)->decrRef())
{
+ AnySplitOutputPort *p=*iter;
_outGoingPorts.erase(iter);
- delete *iter2;
+ delete p;
+ InterceptorInputPort *ip=*iter2;
_intecptrsForOutGoingPorts.erase(iter2);
- delete *iter;
+ delete ip;
}
}
}
-void ForEachLoop::forwardExecStateToOriginalBody(Node *execNode)
-{
- ComposedNode* compNode = dynamic_cast<ComposedNode*>(_node);
- ComposedNode* compNodeExe = dynamic_cast<ComposedNode*>(execNode);
- if (compNode && compNodeExe)
- {
- list<Node *> aChldn = compNodeExe->getAllRecursiveConstituents();
- list<Node *>::iterator iter=aChldn.begin();
- for(;iter!=aChldn.end();iter++)
- compNode->getChildByName(compNodeExe->getChildName(*iter))->setState((*iter)->getState());
- }
-}
-
OutPort *ForEachLoop::getDynOutPortByAbsName(int branchNb, const std::string& name)
{
string portName, nodeName;
}
void ForEachLoop::checkLinkPossibility(OutPort *start, const std::list<ComposedNode *>& pointsOfViewStart,
- InPort *end, const std::list<ComposedNode *>& pointsOfViewEnd) throw(Exception)
+ InPort *end, const std::list<ComposedNode *>& pointsOfViewEnd) throw(YACS::Exception)
{
if(isInMyDescendance(start->getNode())==_node)
throw Exception("ForEachLoop::checkLinkPossibility : A link from work node to init node not permitted");
std::list<OutputPort *> ForEachLoop::getLocalOutputPorts() const
{
list<OutputPort *> ret;
- ret.push_back(getOutputPort(NAME_OF_SPLITTED_SEQ_OUT)); // OCC : mkr : add _splittedPort to the list of output ports
- //ret.push_back(getOutputPort(SplitterNode::NAME_OF_SEQUENCE_INPUT));
+ ret.push_back(getOutputPort(NAME_OF_SPLITTED_SEQ_OUT));
return ret;
}
os << "\" label=\"" << "Loop:" ;
os << getName() <<"\"];\n";
}
+
+//! Reset the state of the node and its children depending on the parameter level
+void ForEachLoop::resetState(int level)
+{
+ if(level==0)return;
+ DynParaLoop::resetState(level);
+ _execCurrentId=0;
+ //Note: cleanDynGraph is not a virtual method (must be called from ForEachLoop object)
+ cleanDynGraph();
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __FOREACHLOOP_HXX__
#define __FOREACHLOOP_HXX__
+#include "YACSlibEngineExport.hxx"
#include "ElementaryNode.hxx"
#include "DynParaLoop.hxx"
#include "OutputPort.hxx"
OutputPort *clone(Node *newHelder) const;
};
- class SeqAnyInputPort : public AnyInputPort
+ class YACSLIBENGINE_EXPORT SeqAnyInputPort : public AnyInputPort
{
friend class ForEachLoop;
friend class SplitterNode;
static const char NAME[];
};
- class ForEachLoop : public DynParaLoop
+ class YACSLIBENGINE_EXPORT ForEachLoop : public DynParaLoop
{
friend class SplitterNode;
friend class FakeNodeForForEachLoop;
void accept(Visitor *visitor);
void writeDot(std::ostream &os) const;
virtual std::string typeName() {return "YACS__ENGINE__ForEachLoop";}
+ virtual void resetState(int level);
protected:
Node *simpleClone(ComposedNode *father, bool editionOnly=true) const;
void checkLinkPossibility(OutPort *start, const std::list<ComposedNode *>& pointsOfViewStart,
void buildDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView);
void getDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView) throw(Exception);
void releaseDelegateOf(OutPort *portDwn, OutPort *portUp, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView) throw(Exception);
- void forwardExecStateToOriginalBody(Node *execNode);
protected:
void cleanDynGraph();
void pushAllSequenceValues();
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "ForLoop.hxx"
#include "Runtime.hxx"
+#include "LinkInfo.hxx"
#include "OutputPort.hxx"
#include "Visitor.hxx"
#include <iostream>
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
using namespace YACS::ENGINE;
using namespace std;
+/*! \class YACS::ENGINE::ForLoop
+ * \brief Class for for loop node
+ *
+ * \ingroup Nodes
+ *
+ * This kind of loop makes a fixed number of steps and stops
+ *
+ */
+
const char ForLoop::NAME_OF_NSTEPS_NUMBER[]="nsteps";
+const char ForLoop::NAME_OF_INDEX[]="index";
-ForLoop::ForLoop(const std::string& name):Loop(name),_nbOfTimesPort(NAME_OF_NSTEPS_NUMBER,this,Runtime::_tc_int)
+ForLoop::ForLoop(const std::string& name):Loop(name),_nbOfTimesPort(NAME_OF_NSTEPS_NUMBER,this,Runtime::_tc_int),
+ _indexPort(NAME_OF_INDEX,this,Runtime::_tc_int)
{
}
ForLoop::ForLoop(const ForLoop& other, ComposedNode *father, bool editionOnly):Loop(other,father,editionOnly),
- _nbOfTimesPort(other._nbOfTimesPort,this)
+ _nbOfTimesPort(other._nbOfTimesPort,this),
+ _indexPort(other._indexPort,this)
{
+ //Copy Data linking
+ std::vector< std::pair<OutPort *, InPort *> > linksToReproduce=other.getSetOfInternalLinks();
+ std::vector< std::pair<OutPort *, InPort *> >::iterator iter=linksToReproduce.begin();
+ for(;iter!=linksToReproduce.end();++iter)
+ {
+ OutPort* pout = iter->first;
+ InPort* pin = iter->second;
+ edAddLink(getOutPort(other.getPortName(pout)),getInPort(other.getPortName(pin)));
+ }
}
Node *ForLoop::simpleClone(ComposedNode *father, bool editionOnly) const
return new ForLoop(*this,father,editionOnly);
}
-InputPort* ForLoop::getInputPort(const std::string& name) const throw(Exception)
+InputPort* ForLoop::getInputPort(const std::string& name) const throw(YACS::Exception)
{
if(name == NAME_OF_NSTEPS_NUMBER)return (InputPort*)&_nbOfTimesPort;
return Loop::getInputPort(name);
*/
void ForLoop::init(bool start)
{
+ DEBTRACE("ForLoop::init " << start);
Loop::init(start);
_nbOfTimesPort.exInit(start);
+ _indexPort.exInit();
+ Any* tmp=AtomAny::New(_nbOfTurns);
+ _indexPort.put(tmp);
+ tmp->decrRef();
}
//! Update the state of the for loop
/*!
- * If the inGate port is ready goes to YACS::TOACTIVATE state
+ * If the inGate port is ready goes to YACS::ACTIVATED state
* If the steps number is 0, create an special internal node
*
*/
void ForLoop::exUpdateState()
{
+ DEBTRACE("ForLoop::exUpdateState " << getName() << " " << _state);
if(_state == YACS::DISABLED)
return;
if(_inGate.exIsReady())
{
- setState(YACS::TOACTIVATE);
+ setState(YACS::ACTIVATED);
_node->exUpdateState();
if(_nbOfTimesPort.isEmpty())
{
*/
YACS::Event ForLoop::updateStateOnFinishedEventFrom(Node *node)
{
+ DEBTRACE("ForLoop::updateStateOnFinishedEventFrom " << node->getName());
if((++_nbOfTurns)>=_nbOfTimesPort.getIntValue())
{
setState(YACS::DONE);
}
else
{
- node->init(false);
- node->exUpdateState();
+ Any* tmp=AtomAny::New(_nbOfTurns);
+ _indexPort.put(tmp);
+ tmp->decrRef();
+ setState(YACS::ACTIVATED);
+ _node->init(false);
+ _node->exUpdateState();
}
return YACS::NOEVENT;
}
ret.push_back((InputPort *)&_nbOfTimesPort);
return ret;
}
+
+OutPort *ForLoop::getOutPort(const std::string& name) const throw(YACS::Exception)
+{
+ if(name==NAME_OF_INDEX)
+ return (OutPort *)&_indexPort;
+ return Loop::getOutPort(name);
+}
+
+OutputPort *ForLoop::getOutputPort(const std::string& name) const throw(YACS::Exception)
+{
+ if(name==NAME_OF_INDEX)
+ return (OutputPort *)&_indexPort;
+ return Loop::getOutputPort(name);
+}
+
+std::list<OutputPort *> ForLoop::getLocalOutputPorts() const
+{
+ list<OutputPort *> ret;
+ ret.push_back(getOutputPort(NAME_OF_INDEX));
+ return ret;
+}
+
+void ForLoop::checkControlDependancy(OutPort *start, InPort *end, bool cross,
+ std::map < ComposedNode *, std::list < OutPort * >, SortHierarc >& fw,
+ std::vector<OutPort *>& fwCross,
+ std::map< ComposedNode *, std::list < OutPort *>, SortHierarc >& bw,
+ LinkInfo& info) const
+{
+ //First testing if start==indexPort. This is the only case possible in theory.
+ if(start != &_indexPort)
+ return StaticDefinedComposedNode::checkControlDependancy(start,end,cross,fw,fwCross,bw,info);
+ if(cross)
+ throw Exception("Internal error occured - cross type link detected on decision port of a loop. Forbidden !");
+ fw[(ComposedNode *)this].push_back(start);
+}
+
+void ForLoop::checkCFLinks(const std::list<OutPort *>& starts, InputPort *end, unsigned char& alreadyFed,
+ bool direction, LinkInfo& info) const
+{
+ const char what[]="ForLoop::checkCFLinks : internal error.";
+ Node *nodeEnd=end->getNode();
+ if(nodeEnd==this)
+ {//In this case 'end' port is a special port of this (for exemple ForLoop::_nbOfTimesPort)
+ solveObviousOrDelegateCFLinks(starts,end,alreadyFed,direction,info);
+ }
+ else if(isInMyDescendance(nodeEnd)==0)
+ {
+ solveObviousOrDelegateCFLinks(starts,end,alreadyFed,direction,info);
+ }
+ else
+ {//no forwarding here.
+ if(starts.size()!=1)
+ throw Exception(what);
+
+ Node *nodeStart=(*(starts.begin()))->getNode();
+ if(nodeStart==this)
+ {
+ // Link between the loop and the internal node
+ if(*(starts.begin())!=&_indexPort)
+ throw Exception(what);
+ }
+ else
+ {
+ // Link from internal node to internal node
+ if(nodeEnd!=nodeStart)
+ throw Exception(what);
+ }
+
+ if(alreadyFed==FREE_ST)
+ alreadyFed=FED_ST;
+ else if(alreadyFed==FED_ST)
+ {
+ info.pushInfoLink(*(starts.begin()),end,I_USELESS);
+ }
+ }
+}
+
+std::list<OutputPort *> ForLoop::getSetOfOutputPort() const
+{
+ list<OutputPort *> ret=ComposedNode::getSetOfOutputPort();
+ ret.push_back((OutputPort *)&_indexPort);
+ return ret;
+}
+
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __FORLOOP_HXX__
#define __FORLOOP_HXX__
+#include "YACSlibEngineExport.hxx"
#include "AnyInputPort.hxx"
+#include "AnyOutputPort.hxx"
#include "Loop.hxx"
namespace YACS
{
namespace ENGINE
{
-/*! \brief Class for for loop node
- *
- * \ingroup Nodes
- *
- * This kind of loop makes a fixed number of steps and stops
- *
- */
- class ForLoop : public Loop
+ class YACSLIBENGINE_EXPORT ForLoop : public Loop
{
protected:
+ static const char NAME_OF_INDEX[];
static const char NAME_OF_NSTEPS_NUMBER[];
AnyInputPort _nbOfTimesPort;
+ AnyOutputPort _indexPort;
public:
ForLoop(const ForLoop& other, ComposedNode *father, bool editionOnly);
ForLoop(const std::string& name);
InputPort *edGetNbOfTimesInputPort() { return &_nbOfTimesPort; }
Node *simpleClone(ComposedNode *father, bool editionOnly=true) const;
InputPort* getInputPort(const std::string& name) const throw(Exception);
+ OutPort *getOutPort(const std::string& name) const throw(Exception);
+ OutputPort *getOutputPort(const std::string& name) const throw(Exception);
std::list<InputPort *> getLocalInputPorts() const;
+ std::list<OutputPort *> getLocalOutputPorts() const;
+ std::list<OutputPort *> getSetOfOutputPort() const;
virtual void accept(Visitor *visitor);
InputPort *getDecisionPort() const { return (InputPort *)&_nbOfTimesPort; }
+ OutputPort *edGetIndexPort() { return &_indexPort; }
virtual std::string typeName() {return "YACS__ENGINE__ForLoop";}
protected:
YACS::Event updateStateOnFinishedEventFrom(Node *node);
+ void checkCFLinks(const std::list<OutPort *>& starts, InputPort *end, unsigned char& alreadyFed,
+ bool direction, LinkInfo& info) const;
+ void checkControlDependancy(OutPort *start, InPort *end, bool cross,
+ std::map < ComposedNode *, std::list < OutPort * >, SortHierarc >& fw,
+ std::vector<OutPort *>& fwCross,
+ std::map< ComposedNode *, std::list < OutPort *>, SortHierarc >& bw,
+ LinkInfo& info) const;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "InGate.hxx"
#include "Node.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __INGATE_HXX__
#define __INGATE_HXX__
+#include "YACSlibEngineExport.hxx"
#include "Port.hxx"
#include "define.hxx"
{
class OutGate;
- class InGate : public Port
+ class YACSLIBENGINE_EXPORT InGate : public Port
{
friend class Bloc;
friend class Node;
InGate(Node *node);
virtual ~InGate();
std::string getNameOfTypeOfCurrentInstance() const;
- void exNotifyFromPrecursor(OutGate *from);
+ void exNotifyFromPrecursor(OutGate *fromgate);
std::map<OutGate *, bool>& edMapOutGate() { return _backLinks; }
- void edAppendPrecursor(OutGate *from);
- void edRemovePrecursor(OutGate *from);
+ void edAppendPrecursor(OutGate *fromgate);
+ void edRemovePrecursor(OutGate *fromgate);
int getNumberOfBackLinks() const;
void edDisconnectAllLinksToMe();
void exNotifyFailed();
void exReset();
bool exIsReady() const;
std::list<OutGate *> getBackLinks();
- void setPrecursorDone(OutGate *from);
+ void setPrecursorDone(OutGate *fromgate);
virtual std::string typeName() {return "YACS__ENGINE__InGate";}
};
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "InPort.hxx"
#include "OutPort.hxx"
#include "ComposedNode.hxx"
return _backLinks.size();
}
-void InPort::edRemoveAllLinksLinkedWithMe() throw(Exception)
+void InPort::edRemoveAllLinksLinkedWithMe() throw(YACS::Exception)
{
set<OutPort *> temp(_backLinks);//edRemoveLink called after causes invalidation of set iterator.
for(set<OutPort *>::iterator iter=temp.begin();iter!=temp.end();iter++)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __INPORT_HXX__
#define __INPORT_HXX__
+#include "YACSlibEngineExport.hxx"
#include "DataPort.hxx"
#include <set>
class OutputDataStreamPort;
class InterceptorInputPort;
- class InPort : public virtual DataPort
+ class YACSLIBENGINE_EXPORT InPort : public virtual DataPort
{
friend class Loop;
friend class OutPort;
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "InPropertyPort.hxx"
+#include "Node.hxx"
+#include "TypeCode.hxx"
+
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
+using namespace YACS::ENGINE;
+using namespace std;
+
+const char InPropertyPort::NAME[]="InPropertyPort";
+
+InPropertyPort::InPropertyPort(const InPropertyPort& other, Node *newHelder)
+ : InputPort(other, newHelder),
+ DataPort(other, newHelder),
+ Port(other, newHelder),
+ _property_data(NULL), _init_property_data(NULL)
+{}
+
+InPropertyPort::InPropertyPort(const std::string& name, Node *node, TypeCode* type, bool canBeNull)
+ : InputPort(name, node, type, canBeNull),
+ DataPort(name, node, type),
+ Port(node),
+ _property_data(NULL), _init_property_data(NULL)
+{
+}
+
+InPropertyPort::~InPropertyPort() {}
+
+string InPropertyPort::getNameOfTypeOfCurrentInstance() const
+{
+ return NAME;
+}
+
+void
+InPropertyPort::exNewPropertyValue(const std::string & name, const std::string & value)
+{
+ DEBTRACE("Adding new Property to the node " << name << " " << value);
+ _node->setProperty(name, value);
+}
+
+void
+InPropertyPort::exSaveInit()
+{
+ _init_property_data = _property_data;
+}
+
+void
+InPropertyPort::exRestoreInit()
+{
+ if(!_init_property_data)return;
+ _property_data = _init_property_data;
+}
+
+InPropertyPort *
+InPropertyPort::clone(Node *newHelder) const
+{
+ return new InPropertyPort(*this,newHelder);
+}
+
+void *
+InPropertyPort::get() const
+{
+ return (void*) _property_data;
+}
+
+void
+InPropertyPort::put(const void *data) throw(ConversionException)
+{
+ put((YACS::ENGINE::Any *)data);
+}
+
+void
+InPropertyPort::put(YACS::ENGINE::Any *data)
+{
+ // Add new properties to the node
+ YACS::ENGINE::SequenceAny * seq_data = static_cast<YACS::ENGINE::SequenceAny*>(data);
+ for (int i = 0; i < seq_data->size(); i++)
+ {
+ std::string key = ((*seq_data)[i]["name"])->getStringValue();
+ std::string value = ((*seq_data)[i]["value"])->getStringValue();
+ exNewPropertyValue(key, value);
+ }
+
+ if(_property_data)
+ _property_data->decrRef();
+ _property_data = data;
+ _property_data->incrRef();
+ DEBTRACE("value ref count: " << _property_data->getRefCnt());
+}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef __INPROPERTYPORT_HXX__
+#define __INPROPERTYPORT_HXX__
+
+#include <string>
+#include "InputPort.hxx"
+
+namespace YACS
+{
+ namespace ENGINE
+ {
+ class OutPort;
+
+ /*! \brief class for Input Property Ports
+ *
+ * \ingroup Ports
+ *
+ */
+ class YACSLIBENGINE_EXPORT InPropertyPort : public InputPort
+ {
+ friend class Runtime; // for port creation
+ friend class OutPort;
+ friend class Node;
+
+ public:
+ static const char NAME[];
+ public:
+ virtual ~InPropertyPort();
+
+ std::string getNameOfTypeOfCurrentInstance() const;
+ //! returns the final physical port behind 'this'.
+#ifdef NOCOVARIANT
+ virtual InPort *getPublicRepresentant() { return this; }
+#else
+ virtual InPropertyPort *getPublicRepresentant() { return this; }
+#endif
+ virtual std::string typeName() {return "YACS__ENGINE__InPropertyPort";}
+ virtual void exNewPropertyValue(const std::string & name, const std::string & value);
+
+ virtual void exSaveInit();
+ virtual void exRestoreInit();
+ virtual InPropertyPort *clone(Node *newHelder) const;
+ virtual void *get() const;
+ virtual void put(const void *data) throw(ConversionException);
+ virtual void put(YACS::ENGINE::Any *data);
+
+ protected:
+ InPropertyPort(const InPropertyPort& other, Node *newHelder);
+ InPropertyPort(const std::string& name, Node *node, TypeCode* type, bool canBeNull = false);
+
+ YACS::ENGINE::Any* _property_data;
+ YACS::ENGINE::Any* _init_property_data;
+ };
+
+ }
+}
+
+#endif
+
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "InlineNode.hxx"
#include "Visitor.hxx"
+#include "Container.hxx"
+#include <iostream>
+
+#define _DEVDEBUG_
+#include "YacsTrace.hxx"
using namespace YACS::ENGINE;
+using namespace std;
InlineNode::~InlineNode() { }
visitor->visitInlineNode(this);
}
+//! Set the script (as a string) to execute
+/*!
+ * \param script: script to execute
+ */
+void InlineNode::setScript(const std::string& script)
+{
+ _script=script;
+ modified();
+}
+
-InlineFuncNode::~InlineFuncNode() { }
+InlineFuncNode::~InlineFuncNode()
+{
+ if(_container)
+ _container->decrRef();
+}
void InlineFuncNode::accept(Visitor *visitor)
{
visitor->visitInlineFuncNode(this);
}
+void InlineFuncNode::setFname(const std::string& fname)
+{
+ _fname=fname;
+ modified();
+}
+
+void InlineFuncNode::checkBasicConsistency() const throw(YACS::Exception)
+{
+ InlineNode::checkBasicConsistency();
+ if(_fname.empty() )
+ {
+ string mess = "Function name is not defined";
+ throw Exception(mess);
+ }
+}
+
+void InlineNode::setExecutionMode(const std::string& mode)
+{
+ if(mode == _mode)return;
+ if(mode == "local"||mode == "remote")
+ {
+ _mode=mode;
+ modified();
+ }
+}
+
+std::string InlineNode::getExecutionMode()
+{
+ return _mode;
+}
+
+Container* InlineNode::getContainer()
+{
+ return _container;
+}
+
+void InlineNode::setContainer(Container* cont)
+{
+ if (cont == _container) return;
+ if(_container)
+ _container->decrRef();
+ _container=cont;
+ if(_container)
+ _container->incrRef();
+}
+
+void InlineNode::performDuplicationOfPlacement(const Node& other)
+{
+ const InlineNode &otherC=*(dynamic_cast<const InlineNode *>(&other));
+ //if other has no container don't clone: this will not have one
+ if(otherC._container)
+ _container=otherC._container->clone();
+}
+
+bool InlineNode::isDeployable() const
+{
+ if(_mode=="remote")
+ return true;
+ else
+ return false;
+}
+
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __INLINENODE_HXX__
#define __INLINENODE_HXX__
+#include "YACSlibEngineExport.hxx"
#include "ElementaryNode.hxx"
#include <string>
{
namespace ENGINE
{
+ class Container;
+
/*! \brief Class for calculation node (script) inlined (and executed) in the schema
*
* \ingroup Nodes
* \see ServiceNode
* \see ElementaryNode
*/
- class InlineNode : public ElementaryNode
+ class YACSLIBENGINE_EXPORT InlineNode : public ElementaryNode
{
protected:
InlineNode(const InlineNode& other, ComposedNode *father)
- :ElementaryNode(other,father),_script(other._script) { }
- InlineNode(const std::string& name):ElementaryNode(name) { }
+ :ElementaryNode(other,father),_script(other._script),_mode(other._mode),_container(0) { }
+ InlineNode(const std::string& name):ElementaryNode(name),_mode("local"),_container(0) { }
public:
-//! Set the script (as a string) to execute
-/*!
- * \param script: script to execute
- */
- virtual void setScript(const std::string& script) { _script=script; }
+ virtual void setScript(const std::string& script);
virtual std::string getScript(){return _script;}
//! Return a new InlineNode node by making a copy of this node
virtual void accept(Visitor *visitor);
virtual ~InlineNode();
virtual std::string typeName() {return "YACS__ENGINE__InlineNode";}
+ virtual void setExecutionMode(const std::string& mode);
+ virtual std::string getExecutionMode();
+ virtual void setContainer(Container* container);
+ virtual Container* getContainer();
+ void performDuplicationOfPlacement(const Node& other);
+ bool isDeployable() const;
protected:
std::string _script;
+ std::string _mode;
+ Container* _container;
};
/*! \brief Class for calculation node (function) inlined (and executed) in the schema
* \see ServiceNode
* \see ElementaryNode
*/
- class InlineFuncNode : public InlineNode
+ class YACSLIBENGINE_EXPORT InlineFuncNode : public InlineNode
{
protected:
InlineFuncNode(const InlineFuncNode& other, ComposedNode *father)
/*!
* \param fname: name of the function contained in the script to execute
*/
- virtual void setFname(const std::string& fname) { _fname=fname; }
+ virtual void setFname(const std::string& fname);
virtual std::string getFname() { return _fname; }
void accept(Visitor *visitor);
virtual ~InlineFuncNode();
virtual std::string typeName() {return "YACS__ENGINE__InlineFuncNode";}
+ virtual void checkBasicConsistency() const throw(Exception);
protected:
std::string _fname;
};
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "InputDataStreamPort.hxx"
+#include "OutputDataStreamPort.hxx"
#include <iostream>
using namespace YACS::ENGINE;
using namespace std;
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
const char InputDataStreamPort::NAME[]="InputDataStreamPort";
InputDataStreamPort::InputDataStreamPort(const InputDataStreamPort& other, Node *newHelder):
{
return new InputDataStreamPort(*this,newHelder);
}
+
+void InputDataStreamPort::edAddOutputDataStreamPort(OutputDataStreamPort *port)
+{
+ DEBTRACE("InputDataStreamPort::edAddOutputDataStreamPort");
+ if(!isAlreadyInSet(port))
+ _setOfOutputDataStreamPort.insert(port);
+}
+
+bool InputDataStreamPort::isAlreadyInSet(OutputDataStreamPort *outPort) const
+{
+ return _setOfOutputDataStreamPort.find(outPort)!=_setOfOutputDataStreamPort.end();
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __INPUTDATASTREAMPORT_HXX__
#define __INPUTDATASTREAMPORT_HXX__
+#include "YACSlibEngineExport.hxx"
#include "InPort.hxx"
#include "DataStreamPort.hxx"
* \ingroup Ports
*
*/
- class InputDataStreamPort : public DataStreamPort, public InPort
+ class OutputDataStreamPort;
+ class YACSLIBENGINE_EXPORT InputDataStreamPort : public DataStreamPort, public InPort
{
public:
static const char NAME[];
+ protected:
+ std::set<OutputDataStreamPort *> _setOfOutputDataStreamPort;
public:
InputDataStreamPort(const InputDataStreamPort& other, Node *newHelder);
InputDataStreamPort(const std::string& name, Node *node, TypeCode* type);
virtual std::string getNameOfTypeOfCurrentInstance() const;
virtual InputDataStreamPort *clone(Node *newHelder) const;
virtual std::string typeName() {return "YACS__ENGINE__InputDataStreamPort";}
+
+ virtual void edAddOutputDataStreamPort(OutputDataStreamPort *port);
+ std::set<OutputDataStreamPort *> getConnectedOutputDataStreamPort() {return _setOfOutputDataStreamPort;}
+
+ private:
+ bool isAlreadyInSet(OutputDataStreamPort *inPort) const;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "InputPort.hxx"
#include "OutPort.hxx"
#include "ComposedNode.hxx"
const char InputPort::NAME[]="InputPort";
-InputPort::InputPort(const InputPort& other, Node *newHelder):DataFlowPort(other,newHelder),InPort(other,newHelder),
- DataPort(other,newHelder),Port(other,newHelder),
- _initValue(0)
+InputPort::InputPort(const InputPort& other, Node *newHelder)
+ : DataFlowPort(other, newHelder),
+ InPort(other, newHelder),
+ DataPort(other, newHelder),
+ Port(other, newHelder),
+ _initValue(0),
+ _canBeNull(other._canBeNull)
{
if(other._initValue)
_initValue=other._initValue->clone();
}
-InputPort::InputPort(const std::string& name, Node *node, TypeCode* type)
- : DataFlowPort(name,node,type), InPort(name,node,type),DataPort(name,node,type),Port(node), _initValue(0)
+InputPort::InputPort(const std::string& name, Node *node, TypeCode* type, bool canBeNull)
+ : DataFlowPort(name, node, type),
+ InPort(name, node, type),
+ DataPort(name, node, type),
+ Port(node),
+ _initValue(0),
+ _canBeNull(canBeNull)
{
}
*/
bool InputPort::edIsInitialized() const
{
- return (edIsManuallyInitialized() or _backLinks.size()!=0 );
+ return (edIsManuallyInitialized() || _backLinks.size()!=0 );
}
InputPort::~InputPort()
}
//! Check basically that this port has one chance to be specified on time. It's a necessary condition \b not \b sufficient at all.
-void InputPort::checkBasicConsistency() const throw(Exception)
+void InputPort::checkBasicConsistency() const throw(YACS::Exception)
{
- if(!edIsManuallyInitialized() and _backLinks.size()==0 )
+ if(!_canBeNull && !edIsManuallyInitialized() && _backLinks.size()==0 )
{
ostringstream stream;
stream << "InputPort::checkBasicConsistency : Port " << _name << " of node with name " << _node->getName() << " neither initialized nor linked back";
_stringRef = strRef;
}
+bool InputPort::canBeNull() const
+{
+ return _canBeNull;
+}
+
ProxyPort::ProxyPort(InputPort* p):InputPort("Convertor", p->getNode(), p->edGetType()),DataPort("Convertor", p->getNode(), p->edGetType()),
Port( p->getNode())
{
*/
}
-void ProxyPort::edRemoveAllLinksLinkedWithMe() throw(Exception)
+void ProxyPort::edRemoveAllLinksLinkedWithMe() throw(YACS::Exception)
{
_port->edRemoveAllLinksLinkedWithMe();
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __INPUTPORT_HXX__
#define __INPUTPORT_HXX__
+#include "YACSlibEngineExport.hxx"
#include "Any.hxx"
#include "InPort.hxx"
#include "Runtime.hxx"
* \ingroup Ports
*
*/
- class InputPort : public DataFlowPort, public InPort
+ class YACSLIBENGINE_EXPORT InputPort : public DataFlowPort, public InPort
{
friend class Runtime; // for port creation
friend class OutPort;
virtual std::string dump();
virtual void setStringRef(std::string strRef);
virtual std::string typeName() {return "YACS__ENGINE__InputPort";}
+ bool canBeNull() const;
protected:
InputPort(const InputPort& other, Node *newHelder);
- InputPort(const std::string& name, Node *node, TypeCode* type);
+ InputPort(const std::string& name, Node *node, TypeCode* type, bool canBeNull = false);
protected:
Any *_initValue;
std::string _stringRef;
+ bool _canBeNull;
};
/*! \brief Base class for Proxy Input Ports
* \ingroup Ports
*
*/
- class ProxyPort : public InputPort
+ class YACSLIBENGINE_EXPORT ProxyPort : public InputPort
{
public:
ProxyPort(InputPort* p);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "InvalidExtractionException.hxx"
using namespace YACS::ENGINE;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __INVALIDEXTRACTIONEXCEPTION_HXX__
#define __INVALIDEXTRACTIONEXCEPTION_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "LinkInfo.hxx"
#include "Switch.hxx"
_level++;
}
-void LinkInfo::endCollapseTransac() throw(Exception)
+void LinkInfo::endCollapseTransac() throw(YACS::Exception)
{
if(--_level==0)
{
if(_levelOfInfo==ALL_STOP_ASAP)
if(areWarningsOrErrors())
- throw(getGlobalRepr());
+ throw Exception(getGlobalRepr());
else if(_levelOfInfo==WARN_ONLY_DONT_STOP)
if(getNumberOfWarnLinksGrp(W_ALL)!=0)
throw Exception(getErrRepr());
_collapse[reason].back().push_back(pair<OutPort *,InPort *>(semStart,end));
}
-void LinkInfo::pushErrLink(OutPort *semStart, InPort *end, ErrReason reason) throw(Exception)
+void LinkInfo::pushErrLink(OutPort *semStart, InPort *end, ErrReason reason) throw(YACS::Exception)
{
if(reason==E_NEVER_SET_INPUTPORT)
_unsetInPort.push_back(end);
else
_errors[reason].push_back(pair<OutPort *, InPort *>(semStart,end));
if(_level==0)
- if(_levelOfInfo==ALL_STOP_ASAP or _levelOfInfo==WARN_ONLY_DONT_STOP)
+ if(_levelOfInfo==ALL_STOP_ASAP || _levelOfInfo==WARN_ONLY_DONT_STOP)
throw Exception(getErrRepr());
}
-void LinkInfo::pushErrSwitch(CollectorSwOutPort *collector) throw(Exception)
+void LinkInfo::pushErrSwitch(CollectorSwOutPort *collector) throw(YACS::Exception)
{
_errorsOnSwitchCases.push_back(collector);
if(_level==0)
- if(_levelOfInfo==ALL_STOP_ASAP or _levelOfInfo==WARN_ONLY_DONT_STOP)
+ if(_levelOfInfo==ALL_STOP_ASAP || _levelOfInfo==WARN_ONLY_DONT_STOP)
throw Exception(getErrRepr());
}
_uselessLinks.insert(pair<Node *,Node *>(start,end));
}
-void LinkInfo::takeDecision() const throw(Exception)
+void LinkInfo::takeDecision() const throw(YACS::Exception)
{
if(!_errors.empty())
throw Exception(getErrRepr());
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __LINKINFO_HXX__
#define __LINKINFO_HXX__
+#include "YACSlibEngineExport.hxx"
#include "Exception.hxx"
#include <vector>
/*!
* \brief Class that deal with list of \b semantics links for high level analysis.
*/
- class LinkInfo
+ class YACSLIBENGINE_EXPORT LinkInfo
{
private:
ComposedNode *_pov;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "LogRecord.hxx"
#include <sstream>
using namespace YACS::ENGINE;
-LogRecord::LogRecord(const std::string& name,int level,const std::string& message, const char* file, int line)
- :_loggerName(name),_level(level),_message(message),_fileName((char*)file),_line(line)
+LogRecord::LogRecord(const std::string& name,int level,const std::string& message, const std::string& file, int line)
+ :_loggerName(name),_level(level),_message(message),_fileName(file),_line(line)
{
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _LOGRECORD_HXX_
#define _LOGRECORD_HXX_
static const LogLevel DEBUG = 10;
static const LogLevel NOTSET = 0;
- LogRecord(const std::string& name,int level,const std::string& message, const char* file, int line);
+ LogRecord(const std::string& name,int level,const std::string& message, const std::string& file, int line);
virtual ~LogRecord();
/** The logger name. */
const std::string _loggerName;
/** Level of logging record */
int _level;
/** filename of logging record */
- char* _fileName;
+ std::string _fileName;
/** line number of logging record */
int _line;
virtual std::string getLevelName(int level);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Logger.hxx"
#include "LogRecord.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _LOGGER_HXX_
#define _LOGGER_HXX_
+#include "YACSlibEngineExport.hxx"
+
#include <string>
#include <vector>
/*! \brief Class for logging error messages
*
*/
- class Logger
+ class YACSLIBENGINE_EXPORT Logger
{
public:
Logger(const std::string& name);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Loop.hxx"
#include "InputPort.hxx"
#include "OutputPort.hxx"
repr.insert(s.begin(),s.end());
}
-void *InputPort4DF2DS::get() const throw(Exception)
+void *InputPort4DF2DS::get() const throw(YACS::Exception)
{
if(!_data)
{
DFToDSForLoop::~DFToDSForLoop()
{
+ edDisconnectAllLinksWithMe();
}
void DFToDSForLoop::getReadyTasks(std::vector<Task *>& tasks)
{
}
-InputPort *DFToDSForLoop::getInputPort(const std::string& name) const throw(Exception)
+InputPort *DFToDSForLoop::getInputPort(const std::string& name) const throw(YACS::Exception)
{
+ try {
+ return Node::getInputPort(name);
+ }
+ catch(Exception& e) {}
+
list<InputPort *>::const_iterator it =_setOfInputPort.begin();
return (*it);
}
-OutputDataStreamPort *DFToDSForLoop::getOutputDataStreamPort(const std::string& name) const throw(Exception)
+OutputDataStreamPort *DFToDSForLoop::getOutputDataStreamPort(const std::string& name) const throw(YACS::Exception)
{
list<OutputDataStreamPort *>::const_iterator it =_setOfOutputDataStreamPort.begin();
return (*it);
DSToDFForLoop::~DSToDFForLoop()
{
+ edDisconnectAllLinksWithMe();
}
void DSToDFForLoop::getReadyTasks(std::vector<Task *>& tasks)
{
}
-OutputPort *DSToDFForLoop::getOutputPort(const std::string& name) const throw(Exception)
+OutputPort *DSToDFForLoop::getOutputPort(const std::string& name) const throw(YACS::Exception)
{
list<OutputPort *>::const_iterator it = _setOfOutputPort.begin();
return (*it);
}
-InputDataStreamPort *DSToDFForLoop::getInputDataStreamPort(const std::string& name) const throw(Exception)
+InputDataStreamPort *DSToDFForLoop::getInputDataStreamPort(const std::string& name) const throw(YACS::Exception)
{
list<InputDataStreamPort *>::const_iterator it = _setOfInputDataStreamPort.begin();
return (*it);
void FakeNodeForLoop::exForwardFailed()
{
_loop->exForwardFailed();
- FakeNodeForLoop *normallyThis=_loop->_nodeForNullTurnOfLoops;
- _loop->_nodeForNullTurnOfLoops=0;
- delete normallyThis;
}
void FakeNodeForLoop::exForwardFinished()
{
_loop->exForwardFinished();
- FakeNodeForLoop *normallyThis=_loop->_nodeForNullTurnOfLoops;
- _loop->_nodeForNullTurnOfLoops=0;
- delete normallyThis;
}
void FakeNodeForLoop::execute()
Loop::~Loop()
{
delete _node;
- delete _nodeForNullTurnOfLoops;
+ if(_nodeForNullTurnOfLoops)delete _nodeForNullTurnOfLoops;
for(set<DSToDFForLoop *>::iterator iter1=_inputsTraducer.begin();iter1!=_inputsTraducer.end();iter1++)
delete (*iter1);
for(set<DFToDSForLoop *>::iterator iter2=_outputsTraducer.begin();iter2!=_outputsTraducer.end();iter2++)
return ret;
}
-bool Loop::edAddChild(Node *node) throw(Exception)
+bool Loop::edAddChild(Node *node) throw(YACS::Exception)
{
return edSetNode(node);
}
}
}
-void Loop::edRemoveChild(Node *node) throw(Exception)
+void Loop::edRemoveChild(Node *node) throw(YACS::Exception)
{
StaticDefinedComposedNode::edRemoveChild(node);
if(_node==node)
return StaticDefinedComposedNode::getNumberOfInputPorts()+1;
}
-Node *Loop::getChildByShortName(const std::string& name) const throw(Exception)
+Node *Loop::getChildByShortName(const std::string& name) const throw(YACS::Exception)
{
if (_node)
if(name==_node->getName())
throw Exception(what);
}
-TypeCode* Loop::MappingDF2DS(TypeCode* type) throw(Exception)
+TypeCode* Loop::MappingDF2DS(TypeCode* type) throw(YACS::Exception)
{
return type;
}
-TypeCode* Loop::MappingDS2DF(TypeCode* type) throw(Exception)
+TypeCode* Loop::MappingDS2DF(TypeCode* type) throw(YACS::Exception)
{
return type;
}
void Loop::buildDelegateOf(InPort * & port, OutPort *initialStart, const std::list<ComposedNode *>& pointsOfView)
{
string typeOfPortInstance=port->getNameOfTypeOfCurrentInstance();
- if(typeOfPortInstance!=InputPort::NAME or
- (typeOfPortInstance == InputPort::NAME and
- initialStart->getNameOfTypeOfCurrentInstance()== OutputPort::NAME and
+ if(typeOfPortInstance!=InputPort::NAME ||
+ (typeOfPortInstance == InputPort::NAME &&
+ initialStart->getNameOfTypeOfCurrentInstance()== OutputPort::NAME &&
!isNecessaryToBuildSpecificDelegateDF2DS(pointsOfView)) )
return ;
InputPort *portCasted=(InputPort *)port;
void Loop::buildDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView)
{
string typeOfPortInstance=(port.first)->getNameOfTypeOfCurrentInstance();
- if(typeOfPortInstance!=OutputPort::NAME or
- ( typeOfPortInstance == OutputPort::NAME and
- finalTarget->getNameOfTypeOfCurrentInstance()== InputPort::NAME and
+ if(typeOfPortInstance!=OutputPort::NAME ||
+ ( typeOfPortInstance == OutputPort::NAME &&
+ finalTarget->getNameOfTypeOfCurrentInstance()== InputPort::NAME &&
!isNecessaryToBuildSpecificDelegateDF2DS(pointsOfView)) )
return ;
OutPort *portCasted=port.first;
port.first=(*iter)->getOutputDataStreamPort("");
}
-void Loop::getDelegateOf(InPort * & port, OutPort *initialStart, const std::list<ComposedNode *>& pointsOfView) throw(Exception)
+void Loop::getDelegateOf(InPort * & port, OutPort *initialStart, const std::list<ComposedNode *>& pointsOfView) throw(YACS::Exception)
{
string typeOfPortInstance=port->getNameOfTypeOfCurrentInstance();
- if(typeOfPortInstance!=InputPort::NAME or
- (typeOfPortInstance == InputPort::NAME and
- initialStart->getNameOfTypeOfCurrentInstance()== OutputPort::NAME and
+ if(typeOfPortInstance!=InputPort::NAME ||
+ (typeOfPortInstance == InputPort::NAME &&
+ initialStart->getNameOfTypeOfCurrentInstance()== OutputPort::NAME &&
!isNecessaryToBuildSpecificDelegateDF2DS(pointsOfView)) )
return ;
InputPort *portCasted=(InputPort *)port;
}
void Loop::getDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget,
- const std::list<ComposedNode *>& pointsOfView) throw(Exception)
+ const std::list<ComposedNode *>& pointsOfView) throw(YACS::Exception)
{
string typeOfPortInstance=(port.first)->getNameOfTypeOfCurrentInstance();
- if(typeOfPortInstance!=OutputPort::NAME or
- ( typeOfPortInstance == OutputPort::NAME and
- finalTarget->getNameOfTypeOfCurrentInstance()== InputPort::NAME and
+ if(typeOfPortInstance!=OutputPort::NAME ||
+ ( typeOfPortInstance == OutputPort::NAME &&
+ finalTarget->getNameOfTypeOfCurrentInstance()== InputPort::NAME &&
!isNecessaryToBuildSpecificDelegateDF2DS(pointsOfView)) )
return ;
OutPort *portCasted=port.first;
port.first=(*iter)->getOutputDataStreamPort("");
}
-void Loop::releaseDelegateOf(InPort * & port, OutPort *initialStart, const std::list<ComposedNode *>& pointsOfView) throw(Exception)
+void Loop::releaseDelegateOf(InPort * & port, OutPort *initialStart, const std::list<ComposedNode *>& pointsOfView) throw(YACS::Exception)
{
string typeOfPortInstance=port->getNameOfTypeOfCurrentInstance();
- if(typeOfPortInstance!=InputPort::NAME or
- ( typeOfPortInstance == InputPort::NAME and
- initialStart->getNameOfTypeOfCurrentInstance()== OutputPort::NAME and
+ if(typeOfPortInstance!=InputPort::NAME ||
+ ( typeOfPortInstance == InputPort::NAME &&
+ initialStart->getNameOfTypeOfCurrentInstance()== OutputPort::NAME &&
!isNecessaryToBuildSpecificDelegateDF2DS(pointsOfView)) )
return ;
InputPort *portCasted=(InputPort *)port;
}
}
-void Loop::releaseDelegateOf(OutPort *portDwn, OutPort *portUp, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView) throw(Exception)
+void Loop::releaseDelegateOf(OutPort *portDwn, OutPort *portUp, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView) throw(YACS::Exception)
{
if(portDwn==portUp)
return ;
}
}
-void Loop::checkNoCyclePassingThrough(Node *node) throw(Exception)
+void Loop::checkNoCyclePassingThrough(Node *node) throw(YACS::Exception)
{
//throw Exception("Loop::checkNoCyclePassingThrough : Internal error occured");
}
* \param end : the InPort to connect
* \return true if a new link has been created, false otherwise.
*/
-bool Loop::edAddDFLink(OutPort *start, InPort *end) throw(Exception)
+bool Loop::edAddDFLink(OutPort *start, InPort *end) throw(YACS::Exception)
{
return edAddLink(start,end);
}
fw[(ComposedNode *)this].push_back(start);
}
-void Loop::checkBasicConsistency() const throw(Exception)
+void Loop::checkBasicConsistency() const throw(YACS::Exception)
{
DEBTRACE("Loop::checkBasicConsistency");
ComposedNode::checkBasicConsistency();
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __LOOP_HXX__
#define __LOOP_HXX__
+#include "YACSlibEngineExport.hxx"
#include "StaticDefinedComposedNode.hxx"
#include "InputDataStreamPort.hxx"
#include "ElementaryNode.hxx"
{
namespace ENGINE
{
- void NbDoneLoader(Loop* node, int val);
+ void YACSLIBENGINE_EXPORT NbDoneLoader(Loop* node, int val);
class Loop;
class ForLoop;
class WhileLoop;
class DFToDSForLoop;
class DSToDFForLoop;
- class InputPort4DF2DS : public InputPort
+ class YACSLIBENGINE_EXPORT InputPort4DF2DS : public InputPort
{
public:
InputPort4DF2DS(DFToDSForLoop *node, TypeCode* type);
~DFToDSForLoop();
};
- class OutputPort4DS2DF : public OutputPort
+ class YACSLIBENGINE_EXPORT OutputPort4DS2DF : public OutputPort
{
public:
OutputPort4DS2DF(DSToDFForLoop *node, TypeCode *type);
Any *_data;
};
- class InputDataStreamPort4DS2DF : public InputDataStreamPort
+ class YACSLIBENGINE_EXPORT InputDataStreamPort4DS2DF : public InputDataStreamPort
{
public:
InputDataStreamPort4DS2DF(DSToDFForLoop *node, TypeCode* type);
* \see ForLoop
* \see WhileLoop
*/
- class Loop : public StaticDefinedComposedNode
+ class YACSLIBENGINE_EXPORT Loop : public StaticDefinedComposedNode
{
friend class DSToDFForLoop;
friend class FakeNodeForLoop;
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm/unix/make_begin.am
-SUBDIRS = Plugin Test
+SUBDIRS = . Plugin Test
lib_LTLIBRARIES = libYACSlibEngine.la
libYACSlibEngine_la_SOURCES = \
+ PropertyInterface.cxx \
TypeCode.cxx \
RefCounter.cxx \
LinkInfo.cxx \
InvalidExtractionException.cxx \
ConditionInputPort.cxx \
AnyInputPort.cxx \
+ AnyOutputPort.cxx \
Port.cxx InGate.cxx \
OutGate.cxx \
DataPort.cxx \
ComposedNode.cxx \
InlineNode.cxx \
ServiceNode.cxx \
+ ServerNode.cxx \
ServiceInlineNode.cxx \
StaticDefinedComposedNode.cxx \
Bloc.cxx \
Catalog.cxx \
ComponentDefinition.cxx \
DataNode.cxx \
+ Task.cxx \
+ Scheduler.cxx \
+ InPropertyPort.cxx \
$(__dummy__)
salomeinclude_HEADERS = \
+YACSlibEngineExport.hxx \
Any.hxx AnyInputPort.hxx Bloc.hxx Catalog.hxx ComponentDefinition.hxx \
ComponentInstance.hxx ComposedNode.hxx ConditionInputPort.hxx Container.hxx ConversionException.hxx \
DataFlowPort.hxx DataNode.hxx DataPort.hxx DataStreamPort.hxx DeploymentTree.hxx \
-Dispatcher.hxx DynParaLoop.hxx ElementaryNode.hxx Executor.hxx ExecutorSwig.hxx \
+Dispatcher.hxx DynParaLoop.hxx ElementaryNode.hxx Executor.hxx \
ForEachLoop.hxx ForLoop.hxx InGate.hxx InlineNode.hxx InPort.hxx \
InputDataStreamPort.hxx InputPort.hxx InvalidExtractionException.hxx LinkInfo.hxx Logger.hxx \
LogRecord.hxx Loop.hxx Node.hxx OptimizerAlg.hxx OptimizerLoop.hxx \
Port.hxx Proc.hxx RefCounter.hxx Runtime.hxx Scheduler.hxx \
ServiceInlineNode.hxx ServiceNode.hxx SharedPtr.hxx StaticDefinedComposedNode.hxx Switch.hxx \
Task.hxx TypeCode.hxx Visitor.hxx VisitorSaveSchema.hxx VisitorSaveState.hxx \
-WhileLoop.hxx \
+WhileLoop.hxx PropertyInterface.hxx AnyOutputPort.hxx ServerNode.hxx InPropertyPort.hxx \
$(__dummy__)
AM_CXXFLAGS = $(THREAD_DEF) \
-I$(srcdir)/../bases
-
-# --- build libYACSlibEngine library before swig libraries (problem with make -j)
-
-BUILT_SOURCES = pilotWRAP.cxx pypilotWRAP.cxx pypilotWRAP.h libYACSlibEngine.la
-
-MYSWIG_FLAGS = -noexcept -I$(srcdir)/../bases
-
-salomepython_PYTHON = pilot.py pypilot.py
-salomepyexec_LTLIBRARIES = _pilot.la _pypilot.la
-
-SWIGINCLUDES=Any.hxx DeploymentTree.hxx InputDataStreamPort.hxx OutPort.hxx SharedPtr.hxx \
-AnyInputPort.hxx Dispatcher.hxx InputPort.hxx OutputDataStreamPort.hxx StaticDefinedComposedNode.hxx \
-Bloc.hxx DynParaLoop.hxx InvalidExtractionException.hxx OutputPort.hxx Switch.hxx \
-ComponentInstance.hxx ElementaryNode.hxx LinkInfo.hxx Pool.hxx Task.hxx \
-ComposedNode.hxx Executor.hxx Logger.hxx Port.hxx TypeCode.hxx \
-ConditionInputPort.hxx ExecutorSwig.hxx LogRecord.hxx Proc.hxx Visitor.hxx \
-Container.hxx ForEachLoop.hxx Loop.hxx RefCounter.hxx VisitorSaveSchema.hxx \
-ConversionException.hxx ForLoop.hxx Node.hxx Runtime.hxx VisitorSaveState.hxx \
-DataFlowPort.hxx InGate.hxx OptimizerAlg.hxx Scheduler.hxx WhileLoop.hxx \
-DataPort.hxx InlineNode.hxx OptimizerLoop.hxx ServiceInlineNode.hxx ComponentDefinition.hxx \
-DataStreamPort.hxx InPort.hxx OutGate.hxx ServiceNode.hxx Catalog.hxx \
-../bases/yacsconfig.h engtypemaps.i
-
-pilotWRAP.cxx:pilot.i $(SWIGINCLUDES)
- $(SWIG) $(SWIG_PYTHON_OPT) $(SWIG_PYTHON_INCLUDES) $(MYSWIG_FLAGS) -o pilotWRAP.cxx $(srcdir)/pilot.i
-
-_pilot_la_SOURCES = \
- pilotWRAP.cxx \
- ExecutorSwig.cxx
-
-
-_pilot_la_CXXFLAGS = \
- $(THREAD_DEF) \
- $(PYTHON_CPPFLAGS) \
- $(OMNIORB_INCLUDES) \
- $(OMNIORB_CXXFLAGS) \
- -I$(srcdir)/../bases
-
-_pilot_la_LDFLAGS = -module
-
-_pilot_la_LIBADD = libYACSlibEngine.la $(OMNIORB_LIBS)
-
-pypilotWRAP.cxx pypilotWRAP.h: pypilot.i pilot.i $(SWIGINCLUDES)
- $(SWIG) $(SWIG_PYTHON_OPT) $(SWIG_PYTHON_INCLUDES) $(MYSWIG_FLAGS) -o pypilotWRAP.cxx $(srcdir)/pypilot.i
-
-_pypilot_la_SOURCES = pypilotWRAP.cxx
-_pypilot_la_CXXFLAGS = $(THREAD_DEF) $(PYTHON_CPPFLAGS) $(OMNIORB_INCLUDES) $(OMNIORB_CXXFLAGS) -I$(srcdir)/../bases
-_pypilot_la_LDFLAGS = -module
-_pypilot_la_LIBADD = libYACSlibEngine.la $(OMNIORB_LIBS)
-
-EXTRA_DIST = pilot.i pypilot.i engtypemaps.i pypilotWRAP.h
-
-clean-local:
- rm -f pypilot.py* pypilotWRAP.*
include $(top_srcdir)/adm/unix/make_end.am
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Node.hxx"
#include "InputPort.hxx"
#include "OutputPort.hxx"
+#include "InPropertyPort.hxx"
#include "ComposedNode.hxx"
#include "Dispatcher.hxx"
#include "InputDataStreamPort.hxx"
using namespace YACS::ENGINE;
using namespace std;
+/*! \class YACS::ENGINE::Node
+ * \brief Base class for all nodes
+ *
+ * \ingroup Nodes
+ */
+
const char Node::SEP_CHAR_IN_PORT[]=".";
int Node::_total = 0;
std::map<int,Node*> Node::idMap;
-std::map<int, std::string> Node::_nodeStateName;
+
+NodeStateNameMap::NodeStateNameMap()
+{
+ insert(make_pair(YACS::READY, "READY"));
+ insert(make_pair(YACS::TOLOAD, "TOLOAD"));
+ insert(make_pair(YACS::LOADED, "LOADED"));
+ insert(make_pair(YACS::TOACTIVATE, "TOACTIVATE"));
+ insert(make_pair(YACS::ACTIVATED, "ACTIVATED"));
+ insert(make_pair(YACS::DESACTIVATED, "DESACTIVATED"));
+ insert(make_pair(YACS::DONE, "DONE"));
+ insert(make_pair(YACS::SUSPENDED, "SUSPENDED"));
+ insert(make_pair(YACS::LOADFAILED, "LOADFAILED"));
+ insert(make_pair(YACS::EXECFAILED, "EXECFAILED"));
+ insert(make_pair(YACS::PAUSE, "PAUSE"));
+ insert(make_pair(YACS::INTERNALERR, "INTERNALERR"));
+ insert(make_pair(YACS::DISABLED, "DISABLED"));
+ insert(make_pair(YACS::FAILED, "FAILED"));
+ insert(make_pair(YACS::ERROR, "ERROR"));
+}
+
Node::Node(const std::string& name):_name(name),_inGate(this),_outGate(this),_father(0),_state(YACS::READY),
_implementation(Runtime::RUNTIME_ENGINE_INTERACTION_IMPL_NAME),_modified(1)
// Should be protected by lock ??
_numId = _total++;
idMap[_numId]=this;
+
+ // Every node has an InPropertyPort
+ _inPropertyPort = new InPropertyPort("__InPropertyPort__Node__YACS_", this, Runtime::_tc_propvec);
}
Node::Node(const Node& other, ComposedNode *father):_inGate(this),_outGate(this),_name(other._name),_father(father),
_state(YACS::READY),_implementation(other._implementation),
- _propertyMap(other._propertyMap),_modified(other._modified)
+ _propertyMap(other._propertyMap),_modified(1)
{
_numId = _total++;
idMap[_numId]=this;
+
+ // Every node has an InPropertyPort
+ _inPropertyPort = new InPropertyPort("__InPropertyPort__Node__YACS_", this, Runtime::_tc_propvec);
}
Node::~Node()
{
if(_father->isNameAlreadyUsed(name))
{
- if ( _father->getChildByName(name) != this )
- {
- std::string what("Name ");
- what+=name;
- what+=" already exists in the scope of "; what+=_father->getName();
- throw Exception(what);
- }
+ if ( _father->getChildByName(name) != this )
+ {
+ std::string what("Name ");
+ what+=name;
+ what+=" already exists in the scope of "; what+=_father->getName();
+ throw Exception(what);
+ }
}
}
_name=name;
_outGate.exNotifyDisabled();
}
-InPort *Node::getInPort(const std::string& name) const throw(Exception)
+InPort *Node::getInPort(const std::string& name) const throw(YACS::Exception)
{
InPort *ret;
try
return ret;
}
+InPropertyPort *
+Node::getInPropertyPort() const throw(YACS::Exception)
+{
+ return _inPropertyPort;
+}
+
+InputPort *
+Node::getInputPort(const std::string& name) const throw(YACS::Exception)
+{
+ if (name == "__InPropertyPort__Node__YACS_")
+ return _inPropertyPort;
+ else
+ {
+ std::string what("Node::getInputPort : the port with name "); what+=name; what+=" does not exist on the current level";
+ throw Exception(what);
+ }
+}
+
/*!
* \note: Contrary to getOutputPort method, this method returns the output port at highest level, possible.
* That is to say in some ComposedNode, like ForEachLoop or Switch, an outport inside 'this' is seen differently than the true outport.
*/
-OutPort *Node::getOutPort(const std::string& name) const throw(Exception)
+OutPort *Node::getOutPort(const std::string& name) const throw(YACS::Exception)
{
OutPort *ret;
try
_outGate.edDisconnectAllLinksFromMe();
}
-ComposedNode *Node::getRootNode() const throw(Exception)
+Proc *Node::getProc()
+{
+ if(!_father)
+ return 0;
+ return _father->getProc();
+}
+
+const Proc * Node::getProc() const
+{
+ if(!_father)
+ return 0;
+ return _father->getProc();
+}
+
+ComposedNode *Node::getRootNode() const throw(YACS::Exception)
{
if(!_father)
throw Exception("No root node");
* USAGE NOT CLEAR, not used so far, when are those characters set ?
*/
-void Node::checkValidityOfPortName(const std::string& name) throw(Exception)
+void Node::checkValidityOfPortName(const std::string& name) throw(YACS::Exception)
{
if(name.find(SEP_CHAR_IN_PORT, 0 )!=string::npos)
{
* @note : Check that 'node1' and 'node2' have exactly the same father
* @exception : If 'node1' and 'node2' have NOT exactly the same father
*/
-ComposedNode *Node::checkHavingCommonFather(Node *node1, Node *node2) throw(Exception)
+ComposedNode *Node::checkHavingCommonFather(Node *node1, Node *node2) throw(YACS::Exception)
{
if(node1!=0 && node2!=0)
{
void Node::setProperty(const std::string& name, const std::string& value)
{
+ DEBTRACE("Node::setProperty " << name << " " << value);
_propertyMap[name]=value;
}
+std::string Node::getProperty(const std::string& name)
+{
+ std::map<std::string,std::string>::iterator it=_propertyMap.find(name);
+
+ if(it != _propertyMap.end())
+ return it->second;
+ else if(_father)
+ return _father->getProperty(name);
+ else
+ return "";
+}
+
+std::map<std::string,std::string> Node::getProperties()
+{
+ std::map<std::string,std::string> amap=_propertyMap;
+ if(_father)
+ {
+ std::map<std::string,std::string> fatherMap=_father->getProperties();
+ amap.insert(fatherMap.begin(),fatherMap.end());
+ }
+
+ return amap;
+}
+
+void Node::setProperties(std::map<std::string,std::string> properties)
+{
+ _propertyMap.clear();
+ _propertyMap=properties;
+}
+
//! Return the node state in the context of its father
/*!
* \return the effective node state
YACS::StatesForNode effectiveState=getEffectiveState();
DEBTRACE("Node::getErrorReport: " << getName() << " " << effectiveState << " " << _errorDetails);
- if(effectiveState != YACS::INVALID && effectiveState != YACS::ERROR && effectiveState != YACS::FAILED)
+ if(effectiveState != YACS::INVALID && effectiveState != YACS::ERROR &&
+ effectiveState != YACS::FAILED && effectiveState != YACS::INTERNALERR)
return "";
std::string report="<error node= " ;
case YACS::FAILED:
report=report+" state= FAILED";
break;
+ case YACS::INTERNALERR:
+ report=report+" state= INTERNALERR";
+ break;
default:
break;
}
*/
std::string Node::getStateName(YACS::StatesForNode state)
{
- static bool map_init=false;
- if(!map_init)
+ static NodeStateNameMap nodeStateNameMap;
+ return nodeStateNameMap[state];
+}
+
+//! Stop all pending activities of the node
+/*!
+ * This method should be called when a Proc is finished and must be deleted from the YACS server
+ */
+void Node::shutdown(int level)
+{
+ if(level==0)return;
+}
+
+//! Clean the node in case of not clean exit
+/*!
+ * This method should be called on a control-C or sigterm
+ */
+void Node::cleanNodes()
+{
+}
+
+//! Reset the node state depending on the parameter level
+void Node::resetState(int level)
+{
+ DEBTRACE("Node::resetState " << getName() << "," << level << "," << _state);
+ if(_state==YACS::ERROR || _state==YACS::FAILED)
{
- _nodeStateName[YACS::READY] ="READY";
- _nodeStateName[YACS::TOLOAD] ="TOLOAD";
- _nodeStateName[YACS::LOADED] ="LOADED";
- _nodeStateName[YACS::TOACTIVATE] ="TOACTIVATE";
- _nodeStateName[YACS::ACTIVATED] ="ACTIVATED";
- _nodeStateName[YACS::DESACTIVATED] ="DESACTIVATED";
- _nodeStateName[YACS::DONE] ="DONE";
- _nodeStateName[YACS::SUSPENDED] ="SUSPENDED";
- _nodeStateName[YACS::LOADFAILED] ="LOADFAILED";
- _nodeStateName[YACS::EXECFAILED] ="EXECFAILED";
- _nodeStateName[YACS::PAUSE] ="PAUSE";
- _nodeStateName[YACS::INTERNALERR] ="INTERNALERR";
- _nodeStateName[YACS::DISABLED] ="DISABLED";
- _nodeStateName[YACS::FAILED] ="FAILED";
- _nodeStateName[YACS::ERROR] ="ERROR";
+ setState(YACS::READY);
+ InGate* inGate = getInGate();
+ std::list<OutGate*> backlinks = inGate->getBackLinks();
+ for (std::list<OutGate*>::iterator io = backlinks.begin(); io != backlinks.end(); io++)
+ {
+ Node* fromNode = (*io)->getNode();
+ if(fromNode->getState() == YACS::DONE)
+ {
+ inGate->setPrecursorDone(*io);
+ }
+ }
}
- return _nodeStateName[state];
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __NODE_HXX__
#define __NODE_HXX__
+#include "YACSlibEngineExport.hxx"
#include "InGate.hxx"
#include "OutGate.hxx"
#include "Exception.hxx"
{
namespace ENGINE
{
- void StateLoader(Node* node, YACS::StatesForNode state);
+ void YACSLIBENGINE_EXPORT StateLoader(Node* node, YACS::StatesForNode state);
class Task;
class InPort;
class OutPort;
class InputPort;
class OutputPort;
+ class InPropertyPort;
class DynParaLoop;
class ForEachLoop;
class ComposedNode;
+ class Proc;
class ElementaryNode;
class Switch;
class InputDataStreamPort;
class OutputDataStreamPort;
class Visitor;
-
-/*! \brief Base class for all nodes
- *
- * \ingroup Nodes
- *
- *
- */
- class Node
+
+ class YACSLIBENGINE_EXPORT NodeStateNameMap : public std::map<YACS::StatesForNode, std::string>
+ {
+ public:
+ NodeStateNameMap();
+ };
+
+ class YACSLIBENGINE_EXPORT Node
{
friend class Bloc;
friend class Loop;
friend class Switch;
friend class InputPort;
friend class OutputPort;
+ friend class InPropertyPort;
friend class DynParaLoop;
friend class ForEachLoop;
friend class ComposedNode;
protected:
InGate _inGate;
OutGate _outGate;
+ InPropertyPort * _inPropertyPort;
std::string _name;
ComposedNode *_father;
YACS::StatesForNode _state;
public:
virtual ~Node();
virtual void init(bool start=true);
+ virtual void shutdown(int level);
+ virtual void resetState(int level);
//! \b This method \b MUST \b NEVER \b BE \b VIRTUAL
Node *clone(ComposedNode *father, bool editionOnly=true) const;
void setState(YACS::StatesForNode theState); // To centralize state changes
virtual std::list<InputDataStreamPort *> getSetOfInputDataStreamPort() const = 0;
virtual std::list<OutputDataStreamPort *> getSetOfOutputDataStreamPort() const = 0;
InPort *getInPort(const std::string& name) const throw(Exception);
+ InPropertyPort *getInPropertyPort() const throw(Exception);
virtual OutPort *getOutPort(const std::string& name) const throw(Exception);
virtual std::set<OutPort *> getAllOutPortsLeavingCurrentScope() const = 0;
virtual std::set<InPort *> getAllInPortsComingFromOutsideOfCurrentScope() const = 0;
virtual std::vector< std::pair<OutPort *, InPort *> > getSetOfLinksLeavingCurrentScope() const = 0;
virtual std::vector< std::pair<InPort *, OutPort *> > getSetOfLinksComingInCurrentScope() const =0;
- virtual InputPort *getInputPort(const std::string& name) const throw(Exception) = 0;
+ virtual InputPort *getInputPort(const std::string& name) const throw(Exception);
virtual OutputPort *getOutputPort(const std::string& name) const throw(Exception) = 0;
virtual InputDataStreamPort *getInputDataStreamPort(const std::string& name) const throw(Exception) = 0;
virtual OutputDataStreamPort *getOutputDataStreamPort(const std::string& name) const throw(Exception) = 0;
std::string getImplementation() const;
virtual ComposedNode *getRootNode() const throw(Exception);
virtual void setProperty(const std::string& name,const std::string& value);
+ virtual std::string getProperty(const std::string& name);
+ std::map<std::string,std::string> getProperties() ;
+ std::map<std::string,std::string> getPropertyMap(){return _propertyMap;} ;
+ virtual void setProperties(std::map<std::string,std::string> properties);
virtual Node *getChildByName(const std::string& name) const throw(Exception) = 0;
+ virtual Proc *getProc();
+ virtual const Proc *getProc() const;
virtual void accept(Visitor *visitor) = 0;
std::string getQualifiedName() const;
int getNumId();
virtual std::string getErrorReport();
virtual std::string getContainerLog();
virtual void ensureLoading();
+ virtual void getCoupledNodes(std::set<Task*>& coupledNodes){};
+ virtual void cleanNodes();
protected:
virtual void exForwardFailed();
virtual void exForwardFinished();
virtual void edDisconnectAllLinksWithMe();
static void checkValidityOfPortName(const std::string& name) throw(Exception);
static ComposedNode *checkHavingCommonFather(Node *node1, Node *node2) throw(Exception);
- static std::map<int, std::string> _nodeStateName;
};
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "OptimizerAlg.hxx"
+#include "Runtime.hxx"
+using namespace YACS::BASES;
using namespace YACS::ENGINE;
-OptimizerAlgBase::OptimizerAlgBase(Pool *pool):_pool(pool)
+OptimizerAlgBase::OptimizerAlgBase(Pool *pool):_pool(pool), _proc(NULL)
{
}
{
}
-OptimizerAlgSync::OptimizerAlgSync(Pool *pool):OptimizerAlgBase(pool)
+void OptimizerAlgBase::initialize(const Any *input) throw (YACS::Exception)
+{
+}
+
+void OptimizerAlgBase::finish()
+{
+}
+
+TypeCode * OptimizerAlgBase::getTCForAlgoInit() const
+{
+ return Runtime::_tc_string;
+}
+
+TypeCode * OptimizerAlgBase::getTCForAlgoResult() const
+{
+ return Runtime::_tc_string;
+}
+
+Any * OptimizerAlgBase::getAlgoResult()
+{
+ return NULL;
+}
+
+TypeCode * OptimizerAlgBase::getTCForInProxy() const
+{
+ return getTCForIn();
+}
+
+TypeCode * OptimizerAlgBase::getTCForOutProxy() const
+{
+ return getTCForOut();
+}
+
+TypeCode * OptimizerAlgBase::getTCForAlgoInitProxy() const
+{
+ return getTCForAlgoInit();
+}
+
+TypeCode * OptimizerAlgBase::getTCForAlgoResultProxy() const
+{
+ return getTCForAlgoResult();
+}
+
+void OptimizerAlgBase::initializeProxy(const Any *input) throw (YACS::Exception)
+{
+ initialize(input);
+}
+
+void OptimizerAlgBase::startProxy()
+{
+ start();
+}
+
+void OptimizerAlgBase::takeDecisionProxy()
+{
+ takeDecision();
+}
+
+void OptimizerAlgBase::finishProxy()
+{
+ finish();
+ _errorMessage = "";
+}
+
+Any * OptimizerAlgBase::getAlgoResultProxy()
+{
+ return getAlgoResult();
+}
+
+void OptimizerAlgBase::setPool(Pool* pool)
+{
+ _pool=pool;
+}
+
+void OptimizerAlgBase::setProc(Proc * proc)
+{
+ _proc = proc;
+}
+
+Proc * OptimizerAlgBase::getProc()
+{
+ return _proc;
+}
+
+bool OptimizerAlgBase::hasError() const
{
+ return (_errorMessage.length() > 0);
}
-OptimizerAlgSync::~OptimizerAlgSync()
+const std::string & OptimizerAlgBase::getError() const
{
+ return _errorMessage;
}
-TypeOfAlgInterface OptimizerAlgSync::getType() const
-{
- return EVENT_ORIENTED;
+void OptimizerAlgBase::setError(const std::string & message)
+{
+ _errorMessage = (message.length() > 0) ? message : "Unknown error";
}
+
OptimizerAlgASync::OptimizerAlgASync(Pool *pool):OptimizerAlgBase(pool)
{
}
{
}
-TypeOfAlgInterface OptimizerAlgASync::getType() const
-{
- return NOT_EVENT_ORIENTED;
+void OptimizerAlgASync::finishProxy()
+{
+ terminateSlaveThread();
+ OptimizerAlgBase::finishProxy();
+}
+
+void OptimizerAlgASync::takeDecision()
+{
+ signalSlaveAndWait();
+}
+
+void OptimizerAlgASync::start()
+{
+ AlternateThread::start();
+}
+
+void OptimizerAlgASync::run()
+{
+ startToTakeDecision();
+ _pool->destroyAll();
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __OPTIMIZERALG_HXX__
#define __OPTIMIZERALG_HXX__
+#include <string>
+
+#include "YACSlibEngineExport.hxx"
#include "RefCounter.hxx"
#include "Exception.hxx"
-#include "DrivenCondition.hxx"
-
-#include <string>
+#include "AlternateThread.hxx"
+#include "Pool.hxx"
+#include "TypeCode.hxx"
namespace YACS
{
namespace ENGINE
{
- class Any;
- class Pool;
- class TypeCode;
-
- typedef enum
- {
- EVENT_ORIENTED = 26,
- NOT_EVENT_ORIENTED = 28
- } TypeOfAlgInterface;
+ class Proc;
/*!
* \brief Base class factorizing common methods for all algorithms interfaces.
*/
- class OptimizerAlgBase : public RefCounter
+ class YACSLIBENGINE_EXPORT OptimizerAlgBase : public RefCounter
{
protected:
Pool *_pool;
+ Proc * _proc;
+ std::string _errorMessage;
+
protected:
OptimizerAlgBase(Pool *pool);
virtual ~OptimizerAlgBase();
- public:
+
+ // Methods to implement in real algorithm classes. These methods shall be called
+ // only through proxy methods.
//! returns typecode of type expected as Input. OwnerShip of returned pointer is held by this.
virtual TypeCode *getTCForIn() const = 0;
//! returns typecode of type expected as Output. OwnerShip of returned pointer is held by this.
virtual TypeCode *getTCForOut() const = 0;
- virtual void parseFileToInit(const std::string& fileName) = 0;
- virtual TypeOfAlgInterface getType() const = 0;
- virtual void initialize(const Any *input) throw (Exception) = 0;
- virtual void finish() = 0;//! Called when optimization has succeed.
- };
-
- /*!
- * \brief Base class to implement in external dynamic lib in case of optimizer event oriented.
- */
- class OptimizerAlgSync : public OptimizerAlgBase
- {
- protected:
- OptimizerAlgSync(Pool *pool);
- public:
- TypeOfAlgInterface getType() const;
- virtual ~OptimizerAlgSync();
+ //! returns typecode of type expected for algo initialization. OwnerShip of returned pointer is held by this.
+ virtual TypeCode *getTCForAlgoInit() const;
+ //! returns typecode of type expected as algo result. OwnerShip of returned pointer is held by this.
+ virtual TypeCode *getTCForAlgoResult() const;
+ virtual void initialize(const Any *input) throw (Exception);
virtual void start() = 0;//! Update _pool attribute before performing anything.
virtual void takeDecision() = 0;//! _pool->getCurrentId gives the \b id at the origin of this call.
//! Perform the job of analysing to know what new jobs to do (_pool->pushInSample)
//! or in case of convergence _pool->destroyAll
+ virtual void finish();//! Called when optimization has succeed.
+ virtual Any * getAlgoResult();
+
+ public:
+ // Proxy methods to encapsulate the call to real methods
+ virtual TypeCode *getTCForInProxy() const;
+ virtual TypeCode *getTCForOutProxy() const;
+ virtual TypeCode *getTCForAlgoInitProxy() const;
+ virtual TypeCode *getTCForAlgoResultProxy() const;
+ virtual void initializeProxy(const Any *input) throw (Exception);
+ virtual void startProxy();
+ virtual void takeDecisionProxy();
+ virtual void finishProxy();
+ virtual Any * getAlgoResultProxy();
+
+ // Utility methods
+ virtual void setPool(Pool *pool);
+ virtual void setProc(Proc * proc);
+ virtual Proc * getProc();
+ virtual bool hasError() const;
+ virtual const std::string & getError() const;
+ virtual void setError(const std::string & message);
+
};
+ typedef OptimizerAlgBase OptimizerAlgSync;
+
/*!
* \brief Base class to implement in external dynamic lib in case of optimizer non event oriented.
*/
- class OptimizerAlgASync : public OptimizerAlgBase
+ class YACSLIBENGINE_EXPORT OptimizerAlgASync : public OptimizerAlgBase,
+ public YACS::BASES::AlternateThread
{
protected:
OptimizerAlgASync(Pool *pool);
public:
- TypeOfAlgInterface getType() const;
virtual ~OptimizerAlgASync();
- virtual void startToTakeDecision(::YACS::BASES::DrivenCondition *condition) = 0;//! _pool->getCurrentId gives the \b id at the origin of this call.
+ virtual void finishProxy();//! Called when optimization has succeed.
+
+ protected:
+ virtual void start();//! Update _pool attribute before performing anything.
+ virtual void takeDecision();//! _pool->getCurrentId gives the \b id at the origin of this call.
+ //! Perform the job of analysing to know what new jobs to do (_pool->pushInSample)
+ //! or in case of convergence _pool->destroyAll
+ virtual void run();
+
+ //! _pool->getCurrentId gives the \b id at the origin of this call.
//! Perform the job between 2 'condition->wait()' of analysing to know what new jobs to do
//! (_pool->pushInSample) or in case of convergence _pool->destroyAll
//! WARNING ! 'condition->wait()' must be called before any analyse of Pool.
+ virtual void startToTakeDecision()=0;
};
typedef OptimizerAlgBase *(*OptimizerAlgBaseFactory)(Pool *pool);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "OptimizerLoop.hxx"
#include "OutputPort.hxx"
+#include "Visitor.hxx"
#include <iostream>
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
using namespace YACS::ENGINE;
using namespace std;
const char FakeNodeForOptimizerLoop::NAME[]="thisIsAFakeNode";
const int OptimizerLoop::NOT_RUNNING_BRANCH_ID=-1973012217;
+const int OptimizerLoop::NOT_INITIALIZED_BRANCH_ID=-1973;
-const char OptimizerLoop::NAME_OF_FILENAME_INPUT[]="FileNameInitAlg";
-
-const char OptimizerLoop::NAME_OF_OUT_POOL_INPUT[]="retPortForOutPool";
-
-OptimizerAlgStandardized::OptimizerAlgStandardized(Pool *pool, OptimizerAlgBase *alg)
- : OptimizerAlgSync(pool),_algBehind(alg),_threadInCaseOfNotEvent(0)
-{
- if(_algBehind)
- _algBehind->incrRef();
-}
-
-OptimizerAlgStandardized::~OptimizerAlgStandardized()
-{
- if(_algBehind)
- _algBehind->decrRef();
-}
-
-TypeCode *OptimizerAlgStandardized::getTCForIn() const
-{
- return _algBehind->getTCForIn();
-}
-
-TypeCode *OptimizerAlgStandardized::getTCForOut() const
-{
- return _algBehind->getTCForOut();
-}
+const char OptimizerLoop::NAME_OF_ALGO_INIT_PORT[] = "algoInit";
+const char OptimizerLoop::NAME_OF_OUT_POOL_INPUT[] = "evalResults";
+const char OptimizerLoop::NAME_OF_ALGO_RESULT_PORT[] = "algoResults";
-void OptimizerAlgStandardized::setAlgPointer(OptimizerAlgBaseFactory algFactory)
-{
- if(_algBehind)
- _algBehind->decrRef();
- _algBehind=algFactory(_pool);
-}
-
-void OptimizerAlgStandardized::parseFileToInit(const std::string& fileName)
-{
- _algBehind->parseFileToInit(fileName);
-}
-void OptimizerAlgStandardized::initialize(const Any *input) throw (Exception)
-{
- _algBehind->initialize(input);
-}
-
-void OptimizerAlgStandardized::takeDecision()
-{
- switch(_algBehind->getType())
- {
- case EVENT_ORIENTED:
- {
- ((OptimizerAlgSync *) _algBehind)->takeDecision();
- break;
- }
- case NOT_EVENT_ORIENTED:
- {
- _condition.notifyOneSync();
- break;
- }
- default:
- throw Exception("Unrecognized type of algorithm. Only 2 types are available : EVENT_ORIENTED or NOT_EVENT_ORIENTED.");
- }
-}
-
-void OptimizerAlgStandardized::finish()
-{
- _algBehind->finish();
-}
-
-void OptimizerAlgStandardized::start()
-{
- switch(_algBehind->getType())
- {
- case EVENT_ORIENTED:
- {
- ((OptimizerAlgSync *) _algBehind)->start();
- break;
- }
- case NOT_EVENT_ORIENTED:
- {
- void **stackForNewTh= new void* [2];
- stackForNewTh[0]=(void *) ((OptimizerAlgASync *)(_algBehind));//In case of virtual inheritance
- stackForNewTh[1]=(void *) &_condition;
- _threadInCaseOfNotEvent=new ::YACS::BASES::Thread(threadFctForAsync,stackForNewTh);
- _condition.waitForAWait();
- break;
- }
- default:
- throw Exception("Unrecognized type of algorithm. Only 2 types are available : EVENT_ORIENTED or NOT_EVENT_ORIENTED.");
- }
-}
-
-void *OptimizerAlgStandardized::threadFctForAsync(void* ownStack)
-{
- void **ownStackCst=(void **)ownStack;
- OptimizerAlgASync *alg=(OptimizerAlgASync *)ownStackCst[0];
- ::YACS::BASES::DrivenCondition *cond=(::YACS::BASES::DrivenCondition *)ownStackCst[1];
- delete [] ownStackCst;
- alg->startToTakeDecision(cond);
-}
-
-FakeNodeForOptimizerLoop::FakeNodeForOptimizerLoop(OptimizerLoop *loop, bool normal, unsigned reason):ElementaryNode(NAME),_loop(loop),
- _normal(normal),
- _reason(reason)
+FakeNodeForOptimizerLoop::FakeNodeForOptimizerLoop(OptimizerLoop *loop, bool normal, std::string message)
+ : ElementaryNode(NAME), _loop(loop), _normal(normal), _message(message)
{
_state=YACS::TOACTIVATE;
_father=_loop->getFather();
}
-FakeNodeForOptimizerLoop::FakeNodeForOptimizerLoop(const FakeNodeForOptimizerLoop& other):ElementaryNode(other),_loop(0),
- _normal(false)
+FakeNodeForOptimizerLoop::FakeNodeForOptimizerLoop(const FakeNodeForOptimizerLoop& other)
+ : ElementaryNode(other), _loop(0), _normal(other._normal), _message(other._message)
{
}
void FakeNodeForOptimizerLoop::exForwardFailed()
{
_loop->exForwardFailed();
- FakeNodeForOptimizerLoop *normallyThis=_loop->_nodeForSpecialCases;
- _loop->_nodeForSpecialCases=0;
- delete normallyThis;
}
void FakeNodeForOptimizerLoop::exForwardFinished()
{
_loop->exForwardFinished();
- FakeNodeForOptimizerLoop *normallyThis=_loop->_nodeForSpecialCases;
- _loop->_nodeForSpecialCases=0;
- delete normallyThis;
}
void FakeNodeForOptimizerLoop::execute()
{
- if(!_normal)
- {
- string what;
- if(_reason==ALG_WITHOUT_START_CASES)
- what="Alg initialization of optimizerNode with name "; what+=_loop->getName(); what+=" returns no new case(s) to launch";
- throw Exception(what);
- }
+ DEBTRACE("FakeNodeForOptimizerLoop::execute: " << _message)
+ if (!_normal) {
+ _loop->_errorDetails = _message;
+ throw Exception(_message);
+ }
+ else
+ {
+ _loop->_algoResultPort.put(_loop->_alg->getAlgoResultProxy());
+ }
}
void FakeNodeForOptimizerLoop::aborted()
{
- _loop->_state=YACS::ERROR;
+ _loop->setState(YACS::ERROR);
}
void FakeNodeForOptimizerLoop::finished()
{
-
+ _loop->setState(YACS::DONE);
}
+/*! \class YACS::ENGINE::OptimizerLoop
+ * \brief class to build optimization loops
+ *
+ * \ingroup ComposedNodes
+ */
+
OptimizerLoop::OptimizerLoop(const std::string& name, const std::string& algLibWthOutExt,
const std::string& symbolNameToOptimizerAlgBaseInstanceFactory,
- bool algInitOnFile) throw(Exception)
- try : DynParaLoop(name,Runtime::_tc_string),_loader(algLibWthOutExt),_algInitOnFile(algInitOnFile),
- _portForInitFile(NAME_OF_FILENAME_INPUT,this,Runtime::_tc_string),
- _alg(new OptimizerAlgStandardized(&_myPool,0)),_convergenceReachedWithOtherCalc(false),
+ bool algInitOnFile,bool initAlgo, Proc * procForTypes):
+ DynParaLoop(name,Runtime::_tc_string),_algInitOnFile(algInitOnFile),_alglib(algLibWthOutExt),
+ _algoInitPort(NAME_OF_ALGO_INIT_PORT, this, Runtime::_tc_string, true),
+ _loader(NULL),_alg(0),_convergenceReachedWithOtherCalc(false),
_retPortForOutPool(NAME_OF_OUT_POOL_INPUT,this,Runtime::_tc_string),
- _nodeForSpecialCases(0),_symbol(symbolNameToOptimizerAlgBaseInstanceFactory)
-{
- OptimizerAlgBaseFactory algFactory=(OptimizerAlgBaseFactory)_loader.getHandleOnSymbolWithName(_symbol);
- if(!algFactory)
- throw Exception("Problem during library loading.");
- _alg->setAlgPointer(algFactory);
- _splittedPort.edSetType(_alg->getTCForIn());
- _retPortForOutPool.edSetType(_alg->getTCForOut());
-}
-catch(Exception& e)
+ _nodeForSpecialCases(0), _algoResultPort(NAME_OF_ALGO_RESULT_PORT, this, Runtime::_tc_string)
{
+ //We need this because calling a virtual method in a constructor does not call the most derived method but the method of the class
+ //A derived class must take care to manage that
+ if(initAlgo)
+ setAlgorithm(algLibWthOutExt,symbolNameToOptimizerAlgBaseInstanceFactory, procForTypes);
}
OptimizerLoop::OptimizerLoop(const OptimizerLoop& other, ComposedNode *father, bool editionOnly):
- DynParaLoop(other,father,editionOnly),_algInitOnFile(other._algInitOnFile),_loader(other._loader.getLibNameWithoutExt()),_convergenceReachedWithOtherCalc(false),
- _alg(new OptimizerAlgStandardized(&_myPool,0)),_portForInitFile(other._portForInitFile,this),_retPortForOutPool(other._retPortForOutPool,this),_nodeForSpecialCases(0),_symbol(other._symbol)
+ DynParaLoop(other,father,editionOnly),_algInitOnFile(other._algInitOnFile),_alglib(other._alglib),
+ _convergenceReachedWithOtherCalc(false),_loader(NULL),_alg(0),_algoInitPort(other._algoInitPort,this),
+ _retPortForOutPool(other._retPortForOutPool,this),_nodeForSpecialCases(0),
+ _algoResultPort(other._algoResultPort, this)
{
- OptimizerAlgBaseFactory algFactory=(OptimizerAlgBaseFactory)_loader.getHandleOnSymbolWithName(_symbol);
- _alg->setAlgPointer(algFactory);
- _splittedPort.edSetType(_alg->getTCForIn());
- _retPortForOutPool.edSetType(_alg->getTCForOut());
+ //Don't call setAlgorithm here because it will be called several times if the class is derived. Call it in simpleClone for cloning
}
OptimizerLoop::~OptimizerLoop()
{
- _alg->decrRef();
+ if(_alg)
+ _alg->decrRef();
cleanDynGraph();
cleanInterceptors();
+ delete _loader;
+ delete _nodeForSpecialCases;
}
Node *OptimizerLoop::simpleClone(ComposedNode *father, bool editionOnly) const
{
- return new OptimizerLoop(*this,father,editionOnly);
+ OptimizerLoop* ol=new OptimizerLoop(*this,father,editionOnly);
+ // TODO: Remove this const_cast (find a better design to get the type codes from the original node)
+ Proc * procForTypes = ol->getProc();
+ if (procForTypes == NULL) {
+ const Proc * origProc = getProc();
+ procForTypes = const_cast<Proc *>(origProc);
+ }
+ ol->setAlgorithm(_alglib, _symbol, false, procForTypes);
+ return ol;
}
void OptimizerLoop::init(bool start)
{
DynParaLoop::init(start);
- _portForInitFile.exInit(start);
+ _algoInitPort.exInit(start);
+ _retPortForOutPool.exInit(start);
+ _algoResultPort.exInit();
_convergenceReachedWithOtherCalc=false;
cleanDynGraph();
cleanInterceptors();
{
if(_state == YACS::DISABLED)
return;
- if(_inGate.exIsReady())
+ delete _nodeForSpecialCases;
+ _nodeForSpecialCases = NULL;
+ try
{
- _state=YACS::TOACTIVATE;
- //internal graph update
- int i;
- int nbOfBr=_nbOfBranches.getIntValue();
- if(nbOfBr==0)
+ if(_inGate.exIsReady())
{
- delete _nodeForSpecialCases;
- _nodeForSpecialCases=new FakeNodeForOptimizerLoop(this,getAllOutPortsLeavingCurrentScope().empty(),FakeNodeForOptimizerLoop::NO_BRANCHES);
- return;
- }
-
- if(_portForInitFile.isEmpty())
- {
- delete _nodeForSpecialCases;
- _nodeForSpecialCases=new FakeNodeForOptimizerLoop(this,getAllOutPortsLeavingCurrentScope().empty(),FakeNodeForOptimizerLoop::NO_ALG_INITIALIZATION);
- return;
- }
- _execNodes.resize(nbOfBr);
- _execIds.resize(nbOfBr);
- if(_initNode)
- {
- _execInitNodes.resize(nbOfBr);
- _initNodeUpdated.resize(nbOfBr);
- for(i=0;i<nbOfBr;i++)
- _initNodeUpdated[i]=false;
- }
- for(i=0;i<nbOfBr;i++)
- {
- _execIds[i]=NOT_RUNNING_BRANCH_ID;
- _execNodes[i]=_node->clone(this,false);
+ setState(YACS::TOACTIVATE);
+ // Force termination in case the previous algorithm did not finish properly (manual stop)
+ _alg->finishProxy();
+ _myPool.destroyAll();
+
+ // Initialize and launch the algorithm
+ _alg->initializeProxy(_algoInitPort.getValue());
+ _alg->startProxy();
+ if (_alg->hasError()) {
+ string error = _alg->getError();
+ _alg->finishProxy();
+ throw Exception(error);
+ }
+
+ //internal graph update
+ int i;
+ int nbOfBr=_nbOfBranches.getIntValue();
+ if(nbOfBr==0)
+ {
+ // A number of branches of 0 is acceptable if there are no output ports
+ // leaving OptimizerLoop
+ bool normal = getAllOutPortsLeavingCurrentScope().empty();
+ _nodeForSpecialCases = new FakeNodeForOptimizerLoop(this, normal,
+ "OptimizerLoop has no branch to run the internal node(s)");
+ return;
+ }
+ _execNodes.resize(nbOfBr);
+ _execIds.resize(nbOfBr);
if(_initNode)
- _execInitNodes[i]=_initNode->clone(this,false);
- prepareInputsFromOutOfScope(i);
- }
- initInterceptors(nbOfBr);
- _alg->parseFileToInit(_portForInitFile.getValue()->getStringValue());
- _alg->start();
- int id;
- unsigned char priority;
- Any *val=_myPool.getNextSampleWithHighestPriority(id,priority);
- if(!val)
- {
- delete _nodeForSpecialCases;
- _nodeForSpecialCases=new FakeNodeForOptimizerLoop(this,getAllOutPortsLeavingCurrentScope().empty(),FakeNodeForOptimizerLoop::ALG_WITHOUT_START_CASES);
- return;
+ {
+ _execInitNodes.resize(nbOfBr);
+ _initNodeUpdated.resize(nbOfBr);
+ for(i=0;i<nbOfBr;i++)
+ _initNodeUpdated[i]=false;
+ }
+ _initializingCounter = 0;
+ if (_finalizeNode)
+ _execFinalizeNodes.resize(nbOfBr);
+ vector<Node *> origNodes;
+ origNodes.push_back(_initNode);
+ origNodes.push_back(_node);
+ origNodes.push_back(_finalizeNode);
+ for(i=0;i<nbOfBr;i++)
+ {
+ _execIds[i]=NOT_INITIALIZED_BRANCH_ID;
+ vector<Node *> clonedNodes = cloneAndPlaceNodesCoherently(origNodes);
+ if(_initNode)
+ _execInitNodes[i] = clonedNodes[0];
+ _execNodes[i] = clonedNodes[1];
+ if(_finalizeNode)
+ _execFinalizeNodes[i] = clonedNodes[2];
+ prepareInputsFromOutOfScope(i);
+ }
+ initInterceptors(nbOfBr);
+ int id;
+ unsigned char priority;
+ Any *val=_myPool.getNextSampleWithHighestPriority(id,priority);
+ if(!val)
+ {
+ // It is acceptable to have no sample to launch if there are no output ports
+ // leaving OptimizerLoop
+ std::set<OutPort *> setOutPort = getAllOutPortsLeavingCurrentScope();
+ // Special in the special
+ // We do not check algoResult
+ setOutPort.erase(&_algoResultPort);
+ bool normal = setOutPort.empty();
+ _nodeForSpecialCases = new FakeNodeForOptimizerLoop(this, normal,
+ string("The algorithm of OptimizerLoop with name ") + _name +
+ " returns no sample to launch");
+ return;
+ }
+ launchMaxOfSamples(true);
}
- launchMaxOfSamples(true);
+ }
+ catch (const exception & e)
+ {
+ _nodeForSpecialCases = new FakeNodeForOptimizerLoop(this, false,
+ string("An error happened in the control algorithm of OptimizerLoop \"") + _name +
+ "\": " + e.what());
}
}
return DynParaLoop::getNumberOfInputPorts()+2;
}
-InputPort *OptimizerLoop::getInputPort(const std::string& name) const throw(Exception)
+InputPort *OptimizerLoop::getInputPort(const std::string& name) const throw(YACS::Exception)
{
- if(name==NAME_OF_FILENAME_INPUT)
- return (InputPort *)&_portForInitFile;
- else if(name==NAME_OF_OUT_POOL_INPUT)
+ if (name == NAME_OF_ALGO_INIT_PORT)
+ return (InputPort *)&_algoInitPort;
+ else if (name == NAME_OF_OUT_POOL_INPUT)
return (InputPort *)&_retPortForOutPool;
else
return DynParaLoop::getInputPort(name);
std::list<InputPort *> OptimizerLoop::getSetOfInputPort() const
{
list<InputPort *> ret=DynParaLoop::getSetOfInputPort();
- ret.push_back((InputPort *)&_portForInitFile);
+ ret.push_back((InputPort *)&_algoInitPort);
ret.push_back((InputPort *)&_retPortForOutPool);
return ret;
}
std::list<InputPort *> OptimizerLoop::getLocalInputPorts() const
{
list<InputPort *> ret=DynParaLoop::getLocalInputPorts();
- ret.push_back((InputPort *)&_portForInitFile);
+ ret.push_back((InputPort *)&_algoInitPort);
ret.push_back((InputPort *)&_retPortForOutPool);
return ret;
}
_nodeForSpecialCases->getReadyTasks(tasks);
return ;
}
- for(vector<Node *>::iterator iter=_execNodes.begin();iter!=_execNodes.end();iter++)
+ vector<Node *>::iterator iter;
+ for (iter=_execNodes.begin() ; iter!=_execNodes.end() ; iter++)
+ (*iter)->getReadyTasks(tasks);
+ for (iter=_execInitNodes.begin() ; iter!=_execInitNodes.end() ; iter++)
+ (*iter)->getReadyTasks(tasks);
+ for (iter=_execFinalizeNodes.begin() ; iter!=_execFinalizeNodes.end() ; iter++)
(*iter)->getReadyTasks(tasks);
- for(vector<Node *>::iterator iter2=_execInitNodes.begin();iter2!=_execInitNodes.end();iter2++)
- (*iter2)->getReadyTasks(tasks);
}
- return;
-
}
YACS::Event OptimizerLoop::updateStateOnFinishedEventFrom(Node *node)
{
+ if (getState() == YACS::FAILED)
+ {
+ // This happens when a valid computation on a branch finishes after an error on another branch.
+ // In this case we just ignore the new result because the algorithm has already been terminated.
+ return YACS::NOEVENT;
+ }
unsigned int id;
switch(getIdentityOfNotifyerNode(node,id))
{
case INIT_NODE:
+ {
_execNodes[id]->exUpdateState();
_nbOfEltConsumed++;
+ _initializingCounter--;
+ if (_initializingCounter == 0) _initNode->setState(DONE);
break;
+ }
case WORK_NODE:
- if(_state==YACS::DONE)//This case happend when alg has reached its convergence whereas other calculations still compute.
- {
- if(isFullyLazy())
- _condForCompletenessB4Relaunch.wait();
- return YACS::NOEVENT;
+ {
+ if(_convergenceReachedWithOtherCalc)
+ { //This case happens when alg has reached its convergence whereas other calculations still compute
+ _execIds[id]=NOT_RUNNING_BRANCH_ID;
+ if(!isFullyLazy())
+ return YACS::NOEVENT;
+ else
+ return finalize();
}
_myPool.putOutSampleAt(_execIds[id],_interceptorsForOutPool[id]->getValue());
_myPool.setCurrentId(_execIds[id]);
- _alg->takeDecision();
+ _alg->takeDecisionProxy();
+ if (_alg->hasError()) {
+ _errorDetails = string("An error happened in the control algorithm of optimizer loop: ") +
+ _alg->getError();
+ _alg->finishProxy();
+ setState(YACS::FAILED);
+ return YACS::ABORT;
+ }
+
_myPool.destroyCurrentCase();
if(_myPool.empty())
{
pushValueOutOfScopeForCase(id);
_execIds[id]=NOT_RUNNING_BRANCH_ID;
- if(!isFullyLazy())// This case happens when the hand is returned to continue, whereas some other are working in parallel for nothing.
- _convergenceReachedWithOtherCalc=true;
- _state=YACS::DONE;
- return YACS::FINISH;
+ if(!isFullyLazy())
+ {// This case happens when the hand is returned to continue, whereas some other are working in parallel for nothing.
+ _convergenceReachedWithOtherCalc=true;
+ return YACS::NOEVENT;
+ }
+ return finalize();
}
_execIds[id]=NOT_RUNNING_BRANCH_ID;
int newId;
if(!val)
{
bool isFinished=true;
- for(int i=0;i<_execIds.size() and isFinished;i++)
- isFinished=(_execIds[i]==NOT_RUNNING_BRANCH_ID);
+ for(int i=0;i<_execIds.size() && isFinished;i++)
+ isFinished=(_execIds[i]==NOT_RUNNING_BRANCH_ID || _execIds[i]==NOT_INITIALIZED_BRANCH_ID);
if(isFinished)
{
std::cerr <<"OptimizerLoop::updateStateOnFinishedEventFrom: Alg has not inserted more cases whereas last element has been calculated !" << std::endl;
+ setState(YACS::ERROR);
exForwardFailed();
- _state=YACS::INTERNALERR;
+ _alg->finishProxy();
return YACS::FINISH;
}
return YACS::NOEVENT;
}
launchMaxOfSamples(false);
+ break;
+ }
+ case FINALIZE_NODE:
+ {
+ _unfinishedCounter--;
+ if (_unfinishedCounter == 0)
+ {
+ _finalizeNode->setState(YACS::DONE);
+ setState(YACS::DONE);
+ return YACS::FINISH;
+ }
+ else
+ return YACS::NOEVENT;
+ break;
+ }
+ default:
+ YASSERT(false);
}
return YACS::NOEVENT;
}
-void OptimizerLoop::checkNoCyclePassingThrough(Node *node) throw(Exception)
+YACS::Event OptimizerLoop::finalize()
+{
+ //update internal node (definition node) state
+ if (_node)
+ {
+ _node->setState(YACS::DONE);
+ ComposedNode* compNode = dynamic_cast<ComposedNode*>(_node);
+ if (compNode)
+ {
+ std::list<Node *> aChldn = compNode->getAllRecursiveConstituents();
+ std::list<Node *>::iterator iter=aChldn.begin();
+ for(;iter!=aChldn.end();iter++)
+ (*iter)->setState(YACS::DONE);
+ }
+ }
+ _alg->finishProxy();
+ _algoResultPort.put(_alg->getAlgoResultProxy());
+ if (_finalizeNode == NULL)
+ {
+ // No finalize node, we just finish OptimizerLoop at the end of exec nodes execution
+ setState(YACS::DONE);
+ return YACS::FINISH;
+ }
+ else
+ {
+ // Run the finalize nodes, the OptimizerLoop will be done only when they all finish
+ _unfinishedCounter = 0; // This counter indicates how many branches are not finished
+ for (int i=0 ; i<_nbOfBranches.getIntValue() ; i++)
+ if (_execIds[i] == NOT_RUNNING_BRANCH_ID)
+ {
+ DEBTRACE("Launching finalize node for branch " << i)
+ _execFinalizeNodes[i]->exUpdateState();
+ _unfinishedCounter++;
+ }
+ else
+ // There should not be any running branch at this point
+ YASSERT(_execIds[i] == NOT_INITIALIZED_BRANCH_ID)
+ return YACS::NOEVENT;
+ }
+}
+
+//! Method used to notify the node that a child node has failed
+/*!
+ * Notify the slave thread of the error, update the current state and
+ * return the change state
+ *
+ * \param node : the child node that has failed
+ * \return the state change
+ */
+YACS::Event OptimizerLoop::updateStateOnFailedEventFrom(Node *node)
+{
+ DEBTRACE("OptimizerLoop::updateStateOnFailedEventFrom " << node->getName());
+ _alg->setError(string("Error during the execution of YACS node ") + node->getName() +
+ ": " + node->getErrorReport());
+ _alg->finishProxy();
+ _myPool.destroyAll();
+ DEBTRACE("OptimizerLoop::updateStateOnFailedEventFrom: returned from error notification.");
+ return DynParaLoop::updateStateOnFailedEventFrom(node);
+}
+
+void OptimizerLoop::checkNoCyclePassingThrough(Node *node) throw(YACS::Exception)
{
}
void OptimizerLoop::cleanInterceptors()
{
- //the destruction of interceptors whereas some running nodes can push value on them can lead to SIG SEGV.
- if(!_execNodes.empty())
- {
- if(_convergenceReachedWithOtherCalc)
- {
- cout << "Waiting completion of last other useless cases." << endl;
- _condForCompletenessB4Relaunch.waitForAWait();
- }
- }
// At this point all garanties taken let's clean all.
map<InputPort *,vector<InputPort *> >::iterator iter=_interceptors.begin();
for(;iter!=_interceptors.end();iter++)
unsigned char priority;
Any *val;
unsigned i;
- for(val=_myPool.getNextSampleWithHighestPriority(id,priority);!isFullyBusy(i) && val;val=_myPool.getNextSampleWithHighestPriority(id,priority))
+ for (val = _myPool.getNextSampleWithHighestPriority(id, priority);
+ !isFullyBusy(i) && val;
+ val = _myPool.getNextSampleWithHighestPriority(id, priority))
{
+ if(_execIds[i] == NOT_INITIALIZED_BRANCH_ID)
+ first=true; // node is not initialized (first pass)
+ else
+ first=false; // node is initialized (second pass)
_execIds[i]=id;
_myPool.markIdAsInUse(id);
- if(_initNode)
+ if(_initNode && !_initNodeUpdated[i])
{
- if(!_initNodeUpdated[i])
- {
- putValueOnBranch(val,i,first);
- _execInitNodes[i]->exUpdateState();
- _initNodeUpdated[i]=true;
- }
- else
- {
- putValueOnBranch(val,i,first);
- _execNodes[i]->exUpdateState();
- _nbOfEltConsumed++;
- }
+ putValueOnBranch(val,i,first);
+ _execInitNodes[i]->exUpdateState();
+ _initNodeUpdated[i]=true;
+ _initializingCounter++;
}
else
{
bool OptimizerLoop::isFullyLazy() const
{
bool isLazy=true;
- for(unsigned i=0;i<_execIds.size() and isLazy;i++)
- isLazy=(_execIds[i]==NOT_RUNNING_BRANCH_ID);
+ for(unsigned i=0;i<_execIds.size() && isLazy;i++)
+ isLazy=(_execIds[i]==NOT_RUNNING_BRANCH_ID || _execIds[i]==NOT_INITIALIZED_BRANCH_ID);
return isLazy;
}
{
bool isFinished=true;
unsigned i;
- for(i=0;i<_execIds.size() and isFinished;i++)
- isFinished=(_execIds[i]!=NOT_RUNNING_BRANCH_ID);
+ for(i=0;i<_execIds.size() && isFinished;i++)
+ isFinished=(_execIds[i]!=NOT_RUNNING_BRANCH_ID && _execIds[i]!=NOT_INITIALIZED_BRANCH_ID);
if(!isFinished)
branchId=i-1;
return isFinished;
{
//For all classical outputports leaving 'this'
set<OutPort *> portsToIntercept=getAllOutPortsLeavingCurrentScope();
+ portsToIntercept.erase(&_algoResultPort);
for(set<OutPort *>::iterator iter=portsToIntercept.begin();iter!=portsToIntercept.end();iter++)
{
OutputPort *portC=(OutputPort *)(*iter);//Warrantied by OptimizerLoop::buildDelegateOf
(*iter).first->put((*iter).second[branchId]->get());
}
+void OptimizerLoop::accept(Visitor *visitor)
+{
+ visitor->visitOptimizerLoop(this);
+}
+
+//! Set the algorithm library name and factory name (symbol in library) to create the algorithm and change it if the node is not connected
+/*!
+ * throw an exception if the node is connected
+ */
+void OptimizerLoop::setAlgorithm(const std::string& alglib, const std::string& symbol,
+ bool checkLinks, Proc * procForTypes)
+{
+ if(checkLinks)
+ {
+ if (_splittedPort.edGetNumberOfOutLinks() != 0 ||
+ _retPortForOutPool.edGetNumberOfLinks() != 0 ||
+ _algoInitPort.edGetNumberOfLinks() != 0 ||
+ _algoResultPort.edGetNumberOfOutLinks() != 0)
+ throw Exception("The OptimizerLoop node must be disconnected before setting the algorithm");
+ }
+
+ _symbol = symbol;
+ _alglib = alglib;
+
+ if (_alg) {
+ _alg->decrRef();
+ _alg = NULL;
+ }
+
+ loadAlgorithm();
+
+ if(_alg)
+ {
+ _alg->setProc((procForTypes == NULL) ? getProc() : procForTypes);
+
+ // Delete the values in the input ports if they were initialized
+ _retPortForOutPool.put((Any *)NULL);
+ _algoInitPort.put((Any *)NULL);
+
+ // Change the type of the ports
+ _splittedPort.edSetType(checkTypeCode(_alg->getTCForInProxy(), NAME_OF_SPLITTED_SEQ_OUT));
+ _retPortForOutPool.edSetType(checkTypeCode(_alg->getTCForOutProxy(), NAME_OF_OUT_POOL_INPUT));
+ _algoInitPort.edSetType(checkTypeCode(_alg->getTCForAlgoInitProxy(), NAME_OF_ALGO_INIT_PORT));
+ _algoResultPort.edSetType(checkTypeCode(_alg->getTCForAlgoResultProxy(), NAME_OF_ALGO_RESULT_PORT));
+ }
+
+ modified();
+}
+
+TypeCode * OptimizerLoop::checkTypeCode(TypeCode * tc, const char * portName)
+{
+ if (tc == NULL) {
+ ostringstream errorMsg;
+ errorMsg << "The algorithm specified for OptimizerLoop node \"" << getName() <<
+ "\" provided an invalid type for port \"" << portName << "\"";
+ throw Exception(errorMsg.str());
+ }
+ return tc;
+}
+
+//! Load the algorithm from the dynamic library
+/*!
+ *
+ */
+void OptimizerLoop::loadAlgorithm()
+{
+ YASSERT(_alg == NULL)
+
+ if (_loader != NULL) {
+ delete _loader;
+ _loader = NULL;
+ }
+ _loader = new YACS::BASES::DynLibLoader(_alglib);
+ OptimizerAlgBaseFactory algFactory = NULL;
+
+ if (_alglib != "" && _symbol != "")
+ {
+ try
+ {
+ _errorDetails = "";
+ algFactory = (OptimizerAlgBaseFactory)_loader->getHandleOnSymbolWithName(_symbol);
+ }
+ catch (YACS::Exception& e)
+ {
+ _errorDetails = e.what();
+ modified();
+ throw;
+ }
+ }
+
+ if (algFactory != NULL)
+ _alg = algFactory(&_myPool);
+}
+
+//! Return the name of the algorithm library
+/*!
+ *
+ */
+std::string OptimizerLoop::getAlgLib() const
+{
+ return _alglib;
+}
+
+//! Check validity for the node.
+/*!
+ * Throw an exception if the node is not valid
+ */
+void OptimizerLoop::checkBasicConsistency() const throw(YACS::Exception)
+{
+ DEBTRACE("OptimizerLoop::checkBasicConsistency");
+ if (_alglib == "")
+ throw Exception("No library specified for the OptimizerLoop control algorithm");
+ if (_symbol == "")
+ throw Exception("No symbol specified for the OptimizerLoop control algorithm");
+ if(_alg == NULL)
+ throw YACS::Exception("Problem during library loading: "+_errorDetails);
+
+ DynParaLoop::checkBasicConsistency();
+}
+
+int OptimizerLoop::getNumberOfOutputPorts() const
+{
+ return DynParaLoop::getNumberOfOutputPorts() + 1;
+}
+
+std::list<OutputPort *> OptimizerLoop::getSetOfOutputPort() const
+{
+ list<OutputPort *> ret = DynParaLoop::getSetOfOutputPort();
+ ret.push_back((OutputPort *)&_algoResultPort);
+ return ret;
+}
+
+std::list<OutputPort *> OptimizerLoop::getLocalOutputPorts() const
+{
+ list<OutputPort *> ret = DynParaLoop::getLocalOutputPorts();
+ ret.push_front((OutputPort *)&_algoResultPort);
+ return ret;
+}
+
+OutPort * OptimizerLoop::getOutPort(const std::string& name) const throw(YACS::Exception)
+{
+ return (name == NAME_OF_ALGO_RESULT_PORT) ? (OutPort *)&_algoResultPort :
+ DynParaLoop::getOutPort(name);
+}
+
+
+OutputPort * OptimizerLoop::getOutputPort(const std::string& name) const throw(YACS::Exception)
+{
+ return (name == NAME_OF_ALGO_RESULT_PORT) ? (OutputPort *)&_algoResultPort :
+ DynParaLoop::getOutputPort(name);
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __OPTIMIZERLOOP_HXX__
#define __OPTIMIZERLOOP_HXX__
+#include "YACSlibEngineExport.hxx"
#include "Pool.hxx"
-#include "Thread.hxx"
#include "DynParaLoop.hxx"
#include "DynLibLoader.hxx"
#include "OptimizerAlg.hxx"
#include "ElementaryNode.hxx"
-#include "DrivenCondition.hxx"
namespace YACS
{
namespace ENGINE
{
- class OptimizerAlgStandardized : public OptimizerAlgSync
- {
- private:
- ::YACS::BASES::Thread *_threadInCaseOfNotEvent;
- ::YACS::BASES::DrivenCondition _condition;
- OptimizerAlgBase *_algBehind;
- public:
- OptimizerAlgStandardized(Pool *pool, OptimizerAlgBase *alg);
- ~OptimizerAlgStandardized();
- TypeCode *getTCForIn() const;
- TypeCode *getTCForOut() const;
- void setAlgPointer(OptimizerAlgBaseFactory algFactory);
- void parseFileToInit(const std::string& fileName);
- void initialize(const Any *input) throw (Exception);
- void takeDecision();
- void finish();
- void start();
- private:
- static void *threadFctForAsync(void* ownStack);
- };
-
class OptimizerLoop;
class FakeNodeForOptimizerLoop : public ElementaryNode
friend class OptimizerLoop;
private:
OptimizerLoop *_loop;
- unsigned _reason;
+ std::string _message;
bool _normal;
private:
- FakeNodeForOptimizerLoop(OptimizerLoop *loop, bool normal, unsigned reason);
+ FakeNodeForOptimizerLoop(OptimizerLoop *loop, bool normal, std::string message);
FakeNodeForOptimizerLoop(const FakeNodeForOptimizerLoop& other);
Node *simpleClone(ComposedNode *father, bool editionOnly) const;
void exForwardFailed();
void finished();
private:
static const char NAME[];
- static const unsigned char ALG_WITHOUT_START_CASES = 52;
- static const unsigned char NO_BRANCHES = 53;
- static const unsigned char NO_ALG_INITIALIZATION = 54;
};
- class OptimizerLoop : public DynParaLoop
+ class YACSLIBENGINE_EXPORT OptimizerLoop : public DynParaLoop
{
friend class FakeNodeForOptimizerLoop;
Pool _myPool;
bool _algInitOnFile;
std::string _symbol;
- AnyInputPort _portForInitFile;
- ::YACS::BASES::DynLibLoader _loader;
- OptimizerAlgStandardized *_alg;
+ std::string _alglib;
+ AnyInputPort _algoInitPort;
+ ::YACS::BASES::DynLibLoader * _loader;
+ OptimizerAlgBase *_alg;
AnyInputPort _retPortForOutPool;
std::vector<bool> _initNodeUpdated;
bool _convergenceReachedWithOtherCalc;
FakeNodeForOptimizerLoop *_nodeForSpecialCases;
std::vector<AnyInputPort *> _interceptorsForOutPool;
- ::YACS::BASES::DrivenCondition _condForCompletenessB4Relaunch;
//! outputports interceptors leaving current scope.
std::map<InputPort *, std::vector<InputPort *> > _interceptors;
+ AnyOutputPort _algoResultPort;
public:
OptimizerLoop(const std::string& name, const std::string& algLibWthOutExt,
const std::string& symbolNameToOptimizerAlgBaseInstanceFactory,
- bool algInitOnFile) throw(Exception);
+ bool algInitOnFile,bool initAlgo=true, Proc * procForTypes = NULL);
OptimizerLoop(const OptimizerLoop& other, ComposedNode *father, bool editionOnly);
~OptimizerLoop();
void init(bool start=true);
void exUpdateState();
int getNumberOfInputPorts() const;
InputPort *edGetPortForOutPool() { return &_retPortForOutPool; }
- InputPort *edGetPortForInitFile() { return &_portForInitFile; }
+ InputPort *edGetAlgoInitPort() { return &_algoInitPort; }
+ OutputPort *edGetAlgoResultPort() { return &_algoResultPort; }
InputPort *getInputPort(const std::string& name) const throw(Exception);
std::list<InputPort *> getSetOfInputPort() const;
std::list<InputPort *> getLocalInputPorts() const;
void getReadyTasks(std::vector<Task *>& tasks);
YACS::Event updateStateOnFinishedEventFrom(Node *node);
void checkNoCyclePassingThrough(Node *node) throw(Exception);
+ virtual void accept(Visitor *visitor);
+ virtual std::string getSymbol() const { return _symbol; }
+ virtual std::string getAlgLib() const ;
+ virtual void setAlgorithm(const std::string& alglib,const std::string& symbol,
+ bool checkLinks=true, Proc * procForTypes = NULL);
+ virtual void checkBasicConsistency() const throw(Exception);
+ virtual std::string typeName() {return "YACS__ENGINE__OptimizerLoop";}
+ int getNumberOfOutputPorts() const;
+ std::list<OutputPort *> getSetOfOutputPort() const;
+ std::list<OutputPort *> getLocalOutputPorts() const;
+ OutPort *getOutPort(const std::string& name) const throw(Exception);
+ OutputPort *getOutputPort(const std::string& name) const throw(Exception);
+ YACS::Event finalize();
+
protected:
+ virtual YACS::Event updateStateOnFailedEventFrom(Node *node);
void buildDelegateOf(InPort * & port, OutPort *initialStart, const std::list<ComposedNode *>& pointsOfView);
void buildDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView);
void checkControlDependancy(OutPort *start, InPort *end, bool cross,
void initInterceptors(unsigned nbOfBr);
void pushValueOutOfScopeForCase(unsigned branchId);
Node *simpleClone(ComposedNode *father, bool editionOnly=true) const;
+ virtual void loadAlgorithm();
+
+ private:
+ TypeCode * checkTypeCode(TypeCode * tc, const char * portName);
+
protected:
static const int NOT_RUNNING_BRANCH_ID;
- static const char NAME_OF_FILENAME_INPUT[];
+ static const int NOT_INITIALIZED_BRANCH_ID;
+ static const char NAME_OF_ALGO_INIT_PORT[];
static const char NAME_OF_OUT_POOL_INPUT[];
+ static const char NAME_OF_ALGO_RESULT_PORT[];
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "OutGate.hxx"
#include "InGate.hxx"
return ret;
}
-void OutGate::edRemoveInGate(InGate *inGate, bool coherenceWithInGate) throw(Exception)
+void OutGate::edRemoveInGate(InGate *inGate, bool coherenceWithInGate) throw(YACS::Exception)
{
- map<InGate *, bool>::iterator iter;
- for(iter=_setOfInGate.begin();iter!=_setOfInGate.end();iter++)
- if((*iter).first==inGate)
- {
- _setOfInGate.erase(iter);
- if(coherenceWithInGate)
- inGate->edRemovePrecursor(this);
- modified();
- inGate->modified();
- break;
- }
+ std::map< InGate* , bool >::iterator iter=_setOfInGate.find(inGate);
if(iter==_setOfInGate.end())
throw Exception("InGate not already connected to OutGate");
+ else
+ {
+ if(coherenceWithInGate)
+ inGate->edRemovePrecursor(this);
+ _setOfInGate.erase(iter);
+ inGate->modified();
+ modified();
+ }
}
-//Idem OutGate::edRemoveInGateOneWay except that no exception thrown if CF not exists
+//Idem OutGate::edRemoveInGate except that no exception thrown if CF not exists
void OutGate::edRemoveInGateOneWay(InGate *inGate)
{
bool found=false;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __OUTGATE_HXX__
#define __OUTGATE_HXX__
+#include "YACSlibEngineExport.hxx"
#include "Port.hxx"
#include "Exception.hxx"
class InGate;
class ElementaryNode;
- class OutGate : public Port
+ class YACSLIBENGINE_EXPORT OutGate : public Port
{
friend class ElementaryNode;
protected:
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "OutPort.hxx"
#include "InPort.hxx"
#include "ComposedNode.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __OUTPORT_HXX__
#define __OUTPORT_HXX__
+#include "YACSlibEngineExport.hxx"
#include "DataPort.hxx"
#include "Exception.hxx"
{
class InPort;
class LinkInfo;
- class OutPort : public virtual DataPort
+ class YACSLIBENGINE_EXPORT OutPort : public virtual DataPort
{
protected:
OutPort(const OutPort& other, Node *newHelder);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "OutputDataStreamPort.hxx"
#include "InputDataStreamPort.hxx"
#include "ComposedNode.hxx"
std::set<InPort *> OutputDataStreamPort::edSetInPort() const
{
set<InPort *> s;
- for(set<InputDataStreamPort *>::iterator iter=_setOfInputDataStreamPort.begin();iter!=_setOfInputDataStreamPort.end();iter++)
+ for(set<InputDataStreamPort *>::const_iterator iter=_setOfInputDataStreamPort.begin();iter!=_setOfInputDataStreamPort.end();iter++)
(*iter)->getAllRepresentants(s);
return s;
}
bool OutputDataStreamPort::isAlreadyLinkedWith(InPort *with) const
{
set<InPort *> s;
- set<InputDataStreamPort *>::iterator iter;
+ set<InputDataStreamPort *>::const_iterator iter;
for(iter=_setOfInputDataStreamPort.begin();iter!=_setOfInputDataStreamPort.end();iter++)
if(*iter==with)
return true;
throw ConversionException(what);
}
_setOfInputDataStreamPort.insert(port);
+ port->edAddOutputDataStreamPort(this);
return true;
}
else
return false;
}
-int OutputDataStreamPort::edRemoveInputDataStreamPort(InputDataStreamPort *inPort, bool forward) throw(Exception)
+int OutputDataStreamPort::edRemoveInputDataStreamPort(InputDataStreamPort *inPort, bool forward) throw(YACS::Exception)
{
if(forward)
{
}
}
-bool OutputDataStreamPort::addInPort(InPort *inPort) throw(Exception)
+bool OutputDataStreamPort::addInPort(InPort *inPort) throw(YACS::Exception)
{
DEBTRACE("OutputDataStreamPort::addInPort");
if(inPort->getNameOfTypeOfCurrentInstance()!=InputDataStreamPort::NAME)
return edAddInputDataStreamPort(static_cast<InputDataStreamPort*>(inPort));
}
-void OutputDataStreamPort::edRemoveAllLinksLinkedWithMe() throw(Exception)
+void OutputDataStreamPort::edRemoveAllLinksLinkedWithMe() throw(YACS::Exception)
{
set<InputDataStreamPort *>::iterator iter;
set<InputDataStreamPort *> vec(_setOfInputDataStreamPort);
_setOfInputDataStreamPort.clear();
}
-int OutputDataStreamPort::removeInPort(InPort *inPort, bool forward) throw(Exception)
+int OutputDataStreamPort::removeInPort(InPort *inPort, bool forward) throw(YACS::Exception)
{
DEBTRACE("OutputDataStreamPort::removeInPort");
if(inPort->getNameOfTypeOfCurrentInstance()!=InputDataStreamPort::NAME && !forward)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __OUTPUTDATASTREAMPORT_HXX__
#define __OUTPUTDATASTREAMPORT_HXX__
+#include "YACSlibEngineExport.hxx"
#include "OutPort.hxx"
#include "DataStreamPort.hxx"
#include "ConversionException.hxx"
class ElementaryNode;
class InputDataStreamPort;
- class OutputDataStreamPort : public DataStreamPort, public OutPort
+ class YACSLIBENGINE_EXPORT OutputDataStreamPort : public DataStreamPort, public OutPort
{
friend class ElementaryNode;
protected:
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "OutputPort.hxx"
#include "ComposedNode.hxx"
#include "InputPort.hxx"
+#include "InPropertyPort.hxx"
#include "Runtime.hxx"
#include "Node.hxx"
return NAME;
}
-void OutputPort::edRemoveAllLinksLinkedWithMe() throw(Exception)
+void OutputPort::edRemoveAllLinksLinkedWithMe() throw(YACS::Exception)
{
set<InputPort *>::iterator iter;
set<InputPort *> vec(_setOfInputPort);
/**
* check if output type is an input type and if a data converter exists before link
*/
-bool OutputPort::edAddInputPort(InputPort *phyPort) throw(Exception)
+bool OutputPort::edAddInputPort(InputPort *phyPort) throw(YACS::Exception)
{
DEBTRACE("OutputPort::edAddInputPort");
if(!isAlreadyInSet(phyPort))
return false;
}
+bool OutputPort::edAddInPropertyPort(InPropertyPort *phyPort) throw(YACS::Exception)
+{
+ DEBTRACE("OutputPort::edAddInPropertyPort");
+ if(!isAlreadyInSet(phyPort))
+ {
+ InputPort *pwrap = getRuntime()->adapt(phyPort,
+ _node->getImplementation(),
+ this->edGetType());
+ _setOfInputPort.insert(pwrap);
+ modified();
+ phyPort->modified();
+ return true;
+ }
+ else
+ return false;
+}
+
/**
* Remove a link by performing not only the deletion in _setOfInputPort but also dereference to the target inputPort.
* If 'forward' == true the forward deletion
* If 'forward' == false no forward deletion performed, oneway deletion without update 'inputPort' side.
*/
-int OutputPort::edRemoveInputPort(InputPort *inputPort, bool forward) throw(Exception)
+int OutputPort::edRemoveInputPort(InputPort *inputPort, bool forward) throw(YACS::Exception)
{
if(forward)
{
{
InPort *publicRepr=with->getPublicRepresentant();
set<InPort *> s;
- set<InputPort *>::iterator iter;
+ set<InputPort *>::const_iterator iter;
for(iter=_setOfInputPort.begin();iter!=_setOfInputPort.end();iter++)
{
if((*iter)->getPublicRepresentant() == publicRepr)
return false;
}
+bool
+OutputPort::isConnected() const
+{
+ return !_setOfInputPort.empty();
+}
+
+
/**
* check compatibility of port class ( an inputPort ) before trying to create the link.
*/
-bool OutputPort::addInPort(InPort *inPort) throw(Exception)
+bool OutputPort::addInPort(InPort *inPort) throw(YACS::Exception)
{
DEBTRACE("OutputPort::addInPort");
- if(inPort->getNameOfTypeOfCurrentInstance()!=InputPort::NAME)
+ if(inPort->getNameOfTypeOfCurrentInstance()!=InputPort::NAME &&
+ inPort->getNameOfTypeOfCurrentInstance()!=InPropertyPort::NAME)
{
string what="not compatible type of port requested during building of link FROM ";
what+=NAME; what+=" TO "; what+=inPort->getNameOfTypeOfCurrentInstance();
throw Exception(what);
}
- return edAddInputPort(static_cast<InputPort*>(inPort));
+ if (inPort->getNameOfTypeOfCurrentInstance() == InputPort::NAME)
+ {
+ return edAddInputPort(static_cast<InputPort*>(inPort));
+ }
+ else
+ {
+ return edAddInPropertyPort(static_cast<InPropertyPort*>(inPort));
+ }
}
/**
* check compatibility of port class ( an inputPort ) before trying to remove link WITHOUT forward.
*/
-int OutputPort::removeInPort(InPort *inPort, bool forward) throw(Exception)
+int OutputPort::removeInPort(InPort *inPort, bool forward) throw(YACS::Exception)
{
if(inPort->getNameOfTypeOfCurrentInstance()!=InputPort::NAME && !forward)
{
std::set<InPort *> OutputPort::edSetInPort() const
{
set<InPort *> s;
- for(set<InputPort *>::iterator iter=_setOfInputPort.begin();iter!=_setOfInputPort.end();iter++)
+ for(set<InputPort *>::const_iterator iter=_setOfInputPort.begin();iter!=_setOfInputPort.end();iter++)
(*iter)->getAllRepresentants(s);
return s;
}
}
//! Check validity of output port. Nothing on base class
-void OutputPort::checkBasicConsistency() const throw(Exception)
+void OutputPort::checkBasicConsistency() const throw(YACS::Exception)
{
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __OUTPUTPORT_HXX__
#define __OUTPUTPORT_HXX__
+#include "YACSlibEngineExport.hxx"
#include "OutPort.hxx"
#include "DataFlowPort.hxx"
#include "ConversionException.hxx"
class InPort;
class Runtime;
class InputPort;
+ class InPropertyPort;
class OptimizerLoop;
class ElementaryNode;
class CollectorSwOutputPort;
- class OutputPort : public DataFlowPort, public OutPort
+ class YACSLIBENGINE_EXPORT OutputPort : public DataFlowPort, public OutPort
{
friend class CollectorSwOutputPort; // for conect
friend class ElementaryNode; // for disconnect...
friend class OptimizerLoop; // for interceptors
friend class InputPort;
friend class Runtime; // for port creation
+ friend class ForLoop; // for port creation
public:
virtual ~OutputPort();
std::set<InPort *> edSetInPort() const;
bool isAlreadyLinkedWith(InPort *with) const;
bool isAlreadyInSet(InputPort *inputPort) const;
+ bool isConnected() const;
std::string getNameOfTypeOfCurrentInstance() const;
int removeInPort(InPort *inPort, bool forward) throw(Exception);
virtual bool edAddInputPort(InputPort *phyPort) throw(Exception);
+ virtual bool edAddInPropertyPort(InPropertyPort *phyPort) throw(Exception);
virtual int edRemoveInputPort(InputPort *inputPort, bool forward) throw(Exception);
bool addInPort(InPort *inPort) throw(Exception);
void edRemoveAllLinksLinkedWithMe() throw(Exception);//entry point for forward port deletion
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm/unix/make_begin.am
lib_LTLIBRARIES = libPluginSimplex.la
-I$(srcdir)/.. \
-I$(srcdir)/../../bases
+libPluginSimplex_la_LIBADD = ../libYACSlibEngine.la
+
EXTRA_DIST = \
aleas.hxx critere.hxx decode.hxx distrib.hxx fonction.hxx \
local.hxx maestro.hxx PluginSimplex.hxx point.hxx saclass.hxx \
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "PluginSimplex.hxx"
#include "TypeCode.hxx"
#include "Pool.hxx"
rien = solv->next();
}
-void PluginSimplex::initialize(const Any *input) throw (Exception)
+void PluginSimplex::initialize(const Any *input) throw(YACS::Exception)
{
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __PLUGINSIMPLEX_HXX__
#define __PLUGINSIMPLEX_HXX__
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
import glob
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include <time.h>
#include <sys/types.h>
+#ifdef WNT
+#else
#include <unistd.h>
+#endif
#include <math.h>
// #include "mt19937ar.h
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __ALEAS__
#define __ALEAS__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __CRITERE__
#define __CRITERE__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "decode.hxx"
#include <iostream>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __DECODE__
#define __DECODE__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __DISTRIB__
#define __DISTRIB__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __FONCTION__
#define __FONCTION__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "local.hxx"
Local::Local(UserFun &f)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __LOCAL__
#define __LOCAL__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "maestro.hxx"
Maestro::Maestro(Decoder &dm, Critere *crt, Distrib &dst)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __MAESTRO__
#define __MAESTRO__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <stdio.h>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "point.hxx"
#include <iostream>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __POINT__
#define __POINT__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "saclass.hxx"
#include <utility>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __SACLASS__
#define __SACLASS__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
/* choix utilisateur */
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "saemul.hxx"
#include "saconst.h"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __SASUPER__
#define __SASUPER__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __SALOMESUP__
#define __SALOMESUP__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "salomevent.hxx"
#include "Any.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __SALOMEVENT__
#define __SALOMEVENT__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "sasimpl.hxx"
#include "saconst.h"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __SASIMPL__
#define __SASIMPL__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "saemul.hxx"
int main(void)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "simplex.hxx"
#include <iostream>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __SIMPLEX__
#define __SIMPLEX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "solution.hxx"
#include <iostream>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __SOLUTION__
#define __SOLUTION__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Pool.hxx"
#include "Any.hxx"
return _out==NOT_USED_NOR_COMPUTED;
}
+int Pool::getCurrentId() const
+{
+ if(empty())
+ throw YACS::Exception("no current case set in pool");
+ else
+ return _currentCase->first;
+}
+Any *Pool::getCurrentInSample() const
+{
+ if(empty())
+ throw YACS::Exception("no current case set in pool");
+ else
+ return (*_currentCase).second.inValue();
+}
+
+Any *Pool::getCurrentOutSample() const
+{
+ if(empty())
+ throw YACS::Exception("no current case set in pool");
+ else
+ return (*_currentCase).second.outValue();
+}
+
+Any *Pool::getOutSample(int id)
+{
+ if(empty())
+ throw YACS::Exception("no current case set in pool");
+
+ std::list< std::pair<int, ExpData> >::iterator iter;
+ for(iter=_container.begin();iter!=_container.end();iter++)
+ if((*iter).first==id)
+ return (*iter).second.outValue();
+ if(iter==_container.end())
+ throw YACS::Exception("no current case set in pool");
+}
+
+
//! Push a sample. \b WARNING inSample ownership is released to current Pool instance (this) !
void Pool::pushInSample(int id, Any *inSample, unsigned char priority)
{
* corrupted 'this'.
*
*/
-void Pool::checkConsistency() throw(Exception)
+void Pool::checkConsistency() throw(YACS::Exception)
{
// First check unicity of ids.
std::set<int> ids;
/*!
* \throw See the \b throw case of pushOutSampleAt method.
*/
-void Pool::setCurrentId(int id) throw(Exception)
+void Pool::setCurrentId(int id) throw(YACS::Exception)
{
std::list< std::pair<int, ExpData> >::iterator iter;
for(iter=_container.begin();iter!=_container.end();iter++)
* has destroyed a case id different from its id.
*
*/
-void Pool::putOutSampleAt(int id, Any *outValue) throw(Exception)
+void Pool::putOutSampleAt(int id, Any *outValue) throw(YACS::Exception)
{
std::list< std::pair<int, ExpData> >::iterator iter;
for(iter=_container.begin();iter!=_container.end();iter++)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __POOL_HXX__
#define __POOL_HXX__
+#include "YACSlibEngineExport.hxx"
#include "Exception.hxx"
#include <list>
class Any;
class OptimizerLoop;
- class Pool
+ class YACSLIBENGINE_EXPORT Pool
{
friend class OptimizerLoop;
std::list< std::pair<int, ExpData> >::iterator _currentCase;
public:
//For algorithm use
- int getCurrentId() const { return (*_currentCase).first; }
- Any *getCurrentInSample() const { return (*_currentCase).second.inValue(); }
- Any *getCurrentOutSample() const { return (*_currentCase).second.outValue(); }
+ int getCurrentId() const ;
+ Any *getCurrentInSample() const ;
+ Any *getCurrentOutSample() const ;
+ Any *getOutSample(int id);
void pushInSample(int id, Any *inSample, unsigned char priority = 0);
void destroyAll();
private:
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Port.hxx"
#include "Node.hxx"
#include <iostream>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __PORT_HXX__
#define __PORT_HXX__
+#include "YACSlibEngineExport.hxx"
+
#include <string>
namespace YACS
*
* \ingroup Ports
*/
- class Port
+ class YACSLIBENGINE_EXPORT Port
{
public:
virtual ~Port();
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Proc.hxx"
#include "ElementaryNode.hxx"
#include "Runtime.hxx"
#include "Container.hxx"
+#include "ComponentInstance.hxx"
#include "InputPort.hxx"
#include "OutputPort.hxx"
#include "TypeCode.hxx"
using namespace std;
using namespace YACS::ENGINE;
-Proc::Proc(const std::string& name):Bloc(name),_edition(false)
+/*! \class YACS::ENGINE::Proc
+ * \brief Base class for all schema objects.
+ *
+ * This is an abstract class that must be specialized in runtime.
+ * \ingroup Nodes
+ */
+
+Proc::Proc(const std::string& name):Bloc(name),_edition(false),_compoinstctr(0)
{
Runtime *theRuntime=getRuntime();
DEBTRACE("theRuntime->_tc_double->ref: " << theRuntime->_tc_double->getRefCnt());
}
}
+std::string Proc::setInPortValue(std::string nodeName, std::string portName, std::string value)
+{
+ DEBTRACE("Proc::setInPortValue " << nodeName << " " << portName << " " << value);
+
+ try
+ {
+ YACS::ENGINE::Node* node = YACS::ENGINE::Proc::nodeMap[nodeName];
+ YACS::ENGINE::InputPort* inputPort = node->getInputPort(portName);
+
+ switch (inputPort->edGetType()->kind())
+ {
+ case Double:
+ {
+ double val = atof(value.c_str());
+ inputPort->edInit(val);
+ }
+ case Int:
+ {
+ int val = atoi(value.c_str());
+ inputPort->edInit(val);
+ }
+ case String:
+ inputPort->edInit(value.c_str());
+ case Bool:
+ {
+ bool val = (! value.compare("False") ) && (! value.compare("0") );
+ inputPort->edInit(val);
+ }
+ default:
+ DEBTRACE("Proc::setInPortValue: filtered type: " << inputPort->edGetType()->kind());
+ }
+ return value;
+ }
+ catch(YACS::Exception& ex)
+ {
+ DEBTRACE("Proc::setInPortValue " << ex.what());
+ stringstream msg;
+ msg << "<value><error>" << ex.what() << "</error></value>";
+ return msg.str();
+ }
+}
+
std::string Proc::getOutPortValue(int nodeNumId, std::string portName)
{
DEBTRACE("Proc::getOutPortValue " << nodeNumId << " " << portName);
containerMap[name]->decrRef();
containerMap[name]=co;
co->incrRef();
+ co->setProc(this);
return co;
}
+
+//! Add a ComponentInstance into componentInstanceMap
+/*!
+ * If the name == "", the component instance is automatically named with a unique (in the Proc) name
+ *
+ * \param inst: the component instance
+ * \param name: the component instance name
+ * \param restCtr: try to reuse instance number previously released, false by default
+ */
+void Proc::addComponentInstance(ComponentInstance* inst, const std::string& name, bool resetCtr)
+{
+ if(name != "")
+ {
+ inst->setName(name);
+ inst->setAnonymous(false);
+ if(componentInstanceMap.count(name)!=0)
+ componentInstanceMap[name]->decrRef();
+ componentInstanceMap[name]=inst;
+ inst->incrRef();
+ }
+ else
+ {
+ //automatic naming : componame_<_compoinstctr>
+ std::string instname;
+ std::string componame=inst->getCompoName();
+ if (resetCtr)
+ _compoinstctr = 0;
+ while(1)
+ {
+ std::ostringstream buffer;
+ buffer << ++_compoinstctr;
+ instname=componame+"_"+buffer.str();
+ if(componentInstanceMap.count(instname)==0)
+ {
+ inst->setName(instname);
+ componentInstanceMap[instname]=inst;
+ inst->incrRef();
+ break;
+ }
+ }
+ }
+}
+
+//! Remove a componentInstance from the componentInstanceMap
+/*!
+ * To be used for a componentInstance with no service nodes referenced.
+ *
+ * \param inst: the component instance
+ */
+void Proc::removeComponentInstance(ComponentInstance* inst)
+{
+ if (componentInstanceMap.count(inst->getInstanceName()))
+ {
+ componentInstanceMap.erase(inst->getInstanceName());
+ inst->decrRef();
+ }
+}
+
+//! Remove a container from the containerMap
+/*!
+ * To be used for a container with no componentInstance referenced.
+ *
+ * \param cont: the container
+ */
+void Proc::removeContainer(Container* cont)
+{
+ if (containerMap.count(cont->getName()))
+ {
+ containerMap.erase(cont->getName());
+ cont->decrRef();
+ }
+}
+
+//! Create a new ComponentInstance and add it into componentInstanceMap
+/*!
+ * If the name == "", the component instance is automatically named with a unique (in the Proc) name
+ *
+ * \param componame: the component name
+ * \param name: the component instance name
+ * \param kind: the component instance kind (depends on runtime)
+ * \return the created ComponentInstance
+ */
+ComponentInstance* Proc::createComponentInstance(const std::string& componame, const std::string& name,const std::string& kind)
+{
+ ComponentInstance* inst= getRuntime()->createComponentInstance(componame,kind);
+ addComponentInstance(inst,name);
+ return inst;
+}
+
+//! Return the proc (this)
+Proc* Proc::getProc()
+{
+ return this;
+}
+
+//! Return the proc (this)
+const Proc * Proc::getProc() const
+{
+ return this;
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _PROC_HXX_
#define _PROC_HXX_
+#include "YACSlibEngineExport.hxx"
#include "Bloc.hxx"
+
#include <string>
#include <iostream>
#include <list>
class ComponentInstance;
class Logger;
- class Proc: public Bloc
+ class YACSLIBENGINE_EXPORT Proc: public Bloc
{
public:
Proc(const std::string& name);
virtual TypeCode* getTypeCode(const std::string& name);
virtual void setTypeCode(const std::string& name,TypeCode *t);
virtual Container* createContainer(const std::string& name,const std::string& kind="");
+ virtual ComponentInstance* createComponentInstance(const std::string& componame,
+ const std::string& name="",
+ const std::string& kind="");
+ virtual void addComponentInstance(ComponentInstance* inst, const std::string& name="",bool resetCtr=false);
+ virtual void removeComponentInstance(ComponentInstance* inst);
+ virtual void removeContainer(Container* cont);
virtual void accept(Visitor *visitor);
+ virtual Proc *getProc();
+ virtual const Proc * getProc() const;
YACS::StatesForNode getNodeState(int numId);
std::string getInPortValue(int nodeNumId, std::string portName);
+ std::string setInPortValue(std::string nodeName, std::string portName, std::string value);
std::string getOutPortValue(int nodeNumId, std::string portName);
std::string getNodeErrorDetails(int nodeNumId);
std::string getNodeErrorReport(int nodeNumId);
std::map<std::string, InlineNode*> inlineMap;
std::map<std::string, TypeCode*> typeMap;
std::map<std::string, Container*> containerMap;
- std::map<std::pair<std::string,int>, ComponentInstance*> componentInstanceMap;
+ std::map<std::string, ComponentInstance*> componentInstanceMap;
std::vector<std::string> names;
typedef std::map<std::string, Logger*> LoggerMap;
virtual void saveState(std::string xmlStateFile);
protected:
bool _edition;
+ int _compoinstctr;
};
}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "PropertyInterface.hxx"
+
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
+using namespace std;
+using namespace YACS::ENGINE;
+
+/*! \class YACS::ENGINE::PropertyInterface
+ * \brief Class for adding property interface to another class
+ *
+ */
+
+void PropertyInterface::setProperty(const std::string& name, const std::string& value)
+{
+ DEBTRACE("PropertyInterface::setProperty " << name << " " << value);
+ _propertyMap[name]=value;
+}
+
+//! Get a property value given its name
+/*!
+ * \param name : the property name
+ * \return the property value
+ */
+std::string PropertyInterface::getProperty(const std::string& name)
+{
+ DEBTRACE("PropertyInterface::getProperty " << name );
+ return _propertyMap[name];
+}
+
+void PropertyInterface::setProperties(std::map<std::string,std::string> properties)
+{
+ DEBTRACE("PropertyInterface::setProperties " );
+ _propertyMap.clear();
+ std::map<std::string,std::string>::iterator it;
+ for (it = properties.begin(); it != properties.end(); ++it)
+ {
+ setProperty(it->first, it->second); // setProperty virtual and derived
+ }
+}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef __PROPERTYINTERFACE_HXX__
+#define __PROPERTYINTERFACE_HXX__
+
+#include "YACSlibEngineExport.hxx"
+
+#include <map>
+#include <string>
+
+namespace YACS
+{
+ namespace ENGINE
+ {
+ class YACSLIBENGINE_EXPORT PropertyInterface
+ {
+ public:
+ virtual void setProperty(const std::string& name,const std::string& value);
+ virtual std::string getProperty(const std::string& name);
+ std::map<std::string,std::string> getProperties() { return _propertyMap; };
+ virtual void setProperties(std::map<std::string,std::string> properties);
+ protected:
+ std::map<std::string,std::string> _propertyMap;
+ };
+ }
+}
+
+#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "RefCounter.hxx"
#include "Mutex.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __REFCOUNTER_HXX__
#define __REFCOUNTER_HXX__
+#include "YACSlibEngineExport.hxx"
+
namespace YACS
{
namespace ENGINE
{
- class RefCounter
+ class YACSLIBENGINE_EXPORT RefCounter
{
public:
unsigned int getRefCnt() const { return _cnt; }
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Runtime.hxx"
#include<cassert>
#include "WhileLoop.hxx"
#include "ForLoop.hxx"
#include "ForEachLoop.hxx"
+#include "OptimizerLoop.hxx"
#include "Switch.hxx"
#include "Bloc.hxx"
#include "Proc.hxx"
TypeCode* Runtime::_tc_bool = 0;
TypeCode* Runtime::_tc_string = 0;
TypeCode* Runtime::_tc_file = 0;
+TypeCode* Runtime::_tc_stringpair = 0;
+TypeCode* Runtime::_tc_propvec = 0;
// --- init typecodes for edInit with C++ Any
Runtime::_tc_bool = new TypeCode(Bool);
Runtime::_tc_string = new TypeCode(String);
Runtime::_tc_file = new TypeCodeObjref("file", "file");
+ TypeCodeStruct * stringpair = new TypeCodeStruct("stringpair", "stringpair");
+ stringpair->addMember("name", Runtime::_tc_string);
+ stringpair->addMember("value", Runtime::_tc_string);
+ Runtime::_tc_stringpair = stringpair;
+ Runtime::_tc_propvec = new TypeCodeSeq("propvec", "propvec", Runtime::_tc_stringpair);
DEBTRACE( "_tc_double refcnt: " << Runtime::_tc_double->getRefCnt() );
DEBTRACE( "_tc_int refcnt: " << Runtime::_tc_int->getRefCnt() );
DEBTRACE( "_tc_bool refcnt: " << Runtime::_tc_bool->getRefCnt() );
DEBTRACE( "_tc_string refcnt: " << Runtime::_tc_string->getRefCnt() );
DEBTRACE( "_tc_file refcnt: " << Runtime::_tc_file->getRefCnt() );
+ DEBTRACE( "_tc_stringpair refcnt: " << Runtime::_tc_stringpair->getRefCnt() );
+ DEBTRACE( "_tc_propvec refcnt: " << Runtime::_tc_propvec->getRefCnt() );
_builtinCatalog = new Catalog("builtins");
- _builtinCatalog->_composednodeMap["Bloc"]=new Bloc("Bloc");
- _builtinCatalog->_composednodeMap["Switch"]=new Switch("Switch");
- _builtinCatalog->_composednodeMap["WhileLoop"]=new WhileLoop("WhileLoop");
- _builtinCatalog->_composednodeMap["ForLoop"]=new ForLoop("ForLoop");
- _builtinCatalog->_composednodeMap["ForEachLoopDouble"]=new ForEachLoop("ForEachLoopDouble",Runtime::_tc_double);
+ _builtinCatalog->_composednodeMap["Bloc"]=createBloc("Bloc");
+ _builtinCatalog->_composednodeMap["Switch"]=createSwitch("Switch");
+ _builtinCatalog->_composednodeMap["WhileLoop"]=createWhileLoop("WhileLoop");
+ _builtinCatalog->_composednodeMap["ForLoop"]=createForLoop("ForLoop");
+ _builtinCatalog->_composednodeMap["ForEachLoop_double"]=createForEachLoop("ForEachLoop_double",Runtime::_tc_double);
+ _builtinCatalog->_composednodeMap["ForEachLoop_string"]=createForEachLoop("ForEachLoop_string",Runtime::_tc_string);
+ _builtinCatalog->_composednodeMap["ForEachLoop_int"]=createForEachLoop("ForEachLoop_int",Runtime::_tc_int);
+ _builtinCatalog->_composednodeMap["ForEachLoop_bool"]=createForEachLoop("ForEachLoop_bool",Runtime::_tc_bool);
std::map<std::string,TypeCode*>& typeMap=_builtinCatalog->_typeMap;
Runtime::_tc_double->incrRef();
typeMap["double"]=Runtime::_tc_double;
typeMap["string"]=Runtime::_tc_string;
Runtime::_tc_file->incrRef();
typeMap["file"]=Runtime::_tc_file;
+ Runtime::_tc_stringpair->incrRef();
+ typeMap["stringpair"]=Runtime::_tc_stringpair;
+ Runtime::_tc_propvec->incrRef();
+ typeMap["propvec"]=Runtime::_tc_propvec;
+
+ // Get dynamic trace level
+ YACS::traceLevel=0;
+ char* valenv=getenv("YACS_TRACELEVEL");
+ if(valenv)
+ {
+ std::istringstream iss(valenv);
+ int temp;
+ if (iss >> temp)
+ YACS::traceLevel=temp;
+ }
+ // Get max threads number
char *maxThreadStr = getenv("YACS_MAX_THREADS");
if (!maxThreadStr) return;
int maxThreads = atoi(maxThreadStr);
Runtime::_tc_bool->decrRef();
Runtime::_tc_string->decrRef();
Runtime::_tc_file->decrRef();
- for(std::vector<Catalog *>::const_iterator it=_catalogs.begin();it !=_catalogs.end();it++)
- delete (*it);
+ for(std::vector<Catalog *>::iterator it=_catalogs.begin();it !=_catalogs.end();it++)
+ (*it)->decrRef();
Runtime::_singleton=0;
DEBTRACE( "Total YACS::ENGINE::Refcount: " << RefCounter::_totalCnt );
}
+TypeCode * Runtime::createInterfaceTc(const std::string& id, const std::string& name,
+ std::list<TypeCodeObjref *> ltc)
+{
+ return TypeCode::interfaceTc(id.c_str(),name.c_str(),ltc);
+}
+
+TypeCode * Runtime::createSequenceTc(const std::string& id,
+ const std::string& name,
+ TypeCode *content)
+{
+ return TypeCode::sequenceTc(id.c_str(),name.c_str(),content);
+};
+
+TypeCodeStruct * Runtime::createStructTc(const std::string& id, const std::string& name)
+{
+ return (TypeCodeStruct *)TypeCode::structTc(id.c_str(),name.c_str());
+}
+
DataNode* Runtime::createInDataNode(const std::string& kind,const std::string& name)
{
throw Exception("InDataNode factory not implemented");
return new ForEachLoop(name,type);
}
+OptimizerLoop* Runtime::createOptimizerLoop(const std::string& name,const std::string& algLib,const std::string& factoryName,bool algInitOnFile,
+ const std::string& kind, Proc * procForTypes)
+{
+ return new OptimizerLoop(name,algLib,factoryName,algInitOnFile, true, procForTypes);
+}
+
InputDataStreamPort* Runtime::createInputDataStreamPort(const std::string& name,Node *node,TypeCode *type)
{
return new InputDataStreamPort(name,node,type);
void Runtime::addCatalog(Catalog* catalog)
{
_catalogs.push_back(catalog);
+ catalog->incrRef();
}
//! Get a typecode by its name from runtime catalogs
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _RUNTIME_HXX_
#define _RUNTIME_HXX_
+#include "YACSlibEngineExport.hxx"
#include "ConversionException.hxx"
#include<string>
#include<set>
#include<map>
#include<vector>
+#include<list>
namespace YACS
{
namespace ENGINE
{
class Runtime;
- Runtime* getRuntime() throw(Exception);
+ YACSLIBENGINE_EXPORT Runtime* getRuntime() throw(Exception);
class Any;
class InputPort;
class OutputPort;
+ class InPropertyPort;
class ForLoop;
class ForEachLoop;
+ class OptimizerLoop;
class WhileLoop;
class Switch;
class InlineNode;
class ElementaryNode;
class Node;
class TypeCode;
+ class TypeCodeStruct;
+ class TypeCodeObjref;
class InputDataStreamPort;
class OutputDataStreamPort;
class Catalog;
class CatalogLoader;
- class Runtime
+ class YACSLIBENGINE_EXPORT Runtime
{
friend Runtime* getRuntime() throw(Exception);
public:
virtual WhileLoop* createWhileLoop(const std::string& name);
virtual ForLoop* createForLoop(const std::string& name);
virtual ForEachLoop* createForEachLoop(const std::string& name,TypeCode * type);
+ virtual OptimizerLoop* createOptimizerLoop(const std::string& name,const std::string& algLib,
+ const std::string& factoryName,bool algInitOnFile,
+ const std::string& kind="", Proc * procForTypes = NULL);
virtual Switch* createSwitch(const std::string& name);
+ virtual TypeCode * createInterfaceTc(const std::string& id, const std::string& name,
+ std::list<TypeCodeObjref *> ltc);
+ virtual TypeCode * createSequenceTc(const std::string& id, const std::string& name, TypeCode *content);
+ virtual TypeCodeStruct * createStructTc(const std::string& id, const std::string& name);
virtual InputPort* createInputPort(const std::string& name,
const std::string& impl,
virtual InputPort* adapt(InputPort* source, const std::string& impl, TypeCode * type,
bool init=false) throw (ConversionException) = 0;
+ virtual InputPort* adapt(InPropertyPort* source,
+ const std::string& impl,
+ TypeCode * type,
+ bool init=false) throw (ConversionException) = 0;
+
virtual void* convertNeutral(TypeCode * type, Any *data);
virtual std::string convertNeutralAsString(TypeCode * type, Any *data);
static YACS::ENGINE::TypeCode *_tc_bool;
static YACS::ENGINE::TypeCode *_tc_string;
static YACS::ENGINE::TypeCode *_tc_file;
+ static YACS::ENGINE::TypeCode *_tc_stringpair;
+ static YACS::ENGINE::TypeCode *_tc_propvec;
virtual void setCatalogLoaderFactory(const std::string& name, CatalogLoader* factory);
std::map<std::string,CatalogLoader*> _catalogLoaderFactoryMap;
Catalog* getBuiltinCatalog();
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "Scheduler.hxx"
+
+using namespace YACS::ENGINE;
+
+Scheduler::~Scheduler()
+{
+}
+
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __SCHEDULER_HXX__
#define __SCHEDULER_HXX__
virtual bool isPlacementPredictableB4Run() const = 0;
virtual bool isMultiplicitySpecified(unsigned& value) const = 0;
virtual void forceMultiplicity(unsigned value) = 0;
+ virtual ~Scheduler();
};
}
}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "ServerNode.hxx"
+#include "Container.hxx"
+#include "Visitor.hxx"
+
+using namespace YACS::ENGINE;
+
+ServerNode::ServerNode(const std::string& name):InlineFuncNode(name),_container(0)
+{
+}
+
+ServerNode::ServerNode(const ServerNode& other, ComposedNode *father):InlineFuncNode(other,father),_container(0)
+{
+}
+
+void ServerNode::performDuplicationOfPlacement(const Node& other)
+{
+ const ServerNode &otherC=*(dynamic_cast<const ServerNode *>(&other));
+ //if other has no container don't clone: this will not have one
+ if(otherC._container)
+ _container=otherC._container->clone();
+}
+
+void ServerNode::load()
+{
+ if(_container)
+ {
+ if(!_container->isAlreadyStarted(0))
+ {
+ try
+ {
+ _container->start(0);
+ }
+ catch(Exception& e)
+ {
+ _errorDetails=e.what();
+ throw e;
+ }
+ }
+ }
+ else
+ {
+ std::string what("ServerNode::load : a load operation requested on ServerNode called \"");
+ what+=_name; what+="\" with no container specified.";
+ _errorDetails=what;
+ throw Exception(what);
+ }
+}
+
+void ServerNode::accept(Visitor *visitor)
+{
+ visitor->visitServerNode(this);
+}
+
+void ServerNode::setContainer(Container *container)
+{
+ if(_container==container)
+ return ;
+ if(_container)
+ _container->decrRef();
+ _container=container;
+ if(_container)
+ _container->incrRef();
+ modified();
+}
+
+//! By definition of ServerNode class.
+bool ServerNode::isDeployable() const
+{
+ return true;
+}
+
+ServerNode::~ServerNode()
+{
+ if(_container)
+ _container->decrRef();
+}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef __SERVERNODE_HXX__
+#define __SERVERNODE_HXX__
+
+#include "YACSlibEngineExport.hxx"
+#include "InlineNode.hxx"
+
+#include <string>
+
+namespace YACS
+{
+ namespace ENGINE
+ {
+ class Container;
+ class Visitor;
+
+ class YACSLIBENGINE_EXPORT ServerNode : public InlineFuncNode
+ {
+ public:
+ ServerNode(const std::string& name);
+ ServerNode(const ServerNode& other, ComposedNode *father);
+ void performDuplicationOfPlacement(const Node& other);
+ void load();
+ void accept(Visitor *visitor);
+ virtual ServerNode *createNode(const std::string& name) const = 0;
+ Container *getContainer() const { return _container; }
+ void setContainer(Container *container);
+ bool isDeployable() const;
+ virtual std::string getEffectiveKindOfServer() const = 0;
+ virtual ~ServerNode();
+ virtual std::string typeName() { return "YACS__ENGINE__ServerNode"; }
+ protected:
+ Container *_container;
+ };
+ }
+}
+
+#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "ServiceInlineNode.hxx"
#include "Visitor.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __SERVICEINLINENODE_HXX__
#define __SERVICEINLINENODE_HXX__
+#include "YACSlibEngineExport.hxx"
#include "ServiceNode.hxx"
#include <string>
{
class Visitor;
- class ServiceInlineNode: public ServiceNode
+ class YACSLIBENGINE_EXPORT ServiceInlineNode: public ServiceNode
{
protected:
ServiceInlineNode(const std::string& name);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "ServiceNode.hxx"
#include "Visitor.hxx"
#include "ComponentInstance.hxx"
using namespace YACS::ENGINE;
+/*! \class YACS::ENGINE::ServiceNode
+ * \brief Class for calculation node associated with a component service
+ *
+ * \ingroup Nodes
+ *
+ * \see InlineNode
+ * \see ElementaryNode
+ */
+
const char ServiceNode::KIND[]="";
+//! Return the service node kind
+/*!
+ * A runtime can provide several implementations of a service node.
+ * Each implementation has a different kind. A ComponentInstance can be
+ * associated to a ServiceNode with the same kind.
+ */
std::string ServiceNode::getKind() const
{
return KIND;
return _component;
}
+//! Return the associated container
+Container *ServiceNode::getContainer()
+{
+ if(_component)return _component->getContainer();
+ return 0;
+}
+
//! By definition of ServiceNode class.
bool ServiceNode::isDeployable() const
{
}
//! Associate an existing component instance to this service node \b AND check the consistency regarding the deployment from root node point of view.
-void ServiceNode::setComponent(ComponentInstance* compo) throw(Exception)
+void ServiceNode::setComponent(ComponentInstance* compo) throw(YACS::Exception)
{
+ DEBTRACE("ServiceNode::setComponent " << compo);
if(compo)
- if(compo->getKind() != this->getKind())
- {
- //Not allowed
- std::string what("ServiceNode::setComponent : component instance kind not allowed ");
- throw Exception(what);
- }
- if(_component)
{
- //The node is already associated with a component instance
- _component->decrRef();
- //Don't forget to unassociate
+ DEBTRACE(compo->getInstanceName());
+ if(compo->getKind() != this->getKind())
+ {
+ //Not allowed
+ std::string what("ServiceNode::setComponent : component instance kind not allowed ");
+ throw Exception(what);
+ }
}
+
+ ComponentInstance* oldcompo=_component;
+ std::string oldref=_ref;
+
_component=compo;
+ _ref=compo->getCompoName();
+ DEBTRACE(_component->getInstanceName());
if(_component)
{
if(_father)
}
catch(Exception& e)
{
- _component=0;
+ // Impossible to associate compo to this node. Keep the old component instance and throws exception
+ _component=oldcompo;
+ _ref=oldref;
throw e;
}
_component->incrRef();
}
- //assert(_component);
+
+ if(oldcompo)
+ oldcompo->decrRef();
}
//! Associate a new component instance to this service node
//Don't forget to unassociate
}
_component= getRuntime()->createComponentInstance(ref,getKind());
- assert(_component);
+ YASSERT(_component);
}
std::string ServiceNode::getRef()
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __SERVICENODE_HXX__
#define __SERVICENODE_HXX__
+#include "YACSlibEngineExport.hxx"
#include "ElementaryNode.hxx"
+
#include <string>
namespace YACS
{
class ComponentInstance;
-/*! \brief Class for calculation node associated with a component service
- *
- * \ingroup Nodes
- *
- * \see InlineNode
- * \see ElementaryNode
- */
- class ServiceNode: public ElementaryNode
+ class YACSLIBENGINE_EXPORT ServiceNode: public ElementaryNode
{
protected:
ServiceNode(const std::string& name);
virtual bool isDeployable() const;
virtual void setComponent(ComponentInstance* compo) throw(Exception);
virtual ComponentInstance *getComponent();
+ virtual Container *getContainer();
virtual void setRef(const std::string& ref);
virtual std::string getRef();
virtual void setMethod(const std::string& method){ _method=method; }
virtual ServiceNode *createNode(const std::string& name) = 0;
virtual ~ServiceNode();
virtual void accept(Visitor *visitor);
-
-//! Return the service node kind
-/*!
- * A runtime can provide several implementations of a service node.
- * Each implementation has a different kind. A ComponentInstance can be
- * associated to a ServiceNode with the same kind.
- */
virtual std::string getKind() const;
static const char KIND[];
virtual std::string typeName() {return "YACS__ENGINE__ServiceNode";}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __SHAREDPTR_HXX__
#define __SHAREDPTR_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "StaticDefinedComposedNode.hxx"
#include "OutPort.hxx"
#include "InPort.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __STATICDEFINEDCOMPOSEDNODE_HXX__
#define __STATICDEFINEDCOMPOSEDNODE_HXX__
+#include "YACSlibEngineExport.hxx"
#include "ComposedNode.hxx"
namespace YACS
* Abstract class, that factorizes all the treatments relative to resource management for ComposedNode that have
* their connectivity fully defined before launching ; which is not always the case for classes inheriting from DynParaLoop.
*/
- class StaticDefinedComposedNode : public ComposedNode
+ class YACSLIBENGINE_EXPORT StaticDefinedComposedNode : public ComposedNode
{
protected:
StaticDefinedComposedNode(const std::string& name);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Switch.hxx"
#include "Visitor.hxx"
#include "LinkInfo.hxx"
return _className;
}
-void CollectorSwOutPort::edRemoveAllLinksLinkedWithMe() throw(Exception)
+void CollectorSwOutPort::edRemoveAllLinksLinkedWithMe() throw(YACS::Exception)
{
map<int, OutPort *>::iterator pt;
if(_consumer)
((*pt).second)->getAllRepresented(represented);
}
-bool CollectorSwOutPort::addInPort(InPort *inPort) throw(Exception)
+bool CollectorSwOutPort::addInPort(InPort *inPort) throw(YACS::Exception)
{
if(_currentProducer)
{//a specific link is beeing done
(*iter).second->addInPort(inPort);
}
-int CollectorSwOutPort::removeInPort(InPort *inPort, bool forward) throw(Exception)
+int CollectorSwOutPort::removeInPort(InPort *inPort, bool forward) throw(YACS::Exception)
{
if(_currentProducer)
{
return _potentialProducers.empty();
}
-bool CollectorSwOutPort::checkManagementOfPort(OutPort *port) throw(Exception)
+bool CollectorSwOutPort::checkManagementOfPort(OutPort *port) throw(YACS::Exception)
{
for(map<int, OutPort *>::iterator iter=_potentialProducers.begin();iter!=_potentialProducers.end();iter++)
if((*iter).second==port)
void FakeNodeForSwitch::exForwardFailed()
{
_sw->exForwardFailed();
- FakeNodeForSwitch *normallyThis=_sw->_undispatchableNotificationNode;
- _sw->_undispatchableNotificationNode=0;
- delete normallyThis;
}
void FakeNodeForSwitch::exForwardFinished()
{
_sw->exForwardFinished();
- FakeNodeForSwitch *normallyThis=_sw->_undispatchableNotificationNode;
- _sw->_undispatchableNotificationNode=0;
- delete normallyThis;
}
void FakeNodeForSwitch::execute()
_sw->setState(YACS::DONE);
}
+/*! \class YACS::ENGINE::Switch
+ * \brief Control node that emulates the C switch
+ *
+ * \ingroup Nodes
+ */
+
Switch::Switch(const Switch& other, ComposedNode *father, bool editionOnly):StaticDefinedComposedNode(other,father),_condition(other._condition,this),
_undispatchableNotificationNode(0)
{
Switch::~Switch()
{
+ if(_undispatchableNotificationNode)delete _undispatchableNotificationNode;
+
for(map< int , Node * >::iterator iter=_mapOfNode.begin();iter!=_mapOfNode.end();iter++)
delete (*iter).second;
for(map<InPort *, CollectorSwOutPort * >::iterator iter2=_outPortsCollector.begin();iter2!=_outPortsCollector.end();iter2++)
void Switch::exUpdateState()
{
+ DEBTRACE("Switch::exUpdateState " << _state);
if(_state == YACS::DISABLED)
return;
if(_inGate.exIsReady())
{
- setState(YACS::TOACTIVATE);
+ setState(YACS::ACTIVATED);
if(_condition.isEmpty())
_undispatchableNotificationNode=new FakeNodeForSwitch(this,false,true);
else
void Switch::init(bool start)
{
+ DEBTRACE("Switch::init " << start);
StaticDefinedComposedNode::init(start);
int i=0;
for(map< int , Node * >::iterator iter=_mapOfNode.begin();iter!=_mapOfNode.end();iter++, i++)
(*iter).second->getReadyTasks(tasks);//Default Node is returned
else
if(_undispatchableNotificationNode)
- _undispatchableNotificationNode->getReadyTasks(tasks);
+ _undispatchableNotificationNode->getReadyTasks(tasks);
else
throw Exception("Switch::getReadyTasks : internal error");
}
return StaticDefinedComposedNode::getNumberOfInputPorts()+1;
}
-void Switch::edRemoveChild(Node *node) throw(Exception)
+void Switch::edRemoveChild(Node *node) throw(YACS::Exception)
{
map< int , Node * >::iterator iter=_mapOfNode.begin();
for(;iter!=_mapOfNode.end();iter++)
ret.push_back((InputPort *)&_condition);
return ret;
}
-OutPort *Switch::getOutPort(const std::string& name) const throw(Exception)
+OutPort *Switch::getOutPort(const std::string& name) const throw(YACS::Exception)
{
for(map<InPort *, CollectorSwOutPort * >::const_iterator iter=_outPortsCollector.begin();iter!=_outPortsCollector.end();iter++)
if(name==(*iter).second->getName())
return StaticDefinedComposedNode::getOutPort(name);
}
-InputPort *Switch::getInputPort(const std::string& name) const throw(Exception)
+InputPort *Switch::getInputPort(const std::string& name) const throw(YACS::Exception)
{
if(name==SELECTOR_INPUTPORT_NAME)
return (InputPort *)&_condition;
return StaticDefinedComposedNode::getInputPort(name);
}
-Node *Switch::getChildByShortName(const std::string& name) const throw(Exception)
+Node *Switch::getChildByShortName(const std::string& name) const throw(YACS::Exception)
{
if(name==DEFAULT_NODE_NAME)
{
return edSetNode(ID_FOR_DEFAULT_NODE,node);
}
-Node *Switch::edReleaseDefaultNode() throw(Exception)
+Node *Switch::edReleaseDefaultNode() throw(YACS::Exception)
{
return edReleaseCase(ID_FOR_DEFAULT_NODE);
}
-Node *Switch::edReleaseCase(int caseId) throw(Exception)
+Node *Switch::edReleaseCase(int caseId) throw(YACS::Exception)
{
map< int , Node * >::iterator iter=_mapOfNode.find(caseId);
if(iter==_mapOfNode.end())
* 0 is returned if caseId is a new ID.
* \b WARNING : 'node' is held by 'this' after call, whereas returned node is no more held.
*/
-Node *Switch::edSetNode(int caseId, Node *node) throw(Exception)
+Node *Switch::edSetNode(int caseId, Node *node) throw(YACS::Exception)
{
if(!node)
throw Exception("Switch::edSetNode : null node cannot be set as a case in switch node");
}
}
-bool Switch::edAddChild(Node *node) throw(Exception)
+//! Change the case of a node
+/*!
+ * \param oldCase : the case value to change
+ * \param newCase : the new value to set
+ * raise an exception if the old case does not exist or if the new case already exists
+ */
+void Switch::edChangeCase(int oldCase, int newCase)
+{
+ std::map< int , Node * >::iterator iter=_mapOfNode.find(oldCase);
+ if(iter==_mapOfNode.end())
+ {
+ //the case does not exists
+ throw Exception("Switch::edChangeCase : case does not exist");
+ }
+ iter=_mapOfNode.find(newCase);
+ if(iter != _mapOfNode.end())
+ {
+ //the new case exists
+ throw Exception("Switch::edChangeCase : new case exists");
+ }
+ Node* node=_mapOfNode[oldCase];
+ _mapOfNode.erase(oldCase);
+ _mapOfNode[newCase]=node;
+ modified();
+}
+
+int Switch::getMaxCase()
{
int aCase = 0;
map<int, Node*>::const_iterator it = _mapOfNode.begin();
for(; it != _mapOfNode.end(); ++it)
if ((*it).first > aCase)
aCase = (*it).first;
- aCase++;
+ return aCase;
+}
+
+bool Switch::edAddChild(Node *node) throw(YACS::Exception)
+{
+ int aCase = getMaxCase() + 1;
DEBTRACE(aCase);
bool ret = edSetNode(aCase, node);
DEBTRACE(ret);
throw Exception("Switch::checkControlDependancy : a link was dectected between 2 cases of a switch. Impossible !");
}
-void Switch::checkNoCyclePassingThrough(Node *node) throw(Exception)
+void Switch::checkNoCyclePassingThrough(Node *node) throw(YACS::Exception)
{
throw Exception("Switch::checkNoCyclePassingThrough : uncorrect control flow link relative to switch");
}
void Switch::checkLinkPossibility(OutPort *start, const std::list<ComposedNode *>& pointsOfViewStart,
- InPort *end, const std::list<ComposedNode *>& pointsOfViewEnd) throw(Exception)
+ InPort *end, const std::list<ComposedNode *>& pointsOfViewEnd) throw(YACS::Exception)
{
throw Exception("Switch::checkLinkPossibility : A link between 2 different cases of a same Switch requested -> Impossible");
}
port.first=newCollector;
}
-void Switch::getDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView) throw(Exception)
+void Switch::getDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView) throw(YACS::Exception)
{
map<InPort *, CollectorSwOutPort * >::iterator iter=_outPortsCollector.find(finalTarget);
if(iter==_outPortsCollector.end())
port.first=(*iter).second;
}
-void Switch::releaseDelegateOf(OutPort *portDwn, OutPort *portUp, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView) throw(Exception)
+void Switch::releaseDelegateOf(OutPort *portDwn, OutPort *portUp, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView) throw(YACS::Exception)
{
set<OutPort *> repr;
portDwn->getAllRepresented(repr);
return YACS::READY;
if(effectiveState==YACS::DISABLED)
return YACS::DISABLED;
- if(!_condition.getValue())
- return node->getState();
- map< int , Node * >::const_iterator iter=_mapOfNode.find(_condition.getIntValue());
- if(iter!=_mapOfNode.end() && (*iter).second==node)
- return node->getState();
- else
- return YACS::READY;
+
+ return node->getState();
}
YACS::StatesForNode Switch::getEffectiveState() const
{
return id;
}
-std::string Switch::getCaseId(const Node *node) const throw(Exception)
+std::string Switch::getCaseId(const Node *node) const throw(YACS::Exception)
{
const char sep='_';
map<int, Node*>::const_iterator iter;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __SWITCH_HXX__
#define __SWITCH_HXX__
+#include "YACSlibEngineExport.hxx"
#include "StaticDefinedComposedNode.hxx"
#include "ElementaryNode.hxx"
#include "AnyInputPort.hxx"
{
class Switch;
- class CollectorSwOutPort : public OutPort
+ class YACSLIBENGINE_EXPORT CollectorSwOutPort : public OutPort
{
friend class Switch;
private:
void finished();
};
- class Switch : public StaticDefinedComposedNode
+ class YACSLIBENGINE_EXPORT Switch : public StaticDefinedComposedNode
{
friend class FakeNodeForSwitch;
friend class CollectorSwOutPort;
Node *edReleaseCase(int caseId) throw(Exception);
Node *edGetNode(int caseId);
Node *edSetNode(int caseId, Node *DISOWNnode) throw(Exception);
+ void edChangeCase(int oldCase, int newCase);
virtual bool edAddChild(Node *DISOWNnode) throw(Exception);
+ int getMaxCase();
void getReadyTasks(std::vector<Task *>& tasks);
void selectRunnableTasks(std::vector<Task *>& tasks);
std::list<Node *> edGetDirectDescendants() const;
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "Task.hxx"
+
+#include <iostream>
+
+using namespace YACS::ENGINE;
+
+Task::~Task()
+{
+}
+
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __TASK_HXX__
#define __TASK_HXX__
+#include "YACSlibEngineExport.hxx"
#include "define.hxx"
+#include <set>
namespace YACS
{
namespace ENGINE
{
class ComponentInstance;
+ class Container;
- class Task
+ class YACSLIBENGINE_EXPORT Task
{
public:
virtual void begin() = 0;
virtual void initService() = 0;
virtual void connectService() = 0;
virtual void disconnectService() = 0;
+ virtual void getCoupledTasks(std::set<Task*>& coupledSet) = 0;
virtual bool isDeployable() const = 0;
virtual ComponentInstance *getComponent() = 0;
+ virtual Container *getContainer() = 0;
virtual YACS::StatesForNode getState() const = 0;
virtual void finished() = 0;
virtual void aborted() = 0;
+ virtual ~Task();
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "ComponentInstanceTest.hxx"
#include "ToyNode.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __COMPONENTINTANCETEST_HXX__
#define __COMPONENTINTANCETEST_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "ContainerTest.hxx"
#include "ComponentInstance.hxx"
#include "ToyNode.hxx"
return stream.str();
}
-bool ContainerTest::isAlreadyStarted() const
+bool ContainerTest::isAlreadyStarted(const ComponentInstance *inst) const
{
return _alreadyStarted;
}
-void ContainerTest::start() throw(Exception)
+void ContainerTest::start(const ComponentInstance *inst) throw(Exception)
{
if(_alreadyStarted)
throw Exception("ContainerTest already started !!!!");
{
}
-bool ContainerTest2::isAlreadyStarted() const
+bool ContainerTest2::isAlreadyStarted(const ComponentInstance *inst) const
{
return _alreadyStarted;
}
-void ContainerTest2::start() throw(Exception)
+void ContainerTest2::start(const ComponentInstance *inst) throw(Exception)
{
if(_alreadyStarted)
throw Exception("ContainerTest already started !!!!");
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __CONTAINERTEST_HXX__
#define __CONTAINERTEST_HXX__
ContainerTest();
std::string getPlacementInfo() const;
// implementation of compulsary methods
- bool isAlreadyStarted() const;
- void start() throw(Exception);
+ bool isAlreadyStarted(const ComponentInstance *inst) const;
+ void start(const ComponentInstance *inst) throw(Exception);
Container *clone() const;
- std::string getPlacementId() const { return ""; }
+ std::string getPlacementId(const ComponentInstance *inst) const { return ""; }
+ std::string getFullPlacementId(const ComponentInstance *inst) const { return ""; }
static void initAllContainers();
protected:
void checkCapabilityToDealWith(const ComponentInstance *inst) const throw(Exception);
public:
ContainerTest2();
// implementation of compulsary methods
- bool isAlreadyStarted() const;
- void start() throw(Exception);
+ bool isAlreadyStarted(const ComponentInstance *inst) const;
+ void start(const ComponentInstance *inst) throw(Exception);
Container *clone() const;
- std::string getPlacementId() const { return ""; }
+ std::string getPlacementId(const ComponentInstance *inst) const { return ""; }
+ std::string getFullPlacementId(const ComponentInstance *inst) const { return ""; }
static void initAllContainers();
protected:
void checkCapabilityToDealWith(const ComponentInstance *inst) const throw(Exception);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#define UNIT_TEST_HEADER " --- TEST src/engine EngineIntegrationTest"
#include "engineIntegrationTest.hxx"
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm/unix/make_begin.am
+if CPPUNIT_IS_OK
check_PROGRAMS = TestEngine IntegrationTestEngine
+endif
TestEngine_SOURCES = \
TestEngine.cxx \
TestEngine_LDFLAGS = $(CPPUNIT_LIBS) -pthread -ldl
-TestEngine_CXXFLAGS = \
+TestEngine_CXXFLAGS = $(THREAD_DEF) \
$(CPPUNIT_INCLUDES) \
-I$(srcdir)/.. \
-I$(srcdir)/../../bases \
-I$(srcdir)/.. \
-I$(srcdir)/../../bases
+libPluginOptEvTest1_la_LIBADD = ../libYACSlibEngine.la
+
IntegrationTestEngine_SOURCES = \
ToyNode.cxx \
ContainerTest.cxx \
-I$(srcdir)/../../bases/Test
+if CPPUNIT_IS_OK
TESTS = TestEngine IntegrationTestEngine
+endif
EXTRA_DIST = \
ComponentInstanceTest.hxx ContainerTest.hxx engineIntegrationTest.hxx \
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "PluginOptEvTest1.hxx"
#include "TypeCode.hxx"
#include "Pool.hxx"
_idTest++;
}
-void PluginOptEvTest1::initialize(const Any *input) throw (Exception)
+void PluginOptEvTest1::initialize(const Any *input) throw(YACS::Exception)
{
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __PUGINOPTEVTEST1_HXX__
#define __PUGINOPTEVTEST1_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "RuntimeForEngineIntegrationTest.hxx"
#include "ComponentInstanceTest.hxx"
#include "ToyNode.hxx"
return new ProxyPort(source);
}
+InputPort* RuntimeForEngineIntegrationTest::adapt(InPropertyPort* source, const std::string& impl, TypeCode * type, bool init) throw (ConversionException)
+{
+ return adapt((InputPort *)source, impl, type, init);
+}
+
ComponentInstance* RuntimeForEngineIntegrationTest::createComponentInstance(const std::string& name, const std::string& kind)
{
if(kind==ToyNode1S::KIND)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __RUNTIMEFORENGINEINTEGRATIONTEST_HXX__
#define __RUNTIMEFORENGINEINTEGRATIONTEST_HXX__
InputPort* createInputPort(const std::string& name, const std::string& impl, Node * node, TypeCode * type);
OutputPort* createOutputPort(const std::string& name, const std::string& impl, Node * node, TypeCode * type);
InputPort* adapt(InputPort* source, const std::string& impl,TypeCode * type,bool init) throw (ConversionException);
+ InputPort* adapt(InPropertyPort* source, const std::string& impl, TypeCode * type,bool init) throw (ConversionException);
ComponentInstance* createComponentInstance(const std::string& name, const std::string& kind="");
};
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "RuntimeForEngineTest.hxx"
#include <iostream>
#include <sstream>
{
return new ProxyPort(source);
}
+
+InputPort* RuntimeForEngineTest::adapt(InPropertyPort* source, const std::string& impl, TypeCode * type, bool init) throw (ConversionException)
+{
+ return adapt((InputPort *)source,impl,type,init);
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __RUNTIMEFORENGINETEST_HXX__
#define __RUNTIMEFORENGINETEST_HXX__
InputPort* createInputPort(const std::string& name, const std::string& impl, Node * node, TypeCode * type);
OutputPort* createOutputPort(const std::string& name, const std::string& impl, Node * node, TypeCode * type);
InputPort* adapt(InputPort* source, const std::string& impl, TypeCode * type,bool init) throw (ConversionException);
+ InputPort* adapt(InPropertyPort* source, const std::string& impl, TypeCode * type,bool init) throw (ConversionException);
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#define UNIT_TEST_HEADER " --- TEST src/engine EngineTest"
#include "engineTest.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "ToyNode.hxx"
#include "TypeCode.hxx"
#include <iostream>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __TOYNODE_HXX__
#define __TOYNODE_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "engineIntegrationTest.hxx"
#include "RuntimeForEngineIntegrationTest.hxx"
#include "ComponentInstanceTest.hxx"
#include "Proc.hxx"
#include <iostream>
+#include <string.h>
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
graph->edAddCFLink(n1,loop);
graph->edAddLink(o21,i21);
graph->checkConsistency(info);
+ DEBTRACE(info.areWarningsOrErrors());
CPPUNIT_ASSERT(!info.areWarningsOrErrors());
Executor exe;
exe.RunW(graph);
+ DEBTRACE(((OutputToyPort*)n2->getOutputPort("o1"))->get()->getDoubleValue());
CPPUNIT_ASSERT_DOUBLES_EQUAL( ((OutputToyPort*)n2->getOutputPort("o1"))->get()->getDoubleValue(),19.397, DBL_PRECISION_COMPARE);
+ DEBTRACE(loop->getNbOfTurns());
CPPUNIT_ASSERT_EQUAL(loop->getNbOfTurns(),3);
+ DEBTRACE(loop->getState());
CPPUNIT_ASSERT_EQUAL(loop->getState(),YACS::DONE);
+ DEBTRACE(graph->getState());
CPPUNIT_ASSERT_EQUAL(graph->getState(),YACS::DONE);
exe.RunW(graph);
+ DEBTRACE(((OutputToyPort*)n2->getOutputPort("o1"))->get()->getDoubleValue());
CPPUNIT_ASSERT_DOUBLES_EQUAL( ((OutputToyPort*)n2->getOutputPort("o1"))->get()->getDoubleValue(),19.397, DBL_PRECISION_COMPARE);
+ DEBTRACE(loop->getNbOfTurns());
CPPUNIT_ASSERT_EQUAL(loop->getNbOfTurns(),3);
+ DEBTRACE(loop->getState());
CPPUNIT_ASSERT_EQUAL(loop->getState(),YACS::DONE);
+ DEBTRACE(graph->getState());
CPPUNIT_ASSERT_EQUAL(graph->getState(),YACS::DONE);
Bloc *clonedGraph=(Bloc *)graph->clone(0);
delete graph;
Executor exe2;
clonedGraph->checkConsistency(info);
+ DEBTRACE(info.areWarningsOrErrors());
CPPUNIT_ASSERT(!info.areWarningsOrErrors());
exe2.RunW(clonedGraph);
+ DEBTRACE(((OutputToyPort*)clonedGraph->getOutputPort("toto.titi.T2.o1"))->get()->getDoubleValue());
CPPUNIT_ASSERT_DOUBLES_EQUAL( ((OutputToyPort*)clonedGraph->getOutputPort("toto.titi.T2.o1"))->get()->getDoubleValue(),19.397, DBL_PRECISION_COMPARE);
+ DEBTRACE(((Loop *)clonedGraph->getChildByName("toto"))->getNbOfTurns());
CPPUNIT_ASSERT_EQUAL(((Loop *)clonedGraph->getChildByName("toto"))->getNbOfTurns(),3);
+ DEBTRACE(clonedGraph->getChildByName("toto")->getState());
CPPUNIT_ASSERT_EQUAL(clonedGraph->getChildByName("toto")->getState(),YACS::DONE);
+ DEBTRACE(clonedGraph->getState());
CPPUNIT_ASSERT_EQUAL(clonedGraph->getState(),YACS::DONE);
delete clonedGraph;
}
graph->edAddCFLink(n1,loop);
graph->edAddLink(o21,i21);
graph->checkConsistency(info);
+ DEBTRACE(info.areWarningsOrErrors());
CPPUNIT_ASSERT(!info.areWarningsOrErrors());
Executor exe;
exe.RunW(graph);
+ DEBTRACE(((OutputToyPort*)n2->getOutputPort("o1"))->get()->getDoubleValue());
CPPUNIT_ASSERT_DOUBLES_EQUAL( ((OutputToyPort*)n2->getOutputPort("o1"))->get()->getDoubleValue(),19.397, DBL_PRECISION_COMPARE);
+ DEBTRACE(loop->getNbOfTurns());
CPPUNIT_ASSERT_EQUAL(loop->getNbOfTurns(),3);
+ DEBTRACE(loop->getState());
CPPUNIT_ASSERT_EQUAL(loop->getState(),YACS::DONE);
CPPUNIT_ASSERT_EQUAL(graph->getState(),YACS::DONE);
graph->checkConsistency(info);
graph->edAddLink(o1,i2);
graph->edAddLink(n1->edGetNbOfInputsOutputPort(),opt->edGetPortForOutPool());
opt->edGetNbOfBranchesPort()->edInit(2);
- opt->edGetPortForInitFile()->edInit("toto");
+ opt->edGetAlgoInitPort()->edInit("toto");
Executor exe;
graph->checkConsistency(info);
CPPUNIT_ASSERT(!info.areWarningsOrErrors());
graph->edAddLink(o1,i2);
graph->edAddLink(n1->edGetNbOfInputsOutputPort(),opt->edGetPortForOutPool());
opt->edGetNbOfBranchesPort()->edInit(2);
- opt->edGetPortForInitFile()->edInit("toto");
+ opt->edGetAlgoInitPort()->edInit("toto");
Executor exe;
graph->checkConsistency(info);
CPPUNIT_ASSERT(!info.areWarningsOrErrors());
CPPUNIT_ASSERT(1==info.getNumberOfErrLinks(E_UNCOMPLETE_SW));
delete graph;
}
+
+void EngineIntegrationTest::testRemoveRuntime()
+{
+ Runtime* r=YACS::ENGINE::getRuntime();
+ delete r;
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __ENGINEINTEGRATIONTEST_HXX__
#define __ENGINEINTEGRATIONTEST_HXX__
CPPUNIT_TEST( testForCheckConsistency2 );
CPPUNIT_TEST( testForCheckConsistency3 );
CPPUNIT_TEST( testForCheckConsistency4 );
+ CPPUNIT_TEST( testRemoveRuntime );
CPPUNIT_TEST_SUITE_END();
public:
void setUp();
void testForCheckConsistency2();
void testForCheckConsistency3();
void testForCheckConsistency4();
+ void testRemoveRuntime();
protected:
template<class T>
static void checkListsEqual(const std::list<T>& setToTest1, const std::list<T>& setToTest2);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// --- include from engine first, to avoid redifinition warning _POSIX_C_SOURCE
//
#include "Bloc.hxx"
#include <string>
#include <list>
#include <vector>
+#include <string.h>
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _ENGINETEST_HXX_
#define _ENGINETEST_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeCode.hxx"
#include <sstream>
#include <iostream>
return AtomAny::getOrBuildFromData(data,this);
}
-const char * TypeCode::name() const throw(Exception)
+const char * TypeCode::name() const throw(YACS::Exception)
{
//throw Exception("No name");
return id();
return id();
}
-const char * TypeCode::id() const throw(Exception)
+const char * TypeCode::id() const throw(YACS::Exception)
{
switch(_kind)
{
}
}
-int TypeCode::isA(const char* id) const throw(Exception)
+int TypeCode::isA(const char* id) const throw(YACS::Exception)
{
throw Exception("Not implemented for this type");
}
}
}
-const TypeCode * TypeCode::contentType() const throw(Exception)
+const TypeCode * TypeCode::contentType() const throw(YACS::Exception)
{
throw Exception("No content type");
};
typname="seq"+std::string(content->name());
name=typname.c_str();
}
+ if(std::string(id)=="")
+ id=name;
return new TypeCodeSeq(id, name,content);
};
//! static factory of struct type given an id and a name
throw Exception("Not implemented yet : YACS::Any for objs ref");
}
-const char * TypeCodeObjref::id() const throw(Exception)
+const char * TypeCodeObjref::id() const throw(YACS::Exception)
{
return _repoId.c_str();
};
-const char * TypeCodeObjref::name() const throw(Exception)
+const char * TypeCodeObjref::name() const throw(YACS::Exception)
{
return _name.c_str();
}
* \param id : a given id
* \return 1 if true, 0 if false
*/
-int TypeCodeObjref::isA(const char* id) const throw(Exception)
+int TypeCodeObjref::isA(const char* id) const throw(YACS::Exception)
{
if(_repoId == id)return 1;
list<TypeCodeObjref *>::const_iterator iter;
return SequenceAny::getOrBuildFromData(data,this);
}
-const char * TypeCodeSeq::id() const throw(Exception)
+const char * TypeCodeSeq::id() const throw(YACS::Exception)
{
return _repoId.c_str();
}
-const char * TypeCodeSeq::name() const throw(Exception)
+const char * TypeCodeSeq::name() const throw(YACS::Exception)
{
return _name.c_str();
}
return _shortName.c_str();
}
-const TypeCode * TypeCodeSeq::contentType() const throw(Exception)
+const TypeCode * TypeCodeSeq::contentType() const throw(YACS::Exception)
{
return _content;
}
* \param repositoryId : the given id
* \param name : the given name
* \param content : the given contained TypeCode
+ * \param staticLgth : the length
*/
TypeCodeArray::TypeCodeArray(const char* repositoryId,
const char* name,
return ArrayAny::getOrBuildFromData(data,this);
}
-const char * TypeCodeArray::id() const throw(Exception)
+const char * TypeCodeArray::id() const throw(YACS::Exception)
{
return _repoId.c_str();
}
-const char * TypeCodeArray::name() const throw(Exception)
+const char * TypeCodeArray::name() const throw(YACS::Exception)
{
return _name.c_str();
}
return _staticLgth;
}
-const TypeCode * TypeCodeArray::contentType() const throw(Exception)
+const TypeCode * TypeCodeArray::contentType() const throw(YACS::Exception)
{
return _content;
}
TypeCodeStruct::~TypeCodeStruct()
{
+ for(vector< pair<string,TypeCode*> >::iterator iter=_members.begin();iter!=_members.end();iter++)
+ (*iter).second->decrRef();
}
TypeCode *TypeCodeStruct::clone() const
return StructAny::getOrBuildFromData(data,this);
}
-const char * TypeCodeStruct::id() const throw(Exception)
+const char * TypeCodeStruct::id() const throw(YACS::Exception)
{
return _repoId.c_str();
};
-const char * TypeCodeStruct::name() const throw(Exception)
+const char * TypeCodeStruct::name() const throw(YACS::Exception)
{
return _name.c_str();
}
return ret;
}
-const TypeCode *TypeCodeStruct::contentType() const throw(Exception)
+const TypeCode *TypeCodeStruct::contentType() const throw(YACS::Exception)
{
const char what[]="Content type is specified by giving a key.";
throw Exception(what);
* \param id : a given id
* \return 1 if true, 0 if false
*/
-int TypeCodeStruct::isA(const char* id) const throw(Exception)
+int TypeCodeStruct::isA(const char* id) const throw(YACS::Exception)
{
if(_repoId == id)return 1;
return 0;
throw Exception("Struct member " + name + " already defined");
}
_members.push_back(std::pair<std::string,TypeCode*>(name,tc));
+ tc->incrRef();
}
+//! Get typecode of struct member given its name
/*!
* If name is not an existing key, 0 is returned.
+ * \param name : the member name
* \param offset : Out parameter, that specified the location of start of data discriminated by name key.
+ * \return the member TypeCode
*/
const TypeCode *TypeCodeStruct::getMember(const std::string& name, unsigned& offset) const
{
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __TYPECODE_HXX__
#define __TYPECODE_HXX__
+#include "YACSlibEngineExport.hxx"
#include "RefCounter.hxx"
#include "Exception.hxx"
#include "Any.hxx"
* \see TypeCodeStruct
* \see TypeCodeArray
*/
- class TypeCode : public RefCounter
+ class YACSLIBENGINE_EXPORT TypeCode : public RefCounter
{
public:
TypeCode(DynType kind);
static const char *KIND_STR_REPR [];
};
- class TypeCodeComposed : public TypeCode
+ class YACSLIBENGINE_EXPORT TypeCodeComposed : public TypeCode
{
protected:
TypeCodeComposed(const TypeCodeComposed& other);
* \ingroup TypeCodes
*
*/
- class TypeCodeObjref : public TypeCodeComposed
+ class YACSLIBENGINE_EXPORT TypeCodeObjref : public TypeCodeComposed
{
friend class Visitor;
public:
* \ingroup TypeCodes
*
*/
- class TypeCodeSeq: public TypeCodeComposed
+ class YACSLIBENGINE_EXPORT TypeCodeSeq: public TypeCodeComposed
{
public:
TypeCodeSeq(const char* repositoryId, const char* name, const TypeCode *content);
* \ingroup TypeCodes
*
*/
- class TypeCodeArray : public TypeCodeComposed
+ class YACSLIBENGINE_EXPORT TypeCodeArray : public TypeCodeComposed
{
public:
TypeCodeArray(const char* repositoryId, const char* name, const TypeCode *content, unsigned staticLgth);
* \ingroup TypeCodes
*
*/
- class TypeCodeStruct : public TypeCodeComposed
+ class YACSLIBENGINE_EXPORT TypeCodeStruct : public TypeCodeComposed
{
friend class StructAny;//Access to _members attribute.
public:
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Visitor.hxx"
#include "Node.hxx"
#include "Proc.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __VISITOR_HXX__
#define __VISITOR_HXX__
class ElementaryNode;
class ComposedNode;
class ForEachLoop;
+ class OptimizerLoop;
+ class DynParaLoop;
class InlineNode;
class InlineFuncNode;
class Loop;
class ForLoop;
class Proc;
class ServiceNode;
+ class ServerNode;
class ServiceInlineNode;
class DataNode;
class Switch;
virtual void visitBloc(Bloc *node) = 0;
virtual void visitElementaryNode(ElementaryNode *node) = 0;
virtual void visitForEachLoop(ForEachLoop *node) = 0;
+ virtual void visitOptimizerLoop(OptimizerLoop *node) = 0;
+ virtual void visitDynParaLoop(DynParaLoop *node) = 0;
virtual void visitForLoop(ForLoop *node) = 0;
virtual void visitInlineNode(InlineNode *node) = 0;
virtual void visitInlineFuncNode(InlineFuncNode *node) = 0;
virtual void visitLoop(Loop *node) = 0;
virtual void visitProc(Proc *node) = 0;
virtual void visitServiceNode(ServiceNode *node) = 0;
+ virtual void visitServerNode(ServerNode *node) = 0;
virtual void visitServiceInlineNode(ServiceInlineNode *node) = 0;
virtual void visitSwitch(Switch *node) = 0;
virtual void visitWhileLoop(WhileLoop *node) = 0;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "VisitorSaveSchema.hxx"
#include "ElementaryNode.hxx"
#include "InlineNode.hxx"
#include "ServiceNode.hxx"
+#include "ServerNode.hxx"
#include "ServiceInlineNode.hxx"
#include "Bloc.hxx"
#include "Proc.hxx"
#include "ForEachLoop.hxx"
+#include "OptimizerLoop.hxx"
#include "Loop.hxx"
#include "ForLoop.hxx"
#include "WhileLoop.hxx"
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
+/*! \class YACS::ENGINE::VisitorSaveSchema
+ * \brief Base class for all visitors that save a schema.
+ *
+ * Can be specialized in runtime.
+ */
+
VisitorSaveSchema::VisitorSaveSchema(ComposedNode *root): _root(root), Visitor(root)
{
}
}
}
-void VisitorSaveSchema::openFileSchema(std::string xmlSchema) throw(Exception)
+void VisitorSaveSchema::openFileSchema(std::string xmlSchema) throw(YACS::Exception)
{
_out.open(xmlSchema.c_str(), ios::out);
if (!_out)
string what = "Impossible to open file for writing: " + xmlSchema;
throw Exception(what);
}
- _out << "<?xml version='1.0'?>" << endl;
- _out << "<proc>" << endl;
+ _out << "<?xml version='1.0' encoding='iso-8859-1' ?>" << endl;
}
void VisitorSaveSchema::closeFileSchema()
_out << ">" << endl;
writeProperties(node);
- node->ComposedNode::accept(this);
+ node->DynParaLoop::accept(this);
writeSimpleDataLinks(node);
writeSimpleStreamLinks(node);
_out << indent(depth) << "</foreach>" << endl;
DEBTRACE("END visitForEachLoop " << _root->getChildName(node));
}
+void VisitorSaveSchema::visitOptimizerLoop(OptimizerLoop *node)
+{
+ DEBTRACE("START visitOptimizerLoop " << _root->getChildName(node));
+ beginCase(node);
+ int depth = depthNode(node);
+
+ _out << indent(depth) << "<optimizer name=\"" << node->getName() << "\"";
+ AnyInputPort *nbranch = static_cast<AnyInputPort*>(node->edGetNbOfBranchesPort());
+ if (node->getState() == YACS::DISABLED)
+ _out << " state=\"disabled\"";
+ if (!nbranch->isEmpty())
+ _out << " nbranch=\"" << nbranch->getIntValue() << "\"";
+ _out << " lib=\"" << node->getAlgLib() << "\"";
+ _out << " entry=\"" << node->getSymbol() << "\"";
+ _out << ">" << endl;
+
+ writeProperties(node);
+ node->DynParaLoop::accept(this);
+ writeSimpleDataLinks(node);
+ writeSimpleStreamLinks(node);
+ _out << indent(depth) << "</optimizer>" << endl;
+ endCase(node);
+ DEBTRACE("END visitOptimizerLoop " << _root->getChildName(node));
+}
+
+void VisitorSaveSchema::visitDynParaLoop(DynParaLoop *node)
+{
+ DEBTRACE("START visitDynParaLoop " << _root->getChildName(node));
+ int depth = depthNode(node);
+ if (node->getInitNode() != NULL)
+ {
+ _out << indent(depth+1) << "<initnode>" << endl;
+ node->getInitNode()->accept(this);
+ _out << indent(depth+1) << "</initnode>" << endl;
+ }
+ if (node->getExecNode() != NULL)
+ {
+ node->getExecNode()->accept(this);
+ }
+ if (node->getFinalizeNode() != NULL)
+ {
+ _out << indent(depth+1) << "<finalizenode>" << endl;
+ node->getFinalizeNode()->accept(this);
+ _out << indent(depth+1) << "</finalizenode>" << endl;
+ }
+ DEBTRACE("END visitDynParaLoop " << _root->getChildName(node));
+}
+
void VisitorSaveSchema::visitForLoop(ForLoop *node)
{
DEBTRACE("START visitForLoop " << _root->getChildName(node));
DEBTRACE("START visitInlineNode " << _root->getChildName(node));
beginCase(node);
int depth = depthNode(node);
- _out << indent(depth) << "<inline name=\"" << node->getName() << "\"";
+ if(node->getExecutionMode()=="local")
+ _out << indent(depth) << "<inline name=\"" << node->getName() << "\"";
+ else
+ _out << indent(depth) << "<remote name=\"" << node->getName() << "\"";
if (node->getState() == YACS::DISABLED)
_out << " state=\"disabled\">" << endl;
else
_out << indent(depth+1) << "<script><code><![CDATA[";
_out << node->getScript();
_out << "]]></code></script>" << endl;
+
+ //add load container if node is remote
+ Container *cont = node->getContainer();
+ if (cont)
+ _out << indent(depth+1) << "<load container=\"" << cont->getName() << "\"/>" << endl;
+
writeProperties(node);
writeInputPorts(node);
writeInputDataStreamPorts(node);
writeOutputPorts(node);
writeOutputDataStreamPorts(node);
- _out << indent(depth) << "</inline>" << endl;
+
+ if(node->getExecutionMode()=="local")
+ _out << indent(depth) << "</inline>" << endl;
+ else
+ _out << indent(depth) << "</remote>" << endl;
+
endCase(node);
DEBTRACE("END visitInlineNode " << _root->getChildName(node));
}
DEBTRACE("START visitInlineFuncNode " << _root->getChildName(node));
beginCase(node);
int depth = depthNode(node);
- _out << indent(depth) << "<inline name=\"" << node->getName() << "\"";
+ if(node->getExecutionMode()=="local")
+ _out << indent(depth) << "<inline name=\"" << node->getName() << "\"";
+ else
+ _out << indent(depth) << "<remote name=\"" << node->getName() << "\"";
if (node->getState() == YACS::DISABLED)
_out << " state=\"disabled\">" << endl;
else
_out << node->getScript();
_out << "]]></code>" << endl;
_out << indent(depth+1) << "</function>" << endl;
+
+ //add load container if node is remote
+ Container *cont = node->getContainer();
+ if (cont)
+ _out << indent(depth+1) << "<load container=\"" << cont->getName() << "\"/>" << endl;
+
writeProperties(node);
writeInputPorts(node);
writeInputDataStreamPorts(node);
writeOutputPorts(node);
writeOutputDataStreamPorts(node);
- _out << indent(depth) << "</inline>" << endl;
+
+ if(node->getExecutionMode()=="local")
+ _out << indent(depth) << "</inline>" << endl;
+ else
+ _out << indent(depth) << "</remote>" << endl;
+
endCase(node);
DEBTRACE("END visitInlineFuncNode " << _root->getChildName(node));
}
void VisitorSaveSchema::visitProc(Proc *node)
{
DEBTRACE("START visitProc " << node->getName());
+ _out << "<proc name=\""<< node->getName() << "\">" << endl;
beginCase(node);
writeProperties(node);
writeTypeCodes(node);
writeContainers(node);
+ writeComponentInstances(node);
node->ComposedNode::accept(this);
writeControls(node);
writeSimpleDataLinks(node);
else
{
ComponentInstance *compo = node->getComponent();
- if (compo && (_componentInstanceMap.find(compo) == _componentInstanceMap.end()))
+ if (compo && !compo->isAnonymous())
+ {
+ _out << indent(depth+1) << "<componentinstance>" << compo->getInstanceName() << "</componentinstance>" << endl;
+ }
+ else if (compo && (_componentInstanceMap.find(compo) == _componentInstanceMap.end()))
{
_out << indent(depth+1) << compo->getFileRepr() << endl;
_componentInstanceMap[compo] = _root->getChildName(node);
_out << indent(depth+1) << "<load container=\"" << it->first << "\"/>" << endl;
}
}
- else
+ else if(compo)
{
_out << indent(depth+1) << "<node>" << _componentInstanceMap[compo] << "</node>" << endl;
}
+ else
+ {
+ _out << indent(depth+1) << "<component>" << "UNKNOWN" << "</component>" << endl;
+ }
}
_out << indent(depth+1) << "<method>" << node->getMethod() << "</method>" << endl;
DEBTRACE("END visitServiceNode " << _root->getChildName(node));
}
+void VisitorSaveSchema::visitServerNode(ServerNode *node)
+{
+ DEBTRACE("START visitServerNode " << _root->getChildName(node));
+ beginCase(node);
+ int depth = depthNode(node);
+ _out << indent(depth) << "<server name=\"" << node->getName() << "\"";
+ if (node->getState() == YACS::DISABLED)
+ _out << " state=\"disabled\">" << endl;
+ else
+ _out << ">" << endl;
+ Container *cont = node->getContainer();
+ map<string, Container*>::const_iterator it;
+ for (it = _containerMap.begin(); it != _containerMap.end(); ++it)
+ {
+ if (it->second == cont) break;
+ }
+ if (it != _containerMap.end())
+ _out << indent(depth+1) << "<loadcontainer>" << it->first << "</loadcontainer>" << endl;
+ /*else
+ {
+ _out << indent(depth+1) << "<node>" << _contnentInstanceMap[cont] << "</node>" << endl;
+ }*/
+ _out << indent(depth+1) << "<method>" << node->getFname() << "</method>" << endl;
+ _out << indent(depth+2) << "<script><code><![CDATA[";
+ _out << node->getScript();
+ _out << "]]></code></script>" << endl;
+ //_out << indent(depth+1) << "</function>" << endl;
+ writeProperties(node);
+ writeInputPorts(node);
+ writeInputDataStreamPorts(node);
+ writeOutputPorts(node);
+ writeOutputDataStreamPorts(node);
+ _out << indent(depth) << "</server>" << endl;
+ endCase(node);
+ DEBTRACE("END visitServerNode " << _root->getChildName(node));
+}
+
void VisitorSaveSchema::visitServiceInlineNode(ServiceInlineNode *node)
{
DEBTRACE("START visitServiceInlineNode " << _root->getChildName(node));
}
}
-void VisitorSaveSchema::dumpTypeCode(TypeCode* type, set<string>& typeNames,map<string, TypeCode*>& typeMap,int depth)
+void VisitorSaveSchema::dumpTypeCode(TypeCode* type, std::set<std::string>& typeNames,std::map<std::string, TypeCode*>& typeMap,int depth)
{
DynType kind = type->kind();
string typeName = type->name();
case YACS::ENGINE::Struct:
{
TypeCodeStruct* tcStruct = dynamic_cast<TypeCodeStruct*>(type);
- assert(tcStruct);
+ YASSERT(tcStruct);
int mbCnt = tcStruct->memberCount();
for (int i=0; i<mbCnt; i++)
{
}
}
+void VisitorSaveSchema::writeComponentInstances(Proc *proc)
+{
+ int depth = depthNode(proc)+1;
+ std::map<std::string, ComponentInstance*>::const_iterator it;
+ for (it = proc->componentInstanceMap.begin(); it != proc->componentInstanceMap.end(); it++)
+ {
+ string name = it->first;
+ ComponentInstance* inst=it->second;
+ if(!inst->isAnonymous())
+ {
+ _out << indent(depth) << "<componentinstance name=\"" << inst->getInstanceName() << "\">" << endl;
+ _out << indent(depth+1) << "<component>" << inst->getCompoName() << "</component>" << endl;
+
+ Container *cont = inst->getContainer();
+ if (cont)
+ _out << indent(depth+1) << "<load container=\"" << cont->getName() << "\"/>" << endl;
+
+ std::map<std::string, std::string> properties = inst->getProperties();
+ std::map<std::string, std::string>::const_iterator itm;
+ for(itm = properties.begin(); itm != properties.end(); ++itm)
+ _out << indent(depth+1) << "<property name=\"" << (*itm).first
+ << "\" value=\"" << (*itm).second << "\"/>" << endl;
+
+ _out << indent(depth) << "</componentinstance>" << endl;
+ }
+ }
+}
+
void VisitorSaveSchema::writeContainers(Proc *proc)
{
int depth = depthNode(proc)+1;
list<InputDataStreamPort*> listOfInputPorts = node->getSetOfInputDataStreamPort();
for (list<InputDataStreamPort*>::iterator it = listOfInputPorts.begin(); it != listOfInputPorts.end(); ++it)
{
- std::map<std::string,std::string> aPropMap = (*it)->getPropertyMap();
+ std::map<std::string,std::string> aPropMap = (*it)->getProperties();
if ( aPropMap.empty() )
- _out << indent(depth) << "<instream name=\"" << (*it)->getName() << "\" type=\""
- << (*it)->edGetType()->name() << "\"/>" << endl;
+ _out << indent(depth) << "<instream name=\"" << (*it)->getName() << "\" type=\""
+ << (*it)->edGetType()->name() << "\"/>" << endl;
else
- {
- _out << indent(depth) << "<instream name=\"" << (*it)->getName() << "\" type=\""
- << (*it)->edGetType()->name() << "\">" << endl;
- for (std::map<std::string,std::string>::iterator itP = aPropMap.begin(); itP != aPropMap.end(); itP++)
- _out << indent(depth+1) << "<property name=\"" << (*itP).first << "\" value=\""
- << (*itP).second << "\"/>" << endl;
- _out << indent(depth) << "</instream>" << endl;
- }
+ {
+ _out << indent(depth) << "<instream name=\"" << (*it)->getName() << "\" type=\""
+ << (*it)->edGetType()->name() << "\">" << endl;
+ for (std::map<std::string,std::string>::iterator itP = aPropMap.begin(); itP != aPropMap.end(); itP++)
+ _out << indent(depth+1) << "<property name=\"" << (*itP).first << "\" value=\""
+ << (*itP).second << "\"/>" << endl;
+ _out << indent(depth) << "</instream>" << endl;
+ }
}
}
list<OutputDataStreamPort*> listOfOutputPorts = node->getSetOfOutputDataStreamPort();
for (list<OutputDataStreamPort*>::iterator it = listOfOutputPorts.begin(); it != listOfOutputPorts.end(); ++it)
{
- std::map<std::string,std::string> aPropMap = (*it)->getPropertyMap();
+ std::map<std::string,std::string> aPropMap = (*it)->getProperties();
if ( aPropMap.empty() )
- _out << indent(depth) << "<outstream name=\"" << (*it)->getName() << "\" type=\""
- << (*it)->edGetType()->name() << "\"/>" << endl;
+ _out << indent(depth) << "<outstream name=\"" << (*it)->getName() << "\" type=\""
+ << (*it)->edGetType()->name() << "\"/>" << endl;
else
- {
- _out << indent(depth) << "<outstream name=\"" << (*it)->getName() << "\" type=\""
- << (*it)->edGetType()->name() << "\">" << endl;
- for (std::map<std::string,std::string>::iterator itP = aPropMap.begin(); itP != aPropMap.end(); itP++)
- _out << indent(depth+1) << "<property name=\"" << (*itP).first << "\" value=\""
- << (*itP).second << "\"/>" << endl;
- _out << indent(depth) << "</outstream>" << endl;
- }
+ {
+ _out << indent(depth) << "<outstream name=\"" << (*it)->getName() << "\" type=\""
+ << (*it)->edGetType()->name() << "\">" << endl;
+ for (std::map<std::string,std::string>::iterator itP = aPropMap.begin(); itP != aPropMap.end(); itP++)
+ _out << indent(depth+1) << "<property name=\"" << (*itP).first << "\" value=\""
+ << (*itP).second << "\"/>" << endl;
+ _out << indent(depth) << "</outstream>" << endl;
+ }
}
}
{
DEBTRACE( "BINGO!" );
- string fromName;
- if ( dynamic_cast<SplitterNode*>(from) && dynamic_cast<ForEachLoop*>(from->getFather()) )
- fromName = from->getFather()->getName();
- else
- fromName = node->getChildName(from);
-
- string childName;
- if ( dynamic_cast<SplitterNode*>(to) && dynamic_cast<ForEachLoop*>(to->getFather()) )
- childName = node->getChildName(to->getFather());
- else
- childName = node->getChildName(to);
+ string fromName;
+ if ( dynamic_cast<SplitterNode*>(from) && dynamic_cast<ForEachLoop*>(from->getFather()) )
+ fromName = from->getFather()->getName();
+ else
+ fromName = node->getChildName(from);
+
+ string childName;
+ if ( dynamic_cast<SplitterNode*>(to) && dynamic_cast<ForEachLoop*>(to->getFather()) )
+ childName = node->getChildName(to->getFather());
+ else
+ childName = node->getChildName(to);
_out << indent(depth) << "<datalink control=\"false\">" << endl;
_out << indent(depth+1) << "<fromnode>" << fromName << "</fromnode> ";
_out << "<fromport>" << anOP->getName() << "</fromport>" << endl;
_out << indent(depth+1) << "<tonode>" << childName << "</tonode> ";
_out << "<toport>" << anIP->getName() << "</toport>" << endl;
- std::map<std::string,std::string> aPropMap = anOP->getPropertyMap();
- for (std::map<std::string,std::string>::iterator itP = aPropMap.begin(); itP != aPropMap.end(); itP++)
+ std::map<std::string,std::string> aPropMap = dynamic_cast<InputDataStreamPort*>(anIP)->getProperties();
+ for (std::map<std::string,std::string>::iterator itP = aPropMap.begin(); itP != aPropMap.end(); itP++)
{
string notAlinkProperty = "DependencyType";
if (notAlinkProperty != (*itP).first)
<< (*itP).second << "\"/>" << endl;
}
_out << indent(depth) << "</stream>" << endl;
- }
+ }
else
{ // --- store info to create the link later, given the input port
DEBTRACE("For later" );
_mapOfSLtoCreate.insert(make_pair(anIP->getNumId(), aLink));
}
}
- }
+ }
}
// --- second pass, retreive links where the output port is inside the scope.
_out << indent(depth+1) << "<tonode>" << node->getChildName(to) << "</tonode> ";
_out << "<toport>" << anIP->getName() << "</toport>" << endl;
- std::map<std::string,std::string> aPropMap = anOP->getPropertyMap();
- for (std::map<std::string,std::string>::iterator itP = aPropMap.begin(); itP != aPropMap.end(); itP++)
- _out << indent(depth+1) << "<property name=\"" << (*itP).first << "\" value=\""
- << (*itP).second << "\"/>" << endl;
+ std::map<std::string,std::string> aPropMap = dynamic_cast<InputDataStreamPort*>(anIP)->getProperties();
+ for (std::map<std::string,std::string>::iterator itP = aPropMap.begin(); itP != aPropMap.end(); itP++)
+ _out << indent(depth+1) << "<property name=\"" << (*itP).first << "\" value=\""
+ << (*itP).second << "\"/>" << endl;
_out << indent(depth) << "</stream>" << endl;
}
SchemaSave::SchemaSave(Proc* proc): _p(proc)
{
- assert(_p);
+ YASSERT(_p);
}
void SchemaSave::save(std::string xmlSchemaFile)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __VISITOR_SAVESCHEMA_HXX__
#define __VISITOR_SAVESCHEMA_HXX__
+#include "YACSlibEngineExport.hxx"
#include "Visitor.hxx"
#include "Exception.hxx"
bool toDelete;
};
- class VisitorSaveSchema: public Visitor
+ class YACSLIBENGINE_EXPORT VisitorSaveSchema: public Visitor
{
public:
VisitorSaveSchema(ComposedNode *root);
virtual void visitBloc(Bloc *node);
virtual void visitElementaryNode(ElementaryNode *node);
virtual void visitForEachLoop(ForEachLoop *node);
+ virtual void visitOptimizerLoop(OptimizerLoop *node);
+ virtual void visitDynParaLoop(DynParaLoop *node);
virtual void visitForLoop(ForLoop *node);
virtual void visitInlineNode(InlineNode *node);
virtual void visitInlineFuncNode(InlineFuncNode *node);
virtual void visitLoop(Loop *node);
virtual void visitProc(Proc *node);
virtual void visitServiceNode(ServiceNode *node);
+ virtual void visitServerNode(ServerNode *node);
virtual void visitServiceInlineNode(ServiceInlineNode *node);
virtual void visitSwitch(Switch *node);
virtual void visitWhileLoop(WhileLoop *node);
virtual void dumpTypeCode(TypeCode* type, std::set<std::string>& typeNames,std::map<std::string, TypeCode*>& typeMap,int depth);
virtual void writeTypeCodes(Proc *proc);
virtual void writeContainers(Proc *proc);
+ virtual void writeComponentInstances(Proc *proc);
virtual void writeInputPorts(Node *node);
virtual void writeInputDataStreamPorts(Node *node); // OCC : mkr : add possibility to write input data stream ports
virtual void writeOutputPorts(Node *node);
std::multimap<int, StreamLinkInfo> _mapOfSLtoCreate;
};
- class SchemaSave
+ class YACSLIBENGINE_EXPORT SchemaSave
{
public:
SchemaSave(Proc* proc);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "ElementaryNode.hxx"
#include "Bloc.hxx"
#include "Proc.hxx"
#include "ForEachLoop.hxx"
+#include "OptimizerLoop.hxx"
#include "Loop.hxx"
#include "ForLoop.hxx"
#include "WhileLoop.hxx"
#include "InputPort.hxx"
#include "InlineNode.hxx"
#include "ServiceNode.hxx"
+#include "ServerNode.hxx"
#include "ServiceInlineNode.hxx"
#include "DataNode.hxx"
}
}
-void VisitorSaveState::openFileDump(std::string xmlDump) throw(Exception)
+void VisitorSaveState::openFileDump(std::string xmlDump) throw(YACS::Exception)
{
_out.open(xmlDump.c_str(), ios::out);
if (!_out)
_out << " </node>" << endl;
}
+void VisitorSaveState::visitOptimizerLoop(OptimizerLoop *node)
+{
+ node->ComposedNode::accept(this);
+ if (!_out) throw Exception("No file open for dump state");
+ string name = _root->getName();
+ if (static_cast<ComposedNode*>(node) != _root) name = _root->getChildName(node);
+ DEBTRACE("VisitorSaveState::visitOptimizerLoop ------ " << name);
+ _out << " <node type='optimizerLoop'>" << endl;
+ _out << " <name>" << name << "</name>" << endl;
+ _out << " <state>" << _nodeStateName[node->getState()] << "</state>" << endl;
+
+ _out << " </node>" << endl;
+}
+
+void VisitorSaveState::visitDynParaLoop(DynParaLoop *node)
+{
+ node->ComposedNode::accept(this);
+}
+
void VisitorSaveState::visitLoop(Loop *node)
{
node->ComposedNode::accept(this);
visitElementaryNode(node);
}
+void VisitorSaveState::visitServerNode(ServerNode *node)
+{
+ visitElementaryNode(node);
+}
void VisitorSaveState::visitServiceInlineNode(ServiceInlineNode *node)
{
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __VISITOR_SAVESTATE_HXX__
#define __VISITOR_SAVESTATE_HXX__
+#include "YACSlibEngineExport.hxx"
#include "Visitor.hxx"
#include "Exception.hxx"
{
namespace ENGINE
{
- class VisitorSaveState: public Visitor
+ class YACSLIBENGINE_EXPORT VisitorSaveState: public Visitor
{
public:
VisitorSaveState(ComposedNode *root);
virtual void visitBloc(Bloc *node);
virtual void visitElementaryNode(ElementaryNode *node);
virtual void visitForEachLoop(ForEachLoop *node);
+ virtual void visitOptimizerLoop(OptimizerLoop *node);
+ virtual void visitDynParaLoop(DynParaLoop *node);
virtual void visitForLoop(ForLoop *node);
virtual void visitInlineNode(InlineNode *node);
virtual void visitInlineFuncNode(InlineFuncNode *node);
virtual void visitLoop(Loop *node);
virtual void visitProc(Proc *node);
virtual void visitServiceNode(ServiceNode *node);
+ virtual void visitServerNode(ServerNode *node);
virtual void visitServiceInlineNode(ServiceInlineNode *node);
virtual void visitSwitch(Switch *node);
virtual void visitWhileLoop(WhileLoop *node);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "WhileLoop.hxx"
#include "Runtime.hxx"
#include "OutputPort.hxx"
WhileLoop::WhileLoop(const WhileLoop& other, ComposedNode *father, bool editionOnly):Loop(other,father,editionOnly),
_conditionPort(other._conditionPort,this)
{
+ //Copy Data linking
+ std::vector< std::pair<OutPort *, InPort *> > linksToReproduce=other.getSetOfInternalLinks();
+ std::vector< std::pair<OutPort *, InPort *> >::iterator iter=linksToReproduce.begin();
+ for(;iter!=linksToReproduce.end();++iter)
+ {
+ OutPort* pout = iter->first;
+ InPort* pin = iter->second;
+ edAddLink(getOutPort(other.getPortName(pout)),getInPort(other.getPortName(pin)));
+ }
}
void WhileLoop::init(bool start)
return;
if(_inGate.exIsReady())
{
- setState(YACS::TOACTIVATE);
+ setState(YACS::ACTIVATED);
_node->exUpdateState();
if(_conditionPort.isLinkedOutOfScope())
if(_conditionPort.isEmpty())
return new WhileLoop(*this,father,editionOnly);
}
-InputPort *WhileLoop::getInputPort(const std::string& name) const throw(Exception)
+InputPort *WhileLoop::getInputPort(const std::string& name) const throw(YACS::Exception)
{
if(name==NAME_OF_INPUT_CONDITION)
return (InputPort*)&_conditionPort;
void WhileLoop::checkLinkPossibility(OutPort *start,
const std::list<ComposedNode *>& pointsOfViewStart,
InPort *end,
- const std::list<ComposedNode *>& pointsOfViewEnd) throw(Exception)
+ const std::list<ComposedNode *>& pointsOfViewEnd) throw(YACS::Exception)
{
DEBTRACE("WhileLoop::checkLinkPossibility");
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __WHILELOOP_HXX__
#define __WHILELOOP_HXX__
+#include "YACSlibEngineExport.hxx"
#include "Loop.hxx"
#include "ConditionInputPort.hxx"
* This node makes steps while the condition is true
*
*/
- class WhileLoop : public Loop
+ class YACSLIBENGINE_EXPORT WhileLoop : public Loop
{
protected:
static const char NAME_OF_INPUT_CONDITION[];
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _YACSLIBENGINEEXPORT_HXX_
+#define _YACSLIBENGINEEXPORT_HXX_
+
+#ifdef WNT
+# if defined YACSlibEngine_EXPORTS
+# define YACSLIBENGINE_EXPORT __declspec( dllexport )
+# else
+# define YACSLIBENGINE_EXPORT __declspec( dllimport )
+# endif
+#else
+# define YACSLIBENGINE_EXPORT
+#endif
+
+#ifdef WNT
+#pragma warning(disable:4251) // Warning DLL Interface ...
+#pragma warning(disable:4290) // Warning Exception ...
+#endif
+
+#endif
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-%include std_except.i
-%include std_string.i
-%include std_map.i
-%include std_list.i
-%include std_vector.i
-%include std_set.i
-
-// ----------------------------------------------------------------------------
-
-%{
-#include "yacsconfig.h"
-
-#ifdef OMNIORB
-#include <omniORB4/CORBA.h>
-
-//--- from omniORBpy.h (not present on Debian Sarge packages)
-struct omniORBPYAPI
-{
- PyObject* (*cxxObjRefToPyObjRef)(const CORBA::Object_ptr cxx_obj,
- CORBA::Boolean hold_lock);
- // Convert a C++ object reference to a Python object reference.
- // If <hold_lock> is true, caller holds the Python interpreter lock.
-
- CORBA::Object_ptr (*pyObjRefToCxxObjRef)(PyObject* py_obj,
- CORBA::Boolean hold_lock);
- // Convert a Python object reference to a C++ object reference.
- // Raises BAD_PARAM if the Python object is not an object reference.
- // If <hold_lock> is true, caller holds the Python interpreter lock.
-
- PyObject* (*handleCxxSystemException)(const CORBA::SystemException& ex);
- // Sets the Python exception state to reflect the given C++ system
- // exception. Always returns NULL. The caller must hold the Python
- // interpreter lock.
-};
-
-omniORBPYAPI* api;
-
-#define OMNIPY_CATCH_AND_HANDLE_SYSTEM_EXCEPTIONS \
-catch (const CORBA::SystemException& ex) { \
- return api->handleCxxSystemException(ex); \
-}
-#else
-#define OMNIPY_CATCH_AND_HANDLE_SYSTEM_EXCEPTIONS
-#endif
-
-#include "Node.hxx"
-#include "InlineNode.hxx"
-#include "ComposedNode.hxx"
-#include "ServiceNode.hxx"
-#include "ServiceInlineNode.hxx"
-#include "Proc.hxx"
-#include "Bloc.hxx"
-#include "ForLoop.hxx"
-#include "WhileLoop.hxx"
-#include "ForEachLoop.hxx"
-#include "Switch.hxx"
-#include "InputPort.hxx"
-#include "OutputPort.hxx"
-#include "InputDataStreamPort.hxx"
-#include "OutputDataStreamPort.hxx"
-#include "OptimizerLoop.hxx"
-
-class InterpreterUnlocker
-{
-public:
- InterpreterUnlocker()
- {
- _save = PyEval_SaveThread(); // allow Python threads to run
- }
- ~InterpreterUnlocker()
- {
- PyEval_RestoreThread(_save); // restore the thread state
- }
-private:
- PyThreadState *_save;
-};
-
-static PyObject* convertNode(YACS::ENGINE::Node* node,int owner=0)
-{
- if (!node)
- return SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__Node,owner);
- PyObject * ob;
- //should use $descriptor(YACS::ENGINE::Bloc *) and so on but $descriptor is not defined here
- // It is better to define a helper function to avoid code bloat
- // First try to find a swig type info by its mangled name
- std::string swigtypename="_p_"+node->typeName();
- swig_type_info *ret = SWIG_MangledTypeQuery(swigtypename.c_str());
- if (ret)
- ob=SWIG_NewPointerObj((void*)node,ret,owner);
- else
- {
- //typeName not known by swig. Try dynamic_cast on known classes
- //You must respect inheritance order in casting : Bloc before ComposedNode and so on
- if(dynamic_cast<YACS::ENGINE::Proc *>(node))
- ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__Proc,owner);
- else if(dynamic_cast<YACS::ENGINE::Bloc *>(node))
- ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__Bloc,owner);
- else if(dynamic_cast<YACS::ENGINE::ForLoop *>(node))
- ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__ForLoop,owner);
- else if(dynamic_cast<YACS::ENGINE::WhileLoop *>(node))
- ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__WhileLoop,owner);
- else if(dynamic_cast<YACS::ENGINE::ForEachLoop *>(node))
- ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__ForEachLoop,owner);
- else if(dynamic_cast<YACS::ENGINE::Switch *>(node))
- ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__Switch,owner);
- else if(dynamic_cast<YACS::ENGINE::ComposedNode *>(node))
- ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__ComposedNode,owner);
- else if(dynamic_cast<YACS::ENGINE::InlineFuncNode *>(node))
- ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__InlineFuncNode,owner);
- else if(dynamic_cast<YACS::ENGINE::InlineNode *>(node))
- ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__InlineNode,owner);
- else if(dynamic_cast<YACS::ENGINE::ServiceInlineNode *>(node))
- ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__ServiceInlineNode,owner);
- else if(dynamic_cast<YACS::ENGINE::ServiceNode *>(node))
- ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__ServiceNode,owner);
- else if(dynamic_cast<YACS::ENGINE::ElementaryNode *>(node))
- ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__ElementaryNode,owner);
- else
- ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__Node,owner);
- }
- return ob;
-}
-
-static PyObject* convertPort(YACS::ENGINE::Port* port,int owner=0)
-{
- if(!port)
- return SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__Port, owner);
- PyObject * ob;
- std::string swigtypename="_p_"+port->typeName();
- swig_type_info *ret = SWIG_MangledTypeQuery(swigtypename.c_str());
- if (ret)
- {
- YACS::ENGINE::InputPort *inport = dynamic_cast<YACS::ENGINE::InputPort *>(port);
- if(inport)
- return SWIG_NewPointerObj((void*)inport,ret,owner);
-
- YACS::ENGINE::OutputPort *outport = dynamic_cast<YACS::ENGINE::OutputPort *>(port);
- if(outport)
- return SWIG_NewPointerObj((void*)outport,ret,owner);
-
- YACS::ENGINE::InputDataStreamPort *indsport = dynamic_cast<YACS::ENGINE::InputDataStreamPort *>(port);
- if(indsport)
- return SWIG_NewPointerObj((void*)indsport,ret,owner);
-
- YACS::ENGINE::OutputDataStreamPort *outdsport = dynamic_cast<YACS::ENGINE::OutputDataStreamPort *>(port);
- if(outdsport)
- return SWIG_NewPointerObj((void*)outdsport,ret,owner);
-
- return SWIG_NewPointerObj((void*)port,ret,owner);
- }
- else
- {
- if(YACS::ENGINE::AnyInputPort *cport =dynamic_cast<YACS::ENGINE::AnyInputPort *>(port))
- ob=SWIG_NewPointerObj((void*)cport,SWIGTYPE_p_YACS__ENGINE__AnyInputPort,owner);
- else if(YACS::ENGINE::AnyOutputPort *cport =dynamic_cast<YACS::ENGINE::AnyOutputPort *>(port))
- ob=SWIG_NewPointerObj((void*)cport,SWIGTYPE_p_YACS__ENGINE__AnyOutputPort,owner);
- else if(dynamic_cast<YACS::ENGINE::InputPort *>(port))
- ob=SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__InputPort,owner);
- else if(dynamic_cast<YACS::ENGINE::OutputPort *>(port))
- ob=SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__OutputPort,owner);
- else if(dynamic_cast<YACS::ENGINE::InputDataStreamPort *>(port))
- ob=SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__InputDataStreamPort, owner);
- else if(dynamic_cast<YACS::ENGINE::OutputDataStreamPort *>(port))
- ob=SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__OutputDataStreamPort, owner);
- else if(dynamic_cast<YACS::ENGINE::InPort *>(port))
- ob=SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__InPort, owner);
- else if(dynamic_cast<YACS::ENGINE::OutPort *>(port))
- ob=SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__OutPort, owner);
- else if(dynamic_cast<YACS::ENGINE::InGate *>(port))
- ob=SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__InGate, owner);
- else if(dynamic_cast<YACS::ENGINE::OutGate *>(port))
- ob=SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__OutGate, owner);
- else
- ob=SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__Port, owner);
- }
- return ob;
-}
-
-%}
-
-#if SWIG_VERSION >= 0x010329
-%template() std::list<int>;
-%template() std::list<std::string>;
-#else
-
-#ifdef SWIGPYTHON
-%typemap(out) std::list<int>
-{
- int i;
- std::list<int>::iterator iL;
-
- $result = PyList_New($1.size());
- for (i=0, iL=$1.begin(); iL!=$1.end(); i++, iL++)
- PyList_SetItem($result,i,PyLong_FromLong((*iL)));
-}
-
-%typemap(out) std::list<std::string>
-{
- int i;
- std::list<std::string>::iterator iL;
-
- $result = PyList_New($1.size());
- for (i=0, iL=$1.begin(); iL!=$1.end(); i++, iL++)
- PyList_SetItem($result,i,PyString_FromString((*iL).c_str()));
-}
-
-%typemap(in) std::list<std::string>
-{
- /* Check if input is a list */
- if (PyList_Check($input))
- {
- int size = PyList_Size($input);
- int i = 0;
- std::list<std::string> myList;
- $1 = myList;
- for (i = 0; i < size; i++)
- {
- PyObject *o = PyList_GetItem($input,i);
- if (PyString_Check(o))
- $1.push_back(std::string(PyString_AsString(PyList_GetItem($input,i))));
- else
- {
- PyErr_SetString(PyExc_TypeError,"list must contain strings");
- return NULL;
- }
- }
- }
- else
- {
- PyErr_SetString(PyExc_TypeError,"not a list");
- return NULL;
- }
-}
-#endif
-#endif
-
-#ifdef SWIGPYTHON
-%typemap(out) YACS::ENGINE::TypeCode*
-{
- if(dynamic_cast<YACS::ENGINE::TypeCodeStruct *>($1))
- $result=SWIG_NewPointerObj((void*)$1,SWIGTYPE_p_YACS__ENGINE__TypeCodeStruct,$owner);
- else if(dynamic_cast<YACS::ENGINE::TypeCodeSeq *>($1))
- $result=SWIG_NewPointerObj((void*)$1,SWIGTYPE_p_YACS__ENGINE__TypeCodeSeq,$owner);
- else if(dynamic_cast<YACS::ENGINE::TypeCodeObjref *>($1))
- $result=SWIG_NewPointerObj((void*)$1,SWIGTYPE_p_YACS__ENGINE__TypeCodeObjref,$owner);
- else
- $result=SWIG_NewPointerObj((void*)$1,SWIGTYPE_p_YACS__ENGINE__TypeCode,$owner);
-}
-
-%typemap(in) std::list<YACS::ENGINE::TypeCodeObjref*>
-{
- // Check if input is a list
- if (PyList_Check($input))
- {
- int size = PyList_Size($input);
- int i = 0;
- std::list<YACS::ENGINE::TypeCodeObjref*> myList;
- $1 = myList;
- for (i = 0; i < size; i++)
- {
- PyObject *o = PyList_GetItem($input,i);
- YACS::ENGINE::TypeCode* temp;
- if ((SWIG_ConvertPtr(o, (void **) &temp, $descriptor(YACS::ENGINE::TypeCode*),0)) == -1)
- {
- PyErr_SetString(PyExc_TypeError,"not a YACS::ENGINE::TypeCode*");
- return NULL;
- }
- else
- {
- if(temp->kind() == YACS::ENGINE::Objref)
- $1.push_back((YACS::ENGINE::TypeCodeObjref*)temp);
- else
- {
- PyErr_SetString(PyExc_TypeError,"not a YACS::ENGINE::TypeCodeObjref*");
- return NULL;
- }
- }
- }
- }
- else
- {
- PyErr_SetString(PyExc_TypeError,"not a list");
- return NULL;
- }
-}
-
-%typemap(out) YACS::ENGINE::Node*
-{
- $result=convertNode($1,$owner);
-}
-
-%typemap(out) YACS::ENGINE::ServiceNode*
-{
- $result=convertNode($1,$owner);
-}
-
-%typemap(out) YACS::ENGINE::InlineNode*
-{
- $result=convertNode($1,$owner);
-}
-
-%typemap(out) YACS::ENGINE::ComposedNode*
-{
- $result=convertNode($1,$owner);
-}
-
-%typemap(out) YACS::ENGINE::Proc*
-{
- $result=convertNode($1,$owner);
-}
-
-%typemap(out) std::set<YACS::ENGINE::Node *>
-{
- int i;
- std::set<YACS::ENGINE::Node *>::iterator iL;
-
- $result = PyList_New($1.size());
- PyObject * ob;
- for (i=0, iL=$1.begin(); iL!=$1.end(); i++, iL++)
- {
- ob=convertNode(*iL);
- PyList_SetItem($result,i,ob);
- }
-}
-
-%typemap(out) std::list<YACS::ENGINE::Node *>
-{
- int i;
- std::list<YACS::ENGINE::Node *>::iterator iL;
-
- $result = PyList_New($1.size());
- PyObject * ob;
- for (i=0, iL=$1.begin(); iL!=$1.end(); i++, iL++)
- {
- ob=convertNode(*iL);
- PyList_SetItem($result,i,ob);
- }
-}
-
-%typemap(out) YACS::ENGINE::InputPort*,YACS::ENGINE::OutputPort*,YACS::ENGINE::InPort*,YACS::ENGINE::OutPort*
-{
- $result=convertPort($1,$owner);
-}
-
-%typemap(out) std::set<YACS::ENGINE::InGate *>
-{
- int i;
- std::set<YACS::ENGINE::InGate *>::iterator iL;
- $result = PyList_New($1.size());
- PyObject * ob;
- for (i=0, iL=$1.begin(); iL!=$1.end(); i++, iL++)
- {
- ob=convertPort(*iL);
- PyList_SetItem($result,i,ob);
- }
-}
-
-%typemap(out) std::set<YACS::ENGINE::OutGate *>
-{
- int i;
- std::set<YACS::ENGINE::OutGate *>::iterator iL;
- $result = PyList_New($1.size());
- PyObject * ob;
- for (i=0, iL=$1.begin(); iL!=$1.end(); i++, iL++)
- {
- ob=convertPort(*iL);
- PyList_SetItem($result,i,ob);
- }
-}
-
-%typemap(out) std::set<YACS::ENGINE::InPort *>
-{
- std::set<YACS::ENGINE::InPort *>::iterator iL;
- $result = PyList_New(0);
- PyObject * ob;
- int status;
- for (iL=$1.begin(); iL!=$1.end(); iL++)
- {
- ob=convertPort(*iL);
- status=PyList_Append($result,ob);
- Py_DECREF(ob);
- if (status < 0)
- {
- PyErr_SetString(PyExc_TypeError,"cannot build the inport list");
- return NULL;
- }
- }
-}
-
-%typemap(out) std::set<YACS::ENGINE::OutPort *>
-{
- std::set<YACS::ENGINE::OutPort *>::iterator iL;
- $result = PyList_New(0);
- PyObject * ob;
- int status;
- for (iL=$1.begin(); iL!=$1.end(); iL++)
- {
- ob=convertPort(*iL);
- status=PyList_Append($result,ob);
- Py_DECREF(ob);
- if (status < 0)
- {
- PyErr_SetString(PyExc_TypeError,"cannot build the outport list");
- return NULL;
- }
- }
-}
-
-%typemap(out) std::list<YACS::ENGINE::OutPort *>
-{
- std::list<YACS::ENGINE::OutPort *>::const_iterator it;
- $result = PyTuple_New($1.size());
- int i = 0;
- for (it = $1.begin(); it != $1.end(); ++it, ++i) {
- PyTuple_SetItem($result,i,convertPort(*it));
- }
-}
-%typemap(out) std::list<YACS::ENGINE::InPort *>
-{
- std::list<YACS::ENGINE::InPort *>::const_iterator it;
- $result = PyTuple_New($1.size());
- int i = 0;
- for (it = $1.begin(); it != $1.end(); ++it, ++i) {
- PyTuple_SetItem($result,i,convertPort(*it));
- }
-}
-%typemap(out) std::list<YACS::ENGINE::OutputPort *>
-{
- std::list<YACS::ENGINE::OutputPort *>::const_iterator it;
- $result = PyTuple_New($1.size());
- int i = 0;
- for (it = $1.begin(); it != $1.end(); ++it, ++i) {
- PyTuple_SetItem($result,i,convertPort(*it));
- }
-}
-%typemap(out) std::list<YACS::ENGINE::InputPort *>
-{
- std::list<YACS::ENGINE::InputPort *>::const_iterator it;
- $result = PyTuple_New($1.size());
- int i = 0;
- for (it = $1.begin(); it != $1.end(); ++it, ++i) {
- PyTuple_SetItem($result,i,convertPort(*it));
- }
-}
-
-#endif
-
-/*
- * Exception section
- */
-// a general exception handler
-%exception {
- try
- {
- $action
- }
- catch(YACS::Exception& _e)
- {
- PyErr_SetString(PyExc_ValueError,_e.what());
- return NULL;
- }
- catch(std::invalid_argument& _e)
- {
- PyErr_SetString(PyExc_IOError ,_e.what());
- return NULL;
- } catch (std::domain_error& e) {
- SWIG_exception(SWIG_ValueError, e.what() );
- } catch (std::overflow_error& e) {
- SWIG_exception(SWIG_OverflowError, e.what() );
- } catch (std::out_of_range& e) {
- SWIG_exception(SWIG_IndexError, e.what() );
- } catch (std::length_error& e) {
- SWIG_exception(SWIG_IndexError, e.what() );
- } catch (std::runtime_error& e) {
- SWIG_exception(SWIG_RuntimeError, e.what() );
- }
- OMNIPY_CATCH_AND_HANDLE_SYSTEM_EXCEPTIONS
- catch (std::exception& e) {
- SWIG_exception(SWIG_SystemError, e.what() );
- }
- catch(...)
- {
- SWIG_exception(SWIG_UnknownError, "Unknown exception");
- }
-}
-
-// a specific exception handler = generic + release lock
-%define PYEXCEPTION(name)
-%exception name {
- try
- {
- InterpreterUnlocker _l;
- $action
- }
- catch(YACS::Exception& _e)
- {
- PyErr_SetString(PyExc_ValueError,_e.what());
- return NULL;
- }
- catch(std::invalid_argument& _e)
- {
- PyErr_SetString(PyExc_IOError ,_e.what());
- return NULL;
- } catch (std::domain_error& e) {
- SWIG_exception(SWIG_ValueError, e.what() );
- } catch (std::overflow_error& e) {
- SWIG_exception(SWIG_OverflowError, e.what() );
- } catch (std::out_of_range& e) {
- SWIG_exception(SWIG_IndexError, e.what() );
- } catch (std::length_error& e) {
- SWIG_exception(SWIG_IndexError, e.what() );
- } catch (std::runtime_error& e) {
- SWIG_exception(SWIG_RuntimeError, e.what() );
- }
- OMNIPY_CATCH_AND_HANDLE_SYSTEM_EXCEPTIONS
- catch (std::exception& e) {
- SWIG_exception(SWIG_SystemError, e.what() );
- }
- catch(...)
- {
- SWIG_exception(SWIG_UnknownError, "Unknown exception");
- }
-}
-%enddef
-
-%define EXCEPTION(name)
-%exception name {
- try
- {
- $action
- }
- catch(YACS::Exception& _e)
- {
- PyErr_SetString(PyExc_ValueError,_e.what());
- return NULL;
- }
- catch(std::invalid_argument& _e)
- {
- PyErr_SetString(PyExc_IOError ,_e.what());
- return NULL;
- } catch (std::domain_error& e) {
- SWIG_exception(SWIG_ValueError, e.what() );
- } catch (std::overflow_error& e) {
- SWIG_exception(SWIG_OverflowError, e.what() );
- } catch (std::out_of_range& e) {
- SWIG_exception(SWIG_IndexError, e.what() );
- } catch (std::length_error& e) {
- SWIG_exception(SWIG_IndexError, e.what() );
- } catch (std::runtime_error& e) {
- SWIG_exception(SWIG_RuntimeError, e.what() );
- }
- OMNIPY_CATCH_AND_HANDLE_SYSTEM_EXCEPTIONS
- catch (std::exception& e) {
- SWIG_exception(SWIG_SystemError, e.what() );
- }
- catch(...)
- {
- SWIG_exception(SWIG_UnknownError, "Unknown exception");
- }
-}
-%enddef
-/*
- * End of Exception section
- */
-
-/*
- * Ownership section
- */
-//Release ownership : transfer it to C++
-%apply SWIGTYPE *DISOWN { YACS::ENGINE::CatalogLoader* factory};
-%apply SWIGTYPE *DISOWN { YACS::ENGINE::Node *DISOWNnode };
-%apply SWIGTYPE *DISOWN { Node *DISOWNnode };
-/*
- * End of ownership section
- */
-
-/*
- * Reference counting section
- * reference counted objects are created with a count of 1 so we do not incrRef them on wrapping creation
- * we only decrRef them on wrapping destruction.
- * Do not forget to declare them new (%newobject) when they are not returned from a constructor
- * unless they will not be decrRef on wrapping destruction
- */
-%feature("ref") YACS::ENGINE::RefCounter ""
-%feature("unref") YACS::ENGINE::RefCounter "$this->decrRef();"
-/*
- * End of Reference counting section
- */
-
-/*
-%wrapper %{
- namespace swig {
- template <> struct traits_from<YACS::ENGINE::InPort *> {
- static PyObject *from(YACS::ENGINE::InPort* val){
- return convertPort(val);
- }
- };
- template <> struct traits_from<YACS::ENGINE::OutPort *> {
- static PyObject *from(YACS::ENGINE::OutPort* val) {
- return convertPort(val);
- }
- };
- template <> struct traits_from<YACS::ENGINE::InputPort *> {
- static PyObject *from(YACS::ENGINE::InPort* val){
- return convertPort(val);
- }
- };
- template <> struct traits_from<YACS::ENGINE::OutputPort *> {
- static PyObject *from(YACS::ENGINE::OutPort* val) {
- return convertPort(val);
- }
- };
- }
-%}
-*/
-
-%define REFCOUNT_TEMPLATE(tname, T...)
-/*
- This macro is a special wrapping for map with value type which derives from RefCounter.
- To overload standard SWIG wrapping we define a full specialization of std::map
- with %extend for 4 basic methods : getitem, setitem, delitem and keys.
- Then we complete the interface by deriving the shadow wrapper from
- the python mixin class (UserDict.DictMixin).
- Do not forget to declare the new shadow class to SWIG with tname_swigregister(tname).
- Objects returned by __getitem__ are declared new (%newobject) so that when destroyed they
- call decrRef (see feature("unref") for RefCounter).
-*/
-template<>
-class std::map<std::string,T*>
-{
-public:
-%extend
-{
- void __setitem__(const std::string& name, T* c)
- {
- std::map<std::string, T* >::iterator i = self->find(name);
- if (i != self->end())
- {
- if(c==i->second)
- return;
- i->second->decrRef();
- }
- (*self)[name]=c;
- c->incrRef();
- }
- T* __getitem__(std::string name)
- {
- std::map<std::string, T* >::iterator i = self->find(name);
- if (i != self->end())
- {
- i->second->incrRef();
- return i->second;
- }
- else
- throw std::out_of_range("key not found");
- }
- void __delitem__(std::string name)
- {
- std::map<std::string, T* >::iterator i = self->find(name);
- if (i != self->end()){
- i->second->decrRef();
- self->erase(i);
- }
- else
- throw std::out_of_range("key not found");
- }
- PyObject* keys() {
- int pysize = self->size();
- PyObject* keyList = PyList_New(pysize);
- std::map<std::string, T* >::const_iterator i = self->begin();
- for (int j = 0; j < pysize; ++i, ++j) {
- PyList_SET_ITEM(keyList, j, PyString_FromString(i->first.c_str()));
- }
- return keyList;
- }
-}
-};
-
-%newobject std::map<std::string,T* >::__getitem__;
-%template() std::pair<std::string, T* >;
-%template(tname) std::map<std::string, T* >;
-%pythoncode{
-from UserDict import DictMixin
-class tname(tname,DictMixin):pass
-tname##_swigregister(tname)
-}
-%enddef
-
-
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-%define DOCSTRING
-"All is needed to create and execute a calculation schema."
-%enddef
-
-%module(docstring=DOCSTRING) pilot
-
-#ifndef SWIGIMPORTED
-//work around SWIG bug #1863647
-#define PySwigIterator pilot_PySwigIterator
-#endif
-
-%feature("autodoc", "1");
-
-%include "engtypemaps.i"
-
-%{
-#include "Any.hxx"
-#include "TypeCode.hxx"
-#include "ComponentDefinition.hxx"
-#include "Visitor.hxx"
-#include "VisitorSaveSchema.hxx"
-#include "VisitorSaveState.hxx"
-#include "LinkInfo.hxx"
-#include "Catalog.hxx"
-#include "Executor.hxx"
-#include "ExecutorSwig.hxx"
-#include "Dispatcher.hxx"
-#include "Container.hxx"
-#include "Logger.hxx"
-#include "DeploymentTree.hxx"
-#include "ComponentInstance.hxx"
-#include "DataNode.hxx"
-
-using namespace YACS::ENGINE;
-
-%}
-
-%init
-%{
- // init section
-#ifdef OMNIORB
- PyObject* omnipy = PyImport_ImportModule((char*)"_omnipy");
- if (!omnipy)
- {
- PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy");
- return;
- }
- PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
- api = (omniORBPYAPI*)PyCObject_AsVoidPtr(pyapi);
- Py_DECREF(pyapi);
-#endif
-%}
-
-%ignore YACS::ENGINE::TypeCode::operator=;
-%ignore YACS::ENGINE::DeploymentTree::operator=;
-%ignore operator<<;
-%ignore YACS::ENGINE::Runtime::_tc_double;
-%ignore YACS::ENGINE::Runtime::_tc_int;
-%ignore YACS::ENGINE::Runtime::_tc_bool;
-%ignore YACS::ENGINE::Runtime::_tc_string;
-%ignore YACS::ENGINE::Runtime::_tc_file;
-%rename(StateLoader) YACS::ENGINE::StateLoader; // to suppress a 503 warning
-%rename(NbDoneLoader) YACS::ENGINE::NbDoneLoader; // to suppress a 503 warning
-%rename(getRuntime) YACS::ENGINE::getRuntime; // to suppress a 503 warning
-%rename(_from) YACS::ENGINE::DataLinkInfo::from ; // to suppress a 314 warning
-%rename(_from) YACS::ENGINE::StreamLinkInfo::from ; // to suppress a 314 warning
-
-/*
- * Template section
- */
-%template() std::pair<std::string, YACS::ENGINE::TypeCode *>;
-%template() std::pair<std::string, YACS::ENGINE::Node *>;
-%template() std::pair<std::string, YACS::ENGINE::InlineNode *>;
-%template() std::pair<std::string, YACS::ENGINE::ServiceNode *>;
-%template() std::pair<std::string, YACS::ENGINE::Container *>;
-%template() std::pair<YACS::ENGINE::OutPort *,YACS::ENGINE::InPort *>;
-%template() std::pair<YACS::ENGINE::InPort *,YACS::ENGINE::OutPort *>;
-//%template(TCmap) std::map<std::string, YACS::ENGINE::TypeCode *>;
-REFCOUNT_TEMPLATE(TCmap,YACS::ENGINE::TypeCode)
-%template(NODEmap) std::map<std::string, YACS::ENGINE::Node *>;
-%template(INODEmap) std::map<std::string, YACS::ENGINE::InlineNode *>;
-%template(SNODEmap) std::map<std::string, YACS::ENGINE::ServiceNode *>;
-//%template(CONTAINmap) std::map<std::string, YACS::ENGINE::Container *>;
-REFCOUNT_TEMPLATE(CONTAINmap,YACS::ENGINE::Container)
-%template(strvec) std::vector<std::string>;
-%template(linksvec) std::vector< std::pair<YACS::ENGINE::OutPort *,YACS::ENGINE::InPort *> >;
-%template(linkvec) std::vector< std::pair<YACS::ENGINE::InPort *,YACS::ENGINE::OutPort *> >;
-%template(instreamlist) std::list<YACS::ENGINE::InputDataStreamPort *>;
-%template(outstreamlist) std::list<YACS::ENGINE::OutputDataStreamPort *>;
-
-%template() std::pair<std::string, YACS::ENGINE::CatalogLoader *>;
-%template(loadermap) std::map<std::string,YACS::ENGINE::CatalogLoader *>;
-%template() std::pair<std::string, YACS::ENGINE::ComposedNode *>;
-%template(composedmap) std::map<std::string,YACS::ENGINE::ComposedNode *>;
-%template() std::pair<std::string, YACS::ENGINE::ComponentDefinition *>;
-%template(compomap) std::map<std::string, YACS::ENGINE::ComponentDefinition *>;
-%template() std::pair<std::string, std::string>;
-%template(propmap) std::map<std::string, std::string>;
-
-/*
- * End of Template section
- */
-
-
-/*
- * Ownership section
- */
-//Take ownership : it is not the default (constructor) as it is a factory
-%newobject YACS::ENGINE::Runtime::createProc;
-%newobject YACS::ENGINE::Runtime::createScriptNode;
-%newobject YACS::ENGINE::Runtime::createFuncNode;
-%newobject YACS::ENGINE::Runtime::createRefNode;
-%newobject YACS::ENGINE::Runtime::createCompoNode;
-%newobject YACS::ENGINE::Runtime::createSInlineNode;
-%newobject YACS::ENGINE::Runtime::createInDataNode;
-%newobject YACS::ENGINE::Runtime::createOutDataNode;
-%newobject YACS::ENGINE::Runtime::createBloc;
-%newobject YACS::ENGINE::Runtime::createForLoop;
-%newobject YACS::ENGINE::Runtime::createForEachLoop;
-%newobject YACS::ENGINE::Runtime::createWhileLoop;
-%newobject YACS::ENGINE::Runtime::createSwitch;
-%newobject YACS::ENGINE::Runtime::loadCatalog;
-%newobject YACS::ENGINE::Runtime::createComponentInstance;
-%newobject YACS::ENGINE::Runtime::createContainer;
-%newobject YACS::ENGINE::Runtime::createInputPort;
-%newobject YACS::ENGINE::Runtime::createOutputPort;
-%newobject YACS::ENGINE::Runtime::createInputDataStreamPort;
-%newobject YACS::ENGINE::Runtime::createOutputDataStreamPort;
-%newobject YACS::ENGINE::Node::clone;
-
-//Take ownership : transfer it from C++ (has to be completed)
-%newobject YACS::ENGINE::Loop::edRemoveNode;
-%newobject YACS::ENGINE::Switch::edReleaseDefaultNode;
-%newobject YACS::ENGINE::Switch::edReleaseCase;
-%newobject YACS::ENGINE::DynParaLoop::edRemoveNode;
-%newobject YACS::ENGINE::DynParaLoop::edRemoveInitNode;
-//No other way to do ??
-%feature("pythonappend") YACS::ENGINE::Bloc::edRemoveChild(Node *node)%{
- args[1].thisown=1
-%}
-
-%newobject YACS::ENGINE::Proc::createContainer;
-%newobject YACS::ENGINE::Proc::createSequenceTc;
-%newobject YACS::ENGINE::Proc::createInterfaceTc;
-%newobject YACS::ENGINE::Proc::createStructTc;
-%newobject YACS::ENGINE::Proc::createType;
-
-%newobject YACS::ENGINE::TypeCode::interfaceTc;
-%newobject YACS::ENGINE::TypeCode::sequenceTc;
-%newobject YACS::ENGINE::TypeCode::structTc;
-
-/*
- * End of ownership section
- */
-
-%include <define.hxx>
-%include <Exception.hxx>
-%include <ConversionException.hxx>
-%include <Runtime.hxx>
-
-PYEXCEPTION(YACS::ENGINE::Executor::RunW)
-PYEXCEPTION(YACS::ENGINE::Executor::RunB)
-PYEXCEPTION(YACS::ENGINE::Executor::setExecMode)
-PYEXCEPTION(YACS::ENGINE::Executor::resumeCurrentBreakPoint)
-PYEXCEPTION(YACS::ENGINE::Executor::stopExecution)
-PYEXCEPTION(YACS::ENGINE::Executor::waitPause)
-PYEXCEPTION(YACS::ENGINE::ComponentInstance::load)
-
-%include <Executor.hxx>
-
-EXCEPTION(YACS::ENGINE::ExecutorSwig::RunPy)
-EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause)
-%include <ExecutorSwig.hxx>
-
-%include <RefCounter.hxx>
-
-%ignore YACS::ENGINE::TypeCode::getOrBuildAnyFromZippedData;
-%include <TypeCode.hxx>
-
-%include <Scheduler.hxx>
-%include <Task.hxx>
-%include <Dispatcher.hxx>
-%include <DeploymentTree.hxx>
-%include <Port.hxx>
-%extend YACS::ENGINE::Port
-{
- int __cmp__(Port* other)
- {
- if(self==other)
- return 0;
- else
- return 1;
- }
- long ptr()
- {
- return (long)self;
- }
-}
-%include <DataPort.hxx>
-%include <InPort.hxx>
-%include <OutPort.hxx>
-%include <InGate.hxx>
-%include <OutGate.hxx>
-%include <DataFlowPort.hxx>
-%include <DataStreamPort.hxx>
-
-%include <LinkInfo.hxx>
-%include <Logger.hxx>
-
-%include <ComponentInstance.hxx>
-%include <Container.hxx>
-%include <InputPort.hxx>
-%extend YACS::ENGINE::InputPort
-{
- void edInitXML(const char * s)
- {
- self->edInit("XML",s);
- }
- void edInitPy(PyObject* ob)
- {
- self->edInit("Python",ob);
- }
-}
-
-%template(edInitInt) YACS::ENGINE::InputPort::edInit<int>;
-%template(edInitBool) YACS::ENGINE::InputPort::edInit<bool>;
-%template(edInitString) YACS::ENGINE::InputPort::edInit<std::string>;
-%template(edInitDbl) YACS::ENGINE::InputPort::edInit<double>;
-
-%include <AnyInputPort.hxx>
-%include <ConditionInputPort.hxx>
-%include <OutputPort.hxx>
-%include <InputDataStreamPort.hxx>
-%include <OutputDataStreamPort.hxx>
-%include <DataPort.hxx>
-
-%include <Node.hxx>
-%extend YACS::ENGINE::Node
-{
- int __cmp__(Node* other)
- {
- if(self==other)
- return 0;
- else
- return 1;
- }
- long ptr()
- {
- return (long)self;
- }
-}
-
-%include <ElementaryNode.hxx>
-%include <InlineNode.hxx>
-%include <ServiceNode.hxx>
-%include <ServiceInlineNode.hxx>
-%include <DataNode.hxx>
-
-%include <ComposedNode.hxx>
-%include <StaticDefinedComposedNode.hxx>
-%include <Bloc.hxx>
-%include <Proc.hxx>
-
-%include <Loop.hxx>
-%include <ForLoop.hxx>
-%include <DynParaLoop.hxx>
-%include <WhileLoop.hxx>
-%include <ForEachLoop.hxx>
-%include <OptimizerAlg.hxx>
-%include <OptimizerLoop.hxx>
-%include <Switch.hxx>
-%include <Visitor.hxx>
-%include <VisitorSaveSchema.hxx>
-%include <ComponentDefinition.hxx>
-%include <Catalog.hxx>
-
-%extend YACS::ENGINE::ConditionInputPort
-{
- bool getPyObj()
- {
- return self->getValue();
- }
-}
-
-%extend YACS::ENGINE::AnyInputPort
-{
- PyObject * getPyObj()
- {
- return (PyObject *)getRuntime()->convertNeutral(self->edGetType(),self->getValue());
- }
-}
-
-%extend YACS::ENGINE::AnyOutputPort
-{
- PyObject * getPyObj()
- {
- return (PyObject *)getRuntime()->convertNeutral(self->edGetType(),self->getValue());
- }
-}
-
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-%define PYPILOTDOCSTRING
-"This module provides 2 classes PyObserver and PyCatalogLoader that can be subclassed in Python (uses director feature)"
-%enddef
-
-%module(directors="1",docstring=PYPILOTDOCSTRING) pypilot
-
-%feature("autodoc", "1");
-
-%include "engtypemaps.i"
-
-%{
-#include "Dispatcher.hxx"
-#include "Catalog.hxx"
-#include "TypeCode.hxx"
-
-namespace YACS
-{
- namespace ENGINE
- {
- class PyObserver:public Observer
- {
- public:
- virtual void notifyObserver(Node* object,const std::string& event)
- {
- //YACS engine processing is pure C++ : need to take the GIL
- PyGILState_STATE gstate = PyGILState_Ensure();
-
- try
- {
- pynotify(object,event);
- if (PyErr_Occurred())
- {
- // print the exception and clear it
- PyErr_Print();
- //do not propagate the python exception (ignore it)
- }
- }
- catch (...)
- {
- //ignore this exception:probably Swig::DirectorException
- if (PyErr_Occurred())
- PyErr_Print();
- }
- PyGILState_Release(gstate);
- }
- virtual void pynotify(Node* object,const std::string& event)
- {
- //To inherit (Python class)
- std::cerr << "pynotify " << event << object << std::endl;
- }
- };
-
- class PyCatalogLoader:public CatalogLoader
- {
- protected:
- virtual CatalogLoader* newLoader(const std::string& path) {return 0;}
- };
- }
-}
-
-%}
-
-%init
-%{
- // init section
-#ifdef OMNIORB
- PyObject* omnipy = PyImport_ImportModule((char*)"_omnipy");
- if (!omnipy)
- {
- PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy");
- return;
- }
- PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
- api = (omniORBPYAPI*)PyCObject_AsVoidPtr(pyapi);
- Py_DECREF(pyapi);
-#endif
-%}
-
-/*
- * Director section : classes that can be subclassed in python
- */
-%feature("director") YACS::ENGINE::PyObserver;
-%feature("nodirector") YACS::ENGINE::PyObserver::notifyObserver;
-%feature("director") YACS::ENGINE::PyCatalogLoader;
-%feature("nodirector") YACS::ENGINE::PyCatalogLoader::newLoader;
-
-/*
-%feature("director:except") {
- if ($error != NULL) {
- // print the exception and clear it
- PyErr_Print();
- //do not propagate the python exception (ignore it)
- //throw Swig::DirectorMethodException();
- }
-}
-*/
-/*
- * End of Director section
- */
-
-%types(YACS::ENGINE::Node *,YACS::ENGINE::Proc *,YACS::ENGINE::ForLoop *,YACS::ENGINE::Bloc *, YACS::ENGINE::Switch *);
-%types(YACS::ENGINE::WhileLoop *,YACS::ENGINE::ForEachLoop *,YACS::ENGINE::ComposedNode *,YACS::ENGINE::InlineNode *);
-%types(YACS::ENGINE::InlineFuncNode *,YACS::ENGINE::ServiceInlineNode *,YACS::ENGINE::ServiceNode *);
-%types(YACS::ENGINE::ElementaryNode *);
-
-%types(YACS::ENGINE::InputPort *,YACS::ENGINE::OutputPort *);
-%types(YACS::ENGINE::InputDataStreamPort *,YACS::ENGINE::OutputDataStreamPort *);
-%types(YACS::ENGINE::InGate *,YACS::ENGINE::OutGate *);
-%types(YACS::ENGINE::InPort *,YACS::ENGINE::OutPort *,YACS::ENGINE::Port *);
-
-%types(YACS::ENGINE::Observer *);
-
-%import "pilot.i"
-%import "Dispatcher.hxx"
-%import "Catalog.hxx"
-
-namespace YACS
-{
- namespace ENGINE
- {
- class PyObserver:public Observer
- {
- public:
- virtual void pynotify(Node* object,const std::string& event);
- };
-
- class PyCatalogLoader:public CatalogLoader
- {
- protected:
- virtual CatalogLoader* newLoader(const std::string& path);
- };
- }
-}
-
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <Python.h>
+#include "ExecutorSwig.hxx"
+#include "Scheduler.hxx"
+
+#include <iostream>
+
+using namespace YACS::ENGINE;
+using namespace std;
+
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
+void ExecutorSwig::RunPy(Scheduler *graph,int debug, bool isPyThread, bool fromscratch)
+{
+ DEBTRACE("ExecutorSwig::RunPy(Scheduler *graph,int debug, bool isPyThread, bool fromscratch) "
+ << debug << " " << isPyThread << " " << fromscratch);
+ PyThreadState *_save;
+ if (isPyThread) _save = PyEval_SaveThread(); // allow Python threads when embedded in a Python thread
+ try
+ {
+ RunB(graph, debug, fromscratch);
+ }
+ catch (YACS::Exception& e)
+ {
+ DEBTRACE("YACS exception caught: ");
+ DEBTRACE(e.what());
+ }
+ catch (const std::ios_base::failure&)
+ {
+ DEBTRACE("io failure");
+ }
+ catch(...)
+ {
+ DEBTRACE("Caught unknown exception.");
+ }
+ if (isPyThread) PyEval_RestoreThread(_save); // restore thread state and lock at the end of Python thread
+}
+
+void ExecutorSwig::waitPause()
+{
+ DEBTRACE("ExecutorSwig::waitPause()");
+ PyThreadState *_save;
+ _save = PyEval_SaveThread(); // allow Python threads when embedded in a Python thread
+ Executor::waitPause();
+ PyEval_RestoreThread(_save); // restore thread state and lock at the end of Python thread
+}
+
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _EXECUTOR_SWIG_HXX_
+#define _EXECUTOR_SWIG_HXX_
+
+#include "Executor.hxx"
+
+namespace YACS
+{
+ namespace ENGINE
+ {
+ class ExecutorSwig: public Executor
+ {
+ public:
+ void RunPy(Scheduler *graph,
+ int debug=0,
+ bool isPyThread = true,
+ bool fromscratch=true);
+ void waitPause();
+ };
+ }
+}
+
+#endif
--- /dev/null
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+include $(top_srcdir)/adm/unix/make_begin.am
+
+BUILT_SOURCES = pilotWRAP.cxx pypilotWRAP.cxx pypilotWRAP.h pilotWRAP.h
+
+MYSWIG_FLAGS = -noexcept -DYACS_PTHREAD -I$(srcdir)/../bases -I$(srcdir)/../engine
+if DOXYGEN_IS_OK
+MYSWIG_FLAGS += -DDOXYGEN_IS_OK
+endif
+
+salomepython_PYTHON = pilot.py pypilot.py
+salomepyexec_LTLIBRARIES = _pilot.la _pypilot.la
+
+ENGINEINCLUDES=Any.hxx DeploymentTree.hxx InputDataStreamPort.hxx OutPort.hxx SharedPtr.hxx \
+AnyInputPort.hxx Dispatcher.hxx InputPort.hxx OutputDataStreamPort.hxx StaticDefinedComposedNode.hxx \
+Bloc.hxx DynParaLoop.hxx InvalidExtractionException.hxx OutputPort.hxx Switch.hxx \
+ComponentInstance.hxx ElementaryNode.hxx LinkInfo.hxx Pool.hxx Task.hxx \
+ComposedNode.hxx Executor.hxx Logger.hxx Port.hxx TypeCode.hxx \
+ConditionInputPort.hxx LogRecord.hxx Proc.hxx Visitor.hxx \
+Container.hxx ForEachLoop.hxx Loop.hxx RefCounter.hxx VisitorSaveSchema.hxx \
+ConversionException.hxx ForLoop.hxx Node.hxx Runtime.hxx VisitorSaveState.hxx \
+DataFlowPort.hxx InGate.hxx OptimizerAlg.hxx Scheduler.hxx WhileLoop.hxx \
+DataPort.hxx InlineNode.hxx OptimizerLoop.hxx ServiceInlineNode.hxx ComponentDefinition.hxx \
+DataStreamPort.hxx InPort.hxx OutGate.hxx ServiceNode.hxx Catalog.hxx \
+PropertyInterface.hxx AnyOutputPort.hxx Pool.hxx InPropertyPort.hxx
+
+SWIGINCLUDES = $(ENGINEINCLUDES:%=$(top_srcdir)/src/engine/%) $(top_srcdir)/src/bases/yacsconfig.h ExecutorSwig.hxx
+
+pilotWRAP.cxx:pilot.i $(SWIGINCLUDES) engtypemaps.i docengine.i
+ $(SWIG) $(SWIG_PYTHON_OPT) $(SWIG_PYTHON_INCLUDES) $(MYSWIG_FLAGS) -o pilotWRAP.cxx $(srcdir)/pilot.i
+
+pilot.py : pilotWRAP.cxx
+
+_pilot_la_SOURCES = \
+ pilotWRAP.cxx \
+ ExecutorSwig.cxx
+
+
+_pilot_la_CXXFLAGS = \
+ $(THREAD_DEF) \
+ $(PYTHON_CPPFLAGS) \
+ $(OMNIORB_INCLUDES) \
+ $(OMNIORB_CXXFLAGS) \
+ -I$(srcdir) \
+ -I$(srcdir)/../engine \
+ -I$(srcdir)/../bases
+
+_pilot_la_LDFLAGS = -module
+
+_pilot_la_LIBADD = ../engine/libYACSlibEngine.la $(OMNIORB_LIBS) $(PYTHON_LIBS)
+
+
+pypilotWRAP.cxx: pypilot.i pilot.i $(SWIGINCLUDES) engtypemaps.i pilotWRAP.cxx
+ $(SWIG) $(SWIG_PYTHON_OPT) $(SWIG_PYTHON_INCLUDES) $(MYSWIG_FLAGS) -o pypilotWRAP.cxx $(srcdir)/pypilot.i
+
+pypilotWRAP.h: pypilotWRAP.cxx
+pilotWRAP.h: pilotWRAP.cxx
+
+pypilot.py : pypilotWRAP.cxx
+
+_pypilot_la_SOURCES = pypilotWRAP.cxx
+_pypilot_la_CXXFLAGS = $(THREAD_DEF) $(PYTHON_CPPFLAGS) $(OMNIORB_INCLUDES) $(OMNIORB_CXXFLAGS) -I$(srcdir)/../engine -I$(srcdir)/../bases
+_pypilot_la_LDFLAGS = -module
+_pypilot_la_LIBADD = ../engine/libYACSlibEngine.la $(OMNIORB_LIBS) $(PYTHON_LIBS)
+
+docengine.i:$(SWIGINCLUDES)
+ DOXSRCDIR=$(top_srcdir)/src/engine doxygen $(top_srcdir)/Misc/Doxyfile
+ $(PYTHON) $(top_srcdir)/Misc/doxy2swig.py -n xml/index.xml docengine.i
+
+EXTRA_DIST = ExecutorSwig.hxx pilot.i pypilot.i engtypemaps.i pypilotWRAP.h
+
+clean-local:
+ rm -f pypilot.py* pypilotWRAP.* pilot.py* pilotWRAP.* docengine.i
+ rm -rf xml
+
+include $(top_srcdir)/adm/unix/make_end.am
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+%include std_except.i
+%include std_string.i
+%include std_map.i
+%include std_list.i
+%include std_vector.i
+%include std_set.i
+
+// ----------------------------------------------------------------------------
+
+%{
+#include "yacsconfig.h"
+
+#ifdef OMNIORB
+#include <omniORB4/CORBA.h>
+
+//--- from omniORBpy.h (not present on Debian Sarge packages)
+struct omniORBPYAPI
+{
+ PyObject* (*cxxObjRefToPyObjRef)(const CORBA::Object_ptr cxx_obj,
+ CORBA::Boolean hold_lock);
+ // Convert a C++ object reference to a Python object reference.
+ // If <hold_lock> is true, caller holds the Python interpreter lock.
+
+ CORBA::Object_ptr (*pyObjRefToCxxObjRef)(PyObject* py_obj,
+ CORBA::Boolean hold_lock);
+ // Convert a Python object reference to a C++ object reference.
+ // Raises BAD_PARAM if the Python object is not an object reference.
+ // If <hold_lock> is true, caller holds the Python interpreter lock.
+
+ PyObject* (*handleCxxSystemException)(const CORBA::SystemException& ex);
+ // Sets the Python exception state to reflect the given C++ system
+ // exception. Always returns NULL. The caller must hold the Python
+ // interpreter lock.
+};
+
+omniORBPYAPI* api;
+
+#define OMNIPY_CATCH_AND_HANDLE_SYSTEM_EXCEPTIONS \
+catch (const CORBA::SystemException& ex) { \
+ return api->handleCxxSystemException(ex); \
+}
+#else
+#define OMNIPY_CATCH_AND_HANDLE_SYSTEM_EXCEPTIONS
+#endif
+
+#include "Node.hxx"
+#include "InlineNode.hxx"
+#include "ComposedNode.hxx"
+#include "ServiceNode.hxx"
+#include "ServiceInlineNode.hxx"
+#include "ServerNode.hxx"
+#include "Proc.hxx"
+#include "Bloc.hxx"
+#include "ForLoop.hxx"
+#include "WhileLoop.hxx"
+#include "ForEachLoop.hxx"
+#include "Switch.hxx"
+#include "InputPort.hxx"
+#include "OutputPort.hxx"
+#include "InPropertyPort.hxx"
+#include "InputDataStreamPort.hxx"
+#include "OutputDataStreamPort.hxx"
+#include "OptimizerLoop.hxx"
+
+class InterpreterUnlocker
+{
+public:
+ InterpreterUnlocker()
+ {
+ _save = PyEval_SaveThread(); // allow Python threads to run
+ }
+ ~InterpreterUnlocker()
+ {
+ PyEval_RestoreThread(_save); // restore the thread state
+ }
+private:
+ PyThreadState *_save;
+};
+
+static PyObject* convertNode(YACS::ENGINE::Node* node,int owner=0)
+{
+ if (!node)
+ return SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__Node,owner);
+ PyObject * ob;
+ //should use $descriptor(YACS::ENGINE::Bloc *) and so on but $descriptor is not defined here
+ // It is better to define a helper function to avoid code bloat
+ // First try to find a swig type info by its mangled name
+ std::string swigtypename="_p_"+node->typeName();
+ swig_type_info *ret = SWIG_MangledTypeQuery(swigtypename.c_str());
+ if (ret)
+ ob=SWIG_NewPointerObj((void*)node,ret,owner);
+ else
+ {
+ //typeName not known by swig. Try dynamic_cast on known classes
+ //You must respect inheritance order in casting : Bloc before ComposedNode and so on
+ if(dynamic_cast<YACS::ENGINE::Proc *>(node))
+ ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__Proc,owner);
+ else if(dynamic_cast<YACS::ENGINE::Bloc *>(node))
+ ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__Bloc,owner);
+ else if(dynamic_cast<YACS::ENGINE::ForLoop *>(node))
+ ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__ForLoop,owner);
+ else if(dynamic_cast<YACS::ENGINE::WhileLoop *>(node))
+ ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__WhileLoop,owner);
+ else if(dynamic_cast<YACS::ENGINE::ForEachLoop *>(node))
+ ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__ForEachLoop,owner);
+ else if(dynamic_cast<YACS::ENGINE::Switch *>(node))
+ ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__Switch,owner);
+ else if(dynamic_cast<YACS::ENGINE::ComposedNode *>(node))
+ ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__ComposedNode,owner);
+ else if(dynamic_cast<YACS::ENGINE::InlineFuncNode *>(node))
+ ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__InlineFuncNode,owner);
+ else if(dynamic_cast<YACS::ENGINE::InlineNode *>(node))
+ ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__InlineNode,owner);
+ else if(dynamic_cast<YACS::ENGINE::ServiceInlineNode *>(node))
+ ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__ServiceInlineNode,owner);
+ else if(dynamic_cast<YACS::ENGINE::ServiceNode *>(node))
+ ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__ServiceNode,owner);
+ else if(dynamic_cast<YACS::ENGINE::ServerNode *>(node))
+ ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__ServerNode,owner);
+ else if(dynamic_cast<YACS::ENGINE::ElementaryNode *>(node))
+ ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__ElementaryNode,owner);
+ else
+ ob=SWIG_NewPointerObj((void*)node,SWIGTYPE_p_YACS__ENGINE__Node,owner);
+ }
+ return ob;
+}
+
+static PyObject* convertPort(YACS::ENGINE::Port* port,int owner=0)
+{
+ if(!port)
+ return SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__Port, owner);
+ PyObject * ob;
+ std::string swigtypename="_p_"+port->typeName();
+ swig_type_info *ret = SWIG_MangledTypeQuery(swigtypename.c_str());
+ if (ret)
+ {
+ YACS::ENGINE::InPropertyPort *inpropertyport = dynamic_cast<YACS::ENGINE::InPropertyPort*>(port);
+ if(inpropertyport)
+ return SWIG_NewPointerObj((void*)inpropertyport,ret,owner);
+
+ YACS::ENGINE::InputPort *inport = dynamic_cast<YACS::ENGINE::InputPort *>(port);
+ if(inport)
+ return SWIG_NewPointerObj((void*)inport,ret,owner);
+
+ YACS::ENGINE::OutputPort *outport = dynamic_cast<YACS::ENGINE::OutputPort *>(port);
+ if(outport)
+ return SWIG_NewPointerObj((void*)outport,ret,owner);
+
+ YACS::ENGINE::InputDataStreamPort *indsport = dynamic_cast<YACS::ENGINE::InputDataStreamPort *>(port);
+ if(indsport)
+ return SWIG_NewPointerObj((void*)indsport,ret,owner);
+
+ YACS::ENGINE::OutputDataStreamPort *outdsport = dynamic_cast<YACS::ENGINE::OutputDataStreamPort *>(port);
+ if(outdsport)
+ return SWIG_NewPointerObj((void*)outdsport,ret,owner);
+
+ return SWIG_NewPointerObj((void*)port,ret,owner);
+ }
+ else
+ {
+ if(YACS::ENGINE::AnyInputPort *cport =dynamic_cast<YACS::ENGINE::AnyInputPort *>(port))
+ ob=SWIG_NewPointerObj((void*)cport,SWIGTYPE_p_YACS__ENGINE__AnyInputPort,owner);
+ else if(YACS::ENGINE::AnyOutputPort *cport =dynamic_cast<YACS::ENGINE::AnyOutputPort *>(port))
+ ob=SWIG_NewPointerObj((void*)cport,SWIGTYPE_p_YACS__ENGINE__AnyOutputPort,owner);
+ else if(dynamic_cast<YACS::ENGINE::InPropertyPort*>(port))
+ ob=SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__InPropertyPort,owner);
+ else if(dynamic_cast<YACS::ENGINE::InputPort *>(port))
+ ob=SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__InputPort,owner);
+ else if(dynamic_cast<YACS::ENGINE::OutputPort *>(port))
+ ob=SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__OutputPort,owner);
+ else if(dynamic_cast<YACS::ENGINE::InputDataStreamPort *>(port))
+ ob=SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__InputDataStreamPort, owner);
+ else if(dynamic_cast<YACS::ENGINE::OutputDataStreamPort *>(port))
+ ob=SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__OutputDataStreamPort, owner);
+ else if(dynamic_cast<YACS::ENGINE::InPort *>(port))
+ ob=SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__InPort, owner);
+ else if(dynamic_cast<YACS::ENGINE::OutPort *>(port))
+ ob=SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__OutPort, owner);
+ else if(dynamic_cast<YACS::ENGINE::InGate *>(port))
+ ob=SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__InGate, owner);
+ else if(dynamic_cast<YACS::ENGINE::OutGate *>(port))
+ ob=SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__OutGate, owner);
+ else
+ ob=SWIG_NewPointerObj((void*)port,SWIGTYPE_p_YACS__ENGINE__Port, owner);
+ }
+ return ob;
+}
+
+%}
+
+#if SWIG_VERSION >= 0x010329
+%template() std::list<int>;
+%template() std::list<std::string>;
+#else
+
+#ifdef SWIGPYTHON
+%typemap(out) std::list<int>
+{
+ int i;
+ std::list<int>::iterator iL;
+
+ $result = PyList_New($1.size());
+ for (i=0, iL=$1.begin(); iL!=$1.end(); i++, iL++)
+ PyList_SetItem($result,i,PyLong_FromLong((*iL)));
+}
+
+%typemap(out) std::list<std::string>
+{
+ int i;
+ std::list<std::string>::iterator iL;
+
+ $result = PyList_New($1.size());
+ for (i=0, iL=$1.begin(); iL!=$1.end(); i++, iL++)
+ PyList_SetItem($result,i,PyString_FromString((*iL).c_str()));
+}
+
+%typemap(in) std::list<std::string>
+{
+ /* Check if input is a list */
+ if (PyList_Check($input))
+ {
+ int size = PyList_Size($input);
+ int i = 0;
+ std::list<std::string> myList;
+ $1 = myList;
+ for (i = 0; i < size; i++)
+ {
+ PyObject *o = PyList_GetItem($input,i);
+ if (PyString_Check(o))
+ $1.push_back(std::string(PyString_AsString(PyList_GetItem($input,i))));
+ else
+ {
+ PyErr_SetString(PyExc_TypeError,"list must contain strings");
+ return NULL;
+ }
+ }
+ }
+ else
+ {
+ PyErr_SetString(PyExc_TypeError,"not a list");
+ return NULL;
+ }
+}
+#endif
+#endif
+
+#ifdef SWIGPYTHON
+
+%typecheck(SWIG_TYPECHECK_POINTER) YACS::ENGINE::Any*
+{
+ void *ptr;
+ if (SWIG_ConvertPtr($input, (void **) &ptr, $1_descriptor, 0) == 0)
+ $1 = 1;
+ else if (PyInt_Check($input))
+ $1 = 1;
+ else if(PyFloat_Check($input))
+ $1 = 1;
+ else if (PyString_Check($input))
+ $1 = 1;
+ else
+ $1 = 0;
+}
+
+%typemap(in) YACS::ENGINE::Any* (int is_new_object)
+{
+ if ((SWIG_ConvertPtr($input,(void **) &$1, $1_descriptor,SWIG_POINTER_EXCEPTION)) == 0)
+ {
+ // It is an Any : it is converted by SWIG_ConvertPtr $input -> $1
+ is_new_object=0;
+ }
+ else if (PyInt_Check($input))
+ {
+ // It is an Int
+ $1=YACS::ENGINE::AtomAny::New((int)PyInt_AsLong($input));
+ is_new_object=1;
+ }
+ else if(PyFloat_Check($input))
+ {
+ // It is a Float
+ $1=YACS::ENGINE::AtomAny::New(PyFloat_AsDouble($input));
+ is_new_object=1;
+ }
+ else if(PyString_Check($input))
+ {
+ // It is a Float
+ $1=YACS::ENGINE::AtomAny::New(PyString_AsString($input));
+ is_new_object=1;
+ }
+ else
+ {
+ // It is an error
+ PyErr_SetString(PyExc_TypeError,"not a yacs any or a convertible type");
+ return NULL;
+ }
+}
+
+%typemap(directorout) YACS::ENGINE::Any*
+{
+ if ((SWIG_ConvertPtr($1,(void **) &$result, $1_descriptor,SWIG_POINTER_EXCEPTION)) == 0)
+ {
+ // It is an Any : it is converted by SWIG_ConvertPtr $input -> $1
+ }
+ else if (PyInt_Check($1))
+ {
+ // It is an Int
+ $result=YACS::ENGINE::AtomAny::New((int)PyInt_AsLong($1));
+ }
+ else if(PyFloat_Check($1))
+ {
+ // It is a Float
+ $result=YACS::ENGINE::AtomAny::New(PyFloat_AsDouble($1));
+ }
+ else if(PyString_Check($1))
+ {
+ // It is a String
+ $result=YACS::ENGINE::AtomAny::New(PyString_AsString($1));
+ }
+ else
+ {
+ // It is an error
+ PyErr_SetString(PyExc_TypeError,"not a yacs any or a convertible type");
+ return NULL;
+ }
+}
+
+%typemap(freearg) YACS::ENGINE::Any *inSample
+{
+ //a reference is taken by the routine called
+ if (!is_new_object$argnum) $1->incrRef();
+}
+
+%typemap(freearg) YACS::ENGINE::Any*
+{
+ //no reference taken by the routine called
+ if (is_new_object$argnum) $1->decrRef();
+}
+
+%typemap(out) YACS::ENGINE::Any*
+{
+ if(dynamic_cast<YACS::ENGINE::SequenceAny *>($1))
+ $result=SWIG_NewPointerObj((void*)$1,SWIGTYPE_p_YACS__ENGINE__SequenceAny,$owner);
+ else if(dynamic_cast<YACS::ENGINE::ArrayAny *>($1))
+ $result=SWIG_NewPointerObj((void*)$1,SWIGTYPE_p_YACS__ENGINE__ArrayAny,$owner);
+ else if(dynamic_cast<YACS::ENGINE::StructAny *>($1))
+ $result=SWIG_NewPointerObj((void*)$1,SWIGTYPE_p_YACS__ENGINE__StructAny,$owner);
+ else
+ $result=SWIG_NewPointerObj((void*)$1,SWIGTYPE_p_YACS__ENGINE__Any,$owner);
+}
+
+%typemap(out) YACS::ENGINE::TypeCode*
+{
+ if(dynamic_cast<YACS::ENGINE::TypeCodeStruct *>($1))
+ $result=SWIG_NewPointerObj((void*)$1,SWIGTYPE_p_YACS__ENGINE__TypeCodeStruct,$owner);
+ else if(dynamic_cast<YACS::ENGINE::TypeCodeSeq *>($1))
+ $result=SWIG_NewPointerObj((void*)$1,SWIGTYPE_p_YACS__ENGINE__TypeCodeSeq,$owner);
+ else if(dynamic_cast<YACS::ENGINE::TypeCodeObjref *>($1))
+ $result=SWIG_NewPointerObj((void*)$1,SWIGTYPE_p_YACS__ENGINE__TypeCodeObjref,$owner);
+ else
+ $result=SWIG_NewPointerObj((void*)$1,SWIGTYPE_p_YACS__ENGINE__TypeCode,$owner);
+}
+
+%typemap(in) std::list<YACS::ENGINE::TypeCodeObjref*>
+{
+ // Check if input is a list
+ if (PyList_Check($input))
+ {
+ int size = PyList_Size($input);
+ int i = 0;
+ std::list<YACS::ENGINE::TypeCodeObjref*> myList;
+ $1 = myList;
+ for (i = 0; i < size; i++)
+ {
+ PyObject *o = PyList_GetItem($input,i);
+ YACS::ENGINE::TypeCode* temp;
+ if ((SWIG_ConvertPtr(o, (void **) &temp, $descriptor(YACS::ENGINE::TypeCode*),0)) == -1)
+ {
+ PyErr_SetString(PyExc_TypeError,"not a YACS::ENGINE::TypeCode*");
+ return NULL;
+ }
+ else
+ {
+ if(temp->kind() == YACS::ENGINE::Objref)
+ $1.push_back((YACS::ENGINE::TypeCodeObjref*)temp);
+ else
+ {
+ PyErr_SetString(PyExc_TypeError,"not a YACS::ENGINE::TypeCodeObjref*");
+ return NULL;
+ }
+ }
+ }
+ }
+ else
+ {
+ PyErr_SetString(PyExc_TypeError,"not a list");
+ return NULL;
+ }
+}
+
+%typemap(out) YACS::ENGINE::Node*
+{
+ $result=convertNode($1,$owner);
+}
+
+%typemap(out) YACS::ENGINE::ServiceNode*
+{
+ $result=convertNode($1,$owner);
+}
+
+%typemap(out) YACS::ENGINE::InlineNode*
+{
+ $result=convertNode($1,$owner);
+}
+
+%typemap(out) YACS::ENGINE::InlineFuncNode*
+{
+ $result=convertNode($1,$owner);
+}
+
+%typemap(out) YACS::ENGINE::ComposedNode*
+{
+ $result=convertNode($1,$owner);
+}
+
+%typemap(out) YACS::ENGINE::OptimizerLoop*
+{
+ $result=convertNode($1,$owner);
+}
+
+%typemap(out) YACS::ENGINE::Proc*
+{
+ $result=convertNode($1,$owner);
+}
+
+%typemap(out) std::set<YACS::ENGINE::Node *>
+{
+ int i;
+ std::set<YACS::ENGINE::Node *>::iterator iL;
+
+ $result = PyList_New($1.size());
+ PyObject * ob;
+ for (i=0, iL=$1.begin(); iL!=$1.end(); i++, iL++)
+ {
+ ob=convertNode(*iL);
+ PyList_SetItem($result,i,ob);
+ }
+}
+
+%typemap(out) std::list<YACS::ENGINE::Node *>
+{
+ int i;
+ std::list<YACS::ENGINE::Node *>::iterator iL;
+
+ $result = PyList_New($1.size());
+ PyObject * ob;
+ for (i=0, iL=$1.begin(); iL!=$1.end(); i++, iL++)
+ {
+ ob=convertNode(*iL);
+ PyList_SetItem($result,i,ob);
+ }
+}
+
+%typemap(out) YACS::ENGINE::InputPort*,YACS::ENGINE::OutputPort*,YACS::ENGINE::InPort*,YACS::ENGINE::OutPort*,YACS::ENGINE::InPropertyPort*
+{
+ $result=convertPort($1,$owner);
+}
+
+%typemap(out) std::set<YACS::ENGINE::InGate *>
+{
+ int i;
+ std::set<YACS::ENGINE::InGate *>::iterator iL;
+ $result = PyList_New($1.size());
+ PyObject * ob;
+ for (i=0, iL=$1.begin(); iL!=$1.end(); i++, iL++)
+ {
+ ob=convertPort(*iL);
+ PyList_SetItem($result,i,ob);
+ }
+}
+
+%typemap(out) std::set<YACS::ENGINE::OutGate *>
+{
+ int i;
+ std::set<YACS::ENGINE::OutGate *>::iterator iL;
+ $result = PyList_New($1.size());
+ PyObject * ob;
+ for (i=0, iL=$1.begin(); iL!=$1.end(); i++, iL++)
+ {
+ ob=convertPort(*iL);
+ PyList_SetItem($result,i,ob);
+ }
+}
+
+%typemap(out) std::set<YACS::ENGINE::InPort *>
+{
+ std::set<YACS::ENGINE::InPort *>::iterator iL;
+ $result = PyList_New(0);
+ PyObject * ob;
+ int status;
+ for (iL=$1.begin(); iL!=$1.end(); iL++)
+ {
+ ob=convertPort(*iL);
+ status=PyList_Append($result,ob);
+ Py_DECREF(ob);
+ if (status < 0)
+ {
+ PyErr_SetString(PyExc_TypeError,"cannot build the inport list");
+ return NULL;
+ }
+ }
+}
+
+%typemap(out) std::set<YACS::ENGINE::OutPort *>
+{
+ std::set<YACS::ENGINE::OutPort *>::iterator iL;
+ $result = PyList_New(0);
+ PyObject * ob;
+ int status;
+ for (iL=$1.begin(); iL!=$1.end(); iL++)
+ {
+ ob=convertPort(*iL);
+ status=PyList_Append($result,ob);
+ Py_DECREF(ob);
+ if (status < 0)
+ {
+ PyErr_SetString(PyExc_TypeError,"cannot build the outport list");
+ return NULL;
+ }
+ }
+}
+
+%typemap(out) std::list<YACS::ENGINE::OutPort *>
+{
+ std::list<YACS::ENGINE::OutPort *>::const_iterator it;
+ $result = PyTuple_New($1.size());
+ int i = 0;
+ for (it = $1.begin(); it != $1.end(); ++it, ++i) {
+ PyTuple_SetItem($result,i,convertPort(*it));
+ }
+}
+%typemap(out) std::list<YACS::ENGINE::InPort *>
+{
+ std::list<YACS::ENGINE::InPort *>::const_iterator it;
+ $result = PyTuple_New($1.size());
+ int i = 0;
+ for (it = $1.begin(); it != $1.end(); ++it, ++i) {
+ PyTuple_SetItem($result,i,convertPort(*it));
+ }
+}
+%typemap(out) std::list<YACS::ENGINE::OutputPort *>
+{
+ std::list<YACS::ENGINE::OutputPort *>::const_iterator it;
+ $result = PyTuple_New($1.size());
+ int i = 0;
+ for (it = $1.begin(); it != $1.end(); ++it, ++i) {
+ PyTuple_SetItem($result,i,convertPort(*it));
+ }
+}
+%typemap(out) std::list<YACS::ENGINE::InputPort *>
+{
+ std::list<YACS::ENGINE::InputPort *>::const_iterator it;
+ $result = PyTuple_New($1.size());
+ int i = 0;
+ for (it = $1.begin(); it != $1.end(); ++it, ++i) {
+ PyTuple_SetItem($result,i,convertPort(*it));
+ }
+}
+%typemap(out) std::list<YACS::ENGINE::InPropertyPort*>
+{
+ std::list<YACS::ENGINE::InPropertyPort *>::const_iterator it;
+ $result = PyTuple_New($1.size());
+ int i = 0;
+ for (it = $1.begin(); it != $1.end(); ++it, ++i) {
+ PyTuple_SetItem($result,i,convertPort(*it));
+ }
+}
+
+#endif
+
+/*
+ * Exception section
+ */
+// a general exception handler
+%exception {
+ try
+ {
+ $action
+ }
+ catch(YACS::Exception& _e)
+ {
+ PyErr_SetString(PyExc_ValueError,_e.what());
+ return NULL;
+ }
+ catch(std::invalid_argument& _e)
+ {
+ PyErr_SetString(PyExc_IOError ,_e.what());
+ return NULL;
+ } catch (std::domain_error& e) {
+ SWIG_exception(SWIG_ValueError, e.what() );
+ } catch (std::overflow_error& e) {
+ SWIG_exception(SWIG_OverflowError, e.what() );
+ } catch (std::out_of_range& e) {
+ PyErr_SetString(PyExc_KeyError,e.what());
+ return NULL;
+ } catch (std::length_error& e) {
+ SWIG_exception(SWIG_IndexError, e.what() );
+ } catch (std::runtime_error& e) {
+ SWIG_exception(SWIG_RuntimeError, e.what() );
+ }
+ OMNIPY_CATCH_AND_HANDLE_SYSTEM_EXCEPTIONS
+ catch (std::exception& e) {
+ SWIG_exception(SWIG_SystemError, e.what() );
+ }
+ catch(...)
+ {
+ SWIG_exception(SWIG_UnknownError, "Unknown exception");
+ }
+}
+
+// a specific exception handler = generic + release lock
+%define PYEXCEPTION(name)
+%exception name {
+ try
+ {
+ InterpreterUnlocker _l;
+ $action
+ }
+ catch(YACS::Exception& _e)
+ {
+ PyErr_SetString(PyExc_ValueError,_e.what());
+ return NULL;
+ }
+ catch(std::invalid_argument& _e)
+ {
+ PyErr_SetString(PyExc_IOError ,_e.what());
+ return NULL;
+ } catch (std::domain_error& e) {
+ SWIG_exception(SWIG_ValueError, e.what() );
+ } catch (std::overflow_error& e) {
+ SWIG_exception(SWIG_OverflowError, e.what() );
+ } catch (std::out_of_range& e) {
+ PyErr_SetString(PyExc_KeyError,e.what());
+ return NULL;
+ } catch (std::length_error& e) {
+ SWIG_exception(SWIG_IndexError, e.what() );
+ } catch (std::runtime_error& e) {
+ SWIG_exception(SWIG_RuntimeError, e.what() );
+ }
+ OMNIPY_CATCH_AND_HANDLE_SYSTEM_EXCEPTIONS
+ catch (std::exception& e) {
+ SWIG_exception(SWIG_SystemError, e.what() );
+ }
+ catch(...)
+ {
+ SWIG_exception(SWIG_UnknownError, "Unknown exception");
+ }
+}
+%enddef
+
+%define EXCEPTION(name)
+%exception name {
+ try
+ {
+ $action
+ }
+ catch(YACS::Exception& _e)
+ {
+ PyErr_SetString(PyExc_ValueError,_e.what());
+ return NULL;
+ }
+ catch(std::invalid_argument& _e)
+ {
+ PyErr_SetString(PyExc_IOError ,_e.what());
+ return NULL;
+ } catch (std::domain_error& e) {
+ SWIG_exception(SWIG_ValueError, e.what() );
+ } catch (std::overflow_error& e) {
+ SWIG_exception(SWIG_OverflowError, e.what() );
+ } catch (std::out_of_range& e) {
+ PyErr_SetString(PyExc_KeyError,e.what());
+ return NULL;
+ } catch (std::length_error& e) {
+ SWIG_exception(SWIG_IndexError, e.what() );
+ } catch (std::runtime_error& e) {
+ SWIG_exception(SWIG_RuntimeError, e.what() );
+ }
+ OMNIPY_CATCH_AND_HANDLE_SYSTEM_EXCEPTIONS
+ catch (std::exception& e) {
+ SWIG_exception(SWIG_SystemError, e.what() );
+ }
+ catch(...)
+ {
+ SWIG_exception(SWIG_UnknownError, "Unknown exception");
+ }
+}
+%enddef
+/*
+ * End of Exception section
+ */
+
+/*
+ * Ownership section
+ */
+//Release ownership : transfer it to C++
+%apply SWIGTYPE *DISOWN { YACS::ENGINE::CatalogLoader* factory};
+%apply SWIGTYPE *DISOWN { YACS::ENGINE::Node *DISOWNnode };
+%apply SWIGTYPE *DISOWN { Node *DISOWNnode };
+/*
+ * End of ownership section
+ */
+
+/*
+ * Reference counting section
+ * reference counted objects are created with a count of 1 so we do not incrRef them on wrapping creation
+ * we only decrRef them on wrapping destruction.
+ * Do not forget to declare them new (%newobject) when they are not returned from a constructor
+ * unless they will not be decrRef on wrapping destruction
+ */
+%feature("ref") YACS::ENGINE::RefCounter ""
+%feature("unref") YACS::ENGINE::RefCounter "$this->decrRef();"
+/*
+ * End of Reference counting section
+ */
+
+/*
+%wrapper %{
+ namespace swig {
+ template <> struct traits_from<YACS::ENGINE::InPort *> {
+ static PyObject *from(YACS::ENGINE::InPort* val){
+ return convertPort(val);
+ }
+ };
+ template <> struct traits_from<YACS::ENGINE::OutPort *> {
+ static PyObject *from(YACS::ENGINE::OutPort* val) {
+ return convertPort(val);
+ }
+ };
+ template <> struct traits_from<YACS::ENGINE::InputPort *> {
+ static PyObject *from(YACS::ENGINE::InPort* val){
+ return convertPort(val);
+ }
+ };
+ template <> struct traits_from<YACS::ENGINE::OutputPort *> {
+ static PyObject *from(YACS::ENGINE::OutPort* val) {
+ return convertPort(val);
+ }
+ };
+ }
+%}
+*/
+
+%define REFCOUNT_TEMPLATE(tname, T...)
+/*
+ This macro is a special wrapping for map with value type which derives from RefCounter.
+ To overload standard SWIG wrapping we define a full specialization of std::map
+ with %extend for 4 basic methods : getitem, setitem, delitem and keys.
+ Then we complete the interface by deriving the shadow wrapper from
+ the python mixin class (UserDict.DictMixin).
+ Do not forget to declare the new shadow class to SWIG with tname_swigregister(tname).
+ Objects returned by __getitem__ are declared new (%newobject) so that when destroyed they
+ call decrRef (see feature("unref") for RefCounter).
+*/
+template<>
+class std::map<std::string,T*>
+{
+public:
+%extend
+{
+ void __setitem__(const std::string& name, T* c)
+ {
+ std::map<std::string, T* >::iterator i = self->find(name);
+ if (i != self->end())
+ {
+ if(c==i->second)
+ return;
+ i->second->decrRef();
+ }
+ (*self)[name]=c;
+ c->incrRef();
+ }
+ T* __getitem__(std::string name)
+ {
+ std::map<std::string, T* >::iterator i = self->find(name);
+ if (i != self->end())
+ {
+ i->second->incrRef();
+ return i->second;
+ }
+ else
+ throw std::out_of_range("key not found");
+ }
+ void __delitem__(std::string name)
+ {
+ std::map<std::string, T* >::iterator i = self->find(name);
+ if (i != self->end()){
+ i->second->decrRef();
+ self->erase(i);
+ }
+ else
+ throw std::out_of_range("key not found");
+ }
+ PyObject* keys() {
+ int pysize = self->size();
+ PyObject* keyList = PyList_New(pysize);
+ std::map<std::string, T* >::const_iterator i = self->begin();
+ for (int j = 0; j < pysize; ++i, ++j) {
+ PyList_SET_ITEM(keyList, j, PyString_FromString(i->first.c_str()));
+ }
+ return keyList;
+ }
+}
+};
+
+%newobject std::map<std::string,T* >::__getitem__;
+%template() std::pair<std::string, T* >;
+%template(tname) std::map<std::string, T* >;
+%pythoncode{
+from UserDict import DictMixin
+class tname(tname,DictMixin):pass
+tname##_swigregister(tname)
+}
+%enddef
+
+
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+%define DOCSTRING
+"All is needed to create and execute a calculation schema."
+%enddef
+
+%module(docstring=DOCSTRING) pilot
+
+#ifndef SWIGIMPORTED
+//work around SWIG bug #1863647
+#if SWIG_VERSION >= 0x010336
+#define SwigPyIterator pilot_PySwigIterator
+#else
+#define PySwigIterator pilot_PySwigIterator
+#endif
+#endif
+
+%feature("autodoc", "1");
+
+%include "engtypemaps.i"
+
+#ifdef DOXYGEN_IS_OK
+%include docengine.i
+#endif
+
+%{
+#include "Any.hxx"
+#include "TypeCode.hxx"
+#include "ComponentDefinition.hxx"
+#include "Visitor.hxx"
+#include "VisitorSaveSchema.hxx"
+#include "VisitorSaveState.hxx"
+#include "LinkInfo.hxx"
+#include "Catalog.hxx"
+#include "Executor.hxx"
+#include "ExecutorSwig.hxx"
+#include "Dispatcher.hxx"
+#include "Container.hxx"
+#include "Logger.hxx"
+#include "DeploymentTree.hxx"
+#include "ComponentInstance.hxx"
+#include "DataNode.hxx"
+
+using namespace YACS::ENGINE;
+
+%}
+
+%init
+%{
+ // init section
+#ifdef OMNIORB
+ PyObject* omnipy = PyImport_ImportModule((char*)"_omnipy");
+ if (!omnipy)
+ {
+ PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy");
+ return;
+ }
+ PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
+ api = (omniORBPYAPI*)PyCObject_AsVoidPtr(pyapi);
+ Py_DECREF(pyapi);
+#endif
+%}
+
+%ignore YACS::ENGINE::Any::operator[];
+%ignore YACS::ENGINE::TypeCode::operator=;
+%ignore YACS::ENGINE::DeploymentTree::operator=;
+%ignore operator<<;
+%ignore YACS::ENGINE::Runtime::_tc_double;
+%ignore YACS::ENGINE::Runtime::_tc_int;
+%ignore YACS::ENGINE::Runtime::_tc_bool;
+%ignore YACS::ENGINE::Runtime::_tc_string;
+%ignore YACS::ENGINE::Runtime::_tc_file;
+%rename(StateLoader) YACS::ENGINE::StateLoader; // to suppress a 503 warning
+%rename(NbDoneLoader) YACS::ENGINE::NbDoneLoader; // to suppress a 503 warning
+%rename(getRuntime) YACS::ENGINE::getRuntime; // to suppress a 503 warning
+%rename(_from) YACS::ENGINE::DataLinkInfo::from ; // to suppress a 314 warning
+%rename(_from) YACS::ENGINE::StreamLinkInfo::from ; // to suppress a 314 warning
+
+/*
+ * Template section
+ */
+%template() std::pair<std::string, YACS::ENGINE::TypeCode *>;
+%template() std::pair<std::string, YACS::ENGINE::Node *>;
+%template() std::pair<std::string, YACS::ENGINE::InlineNode *>;
+%template() std::pair<std::string, YACS::ENGINE::ServiceNode *>;
+%template() std::pair<std::string, YACS::ENGINE::Container *>;
+%template() std::pair<YACS::ENGINE::OutPort *,YACS::ENGINE::InPort *>;
+%template() std::pair<YACS::ENGINE::InPort *,YACS::ENGINE::OutPort *>;
+//%template(TCmap) std::map<std::string, YACS::ENGINE::TypeCode *>;
+REFCOUNT_TEMPLATE(TCmap,YACS::ENGINE::TypeCode)
+%template(NODEmap) std::map<std::string, YACS::ENGINE::Node *>;
+%template(INODEmap) std::map<std::string, YACS::ENGINE::InlineNode *>;
+%template(SNODEmap) std::map<std::string, YACS::ENGINE::ServiceNode *>;
+//%template(CONTAINmap) std::map<std::string, YACS::ENGINE::Container *>;
+REFCOUNT_TEMPLATE(CONTAINmap,YACS::ENGINE::Container)
+%template(strvec) std::vector<std::string>;
+%template(linksvec) std::vector< std::pair<YACS::ENGINE::OutPort *,YACS::ENGINE::InPort *> >;
+%template(linkvec) std::vector< std::pair<YACS::ENGINE::InPort *,YACS::ENGINE::OutPort *> >;
+%template(instreamlist) std::list<YACS::ENGINE::InputDataStreamPort *>;
+%template(outstreamlist) std::list<YACS::ENGINE::OutputDataStreamPort *>;
+
+%template() std::pair<std::string, YACS::ENGINE::CatalogLoader *>;
+%template(loadermap) std::map<std::string,YACS::ENGINE::CatalogLoader *>;
+%template() std::pair<std::string, YACS::ENGINE::ComposedNode *>;
+%template(composedmap) std::map<std::string,YACS::ENGINE::ComposedNode *>;
+%template() std::pair<std::string, YACS::ENGINE::ComponentDefinition *>;
+%template(compomap) std::map<std::string, YACS::ENGINE::ComponentDefinition *>;
+%template() std::pair<std::string, std::string>;
+%template(propmap) std::map<std::string, std::string>;
+
+REFCOUNT_TEMPLATE(CompoInstmap,YACS::ENGINE::ComponentInstance)
+/*
+ * End of Template section
+ */
+
+
+/*
+ * Ownership section
+ */
+//Take ownership : it is not the default (constructor) as it is a factory
+%newobject *::createProc;
+%newobject *::createScriptNode;
+%newobject *::createFuncNode;
+%newobject *::createRefNode;
+%newobject *::createCompoNode;
+%newobject *::createSInlineNode;
+%newobject *::createInDataNode;
+%newobject *::createOutDataNode;
+%newobject *::createBloc;
+%newobject *::createForLoop;
+%newobject *::createForEachLoop;
+%newobject *::createWhileLoop;
+%newobject *::createSwitch;
+%newobject *::loadCatalog;
+%newobject *::createComponentInstance;
+%newobject *::createContainer;
+
+
+%newobject *::createInputPort;
+%newobject *::createOutputPort;
+%newobject *::createInputDataStreamPort;
+%newobject *::createOutputDataStreamPort;
+%newobject *::clone;
+%newobject *::New;
+
+//Take ownership : transfer it from C++ (has to be completed)
+%newobject YACS::ENGINE::Loop::edRemoveNode;
+%newobject YACS::ENGINE::Switch::edReleaseDefaultNode;
+%newobject YACS::ENGINE::Switch::edReleaseCase;
+%newobject YACS::ENGINE::DynParaLoop::edRemoveNode;
+%newobject YACS::ENGINE::DynParaLoop::edRemoveInitNode;
+//No other way to do ??
+%feature("pythonappend") YACS::ENGINE::Bloc::edRemoveChild(Node *node)%{
+ args[1].thisown=1
+%}
+
+%newobject *::createSequenceTc;
+%newobject *::createInterfaceTc;
+%newobject *::createStructTc;
+%newobject *::createType;
+
+%newobject YACS::ENGINE::TypeCode::interfaceTc;
+%newobject YACS::ENGINE::TypeCode::sequenceTc;
+%newobject YACS::ENGINE::TypeCode::structTc;
+
+/*
+ * End of ownership section
+ */
+
+
+%include <define.hxx>
+%include <YACSBasesExport.hxx>
+%include <Exception.hxx>
+%include <YACSlibEngineExport.hxx>
+%include <ConversionException.hxx>
+%include <Runtime.hxx>
+%include <PropertyInterface.hxx>
+
+PYEXCEPTION(YACS::ENGINE::Executor::RunW)
+PYEXCEPTION(YACS::ENGINE::Executor::RunB)
+PYEXCEPTION(YACS::ENGINE::Executor::setExecMode)
+PYEXCEPTION(YACS::ENGINE::Executor::resumeCurrentBreakPoint)
+PYEXCEPTION(YACS::ENGINE::Executor::stopExecution)
+PYEXCEPTION(YACS::ENGINE::Executor::waitPause)
+PYEXCEPTION(YACS::ENGINE::ComponentInstance::load)
+
+%include <Executor.hxx>
+
+EXCEPTION(YACS::ENGINE::ExecutorSwig::RunPy)
+EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause)
+%include <ExecutorSwig.hxx>
+
+%include <RefCounter.hxx>
+
+%include <Any.hxx>
+
+%ignore YACS::ENGINE::TypeCode::getOrBuildAnyFromZippedData;
+%include <TypeCode.hxx>
+
+%include <Scheduler.hxx>
+%include <Task.hxx>
+%include <Dispatcher.hxx>
+%include <DeploymentTree.hxx>
+%include <Port.hxx>
+%extend YACS::ENGINE::Port
+{
+ int __cmp__(Port* other)
+ {
+ if(self==other)
+ return 0;
+ else
+ return 1;
+ }
+ long ptr()
+ {
+ return (long)self;
+ }
+}
+%include <DataPort.hxx>
+%include <InPort.hxx>
+%include <OutPort.hxx>
+%include <InGate.hxx>
+%include <OutGate.hxx>
+%include <DataFlowPort.hxx>
+%include <DataStreamPort.hxx>
+
+%include <LinkInfo.hxx>
+%include <Logger.hxx>
+
+%include <ComponentInstance.hxx>
+%include <Container.hxx>
+%include <InputPort.hxx>
+%extend YACS::ENGINE::InputPort
+{
+ void edInitXML(const char * s)
+ {
+ self->edInit("XML",s);
+ }
+ void edInitPy(PyObject* ob)
+ {
+ self->edInit("Python",ob);
+ }
+}
+%include <InPropertyPort.hxx>
+%extend YACS::ENGINE::InPropertyPort
+{
+ void edInitXML(const char * s)
+ {
+ self->edInit("XML",s);
+ }
+ void edInitPy(PyObject* ob)
+ {
+ self->edInit("Python",ob);
+ }
+}
+
+%template(edInitInt) YACS::ENGINE::InputPort::edInit<int>;
+%template(edInitBool) YACS::ENGINE::InputPort::edInit<bool>;
+%template(edInitString) YACS::ENGINE::InputPort::edInit<std::string>;
+%template(edInitDbl) YACS::ENGINE::InputPort::edInit<double>;
+
+%include <AnyInputPort.hxx>
+%include <ConditionInputPort.hxx>
+%include <OutputPort.hxx>
+%include <AnyOutputPort.hxx>
+%include <InputDataStreamPort.hxx>
+%include <OutputDataStreamPort.hxx>
+%include <DataPort.hxx>
+
+%include <Node.hxx>
+%extend YACS::ENGINE::Node
+{
+ int __cmp__(Node* other)
+ {
+ if(self==other)
+ return 0;
+ else
+ return 1;
+ }
+ long ptr()
+ {
+ return (long)self;
+ }
+}
+
+%include <ElementaryNode.hxx>
+%include <InlineNode.hxx>
+%include <ServiceNode.hxx>
+%include <ServiceInlineNode.hxx>
+%include <ServerNode.hxx>
+%include <DataNode.hxx>
+
+%include <ComposedNode.hxx>
+%include <StaticDefinedComposedNode.hxx>
+%include <Bloc.hxx>
+%include <Proc.hxx>
+
+%include <Loop.hxx>
+%include <ForLoop.hxx>
+%include <DynParaLoop.hxx>
+%include <WhileLoop.hxx>
+%include <ForEachLoop.hxx>
+%include <OptimizerLoop.hxx>
+%include <Switch.hxx>
+%include <Visitor.hxx>
+%include <VisitorSaveSchema.hxx>
+%include <ComponentDefinition.hxx>
+%include <Catalog.hxx>
+%include <Pool.hxx>
+
+%include <AlternateThread.hxx>
+%include <AlternateThreadPT.hxx>
+
+// Ignore class OptimizerAlgASync to avoid confusion with class
+// OptimizerAlgASync in module SALOMERuntime
+%ignore YACS::ENGINE::OptimizerAlgASync;
+%include <OptimizerAlg.hxx>
+
+%extend YACS::ENGINE::ConditionInputPort
+{
+ bool getPyObj()
+ {
+ return self->getValue();
+ }
+}
+
+%extend YACS::ENGINE::AnyInputPort
+{
+ PyObject * getPyObj()
+ {
+ return (PyObject *)getRuntime()->convertNeutral(self->edGetType(),self->getValue());
+ }
+}
+
+%extend YACS::ENGINE::AnyOutputPort
+{
+ PyObject * getPyObj()
+ {
+ return (PyObject *)getRuntime()->convertNeutral(self->edGetType(),self->getValue());
+ }
+}
+
+%newobject YACS::ENGINE::SequenceAny::__getitem__;
+%extend YACS::ENGINE::SequenceAny
+{
+ Any* __getitem__(int i)
+ {
+ if (i < self->size())
+ {
+ AnyPtr a=(*self)[i];
+ a->incrRef();
+ return a;
+ }
+ else
+ throw std::length_error("index too large");
+ }
+}
+
+%newobject YACS::ENGINE::StructAny::__getitem__;
+%extend YACS::ENGINE::StructAny
+{
+ Any* __getitem__(const char * key)
+ {
+ AnyPtr a=(*self)[key];
+ a->incrRef();
+ return a;
+ }
+}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+%define PYPILOTDOCSTRING
+"This module provides 2 classes PyObserver and PyCatalogLoader that can be subclassed in Python (uses director feature)"
+%enddef
+
+%module(directors="1",docstring=PYPILOTDOCSTRING) pypilot
+
+%feature("autodoc", "1");
+
+%include "engtypemaps.i"
+
+%{
+#include "Dispatcher.hxx"
+#include "Catalog.hxx"
+#include "TypeCode.hxx"
+
+namespace YACS
+{
+ namespace ENGINE
+ {
+ class PyObserver:public Observer
+ {
+ public:
+ virtual void notifyObserver(Node* object,const std::string& event)
+ {
+ //YACS engine processing is pure C++ : need to take the GIL
+ PyGILState_STATE gstate = PyGILState_Ensure();
+
+ try
+ {
+ pynotify(object,event);
+ if (PyErr_Occurred())
+ {
+ // print the exception and clear it
+ PyErr_Print();
+ //do not propagate the python exception (ignore it)
+ }
+ }
+ catch (...)
+ {
+ //ignore this exception:probably Swig::DirectorException
+ if (PyErr_Occurred())
+ PyErr_Print();
+ }
+ PyGILState_Release(gstate);
+ }
+ virtual void pynotify(Node* object,const std::string& event)
+ {
+ //To inherit (Python class)
+ std::cerr << "pynotify " << event << object << std::endl;
+ }
+ };
+
+ class PyCatalogLoader:public CatalogLoader
+ {
+ protected:
+ virtual CatalogLoader* newLoader(const std::string& path) {return 0;}
+ };
+ }
+}
+
+%}
+
+%init
+%{
+ // init section
+#ifdef OMNIORB
+ PyObject* omnipy = PyImport_ImportModule((char*)"_omnipy");
+ if (!omnipy)
+ {
+ PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy");
+ return;
+ }
+ PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
+ api = (omniORBPYAPI*)PyCObject_AsVoidPtr(pyapi);
+ Py_DECREF(pyapi);
+#endif
+%}
+
+/*
+ * Director section : classes that can be subclassed in python
+ */
+%feature("director") YACS::ENGINE::PyObserver;
+%feature("nodirector") YACS::ENGINE::PyObserver::notifyObserver;
+%feature("director") YACS::ENGINE::PyCatalogLoader;
+%feature("nodirector") YACS::ENGINE::PyCatalogLoader::newLoader;
+
+/*
+%feature("director:except") {
+ if ($error != NULL) {
+ // print the exception and clear it
+ PyErr_Print();
+ //do not propagate the python exception (ignore it)
+ //throw Swig::DirectorMethodException();
+ }
+}
+*/
+/*
+ * End of Director section
+ */
+
+%types(YACS::ENGINE::Node *,YACS::ENGINE::Proc *,YACS::ENGINE::ForLoop *,YACS::ENGINE::Bloc *, YACS::ENGINE::Switch *);
+%types(YACS::ENGINE::WhileLoop *,YACS::ENGINE::ForEachLoop *,YACS::ENGINE::ComposedNode *,YACS::ENGINE::InlineNode *);
+%types(YACS::ENGINE::InlineFuncNode *,YACS::ENGINE::ServiceInlineNode *,YACS::ENGINE::ServiceNode *);
+%types(YACS::ENGINE::ElementaryNode *);
+
+%types(YACS::ENGINE::InputPort *,YACS::ENGINE::OutputPort *,YACS::ENGINE::InPropertyPort *);
+%types(YACS::ENGINE::InputDataStreamPort *,YACS::ENGINE::OutputDataStreamPort *);
+%types(YACS::ENGINE::InGate *,YACS::ENGINE::OutGate *);
+%types(YACS::ENGINE::InPort *,YACS::ENGINE::OutPort *,YACS::ENGINE::Port *);
+
+%types(YACS::ENGINE::Observer *);
+
+%import "pilot.i"
+%import "Dispatcher.hxx"
+%import "Catalog.hxx"
+
+namespace YACS
+{
+ namespace ENGINE
+ {
+ class PyObserver:public Observer
+ {
+ public:
+ virtual void pynotify(Node* object,const std::string& event);
+ };
+
+ class PyCatalogLoader:public CatalogLoader
+ {
+ protected:
+ virtual CatalogLoader* newLoader(const std::string& path);
+ };
+ }
+}
+
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "CaseSwitch.hxx"
//#define _DEVDEBUG_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _CASESWITCH_HXX_
#define _CASESWITCH_HXX_
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>CaseSwitch</class>
- <widget class="QWidget" name="CaseSwitch" >
- <property name="geometry" >
+ <widget class="QWidget" name="CaseSwitch">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<height>33</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QGridLayout" name="gridLayout" >
- <property name="margin" >
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="margin">
<number>0</number>
</property>
- <item row="0" column="0" >
- <layout class="QHBoxLayout" name="horizontalLayout" >
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
<item>
- <widget class="QCheckBox" name="cb_default" >
- <property name="text" >
+ <widget class="QCheckBox" name="cb_default">
+ <property name="text">
<string>default</string>
</property>
</widget>
</item>
<item>
- <widget class="QSpinBox" name="sb_case" />
+ <widget class="QSpinBox" name="sb_case"/>
</item>
</layout>
</item>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "RuntimeSALOME.hxx"
#include "CatalogWidget.hxx"
#include "TypeCode.hxx"
#include "ComponentDefinition.hxx"
#include "ItemMimeData.hxx"
+#include "QtGuiContext.hxx"
+#include <QApplication>
#include <QMimeData>
#include <QDrag>
#include <QPainter>
#include <QBitmap>
#include <QString>
#include <QFileInfo>
+#include <QMouseEvent>
#include <cassert>
_idCatalog = 0;
_cataMap.clear();
_typeToCataMap.clear();
+ _dragModifier=false;
setColumnCount(1);
setDragDropMode(QAbstractItemView::DragOnly);
setDragEnabled(true);
setDropIndicatorShown(true);
+
+ setSelectionMode(QAbstractItemView::ExtendedSelection);
}
bool CatalogWidget::addCatalogFromFile(std::string fileName)
{
DEBTRACE("CatalogWidget::addCatalogFromFile " << fileName);
- Catalog *cataProc = YACS::ENGINE::getSALOMERuntime()->loadCatalog("proc", fileName);
QFileInfo afi(fileName.c_str());
+ if(!afi.exists())
+ return false;
+ Catalog *cataProc = YACS::ENGINE::getSALOMERuntime()->loadCatalog("proc", fileName);
string aFile = afi.fileName().toStdString();
addCatalog(cataProc, aFile);
}
void CatalogWidget::startDrag(Qt::DropActions supportedActions)
{
DEBTRACE("startDrag " << supportedActions);
- QTreeWidgetItem *item = currentItem();
- assert(item);
- QTreeWidgetItem *parent = item->parent();
- if (!parent) return;
- QTreeWidgetItem *grandPa = parent->parent();
- if (!grandPa) return;
- QTreeWidgetItem *grandGrandPa = grandPa->parent();
- string cataName ="";
- if (grandGrandPa)
- cataName = grandGrandPa->text(0).toStdString();
- else
- cataName = grandPa->text(0).toStdString();
-
- DEBTRACE("cataName=" << cataName);
- assert(_cataMap.count(cataName));
- YACS::ENGINE::Catalog *catalog = _cataMap[cataName];
-
- QString mimeInfo;
- string compo = "";
- string definition = "";
- QPixmap pixmap;
- if (! parent->text(0).compare("Types"))
- {
- mimeInfo = "Type";
- definition = item->text(0).toStdString();
- pixmap.load("icons:data_link.png");
- }
- else if (parent->text(0).contains("Nodes"))
- {
- mimeInfo = "Node";
- definition = item->text(0).toStdString();
- pixmap.load("icons:add_node.png");
- }
- else if (! grandPa->text(0).compare("Components"))
+ if (! QtGuiContext::getQtCurrent()) return;
+ if (! QtGuiContext::getQtCurrent()->isEdition()) return;
+
+ QDrag *drag = 0;
+ ItemMimeData *mime = 0;
+ QString theMimeInfo;
+
+ QList<QTreeWidgetItem*> selectList = selectedItems();
+ for (int i=0; i<selectList.size(); i++)
{
- mimeInfo = "Service";
- definition = item->text(0).toStdString();
- compo = parent->text(0).toStdString();
- pixmap.load("icons:new_salome_service_node.png");
+ QTreeWidgetItem *parent = selectList[i]->parent();
+ if (!parent) continue;
+ QTreeWidgetItem *grandPa = parent->parent();
+ if (!grandPa) continue;
+ QTreeWidgetItem *grandGrandPa = grandPa->parent();
+ string cataName ="";
+ if (grandGrandPa)
+ cataName = grandGrandPa->text(0).toStdString();
+ else
+ cataName = grandPa->text(0).toStdString();
+ DEBTRACE("cataName=" << cataName);
+ YASSERT(_cataMap.count(cataName));
+ YACS::ENGINE::Catalog *catalog = _cataMap[cataName];
+
+ QString mimeInfo;
+ string compo = "";
+ string definition = "";
+ QPixmap pixmap;
+ if (! parent->text(0).compare("Types"))
+ {
+ mimeInfo = "Type";
+ definition = selectList[i]->text(0).toStdString();
+ pixmap.load("icons:data_link.png");
+ }
+ else if (parent->text(0).contains("Nodes"))
+ {
+ mimeInfo = "Node";
+ definition = selectList[i]->text(0).toStdString();
+ pixmap.load("icons:add_node.png");
+ }
+ else if (! grandPa->text(0).compare("Components"))
+ {
+ mimeInfo = "Service";
+ definition = selectList[i]->text(0).toStdString();
+ compo = parent->text(0).toStdString();
+ pixmap.load("icons:new_salome_service_node.png");
+ }
+ else
+ {
+ mimeInfo = "Component";
+ compo = selectList[i]->text(0).toStdString();
+ pixmap.load("icons:component.png");
+ }
+ QString mimeType = "yacs/cata" + mimeInfo;
+
+ if (!drag) // --- intialize mime data with the first selected item
+ {
+ DEBTRACE("mimeInfo=" << mimeInfo.toStdString() << " definition=" << definition << " compo=" << compo);
+ drag = new QDrag(this);
+ mime = new ItemMimeData;
+ drag->setMimeData(mime);
+ mime->setData(mimeType, mimeInfo.toAscii());
+ drag->setPixmap(pixmap);
+
+ theMimeInfo = mimeInfo;
+
+ mime->setCatalog(catalog);
+ mime->setCataName(cataName);
+ mime->setCompo(compo);
+ mime->setType(definition);
+ }
+ else // --- push only selected item of the same mimeType than the first
+ {
+ if (theMimeInfo == mimeInfo)
+ {
+ DEBTRACE("mimeInfo=" << mimeInfo.toStdString() << " definition=" << definition << " compo=" << compo);
+ mime->setCatalog(catalog);
+ mime->setCataName(cataName);
+ mime->setCompo(compo);
+ mime->setType(definition);
+ }
+ }
}
- else
+
+ if (drag)
{
- mimeInfo = "Component";
- compo = item->text(0).toStdString();
- pixmap.load("icons:component.png");
+ if(_dragModifier)
+ mime->setControl(true);
+ else
+ mime->setControl(false);
+
+ drag->exec(supportedActions);
}
- DEBTRACE("mimeInfo=" << mimeInfo.toStdString() << " definition=" << definition << " compo=" << compo);
- QString mimeType = "yacs/cata" + mimeInfo;
-
- QDrag *drag = new QDrag(this);
- ItemMimeData *mime = new ItemMimeData;
- drag->setMimeData(mime);
- mime->setData(mimeType, mimeInfo.toAscii());
- mime->setCatalog(catalog);
- mime->setCataName(cataName);
- mime->setCompo(compo);
- mime->setType(definition);
- drag->setPixmap(pixmap);
-
- drag->exec(supportedActions);
}
+
+void CatalogWidget::mousePressEvent(QMouseEvent *event)
+{
+ DEBTRACE("CatalogWidget::mousePressEvent ");
+ _dragModifier= false;
+ if(event->button() == Qt::MidButton)
+ _dragModifier= true;
+ QTreeWidget::mousePressEvent(event);
+}
+
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _CATALOGWIDGET_HXX_
#define _CATALOGWIDGET_HXX_
virtual std::map<std::string, YACS::ENGINE::Catalog*> getCataMap();
virtual YACS::ENGINE::Catalog* getCatalog(std::string cataName);
virtual YACS::ENGINE::Catalog* getCatalogFromType(std::string typeName);
+ virtual void mousePressEvent(QMouseEvent *event);
protected:
virtual void addCatalog(YACS::ENGINE::Catalog* catalog,
int _idCatalog;
std::map<std::string, YACS::ENGINE::Catalog*> _cataMap;
std::map<std::string, YACS::ENGINE::Catalog*> _typeToCataMap;
+ bool _dragModifier;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionBloc.hxx"
+#include "PropertyEditor.hxx"
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
const char* name)
: EditionNode(subject, parent, name)
{
+ _propeditor=new PropertyEditor(_subject);
+ _wid->gridLayout1->addWidget(_propeditor);
}
EditionBloc::~EditionBloc()
{
}
+void EditionBloc::update(GuiEvent event, int type, Subject* son)
+{
+ DEBTRACE("EditionBloc::update " <<eventName(event) << " " << type);
+ if(event == SETVALUE)
+ _propeditor->update();
+}
+
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONBLOC_HXX_
#define _EDITIONBLOC_HXX_
{
namespace HMI
{
+ class PropertyEditor;
class EditionBloc: public EditionNode
{
QWidget* parent = 0,
const char* name = 0);
virtual ~EditionBloc();
+ virtual void update(GuiEvent event, int type, Subject* son);
// liste de nodes fils
+ protected:
+ PropertyEditor* _propeditor;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionComponent.hxx"
+#include "PropertyEditor.hxx"
+#include "QtGuiContext.hxx"
+#include "Container.hxx"
+#include "ComponentInstance.hxx"
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
using namespace YACS;
using namespace YACS::HMI;
+using namespace YACS::ENGINE;
+
EditionComponent::EditionComponent(Subject* subject,
QWidget* parent,
const char* name)
: ItemEdition(subject, parent, name)
{
+
+ QHBoxLayout* hboxLayout = new QHBoxLayout();
+ hboxLayout->setSizeConstraint(QLayout::SetDefaultConstraint);
+ QLabel* la_container = new QLabel("Container:");
+ hboxLayout->addWidget(la_container);
+ _cb_container = new ComboBox();
+ hboxLayout->addWidget(_cb_container);
+ _wid->gridLayout1->addLayout(hboxLayout, 3, 0, 1, 1);
+ _propeditor=new PropertyEditor(_subject);
+ _wid->gridLayout1->addWidget(_propeditor);
+
+ connect(_cb_container, SIGNAL(mousePressed()),
+ this, SLOT(fillContainerPanel()));
+ connect(_cb_container, SIGNAL(activated(int)),
+ this, SLOT(changeContainer(int)));
+
+ fillContainerPanel();
}
EditionComponent::~EditionComponent()
{
}
+void EditionComponent::update(GuiEvent event, int type, Subject* son)
+{
+ DEBTRACE("EditionComponent::update " <<eventName(event) << " " << type);
+ if(event == SETVALUE)
+ _propeditor->update();
+
+ if(event == ADDREF || event == ASSOCIATE)
+ fillContainerPanel();
+}
+
+void EditionComponent::fillContainerPanel()
+{
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ _cb_container->clear();
+ std::map<string,Container*>::const_iterator it = proc->containerMap.begin();
+ for(; it != proc->containerMap.end(); ++it)
+ _cb_container->addItem( QString((*it).first.c_str()));
+
+ SubjectComponent *scompo=dynamic_cast<SubjectComponent*>(_subject);
+ ComponentInstance *compoInst = scompo->getComponent();
+ Container * cont = compoInst->getContainer();
+ if (cont)
+ {
+ int index = _cb_container->findText(cont->getName().c_str());
+ _cb_container->setCurrentIndex(index);
+ }
+}
+
+void EditionComponent::changeContainer(int index)
+{
+ string contName = _cb_container->itemText(index).toStdString();
+ DEBTRACE(contName);
+ SubjectComponent *scompo=dynamic_cast<SubjectComponent*>(_subject);
+ ComponentInstance *compoInst = scompo->getComponent();
+
+ Proc* proc = GuiContext::getCurrent()->getProc();
+
+ if (proc->containerMap.count(contName)==0)
+ {
+ DEBTRACE("-------------> not found : " << contName);
+ return;
+ }
+ Container *newContainer =proc->containerMap[contName];
+ SubjectContainer *scnt = GuiContext::getCurrent()->_mapOfSubjectContainer[newContainer];
+ scompo->associateToContainer(scnt);
+ scompo->select(true);
+}
+
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONCOMPONENT_HXX_
#define _EDITIONCOMPONENT_HXX_
#include "ItemEdition.hxx"
+#include "FormComponent.hxx"
namespace YACS
{
namespace HMI
{
+ class PropertyEditor;
class EditionComponent: public ItemEdition
{
+ Q_OBJECT
public:
EditionComponent(Subject* subject,
- QWidget* parent = 0,
- const char* name = 0);
+ QWidget* parent = 0,
+ const char* name = 0);
virtual ~EditionComponent();
+ virtual void update(GuiEvent event, int type, Subject* son);
+ protected:
+ PropertyEditor* _propeditor;
+ ComboBox* _cb_container;
+ public slots:
+ virtual void fillContainerPanel();
+ virtual void changeContainer(int index);
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionContainer.hxx"
//#define _DEVDEBUG_
#include "FormContainer.hxx"
#include "QtGuiContext.hxx"
+#include "guiObservers.hxx"
#include "Proc.hxx"
+#include "Message.hxx"
+
+#include <cassert>
using namespace std;
{
_wContainer = new FormContainer(this);
_wid->gridLayout1->addWidget(_wContainer);
- connect(_wContainer->cb_host, SIGNAL(mousePressed()),
+ connect(_wContainer->cb_resource, SIGNAL(mousePressed()),
this, SLOT(fillContainerPanel()));
connect(_wContainer->tb_container, SIGNAL(toggled(bool)),
this, SLOT(fillContainerPanel())); // --- to update display of current selection
void EditionContainer::fillContainerPanel()
{
DEBTRACE("EditionContainer::fillContainerPanel");
+ SubjectContainer *scont = dynamic_cast<SubjectContainer*>(_subject);
+ YASSERT(scont);
+ _wContainer->FillPanel(scont->getContainer());
+}
- _wContainer->le_name->setText(_subject->getName().c_str());
- _wContainer->le_instance->setReadOnly(true);
-
- _wContainer->cb_host->clear();
- _wContainer->cb_host->addItem(""); // --- when no host selected
-
- list<string> machines = QtGuiContext::getQtCurrent()->getGMain()->getMachineList();
- list<string>::iterator itm = machines.begin();
- for( ; itm != machines.end(); ++itm)
+void EditionContainer::onApply()
+{
+ DEBTRACE("EditionContainer::onApply");
+ bool edited = true;
+ if (!_wContainer->onApply())
{
- _wContainer->cb_host->addItem(QString((*itm).c_str()));
+ _isEdited = true;
+ Message mess(GuiContext::getCurrent()->_lastErrorMessage);
+ return;
}
+ edited = false;
+ _isEdited = _isEdited || edited;
+ ItemEdition::onApply();
+}
+
+void EditionContainer::onCancel()
+{
+ DEBTRACE("EditionContainer::onCancel");
+ SubjectContainer *scont = dynamic_cast<SubjectContainer*>(_subject);
+ YASSERT(scont);
+ _wContainer->FillPanel(scont->getContainer());
+ ItemEdition::onCancel();
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONCONTAINER_HXX_
#define _EDITIONCONTAINER_HXX_
public slots:
virtual void fillContainerPanel();
+ virtual void onApply();
+ virtual void onCancel();
protected:
FormContainer *_wContainer;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionControlLink.hxx"
//#define _DEVDEBUG_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONCONTROLLINK_HXX_
#define _EDITIONCONTROLLINK_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionDataLink.hxx"
+#include "PropertyEditor.hxx"
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
const char* name)
: ItemEdition(subject, parent, name)
{
+ SubjectLink * sub = dynamic_cast<SubjectLink*>(_subject);
+ if(dynamic_cast<SubjectInputDataStreamPort*>(sub->getSubjectInPort()))
+ {
+ _propeditor=new PropertyEditor(_subject);
+ _wid->gridLayout1->addWidget(_propeditor);
+ }
}
EditionDataLink::~EditionDataLink()
{
}
+void EditionDataLink::update(GuiEvent event, int type, Subject* son)
+{
+ DEBTRACE("EditionDataLink::update " <<eventName(event) << " " << type);
+ if(event == SETVALUE && _propeditor)
+ _propeditor->update();
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONDATALINK_HXX_
#define _EDITIONDATALINK_HXX_
{
namespace HMI
{
+ class PropertyEditor;
class EditionDataLink: public ItemEdition
{
QWidget* parent = 0,
const char* name = 0);
virtual ~EditionDataLink();
+ virtual void update(GuiEvent event, int type, Subject* son);
// informations
+ protected:
+ PropertyEditor* _propeditor;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionDataType.hxx"
//#define _DEVDEBUG_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONDATATYPE_HXX_
#define _EDITIONDATATYPE_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionElementaryNode.hxx"
#include "ValueDelegate.hxx"
#include "QtGuiContext.hxx"
+#include "Proc.hxx"
#include "Port.hxx"
#include "DataPort.hxx"
#include "TypeCode.hxx"
_valueDelegate = 0;
_subElemNode = dynamic_cast<SubjectElementaryNode*>(_subject);
- assert(_subElemNode);
+ YASSERT(_subElemNode);
_valueDelegate = new ValueDelegate(parent);
connect(_valueDelegate, SIGNAL(commitData(QWidget*)),
int numRows = model->rowCount(parentIndex);
if (_tvInPorts)
{
+ _tvInPorts->cb_insert->setCurrentIndex(0);
_tvInPorts->setNode(_subElemNode);
_tvInPorts->tv_ports->setRootIndex(parentIndex);
for (int row = 0; row < numRows; ++row)
}
if (_tvOutPorts)
{
+ _tvOutPorts->cb_insert->setCurrentIndex(0);
_tvOutPorts->setNode(_subElemNode);
_tvOutPorts->tv_ports->setRootIndex(parentIndex);
for (int row = 0; row < numRows; ++row)
return true;
}
-void EditionElementaryNode::createTablePorts()
+void EditionElementaryNode::createTablePorts(QLayout* layout)
{
_twPorts = new QTabWidget(this);
- _wid->gridLayout1->addWidget(_twPorts);
+ layout->addWidget(_twPorts);
SchemaModel *model = QtGuiContext::getQtCurrent()->getSchemaModel();
QModelIndex schemIndex = model->index(0, 0, QModelIndex());
{
DEBTRACE("EditionElementaryNode::onCommitData " << editor);
GenericEditor* gedit = dynamic_cast<GenericEditor*>(editor);
- assert(gedit);
+ YASSERT(gedit);
QString val = gedit->GetStrValue();
DEBTRACE(val.toStdString());
Subject *sub = gedit->getSubject();
- assert(sub);
+ YASSERT(sub);
SubjectDataPort *sdp = dynamic_cast<SubjectDataPort*>(sub);
- assert(sdp);
+ YASSERT(sdp);
string strval = val.toStdString();
bool isOk = false;
if (gedit->getColumnInSubject() == YValue)
{
- if (sdp->getPort()->edGetType()->kind() == YACS::ENGINE::String)
- strval = "\"" + strval + "\"";
DEBTRACE(strval);
isOk = sdp->setValue(strval);
+
+ GuiExecutor* executor = QtGuiContext::getQtCurrent()->getGuiExecutor();
+ if (executor) executor->setInPortValue(sdp->getPort(), strval);
}
else // --- YLabel
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONELEMENTARYNODE_HXX_
#define _EDITIONELEMENTARYNODE_HXX_
protected:
virtual bool hasInputPorts();
virtual bool hasOutputPorts();
- virtual void createTablePorts();
+ virtual void createTablePorts(QLayout* layout);
SubjectElementaryNode *_subElemNode;
QTabWidget* _twPorts;
TablePortsEdition* _tvInPorts;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionForEachLoop.hxx"
#include "FormEachLoop.hxx"
+#include "Node.hxx"
+#include "ForEachLoop.hxx"
+#include "TypeCode.hxx"
+#include "QtGuiContext.hxx"
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
using namespace YACS;
using namespace YACS::HMI;
+using namespace YACS::ENGINE;
EditionForEachLoop::EditionForEachLoop(Subject* subject,
QWidget* parent,
: EditionNode(subject, parent, name)
{
_formEachLoop = new FormEachLoop(this);
+ _nbBranches = 1;
_wid->gridLayout1->addWidget(_formEachLoop);
_formEachLoop->sb_nbranch->setMinimum(1);
_formEachLoop->sb_nbranch->setMaximum(INT_MAX);
- connect(_formEachLoop->sb_nbranch, SIGNAL(valueChanged(const QString &)),
- this, SLOT(onModifyNbBranches(const QString &)));
+ Node* node=_subjectNode->getNode();
+ ForEachLoop *fe = dynamic_cast<ForEachLoop*>(node);
+ if(fe)
+ _formEachLoop->lineEdit->setText(fe->edGetSamplePort()->edGetType()->name());
+ connect(_formEachLoop->sb_nbranch, SIGNAL(editingFinished()),
+ this, SLOT(onNbBranchesEdited()));
+
+ connect(_formEachLoop->lineEdit_2, SIGNAL(editingFinished()),this,SLOT(onModifyCollection()));
+
}
EditionForEachLoop::~EditionForEachLoop()
{
}
-void EditionForEachLoop::onModifyNbBranches(const QString &text)
+void EditionForEachLoop::onModifyCollection()
{
- SubjectForEachLoop *sfe = dynamic_cast<SubjectForEachLoop*>(_subject);
- assert(sfe);
- sfe->setNbBranches(text.toStdString());
+ bool isOk = false;
+ Node* node=_subjectNode->getNode();
+ ForEachLoop *fe = dynamic_cast<ForEachLoop*>(node);
+ InputPort* dp=fe->edGetSeqOfSamplesPort();
+ SubjectDataPort* sdp = QtGuiContext::getQtCurrent()->_mapOfSubjectDataPort[dp];
+ isOk=sdp->setValue(_formEachLoop->lineEdit_2->text().toStdString());
+ DEBTRACE(isOk);
+}
+
+void EditionForEachLoop::onNbBranchesEdited()
+{
+ int newval = _formEachLoop->sb_nbranch->value();
+ DEBTRACE("EditionForEachLoop::onNbBranchesEdited " << _nbBranches << " --> " << newval);
+ if (newval != _nbBranches)
+ {
+ SubjectForEachLoop *sfe = dynamic_cast<SubjectForEachLoop*>(_subject);
+ YASSERT(sfe);
+ QString text = _formEachLoop->sb_nbranch->cleanText();
+ sfe->setNbBranches(text.toStdString());
+ }
}
void EditionForEachLoop::synchronize()
ss >> i;
DEBTRACE(i);
_formEachLoop->sb_nbranch->setValue(i);
+ _nbBranches = i;
+
+ //smplscollection
+ InputPort* dp=_subjectNode->getNode()->getInputPort("SmplsCollection");
+ _formEachLoop->lineEdit_2->setText(dp->getAsString().c_str());
break;
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONFOREACHLOOP_HXX_
#define _EDITIONFOREACHLOOP_HXX_
Q_OBJECT
public slots:
- virtual void onModifyNbBranches(const QString &text);
+ virtual void onModifyCollection();
+ virtual void onNbBranchesEdited();
public:
EditionForEachLoop(Subject* subject,
protected:
FormEachLoop *_formEachLoop;
+ int _nbBranches;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionInputPort.hxx"
#include "QtGuiContext.hxx"
#include "DataPort.hxx"
{
}
+void EditionInputPort::select(bool isSelected)
+{
+ DEBTRACE("EditionInputPort::select " << isSelected);
+ if (isSelected)
+ {
+ Subject *snode = _subject->getParent();
+ if (snode)
+ {
+ if(QtGuiContext::getQtCurrent()->_mapOfEditionItem.count(snode) == 0)
+ {
+ //panel is not created. Force its creation
+ update(YACS::HMI::ADD,snode->getType(),snode);
+ }
+ QWidget *widget = QtGuiContext::getQtCurrent()->_mapOfEditionItem[snode];
+ ItemEdition *item = dynamic_cast<ItemEdition*>(widget);
+ item->synchronize();
+ QtGuiContext::getQtCurrent()->getStackedWidget()->setCurrentWidget(widget);
+ }
+ else
+ {
+ synchronize();
+ QtGuiContext::getQtCurrent()->getStackedWidget()->setCurrentWidget(this);
+ }
+ }
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONINPUTPORT_HXX_
#define _EDITIONINPUTPORT_HXX_
QWidget* parent = 0,
const char* name = 0);
virtual ~EditionInputPort();
+ virtual void select(bool isSelected);
// changement de type ?
// edition valeur initiale
};
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionLoop.hxx"
#include "FormLoop.hxx"
+#include "Node.hxx"
+#include "OutputPort.hxx"
+#include "QtGuiContext.hxx"
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
: EditionNode(subject, parent, name)
{
_formLoop = new FormLoop(this);
+ _nbsteps = 0;
_wid->gridLayout1->addWidget(_formLoop);
+
+ QHBoxLayout* _hbl_index = new QHBoxLayout();
+ QLabel* _la_index = new QLabel(this);
+ _hbl_index->addWidget(_la_index);
+ _la_index->setText("index:");
+ _le_index = new QLineEdit(this);
+ _le_index->setText(QString::number(0));
+ _le_index->setReadOnly(true);
+ _hbl_index->addWidget(_le_index);
+ _formLoop->gridLayout->addLayout(_hbl_index, 1, 0);
+
_formLoop->sb_nsteps->setMinimum(0);
_formLoop->sb_nsteps->setMaximum(INT_MAX);
- connect(_formLoop->sb_nsteps, SIGNAL(valueChanged(const QString &)),
- this, SLOT(onModifyNbSteps(const QString &)));
+ connect(_formLoop->sb_nsteps, SIGNAL(editingFinished()),
+ this, SLOT(onNbStepsEdited()));
}
EditionLoop::~EditionLoop()
{
}
-void EditionLoop::onModifyNbSteps(const QString &text)
+void EditionLoop::onNbStepsEdited()
{
- SubjectForLoop *sfl = dynamic_cast<SubjectForLoop*>(_subject);
- assert(sfl);
- sfl->setNbSteps(text.toStdString());
+ int newval = _formLoop->sb_nsteps->value();
+ DEBTRACE("EditionLoop::onNbStepsEdited " << _nbsteps << " --> " << newval);
+ if (newval != _nbsteps)
+ {
+ SubjectForLoop *sfl = dynamic_cast<SubjectForLoop*>(_subject);
+ YASSERT(sfl);
+ QString text = _formLoop->sb_nsteps->cleanText();
+ sfl->setNbSteps(text.toStdString());
+ }
}
void EditionLoop::synchronize()
switch (event)
{
case SETVALUE:
- SubjectComposedNode * scn = dynamic_cast<SubjectComposedNode*>(_subject);
- string val = scn->getValue();
- istringstream ss(val);
- DEBTRACE(val);
- int i = 0;
- ss >> i;
- DEBTRACE(i);
- _formLoop->sb_nsteps->setValue(i);
- break;
+ {
+ SubjectComposedNode * scn = dynamic_cast<SubjectComposedNode*>(_subject);
+ string val = scn->getValue();
+ istringstream ss(val);
+ DEBTRACE(val);
+ int i = 0;
+ ss >> i;
+ DEBTRACE(i);
+ _formLoop->sb_nsteps->setValue(i);
+ _nbsteps = i;
+
+ YACS::ENGINE::OutputPort* odp=scn->getNode()->getOutputPort("index");
+ SubjectDataPort* sodp = QtGuiContext::getQtCurrent()->_mapOfSubjectDataPort[odp];
+ _le_index->setText(QString::fromStdString(sodp->getExecValue()));
+ break;
+ }
+ case UPDATEPROGRESS:
+ {
+ SubjectComposedNode * scn = dynamic_cast<SubjectComposedNode*>(_subject);
+ YACS::ENGINE::OutputPort* odp=scn->getNode()->getOutputPort("index");
+ SubjectDataPort* sodp = QtGuiContext::getQtCurrent()->_mapOfSubjectDataPort[odp];
+ _le_index->setText(QString::fromStdString(sodp->getExecValue()));
+ break;
+ }
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONLOOP_HXX_
#define _EDITIONLOOP_HXX_
Q_OBJECT
public slots:
- virtual void onModifyNbSteps(const QString &text);
+ virtual void onNbStepsEdited();
public:
EditionLoop(Subject* subject,
protected:
FormLoop *_formLoop;
+ QLineEdit *_le_index;
+ int _nbsteps;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionNode.hxx"
#include "QtGuiContext.hxx"
#include "Proc.hxx"
_wid->le_name->setReadOnly(false);
_subjectNode = dynamic_cast<SubjectNode*>(_subject);
- assert(_subjectNode);
+ YASSERT(_subjectNode);
_le_fullName = 0;
if (!dynamic_cast<SubjectProc*>(_subject))
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONNODE_HXX_
#define _EDITIONNODE_HXX_
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "EditionOptimizerLoop.hxx"
+#include "FormOptimizerLoop.hxx"
+#include "Node.hxx"
+#include "OptimizerLoop.hxx"
+#include "TypeCode.hxx"
+#include "QtGuiContext.hxx"
+#include "Message.hxx"
+
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
+#include <sstream>
+
+using namespace std;
+
+using namespace YACS;
+using namespace YACS::HMI;
+using namespace YACS::ENGINE;
+
+EditionOptimizerLoop::EditionOptimizerLoop(Subject* subject,
+ QWidget* parent,
+ const char* name)
+ : EditionNode(subject, parent, name)
+{
+ _formOptimizerLoop = new FormOptimizerLoop(this);
+ _nbBranches = 1;
+ _wid->gridLayout1->addWidget(_formOptimizerLoop);
+ _formOptimizerLoop->sb_nbranch->setMinimum(1);
+ _formOptimizerLoop->sb_nbranch->setMaximum(INT_MAX);
+
+ connect(_formOptimizerLoop->sb_nbranch, SIGNAL(editingFinished()),
+ this, SLOT(onNbBranchesEdited()));
+ connect(_formOptimizerLoop->lineEdit_initValue, SIGNAL(editingFinished()),
+ this, SLOT(onModifyInitFile()));
+ connect(_formOptimizerLoop->lineEdit_entry, SIGNAL(editingFinished()),
+ this, SLOT(onModifyEntry()));
+ connect(_formOptimizerLoop->lineEdit_lib, SIGNAL(editingFinished()),
+ this, SLOT(onModifyLib()));
+}
+
+EditionOptimizerLoop::~EditionOptimizerLoop()
+{
+}
+
+void EditionOptimizerLoop::onModifyInitFile()
+{
+ bool isOk = false;
+ Node* node=_subjectNode->getNode();
+ OptimizerLoop *ol = dynamic_cast<OptimizerLoop*>(node);
+ InputPort * dp = ol->edGetAlgoInitPort();
+ SubjectDataPort* sdp = QtGuiContext::getQtCurrent()->_mapOfSubjectDataPort[dp];
+ isOk=sdp->setValue(_formOptimizerLoop->lineEdit_initValue->text().toStdString());
+ DEBTRACE(isOk);
+}
+
+void EditionOptimizerLoop::onModifyEntry()
+{
+ DEBTRACE("EditionOptimizerLoop::onModifyEntry");
+ OptimizerLoop *oloop = dynamic_cast<OptimizerLoop*>(_subjectNode->getNode());
+ if (oloop->getSymbol() == _formOptimizerLoop->lineEdit_entry->text().toStdString()) return;
+
+ bool isOk = false;
+ SubjectOptimizerLoop *ol = dynamic_cast<SubjectOptimizerLoop*>(_subjectNode);
+ isOk=ol->setAlgorithm(_formOptimizerLoop->lineEdit_lib->text().toStdString(),
+ _formOptimizerLoop->lineEdit_entry->text().toStdString());
+ if(!isOk)
+ Message mess;
+ DEBTRACE(isOk);
+}
+
+void EditionOptimizerLoop::onModifyLib()
+{
+ DEBTRACE("EditionOptimizerLoop::onModifyLib");
+ OptimizerLoop *oloop = dynamic_cast<OptimizerLoop*>(_subjectNode->getNode());
+ if(oloop->getAlgLib() == _formOptimizerLoop->lineEdit_lib->text().toStdString()) return;
+
+ bool isOk = false;
+ SubjectOptimizerLoop *ol = dynamic_cast<SubjectOptimizerLoop*>(_subjectNode);
+ isOk=ol->setAlgorithm(_formOptimizerLoop->lineEdit_lib->text().toStdString(),
+ _formOptimizerLoop->lineEdit_entry->text().toStdString());
+ if (!isOk && !_formOptimizerLoop->lineEdit_lib->text().isEmpty() &&
+ !_formOptimizerLoop->lineEdit_entry->text().isEmpty())
+ Message mess;
+ DEBTRACE(isOk);
+}
+
+void EditionOptimizerLoop::onNbBranchesEdited()
+{
+ int newval = _formOptimizerLoop->sb_nbranch->value();
+ DEBTRACE("EditionOptimizerLoop::onNbBranchesEdited " << _nbBranches << " --> " << newval);
+ if (newval != _nbBranches)
+ {
+ SubjectOptimizerLoop *sol = dynamic_cast<SubjectOptimizerLoop*>(_subject);
+ YASSERT(sol);
+ QString text = _formOptimizerLoop->sb_nbranch->cleanText();
+ sol->setNbBranches(text.toStdString());
+ }
+}
+
+void EditionOptimizerLoop::synchronize()
+{
+ _subject->update(SETVALUE, 0, _subject);
+}
+
+void EditionOptimizerLoop::update(GuiEvent event, int type, Subject* son)
+{
+ DEBTRACE("EditionOptimizerLoop::update " << eventName(event) << " " << type);
+ EditionNode::update(event, type, son);
+ switch (event)
+ {
+ case SETVALUE:
+ // Nb branches
+ SubjectComposedNode * scn = dynamic_cast<SubjectComposedNode*>(_subject);
+ string val = scn->getValue();
+ istringstream ss(val);
+ DEBTRACE( val);
+ int i = 0;
+ ss >> i;
+ DEBTRACE(i);
+ _formOptimizerLoop->sb_nbranch->setValue(i);
+ _nbBranches = i;
+
+ OptimizerLoop * ol = dynamic_cast<OptimizerLoop *>(_subjectNode->getNode());
+
+ // Algo init value
+ InputPort * dp = ol->edGetAlgoInitPort();
+ _formOptimizerLoop->lineEdit_initValue->setText(dp->getAsString().c_str());
+
+ // Algo library and entry
+ _formOptimizerLoop->lineEdit_entry->setText(QString::fromStdString(ol->getSymbol()));
+ _formOptimizerLoop->lineEdit_lib->setText(QString::fromStdString(ol->getAlgLib()));
+
+ // Type names
+ _formOptimizerLoop->label_evalSampleType->setText(ol->edGetSamplePort()->edGetType()->name());
+ _formOptimizerLoop->label_evalResultType->setText(ol->edGetPortForOutPool()->edGetType()->name());
+ _formOptimizerLoop->label_algoInitType->setText(ol->edGetAlgoInitPort()->edGetType()->name());
+ _formOptimizerLoop->label_algoResultType->setText(ol->edGetAlgoResultPort()->edGetType()->name());
+ break;
+ }
+}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _EDITIONOPTIMIZERLOOP_HXX_
+#define _EDITIONOPTIMIZERLOOP_HXX_
+
+#include "EditionNode.hxx"
+
+namespace YACS
+{
+ namespace HMI
+ {
+ class FormOptimizerLoop;
+
+ class EditionOptimizerLoop: public EditionNode
+ {
+ Q_OBJECT
+
+ public slots:
+ virtual void onModifyInitFile();
+ virtual void onModifyEntry();
+ virtual void onModifyLib();
+ virtual void onNbBranchesEdited();
+
+ public:
+ EditionOptimizerLoop(Subject* subject,
+ QWidget* parent = 0,
+ const char* name = 0);
+ virtual ~EditionOptimizerLoop();
+ virtual void synchronize();
+ virtual void update(GuiEvent event, int type, Subject* son);
+
+ protected:
+ FormOptimizerLoop *_formOptimizerLoop;
+ int _nbBranches;
+ };
+ }
+}
+#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionOutNode.hxx"
//#define _DEVDEBUG_
const char* name)
: EditionElementaryNode(subject, parent, name)
{
- createTablePorts();
+ createTablePorts(_wid->gridLayout1);
setEditablePorts(true);
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONOUTNODE_HXX_
#define _EDITIONOUTNODE_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionOutputPort.hxx"
#include "QtGuiContext.hxx"
#include "DataPort.hxx"
{
}
+void EditionOutputPort::select(bool isSelected)
+{
+ DEBTRACE("EditionOutputPort::select " << isSelected);
+ if (isSelected)
+ {
+ Subject *snode = _subject->getParent();
+ if (snode)
+ {
+ if(QtGuiContext::getQtCurrent()->_mapOfEditionItem.count(snode) == 0)
+ {
+ //panel is not created. Force its creation
+ update(YACS::HMI::ADD,snode->getType(),snode);
+ }
+ QWidget *widget = QtGuiContext::getQtCurrent()->_mapOfEditionItem[snode];
+ ItemEdition *item = dynamic_cast<ItemEdition*>(widget);
+ item->synchronize();
+ QtGuiContext::getQtCurrent()->getStackedWidget()->setCurrentWidget(widget);
+ }
+ else
+ {
+ synchronize();
+ QtGuiContext::getQtCurrent()->getStackedWidget()->setCurrentWidget(this);
+ }
+ }
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONOUTPUTPORT_HXX_
#define _EDITIONOUTPUTPORT_HXX_
QWidget* parent = 0,
const char* name = 0);
virtual ~EditionOutputPort();
+ virtual void select(bool isSelected);
// changement de type ?
// edition valeur initiale (noeud in)
};
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionPresetNode.hxx"
//#define _DEVDEBUG_
const char* name)
: EditionElementaryNode(subject, parent, name)
{
- createTablePorts();
+ createTablePorts(_wid->gridLayout1);
setEditablePorts(true);
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONPRESETNODE_HXX_
#define _EDITIONPRESETNODE_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionProc.hxx"
#include "QtGuiContext.hxx"
#include "LinkInfo.hxx"
#include "Logger.hxx"
+#include <QComboBox>
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
_wid->gridLayout1->addWidget(_statusLog);
_errorLog = "";
_modifLog = "";
+
+ if (!QtGuiContext::getQtCurrent()->isEdition())
+ {
+ QHBoxLayout* hbox = new QHBoxLayout();
+ QLabel* la = new QLabel("Shutdown level:",this);
+ QComboBox* cb = new QComboBox(this);
+ cb->addItem("0",0 );
+ cb->addItem("1",1 );
+ cb->addItem("2",2 );
+ cb->addItem("3",3 );
+ int level=1;
+ if (QtGuiContext::getQtCurrent()->getGuiExecutor())
+ level=QtGuiContext::getQtCurrent()->getGuiExecutor()->getShutdownLevel();
+ DEBTRACE(level);
+ cb->setCurrentIndex(level);
+ connect(cb, SIGNAL(currentIndexChanged(int)), this, SLOT(onLevelChange(int)));
+ hbox->addWidget(la);
+ hbox->addWidget(cb);
+ _wid->gridLayout1->addLayout(hbox,4,0);
+ }
}
EditionProc::~EditionProc()
{
DEBTRACE("EditionProc::update " << GuiObserver::eventName(event));
EditionBloc::update(event, type, son);
- YACS::ENGINE::Proc* proc = QtGuiContext::getQtCurrent()->getProc();
- Logger* logger = 0;
string statusLog = "";
switch (event)
{
_modifLog = "";
else
_modifLog = "--- some elements are modified and not taken into account. Confirmation or annulation required ---\n";
- statusLog = _modifLog + _errorLog;
- _statusLog->setText(statusLog.c_str());
- break;
case UPDATE:
- if (!proc->isValid())
+ synchronize();
+ break;
+ case UPDATEPROGRESS:
{
- _errorLog = "--- YACS schema is not valid ---\n\n";
- _errorLog += proc->getErrorReport();
+ if(type != YACS::FINISHED)break;
+ if (!QtGuiContext::getQtCurrent()) break;
+ if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) break;
+ YACS::ENGINE::Proc* proc = QtGuiContext::getQtCurrent()->getProc();
+ _errorLog = QtGuiContext::getQtCurrent()->getGuiExecutor()->getErrorReport(proc);
+ _statusLog->setText(QString::fromStdString(_errorLog));
+ break;
}
- else
+ default:
+ ;
+ }
+
+}
+
+void EditionProc::synchronize()
+{
+ DEBTRACE("EditionProc::synchronize");
+ YACS::ENGINE::Proc* proc = QtGuiContext::getQtCurrent()->getProc();
+ Logger* logger = 0;
+ string statusLog = "";
+
+ if (!QtGuiContext::getQtCurrent()->isEdition())
+ return;
+ if (!proc->isValid())
+ {
+ _errorLog = "--- YACS schema is not valid ---\n\n";
+ _errorLog += proc->getErrorReport();
+ DEBTRACE(_errorLog);
+ }
+ else
+ {
+ // --- Check consistency
+ LinkInfo info(LinkInfo::ALL_DONT_STOP);
+ _errorLog="";
+ try
{
- // --- Check consistency
- LinkInfo info(LinkInfo::ALL_DONT_STOP);
proc->checkConsistency(info);
if (info.areWarningsOrErrors())
- _errorLog = info.getGlobalRepr();
+ _errorLog += info.getGlobalRepr();
else
{
- _errorLog = "--- No Validity Errors ---\n";
+ _errorLog += "--- No Validity Errors ---\n";
_errorLog += "--- No Consistency Errors ---\n";
}
}
- // --- Add initial logger info
- logger = proc->getLogger("parser");
- if (!logger->isEmpty())
+ catch (Exception &ex)
{
- _errorLog += "--- Original file import log ---\n";
- _errorLog += logger->getStr();
+ _errorLog = "--- YACS schema has consistency errors ---\n\n";
+ _errorLog += ex.what();
}
- statusLog = _modifLog + _errorLog;
- _statusLog->setText(statusLog.c_str());
- break;
- default:
- ;
+ DEBTRACE(_errorLog);
}
+ // --- Add initial logger info
+ logger = proc->getLogger("parser");
+ if (!logger->isEmpty())
+ {
+ _errorLog += "--- Original file import log ---\n";
+ _errorLog += logger->getStr();
+ }
+ statusLog = _modifLog + _errorLog;
+ _statusLog->setText(statusLog.c_str());
+}
+void EditionProc::onLevelChange(int index)
+{
+ DEBTRACE("EditionProc::onLevelChange " << index);
+ if (QtGuiContext::getQtCurrent()->getGuiExecutor())
+ QtGuiContext::getQtCurrent()->getGuiExecutor()->setShutdownLevel(index);
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONPROC_HXX_
#define _EDITIONPROC_HXX_
class EditionProc: public EditionBloc
{
+ Q_OBJECT
+
+ public slots:
+ virtual void onLevelChange(int index);
+
public:
EditionProc(Subject* subject,
QWidget* parent = 0,
const char* name = 0);
virtual ~EditionProc();
virtual void update(GuiEvent event, int type, Subject* son);
+ virtual void synchronize();
// liste de nodes fils
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionPyFunc.hxx"
#include "InlineNode.hxx"
+#include "InputPort.hxx"
+#include "OutputPort.hxx"
+#include "QtGuiContext.hxx"
+#include "Container.hxx"
+
+#include <QToolButton>
+
+#if HAS_QSCI4>0
+#include <qsciscintilla.h>
+#include <qscilexerpython.h>
+#endif
#include <cassert>
using namespace YACS;
using namespace YACS::HMI;
+using namespace YACS::ENGINE;
+
EditionPyFunc::EditionPyFunc(Subject* subject,
QWidget* parent,
_liFuncName = 0;
_subFuncNode = dynamic_cast<SubjectPyFuncNode*>(_subject);
- assert(_subFuncNode);
+ YASSERT(_subFuncNode);
YACS::ENGINE::InlineFuncNode *pyFuncNode
= dynamic_cast<YACS::ENGINE::InlineFuncNode*>(_subFuncNode->getNode());
- assert(pyFuncNode);
+ YASSERT(pyFuncNode);
+
+ _glayout->removeWidget( _sci );
+ QGridLayout *glt = new QGridLayout();
_funcName = pyFuncNode->getFname();
QLabel* laFuncName = new QLabel("laFuncName", this );
- _wid->gridLayout1->addWidget( laFuncName );
+ glt->addWidget(laFuncName, 0, 0, 1, 1);
laFuncName->setText("Function Name:");
_liFuncName = new QLineEdit( "liFuncName", this );
- _wid->gridLayout1->addWidget( _liFuncName );
+ glt->addWidget(_liFuncName, 0, 1, 1, 1);
_liFuncName->setText(_funcName.c_str());
+ QPushButton* gener_template = new QPushButton("Template",this);
+ connect(gener_template,SIGNAL(clicked()),this, SLOT(onTemplate()));
+ glt->addWidget(gener_template, 0, 2, 1, 1);
+ _glayout->addLayout( glt , 1);
+
+ _glayout->addWidget( _sci );
+
connect(_liFuncName, SIGNAL(textChanged(const QString&)),
this, SLOT(onFuncNameModified(const QString&)));
}
{
bool funcNameEdited = false;
string funcName = _liFuncName->text().toStdString();
+ if (funcName.empty())
+ {
+ _liFuncName->setText(_funcName.c_str());
+ funcName = _funcName;
+ }
if (funcName != _funcName)
{
funcNameEdited = true;
{
if (_funcName != text.toStdString()) setEdited(true);
}
+
+void EditionPyFunc::onTemplate()
+{
+ if(_funcName=="")return;
+
+ ElementaryNode* node = dynamic_cast<ElementaryNode*>(_subFuncNode->getNode());
+
+ std::string text;
+ text = "def " + _funcName + "(";
+
+ std::list<InputPort*> iplist = node->getSetOfInputPort();
+ std::list<InputPort*>::iterator ipos = iplist.begin();
+ for (; ipos != iplist.end(); ipos++)
+ {
+ text = text + (*ipos)->getName() + ",";
+ }
+ text = text + "):\n";
+ text = text + " return ";
+
+ std::list<OutputPort*> oplist = node->getSetOfOutputPort();
+ std::list<OutputPort*>::iterator opos = oplist.begin();
+ for (; opos != oplist.end(); opos++)
+ {
+ text = text + (*opos)->getName() + ",";
+ }
+ text[text.length()-1]=' ';
+ text = text + "\n";
+ _sci->append(text.c_str());
+ onApply();
+}
+
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONPYFUNC_HXX_
#define _EDITIONPYFUNC_HXX_
#include "EditionScript.hxx"
+#include "FormComponent.hxx"
+#include <QRadioButton>
namespace YACS
{
virtual void onApply();
virtual void onCancel();
virtual void onFuncNameModified(const QString &text);
+ virtual void onTemplate();
public:
EditionPyFunc(Subject* subject,
- QWidget* parent = 0,
- const char* name = 0);
+ QWidget* parent = 0,
+ const char* name = 0);
virtual ~EditionPyFunc();
protected:
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionSalomeNode.hxx"
+#include "PropertyEditor.hxx"
#include "FormComponent.hxx"
#include "FormContainer.hxx"
#include "ServiceNode.hxx"
#include "ComponentInstance.hxx"
#include "QtGuiContext.hxx"
#include "Container.hxx"
+#include "Message.hxx"
#include <cassert>
#include <map>
: EditionElementaryNode(subject, parent, name)
{
+ // --- create property editor panel
+ _propeditor=new PropertyEditor(_subject);
+ _wid->gridLayout1->addWidget(_propeditor);
+
// --- create container and component panels
_wContainer = new FormContainer(this);
_wid->gridLayout1->addWidget(_wContainer);
- connect(_wContainer->cb_host, SIGNAL(mousePressed()),
+ connect(_wContainer->cb_resource, SIGNAL(mousePressed()),
this, SLOT(fillContainerPanel()));
- connect(_wContainer->cb_host, SIGNAL(activated(int)),
+ connect(_wContainer->cb_resource, SIGNAL(activated(int)),
this, SLOT(changeHost(int)));
connect(_wContainer->tb_container, SIGNAL(toggled(bool)),
this, SLOT(fillContainerPanel())); // --- to update display of current selection
_wid->gridLayout1->addLayout(_hbl_method, _wid->gridLayout1->rowCount(), 0, 1, 1);
_la_method->setText("Method:");
// SubjectServiceNode *ssn = dynamic_cast<SubjectServiceNode*>(_subject);
-// assert(ssn);
+// YASSERT(ssn);
_servNode =
dynamic_cast<YACS::ENGINE::ServiceNode*>(_subElemNode->getNode());
- assert(_servNode);
+ YASSERT(_servNode);
_le_method->setText((_servNode->getMethod()).c_str());
_le_method->setReadOnly(true);
fillComponentPanel();
- createTablePorts();
+ createTablePorts(_wid->gridLayout1);
}
EditionSalomeNode::~EditionSalomeNode()
DEBTRACE("EditionSalomeNode::update ");
EditionElementaryNode::update(event, type, son);
SubjectReference* subref= 0;
- switch (event)
+ switch (event)
{
case ADDREF:
DEBTRACE("ADDREF");
subref = dynamic_cast<SubjectReference*>(son);
- assert(subref);
+ YASSERT(subref);
DEBTRACE(subref->getName() << " " << subref->getReference()->getName());
fillComponentPanel();
+ fillContainerPanel();
break;
case ASSOCIATE:
fillContainerPanel();
break;
+ case SETVALUE:
+ _propeditor->update();
+ break;
+
default:
;
}
}
+void EditionSalomeNode::synchronize()
+{
+ EditionElementaryNode::synchronize();
+ _wContainer->tb_container->setChecked(FormContainer::_checked);
+ _wComponent->tb_component->setChecked(FormComponent::_checked);
+ fillComponentPanel();
+ fillContainerPanel();
+}
+
/*! must be updated when associate service to component instance, or when the list of
* available component instances changes.
*/
Proc* proc = GuiContext::getCurrent()->getProc();
_wComponent->cb_instance->clear();
- map<pair<string,int>,ComponentInstance*>::const_iterator it = proc->componentInstanceMap.begin();
+ map<string,ComponentInstance*>::const_iterator it = proc->componentInstanceMap.begin();
for(; it != proc->componentInstanceMap.end(); ++it)
{
ComponentInstance *inst=(*it).second;
void EditionSalomeNode::fillContainerPanel()
{
+ DEBTRACE("EditionSalomeNode::fillContainerPanel");
ComponentInstance *compoInst = _servNode->getComponent();
if (compoInst)
{
for(; it != proc->containerMap.end(); ++it)
_wComponent->cb_container->addItem( QString((*it).first.c_str()));
- int index = _wComponent->cb_container->findText(compoInst->getContainer()->getName().c_str());
- _wComponent->cb_container->setCurrentIndex(index);
-
- _wContainer->le_name->setText(compoInst->getContainer()->getName().c_str());
- _wContainer->le_instance->setReadOnly(true);
-
- _wContainer->cb_host->clear();
- _wContainer->cb_host->addItem(""); // --- when no host selected
- list<string> machines = QtGuiContext::getQtCurrent()->getGMain()->getMachineList();
- list<string>::iterator itm = machines.begin();
- for( ; itm != machines.end(); ++itm)
+ Container * cont = compoInst->getContainer();
+ if (cont)
{
- _wContainer->cb_host->addItem(QString((*itm).c_str()));
+ int index = _wComponent->cb_container->findText(cont->getName().c_str());
+ _wComponent->cb_container->setCurrentIndex(index);
+ _wContainer->FillPanel(cont);
}
}
}
void EditionSalomeNode::changeInstance(int index)
{
string instName = _wComponent->cb_instance->itemText(index).toStdString();
- int i = instName.find_last_of('_');
- if (i<0) return;
-
- DEBTRACE(instName << " " << i);
- string compoName = instName;
- compoName.erase(i);
- string inst = instName;
- inst.erase(0,i+1);
- DEBTRACE(instName << " " << compoName << " " << inst);
- i = atoi(inst.c_str());
- pair<string,int> aKey(compoName,i);
-
Proc* proc = GuiContext::getCurrent()->getProc();
ComponentInstance *newCompoInst = 0;
ComponentInstance *oldCompoInst = _servNode->getComponent();
- if (proc->componentInstanceMap.count(aKey))
- newCompoInst = proc->componentInstanceMap[aKey];
+ if (proc->componentInstanceMap.count(instName))
+ newCompoInst = proc->componentInstanceMap[instName];
else DEBTRACE("-------------> not found : " << instName);
if (newCompoInst && (newCompoInst != oldCompoInst))
{
- assert(GuiContext::getCurrent()->_mapOfSubjectComponent.count(newCompoInst));
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectComponent.count(newCompoInst));
SubjectServiceNode *ssn = dynamic_cast<SubjectServiceNode*>(_subject);
- ssn->associateToComponent(GuiContext::getCurrent()->_mapOfSubjectComponent[newCompoInst]);
+ if(!ssn->associateToComponent(GuiContext::getCurrent()->_mapOfSubjectComponent[newCompoInst]))
+ Message mess;
}
}
DEBTRACE("-------------> not found : " << contName);
return;
}
- assert(GuiContext::getCurrent()->_mapOfSubjectContainer.count(newContainer));
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectContainer.count(newContainer));
SubjectContainer *scnt = GuiContext::getCurrent()->_mapOfSubjectContainer[newContainer];
SubjectServiceNode *ssn = dynamic_cast<SubjectServiceNode*>(_subject);
SubjectComponent *sco =
dynamic_cast<SubjectComponent*>(ssn->getSubjectReference()->getReference());
- assert (sco);
+ YASSERT(sco);
sco->associateToContainer(scnt);
}
void EditionSalomeNode::changeHost(int index)
{
- string hostName = _wContainer->cb_host->itemText(index).toStdString();
+ string hostName = _wContainer->cb_resource->itemText(index).toStdString();
DEBTRACE(hostName);
}
+
+void EditionSalomeNode::onApply()
+{
+ DEBTRACE("EditionSalomeNode::onApply");
+ bool edited = true;
+ if (_wContainer->onApply())
+ edited = false;
+ _isEdited = _isEdited || edited;
+ EditionElementaryNode::onApply();
+}
+
+void EditionSalomeNode::onCancel()
+{
+ DEBTRACE("EditionSalomeNode::onCancel");
+ ComponentInstance *compoInst = _servNode->getComponent();
+ if (compoInst)
+ {
+ _wContainer->FillPanel(compoInst->getContainer());
+ }
+ EditionElementaryNode::onApply();
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONSALOMENODE_HXX_
#define _EDITIONSALOMENODE_HXX_
namespace HMI
{
+ class PropertyEditor;
// ports en cablage plus initialisation seulement
// choix de l'instance de composant
// panneau depliable instance de composant
const char* name = 0);
virtual ~EditionSalomeNode();
virtual void update(GuiEvent event, int type, Subject* son);
+ virtual void synchronize();
public slots:
virtual void fillComponentPanel();
virtual void changeInstance(int index);
virtual void changeContainer(int index);
virtual void changeHost(int index);
+ virtual void onApply();
+ virtual void onCancel();
protected:
+ PropertyEditor* _propeditor;
FormComponent *_wComponent;
FormContainer *_wContainer;
QHBoxLayout *_hbl_method;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionScript.hxx"
#include "QtGuiContext.hxx"
-
+#include "Resource.hxx"
+#include "Container.hxx"
#include "InlineNode.hxx"
#if HAS_QSCI4>0
#include <qscilexerpython.h>
#endif
+#include <QToolButton>
+#include <QSplitter>
+#include <QTemporaryFile>
+#include <QTextStream>
+#include <QProcess>
+
#include <cassert>
//#define _DEVDEBUG_
{
if (e->type() == QEvent::ShortcutOverride)
{
- QKeyEvent *ke = (QKeyEvent*)e;
- if ( ((ke->modifiers() == Qt::NoModifier) || (ke->modifiers() == Qt::ShiftModifier))
- && (ke->key() != Qt::Key_Escape))
- {
- e->accept();
- return true;
- }
+ e->accept();
+ return true;
}
return QsciScintilla::event(e);
}
_sci = 0;
_subInlineNode = dynamic_cast<SubjectInlineNode*>(_subject);
- assert(_subInlineNode);
+ YASSERT(_subInlineNode);
+
+ QSplitter *splitter = new QSplitter(this);
+ splitter->setOrientation(Qt::Vertical);
+ _wid->gridLayout1->addWidget(splitter);
+
+ QWidget* widg=new QWidget;
+ _portslayout = new QVBoxLayout;
+ widg->setLayout(_portslayout);
+ _portslayout->setMargin(1);
+ splitter->addWidget(widg);
+
+ QWidget* window=new QWidget;
+ _glayout=new QVBoxLayout;
+ window->setLayout(_glayout);
+ _glayout->setMargin(1);
+ splitter->addWidget(window);
+
+ //add an options section in ports layout for execution mode (local or remote)
+ QHBoxLayout* hboxLayout = new QHBoxLayout();
+ hboxLayout->setMargin(0);
+ QToolButton* tb_options = new QToolButton();
+ tb_options->setCheckable(true);
+ QIcon icon;
+ icon.addFile("icons:icon_down.png");
+ icon.addFile("icons:icon_up.png", QSize(), QIcon::Normal, QIcon::On);
+ tb_options->setIcon(icon);
+ hboxLayout->addWidget(tb_options);
+
+ QLabel* label = new QLabel("Execution Mode");
+ QFont font;
+ font.setBold(true);
+ font.setWeight(75);
+ label->setFont(font);
+ hboxLayout->addWidget(label);
+
+ _portslayout->addLayout(hboxLayout);
- createTablePorts();
+ fr_options = new QFrame();
+ QHBoxLayout* hboxLayout1 = new QHBoxLayout(fr_options);
+ hboxLayout1->setMargin(0);
+ radiolocal= new QRadioButton("Local");
+ radioremote= new QRadioButton("Remote");
+ radiolocal->setChecked(true);
+ hboxLayout1->addWidget(radiolocal);
+ hboxLayout1->addWidget(radioremote);
+ hboxLayout->addWidget(fr_options);
+
+ fr_container = new QFrame();
+ QHBoxLayout* hboxLayout2 = new QHBoxLayout(fr_container);
+ hboxLayout2->setMargin(0);
+ QLabel* laContainer = new QLabel("Container:");
+ hboxLayout2->addWidget(laContainer);
+ cb_container = new ComboBox();
+ hboxLayout2->addWidget(cb_container);
+ _portslayout->addWidget(fr_container);
+ //end of insertion of execution mode
+
+ createTablePorts(_portslayout);
setEditablePorts(true);
_haveScript = true;
_sci = new QTextEdit(this);
#endif
_wid->gridLayout->removeItem(_wid->spacerItem);
- _wid->gridLayout1->addWidget( _sci );
+
+ _editor = new QPushButton("External Editor", this);
+ connect(_editor, SIGNAL(clicked()), this, SLOT(onEdit()));
+ if(!Resource::pythonExternalEditor.isEmpty())
+ {
+ _glayout->addWidget( _editor );
+ }
+ _glayout->addWidget( _sci );
+
#if HAS_QSCI4>0
_sci->setUtf8(1);
QsciLexerPython *lex = new QsciLexerPython(_sci);
+ lex->setFont(Resource::pythonfont);
_sci->setLexer(lex);
_sci->setBraceMatching(QsciScintilla::SloppyBraceMatch);
_sci->setAutoIndent(1);
_sci->setIndentationGuides(1);
_sci->setIndentationsUseTabs(0);
_sci->setAutoCompletionThreshold(2);
+ //_sci->setMarginLineNumbers(1,true);
+ _sci->setMarginWidth(1,0);
+ _sci->setFolding(QsciScintilla::PlainFoldStyle);
#endif
if (!QtGuiContext::getQtCurrent()->isEdition())
}
connect(_sci, SIGNAL(textChanged()), this, SLOT(onScriptModified()));
+ connect(tb_options, SIGNAL(toggled(bool)), this, SLOT(on_tb_options_toggled(bool)));
+ connect(radioremote, SIGNAL(toggled(bool)), this, SLOT(on_remote_toggled(bool)));
+ connect(cb_container, SIGNAL(mousePressed()), this, SLOT(fillContainerPanel()));
+ connect(cb_container, SIGNAL(activated(int)), this, SLOT(changeContainer(int)));
+
+ update(UPDATE,0,0);
+ on_tb_options_toggled(false);
}
EditionScript::~EditionScript()
{
}
+void EditionScript::synchronize()
+{
+ DEBTRACE("EditionScript::synchronize " << this->_isEdited);
+ EditionElementaryNode::synchronize();
+ YACS::ENGINE::InlineNode* pyNode = dynamic_cast<YACS::ENGINE::InlineNode*>(_subInlineNode->getNode());
+ YASSERT(pyNode);
+ disconnect(_sci, SIGNAL(textChanged()), this, SLOT(onScriptModified()));
+ if (!_isEdited)
+ {
+ _sci->clear();
+ _sci->append(pyNode->getScript().c_str());
+ }
+ connect(_sci, SIGNAL(textChanged()), this, SLOT(onScriptModified()));
+}
+
void EditionScript::onApply()
{
+ DEBTRACE("EditionScript::onApply");
bool scriptEdited = false;
+#if HAS_QSCI4>0
+ _sci->lexer()->setFont(Resource::pythonfont);
+#endif
+
+ if(Resource::pythonExternalEditor.isEmpty())
+ {
+ _editor->hide();
+ _glayout->removeWidget(_editor);
+ }
+ else
+ {
+ _editor->show();
+ if(_glayout->itemAt(0)->widget() != _editor)
+ _glayout->insertWidget ( 0, _editor );
+ }
+
if (_haveScript)
{
#if HAS_QSCI4>0
if (_sci->isModified())
{
scriptEdited = true;
- bool ret = _subInlineNode->setScript(_sci->text().toStdString());
+ std::string text=_sci->text().toStdString();
+ if(text[text.length()-1] != '\n')
+ text=text+'\n';
+ bool ret = _subInlineNode->setScript(text);
if (ret) scriptEdited = false;
}
#else
if (_sci->document()->isModified())
{
scriptEdited = true;
- bool ret = _subInlineNode->setScript(_sci->document()->toPlainText().toStdString());
+ std::string text=_sci->document()->toPlainText().toStdString();
+ if(text[text.length()-1] != '\n')
+ text=text+'\n';
+ bool ret = _subInlineNode->setScript(text);
if (ret) scriptEdited = false;
}
#endif
void EditionScript::onScriptModified()
{
+ DEBTRACE("EditionScript::onScriptModified");
+ _isEdited = true;
setEdited(true);
}
+
+void EditionScript::onEdit()
+{
+ DEBTRACE("EditionScript::onEdit");
+ QTemporaryFile outFile;
+ if (!outFile.open())
+ return;
+ QString fileName = outFile.fileName();
+ QTextStream out(&outFile);
+#if HAS_QSCI4>0
+ out << _sci->text();
+#else
+ out << _sci->toPlainText();
+#endif
+ outFile.close();
+
+ QStringList options=Resource::pythonExternalEditor.split(" ");
+ QString prog=options.takeAt(0);
+ QProcess::execute(prog, QStringList() << options << fileName);
+
+ QFile inFile(fileName);
+ if (!inFile.open(QIODevice::ReadOnly))
+ return;
+ QTextStream in(&inFile);
+#if HAS_QSCI4>0
+ _sci->setText(in.readAll());
+#else
+ _sci->setPlainText(in.readAll());
+#endif
+ onApply();
+}
+
+void EditionScript::on_tb_options_toggled(bool checked)
+{
+ DEBTRACE("EditionScript::on_tb_options_toggled " << checked);
+ _checked = checked;
+ if(_checked)
+ {
+ fr_options->show();
+ if(_remote)fr_container->show();
+ }
+ else
+ {
+ fr_options->hide();
+ fr_container->hide();
+ }
+}
+
+void EditionScript::on_remote_toggled(bool checked)
+{
+ DEBTRACE("EditionScript::on_remote_toggled " << checked);
+ _remote=checked;
+ YACS::ENGINE::InlineNode *pyNode = dynamic_cast<YACS::ENGINE::InlineNode*>(_subInlineNode->getNode());
+ std::string mode = pyNode->getExecutionMode();
+ DEBTRACE(mode);
+
+ if(checked)
+ {
+ //remote radio button is checked
+ if(mode != "remote")
+ _subInlineNode->setExecutionMode("remote");
+ fr_container->show();
+ fillContainerPanel();
+ }
+ else
+ {
+ //remote radio button is unchecked
+ if(mode != "local")
+ _subInlineNode->setExecutionMode("local");
+ fr_container->hide();
+ }
+}
+
+void EditionScript::fillContainerPanel()
+{
+ DEBTRACE("EditionScript::fillContainerPanel ");
+ YACS::ENGINE::Proc* proc = GuiContext::getCurrent()->getProc();
+
+ cb_container->clear();
+ std::map<string,YACS::ENGINE::Container*>::const_iterator it = proc->containerMap.begin();
+ for(; it != proc->containerMap.end(); ++it)
+ cb_container->addItem( QString((*it).first.c_str()));
+
+ YACS::ENGINE::InlineNode *pyNode = dynamic_cast<YACS::ENGINE::InlineNode*>(_subInlineNode->getNode());
+
+ YACS::ENGINE::Container * cont = pyNode->getContainer();
+ if (cont)
+ {
+ int index = cb_container->findText(cont->getName().c_str());
+ cb_container->setCurrentIndex(index);
+ }
+}
+
+void EditionScript::changeContainer(int index)
+{
+ DEBTRACE("EditionScript::changeContainer ");
+ string contName = cb_container->itemText(index).toStdString();
+ DEBTRACE(contName);
+ YACS::ENGINE::InlineNode *pyNode = dynamic_cast<YACS::ENGINE::InlineNode*>(_subInlineNode->getNode());
+ YACS::ENGINE::Container *oldContainer = pyNode->getContainer();
+
+ YACS::ENGINE::Container *newContainer = 0;
+ YACS::ENGINE::Proc* proc = GuiContext::getCurrent()->getProc();
+ if (proc->containerMap.count(contName))
+ newContainer = proc->containerMap[contName];
+ if (!newContainer)
+ {
+ DEBTRACE("-------------> not found : " << contName);
+ return;
+ }
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectContainer.count(newContainer));
+ SubjectContainer *scnt = GuiContext::getCurrent()->_mapOfSubjectContainer[newContainer];
+
+ _subInlineNode->setContainer(scnt);
+}
+
+void EditionScript::update(GuiEvent event, int type, Subject* son)
+{
+ DEBTRACE("EditionScript::update " << eventName(event) <<" "<<type<<" "<<son);
+ EditionElementaryNode::update(event, type, son);
+ if(event == ASSOCIATE)
+ {
+ fillContainerPanel();
+ }
+ else if(event == UPDATE)
+ {
+ YACS::ENGINE::InlineNode *pyNode = dynamic_cast<YACS::ENGINE::InlineNode*>(_subInlineNode->getNode());
+ std::string mode = pyNode->getExecutionMode();
+ if(mode == "remote")
+ {
+ _remote=true;
+ radioremote->setChecked(true);
+ }
+ else if(mode == "local")
+ {
+ _remote=false;
+ radiolocal->setChecked(true);
+ }
+
+ fillContainerPanel();
+ }
+}
+
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONSCRIPT_HXX_
#define _EDITIONSCRIPT_HXX_
#include "yacsconfig.h"
#include "EditionElementaryNode.hxx"
+#include "FormComponent.hxx"
+#include <QRadioButton>
#if HAS_QSCI4>0
class QsciScintilla;
virtual void onApply();
virtual void onCancel();
virtual void onScriptModified();
+ virtual void onEdit();
+ virtual void on_tb_options_toggled(bool checked);
+ virtual void on_remote_toggled(bool checked);
+ virtual void fillContainerPanel();
+ virtual void changeContainer(int);
+ virtual void update(GuiEvent event, int type, Subject* son);
public:
EditionScript(Subject* subject,
QWidget* parent = 0,
const char* name = 0);
virtual ~EditionScript();
+ virtual void synchronize();
protected:
SubjectInlineNode *_subInlineNode;
#else
QTextEdit* _sci;
#endif
-
+ QVBoxLayout* _glayout;
+ QVBoxLayout* _portslayout;
+ QPushButton* _editor;
+ bool _checked;
+ bool _remote;
+ QFrame *fr_options;
+ QFrame *fr_container;
+ ComboBox* cb_container;
+ QRadioButton* radiolocal;
+ QRadioButton* radioremote;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionStudyInNode.hxx"
//#define _DEVDEBUG_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONSTUDYINNODE_HXX_
#define _EDITIONSTUDYINNODE_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionStudyOutNode.hxx"
//#define _DEVDEBUG_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONSTUDYOUTNODE_HXX_
#define _EDITIONSTUDYOUTNODE_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionSwitch.hxx"
#include "TableSwitch.hxx"
#include "SchemaModel.hxx"
{
DEBTRACE("EditionSwitch::onModifySelect " << text.toStdString());
SubjectSwitch *sswitch = dynamic_cast<SubjectSwitch*>(_subject);
- assert(sswitch);
+ YASSERT(sswitch);
sswitch->setSelect(text.toStdString());
}
{
DEBTRACE("EditionSwitch::onCommitData " << editor);
GenericEditor* gedit = dynamic_cast<GenericEditor*>(editor);
- assert(gedit);
+ YASSERT(gedit);
QString val = gedit->GetStrValue();
DEBTRACE(val.toStdString());
Subject *sub = gedit->getSubject();
- assert(sub);
+ YASSERT(sub);
SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
- assert(snode);
+ YASSERT(snode);
sub = snode->getParent();
SubjectSwitch *sswitch = dynamic_cast<SubjectSwitch*>(sub);
- assert(sswitch);
+ YASSERT(sswitch);
bool isOk = sswitch->setCase(val.toStdString(), snode);
if (_valueDelegate)
_valueDelegate->setResultEditing(editor, isOk);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONSWITCH_HXX_
#define _EDITIONSWITCH_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "EditionWhile.hxx"
#include "FormLoop.hxx"
#include "guiObservers.hxx"
: EditionNode(subject, parent, name)
{
_formWhile = new FormLoop(this);
+ _condition = 0;
_wid->gridLayout1->addWidget(_formWhile);
_formWhile->sb_nsteps->setMinimum(0);
_formWhile->sb_nsteps->setMaximum(1);
_formWhile->label->setText("Condition");
- connect(_formWhile->sb_nsteps, SIGNAL(valueChanged(const QString &)),
- this, SLOT(onModifyCondition(const QString &)));
+ connect(_formWhile->sb_nsteps, SIGNAL(editingFinished()),
+ this, SLOT(onConditionEdited()));
}
EditionWhile::~EditionWhile()
{
}
-void EditionWhile::onModifyCondition(const QString &text)
+void EditionWhile::onConditionEdited()
{
- DEBTRACE("EditionWhile::onModifyCondition " << text.toStdString());
- SubjectWhileLoop *swl = dynamic_cast<SubjectWhileLoop*>(_subject);
- assert(swl);
- swl->setCondition(text.toStdString());
+ int newval = _formWhile->sb_nsteps->value();
+ DEBTRACE("EditionWhile::onConditionEdited " << _condition << " --> " << newval);
+ if (newval != _condition)
+ {
+ SubjectWhileLoop *swl = dynamic_cast<SubjectWhileLoop*>(_subject);
+ YASSERT(swl);
+ QString text = _formWhile->sb_nsteps->cleanText();
+ swl->setCondition(text.toStdString());
+ }
}
void EditionWhile::synchronize()
ss >> i;
DEBTRACE(i);
_formWhile->sb_nsteps->setValue(i);
+ _condition = i;
break;
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _EDITIONWHILE_HXX_
#define _EDITIONWHILE_HXX_
Q_OBJECT
public slots:
- virtual void onModifyCondition(const QString &text);
+ virtual void onConditionEdited();
public:
EditionWhile(Subject* subject,
protected:
FormLoop *_formWhile;
+ bool _condition;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "FormComponent.hxx"
//#define _DEVDEBUG_
using namespace std;
+bool FormComponent::_checked = false;
+
ComboBox::ComboBox(QWidget *parent)
: QComboBox(parent)
{
cb_container = new ComboBox(fr_component);
gridLayout3->addWidget(cb_container, 2, 1, 1, 1);
- _checked = false;
QIcon icon;
icon.addFile("icons:icon_down.png");
icon.addFile("icons:icon_up.png",
QSize(), QIcon::Normal, QIcon::On);
tb_component->setIcon(icon);
- on_tb_component_toggled(false);
-// connect(tb_component, SIGNAL(toggled(bool)),
-// this, SLOT(on_tb_component_toggled(bool)));
+ on_tb_component_toggled(FormComponent::_checked);
}
FormComponent::~FormComponent()
void FormComponent::on_tb_component_toggled(bool checked)
{
- //DEBTRACE("FormComponent::on_tb_component_toggled " << checked);
+ DEBTRACE("FormComponent::on_tb_component_toggled " << checked);
_checked = checked;
if (_checked) fr_component->show();
else fr_component->hide();
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _FORMCOMPONENT_HXX_
#define _FORMCOMPONENT_HXX_
FormComponent(QWidget *parent = 0);
virtual ~FormComponent();
+public:
+ static bool _checked;
+
public slots:
void on_tb_component_toggled(bool checked);
-protected:
- bool _checked;
-
private:
};
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>fm_component</class>
- <widget class="QWidget" name="fm_component" >
- <property name="geometry" >
+ <widget class="QWidget" name="fm_component">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<height>171</height>
</rect>
</property>
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QGridLayout" >
- <property name="leftMargin" >
- <number>3</number>
+ <layout class="QGridLayout">
+ <property name="margin">
+ <number>2</number>
</property>
- <property name="topMargin" >
- <number>3</number>
- </property>
- <property name="rightMargin" >
- <number>3</number>
- </property>
- <property name="bottomMargin" >
- <number>3</number>
- </property>
- <item row="0" column="0" >
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <layout class="QHBoxLayout" >
+ <item row="0" column="0">
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <layout class="QHBoxLayout">
<item>
- <widget class="QToolButton" name="tb_component" >
- <property name="text" >
+ <widget class="QToolButton" name="tb_component">
+ <property name="text">
<string>...</string>
</property>
- <property name="checkable" >
+ <property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
- <widget class="QLabel" name="la_component" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+ <widget class="QLabel" name="la_component">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="font" >
+ <property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
- <property name="text" >
+ <property name="text">
<string>Component</string>
</property>
</widget>
</item>
</layout>
</item>
- <item row="1" column="0" >
- <widget class="QFrame" name="fr_component" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+ <item row="1" column="0">
+ <widget class="QFrame" name="fr_component">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="frameShape" >
+ <property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
- <property name="frameShadow" >
+ <property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
- <property name="lineWidth" >
+ <property name="lineWidth">
<number>1</number>
</property>
- <property name="midLineWidth" >
+ <property name="midLineWidth">
<number>0</number>
</property>
- <layout class="QGridLayout" >
- <property name="leftMargin" >
- <number>3</number>
- </property>
- <property name="topMargin" >
- <number>3</number>
- </property>
- <property name="rightMargin" >
- <number>3</number>
- </property>
- <property name="bottomMargin" >
+ <layout class="QGridLayout">
+ <property name="margin">
<number>3</number>
</property>
- <item row="0" column="0" >
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="la_name" >
- <property name="text" >
+ <item row="0" column="0">
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="la_name">
+ <property name="text">
<string>Name:</string>
</property>
</widget>
</item>
- <item row="0" column="1" >
- <widget class="QLineEdit" name="le_name" />
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="le_name"/>
</item>
- <item row="1" column="0" >
- <widget class="QLabel" name="la_instance" >
- <property name="text" >
+ <item row="1" column="0">
+ <widget class="QLabel" name="la_instance">
+ <property name="text">
<string>Instance:</string>
</property>
</widget>
</item>
- <item row="2" column="0" >
- <widget class="QLabel" name="la_container" >
- <property name="text" >
+ <item row="2" column="0">
+ <widget class="QLabel" name="la_container">
+ <property name="text">
<string>Container:</string>
</property>
</widget>
</item>
- <item row="2" column="1" >
- <widget class="QComboBox" name="cb_container" />
+ <item row="2" column="1">
+ <widget class="QComboBox" name="cb_container"/>
</item>
- <item row="1" column="1" >
- <widget class="QComboBox" name="cb_instance" />
+ <item row="1" column="1">
+ <widget class="QComboBox" name="cb_instance"/>
</item>
</layout>
</item>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "FormContainer.hxx"
#include "FormComponent.hxx"
+#include "QtGuiContext.hxx"
+#include "Container.hxx"
+
+#include <cassert>
+#include <cstdlib>
+#include <climits>
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
#include <QList>
+#include <sstream>
using namespace std;
+using namespace YACS;
+using namespace YACS::HMI;
+using namespace YACS::ENGINE;
+
+bool FormContainer::_checked = false;
FormContainer::FormContainer(QWidget *parent)
{
setupUi(this);
- _checked = false;
_advanced = false;
-
- gridLayout2->removeWidget(cb_host);
- delete cb_host;
- cb_host = new ComboBox(gb_basic);
- gridLayout2->addWidget(cb_host, 2, 1, 1, 1);
+ _properties.clear();
QIcon icon;
icon.addFile("icons:icon_down.png");
icon.addFile("icons:icon_up.png",
QSize(), QIcon::Normal, QIcon::On);
tb_container->setIcon(icon);
- on_tb_container_toggled(false);
+ on_tb_container_toggled(FormContainer::_checked);
on_ch_advance_stateChanged(0);
+
+ sb_mem->setMaximum(INT_MAX);
+ sb_cpu->setMaximum(INT_MAX);
+ sb_nbNodes->setMaximum(INT_MAX);
+ sb_procNode->setMaximum(INT_MAX);
+ sb_nbprocpar->setMaximum(INT_MAX);
+ sb_nbproc->setMaximum(INT_MAX);
+
+
+ FillPanel(0); // --- set widgets before signal connexion to avoid false modif detection
+
+ connect(le_name, SIGNAL(textChanged(const QString&)),
+ this, SLOT(onModifyName(const QString&)));
+
+ connect(cb_resource, SIGNAL(activated(const QString&)),
+ this, SLOT(onModifyResource(const QString&)));
+
+ connect(cb_policy, SIGNAL(activated(const QString&)),
+ this, SLOT(onModifyPolicy(const QString&)));
+
+ connect(cb_type, SIGNAL(activated(const QString&)),
+ this, SLOT(onModifyType(const QString&)));
+
+ connect(cb_parallel, SIGNAL(activated(const QString&)),
+ this, SLOT(onModifyParLib(const QString&)));
+
+ connect(le_workdir, SIGNAL(textChanged(const QString&)),
+ this, SLOT(onModifyWorkDir(const QString&)));
+
+ connect(le_contname, SIGNAL(textChanged(const QString&)),
+ this, SLOT(onModifyContName(const QString&)));
+
+ connect(le_os, SIGNAL(textChanged(const QString&)),
+ this, SLOT(onModifyOS(const QString&)));
+
+ connect(le_hostname, SIGNAL(textChanged(const QString&)),
+ this, SLOT(onModifyHostName(const QString&)));
+
+ connect(le_compolist, SIGNAL(textChanged(const QString&)),
+ this, SLOT(onModifyCompoList(const QString&)));
+
+ connect(le_resourceList, SIGNAL(textChanged(const QString&)),
+ this, SLOT(onModifyResourceList(const QString&)));
+
+ connect(ch_mpi, SIGNAL(clicked(bool)),
+ this, SLOT(onModifyIsMPI(bool)));
+
+ connect(sb_mem, SIGNAL(valueChanged(const QString&)),
+ this, SLOT(onModifyMem(const QString&)));
+
+ connect(sb_cpu, SIGNAL(valueChanged(const QString&)),
+ this, SLOT(onModifyClock(const QString&)));
+
+ connect(sb_nbNodes, SIGNAL(valueChanged(const QString&)),
+ this, SLOT(onModifyNodes(const QString&)));
+
+ connect(sb_procNode, SIGNAL(valueChanged(const QString&)),
+ this, SLOT(onModifyProcs(const QString&)));
+
+ connect(sb_nbprocpar, SIGNAL(valueChanged(const QString&)),
+ this, SLOT(onModifyProcPar(const QString&)));
+
+ connect(sb_nbproc, SIGNAL(valueChanged(const QString&)),
+ this, SLOT(onModifyProcRes(const QString&)));
}
FormContainer::~FormContainer()
{
}
+void FormContainer::FillPanel(YACS::ENGINE::Container *container)
+{
+ DEBTRACE("FormContainer::FillPanel");
+ _container = container;
+ if (_container)
+ {
+ _properties = _container->getProperties();
+ le_name->setText(_container->getName().c_str());
+ }
+ else
+ {
+ _properties.clear();
+ le_name->setText("not defined");
+ }
+
+ cb_type->clear();
+ cb_type->addItem("mono");
+ cb_type->addItem("multi");
+ if(_properties.count("type") && _properties["type"]=="multi")
+ {
+ cb_type->setCurrentIndex(1);
+ cb_mode->setText("multi");
+ }
+ else
+ cb_mode->setText("mono");
+
+
+ vector<string> parlibs;
+ parlibs.push_back("");
+ parlibs.push_back("Mpi");
+ parlibs.push_back("Dummy");
+ cb_parallel->clear();
+ for(int i=0; i< parlibs.size(); i++)
+ cb_parallel->addItem(parlibs[i].c_str());
+ if(_properties.count("parallelLib"))
+ {
+ int i=0;
+ for(i=0; i< parlibs.size(); i++)
+ if(parlibs[i] == _properties["parallelLib"])
+ {
+ cb_parallel->setCurrentIndex(i);
+ break;
+ }
+ }
+ else
+ cb_parallel->setCurrentIndex(0);
+
+ if(_properties.count("workingdir"))
+ le_workdir->setText(_properties["workingdir"].c_str());
+ else
+ le_workdir->setText("");
+
+ if(_properties.count("container_name"))
+ le_contname->setText(_properties["container_name"].c_str());
+ else
+ le_contname->setText("");
+
+ if(_properties.count("isMPI"))
+ {
+ DEBTRACE("_properties[isMPI]=" << _properties["isMPI"]);
+ if ((_properties["isMPI"] == "0") || (_properties["isMPI"] == "false"))
+ ch_mpi->setCheckState(Qt::Unchecked);
+ else
+ ch_mpi->setCheckState(Qt::Checked);
+ }
+ else
+ ch_mpi->setCheckState(Qt::Unchecked);
+
+ if(_properties.count("nb_parallel_procs"))
+ sb_nbprocpar->setValue(atoi(_properties["nb_parallel_procs"].c_str()));
+ else
+ sb_nbprocpar->setValue(0);
+
+ //Resources
+ cb_resource->clear();
+ cb_resource->addItem("automatic"); // --- when no resource is selected
+
+ //add available resources
+ list<string> machines = QtGuiContext::getQtCurrent()->getGMain()->getMachineList();
+ list<string>::iterator itm = machines.begin();
+ for( ; itm != machines.end(); ++itm)
+ {
+ cb_resource->addItem(QString((*itm).c_str()));
+ }
+
+ std::string resource="";
+ if(_properties.count("name") && _properties["name"] != "")
+ {
+ //a resource has been specified
+ int index = cb_resource->findText(_properties["name"].c_str());
+ if (index > 0)
+ {
+ //the resource is found: use it
+ cb_resource->setCurrentIndex(index);
+ resource=_properties["name"];
+ }
+ else
+ {
+ //the resource has not been found: add a false item
+ std::string item="Unknown resource ("+_properties["name"]+")";
+ cb_resource->addItem(item.c_str());
+ cb_resource->setCurrentIndex(cb_resource->count()-1);
+ }
+ }
+ else
+ cb_resource->setCurrentIndex(0);
+ updateResource(resource);
+
+ if (!QtGuiContext::getQtCurrent()->isEdition())
+ {
+ //if the schema is in execution do not allow editing
+ le_name->setReadOnly(true);
+ cb_type->setEnabled(false);
+ cb_parallel->setEnabled(false);
+ le_workdir->setReadOnly(true);
+ le_contname->setReadOnly(true);
+ ch_mpi->setEnabled(false);
+ sb_nbprocpar->setReadOnly(true);
+ cb_resource->setEnabled(false);
+ le_hostname->setEnabled(false);
+ le_os->setEnabled(false);
+ sb_nbproc->setEnabled(false);
+ sb_mem->setEnabled(false);
+ sb_cpu->setEnabled(false);
+ sb_nbNodes->setEnabled(false);
+ sb_procNode->setEnabled(false);
+ cb_policy->setEnabled(false);
+ le_compolist->setEnabled(false);
+ le_resourceList->setEnabled(false);
+ }
+}
+
+void FormContainer::onModified()
+{
+ DEBTRACE("FormContainer::onModified");
+ Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
+ if (!sub) return;
+ YASSERT(QtGuiContext::getQtCurrent()->_mapOfEditionItem.count(sub));
+ QWidget *widget = QtGuiContext::getQtCurrent()->_mapOfEditionItem[sub];
+ ItemEdition *item = dynamic_cast<ItemEdition*>(widget);
+ YASSERT(item);
+ item->setEdited(true);
+}
+
void FormContainer::on_tb_container_toggled(bool checked)
{
- //DEBTRACE("FormContainer::on_tb_container_toggled " << checked);
+ DEBTRACE("FormContainer::on_tb_container_toggled " << checked);
_checked = checked;
- if (_checked) fr_container->show();
- else fr_container->hide();
+ if (_checked) gb_basic->show();
+ else gb_basic->hide();
}
void FormContainer::on_ch_advance_stateChanged(int state)
{
- //DEBTRACE("FormContainer::on_ch_advance_stateChanged " << state);
- if (state) gb_advance->show();
- else gb_advance->hide();
+ DEBTRACE("FormContainer::on_ch_advance_stateChanged " << state);
+ if (state) tw_advance->show();
+ else tw_advance->hide();
+}
+
+void FormContainer::onModifyName(const QString &text)
+{
+ DEBTRACE("onModifyName " << text.toStdString());
+ SubjectContainer *scont =
+ QtGuiContext::getQtCurrent()->_mapOfSubjectContainer[_container];
+ YASSERT(scont);
+ string name = scont->getName();
+ if (name != text.toStdString())
+ onModified();
+}
+
+void FormContainer::updateResource(const std::string &resource)
+{
+ DEBTRACE("FormContainer::updateResource " << resource);
+ if (resource=="")
+ {
+ //the resource is not specified: use automatic and allow editing
+ if(_properties.count("hostname"))
+ le_hostname->setText(_properties["hostname"].c_str());
+ else
+ le_hostname->setText("");
+ le_hostname->setEnabled(true);
+
+ if(_properties.count("OS"))
+ le_os->setText(_properties["OS"].c_str());
+ else
+ le_os->setText("");
+ le_os->setEnabled(true);
+
+ if(_properties.count("nb_resource_procs"))
+ sb_nbproc->setValue(atoi(_properties["nb_resource_procs"].c_str()));
+ else
+ sb_nbproc->setValue(0);
+ sb_nbproc->setEnabled(true);
+
+ if(_properties.count("mem_mb"))
+ sb_mem->setValue(atoi(_properties["mem_mb"].c_str()));
+ else
+ sb_mem->setValue(0);
+ sb_mem->setEnabled(true);
+
+ if(_properties.count("cpu_clock"))
+ sb_cpu->setValue(atoi(_properties["cpu_clock"].c_str()));
+ else
+ sb_cpu->setValue(0);
+ sb_cpu->setEnabled(true);
+
+ if(_properties.count("nb_node"))
+ sb_nbNodes->setValue(atoi(_properties["nb_node"].c_str()));
+ else
+ sb_nbNodes->setValue(0);
+ sb_nbNodes->setEnabled(true);
+
+ if(_properties.count("nb_proc_per_node"))
+ sb_procNode->setValue(atoi(_properties["nb_proc_per_node"].c_str()));
+ else
+ sb_procNode->setValue(0);
+ sb_procNode->setEnabled(true);
+
+ std::vector<std::string> policies;
+ policies.push_back("cycl");
+ policies.push_back("altcycl");
+ policies.push_back("best");
+ policies.push_back("first");
+ cb_policy->clear();
+ for(int i=0; i< policies.size(); i++)
+ cb_policy->addItem(policies[i].c_str());
+ if(_properties.count("policy"))
+ {
+ int i=0;
+ for(i=0; i< policies.size(); i++)
+ if(policies[i] == _properties["policy"])
+ {
+ cb_policy->setCurrentIndex(i);
+ break;
+ }
+ }
+ else
+ cb_policy->setCurrentIndex(1);
+ cb_policy->setEnabled(true);
+
+ if(_properties.count("component_list"))
+ le_compolist->setText(_properties["component_list"].c_str());
+ else
+ le_compolist->setText("");
+ le_compolist->setEnabled(true);
+
+ if(_properties.count("resource_list"))
+ le_resourceList->setText(_properties["resource_list"].c_str());
+ else
+ le_resourceList->setText("");
+ le_resourceList->setEnabled(true);
+ }
+ else
+ {
+ //a specific resource has been chosen: properties are those declared in the resources manager
+ //properties can not be edited
+ std::map<std::string,std::string> properties= _container->getResourceProperties(resource);
+ if(properties.count("hostname"))
+ le_hostname->setText(properties["hostname"].c_str());
+ else
+ le_hostname->setText("");
+ le_hostname->setEnabled(false);
+
+ if(properties.count("OS"))
+ le_os->setText(properties["OS"].c_str());
+ else
+ le_os->setText("");
+ le_os->setEnabled(false);
+
+ if(properties.count("nb_resource_procs"))
+ sb_nbproc->setValue(atoi(properties["nb_resource_procs"].c_str()));
+ else
+ sb_nbproc->setValue(0);
+ sb_nbproc->setEnabled(false);
+
+ if(properties.count("mem_mb"))
+ sb_mem->setValue(atoi(properties["mem_mb"].c_str()));
+ else
+ sb_mem->setValue(0);
+ sb_mem->setEnabled(false);
+
+ if(properties.count("cpu_clock"))
+ sb_cpu->setValue(atoi(properties["cpu_clock"].c_str()));
+ else
+ sb_cpu->setValue(0);
+ sb_cpu->setEnabled(false);
+
+ if(properties.count("nb_node"))
+ sb_nbNodes->setValue(atoi(properties["nb_node"].c_str()));
+ else
+ sb_nbNodes->setValue(0);
+ sb_nbNodes->setEnabled(false);
+
+ if(properties.count("nb_proc_per_node"))
+ sb_procNode->setValue(atoi(properties["nb_proc_per_node"].c_str()));
+ else
+ sb_procNode->setValue(0);
+ sb_procNode->setEnabled(false);
+
+ cb_policy->clear();
+ cb_policy->setEnabled(false);
+
+ if(properties.count("component_list"))
+ le_compolist->setText(properties["component_list"].c_str());
+ else
+ le_compolist->setText("");
+ le_compolist->setEnabled(false);
+
+ if(properties.count("resource_list"))
+ le_resourceList->setText(properties["resource_list"].c_str());
+ else
+ le_resourceList->setText("");
+ le_resourceList->setEnabled(false);
+ }
+}
+
+void FormContainer::onModifyResource(const QString &text)
+{
+ DEBTRACE("onModifyResource " << text.toStdString());
+ if (!_container) return;
+ std::string resource=text.toStdString();
+ if(resource=="automatic")resource="";
+ map<string,string> properties = _container->getProperties();
+ _properties["name"] = resource;
+ if (properties["name"] != resource)
+ {
+ // reset resource properties
+ _properties.erase("hostname");
+ _properties.erase("OS");
+ _properties.erase("nb_resource_procs");
+ _properties.erase("mem_mb");
+ _properties.erase("cpu_clock");
+ _properties.erase("nb_node");
+ _properties.erase("nb_proc_per_node");
+ _properties.erase("policy");
+ onModified();
+ updateResource(resource);
+ }
+}
+
+void FormContainer::onModifyType(const QString &text)
+{
+ DEBTRACE("onModifyType " << text.toStdString());
+ if (!_container) return;
+ std::string prop=_container->getProperty("type");
+ _properties["type"] = text.toStdString();
+ if (_properties["type"] == "mono")
+ cb_mode->setText("mono");
+ else
+ cb_mode->setText("multi");
+ if (prop != text.toStdString())
+ onModified();
+}
+
+void FormContainer::onModifyPolicy(const QString &text)
+{
+ DEBTRACE("onModifyPolicy " << text.toStdString());
+ if (!_container) return;
+ if(_properties.count("name") && _properties["name"] != "")return; //do not modify resource parameter when specific resource is set
+ map<string,string> properties = _container->getProperties();
+ _properties["policy"] = text.toStdString();
+ if (properties["policy"] != text.toStdString())
+ {
+ onModified();
+ }
+}
+
+void FormContainer::onModifyWorkDir(const QString &text)
+{
+ DEBTRACE("onModifyWorkDir " << text.toStdString());
+ if (!_container) return;
+ map<string,string> properties = _container->getProperties();
+ _properties["workingdir"] = text.toStdString();
+ if (properties["workingdir"] != text.toStdString())
+ {
+ onModified();
+ }
+}
+
+void FormContainer::onModifyContName(const QString &text)
+{
+ DEBTRACE("onModifyContName " << text.toStdString());
+ if (!_container) return;
+ map<string,string> properties = _container->getProperties();
+ _properties["container_name"] = text.toStdString();
+ if (properties["container_name"] != text.toStdString())
+ {
+ onModified();
+ }
+}
+
+void FormContainer::onModifyOS(const QString &text)
+{
+ DEBTRACE("onModifyOS " << text.toStdString());
+ if (!_container) return;
+ if(_properties.count("name") && _properties["name"] != "")return; //do not modify resource parameter when specific resource is set
+ map<string,string> properties = _container->getProperties();
+ _properties["OS"] = text.toStdString();
+ if (properties["OS"] != text.toStdString())
+ {
+ onModified();
+ }
+}
+
+void FormContainer::onModifyParLib(const QString &text)
+{
+ DEBTRACE("onModifyParLib " << text.toStdString());
+ if (!_container) return;
+ map<string,string> properties = _container->getProperties();
+ _properties["parallelLib"] = text.toStdString();
+ if (properties["parallelLib"] != text.toStdString())
+ {
+ onModified();
+ }
+}
+
+void FormContainer::onModifyIsMPI(bool isMpi)
+{
+ DEBTRACE("onModifyIsMPI " << isMpi);
+ if (!_container) return;
+ string text = "false";
+ if (isMpi) text = "true";
+ DEBTRACE(text);
+ map<string,string> properties = _container->getProperties();
+ _properties["isMPI"] = text;
+ if (properties["isMPI"] != text)
+ {
+ onModified();
+ }
+}
+
+void FormContainer::onModifyMem(const QString &text)
+{
+ DEBTRACE("onModifyMem " << text.toStdString());
+ if (!_container) return;
+ if(_properties.count("name") && _properties["name"] != "")return; //do not modify resource parameter when specific resource is set
+ map<string,string> properties = _container->getProperties();
+ if(properties.count("mem_mb")==0 )properties["mem_mb"]="0"; //default value
+ _properties["mem_mb"] = text.toStdString();
+ if (properties["mem_mb"] != text.toStdString())
+ {
+ onModified();
+ }
+}
+
+void FormContainer::onModifyClock(const QString &text)
+{
+ DEBTRACE("onModifyClock " << text.toStdString());
+ if (!_container) return;
+ if(_properties.count("name") && _properties["name"] != "")return; //do not modify resource parameter when specific resource is set
+ map<string,string> properties = _container->getProperties();
+ if(properties.count("cpu_clock")==0 )properties["cpu_clock"]="0"; //default value
+ _properties["cpu_clock"] = text.toStdString();
+ if (properties["cpu_clock"] != text.toStdString())
+ {
+ onModified();
+ }
+}
+
+void FormContainer::onModifyNodes(const QString &text)
+{
+ DEBTRACE("onModifyNodes " << text.toStdString());
+ if (!_container) return;
+ if(_properties.count("name") && _properties["name"] != "")return; //do not modify resource parameter when specific resource is set
+ map<string,string> properties = _container->getProperties();
+ if(properties.count("nb_node")==0 )properties["nb_node"]="0"; //default value
+ _properties["nb_node"] = text.toStdString();
+ if (properties["nb_node"] != text.toStdString())
+ {
+ onModified();
+ }
+}
+
+void FormContainer::onModifyProcs(const QString &text)
+{
+ DEBTRACE("onModifyProcs " << text.toStdString());
+ if (!_container) return;
+ if(_properties.count("name") && _properties["name"] != "")return; //do not modify resource parameter when specific resource is set
+ map<string,string> properties = _container->getProperties();
+ if(properties.count("nb_proc_per_node")==0 )properties["nb_proc_per_node"]="0"; //default value
+ _properties["nb_proc_per_node"] = text.toStdString();
+ if (properties["nb_proc_per_node"] != text.toStdString())
+ {
+ onModified();
+ }
+}
+
+void FormContainer::onModifyCompos(const QString &text)
+{
+ DEBTRACE("onModifyCompo " << text.toStdString());
+ if (!_container) return;
+ map<string,string> properties = _container->getProperties();
+ _properties["nb_component_nodes"] = text.toStdString();
+ if (properties["nb_component_nodes"] != text.toStdString())
+ {
+ onModified();
+ }
+}
+
+void FormContainer::onModifyProcPar(const QString &text)
+{
+ DEBTRACE("onModifyProcPar " << text.toStdString());
+ if (!_container) return;
+ map<string,string> properties = _container->getProperties();
+ _properties["nb_parallel_procs"] = text.toStdString();
+ if (properties["nb_parallel_procs"] != text.toStdString())
+ {
+ onModified();
+ }
+}
+
+void FormContainer::onModifyResourceName(const QString &text)
+{
+ DEBTRACE("onModifyResourceName " << text.toStdString());
+ if (!_container) return;
+ map<string,string> properties = _container->getProperties();
+ _properties["resource_name"] = text.toStdString();
+ if (properties["resource_name"] != text.toStdString())
+ {
+ onModified();
+ }
+}
+
+void FormContainer::onModifyHostName(const QString &text)
+{
+ DEBTRACE("onModifyHostName " << text.toStdString());
+ if (!_container) return;
+ if(_properties.count("name") && _properties["name"] != "")return; //do not modify resource parameter when specific resource is set
+
+ map<string,string> properties = _container->getProperties();
+ _properties["hostname"] = text.toStdString();
+ if (properties["hostname"] != text.toStdString())
+ {
+ onModified();
+ }
+}
+
+void FormContainer::onModifyProcRes(const QString &text)
+{
+ DEBTRACE("onModifyProcRes " << text.toStdString());
+ if (!_container) return;
+ if(_properties.count("name") && _properties["name"] != "")return; //do not modify resource parameter when specific resource is set
+ map<string,string> properties = _container->getProperties();
+ if(properties.count("nb_resource_procs")==0 )properties["nb_resource_procs"]="0"; //default value
+ _properties["nb_resource_procs"] = text.toStdString();
+ if (properties["nb_resource_procs"] != text.toStdString())
+ {
+ onModified();
+ }
+}
+
+void FormContainer::onModifyCompoList(const QString &text)
+{
+ DEBTRACE("onModifyCompoList " << text.toStdString());
+ if (!_container) return;
+ if(_properties.count("name") && _properties["name"] != "")return; //do not modify resource parameter when specific resource is set
+ map<string,string> properties = _container->getProperties();
+ _properties["component_list"] = text.toStdString();
+ if (properties["component_list"] != text.toStdString())
+ {
+ onModified();
+ }
+}
+
+void FormContainer::onModifyResourceList(const QString &text)
+{
+ DEBTRACE("onModifyResourceList " << text.toStdString());
+ if (!_container) return;
+ if(_properties.count("name") && _properties["name"] != "")return; //do not modify resource parameter when specific resource is set
+ map<string,string> properties = _container->getProperties();
+ _properties["resource_list"] = text.toStdString();
+ if (properties["resource_list"] != text.toStdString())
+ {
+ onModified();
+ }
+}
+
+
+bool FormContainer::onApply()
+{
+ SubjectContainer *scont =
+ QtGuiContext::getQtCurrent()->_mapOfSubjectContainer[_container];
+ YASSERT(scont);
+ bool ret = scont->setProperties(_properties);
+ DEBTRACE(ret);
+ if (ret) ret = scont->setName(le_name->text().toStdString());
+ return ret;
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _FORMCONTAINER_HXX_
#define _FORMCONTAINER_HXX_
#include "ui_FormContainer.h"
#include <QIcon>
+#include <map>
+#include <string>
+
+namespace YACS
+{
+ namespace ENGINE
+ {
+ class Container;
+ }
+}
class FormContainer: public QWidget, public Ui::fm_container
{
FormContainer(QWidget *parent = 0);
virtual ~FormContainer();
+ void FillPanel(YACS::ENGINE::Container *container);
+ virtual void onModified();
+ virtual bool onApply();
+ void updateResource(const std::string &resource);
+
+public:
+ static bool _checked;
+
public slots:
void on_tb_container_toggled(bool checked);
void on_ch_advance_stateChanged(int state);
+ void onModifyName(const QString &text);
+ void onModifyResource(const QString &text);
+ void onModifyPolicy(const QString &text);
+ void onModifyType(const QString &text);
+ void onModifyWorkDir(const QString &text);
+ void onModifyContName(const QString &text);
+ void onModifyOS(const QString &text);
+ void onModifyParLib(const QString &text);
+ void onModifyIsMPI(bool isMpi);
+ void onModifyMem(const QString &text);
+ void onModifyClock(const QString &text);
+ void onModifyNodes(const QString &text);
+ void onModifyProcs(const QString &text);
+ void onModifyCompos(const QString &text);
+ void onModifyProcPar(const QString &text);
+ void onModifyResourceName(const QString &text);
+ void onModifyHostName(const QString &text);
+ void onModifyProcRes(const QString &text);
+ void onModifyCompoList(const QString &text);
+ void onModifyResourceList(const QString &text);
+
protected:
- bool _checked;
bool _advanced;
+ YACS::ENGINE::Container *_container;
+ std::map<std::string, std::string> _properties;
private:
};
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>fm_container</class>
- <widget class="QWidget" name="fm_container" >
- <property name="geometry" >
+ <widget class="QWidget" name="fm_container">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>278</width>
- <height>548</height>
+ <width>284</width>
+ <height>655</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QGridLayout" >
- <property name="leftMargin" >
- <number>3</number>
+ <layout class="QGridLayout" name="gridLayout_5">
+ <property name="margin">
+ <number>2</number>
</property>
- <property name="topMargin" >
- <number>3</number>
- </property>
- <property name="rightMargin" >
- <number>3</number>
- </property>
- <property name="bottomMargin" >
- <number>3</number>
- </property>
- <item row="0" column="0" >
- <layout class="QHBoxLayout" >
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
<item>
- <widget class="QToolButton" name="tb_container" >
- <property name="text" >
+ <widget class="QToolButton" name="tb_container">
+ <property name="text">
<string>...</string>
</property>
- <property name="checkable" >
+ <property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
- <widget class="QLabel" name="label" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="font" >
+ <property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
- <property name="text" >
+ <property name="text">
<string>Container</string>
</property>
</widget>
</item>
+ <item>
+ <spacer name="horizontalSpacer_7">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</item>
- <item row="1" column="0" >
- <widget class="QFrame" name="fr_container" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+ <item row="1" column="0">
+ <widget class="QGroupBox" name="gb_basic">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="frameShape" >
- <enum>QFrame::NoFrame</enum>
+ <property name="title">
+ <string>Parameters</string>
</property>
- <property name="frameShadow" >
- <enum>QFrame::Raised</enum>
- </property>
- <layout class="QGridLayout" >
- <property name="leftMargin" >
- <number>0</number>
- </property>
- <property name="topMargin" >
- <number>0</number>
- </property>
- <property name="rightMargin" >
- <number>0</number>
- </property>
- <property name="bottomMargin" >
- <number>0</number>
+ <layout class="QGridLayout" name="gridLayout_4">
+ <property name="margin">
+ <number>2</number>
</property>
- <item row="0" column="0" >
- <widget class="QGroupBox" name="gb_basic" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Name:</string>
</property>
- <property name="title" >
- <string>Basic parameters</string>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="le_name">
+ <property name="toolTip">
+ <string>identification of the container in schema</string>
</property>
- <layout class="QGridLayout" >
- <property name="leftMargin" >
- <number>3</number>
- </property>
- <property name="topMargin" >
- <number>3</number>
- </property>
- <property name="rightMargin" >
- <number>3</number>
- </property>
- <property name="bottomMargin" >
- <number>3</number>
- </property>
- <item row="0" column="0" >
- <widget class="QLabel" name="label_2" >
- <property name="text" >
- <string>Name:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="QLineEdit" name="le_name" >
- <property name="toolTip" >
- <string>identification of the container in schema</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="label_3" >
- <property name="text" >
- <string>Instance:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1" >
- <widget class="QLineEdit" name="le_instance" >
- <property name="toolTip" >
- <string>name of the container when instanciated at runtime</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" >
- <widget class="QLabel" name="label_4" >
- <property name="text" >
- <string>Host:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1" >
- <widget class="QComboBox" name="cb_host" >
- <property name="toolTip" >
- <string>name of the computer hosting container when manually set</string>
- </property>
- </widget>
- </item>
- </layout>
</widget>
</item>
- <item row="1" column="0" >
- <widget class="QCheckBox" name="ch_advance" >
- <property name="text" >
- <string>Show Advanced parameters</string>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Resource:</string>
</property>
</widget>
</item>
- <item row="2" column="0" >
- <widget class="QGroupBox" name="gb_advance" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <item row="1" column="1">
+ <widget class="ComboBox" name="cb_resource">
+ <property name="toolTip">
+ <string>name of the resource hosting container when manually set</string>
</property>
- <property name="title" >
- <string>Advanced parameters</string>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_15">
+ <property name="text">
+ <string>type:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="ComboBox" name="cb_type">
+ <property name="toolTip">
+ <string>container type</string>
+ </property>
+ <property name="maxVisibleItems">
+ <number>2</number>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="2">
+ <widget class="QCheckBox" name="ch_advance">
+ <property name="text">
+ <string>Show Advanced parameters</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" colspan="2">
+ <widget class="QTabWidget" name="tw_advance">
+ <property name="currentIndex">
+ <number>1</number>
</property>
- <layout class="QGridLayout" >
- <property name="leftMargin" >
- <number>3</number>
- </property>
- <property name="topMargin" >
- <number>3</number>
- </property>
- <property name="rightMargin" >
- <number>3</number>
- </property>
- <property name="bottomMargin" >
- <number>3</number>
- </property>
- <item row="0" column="0" >
- <widget class="QLabel" name="label_5" >
- <property name="text" >
- <string>mem mb:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="2" >
- <widget class="QSpinBox" name="sb_mem" >
- <property name="toolTip" >
- <string>required memory (megaBytes)</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="label_6" >
- <property name="text" >
- <string>cpu clock</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2" >
- <widget class="QSpinBox" name="sb_cpu" >
- <property name="toolTip" >
- <string>required cpu clock frequency (MHz)</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" colspan="2" >
- <widget class="QLabel" name="label_7" >
- <property name="text" >
- <string>nb proc per node:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2" >
- <widget class="QSpinBox" name="sb_procNode" />
- </item>
- <item row="3" column="0" >
- <widget class="QLabel" name="label_8" >
- <property name="text" >
- <string>nb nodes:</string>
- </property>
- </widget>
- </item>
- <item row="3" column="2" >
- <widget class="QSpinBox" name="sb_nbNodes" />
- </item>
- <item row="4" column="0" >
- <widget class="QLabel" name="label_9" >
- <property name="text" >
- <string>MPI usage:</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1" colspan="2" >
- <widget class="QComboBox" name="cb_mpi" />
- </item>
- <item row="5" column="0" >
- <widget class="QLabel" name="label_10" >
- <property name="text" >
- <string>Parallel library:</string>
- </property>
- </widget>
- </item>
- <item row="5" column="1" colspan="2" >
- <widget class="QLineEdit" name="le_parallel" />
- </item>
- <item row="6" column="0" >
- <widget class="QLabel" name="label_11" >
- <property name="text" >
- <string>nb compo nodes:</string>
- </property>
- </widget>
- </item>
- <item row="6" column="2" >
- <widget class="QSpinBox" name="sb_nbCompoNodes" />
- </item>
- <item row="7" column="0" >
- <widget class="QLabel" name="label_12" >
- <property name="text" >
- <string>working directory:</string>
- </property>
- </widget>
- </item>
- <item row="7" column="1" colspan="2" >
- <widget class="QLineEdit" name="le_workdir" />
- </item>
- </layout>
+ <widget class="QWidget" name="tab">
+ <attribute name="title">
+ <string>Container</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0" colspan="2">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>container name:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QLineEdit" name="le_contname">
+ <property name="toolTip">
+ <string>name of the container when instanciated at runtime</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_9">
+ <property name="text">
+ <string>mode:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QLabel" name="label_12">
+ <property name="text">
+ <string>working dir:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QLineEdit" name="le_workdir"/>
+ </item>
+ <item row="3" column="0" colspan="3">
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Parallel parameters</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_16">
+ <property name="text">
+ <string>nb procs:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3">
+ <widget class="QSpinBox" name="sb_nbprocpar">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="4">
+ <widget class="QCheckBox" name="ch_mpi">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::RightToLeft</enum>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>MPI container</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QLabel" name="label_17">
+ <property name="text">
+ <string>PaCO++ lib:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2" colspan="2">
+ <widget class="ComboBox" name="cb_parallel">
+ <property name="editable">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>50</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>168</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="2">
+ <widget class="QLineEdit" name="cb_mode">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_2">
+ <attribute name="title">
+ <string>Resource</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_19">
+ <property name="text">
+ <string>hostname:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="2">
+ <widget class="QLineEdit" name="le_hostname"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_13">
+ <property name="text">
+ <string>O.S.:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" colspan="2">
+ <widget class="QLineEdit" name="le_os"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_20">
+ <property name="text">
+ <string>nb procs:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="2">
+ <widget class="QSpinBox" name="sb_nbproc">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>mem mb:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="2">
+ <widget class="QSpinBox" name="sb_mem">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>required memory (megaBytes)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>cpu clock:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <spacer name="horizontalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="2">
+ <widget class="QSpinBox" name="sb_cpu">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>required cpu clock frequency (MHz)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="label_8">
+ <property name="text">
+ <string>nb nodes:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <spacer name="horizontalSpacer_5">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="2">
+ <widget class="QSpinBox" name="sb_nbNodes">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0">
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>nb proc / node:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1">
+ <spacer name="horizontalSpacer_6">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="6" column="2">
+ <widget class="QSpinBox" name="sb_procNode">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="0">
+ <widget class="QLabel" name="label_14">
+ <property name="text">
+ <string>policy:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="0">
+ <widget class="QLabel" name="label_10">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Component list:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="9" column="0" colspan="3">
+ <widget class="QLineEdit" name="le_compolist">
+ <property name="toolTip">
+ <string>example: GEOM, SMESH</string>
+ </property>
+ </widget>
+ </item>
+ <item row="10" column="0" colspan="2">
+ <widget class="QLabel" name="label_21">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Restricted resource list:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="11" column="0" colspan="3">
+ <widget class="QLineEdit" name="le_resourceList">
+ <property name="toolTip">
+ <string>example: machine1, machine2</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="1" colspan="2">
+ <widget class="ComboBox" name="cb_policy">
+ <property name="editable">
+ <bool>false</bool>
+ </property>
+ <property name="maxVisibleItems">
+ <number>3</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>ComboBox</class>
+ <extends>QComboBox</extends>
+ <header>FormComponent.hxx</header>
+ </customwidget>
+ </customwidgets>
<resources/>
- <connections/>
+ <connections>
+ <connection>
+ <sender>ch_advance</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>tw_advance</receiver>
+ <slot>setShown(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>140</x>
+ <y>171</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>135</x>
+ <y>202</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
</ui>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "FormEachLoop.hxx"
//#define _DEVDEBUG_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _FORMEACHLOOP_HXX_
#define _FORMEACHLOOP_HXX_
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>FormEachLoop</class>
- <widget class="QWidget" name="FormEachLoop" >
- <property name="geometry" >
+ <widget class="QWidget" name="FormEachLoop">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>370</width>
- <height>89</height>
+ <width>167</width>
+ <height>87</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QGridLayout" name="gridLayout_2" >
- <item row="0" column="0" >
- <layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="label_2" >
- <property name="text" >
+ <layout class="QGridLayout" name="gridLayout_2">
+ <property name="margin">
+ <number>3</number>
+ </property>
+ <item row="0" column="0">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
<string>Input type</string>
</property>
</widget>
</item>
- <item row="0" column="1" >
- <widget class="QComboBox" name="cb_type" />
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="label" >
- <property name="text" >
+ <item row="1" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
<string>Nb. branches</string>
</property>
</widget>
</item>
- <item row="1" column="1" >
- <widget class="QSpinBox" name="sb_nbranch" />
+ <item row="1" column="2">
+ <widget class="QSpinBox" name="sb_nbranch"/>
+ </item>
+ <item row="0" column="2">
+ <widget class="QLineEdit" name="lineEdit">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>SmplsCollection</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QLineEdit" name="lineEdit_2"/>
</item>
</layout>
</item>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "FormEditItem.hxx"
//#define _DEVDEBUG_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _FORMEDITITEM_HXX_
#define _FORMEDITITEM_HXX_
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>fm_editItem</class>
- <widget class="QWidget" name="fm_editItem" >
- <property name="geometry" >
+ <widget class="QWidget" name="fm_editItem">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>267</width>
- <height>173</height>
+ <width>216</width>
+ <height>134</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" >
- <layout class="QGridLayout" name="gridLayout1" >
- <item row="0" column="0" >
- <layout class="QGridLayout" name="gridLayout3" >
- <item row="0" column="0" >
- <widget class="QToolButton" name="tb_min" >
- <property name="text" >
- <string>...</string>
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="leftMargin">
+ <number>1</number>
+ </property>
+ <property name="topMargin">
+ <number>2</number>
+ </property>
+ <property name="rightMargin">
+ <number>1</number>
+ </property>
+ <property name="bottomMargin">
+ <number>1</number>
+ </property>
+ <item row="0" column="0">
+ <layout class="QGridLayout" name="gridLayout1">
+ <item row="0" column="0">
+ <layout class="QGridLayout" name="gridLayout3">
+ <item row="0" column="0">
+ <widget class="QLabel" name="la_type">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="QLabel" name="la_type" >
- <property name="text" >
+ <property name="text">
<string>Type</string>
</property>
</widget>
</item>
</layout>
</item>
- <item row="1" column="0" >
- <widget class="QLineEdit" name="le_name" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+ <item row="1" column="0">
+ <widget class="QLineEdit" name="le_name">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</item>
</layout>
</item>
- <item row="1" column="0" >
+ <item row="1" column="0">
<spacer>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" stdset="0">
<size>
<width>61</width>
<height>31</height>
</property>
</spacer>
</item>
- <item row="2" column="0" >
- <layout class="QHBoxLayout" >
+ <item row="2" column="0">
+ <layout class="QHBoxLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetDefaultConstraint</enum>
+ </property>
<item>
- <widget class="QPushButton" name="pb_apply" >
- <property name="text" >
+ <widget class="QPushButton" name="pb_apply">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item>
<spacer>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</spacer>
</item>
<item>
- <widget class="QPushButton" name="pb_cancel" >
- <property name="text" >
+ <widget class="QPushButton" name="pb_cancel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
<string>Cancel Edition</string>
</property>
</widget>
<receiver>pb_apply</receiver>
<slot>click()</slot>
<hints>
- <hint type="sourcelabel" >
+ <hint type="sourcelabel">
<x>133</x>
<y>68</y>
</hint>
- <hint type="destinationlabel" >
+ <hint type="destinationlabel">
<x>47</x>
<y>144</y>
</hint>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "FormEditTree.hxx"
#include "TreeView.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _FORMEDITTREE_HXX_
#define _FORMEDITTREE_HXX_
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>fm_schemaTree</class>
- <widget class="QWidget" name="fm_schemaTree" >
- <property name="geometry" >
+ <widget class="QWidget" name="fm_schemaTree">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>400</width>
- <height>425</height>
+ <width>185</width>
+ <height>192</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>Edit Tree</string>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QTreeView" name="tv_schema" >
- <property name="minimumSize" >
+ <layout class="QGridLayout">
+ <property name="margin">
+ <number>3</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QTreeView" name="tv_schema">
+ <property name="minimumSize">
<size>
<width>10</width>
<height>10</height>
</size>
</property>
- <property name="maximumSize" >
+ <property name="maximumSize">
<size>
<width>4000</width>
<height>4000</height>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "FormLoop.hxx"
//#define _DEVDEBUG_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _FORMLOOP_HXX_
#define _FORMLOOP_HXX_
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>FormLoop</class>
- <widget class="QWidget" name="FormLoop" >
- <property name="geometry" >
+ <widget class="QWidget" name="FormLoop">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>370</width>
- <height>51</height>
+ <width>134</width>
+ <height>29</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" >
- <layout class="QHBoxLayout" name="horizontalLayout" >
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="margin">
+ <number>3</number>
+ </property>
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
<item>
- <widget class="QLabel" name="label" >
- <property name="text" >
+ <widget class="QLabel" name="label">
+ <property name="text">
<string>nsteps</string>
</property>
</widget>
</item>
<item>
- <widget class="QSpinBox" name="sb_nsteps" />
+ <widget class="QSpinBox" name="sb_nsteps"/>
</item>
</layout>
</item>
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#include "FormOptimizerLoop.hxx"
+
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
+using namespace std;
+using namespace YACS::HMI;
+
+FormOptimizerLoop::FormOptimizerLoop(QWidget *parent)
+{
+ DEBTRACE("FormOptimizerLoop::FormOptimizerLoop");
+ setupUi(this);
+}
+
+FormOptimizerLoop::~FormOptimizerLoop()
+{
+ DEBTRACE("FormOptimizerLoop::~FormOptimizerLoop");
+}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef _FORMOPTIMIZERLOOP_HXX_
+#define _FORMOPTIMIZERLOOP_HXX_
+
+#include "ui_FormOptimizerLoop.h"
+
+namespace YACS
+{
+ namespace HMI
+ {
+ class FormOptimizerLoop: public QWidget, public Ui::FormOptimizerLoop
+ {
+ Q_OBJECT
+
+ public:
+ FormOptimizerLoop(QWidget *parent = 0);
+ ~FormOptimizerLoop();
+
+ };
+ }
+}
+
+#endif
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>FormOptimizerLoop</class>
+ <widget class="QWidget" name="FormOptimizerLoop">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>247</width>
+ <height>259</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <property name="margin">
+ <number>3</number>
+ </property>
+ <item row="0" column="0">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="1" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Nb. branches</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QSpinBox" name="sb_nbranch">
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>1000000000</number>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Eval. result type</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Algo init type</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Algo result type</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Eval. sample type</string>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Algo init value</string>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="2">
+ <widget class="QLineEdit" name="lineEdit_initValue"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>Library</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_8">
+ <property name="text">
+ <string>Entry</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QLineEdit" name="lineEdit_lib"/>
+ </item>
+ <item row="3" column="2">
+ <widget class="QLineEdit" name="lineEdit_entry"/>
+ </item>
+ <item row="4" column="2">
+ <widget class="QLabel" name="label_evalSampleType">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="2">
+ <widget class="QLabel" name="label_evalResultType">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="2">
+ <widget class="QLabel" name="label_algoInitType">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="2">
+ <widget class="QLabel" name="label_algoResultType">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "FormSchemaView.hxx"
#include "GraphicsView.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _FORMSCHEMAVIEW_HXX_
#define _FORMSCHEMAVIEW_HXX_
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "FormUndoRedo.hxx"
+#include "GraphicsView.hxx"
+#include "QtGuiContext.hxx"
+#include "commands.hxx"
+
+#include <string>
+#include <list>
+
+#include <QTreeWidget>
+#include <QList>
+
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
+using namespace std;
+using namespace YACS::HMI;
+
+FormUndoRedo::FormUndoRedo(QWidget *parent)
+{
+ setupUi(this);
+
+ Invocator *procInvoc = GuiContext::getCurrent()->getInvoc();
+ list<string> commandsDone = procInvoc->getDone();
+ list<string> commandsUndone = procInvoc->getUndone();
+
+ QList<QTreeWidgetItem *> itemsDone;
+ list<string>::iterator it;
+ for(it = commandsDone.begin(); it != commandsDone.end(); ++it)
+ {
+ (*it).erase((*it).rfind("\n"));
+ QTreeWidgetItem *commItem = new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString((*it).c_str())));
+ itemsDone.append(commItem);
+ }
+ treeWdUndo->insertTopLevelItems(0, itemsDone);
+
+ QList<QTreeWidgetItem *> itemsUndone;
+ for(it = commandsUndone.begin(); it != commandsUndone.end(); ++it)
+ {
+ (*it).erase((*it).rfind("\n"));
+ QTreeWidgetItem *commItem = new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString((*it).c_str())));
+ itemsUndone.append(commItem);
+ }
+ treeWdRedo->insertTopLevelItems(0, itemsUndone);
+}
+
+FormUndoRedo::~FormUndoRedo()
+{
+}
+// QTreeWidget *treeWidget = new QTreeWidget();
+// treeWidget->setColumnCount(1);
+// QList<QTreeWidgetItem *> items;
+// for (int i = 0; i < 10; ++i)
+// items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("item: %1").arg(i))));
+// treeWidget->insertTopLevelItems(0, items);
+
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _FORMUNDOREDO_HXX_
+#define _FORMUNDOREDO_HXX_
+
+#include "ui_FormUndoRedo.h"
+
+class FormUndoRedo: public QDialog, public Ui::fm_UndoRedo
+{
+ Q_OBJECT
+
+public:
+ FormUndoRedo(QWidget *parent = 0);
+ virtual ~FormUndoRedo();
+
+public slots:
+
+protected:
+
+private:
+};
+
+
+#endif
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>fm_UndoRedo</class>
+ <widget class="QDialog" name="fm_UndoRedo">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>573</width>
+ <height>281</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>UndoRedo</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="margin">
+ <number>3</number>
+ </property>
+ <item>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="currentIndex">
+ <number>1</number>
+ </property>
+ <widget class="QWidget" name="undoTab">
+ <attribute name="title">
+ <string>Undo</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <property name="margin">
+ <number>3</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QTreeWidget" name="treeWdUndo">
+ <column>
+ <property name="text">
+ <string notr="true">1</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="redoTab">
+ <attribute name="title">
+ <string>Redo</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="margin">
+ <number>3</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QTreeWidget" name="treeWdRedo">
+ <column>
+ <property name="text">
+ <string notr="true">1</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>fm_UndoRedo</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>fm_UndoRedo</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include <Python.h>
#include "SALOME_ResourcesManager.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
#include "RuntimeSALOME.hxx"
#include "Proc.hxx"
+#include "InputPort.hxx"
+#include "ServiceNode.hxx"
#include "parsers.hxx"
#include "Logger.hxx"
#include "YACSGuiLoader.hxx"
+#include "ComponentInstance.hxx"
#include "SALOME_NamingService.hxx"
#include "SALOME_ModuleCatalog.hxx"
#include "Scene.hxx"
#include "GenericGui.hxx"
#include "SceneItem.hxx"
+#include "SceneNodeItem.hxx"
+#include "SceneComposedNodeItem.hxx"
#include "ItemEdition.hxx"
#include "CatalogWidget.hxx"
#include "TreeView.hxx"
#include "TypeCode.hxx"
#include "LinkInfo.hxx"
#include "LogViewer.hxx"
+#include "chrono.hxx"
+#include "Resource.hxx"
+#include "Message.hxx"
+#include "ListJobs_GUI.hxx"
#include <QFileDialog>
#include <sstream>
#include <ctime>
+#ifdef WNT
+#define WEXITSTATUS(w) ((int) ((w) & 0x40000000))
+#endif
+
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
_catalogsWidget = 0;
_sessionCatalog = 0;
_schemaCnt = 0;
+ _isSaved = false;
_mapViewContext.clear();
_machineList.clear();
_menuId = 190;
+ _BJLdialog = NULL;
+ QtGuiContext::_counters = new counters(100);
+ srand((unsigned)time(0));
GuiObserver::setEventMap();
iconPath += "/share/salome/resources/yacs";
DEBTRACE(iconPath);
QDir::addSearchPath("icons", iconPath.c_str());
+
+ _guiEditor = new GuiEditor();
YACS::ENGINE::RuntimeSALOME::setRuntime();
_loader = new YACSGuiLoader();
DEBTRACE("SALOME_ModuleCatalog::ModuleCatalog found");
std::string anIOR = orb->object_to_string( aModuleCatalog );
_sessionCatalog = runTime->loadCatalog( "session", anIOR );
+ runTime->addCatalog(_sessionCatalog);
{
std::map< std::string, YACS::ENGINE::ComponentDefinition * >::iterator it;
for (it = _sessionCatalog->_componentMap.begin();
}
_dwTree = new QDockWidget(_parent);
+ _dwTree->setVisible(false);
_dwTree->setWindowTitle("Tree View: edition mode");
_parent->addDockWidget(Qt::LeftDockWidgetArea, _dwTree);
_dwStacked = new QDockWidget(_parent);
+ _dwStacked->setVisible(false);
_dwStacked->setWindowTitle("Input Panel");
+ _dwStacked->setMinimumWidth(270); // --- force a minimum until display
_parent->addDockWidget(Qt::RightDockWidgetArea, _dwStacked);
_dwCatalogs = new QDockWidget(_parent);
+ _dwCatalogs->setVisible(false);
_dwCatalogs->setWindowTitle("Catalogs");
_parent->addDockWidget(Qt::RightDockWidgetArea, _dwCatalogs);
_catalogsWidget = new CatalogWidget(_dwCatalogs,
_builtinCatalog,
_sessionCatalog);
- _catalogsWidget->setMinimumWidth(350); // --- force a minimum until display
_dwCatalogs->setWidget(_catalogsWidget);
+
_parent->tabifyDockWidget(_dwStacked, _dwCatalogs);
+ _parent->tabifyDockWidget(_dwTree, _wrapper->objectBrowser());
+#if QT_VERSION >= 0x040500
+ _parent->setTabPosition(Qt::AllDockWidgetAreas, Resource::tabPanelsUp? QTabWidget::North: QTabWidget::South);
+#endif
+ //Import user catalog
+ std::string usercata=Resource::userCatalog.toStdString();
+ _catalogsWidget->addCatalogFromFile(usercata);
}
GenericGui::~GenericGui()
{
+ if(_BJLdialog) delete _BJLdialog;
}
void GenericGui::createActions()
{
-// QAction* createAction(const int id,
-// const QString& toolTip,
-// const QIcon& icon,
-// const QString& menu,
-// const QString& status,
-// const int shortCut,
-// QObject* parent =0,
-// bool checkable = false,
-// QObject* receiver =0,
-// const char* member =0);
-
- QPixmap pixmap;
-
- pixmap.load("icons:new_dataflow.png");
- _newSchemaAct = _wrapper->createAction(getMenuId(), tr("Create a new YACS Schema"), QIcon(pixmap),
+ // QAction* createAction(const int id,
+ // const QString& toolTip,
+ // const QIcon& icon,
+ // const QString& menu,
+ // const QString& status,
+ // const int shortCut,
+ // QObject* parent =0,
+ // bool checkable = false,
+ // QObject* receiver =0,
+ // const char* member =0);
+
+ _newSchemaAct = _wrapper->createAction(getMenuId(), tr("Create a new YACS Schema"), QIcon("icons:schema.png"),
tr("New Schema"), tr("Create a new YACS Schema"),
0, _parent, false, this, SLOT(onNewSchema()));
-
- pixmap.load("icons:import_dataflow.png");
- _importSchemaAct = _wrapper->createAction(getMenuId(), tr("Import a YACS Schema for edition"), QIcon(pixmap),
+ _newSchemaAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_N); // --- QKeySequence::New ambiguous in SALOME
+
+ _importSchemaAct = _wrapper->createAction(getMenuId(), tr("Import a YACS Schema for edition"), QIcon("icons:import_dataflow.png"),
tr("Import Schema"), tr("Import a YACS Schema for edition"),
0, _parent, false, this, SLOT(onImportSchema()));
+ _importSchemaAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_O); // --- QKeySequence::Open ambiguous in SALOME
- pixmap.load("icons:import_superv_dataflow.png");
- _importSupervSchemaAct = _wrapper->createAction(getMenuId(), tr("Import a SUPERV Schema for edition"), QIcon(pixmap),
+ _importSupervSchemaAct = _wrapper->createAction(getMenuId(), tr("Import a SUPERV Schema for edition"), QIcon("icons:import_superv_dataflow.png"),
tr("Import SUPERV Schema"), tr("Import a SUPERV Schema for edition"),
0, _parent, false, this, SLOT(onImportSupervSchema()));
- pixmap.load("icons:save_dataflow.png");
- _exportSchemaAct = _wrapper->createAction(getMenuId(), tr("Save the current YACS Schema"), QIcon(pixmap),
+ _exportSchemaAct = _wrapper->createAction(getMenuId(), tr("Save the current YACS Schema"), QIcon("icons:save_dataflow.png"),
tr("Save Schema"), tr("Save the current YACS Schema"),
0, _parent, false, this, SLOT(onExportSchema()));
+ _exportSchemaAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_S); // --- QKeySequence::Save ambiguous in SALOME
- pixmap.load("icons:export_dataflow.png");
- _exportSchemaAsAct = _wrapper->createAction(getMenuId(), tr("Save the current YACS Schema As..."), QIcon(pixmap),
+ _exportSchemaAsAct = _wrapper->createAction(getMenuId(), tr("Save the current YACS Schema As..."), QIcon("icons:export_dataflow.png"),
tr("Save Schema As"), tr("Save the current YACS Schema As..."),
0, _parent, false, this, SLOT(onExportSchemaAs()));
+ //_exportSchemaAsAct->setShortcut(QKeySequence::SaveAs); // --- ambiguous in SALOME
- pixmap.load("icons:insert_file.png");
- _importCatalogAct = _wrapper->createAction(getMenuId(), tr("Import a Schema as a Catalog"), QIcon(pixmap),
- tr("Import Catalog"), tr("Import a Schema as a Catalog"),
- 0, _parent, false, this, SLOT(onImportCatalog()));
+ _importCatalogAct = _wrapper->createAction(getMenuId(), tr("Import a Schema as a Catalog"), QIcon("icons:insert_file.png"),
+ tr("Import Catalog"), tr("Import a Schema as a Catalog"),
+ 0, _parent, false, this, SLOT(onImportCatalog()));
- pixmap.load("icons:run_active.png");
- _runLoadedSchemaAct = _wrapper->createAction(getMenuId(), tr("Prepare the current edited schema for run"), QIcon(pixmap),
- tr("Run Current Schema"), tr("Prepare the current edited schema for run"),
- 0, _parent, false, this, SLOT(onRunLoadedSchema()));
+ _runLoadedSchemaAct = _wrapper->createAction(getMenuId(), tr("Prepare the current edited schema for run"), QIcon("icons:run_active.png"),
+ tr("Run Current Schema"), tr("Prepare the current edited schema for run"),
+ 0, _parent, false, this, SLOT(onRunLoadedSchema()));
- pixmap.load("icons:load_execution_state.png");
- _loadRunStateSchemaAct = _wrapper->createAction(getMenuId(), tr("Load a previous run state for this schema, prepare to run"), QIcon(pixmap),
+ _loadRunStateSchemaAct = _wrapper->createAction(getMenuId(), tr("Load a previous run state for this schema, prepare to run"), QIcon("icons:load_execution_state.png"),
tr("Load Run State"), tr("Load a previous run state for this schema, prepare to run"),
0, _parent, false, this, SLOT(onLoadRunStateSchema()));
- pixmap.load("icons:run.png");
- _loadAndRunSchemaAct = _wrapper->createAction(getMenuId(), tr("Load a schema for run"), QIcon(pixmap),
- tr("Load Schema to run"), tr("Load a schema for run"),
- 0, _parent, false, this, SLOT(onLoadAndRunSchema()));
+ _loadAndRunSchemaAct = _wrapper->createAction(getMenuId(), tr("Load a schema for run"), QIcon("icons:run.png"),
+ tr("Load Schema to run"), tr("Load a schema for run"),
+ 0, _parent, false, this, SLOT(onLoadAndRunSchema()));
+ _chooseBatchJobAct = _wrapper->createAction(getMenuId(), tr("Choose Batch Job for watch"), QIcon("icons:batch.png"),
+ tr("Choose Batch Job for watch"), tr("Choose Batch Job for watch"),
+ 0, _parent, false, this, SLOT(onChooseBatchJob()));
- pixmap.load("icons:suspend_resume.png");
- _startResumeAct = _wrapper->createAction(getMenuId(), tr("Start or Resume Schema execution"), QIcon(pixmap),
- tr("Start/Resume execution"), tr("Start or Resume Schema execution"),
- 0, _parent, false, this, SLOT(onStartResume()));
+ _startResumeAct = _wrapper->createAction(getMenuId(), tr("Start or Resume Schema execution"), QIcon("icons:suspend_resume.png"),
+ tr("Start/Resume execution"), tr("Start or Resume Schema execution"),
+ 0, _parent, false, this, SLOT(onStartResume()));
- pixmap.load("icons:kill.png");
- _abortAct = _wrapper->createAction(getMenuId(), tr("Abort the current execution"), QIcon(pixmap),
+ _abortAct = _wrapper->createAction(getMenuId(), tr("Abort the current execution"), QIcon("icons:kill.png"),
tr("Abort execution"), tr("Abort the current execution"),
0, _parent, false, this, SLOT(onAbort()));
- pixmap.load("icons:pause.png");
- _pauseAct = _wrapper->createAction(getMenuId(), tr("Suspend the current execution"), QIcon(pixmap),
+ _pauseAct = _wrapper->createAction(getMenuId(), tr("Suspend the current execution"), QIcon("icons:pause.png"),
tr("Suspend execution"), tr("Suspend the current execution"),
0, _parent, false, this, SLOT(onPause()));
- pixmap.load("icons:reset.png");
- _resetAct = _wrapper->createAction(getMenuId(), tr("Reset the current execution"), QIcon(pixmap),
- tr("Reset execution"), tr("Reset the current execution"),
- 0, _parent, false, this, SLOT(onReset()));
+ _resetAct = _wrapper->createAction(getMenuId(), tr("Reset error nodes and restart the current execution"), QIcon("icons:reset.png"),
+ tr("Restart execution"), tr("Restart the current execution with reset of error nodes"),
+ 0, _parent, false, this, SLOT(onReset()));
- pixmap.load("icons:save_dataflow_state.png");
- _saveRunStateAct = _wrapper->createAction(getMenuId(), tr("Save the current run state"), QIcon(pixmap),
+ _saveRunStateAct = _wrapper->createAction(getMenuId(), tr("Save the current run state"), QIcon("icons:save_dataflow_state.png"),
tr("Save State"), tr("Save the current run state"),
0, _parent, false, this, SLOT(onSaveRunState()));
- pixmap.load("icons:new_edition.png");
- _newEditionAct = _wrapper->createAction(getMenuId(), tr("Edit again the current schema in a new context"), QIcon(pixmap),
+ _newEditionAct = _wrapper->createAction(getMenuId(), tr("Edit again the current schema in a new context"), QIcon("icons:new_edition.png"),
tr("Edit Again"), tr("Edit again the current schema in a new context"),
0, _parent, false, this, SLOT(onNewEdition()));
- pixmap.load("icons:change_informations.png");
- _getYacsContainerLogAct = _wrapper->createAction(getMenuId(), tr("get YACS container log"), QIcon(pixmap),
- tr("YACS Container Log"), tr("get YACS container log"),
- 0, _parent, false, this, SLOT(onGetYacsContainerLog()));
+ _getYacsContainerLogAct = _wrapper->createAction(getMenuId(), tr("get YACS container log"), QIcon("icons:change_informations.png"),
+ tr("YACS Container Log"), tr("get YACS container log"),
+ 0, _parent, false, this, SLOT(onGetYacsContainerLog()));
- pixmap.load("icons:filter_notification.png");
- _getErrorReportAct = _wrapper->createAction(getMenuId(), tr("get Node Error Report"), QIcon(pixmap),
- tr("Node Error Report"), tr("get Node Error Report"),
- 0, _parent, false, this, SLOT(onGetErrorReport()));
+ _getErrorReportAct = _wrapper->createAction(getMenuId(), tr("get Node Error Report"), QIcon("icons:filter_notification.png"),
+ tr("Node Error Report"), tr("get Node Error Report"),
+ 0, _parent, false, this, SLOT(onGetErrorReport()));
- pixmap.load("icons:icon_text.png");
- _getErrorDetailsAct = _wrapper->createAction(getMenuId(), tr("get Node Error Details"), QIcon(pixmap),
- tr("Node Error Details"), tr("get Node Error Details"),
- 0, _parent, false, this, SLOT(onGetErrorDetails()));
+ _getErrorDetailsAct = _wrapper->createAction(getMenuId(), tr("get Node Error Details"), QIcon("icons:icon_text.png"),
+ tr("Node Error Details"), tr("get Node Error Details"),
+ 0, _parent, false, this, SLOT(onGetErrorDetails()));
- pixmap.load("icons:change_informations.png");
- _getContainerLogAct = _wrapper->createAction(getMenuId(), tr("get Node Container Log"), QIcon(pixmap),
- tr("Node Container Log"), tr("get Node Container Log"),
- 0, _parent, false, this, SLOT(onGetContainerLog()));
+ _getContainerLogAct = _wrapper->createAction(getMenuId(), tr("get Node Container Log"), QIcon("icons:change_informations.png"),
+ tr("Node Container Log"), tr("get Node Container Log"),
+ 0, _parent, false, this, SLOT(onGetContainerLog()));
+ _shutdownProcAct = _wrapper->createAction(getMenuId(), tr("Shutdown Proc"), QIcon("icons:kill.png"),
+ tr("Shutdown Proc"), tr("Shutdown Proc"),
+ 0, _parent, false, this, SLOT(onShutdownProc()));
- pixmap.load("icons:kill.png");
- _editDataTypesAct = _wrapper->createAction(getMenuId(), tr("Edit Data Types"), QIcon(pixmap),
- tr("Edit Data Types"), tr("Edit Data Types"),
- 0, _parent, false, this, SLOT(onEditDataTypes()));
+ _editDataTypesAct = _wrapper->createAction(getMenuId(), tr("Edit Data Types"), QIcon("icons:kill.png"),
+ tr("Edit Data Types"), tr("Edit Data Types"),
+ 0, _parent, false, this, SLOT(onEditDataTypes()));
- pixmap.load("icons:kill.png");
- _createDataTypeAct = _wrapper->createAction(getMenuId(), tr("Create Data Types"), QIcon(pixmap),
+ _createDataTypeAct = _wrapper->createAction(getMenuId(), tr("Create Data Types"), QIcon("icons:kill.png"),
tr("Create Data Types"), tr("Create Data Types"),
0, _parent, false, this, SLOT(onCreateDataType()));
- pixmap.load("icons:folder_cyan.png");
- _importDataTypeAct = _wrapper->createAction(getMenuId(), tr("Import Data Types, use drag and drop from catalog"), QIcon(pixmap),
+ _importDataTypeAct = _wrapper->createAction(getMenuId(), tr("Import Data Types, use drag and drop from catalog"), QIcon("icons:folder_cyan.png"),
tr("Import Data Types"), tr("Import Data Types, use drag and drop from catalog"),
0, _parent, false, this, SLOT(onImportDataType()));
- pixmap.load("icons:container.png");
- _newContainerAct = _wrapper->createAction(getMenuId(), tr("Create a New Container"), QIcon(pixmap),
- tr("Create Container"), tr("Create a New Container"),
- 0, _parent, false, this, SLOT(onNewContainer()));
-
- pixmap.load("icons:new_salome_component.png");
- _newSalomeComponentAct = _wrapper->createAction(getMenuId(), tr("Create a New SALOME Component"), QIcon(pixmap),
- tr("SALOME Component"), tr("Create a New SALOME Component"),
- 0, _parent, false, this, SLOT(onNewSalomeComponent()));
-
- pixmap.load("icons:new_salomepy_component.png");
- _newSalomePythonComponentAct = _wrapper->createAction(getMenuId(), tr("Create a New SALOME Python Component"), QIcon(pixmap),
- tr("SALOME Python Component"), tr("Create a New SALOME Python Component"),
- 0, _parent, false, this, SLOT(onNewSalomePythonComponent()));
-
- pixmap.load("icons:new_corba_component.png");
- _newCorbaComponentAct = _wrapper->createAction(getMenuId(), tr("Create a New CORBA Component"), QIcon(pixmap),
- tr("CORBA Component"), tr("Create a New CORBA Component"),
- 0, _parent, false, this, SLOT(onNewCorbaComponent()));
-
- pixmap.load("icons:schema.png");
- _newSchemaAct = _wrapper->createAction(getMenuId(), tr("New Schema"), QIcon(pixmap),
- tr("New Schema"), tr("New Schema"),
- 0, _parent, false, this, SLOT(onNewSchema()));
-
- pixmap.load("icons:new_salome_service_node.png");
- _salomeServiceNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New SALOME Service Node"), QIcon(pixmap),
- tr("SALOME Service Node"), tr("Create a New SALOME Service Node"),
- 0, _parent, false, this, SLOT(onSalomeServiceNode()));
-
- pixmap.load("icons:new_service_inline_node.png");
- _serviceInlineNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Inline Service Node"), QIcon(pixmap),
- tr("Inline Service Node"), tr("Create a New Inline Service Node"),
- 0, _parent, false, this, SLOT(onServiceInlineNode()));
-
- pixmap.load("icons:new_corba_service_node.png");
- _CORBAServiceNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New CORBA Service Node"), QIcon(pixmap),
- tr("CORBA Node"), tr("Create a New CORBA Service Node"),
- 0, _parent, false, this, SLOT(onCORBAServiceNode()));
-
- pixmap.load("icons:new_nodenode_service_node.png");
- _nodeNodeServiceNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Node referencing a Node"), QIcon(pixmap),
- tr("Ref on Node"), tr("Create a New Node referencing a Node"),
- 0, _parent, false, this, SLOT(onNodeNodeServiceNode()));
-
- pixmap.load("icons:new_cpp_node.png");
- _cppNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New C++ Node"), QIcon(pixmap),
- tr("Cpp Node"), tr("Create a New C++ Node"),
- 0, _parent, false, this, SLOT(onCppNode()));
-
- pixmap.load("icons:kill.png");
- _inDataNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Input data Node"), QIcon(pixmap),
- tr("Input Data Node"), tr("Create a New Input data Node"),
- 0, _parent, false, this, SLOT(onInDataNode()));
-
- pixmap.load("icons:kill.png");
- _outDataNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Output data Node"), QIcon(pixmap),
- tr("Output Data Node"), tr("Create a New Output data Node"),
- 0, _parent, false, this, SLOT(onOutDataNode()));
-
- pixmap.load("icons:kill.png");
- _inStudyNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Input Study Node"), QIcon(pixmap),
- tr("Input Study Node"), tr("Create a New Input Study Node"),
- 0, _parent, false, this, SLOT(onInStudyNode()));
-
- pixmap.load("icons:kill.png");
- _outStudyNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Output Study Node"), QIcon(pixmap),
- tr("Output Study Node"), tr("Create a New Output Study Node"),
- 0, _parent, false, this, SLOT(onOutStudyNode()));
-
- pixmap.load("icons:new_inline_script_node.png");
- _inlineScriptNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Inline Python Script Node"), QIcon(pixmap),
- tr("Inline Script Node"), tr("Create a New Inline Python Script Node"),
- 0, _parent, false, this, SLOT(onInlineScriptNode()));
-
- pixmap.load("icons:new_inline_function_node.png");
- _inlineFunctionNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Inline Python Function Node"), QIcon(pixmap),
- tr("Inline Function Node"), tr("Create a New Inline Python Function Node"),
- 0, _parent, false, this, SLOT(onInlineFunctionNode()));
-
- pixmap.load("icons:new_block_node.png");
- _blockNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Bloc Node"), QIcon(pixmap),
- tr("bloc Node"), tr("Create a New Bloc Node"),
- 0, _parent, false, this, SLOT(onBlockNode()));
-
- pixmap.load("icons:new_for_loop_node.png");
- _FORNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New For Loop Node"), QIcon(pixmap),
- tr("For Loop Node"), tr("Create a New For Loop Node"),
- 0, _parent, false, this, SLOT(onFORNode()));
-
- pixmap.load("icons:new_foreach_loop_node.png");
- _FOREACHNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New For Each Loop Node"), QIcon(pixmap),
- tr("For Each Loop Node"), tr("Create a New For Each Loop Node"),
- 0, _parent, false, this, SLOT(onFOREACHNode()));
-
- pixmap.load("icons:new_while_loop_node.png");
- _WHILENodeAct = _wrapper->createAction(getMenuId(), tr("Create a New While Loop Node"), QIcon(pixmap),
- tr("While Loop Node"), tr("Create a New While Loop Node"),
- 0, _parent, false, this, SLOT(onWHILENode()));
-
- pixmap.load("icons:new_switch_loop_node.png");
- _SWITCHNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Switch Node"), QIcon(pixmap),
- tr("Switch Node"), tr("Create a New Switch Node"),
- 0, _parent, false, this, SLOT(onSWITCHNode()));
-
- pixmap.load("icons:new_from_library_node.png");
- _nodeFromCatalogAct = _wrapper->createAction(getMenuId(), tr("Create a New Node from Catalog, use drag and drop from catalog"), QIcon(pixmap),
- tr("Node from Catalog"), tr("Create a New Node from Catalog, use drag and drop from catalog"),
- 0, _parent, false, this, SLOT(onNodeFromCatalog()));
-
- pixmap.load("icons:delete.png");
- _deleteItemAct = _wrapper->createAction(getMenuId(), tr("Delete a Schema Item"), QIcon(pixmap),
- tr("Delete Item"), tr("Delete a Schema Item"),
- 0, _parent, false, this, SLOT(onDeleteItem()));
-
- pixmap.load("icons:cut.png");
- _cutItemAct = _wrapper->createAction(getMenuId(), tr("Cut a Schema Item"), QIcon(pixmap),
+ _newContainerAct = _wrapper->createAction(getMenuId(), tr("Create a New Container"), QIcon("icons:container.png"),
+ tr("Create Container"), tr("Create a New Container"),
+ 0, _parent, false, this, SLOT(onNewContainer()));
+
+ _selectComponentInstanceAct = _wrapper->createAction(getMenuId(), tr("Select a Component Instance"), QIcon("icons:icon_select.png"),
+ tr("Select a Component Instance"), tr("Select a Component Instance"),
+ 0, _parent, false, this, SLOT(onSelectComponentInstance()));
+
+ _newSalomeComponentAct = _wrapper->createAction(getMenuId(), tr("Create a New SALOME Component Instance"), QIcon("icons:new_salome_component.png"),
+ tr("Create Component Instance"), tr("Create a New SALOME Component Instance"),
+ 0, _parent, false, this, SLOT(onNewSalomeComponent()));
+
+ _newSalomePythonComponentAct = _wrapper->createAction(getMenuId(), tr("Create a New SALOME Python Component"), QIcon("icons:new_salomepy_component.png"),
+ tr("SALOME Python Component"), tr("Create a New SALOME Python Component"),
+ 0, _parent, false, this, SLOT(onNewSalomePythonComponent()));
+
+ _newCorbaComponentAct = _wrapper->createAction(getMenuId(), tr("Create a New CORBA Component"), QIcon("icons:new_corba_component.png"),
+ tr("CORBA Component"), tr("Create a New CORBA Component"),
+ 0, _parent, false, this, SLOT(onNewCorbaComponent()));
+
+ _salomeServiceNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New SALOME Service Node"), QIcon("icons:new_salome_service_node.png"),
+ tr("SALOME Service Node"), tr("Create a New SALOME Service Node"),
+ 0, _parent, false, this, SLOT(onSalomeServiceNode()));
+
+ _serviceInlineNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Inline Service Node"), QIcon("icons:new_service_inline_node.png"),
+ tr("Inline Service Node"), tr("Create a New Inline Service Node"),
+ 0, _parent, false, this, SLOT(onServiceInlineNode()));
+
+ _CORBAServiceNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New CORBA Service Node"), QIcon("icons:new_corba_service_node.png"),
+ tr("CORBA Node"), tr("Create a New CORBA Service Node"),
+ 0, _parent, false, this, SLOT(onCORBAServiceNode()));
+
+ _nodeNodeServiceNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Node referencing a Node"), QIcon("icons:new_nodenode_service_node.png"),
+ tr("Ref on Node"), tr("Create a New Node referencing a Node"),
+ 0, _parent, false, this, SLOT(onNodeNodeServiceNode()));
+
+ _cppNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New C++ Node"), QIcon("icons:new_cpp_node.png"),
+ tr("Cpp Node"), tr("Create a New C++ Node"),
+ 0, _parent, false, this, SLOT(onCppNode()));
+
+ _inDataNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Input data Node"), QIcon("icons:node.png"),
+ tr("Input Data Node"), tr("Create a New Input data Node"),
+ 0, _parent, false, this, SLOT(onInDataNode()));
+
+ _outDataNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Output data Node"), QIcon("icons:node.png"),
+ tr("Output Data Node"), tr("Create a New Output data Node"),
+ 0, _parent, false, this, SLOT(onOutDataNode()));
+
+ _inStudyNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Input Study Node"), QIcon("icons:node.png"),
+ tr("Input Study Node"), tr("Create a New Input Study Node"),
+ 0, _parent, false, this, SLOT(onInStudyNode()));
+
+ _outStudyNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Output Study Node"), QIcon("icons:node.png"),
+ tr("Output Study Node"), tr("Create a New Output Study Node"),
+ 0, _parent, false, this, SLOT(onOutStudyNode()));
+
+ _inlineScriptNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Inline Python Script Node"), QIcon("icons:new_inline_script_node.png"),
+ tr("Inline Script Node"), tr("Create a New Inline Python Script Node"),
+ 0, _parent, false, this, SLOT(onInlineScriptNode()));
+
+ _inlineFunctionNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Inline Python Function Node"), QIcon("icons:new_inline_function_node.png"),
+ tr("Inline Function Node"), tr("Create a New Inline Python Function Node"),
+ 0, _parent, false, this, SLOT(onInlineFunctionNode()));
+
+ _blockNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Bloc Node"), QIcon("icons:new_block_node.png"),
+ tr("bloc Node"), tr("Create a New Bloc Node"),
+ 0, _parent, false, this, SLOT(onBlockNode()));
+
+ _FORNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New For Loop Node"), QIcon("icons:new_for_loop_node.png"),
+ tr("For Loop Node"), tr("Create a New For Loop Node"),
+ 0, _parent, false, this, SLOT(onFORNode()));
+
+ _FOREACHNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New For Each Loop Node"), QIcon("icons:new_foreach_loop_node.png"),
+ tr("For Each Loop Node"), tr("Create a New For Each Loop Node"),
+ 0, _parent, false, this, SLOT(onFOREACHNode()));
+
+ _WHILENodeAct = _wrapper->createAction(getMenuId(), tr("Create a New While Loop Node"), QIcon("icons:new_while_loop_node.png"),
+ tr("While Loop Node"), tr("Create a New While Loop Node"),
+ 0, _parent, false, this, SLOT(onWHILENode()));
+
+ _SWITCHNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Switch Node"), QIcon("icons:new_switch_loop_node.png"),
+ tr("Switch Node"), tr("Create a New Switch Node"),
+ 0, _parent, false, this, SLOT(onSWITCHNode()));
+
+ _OptimizerLoopAct = _wrapper->createAction(getMenuId(), tr("Create a New Optimizer Loop Node"), QIcon("icons:new_for_loop_node.png"),
+ tr("Optimizer Loop"), tr("Create a New Optimizer Loop"),
+ 0, _parent, false, this, SLOT(onOptimizerLoop()));
+
+ _nodeFromCatalogAct = _wrapper->createAction(getMenuId(), tr("Create a New Node from Catalog, use drag and drop from catalog"), QIcon("icons:new_from_library_node.png"),
+ tr("Node from Catalog"), tr("Create a New Node from Catalog, use drag and drop from catalog"),
+ 0, _parent, false, this, SLOT(onNodeFromCatalog()));
+
+ _deleteItemAct = _wrapper->createAction(getMenuId(), tr("Delete a Schema Item"), QIcon("icons:delete.png"),
+ tr("Delete Item"), tr("Delete a Schema Item"),
+ 0, _parent, false, this, SLOT(onDeleteItem()));
+ _deleteItemAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_D); // --- QKeySequence::Delete dangerous...
+
+ _cutItemAct = _wrapper->createAction(getMenuId(), tr("Cut a Schema Item"), QIcon("icons:cut.png"),
tr("Cut Item"), tr("Cut a Schema Item"),
0, _parent, false, this, SLOT(onCutItem()));
+ _cutItemAct->setShortcut(QKeySequence::Cut);
- pixmap.load("icons:copy.png");
- _copyItemAct = _wrapper->createAction(getMenuId(), tr("Copy a Schema Item"), QIcon(pixmap),
+ _copyItemAct = _wrapper->createAction(getMenuId(), tr("Copy a Schema Item"), QIcon("icons:copy.png"),
tr("Copy Item"), tr("Copy a Schema Item"),
0, _parent, false, this, SLOT(onCopyItem()));
+ _copyItemAct->setShortcut(QKeySequence::Copy);
- pixmap.load("icons:paste.png");
- _pasteItemAct = _wrapper->createAction(getMenuId(), tr("Paste a Schema Item"), QIcon(pixmap),
+ _pasteItemAct = _wrapper->createAction(getMenuId(), tr("Paste a Schema Item"), QIcon("icons:paste.png"),
tr("Paste Item"), tr("Paste a Schema Item"),
0, _parent, false, this, SLOT(onPasteItem()));
+ _pasteItemAct->setShortcut(QKeySequence::Paste);
+
+ _putInBlocAct = _wrapper->createAction(getMenuId(), tr("Put node in block"), QIcon("icons:paste.png"),
+ tr("Put node in block"), tr("Put node in block"),
+ 0, _parent, false, this, SLOT(onPutInBloc()));
+
+ _arrangeLocalNodesAct = _wrapper->createAction(getMenuId(), tr("arrange nodes on that bloc level, without recursion"), QIcon("icons:arrange_nodes.png"),
+ tr("arrange local nodes"), tr("arrange nodes on that bloc level, without recursion"),
+ 0, _parent, false, this, SLOT(onArrangeLocalNodes()));
+
+ _arrangeRecurseNodesAct = _wrapper->createAction(getMenuId(), tr("arrange nodes on that bloc level, with recursion"), QIcon("icons:sample.png"),
+ tr("arrange nodes recursion"), tr("arrange nodes on that bloc level, with recursion"),
+ 0, _parent, false, this, SLOT(onArrangeRecurseNodes()));
+
+ _computeLinkAct = _wrapper->createAction(getMenuId(), tr("compute orthogonal links"), QIcon("icons:rebuild_links.png"),
+ tr("compute links"), tr("compute orthogonal links"),
+ 0, _parent, false, this, SLOT(onRebuildLinks()));
+
+ _zoomToBlocAct = _wrapper->createAction(getMenuId(), tr("zoom 2D view to selected bloc"), QIcon("icons:zoomToBloc.png"),
+ tr("zoom to bloc"), tr("zoom 2D view to the selected composed node"),
+ 0, _parent, false, this, SLOT(onZoomToBloc()));
+
+ _centerOnNodeAct = _wrapper->createAction(getMenuId(), tr("center 2D view on selected node"), QIcon("icons:centerOnNode.png"),
+ tr("center on node"), tr("center 2D view on selected node"),
+ 0, _parent, false, this, SLOT(onCenterOnNode()));
+ _centerOnNodeAct->setShortcut(QKeySequence::Find);
+
+ _shrinkExpand = _wrapper->createAction(getMenuId(), tr("shrink or expand the selected node"), QIcon("icons:shrinkExpand.png"),
+ tr("shrink/expand"), tr("shrink or expand the selected node"),
+ 0, _parent, false, this, SLOT(onShrinkExpand()));
+
+ _toggleStraightLinksAct = _wrapper->createAction(getMenuId(), tr("draw straight or orthogonal links"), QIcon("icons:straightLink.png"),
+ tr("straight/orthogonal"), tr("draw straight or orthogonal links"),
+ 0, _parent, true, this, SLOT(onToggleStraightLinks(bool)));
+
+ _toggleStraightLinksAct->setChecked(Resource::straightLinks);
+ onToggleStraightLinks(Resource::straightLinks);
- pixmap.load("icons:arrange_nodes.png");
- _arrangeLocalNodesAct = _wrapper->createAction(getMenuId(), tr("arrange nodes on that bloc level, without recursion"), QIcon(pixmap),
- tr("arrange local nodes"), tr("arrange nodes on that bloc level, without recursion"),
- 0, _parent, false, this, SLOT(onArrangeLocalNodes()));
-
- pixmap.load("icons:sample.png");
- _arrangeRecurseNodesAct = _wrapper->createAction(getMenuId(), tr("arrange nodes on that bloc level, with recursion"), QIcon(pixmap),
- tr("arrange nodes recursion"), tr("arrange nodes on that bloc level, with recursion"),
- 0, _parent, false, this, SLOT(onArrangeRecurseNodes()));
-
- pixmap.load("icons:rebuild_links.png");
- _computeLinkAct = _wrapper->createAction(getMenuId(), tr("compute orthogonal links"), QIcon(pixmap),
- tr("compute links"), tr("compute orthogonal links"),
- 0, _parent, false, this, SLOT(onRebuildLinks()));
-
- pixmap.load("icons:autoComputeLink.png");
- _toggleAutomaticComputeLinkAct = _wrapper->createAction(getMenuId(), tr("compute othogonal links autoamtically when nodes move"), QIcon(pixmap),
- tr("automatic link"), tr("compute othogonal links autoamtically when nodes move"),
- 0, _parent, true, this, SLOT(onToggleAutomaticComputeLinks(bool)));
-
- _toggleAutomaticComputeLinkAct->setChecked(true);
-
- pixmap.load("icons:simplifyLink.png");
- _toggleSimplifyLinkAct = _wrapper->createAction(getMenuId(), tr("simplify links by removing unnecessary direction changes"), QIcon(pixmap),
- tr("simplify links"), tr("simplify links by removing unnecessary direction changes"),
- 0, _parent, true, this, SLOT(onToggleSimplifyLinks(bool)));
- _toggleSimplifyLinkAct->setChecked(true);
-
- pixmap.load("icons:force2nodeLink.png");
- _toggleForce2NodesLinkAct = _wrapper->createAction(getMenuId(), tr("force orthogonal links by adding an edge on simples links"), QIcon(pixmap),
- tr("force ortho links"), tr("force orthogonal links by adding an edge on simples links"),
- 0, _parent, true, this, SLOT(onToggleForce2NodesLinks(bool)));
+ _toggleAutomaticComputeLinkAct = _wrapper->createAction(getMenuId(), tr("compute othogonal links automatically when nodes move"), QIcon("icons:autoComputeLink.png"),
+ tr("automatic link"), tr("compute othogonal links automatically when nodes move"),
+ 0, _parent, true, this, SLOT(onToggleAutomaticComputeLinks(bool)));
+
+ _toggleAutomaticComputeLinkAct->setChecked(Resource::autoComputeLinks);
+ onToggleAutomaticComputeLinks(Resource::autoComputeLinks); // Why is this needed ?
+
+ _toggleSimplifyLinkAct = _wrapper->createAction(getMenuId(), tr("simplify links by removing unnecessary direction changes"), QIcon("icons:simplifyLink.png"),
+ tr("simplify links"), tr("simplify links by removing unnecessary direction changes"),
+ 0, _parent, true, this, SLOT(onToggleSimplifyLinks(bool)));
+ _toggleSimplifyLinkAct->setChecked(Resource::simplifyLink);
+ onToggleSimplifyLinks(Resource::simplifyLink);
+
+ _toggleForce2NodesLinkAct = _wrapper->createAction(getMenuId(), tr("force orthogonal links by adding an edge on simples links"), QIcon("icons:force2nodeLink.png"),
+ tr("force ortho links"), tr("force orthogonal links by adding an edge on simples links"),
+ 0, _parent, true, this, SLOT(onToggleForce2NodesLinks(bool)));
_toggleForce2NodesLinkAct->setChecked(true);
- pixmap.load("icons:ob_service_node.png");
- _selectReferenceAct = _wrapper->createAction(getMenuId(), tr("select reference"), QIcon(pixmap),
- tr("select reference"), tr("select reference"),
- 0, _parent, false, this, SLOT(onSelectReference()));
+ _toggleAddRowColsAct = _wrapper->createAction(getMenuId(), tr("allow more path for the links, for a better separation"), QIcon("icons:addRowCols.png"),
+ tr("separate links"), tr("allow more path for the links, for a better separation"),
+ 0, _parent, true, this, SLOT(onToggleAddRowCols(bool)));
+ _toggleAddRowColsAct->setChecked(Resource::addRowCols);
+ onToggleAddRowCols(Resource::addRowCols);
+
+ _selectReferenceAct = _wrapper->createAction(getMenuId(), tr("select reference"), QIcon("icons:ob_service_node.png"),
+ tr("select reference"), tr("select reference"),
+ 0, _parent, false, this, SLOT(onSelectReference()));
- pixmap.load("icons:whatsThis.png");
- _whatsThisAct = _wrapper->createAction(getMenuId(), tr("active whatsThis Mode to get help on widgets"), QIcon(pixmap),
- tr("whatsThis Mode"), tr("active whatsThis Mode to get help on widgets"),
- 0, _parent, false, this, SLOT(onWhatsThis()));
+ _whatsThisAct = _wrapper->createAction(getMenuId(), tr("active whatsThis Mode to get help on widgets"), QIcon("icons:whatsThis.png"),
+ tr("whatsThis Mode"), tr("active whatsThis Mode to get help on widgets"),
+ 0, _parent, false, this, SLOT(onWhatsThis()));
+ _whatsThisAct->setShortcut(QKeySequence::WhatsThis);
- pixmap.load("icons:run_active.png");
- _withoutStopModeAct = _wrapper->createAction(getMenuId(), tr("set execution mode without stop"), QIcon(pixmap),
- tr("mode without stop"), tr("set execution mode without stop"),
+ _withoutStopModeAct = _wrapper->createAction(getMenuId(), tr("set execution mode without stop"), QIcon("icons:run_active.png"),
+ tr("mode without stop"), tr("set execution mode without stop"),
0, _parent, true, this, SLOT(onWithoutStopMode(bool)));
- pixmap.load("icons:breakpoints_active.png");
- _breakpointsModeAct = _wrapper->createAction(getMenuId(), tr("set execution mode with stop on breakpoints"), QIcon(pixmap),
- tr("mode breakpoints"), tr("set execution mode with stop on breakpoints"),
+ _breakpointsModeAct = _wrapper->createAction(getMenuId(), tr("set execution mode with stop on breakpoints"), QIcon("icons:breakpoints_active.png"),
+ tr("mode breakpoints"), tr("set execution mode with stop on breakpoints"),
0, _parent, true, this, SLOT(onBreakpointsMode(bool)));
- pixmap.load("icons:step_by_step_active.png");
- _stepByStepModeAct = _wrapper->createAction(getMenuId(), tr("set execution mode step by step"), QIcon(pixmap),
+ _stepByStepModeAct = _wrapper->createAction(getMenuId(), tr("set execution mode step by step"), QIcon("icons:step_by_step_active.png"),
tr("mode step by step"), tr("set execution mode step by step"),
0, _parent, true, this, SLOT(onStepByStepMode(bool)));
- pixmap.load("icons:toggle_stop_on_error.png");
- _toggleStopOnErrorAct = _wrapper->createAction(getMenuId(), tr("Force stop on first error during execution"), QIcon(pixmap),
- tr("stop on error"), tr("Force stop on first error during execution"),
- 0, _parent, true, this, SLOT(onToggleStopOnError(bool)));
+ _toggleStopOnErrorAct = _wrapper->createAction(getMenuId(), tr("Force stop on first error during execution"), QIcon("icons:toggle_stop_on_error.png"),
+ tr("stop on error"), tr("Force stop on first error during execution"),
+ 0, _parent, true, this, SLOT(onToggleStopOnError(bool)));
+
+ _toggleSceneItemVisibleAct = _wrapper->createAction(getMenuId(), tr("toggle 2D scene item visibility"), QIcon("icons:toggleVisibility.png"),
+ tr("visible/hidden"), tr("toggle 2D scene item visibility"),
+ 0, _parent, true, this, SLOT(onToggleSceneItemVisible(bool)));
+
+
- pixmap.load("icons:toggleVisibility.png");
- _toggleSceneItemVisibleAct = _wrapper->createAction(getMenuId(), tr("toggle 2D scene item visibility"), QIcon(pixmap),
- tr("visible/hidden"), tr("toggle 2D scene item visibility"),
- 0, _parent, true, this, SLOT(onToggleSceneItemVisible(bool)));
+ _showAllLinksAct = _wrapper->createAction(getMenuId(), tr("Show all the links"), QIcon("icons:showLink.png"),
+ tr("show all links"), tr("Show all the links"),
+ 0, _parent, false, this, SLOT(onShowAllLinks()));
+ _hideAllLinksAct = _wrapper->createAction(getMenuId(), tr("Hide all the links"), QIcon("icons:hideLink.png"),
+ tr("hide all links"), tr("Hide all the links"),
+ 0, _parent, false, this, SLOT(onHideAllLinks()));
+
+
+ _showOnlyPortLinksAct = _wrapper->createAction(getMenuId(), tr("Show only links from/to this port"), QIcon("icons:showLink.png"),
+ tr("show only links"), tr("Show only links from/to this port"),
+ 0, _parent, false, this, SLOT(onShowOnlyPortLinks()));
+
+ _showPortLinksAct = _wrapper->createAction(getMenuId(), tr("Show links from/to this port"), QIcon("icons:showLink.png"),
+ tr("show links"), tr("Show links from/to this port"),
+ 0, _parent, false, this, SLOT(onShowPortLinks()));
+
+ _hidePortLinksAct = _wrapper->createAction(getMenuId(), tr("Hide links from/to this port"), QIcon("icons:hideLink.png"),
+ tr("hide links"), tr("Hide links from/to this port"),
+ 0, _parent, false, this, SLOT(onHidePortLinks()));
+
+
+ _showOnlyCtrlLinksAct = _wrapper->createAction(getMenuId(), tr("Show only control links from/to this node"), QIcon("icons:showLink.png"),
+ tr("show only Control links"), tr("Show only control links from/to this node"),
+ 0, _parent, false, this, SLOT(onShowOnlyCtrlLinks()));
+
+ _showCtrlLinksAct = _wrapper->createAction(getMenuId(), tr("Show control links from/to this node"), QIcon("icons:showLink.png"),
+ tr("show control links"), tr("Show control links from/to this node"),
+ 0, _parent, false, this, SLOT(onShowCtrlLinks()));
+
+ _hideCtrlLinksAct = _wrapper->createAction(getMenuId(), tr("Hide control links from/to this node"), QIcon("icons:hideLink.png"),
+ tr("hide control links"), tr("Hide control links from/to this node"),
+ 0, _parent, false, this, SLOT(onHideCtrlLinks()));
+
+
+ _showOnlyLinkAct = _wrapper->createAction(getMenuId(), tr("Show only this link"), QIcon("icons:showLink.png"),
+ tr("show only"), tr("Show only this link"),
+ 0, _parent, false, this, SLOT(onShowOnlyLink()));
+
+ _showLinkAct = _wrapper->createAction(getMenuId(), tr("Show this link"), QIcon("icons:showLink.png"),
+ tr("show"), tr("Show this link"),
+ 0, _parent, false, this, SLOT(onShowLink()));
+
+ _hideLinkAct = _wrapper->createAction(getMenuId(), tr("Hide this link"), QIcon("icons:hideLink.png"),
+ tr("hide"), tr("Hide this link"),
+ 0, _parent, false, this, SLOT(onHideLink()));
+
+
+ _emphasisPortLinksAct = _wrapper->createAction(getMenuId(), tr("emphasis on links from/to this port"), QIcon("icons:emphasisLink.png"),
+ tr("emphasize links"), tr("emphasis on links from/to this port"),
+ 0, _parent, false, this, SLOT(onEmphasisPortLinks()));
+
+ _emphasisCtrlLinksAct = _wrapper->createAction(getMenuId(), tr("emphasis on control links from/to this node"), QIcon("icons:emphasisLink.png"),
+ tr("emphasize control links"), tr("emphasis on control links from/to this node"),
+ 0, _parent, false, this, SLOT(onEmphasisCtrlLinks()));
+
+ _emphasisLinkAct = _wrapper->createAction(getMenuId(), tr("emphasis on this link"), QIcon("icons:emphasisLink.png"),
+ tr("emphasize"), tr("emphasis on this link"),
+ 0, _parent, false, this, SLOT(onEmphasisLink()));
+
+ _deEmphasizeAllAct = _wrapper->createAction(getMenuId(), tr("remove all emphasis"), QIcon("icons:deEmphasisLink.png"),
+ tr("remove all emphasis"), tr("remove all emphasis"),
+ 0, _parent, false, this, SLOT(onDeEmphasizeAll()));
+
+
+ _undoAct = _wrapper->createAction(getMenuId(), tr("undo last action"), QIcon("icons:undo.png"),
+ tr("undo"), tr("undo last action"),
+ 0, _parent, false, this, SLOT(onUndo()));
+ _undoAct->setShortcut(QKeySequence::Undo);
+
+ _redoAct = _wrapper->createAction(getMenuId(), tr("redo last action"), QIcon("icons:redo.png"),
+ tr("redo"), tr("redo last action"),
+ 0, _parent, false, this, SLOT(onRedo()));
+ _redoAct->setShortcut(QKeySequence::Redo);
+
+ _showUndoAct = _wrapper->createAction(getMenuId(), tr("show undo commands"), QIcon("icons:undo.png"),
+ tr("show undo"), tr("show undo commands"),
+ 0, _parent, false, this, SLOT(onShowUndo()));
+
+ _showRedoAct = _wrapper->createAction(getMenuId(), tr("show redo commands"), QIcon("icons:redo.png"),
+ tr("show redo"), tr("show redo commands"),
+ 0, _parent, false, this, SLOT(onShowRedo()));
+
_execModeGroup = new QActionGroup(this);
_execModeGroup->addAction(_withoutStopModeAct);
_execModeGroup->addAction(_breakpointsModeAct);
_execModeGroup->addAction(_stepByStepModeAct);
_withoutStopModeAct->setChecked(true);
-
- /*
- pixmap.load("icons:.png");
- _ = _wrapper->createAction(getMenuId(), tr(""), QIcon(pixmap),
- tr(""), tr(""),
- 0, _parent, false, this, SLOT());
-
- */
-
-
}
void GenericGui::createMenus()
{
int aMenuId;
- aMenuId = _wrapper->createMenu( "File", -1, -1 );
+ aMenuId = _wrapper->createMenu( tr( "File" ), -1, -1 );
_wrapper->createMenu( _wrapper->separator(), aMenuId, -1, 10 );
- aMenuId = _wrapper->createMenu( "YACS" , aMenuId, -1, 10 );
+ aMenuId = _wrapper->createMenu( "YACS", aMenuId, -1, 10 );
_wrapper->createMenu( _newSchemaAct, aMenuId );
_wrapper->createMenu( _importSchemaAct, aMenuId );
- aMenuId = _wrapper->createMenu( tr( "YACS" ), -1, -1, 30 );
+ aMenuId = _wrapper->createMenu( "YACS", -1, -1, 30 );
_wrapper->createMenu( _newSchemaAct, aMenuId );//, 10
_wrapper->createMenu( _importSchemaAct, aMenuId );
_wrapper->createMenu( _importSupervSchemaAct, aMenuId );
_wrapper->createMenu( _runLoadedSchemaAct, aMenuId );
_wrapper->createMenu( _loadRunStateSchemaAct, aMenuId );
_wrapper->createMenu( _loadAndRunSchemaAct, aMenuId );
+ _wrapper->createMenu( _chooseBatchJobAct, aMenuId );
+ _wrapper->createMenu( _wrapper->separator(), aMenuId);
+ _wrapper->createMenu( _undoAct, aMenuId );
+ _wrapper->createMenu( _redoAct, aMenuId );
+ _wrapper->createMenu( _showUndoAct, aMenuId );
+ _wrapper->createMenu( _showRedoAct, aMenuId );
_wrapper->createMenu( _wrapper->separator(), aMenuId);
_wrapper->createMenu( _startResumeAct, aMenuId );
_wrapper->createMenu( _abortAct, aMenuId );
_wrapper->createMenu( _resetAct, aMenuId );
_wrapper->createMenu( _wrapper->separator(), aMenuId);
_wrapper->createMenu( _saveRunStateAct, aMenuId );
- _wrapper->createMenu( _newEditionAct, aMenuId );
+ //_wrapper->createMenu( _newEditionAct, aMenuId );
_wrapper->createMenu( _wrapper->separator(), aMenuId);
_wrapper->createMenu( _withoutStopModeAct, aMenuId );
_wrapper->createMenu( _breakpointsModeAct, aMenuId );
_wrapper->createMenu( _wrapper->separator(), aMenuId);
_wrapper->createMenu( _importCatalogAct, aMenuId );
_wrapper->createMenu( _wrapper->separator(), aMenuId);
+ _wrapper->createMenu( _toggleStraightLinksAct, aMenuId );
+ _wrapper->createMenu( _toggleAutomaticComputeLinkAct, aMenuId );
+ _wrapper->createMenu( _toggleSimplifyLinkAct, aMenuId );
+ _wrapper->createMenu( _toggleForce2NodesLinkAct, aMenuId );
+ _wrapper->createMenu( _toggleAddRowColsAct, aMenuId );
+ _wrapper->createMenu( _wrapper->separator(), aMenuId);
+ _wrapper->createMenu( _showAllLinksAct, aMenuId );
+ _wrapper->createMenu( _hideAllLinksAct, aMenuId );
+ _wrapper->createMenu( _wrapper->separator(), aMenuId);
_wrapper->createMenu( _whatsThisAct, aMenuId );
}
void GenericGui::createTools()
{
- int aToolId = _wrapper->createTool ( tr( "TOOL_YACS" ) );
+ int aToolId = _wrapper->createTool ( tr( "YACS Toolbar" ) );
_wrapper->createTool( _newSchemaAct, aToolId );
_wrapper->createTool( _importSchemaAct, aToolId );
- _wrapper->createTool( _importSupervSchemaAct, aToolId );
_wrapper->createTool( _wrapper->separator(), aToolId );
_wrapper->createTool( _exportSchemaAct, aToolId );
_wrapper->createTool( _exportSchemaAsAct, aToolId );
_wrapper->createTool( _runLoadedSchemaAct, aToolId );
_wrapper->createTool( _loadRunStateSchemaAct, aToolId );
_wrapper->createTool( _loadAndRunSchemaAct, aToolId );
+ _wrapper->createTool( _chooseBatchJobAct, aToolId );
+ _wrapper->createTool( _wrapper->separator(), aToolId );
+ _wrapper->createTool( _undoAct, aToolId );
+ _wrapper->createTool( _redoAct, aToolId );
_wrapper->createTool( _wrapper->separator(), aToolId );
_wrapper->createTool( _startResumeAct, aToolId );
_wrapper->createTool( _abortAct, aToolId );
_wrapper->createTool( _pauseAct, aToolId );
_wrapper->createTool( _resetAct, aToolId );
_wrapper->createTool( _wrapper->separator(), aToolId );
- _wrapper->createTool( _wrapper->separator(), aToolId );
_wrapper->createTool( _saveRunStateAct, aToolId );
- _wrapper->createTool( _newEditionAct, aToolId );
+ //_wrapper->createTool( _newEditionAct, aToolId );
_wrapper->createTool( _withoutStopModeAct, aToolId );
_wrapper->createTool( _breakpointsModeAct, aToolId );
_wrapper->createTool( _stepByStepModeAct, aToolId );
_wrapper->createTool( _wrapper->separator(), aToolId );
_wrapper->createTool( _importCatalogAct, aToolId );
_wrapper->createTool( _wrapper->separator(), aToolId );
+ _wrapper->createTool( _toggleStraightLinksAct, aToolId );
+ _wrapper->createTool( _toggleAutomaticComputeLinkAct, aToolId );
+ _wrapper->createTool( _toggleSimplifyLinkAct, aToolId );
+ //_wrapper->createTool( _toggleForce2NodesLinkAct, aToolId );
+ _wrapper->createTool( _toggleAddRowColsAct, aToolId );
+ _wrapper->createTool( _wrapper->separator(), aToolId );
+ _wrapper->createTool( _showAllLinksAct, aToolId );
+ _wrapper->createTool( _hideAllLinksAct, aToolId );
+ _wrapper->createTool( _wrapper->separator(), aToolId );
_wrapper->createTool( _whatsThisAct, aToolId );
}
void GenericGui::initialMenus()
{
- showBaseMenus(true);
showEditionMenus(false);
showExecMenus(false);
+ showCommonMenus(false);
+ showBaseMenus(true);
}
void GenericGui::showBaseMenus(bool show)
_wrapper->setMenuShown(_importSchemaAct, show);
_wrapper->setToolShown(_importSchemaAct, show);
_wrapper->setMenuShown(_importSupervSchemaAct, show);
- _wrapper->setToolShown(_importSupervSchemaAct, show);
_wrapper->setMenuShown(_loadAndRunSchemaAct, show);
_wrapper->setToolShown(_loadAndRunSchemaAct, show);
+ _wrapper->setMenuShown(_chooseBatchJobAct, show);
+ _wrapper->setToolShown(_chooseBatchJobAct, show);
_wrapper->setMenuShown(_whatsThisAct, show);
_wrapper->setToolShown(_whatsThisAct, show);
}
_wrapper->setToolShown(_loadRunStateSchemaAct, show);
_wrapper->setMenuShown(_loadRunStateSchemaAct, show);
_wrapper->setToolShown(_runLoadedSchemaAct, show);
+ _wrapper->setMenuShown(_undoAct, show);
+ _wrapper->setToolShown(_undoAct, show);
+ _wrapper->setMenuShown(_redoAct, show);
+ _wrapper->setToolShown(_redoAct, show);
+ _wrapper->setMenuShown(_showUndoAct, show);
+ _wrapper->setMenuShown(_showRedoAct, show);
_wrapper->setMenuShown(_importCatalogAct, show);
_wrapper->setToolShown(_importCatalogAct, show);
}
_wrapper->setToolShown(_resetAct, show);
_wrapper->setMenuShown(_saveRunStateAct, show);
_wrapper->setToolShown(_saveRunStateAct, show);
- _wrapper->setMenuShown(_newEditionAct, show);
- _wrapper->setToolShown(_newEditionAct, show);
+ //_wrapper->setMenuShown(_newEditionAct, show);
+ //_wrapper->setToolShown(_newEditionAct, show);
_wrapper->setMenuShown(_withoutStopModeAct, show);
_wrapper->setToolShown(_withoutStopModeAct, show);
_wrapper->setMenuShown(_breakpointsModeAct, show);
_wrapper->setToolShown(_toggleStopOnErrorAct, show);
}
+void GenericGui::showCommonMenus(bool show)
+{
+ DEBTRACE("GenericGui::showCommonMenus " << show);
+ _wrapper->setMenuShown(_toggleStraightLinksAct, show);
+ _wrapper->setToolShown(_toggleStraightLinksAct, show);
+ _wrapper->setMenuShown(_toggleAutomaticComputeLinkAct, show);
+ _wrapper->setToolShown(_toggleAutomaticComputeLinkAct, show);
+ _wrapper->setMenuShown(_toggleSimplifyLinkAct, show);
+ _wrapper->setToolShown(_toggleSimplifyLinkAct, show);
+ _wrapper->setMenuShown(_toggleForce2NodesLinkAct, show);
+ //_wrapper->setToolShown(_toggleForce2NodesLinkAct, show);
+ _wrapper->setMenuShown(_toggleAddRowColsAct, show);
+ _wrapper->setToolShown(_toggleAddRowColsAct, show);
+ _wrapper->setMenuShown(_showAllLinksAct, show);
+ _wrapper->setToolShown(_showAllLinksAct, show);
+ _wrapper->setMenuShown(_hideAllLinksAct, show);
+ _wrapper->setToolShown(_hideAllLinksAct, show);
+}
+
void GenericGui::switchContext(QWidget *view)
{
- DEBTRACE("GenericGui::switchContext");
+ DEBTRACE("GenericGui::switchContext " << view);
if (! _mapViewContext.count(view))
{
initialMenus();
+ _dwTree->setWidget(0);
+ _dwStacked->setWidget(0);
return;
}
QtGuiContext* newContext = _mapViewContext[view];
- QtGuiContext* oldContext = QtGuiContext::getQtCurrent();
_dwTree->setWidget(newContext->getEditTree());
_dwTree->widget()->show();
+ _dwTree->raise();
_dwStacked->setWidget(newContext->getStackedWidget());
QtGuiContext::setQtCurrent(newContext);
if (newContext->isEdition())
{
+ showExecMenus(false);
showBaseMenus(true);
showEditionMenus(true);
- showExecMenus(false);
+ showCommonMenus(true);
if (_dwTree) _dwTree->setWindowTitle("Tree View: edition mode");
}
else
{
- showBaseMenus(true);
showEditionMenus(false);
+ showBaseMenus(true);
showExecMenus(true);
+ showCommonMenus(true);
_withoutStopModeAct->setChecked(true);
if (_dwTree) _dwTree->setWindowTitle("Tree View: execution mode");
}
+ _dwStacked->setMinimumWidth(10);
+}
+
+bool GenericGui::closeContext(QWidget *view, bool onExit)
+{
+ DEBTRACE("GenericGui::closeContext " << onExit);
+ if (! _mapViewContext.count(view))
+ return true;
+ QtGuiContext* context = _mapViewContext[view];
+ switchContext(view);
+
+ bool tryToSave = false;
+
+ if (QtGuiContext::getQtCurrent()->isEdition())
+ {
+ if (!QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
+ {
+ QMessageBox msgBox;
+ msgBox.setText("Some elements are modified and not taken into account.");
+ string info = "do you want to apply your changes ?\n";
+ info += " - Save : do not take into account edition in progress,\n";
+ info += " but if there are other modifications, select a file name for save\n";
+ info += " - Discard : discard all modifications and close the schema";
+ if (!onExit)
+ info += "\n - Cancel : do not close the schema, return to edition";
+ msgBox.setInformativeText(info.c_str());
+ if (!onExit)
+ {
+ msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
+ msgBox.setDefaultButton(QMessageBox::Cancel);
+ }
+ else
+ {
+ msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard);
+ msgBox.setDefaultButton(QMessageBox::Save);
+ }
+ int ret = msgBox.exec();
+ switch (ret)
+ {
+ case QMessageBox::Save:
+ tryToSave = true;
+ break;
+ case QMessageBox::Discard:
+ tryToSave = false;
+ break;
+ case QMessageBox::Cancel:
+ default:
+ DEBTRACE("Cancel or default");
+ return false;
+ break;
+ }
+ }
+ else
+ if (QtGuiContext::getQtCurrent()->isNotSaved())
+ {
+ QMessageBox msgBox;
+ msgBox.setWindowTitle("Close the active schema");
+ msgBox.setText("The schema has been modified");
+ string info = "do you want to save the schema ?\n";
+ info += " - Save : select a file name for save\n";
+ info += " - Discard : discard all modifications and close the schema";
+ if (!onExit)
+ info += "\n - Cancel : do not close the schema, return to edition";
+ msgBox.setInformativeText(info.c_str());
+ if (!onExit)
+ {
+ msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
+ msgBox.setDefaultButton(QMessageBox::Cancel);
+ }
+ else
+ {
+ msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard);
+ msgBox.setDefaultButton(QMessageBox::Save);
+ }
+ int ret = msgBox.exec();
+ switch (ret)
+ {
+ case QMessageBox::Save:
+ tryToSave = true;
+ break;
+ case QMessageBox::Discard:
+ tryToSave = false;
+ break;
+ case QMessageBox::Cancel:
+ DEBTRACE("Cancel or default");
+ default:
+ return false;
+ break;
+ }
+ }
+
+ if (tryToSave)
+ {
+ onExportSchemaAs();
+ if ((!onExit) && (!_isSaved)) // --- probably, user has cancelled the save dialog. Do not close
+ return false;
+ }
+ }
+
+ map<QWidget*, YACS::HMI::QtGuiContext*>::iterator it = _mapViewContext.begin();
+ QtGuiContext* newContext = 0;
+ QWidget* newView = 0;
+ for (; it != _mapViewContext.end(); ++it)
+ {
+ if ((*it).second != context)
+ {
+ newView = (*it).first;
+ newContext = (*it).second;
+ break;
+ }
+ }
+ int studyId = _wrapper->activeStudyId();
+ if (context->getStudyId() == studyId)
+ {
+ _wrapper->deleteSchema(view);
+ DEBTRACE("delete context");
+ if (GuiExecutor* exec = context->getGuiExecutor())
+ {
+ exec->closeContext();
+ }
+ delete context;
+ _mapViewContext.erase(view);
+ switchContext(newView);
+ }
+ return true;
}
void GenericGui::showDockWidgets(bool isVisible)
{
DEBTRACE("GenericGui::showDockWidgets " << isVisible);
if (_dwTree) _dwTree->setVisible(isVisible);
+ if (_dwTree) _dwTree->toggleViewAction()->setVisible(isVisible);
if (_dwStacked) _dwStacked->setVisible(isVisible);
+ if (_dwStacked) _dwStacked->toggleViewAction()->setVisible(isVisible);
if (_dwCatalogs) _dwCatalogs->setVisible(isVisible);
+ if (_dwCatalogs) _dwCatalogs->toggleViewAction()->setVisible(isVisible);
}
void GenericGui::raiseStacked()
Engines::ResourcesManager_var resManager = Engines::ResourcesManager::_narrow(obj);
if(!resManager) return _machineList;
- Engines::CompoList compoList ;
- Engines::MachineParameters params;
+ Engines::ResourceParameters params;
lcc.preSet(params);
- Engines::MachineList* machineList =
- resManager->GetFittingResources(params, compoList);
+ Engines::ResourceList* resourceList =
+ resManager->GetFittingResources(params);
- for (int i = 0; i < machineList->length(); i++)
- {
- const char* aMachine = (*machineList)[i];
- _machineList.push_back(aMachine);
- }
+ for (int i = 0; i < resourceList->length(); i++)
+ {
+ const char* aResource = (*resourceList)[i];
+ _machineList.push_back(aResource);
+ }
return _machineList;
}
clock_t end_t;
start_t = clock();
+
+ QWidget* central = _parent->centralWidget();
+ if (central)
+ central->setFocus();
+ else
+ DEBTRACE("No Central Widget");
+
QString fileName;
QWidget* refWindow = 0; // --- used only on run to refer to the schema in edition
if (forEdition)
context->setEdition(forEdition);
context->setSessionCatalog(_sessionCatalog);
context->setFileName(fileName);
- context->setCurrentCatalog(YACS::ENGINE::getSALOMERuntime()->loadCatalog("proc", fileName.toStdString()));
+ context->setCurrentCatalog(_builtinCatalog);
// --- scene, viewWindow & GraphicsView
gView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
int studyId = _wrapper->AssociateViewToWindow(gView, viewWindow);
context->setStudyId(studyId);
+ std::ostringstream value;
+ value << studyId;
+ proc->setProperty("DefaultStudyID",value.str());
context->setScene(scene);
context->setView(gView);
context->setWindow(viewWindow);
context->setEditTree(editTree);
editTree->tv_schema->setModel(schemaModel);
context->setSelectionModel(editTree->tv_schema->selectionModel());
+ _dwTree->raise();
QObject::connect(editTree->tv_schema->selectionModel(),
SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
end_t = clock();
double passe = (end_t -start_t);
passe = passe/CLOCKS_PER_SEC;
- cerr <<"create context -1- : " << passe << endl;
+ DEBTRACE("create context -1- : " << passe);
start_t = end_t;
}
end_t = clock();
double passe = (end_t -start_t);
passe = passe/CLOCKS_PER_SEC;
- cerr <<"create context - load proc- : " << passe << endl;
+ DEBTRACE("create context - load proc- : " << passe);
start_t = end_t;
}
// --- adjust widgets
TreeView *vtree = dynamic_cast<TreeView*>(editTree->tv_schema);
- assert(vtree);
+ YASSERT(vtree);
vtree->resizeColumns();
- _catalogsWidget->setMinimumWidth(40); // --- reset the constraint on width
+ _catalogsWidget->setMinimumWidth(10); // --- reset the constraint on width
editTree->setMinimumHeight(40);
+ _dwStacked->setMinimumWidth(10);
// --- show menus
if (forEdition)
{
- showEditionMenus(true);
showExecMenus(false);
+ showEditionMenus(true);
+ showCommonMenus(true);
if (_dwTree) _dwTree->setWindowTitle("Tree View: edition mode");
}
else
{
showEditionMenus(false);
showExecMenus(true);
+ showCommonMenus(true);
_withoutStopModeAct->setChecked(true);
if (_dwTree) _dwTree->setWindowTitle("Tree View: execution mode");
}
+
+ QtGuiContext::getQtCurrent()->setNotSaved(false);
+ {
+ end_t = clock();
+ double passe = (end_t -start_t);
+ passe = passe/CLOCKS_PER_SEC;
+ DEBTRACE("create context - end - : " << passe);
+ start_t = end_t;
+ }
}
// -----------------------------------------------------------------------------
void GenericGui::setLoadedPresentation(YACS::ENGINE::Proc* proc)
{
+ DEBTRACE("GenericGui::setLoadedPresentation");
+ QtGuiContext::getQtCurrent()->setLoadingPresentation(true);
map<YACS::ENGINE::Node*, PrsData> presNodes = _loader->getPrsData(proc);
if (!presNodes.empty())
{
PrsData pres = (*it).second;
SubjectNode *snode = QtGuiContext::getQtCurrent()->_mapOfSubjectNode[node];
SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[snode];
- assert(item);
- item->setPos(QPointF(pres._x, pres._y));
- item->setWidth(pres._width);
- item->setHeight(pres._height);
+ YASSERT(item);
+ SceneNodeItem *inode = dynamic_cast<SceneNodeItem*>(item);
+ YASSERT(inode);
+ inode->setPos(QPointF(pres._x, pres._y));
+ inode->setWidth(pres._width);
+ inode->setHeight(pres._height);
+ inode->setExpanded(pres._expanded);
+ inode->setExpandedPos(QPointF(pres._expx, pres._expy));
+ inode->setExpandedWH(pres._expWidth, pres._expHeight);
+ inode->setShownState(shownState(pres._shownState));
}
- _guiEditor->rebuildLinks();
}
+ if (Scene::_autoComputeLinks)
+ _guiEditor->rebuildLinks();
+ else
+ {
+ YACS::HMI::SubjectProc* subproc = QtGuiContext::getQtCurrent()->getSubjectProc();
+ SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[subproc];
+ SceneComposedNodeItem *proc = dynamic_cast<SceneComposedNodeItem*>(item);
+ proc->updateLinks();
+ }
+
+ QtGuiContext::getQtCurrent()->setLoadingPresentation(false);
}
// -----------------------------------------------------------------------------
YACS::ENGINE::RuntimeSALOME* runTime = YACS::ENGINE::getSALOMERuntime();
YACS::ENGINE::Proc *proc = runTime->createProc(name.str());
+ _loader->reset();
+
QString fileName = name.str().c_str();
createContext(proc, fileName, "", true);
}
+void GenericGui::loadSchema(const std::string& filename,bool edit, bool arrangeLocalNodes)
+{
+ YACS::ENGINE::Proc *proc = _loader->load(filename.c_str());
+ if (!proc)
+ return;
+ YACS::ENGINE::Logger* logger= proc->getLogger("parser");
+ if(!logger->isEmpty())
+ {
+ DEBTRACE(logger->getStr());
+ }
+ QString fn=QString::fromStdString(filename);
+ if(edit)
+ createContext(proc, fn, "", true);
+ else
+ createContext(proc, fn, fn, false);
+ if (arrangeLocalNodes)
+ {
+ _guiEditor->arrangeProc();
+ }
+}
+
void GenericGui::onImportSchema()
{
+ clock_t start_t;
+ clock_t end_t;
+ start_t = clock();
DEBTRACE("GenericGui::onImportSchema");
- QString fn = QFileDialog::getOpenFileName( _parent,
- "Choose a filename to load" ,
- QString::null,
- tr( "XML-Files (*.xml);;All Files (*)" ));
+ QFileDialog dialog(_parent,
+ "Choose a filename to load" ,
+ QString::null,
+ tr( "XML-Files (*.xml);;All Files (*)" ));
+
+ dialog.setHistory(_wrapper->getQuickDirList());
+
+ QString fn;
+ QStringList fileNames;
+ if (dialog.exec())
+ {
+ fileNames = dialog.selectedFiles();
+ if (!fileNames.isEmpty())
+ fn = fileNames.first();
+ }
+
if ( !fn.isEmpty() )
{
+ // add ".xml" suffix
+ QFileInfo fi(fn);
+ if (!fi.exists() && fi.suffix() != "xml")
+ fn += ".xml";
+
DEBTRACE("file loaded : " <<fn.toStdString());
- YACS::ENGINE::Proc *proc = _loader->load(fn.toLatin1());
+ YACS::ENGINE::Proc *proc = 0;
+
+ try {
+ proc = _loader->load(fn.toLatin1());
+ }
+ catch (...) {
+ }
+
+ {
+ end_t = clock();
+ double passe = (end_t -start_t);
+ passe = passe/CLOCKS_PER_SEC;
+ DEBTRACE("load xml file : " << passe);
+ start_t = end_t;
+ }
+
if (!proc)
{
QMessageBox msgBox(QMessageBox::Critical,
void GenericGui::onImportSupervSchema()
{
DEBTRACE("GenericGui::onImportSupervSchema");
- QString fn = QFileDialog::getOpenFileName( _parent,
- "Choose a SUPERV filename to load" ,
- QString::null,
- tr( "XML-Files (*.xml);;All Files (*)" ));
+ QFileDialog dialog(_parent,
+ "Choose a SUPERV filename to load" ,
+ QString::null,
+ tr( "XML-Files (*.xml);;All Files (*)" ));
+
+ dialog.setHistory(_wrapper->getQuickDirList());
+
+ QString fn;
+ QStringList fileNames;
+ if (dialog.exec())
+ {
+ fileNames = dialog.selectedFiles();
+ if (!fileNames.isEmpty())
+ fn = fileNames.first();
+ }
+
if (fn.isEmpty()) return;
+ // add ".xml" suffix
+ QFileInfo fi(fn);
+ if (!fi.exists() && fi.suffix() != "xml")
+ fn += ".xml";
+
DEBTRACE("file loaded : " <<fn.toStdString());
QString tmpFileName;
try
{
+#ifdef WNT
+ QString tmpDir = getenv("TEMP");
+ QString fileExt = "bat";
+#else
QString tmpDir = "/tmp";
+ QString fileExt = "sh";
+#endif
QDir aTmpDir(tmpDir);
aTmpDir.mkdir(QString("YACS_") + getenv("USER"));
- assert(aTmpDir.cd(QString("YACS_") + getenv("USER")));
+ YASSERT(aTmpDir.cd(QString("YACS_") + getenv("USER")));
QDateTime curTime = QDateTime::currentDateTime();
tmpFileName = "SUPERV_import_" + curTime.toString("yyyyMMdd_hhmmss") + ".xml";
QString tmpOutput = "salomeloader_output";
tmpFileName = aTmpDir.absoluteFilePath(tmpFileName);
DEBTRACE(tmpFileName.toStdString());
- QString aCall = "salomeloader.sh " + fn + " " + tmpFileName + " > " + tmpOutput;
+ QString aCall = "salomeloader."+ fileExt+ " "+ fn + " " + tmpFileName + " > " + tmpOutput;
DEBTRACE(aCall.toStdString());
int ret = system(aCall.toAscii());
if (!fileNames.isEmpty())
selectedFile = fileNames.first();
}
- return selectedFile;
+ QString filteredName = _guiEditor->asciiFilter(selectedFile);
+ DEBTRACE(filteredName.toStdString());
+ return filteredName;
}
void GenericGui::onExportSchema()
if (fn.isEmpty()) return;
DEBTRACE("GenericGui::onExportSchema: " << fn.toStdString());
+ //to be sure that all pending changes are effective
+ _parent->setFocus();
QtGuiContext::getQtCurrent()->setFileName(fn);
VisitorSaveGuiSchema aWriter(proc);
aWriter.openFileSchema( fn.toStdString() );
aWriter.visitProc();
aWriter.closeFileSchema();
+ QtGuiContext::getQtCurrent()->setNotSaved(false);
if (fn.compare(foo) && _wrapper)
_wrapper->renameSchema(foo, fn, QtGuiContext::getQtCurrent()->getWindow());
void GenericGui::onExportSchemaAs()
{
DEBTRACE("GenericGui::onExportSchemaAs");
+ _isSaved = false;
if (!QtGuiContext::getQtCurrent()) return;
YACS::ENGINE::Proc* proc = QtGuiContext::getQtCurrent()->getProc();
QString fo = QtGuiContext::getQtCurrent()->getFileName();
QString foo = fo;
- if (fo.startsWith("newShema_")) fo.clear();
+ if (fo.startsWith("newSchema_")) fo.clear();
QString fn = getSaveFileName(fo);
if (fn.isEmpty()) return;
aWriter.openFileSchema(fn.toStdString());
aWriter.visitProc();
aWriter.closeFileSchema();
+ _isSaved = true;
+ QtGuiContext::getQtCurrent()->setNotSaved(false);
if (fn.compare(foo) && _wrapper)
_wrapper->renameSchema(foo, fn, QtGuiContext::getQtCurrent()->getWindow());
void GenericGui::onImportCatalog()
{
DEBTRACE("GenericGui::onImportCatalog");
- QString fn = QFileDialog::getOpenFileName( _parent,
- "Choose a YACS Schema to load as a Catalog" ,
- QString::null,
- tr( "XML-Files (*.xml);;All Files (*)" ));
+ QFileDialog dialog(_parent,
+ "Choose a YACS Schema to load as a Catalog" ,
+ QString::null,
+ tr( "XML-Files (*.xml);;All Files (*)" ));
+
+ dialog.setHistory(_wrapper->getQuickDirList());
+
+ QString fn;
+ QStringList fileNames;
+ if (dialog.exec())
+ {
+ fileNames = dialog.selectedFiles();
+ if (!fileNames.isEmpty())
+ fn = fileNames.first();
+ }
+
if ( !fn.isEmpty() )
_catalogsWidget->addCatalogFromFile(fn.toStdString());
}
{
DEBTRACE(ex.what());
QtGuiContext::getQtCurrent()->getSubjectProc()->select(true);
+ return;
}
if (info.areWarningsOrErrors()) return;
QFileInfo fo = QtGuiContext::getQtCurrent()->getFileName();
QString procName = fo.baseName();
//QString tmpDir = SALOMEDS_Tool::GetTmpDir().c_str();
+#ifdef WNT
+ QString tmpDir = getenv("TEMP");
+#else
QString tmpDir = "/tmp";
+#endif
QDir aTmpDir(tmpDir);
aTmpDir.mkdir(QString("YACS_") + getenv("USER"));
- assert(aTmpDir.cd(QString("YACS_") + getenv("USER")));
+ YASSERT(aTmpDir.cd(QString("YACS_") + getenv("USER")));
QDateTime curTime = QDateTime::currentDateTime();
QString aRunName = procName + "_" + curTime.toString("yyyyMMdd_hhmmss") + ".xml";
aRunName = aTmpDir.absoluteFilePath(aRunName);
}
}
executor->startResumeDataflow(true); // --- initialise gui state
+ if(_toggleStopOnErrorAct->isChecked())
+ executor->setStopOnError(false);
}
void GenericGui::onLoadRunStateSchema()
tr( "XML-Files (*.xml);;All Files (*)" ));
if ( !fn.isEmpty() )
{
- DEBTRACE("***************************************************************************");
+ // add ".xml" suffix
+ QFileInfo fi(fn);
+ if (!fi.exists() && fi.suffix() != "xml")
+ fn += ".xml";
+
DEBTRACE("file loaded : " <<fn.toStdString());
- DEBTRACE("***************************************************************************");
- YACS::ENGINE::Proc *proc = _loader->load(fn.toLatin1());
+ YACS::ENGINE::Proc *proc =0;
+
+ try {
+ proc = _loader->load(fn.toLatin1());
+ }
+ catch (...) {
+ }
+
+ if (!proc)
+ {
+ QMessageBox msgBox(QMessageBox::Critical,
+ "Import YACS Schema, native YACS XML format",
+ "The file has not the native YACS XML format or is not readable.");
+ msgBox.exec();
+ return;
+ }
YACS::ENGINE::Logger* logger= proc->getLogger("parser");
if(!logger->isEmpty())
{
DEBTRACE(logger->getStr());
}
- createContext(proc, fn, fn, false);
+ createContext(proc, fn, "", true);
+ onRunLoadedSchema();
}
+}
+
+void GenericGui::onChooseBatchJob() {
+ DEBTRACE("GenericGui::onChooseBatchJob");
+
+ // Show the Batch Jobs list
+ if(_BJLdialog) delete _BJLdialog;
+ _BJLdialog = new BatchJobsListDialog(tr("Select one Batch Job to watch"),this);
+ _BJLdialog->show();
+ _BJLdialog->move(300,200);
+ _BJLdialog->resize(450,200);
}
void GenericGui::onNewEdition()
{
DEBTRACE("GenericGui::onNewEdition");
-// if (!QtGuiContext::getQtCurrent()) return;
-// if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
-// QtGuiContext::getQtCurrent()->getGuiExecutor()->resetDataflow();
+ // if (!QtGuiContext::getQtCurrent()) return;
+ // if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
+ // QtGuiContext::getQtCurrent()->getGuiExecutor()->resetDataflow();
}
void GenericGui::onGetYacsContainerLog()
if (!QtGuiContext::getQtCurrent()) return;
if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
string log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getContainerLog();
- LogViewer *lv = new LogViewer("YACS Container Log", _parent);
+ ContainerLogViewer *lv = new ContainerLogViewer("YACS Container Log", _parent);
lv->readFile(log);
lv->show();
}
{
DEBTRACE("GenericGui::onGetErrorReport");
if (!QtGuiContext::getQtCurrent()) return;
- if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
- SubjectElementaryNode *snode = dynamic_cast<SubjectElementaryNode*>(sub);
+ SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
if (!snode) return;
- string log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getErrorReport(snode->getNode());
+ string log;
+ if (QtGuiContext::getQtCurrent()->getGuiExecutor())
+ {
+ log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getErrorReport(snode->getNode());
+ }
+ else
+ {
+ log = snode->getNode()->getErrorReport();
+ }
+
LogViewer *lv = new LogViewer("Node error report", _parent);
lv->setText(log);
lv->show();
{
DEBTRACE("GenericGui::onGetErrorDetails");
if (!QtGuiContext::getQtCurrent()) return;
- if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
- SubjectElementaryNode *snode = dynamic_cast<SubjectElementaryNode*>(sub);
+ SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
if (!snode) return;
- string log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getErrorDetails(snode->getNode());
+ string log;
+ if (QtGuiContext::getQtCurrent()->getGuiExecutor())
+ {
+ log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getErrorDetails(snode->getNode());
+ }
+ else
+ {
+ log = snode->getNode()->getErrorDetails();
+ }
+
LogViewer *lv = new LogViewer("Node Error Details", _parent);
lv->setText(log);
lv->show();
SubjectElementaryNode *snode = dynamic_cast<SubjectElementaryNode*>(sub);
if (!snode) return;
string log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getContainerLog(snode->getNode());
+
LogViewer *lv = new LogViewer("Node Container Log", _parent);
- lv->readFile(log);
+ if (log.empty())
+ {
+ string info = "\n";
+ if (dynamic_cast<YACS::ENGINE::ServiceNode*>(snode->getNode()))
+ {
+ info +="The container log of this node\n";
+ info += "is not stored in a file and \n";
+ info += "can't be displayed here, \n";
+ info += "but you can have a look at \n";
+ info += "the SALOME standard output,\n";
+ info += "on your terminal...";
+ }
+ else
+ {
+ info += "See YACS Container log \n";
+ info += "(on main proc menu) \n";
+ info += "for all inline nodes";
+ }
+ lv->setText(info);
+ }
+ else
+ lv->readFile(log);
lv->show();
}
-
+void GenericGui::onShutdownProc()
+{
+ DEBTRACE("GenericGui::onShutdownProc");
+ if (!QtGuiContext::getQtCurrent()) return;
+ if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
+ QtGuiContext::getQtCurrent()->getGuiExecutor()->shutdownProc();
+}
void GenericGui::onEditDataTypes()
{
if (_dwCatalogs) _dwCatalogs->raise();
}
+void GenericGui::onSelectComponentInstance()
+{
+ DEBTRACE("GenericGui::onSelectComponentInstance");
+ Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
+ if (!sub) return;
+ SubjectComponent *ref = dynamic_cast<SubjectComponent*>(sub);
+ YASSERT(ref);
+ YACS::ENGINE::ComponentInstance* compo=ref->getComponent();
+ QtGuiContext::getQtCurrent()->_mapOfLastComponentInstance[compo->getCompoName()]=compo;
+}
void GenericGui::onNewContainer()
{
void GenericGui::onNewSalomeComponent()
{
DEBTRACE("GenericGui::onNewSalomeComponent");
+ _guiEditor->CreateComponentInstance();
}
void GenericGui::onNewSalomePythonComponent()
void GenericGui::onFOREACHNode()
{
DEBTRACE("GenericGui::onFOREACHNode");
- _guiEditor->CreateForEachLoop();
+ createForEachLoop("double");
+}
+
+void GenericGui::createForEachLoop(std::string type)
+{
+ DEBTRACE("GenericGui::createForEachLoop");
+ _guiEditor->CreateForEachLoop(type);
}
void GenericGui::onWHILENode()
_guiEditor->CreateSwitch();
}
+void GenericGui::onOptimizerLoop()
+{
+ DEBTRACE("GenericGui::onOptimizerLoop");
+ _guiEditor->CreateOptimizerLoop();
+}
+
void GenericGui::onNodeFromCatalog()
{
DEBTRACE("GenericGui::onNodeFromCatalog");
_guiEditor->PasteSubject();
}
+void GenericGui::onPutInBloc()
+{
+ _guiEditor->PutSubjectInBloc();
+}
+
void GenericGui::onArrangeLocalNodes()
{
DEBTRACE("GenericGui::onArrangeLocalNodes");
_guiEditor->rebuildLinks();
}
+void GenericGui::onZoomToBloc()
+{
+ DEBTRACE("GenericGui::onZoomToBloc");
+ QtGuiContext::getQtCurrent()->getView()->onZoomToBloc();
+}
+
+void GenericGui::onCenterOnNode()
+{
+ DEBTRACE("GenericGui::onCenterOnNode");
+ QtGuiContext::getQtCurrent()->getView()->onCenterOnNode();
+}
+
+void GenericGui::onShrinkExpand() {
+ DEBTRACE("GenericGui::onShrinkExpand");
+ _guiEditor->shrinkExpand();
+}
+
+void GenericGui::onToggleStraightLinks(bool checked)
+{
+ Scene::_straightLinks = checked;
+ DEBTRACE("Scene::_straightLinks=" << checked);
+ if (!QtGuiContext::getQtCurrent())
+ return;
+ map<Subject*, SchemaItem*>::const_iterator it = QtGuiContext::getQtCurrent()->_mapOfSchemaItem.begin();
+ for( ; it != QtGuiContext::getQtCurrent()->_mapOfSchemaItem.end(); ++it)
+ {
+ Subject* sub = (*it).first;
+ sub->update(SWITCHSHAPE, 0, 0);
+ }
+}
+
void GenericGui::onToggleAutomaticComputeLinks(bool checked)
{
Scene::_autoComputeLinks = checked;
DEBTRACE("Scene::_force2NodesLink=" << checked);
}
+void GenericGui::onToggleAddRowCols(bool checked)
+{
+ Scene::_addRowCols = checked;
+ DEBTRACE("Scene::_addRowCols=" << checked);
+}
+
void GenericGui::onSelectReference()
{
Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
if (!sub) return;
SubjectReference *ref = dynamic_cast<SubjectReference*>(sub);
- assert(ref);
+ YASSERT(ref);
SubjectServiceNode *snode = dynamic_cast<SubjectServiceNode*>(ref->getReference());
snode->select(true);
}
DEBTRACE("GenericGui::onToggleStopOnError " << checked);
if (!QtGuiContext::getQtCurrent()) return;
if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
+ if(checked)
+ QtGuiContext::getQtCurrent()->getGuiExecutor()->setStopOnError(false);
+ else
+ QtGuiContext::getQtCurrent()->getGuiExecutor()->unsetStopOnError();
}
void GenericGui::onToggleSceneItemVisible(bool checked)
item->setVisible(checked);
}
+void GenericGui::displayLinks(bool isShown)
+{
+ if (!QtGuiContext::getQtCurrent()) return;
+ map<pair<YACS::ENGINE::OutPort*, YACS::ENGINE::InPort*>,YACS::HMI::SubjectLink*>::const_iterator it;
+ for (it = QtGuiContext::getQtCurrent()->_mapOfSubjectLink.begin();
+ it != QtGuiContext::getQtCurrent()->_mapOfSubjectLink.end();
+ ++it)
+ {
+ YACS::HMI::SubjectLink* sub = (*it).second;
+ if (!sub) continue;
+ SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
+ item->setVisible(isShown);
+ }
+}
+
+void GenericGui::displayControlLinks(bool isShown)
+{
+ if (!QtGuiContext::getQtCurrent()) return;
+ map<pair<YACS::ENGINE::Node*, YACS::ENGINE::Node*>,YACS::HMI::SubjectControlLink*>::const_iterator it;
+ for (it = QtGuiContext::getQtCurrent()->_mapOfSubjectControlLink.begin();
+ it != QtGuiContext::getQtCurrent()->_mapOfSubjectControlLink.end();
+ ++it)
+ {
+ YACS::HMI::SubjectControlLink* sub = (*it).second;
+ if (!sub) continue;
+ SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
+ item->setVisible(isShown);
+ }
+}
+
+void GenericGui::displayPortLinks(bool isShown)
+{
+ Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
+ DEBTRACE("displayPortLinks, subject : " << sub->getName());
+ SubjectDataPort *sport = dynamic_cast<SubjectDataPort*>(sub);
+ if (sport)
+ {
+ DEBTRACE("dataPort : " << sport->getName());
+ list<SubjectLink*> linkList = sport->getListOfSubjectLink();
+ list<SubjectLink*>::const_iterator it = linkList.begin();
+ for( ; it != linkList.end(); ++it)
+ {
+ YACS::HMI::SubjectLink* sub = (*it);
+ if (!sub) continue;
+ SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
+ item->setVisible(isShown);
+ }
+ return;
+ }
+ SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
+ if (snode)
+ {
+ DEBTRACE("Node : " << snode->getName());
+ list<SubjectControlLink*> linkList = snode->getSubjectControlLinks();
+ list<SubjectControlLink*>::const_iterator it = linkList.begin();
+ for( ; it != linkList.end(); ++it)
+ {
+ YACS::HMI::SubjectControlLink* sub = (*it);
+ if (!sub) continue;
+ SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
+ item->setVisible(isShown);
+ }
+ return;
+ }
+}
+
+void GenericGui::displayALink(bool isShown)
+{
+ Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
+ if (! QtGuiContext::getQtCurrent()->_mapOfSceneItem.count(sub)) return;
+ SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
+ item->setVisible(isShown);
+}
+
+void GenericGui::onShowAllLinks()
+{
+ DEBTRACE("GenericGui::onShowAllLinks");
+ displayLinks(true);
+ displayControlLinks(true);
+}
+
+void GenericGui::onHideAllLinks()
+{
+ DEBTRACE("GenericGui::onHideAllLinks");
+ displayLinks(false);
+ displayControlLinks(false);
+}
+
+void GenericGui::onShowOnlyPortLinks()
+{
+ DEBTRACE("GenericGui::onShowOnlyPortLinks");
+ onHideAllLinks();
+ displayPortLinks(true);
+}
+
+void GenericGui::onShowPortLinks()
+{
+ DEBTRACE("GenericGui::onShowPortLinks");
+ displayPortLinks(true);
+}
+
+void GenericGui::onHidePortLinks()
+{
+ DEBTRACE("GenericGui::onHidePortLinks");
+ displayPortLinks(false);
+}
+
+void GenericGui::onEmphasisPortLinks()
+{
+ DEBTRACE("GenericGui::onEmphasisPortLinks");
+ if (!QtGuiContext::getQtCurrent()) return;
+ Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
+ DEBTRACE("EmphasizePortLinks, subject : " << sub->getName());
+ if (!sub)
+ return;
+
+ SubjectDataPort *sport = dynamic_cast<SubjectDataPort*>(sub);
+ if (sport)
+ {
+ emphasizePortLink(sport, true);
+ return;
+ }
+
+ // --- if a Node, explore all data ports
+
+ SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
+ if (snode)
+ {
+ DEBTRACE("Node : " << snode->getName());
+ {
+ list<SubjectInputPort*> linkList = snode->getSubjectInputPorts();
+ list<SubjectInputPort*>::const_iterator it = linkList.begin();
+ for( ; it != linkList.end(); ++it)
+ {
+ YACS::HMI::SubjectInputPort* sub = (*it);
+ if (!sub) continue;
+ emphasizePortLink(sub, true);
+ }
+ }
+ {
+ list<SubjectOutputPort*> linkList = snode->getSubjectOutputPorts();
+ list<SubjectOutputPort*>::const_iterator it = linkList.begin();
+ for( ; it != linkList.end(); ++it)
+ {
+ YACS::HMI::SubjectOutputPort* sub = (*it);
+ if (!sub) continue;
+ emphasizePortLink(sub, true);
+ }
+ }
+ return;
+ }
+}
+
+void GenericGui::onShowOnlyCtrlLinks()
+{
+ DEBTRACE("GenericGui::onShowOnlyCtrlLinks");
+ onHideAllLinks();
+ displayPortLinks(true);
+}
+
+void GenericGui::onShowCtrlLinks()
+{
+ DEBTRACE("GenericGui::onShowCtrlLinks");
+ displayPortLinks(true);
+}
+
+void GenericGui::onHideCtrlLinks()
+{
+ DEBTRACE("GenericGui::onHideCtrlLinks");
+ displayPortLinks(false);
+}
+
+void GenericGui::onEmphasisCtrlLinks()
+{
+ DEBTRACE("GenericGui::onEmphasisCtrlLinks");
+ Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
+ DEBTRACE("Emphasize Ctrl Links, subject : " << sub->getName());
+ if (!sub)
+ return;
+ SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
+ if (snode)
+ {
+ DEBTRACE("Node : " << snode->getName());
+ list<SubjectControlLink*> linkList = snode->getSubjectControlLinks();
+ list<SubjectControlLink*>::const_iterator it = linkList.begin();
+ for( ; it != linkList.end(); ++it)
+ {
+ YACS::HMI::SubjectControlLink* sub = (*it);
+ if (!sub) continue;
+ sub->update(EMPHASIZE, true, sub);
+ Subject *sin = sub->getSubjectInNode();
+ Subject *sout = sub->getSubjectOutNode();
+ sin->update(EMPHASIZE, true, sub);
+ sout->update(EMPHASIZE, true, sub);
+ }
+ return;
+ }
+}
+
+void GenericGui::onShowOnlyLink()
+{
+ DEBTRACE("GenericGui::onShowOnlyLink");
+ onHideAllLinks();
+ displayALink(true);
+}
+
+void GenericGui::onShowLink()
+{
+ DEBTRACE("GenericGui::onShowLink");
+ displayALink(true);
+}
+
+void GenericGui::onHideLink()
+{
+ DEBTRACE("GenericGui::onHideLink");
+ displayALink(false);
+}
+
+void GenericGui::onEmphasisLink()
+{
+ DEBTRACE("GenericGui::onEmphasisLink");
+ Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
+ if (!sub)
+ return;
+ sub->update(EMPHASIZE, true, sub);
+}
+
+void GenericGui::onDeEmphasizeAll()
+{
+ DEBTRACE("GenericGui::onDeEmphasizeAll");
+ map<Subject*, SchemaItem*>::const_iterator it = QtGuiContext::getQtCurrent()->_mapOfSchemaItem.begin();
+ for( ; it != QtGuiContext::getQtCurrent()->_mapOfSchemaItem.end(); ++it)
+ {
+ Subject* sub = (*it).first;
+ sub->update(EMPHASIZE, false, sub);
+ }
+}
+
+void GenericGui::onUndo()
+{
+ DEBTRACE("GenericGui::onUndo");
+ if (QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
+ QtGuiContext::getQtCurrent()->getInvoc()->undo();
+ else Message("undo not possible when there are local modifications not confirmed");
+}
+
+void GenericGui::onRedo()
+{
+ DEBTRACE("GenericGui::onRedo");
+ if (QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
+ QtGuiContext::getQtCurrent()->getInvoc()->redo();
+ else Message("redo not possible when there are local modifications not confirmed");
+}
+
+void GenericGui::onShowUndo()
+{
+ _guiEditor->showUndo(_parent);
+}
+
+void GenericGui::onShowRedo()
+{
+ _guiEditor->showRedo(_parent);
+}
+
void GenericGui::onCleanOnExit()
{
DEBTRACE("GenericGui::onCleanOnExit");
int studyId = _wrapper->activeStudyId();
- set<QtGuiContext*> setcpy = QtGuiContext::_setOfContext;
- set<QtGuiContext*>::iterator it = setcpy.begin();
- for ( ; it != setcpy.end(); ++it)
- if ((*it)->getStudyId() == studyId)
- {
- QtGuiContext::setQtCurrent(*it);
- delete(*it);
- }
+ map<QWidget*, YACS::HMI::QtGuiContext*> mapViewContextCopy = _mapViewContext;
+ map<QWidget*, YACS::HMI::QtGuiContext*>::iterator it = mapViewContextCopy.begin();
+ for (; it != mapViewContextCopy.end(); ++it)
+ {
+ closeContext((*it).first, true);
+ }
+}
+
+void GenericGui::emphasizePortLink(YACS::HMI::SubjectDataPort* sub, bool emphasize)
+{
+ DEBTRACE("dataPort : " << sub->getName());
+ list<SubjectLink*> linkList = sub->getListOfSubjectLink();
+ list<SubjectLink*>::const_iterator it = linkList.begin();
+ for( ; it != linkList.end(); ++it)
+ {
+ YACS::HMI::SubjectLink* subli = (*it);
+ if (!subli) continue;
+ subli->update(EMPHASIZE, emphasize, sub);
+ Subject *sin = subli->getSubjectInPort();
+ Subject *sout = subli->getSubjectOutPort();
+ sin->update(EMPHASIZE, emphasize, sub);
+ sout->update(EMPHASIZE, emphasize, sub);
+ }
+}
+
+void GenericGui::onHelpContextModule( const QString& theComponentName, const QString& theFileName, const QString& theContext)
+{
+ _wrapper->onHelpContextModule(theComponentName,theFileName,theContext);
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _GENERICGUI_HXX_
#define _GENERICGUI_HXX_
+#include "GenericGuiExport.hxx"
+
#include <QAction>
#include <QActionGroup>
#include <QObject>
class SuitWrapper;
class CatalogWidget;
class YACSGuiLoader;
+ class SubjectDataPort;
+ class BatchJobsListDialog;
- class GenericGui: public QObject
+ class GENERICGUI_EXPORT GenericGui: public QObject
{
Q_OBJECT
void showBaseMenus(bool show);
void showEditionMenus(bool show);
void showExecMenus(bool show);
+ void showCommonMenus(bool show);
void switchContext(QWidget *view);
+ bool closeContext(QWidget *view, bool onExit = false);
void showDockWidgets(bool isVisible);
void raiseStacked();
CatalogWidget* getCatalogWidget() { return _catalogsWidget; };
std::list<std::string> getMachineList();
+ void createForEachLoop(std::string type="double");
+ virtual void loadSchema(const std::string& filename,bool edit=true, bool arrangeLocalNodes=false);
+ virtual void onHelpContextModule( const QString&, const QString&, const QString& = QString() );
+ void createContext(YACS::ENGINE::Proc* proc,
+ const QString& schemaName,
+ const QString& runName,
+ bool forEdition);
+ YACSGuiLoader *getLoader() { return _loader; };
QAction *_newSchemaAct;
QAction *_importSchemaAct;
+ QAction *_chooseBatchJobAct;
QAction *_importSupervSchemaAct;
QAction *_exportSchemaAct;
QAction *_exportSchemaAsAct;
QAction *_getErrorReportAct;
QAction *_getErrorDetailsAct;
QAction *_getContainerLogAct;
+ QAction *_shutdownProcAct;
QAction *_editDataTypesAct;
QAction *_createDataTypeAct;
QAction *_importDataTypeAct;
QAction *_newContainerAct;
+ QAction *_selectComponentInstanceAct;
QAction *_newSalomeComponentAct;
QAction *_newSalomePythonComponentAct;
QAction *_newCorbaComponentAct;
QAction *_FOREACHNodeAct;
QAction *_WHILENodeAct;
QAction *_SWITCHNodeAct;
+ QAction *_OptimizerLoopAct;
QAction *_nodeFromCatalogAct;
QAction *_deleteItemAct;
QAction *_cutItemAct;
QAction *_copyItemAct;
QAction *_pasteItemAct;
+ QAction *_putInBlocAct;
QAction *_arrangeLocalNodesAct;
QAction *_arrangeRecurseNodesAct;
QAction *_computeLinkAct;
+ QAction *_zoomToBlocAct;
+ QAction *_centerOnNodeAct;
+ QAction *_shrinkExpand;
+
+ QAction *_toggleStraightLinksAct;
QAction *_toggleAutomaticComputeLinkAct;
QAction *_toggleSimplifyLinkAct;
QAction *_toggleForce2NodesLinkAct;
+ QAction *_toggleAddRowColsAct;
QAction *_toggleSceneItemVisibleAct;
QAction *_selectReferenceAct;
QAction *_whatsThisAct;
+ QAction *_showAllLinksAct;
+ QAction *_hideAllLinksAct;
+
+ QAction *_showOnlyPortLinksAct;
+ QAction *_showPortLinksAct;
+ QAction *_hidePortLinksAct;
+ QAction *_emphasisPortLinksAct;
+
+ QAction *_showOnlyCtrlLinksAct;
+ QAction *_showCtrlLinksAct;
+ QAction *_hideCtrlLinksAct;
+ QAction *_emphasisCtrlLinksAct;
+
+ QAction *_showOnlyLinkAct;
+ QAction *_showLinkAct;
+ QAction *_hideLinkAct;
+ QAction *_emphasisLinkAct;
+ QAction *_deEmphasizeAllAct;
+
+ QAction *_undoAct;
+ QAction *_redoAct;
+ QAction *_showUndoAct;
+ QAction *_showRedoAct;
+
YACS::HMI::GuiEditor *_guiEditor;
+ void setLoadedPresentation(YACS::ENGINE::Proc* proc);
public slots:
void onCleanOnExit();
protected:
int getMenuId() { return _menuId++; }
- void createContext(YACS::ENGINE::Proc* proc,
- const QString& schemaName,
- const QString& runName,
- bool forEdition);
- void setLoadedPresentation(YACS::ENGINE::Proc* proc);
QString getSaveFileName(const QString& fileName = QString());
YACSGuiLoader *_loader;
QDockWidget* _dwTree;
QDockWidget* _dwStacked;
QDockWidget* _dwCatalogs;
+ BatchJobsListDialog* _BJLdialog;
YACS::ENGINE::Catalog* _builtinCatalog;
YACS::ENGINE::Catalog* _sessionCatalog;
CatalogWidget* _catalogsWidget;
int _menuId;
int _toolId;
int _schemaCnt;
+ bool _isSaved;
std::list<std::string> _machineList;
private slots:
void onNewSchema();
void onImportSchema();
+ void onChooseBatchJob();
void onImportSupervSchema();
void onExportSchema();
void onExportSchemaAs();
void onGetErrorReport();
void onGetErrorDetails();
void onGetContainerLog();
+ void onShutdownProc();
void onEditDataTypes();
void onCreateDataType();
void onImportDataType();
void onNewContainer();
+ void onSelectComponentInstance();
void onNewSalomeComponent();
void onNewSalomePythonComponent();
void onNewCorbaComponent();
void onFOREACHNode();
void onWHILENode();
void onSWITCHNode();
+ void onOptimizerLoop();
void onNodeFromCatalog();
void onDeleteItem();
void onCutItem();
void onCopyItem();
void onPasteItem();
+ void onPutInBloc();
void onArrangeLocalNodes();
void onArrangeRecurseNodes();
void onRebuildLinks();
+ void onZoomToBloc();
+ void onCenterOnNode();
+ void onShrinkExpand();
+ void onToggleStraightLinks(bool checked);
void onToggleAutomaticComputeLinks(bool checked);
void onToggleSimplifyLinks(bool checked);
void onToggleForce2NodesLinks(bool checked);
+ void onToggleAddRowCols(bool checked);
void onToggleSceneItemVisible(bool checked);
+ void onShowAllLinks();
+ void onHideAllLinks();
+
+ void onShowOnlyPortLinks();
+ void onShowPortLinks();
+ void onHidePortLinks();
+ void onEmphasisPortLinks();
+
+ void onShowOnlyCtrlLinks();
+ void onShowCtrlLinks();
+ void onHideCtrlLinks();
+ void onEmphasisCtrlLinks();
+
+ void onShowOnlyLink();
+ void onShowLink();
+ void onHideLink();
+ void onEmphasisLink();
+ void onDeEmphasizeAll();
+
void onSelectReference();
void onWhatsThis();
+ void onUndo();
+ void onRedo();
+ void onShowUndo();
+ void onShowRedo();
+
private:
+ void displayLinks(bool isShown);
+ void displayControlLinks(bool isShown);
+ void displayPortLinks(bool isShown);
+ void displayALink(bool isShown);
+ void emphasizePortLink(YACS::HMI::SubjectDataPort* sub, bool emphasize);
};
}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _GENERICGUIEXPORT_HXX_
+#define _GENERICGUIEXPORT_HXX_
+
+#ifdef WNT
+# if defined GenericGui_EXPORTS
+# define GENERICGUI_EXPORT __declspec( dllexport )
+# else
+# define GENERICGUI_EXPORT __declspec( dllimport )
+# endif
+#else
+# define GENERICGUI_EXPORT
+#endif
+
+#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "GraphicsView.hxx"
#include "SchemaModel.hxx"
#include "SceneItem.hxx"
+#include "SceneTextItem.hxx"
#include "Scene.hxx"
#include "QtGuiContext.hxx"
+#include "guiObservers.hxx"
#include <cmath>
#include <QMenu>
#include <QGraphicsView>
+#include <QWheelEvent>
+
+#include <cmath>
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
_zooming = false;
_fittingArea = false;
_panning = false;
+ _rect = 0;
setTransformationAnchor(QGraphicsView::AnchorViewCenter);
}
QGraphicsItem *qgitem = itemAt(event->pos());
if (qgitem)
{
- AbstractSceneItem *item = dynamic_cast<AbstractSceneItem*>(qgitem);
+ SceneItem *item = dynamic_cast<SceneItem*>(qgitem);
if (item)
- item->popupMenu(this, event->globalPos());
+ {
+ QPointF point = mapToScene(event->pos());
+ item->setEventPos(point);
+ item->popupMenu(this, event->globalPos());
+ }
+ else
+ {
+ SceneTextItem *item = dynamic_cast<SceneTextItem*>(qgitem);
+ if (item)
+ {
+ QPointF point = mapToScene(event->pos());
+ item->setEventPos(point);
+ item->popupMenu(this, event->globalPos());
+ }
+ }
}
}
WrapGraphicsView::mouseMoveEvent(e);
if (e->buttons()==Qt::LeftButton)
{
+ QPoint current = e->pos();
if (_zooming)
{
qreal currentX = e->globalX();
- qreal delta = currentX - _prevX;
+ qreal currentY = e->globalY();
+ qreal delta = sqrt((currentX - _prevX)*(currentX - _prevX) + (currentY - _prevY)*(currentY - _prevY));
+ if ((currentX*currentX + currentY*currentY) < (_prevX*_prevX + _prevY*_prevY))
+ delta = -delta;
_prevX = currentX;
+ _prevY = currentY;
// if (delta < -30) delta = -30;
// if (delta > 30) delta = 30;
double deltax = delta/900.;
}
else if (_panning)
{
- QPoint current = e->pos();
translate(current.x() - _prevPos.x(), current.y() - _prevPos.y());
//DEBTRACE(current.x()<<"-"<<_prevPos.x()<<" "<<current.y()<<"-"<<_prevPos.y());
_prevPos = current;
}
+ else if (_fittingArea)
+ {
+ if (!_rect)
+ {
+ _rect = scene()->addRect(QGraphicsView::mapToScene(QRect(_prevPos, current)).boundingRect());
+ _rect->setZValue(100000);
+ _rect->setParentItem(0);
+ }
+ else
+ {
+ _rect->setRect(QGraphicsView::mapToScene(QRect(_prevPos, current)).boundingRect());
+ _rect->show();
+ }
+ }
}
}
void GraphicsView::mousePressEvent(QMouseEvent *e)
{
+ DEBTRACE("GraphicsView::mousePressEvent");
+ if (QtGuiContext::getQtCurrent()->getView() != this)
+ {
+ DEBTRACE("Switch context before selection");
+ QtGuiContext::getQtCurrent()->getGMain()->switchContext(this->parentWidget());
+ }
WrapGraphicsView::mousePressEvent(e);
if (_zooming)
{
_prevX = e->globalX();
+ _prevY = e->globalY();
}
else if (_fittingArea)
{
{
_fittingArea = false;
QPoint current = e->pos();
- fitInView(QRect(_prevPos, current), Qt::KeepAspectRatio);
+ fitInView(QGraphicsView::mapToScene(QRect(_prevPos, current)).boundingRect(), Qt::KeepAspectRatio);
+ if (_rect)
+ _rect->hide();
}
QTransform q = transform();
DEBTRACE(q.m11()<<" "<<q.m12()<<" "<<q.m21()<<" "<<q.m22()<<" "<<q.dx()<<" "<<q.dy());
WrapGraphicsView::mouseReleaseEvent(e);
}
+
+void GraphicsView::wheelEvent(QWheelEvent *e)
+{
+ DEBTRACE("GraphicsView::wheelEvent " << e->delta());
+ double zoom = exp(0.1*e->delta()/120);
+ _scale = _scale*zoom;
+ setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
+ scale(zoom,zoom);
+}
+
+void GraphicsView::onZoomToBloc()
+{
+ Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
+ SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
+ if (!snode)
+ return;
+ SubjectComposedNode *scnode = dynamic_cast<SubjectComposedNode*>(sub);
+ if (!scnode)
+ scnode = dynamic_cast<SubjectComposedNode*>(snode->getParent());
+ YASSERT(scnode);
+ SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[scnode];
+ YASSERT(item);
+ QRectF rect = item->mapToScene(item->boundingRect().toRect()).boundingRect();
+ fitInView(rect.toRect(), Qt::KeepAspectRatio);
+}
+
+void GraphicsView::onCenterOnNode()
+{
+ Subject *sub =QtGuiContext::getQtCurrent()->getSelectedSubject();
+ SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
+ if (!snode)
+ return;
+ SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
+ centerOn(item);
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _GRAPHICSVIEW_HXX_
#define _GRAPHICSVIEW_HXX_
#include <QContextMenuEvent>
#include <QAction>
+#include <QGraphicsRectItem>
namespace YACS
{
virtual void onViewZoom();
virtual void onViewPan();
virtual void onViewGlobalPan();
- virtual void onViewReset();
+ virtual void onViewReset();
+
+ virtual void onZoomToBloc();
+ virtual void onCenterOnNode();
protected:
void contextMenuEvent(QContextMenuEvent *event);
void mouseMoveEvent (QMouseEvent *e);
void mousePressEvent (QMouseEvent *e);
void mouseReleaseEvent (QMouseEvent *e);
+ virtual void wheelEvent (QWheelEvent *e);
bool _zooming;
bool _fittingArea;
bool _panning;
int _prevX;
+ int _prevY;
qreal _scale;
QPoint _prevPos;
+ QGraphicsRectItem *_rect;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include <Python.h>
#include "GuiEditor.hxx"
#include "RuntimeSALOME.hxx"
#include "Proc.hxx"
#include "Node.hxx"
+#include "ForEachLoop.hxx"
#include "Catalog.hxx"
+#include "Container.hxx"
+#include "ComponentInstance.hxx"
#include "guiObservers.hxx"
#include "QtGuiContext.hxx"
#include "TypeCode.hxx"
+#include "Scene.hxx"
#include "SceneComposedNodeItem.hxx"
#include "SceneLinkItem.hxx"
#include "Catalog.hxx"
#include "ItemMimeData.hxx"
#include "Message.hxx"
+#include "Resource.hxx"
+#include "FormUndoRedo.hxx"
+#include <QMessageBox>
#include <string>
#include <sstream>
GuiEditor::GuiEditor()
{
+ // approximative conversion from latin1 to US ascii (removing accentuation)
DEBTRACE("GuiEditor::GuiEditor");
+ _table = "________________" ; // 0 - 15
+ _table += "________________" ; // 16 - 31
+ _table += " !\"#$%&'()*+,-./" ; // 32 - 47
+ _table += "0123456789:;<=>?" ; // 48 - 63
+ _table += "@ABCDEFGHIJKLMNO" ; // 64 - 79
+ _table += "PQRSTUVWXYZ[\\]^_" ; // 80 - 95
+ _table += "`abcdefghijklmno" ; // 96 - 111
+ _table += "pqrstuvwxyz{|}~_" ; // 112 - 127
+ _table += "________________" ; // 128 - 143
+ _table += "________________" ; // 144 - 159
+ _table += "_icLoY|-_ca-__r-" ; // 160 - 175
+ _table += "-_23'u_..10\"___?" ; // 176 - 191
+ _table += "AAAAAAACEEEEIIII" ; // 192 - 207
+ _table += "DNOOOOOx0UUUUYPB" ; // 208 - 223
+ _table += "aaaaaaaceeeeiiii" ; // 224 - 239
+ _table += "onooooo-0uuuuypy" ; // 240 - 255
+ //_table[167] = char(167); // '§'
+ //_table[176] = char(176); // '°'
+ DEBTRACE(_table.size() << " " << _table);
}
GuiEditor::~GuiEditor()
DEBTRACE("GuiEditor::~GuiEditor");
}
-void GuiEditor::CreateNodeFromCatalog(const ItemMimeData* myData, SubjectComposedNode *cnode)
+void GuiEditor::CreateNodeFromCatalog(const ItemMimeData* myData, SubjectComposedNode *cnode,bool createNewComponentInstance)
{
DEBTRACE("GuiEditor::CreateNodeFromCatalog");
- Catalog* catalog = myData->getCatalog();
- string compoName = myData->getCompo();
- string service = myData->getType();
- DEBTRACE(compoName << "/" << service);
- std::stringstream name;
- name << service << GuiContext::getCurrent()->getNewId();
-
- int swCase = 0;
- SubjectSwitch *aSwitch = dynamic_cast<SubjectSwitch*>(cnode);
- if (aSwitch)
+ int nb = myData->getDataSize();
+ DEBTRACE(nb);
+ for (int i=0; i<nb; i++)
{
- map<int, SubjectNode*> bodyMap = aSwitch->getBodyMap();
- if (bodyMap.empty()) swCase = 1;
- else
- {
- map<int, SubjectNode*>::reverse_iterator rit = bodyMap.rbegin();
- swCase = (*rit).first + 1;
- }
- if (!aSwitch->addNode(catalog, compoName, service, name.str(), swCase))
- Message mess;
+ Catalog* catalog = myData->getCatalog(i);
+ string compoName = myData->getCompo(i);
+ string service = myData->getType(i);
+ DEBTRACE(compoName << "/" << service);
+ _createNode(catalog, cnode, service, compoName,createNewComponentInstance);
}
- else if (cnode)
- if (! cnode->addNode(catalog, compoName, service, name.str()))
- Message mess;
-}
-
-void GuiEditor::AddTypeFromCatalog(const ItemMimeData* myData)
-{
- DEBTRACE("GuiEditor::AddTypeFromCatalog");
- Catalog* catalog = myData->getCatalog();
- DEBTRACE("catalog " << catalog);
- string aType = myData->getType();
- DEBTRACE(aType);
- SubjectProc* sProc = QtGuiContext::getQtCurrent()->getSubjectProc();
- sProc->addDataType(catalog, aType);
}
void GuiEditor::CreateNode(std::string typeNode)
}
DEBTRACE(sub->getName());
- YACS::HMI::SubjectComposedNode *subject = dynamic_cast< YACS::HMI::SubjectComposedNode*>(sub);
- if (!subject)
+ YACS::HMI::SubjectComposedNode *cnode = dynamic_cast< YACS::HMI::SubjectComposedNode*>(sub);
+ if (!cnode)
{
DEBTRACE("GuiEditor::CreateNode : no ComposedNode selected!");
return;
}
- std::stringstream name;
- name << typeNode << GuiContext::getCurrent()->getNewId();
+ _createNode(catalog, cnode, typeNode, "", Resource::COMPONENT_INSTANCE_NEW);
+}
- YACS::HMI::SubjectSwitch *aSwitch = dynamic_cast< YACS::HMI::SubjectSwitch*>(subject);
+void GuiEditor::_createNode(YACS::ENGINE::Catalog* catalog,
+ SubjectComposedNode *cnode,
+ std::string service,
+ std::string compoName,
+ bool createNewComponentInstance)
+{
+ // --- find a name not used
+
+ string name = service;
+ if (name == "PresetNode")
+ name = "DataIn";
+ Node *node =cnode->getNode();
+ ComposedNode *father = dynamic_cast<ComposedNode*>(node);
+ YASSERT(father);
+ list<Node*> children = father->edGetDirectDescendants();
+ bool nameInUse = true;
+ std::stringstream tryname;
+ while (nameInUse)
+ {
+ nameInUse = false;
+ long newid = GuiContext::getCurrent()->getNewId();
+ tryname.str("");
+ tryname << name << newid;
+ if (newid > 100000) break;
+ for (list<Node*>::iterator it = children.begin(); it != children.end(); ++it)
+ {
+ if ((*it)->getName() == tryname.str())
+ nameInUse = true;
+ }
+ }
+ name = tryname.str();
+
+ int swCase = 0;
+ SubjectSwitch *aSwitch = dynamic_cast<SubjectSwitch*>(cnode);
if (aSwitch)
{
map<int, SubjectNode*> bodyMap = aSwitch->getBodyMap();
- int swCase = 0;
if (bodyMap.empty()) swCase = 1;
else
{
map<int, SubjectNode*>::reverse_iterator rit = bodyMap.rbegin();
swCase = (*rit).first + 1;
}
- if (!aSwitch->addNode(catalog, "", typeNode, name.str(), swCase))
+ if (!aSwitch->addNode(catalog, compoName, service, name, createNewComponentInstance, swCase))
Message mess;
}
- else
- if (!subject->addNode(catalog, "", typeNode, name.str()))
+ else if (cnode && (dynamic_cast<SubjectBloc*>(cnode) == 0) && cnode->getChild() != 0)
+ {
+ // loop with a body : can't add a node
+ QMessageBox msgBox;
+ std::string msg;
+ msg="This loop has already a body. It is not possible to add directly another node\n";
+ msg=msg+"Do you want to put the existing node in a bloc and add the new node in this bloc ?\n";
+ msgBox.setText(msg.c_str());
+ msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No );
+ msgBox.setDefaultButton(QMessageBox::No);
+ int ret = msgBox.exec();
+ if(ret == QMessageBox::Yes)
+ {
+ // User wants to put body node in bloc
+ if (cnode->getChild()->putInComposedNode("Bloc1","Bloc"))
+ {
+ //the bloc has been successfully created. Add the new node
+ SubjectBloc* newbloc = dynamic_cast<SubjectBloc*>(cnode->getChild());
+ if (!newbloc->addNode(catalog, compoName, service, name, createNewComponentInstance))
+ Message mess;
+ }
+ else
+ Message mess;
+ }
+ }
+ else if (cnode)
+ if (!cnode->addNode(catalog, compoName, service, name, createNewComponentInstance))
Message mess;
}
+void GuiEditor::AddTypeFromCatalog(const ItemMimeData* myData)
+{
+ DEBTRACE("GuiEditor::AddTypeFromCatalog");
+ SubjectProc* sProc = QtGuiContext::getQtCurrent()->getSubjectProc();
+ int nb = myData->getDataSize();
+ DEBTRACE(nb);
+ for (int i=0; i<nb; i++)
+ {
+ Catalog* catalog = myData->getCatalog(i);
+ DEBTRACE("catalog " << catalog);
+ string aType = myData->getType(i);
+ DEBTRACE(aType);
+ sProc->addDataType(catalog, aType);
+ }
+}
+
void GuiEditor::CreateBloc()
{
DEBTRACE("GuiEditor::CreateBloc");
CreateNode("ForLoop");
}
-void GuiEditor::CreateForEachLoop()
+void GuiEditor::CreateForEachLoop(std::string type)
{
DEBTRACE("GuiEditor::CreateForEachLoop");
- CreateNode("ForEachLoopDouble");
+ // The ForEachLoop node for datatype type must exist in builtin catalog
+ // So create it in builtin catalog if it does not exist and datatype is loaded in the current Proc
+ YACS::ENGINE::Catalog *catalog = YACS::ENGINE::getSALOMERuntime()->getBuiltinCatalog();
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ std::string typeName="ForEachLoop_"+type;
+ if (!catalog->_composednodeMap.count(typeName))
+ {
+ if(proc->typeMap.count(type))
+ {
+ catalog->_composednodeMap[typeName]=new ForEachLoop(typeName,proc->typeMap[type]);
+ }
+ }
+ CreateNode(typeName);
}
void GuiEditor::CreateWhileLoop()
CreateNode("Switch");
}
+void GuiEditor::CreateOptimizerLoop()
+{
+ DEBTRACE("GuiEditor::CreateOptimizerLoop");
+ CreateNode("OptimizerLoop");
+}
+
void GuiEditor::CreateContainer()
{
DEBTRACE("GuiEditor::CreateContainer");
SubjectProc *sproc = QtGuiContext::getQtCurrent()->getSubjectProc();
- assert(sproc);
- std::stringstream name;
- name << "container" << GuiContext::getCurrent()->getNewId();
- sproc->addContainer(name.str());
+ YASSERT(sproc);
+ SubjectContainer *scont = 0;
+ while (!scont)
+ {
+ std::stringstream name;
+ long newid = GuiContext::getCurrent()->getNewId();
+ if (newid > 100000) break;
+ name.str("");
+ name << "container" << newid;
+ scont = sproc->addContainer(name.str());
+ }
+}
+
+void GuiEditor::CreateComponentInstance()
+{
+ DEBTRACE("GuiEditor::CreateComponentInstance");
+ SubjectProc *sproc = QtGuiContext::getQtCurrent()->getSubjectProc();
+ YASSERT(sproc);
+ Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
+ SubjectComponent *sco = dynamic_cast<SubjectComponent*>(sub);
+ if (!sco)
+ {
+ DEBTRACE("GuiEditor::CreateComponentInstance: " << "selection is not a component");
+ return;
+ }
+ string compoName = sco->getComponent()->getCompoName();
+ string containerName = sco->getComponent()->getContainer()->getName();
+ sproc->addComponent(compoName, containerName);
}
+
SubjectDataPort* GuiEditor::CreateInputPort(SubjectElementaryNode* seNode,
std::string name,
YACS::ENGINE::Catalog *catalog,
SubjectDataPort* before)
{
DEBTRACE("GuiEditor::CreateInputPort");
-
- std::stringstream aName;
+ SubjectDataPort *sdp = 0;
if (name.empty())
- aName << "i" << GuiContext::getCurrent()->getNewId();
+ {
+ std::stringstream aName;
+ long newid = 0;
+ while (newid < 100000)
+ {
+ newid = GuiContext::getCurrent()->getNewId();
+ aName.str("");
+ aName << "i" << newid;
+ try
+ {
+ seNode->getNode()->getInputPort(aName.str());
+ }
+ catch(Exception& ex)
+ {
+ break;
+ }
+ }
+ sdp = seNode->addInputPort(catalog,type, aName.str());
+ }
else
- aName << name;
- SubjectDataPort *sdp = seNode->addInputPort(catalog,type, aName.str());
+ sdp = seNode->addInputPort(catalog,type, name);
if (!sdp)
Message mess;
return sdp;
SubjectDataPort* before)
{
DEBTRACE("GuiEditor::CreateOutputPort");
-
- std::stringstream aName;
+ SubjectDataPort *sdp = 0;
if (name.empty())
- aName << "o" << GuiContext::getCurrent()->getNewId();
+ {
+ std::stringstream aName;
+ long newid = 0;
+ while (newid < 100000)
+ {
+ newid = GuiContext::getCurrent()->getNewId();
+ aName.str("");
+ aName << "o" << newid;
+ try
+ {
+ seNode->getNode()->getOutputPort(aName.str());
+ }
+ catch(Exception& ex)
+ {
+ break;
+ }
+ }
+ sdp = seNode->addOutputPort(catalog,type, aName.str());
+ }
else
- aName << name;
- SubjectDataPort *sdp = seNode->addOutputPort(catalog,type, aName.str());
+ sdp = seNode->addOutputPort(catalog,type, name);
if (!sdp)
Message mess;
return sdp;
}
+/*!
+ * Subject shrink or expand, command from popup menu: needs a valid selection
+ */
+void GuiEditor::shrinkExpand() {
+ DEBTRACE("GuiEditor::shrinkExpand");
+
+ Subject* sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
+ if (!sub) {
+ DEBTRACE("GuiEditor::shrinkExpand : invalid selection!");
+ return;
+ };
+
+ if (! QtGuiContext::getQtCurrent()->_mapOfSceneItem.count(sub)) {
+ DEBTRACE("GuiEditor::shrinkExpand: no scene item corresponding to this subject");
+ return;
+ };
+
+ SceneItem* item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
+ SceneNodeItem *sni = dynamic_cast<SceneNodeItem*>(item);
+ if (!sni) {
+ DEBTRACE("GuiEditor::shrinkExpand: no scene node item corresponding to this subject");
+ return;
+ };
+
+ if (sni->isExpanded()) {
+ sni->setExpanded(false);
+ } else {
+ sni->setExpanded(true);
+ };
+ sni->reorganizeShrinkExpand();
+ sni->showOutScopeLinks();
+ sni->updateLinks();
+}
+
/*!
* Subject destruction, command from popup menu: needs a valid selection
*/
void GuiEditor::DeleteSubject()
{
DEBTRACE("GuiEditor::DeleteSubject");
+ if (!QtGuiContext::getQtCurrent()->isEdition()) return;
QModelIndexList selList
= QtGuiContext::getQtCurrent()->getSelectionModel()->selectedIndexes();
if (selList.isEmpty())
if (!selItem) return;
Subject *subToRemove = selItem->getSubject();
Subject *subParent = subToRemove->getParent();
-
DeleteSubject(subParent, subToRemove);
}
Subject* toRemove)
{
DEBTRACE("GuiEditor::DeleteSubject "<<parent->getName()<<" "<<toRemove->getName());
- parent->destroy(toRemove);
+ if (!QtGuiContext::getQtCurrent()->isEdition()) return;
+ toRemove->askRegisterUndoDestroy();
+ if(!parent->destroy(toRemove))
+ Message mess;
}
void GuiEditor::CutSubject()
{
DEBTRACE("GuiEditor::CutSubject");
+ if (!QtGuiContext::getQtCurrent()->isEdition()) return;
Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
if (!sub)
{
void GuiEditor::CopySubject()
{
DEBTRACE("GuiEditor::CopySubject");
+ if (!QtGuiContext::getQtCurrent()->isEdition()) return;
Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
if (!sub)
{
void GuiEditor::PasteSubject()
{
DEBTRACE("GuiEditor::PasteSubject");
+ if (!QtGuiContext::getQtCurrent()->isEdition()) return;
Subject *newParent = QtGuiContext::getQtCurrent()->getSelectedSubject();
if (!newParent)
{
Message mess("Paste not possible for this kind of object");
}
+void GuiEditor::PutSubjectInBloc()
+{
+ Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
+ if (!sub)
+ {
+ Message mess("GuiEditor::PutSubjectInBloc : invalid selection!");
+ return;
+ }
+ if (SubjectNode *snode = dynamic_cast<SubjectNode*>(sub))
+ {
+ //Build the set of children node names
+ Node* node=snode->getNode();
+ ComposedNode* father=node->getFather();
+ std::list<Node*> children = father->edGetDirectDescendants();
+ std::set<std::string> names;
+ for (std::list<Node*>::iterator it = children.begin(); it != children.end(); ++it)
+ names.insert((*it)->getName());
+
+ std::stringstream tryname;
+ long newid=0;
+ while (newid < 100000)
+ {
+ tryname.str("");
+ tryname << "Bloc" << newid;
+ if(names.find(tryname.str()) == names.end())break;
+ newid++;
+ }
+
+ if (!snode->putInComposedNode(tryname.str(),"Bloc"))
+ Message mess;
+
+ return;
+ }
+ Message mess("Put in Bloc not possible for this kind of object");
+}
+
void GuiEditor::rebuildLinks()
{
// --- only global link redraw for now...
-
+ DEBTRACE("GuiEditor::rebuildLinks");
YACS::HMI::SubjectProc* subproc = QtGuiContext::getQtCurrent()->getSubjectProc();
SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[subproc];
SceneComposedNodeItem *proc = dynamic_cast<SceneComposedNodeItem*>(item);
return;
}
sci->arrangeNodes(isRecursive);
+// if (Scene::_autoComputeLinks && !QtGuiContext::getQtCurrent()->isLoading())
+// {
+// YACS::HMI::SubjectProc* subproc = QtGuiContext::getQtCurrent()->getSubjectProc();
+// SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[subproc];
+// SceneComposedNodeItem *proc = dynamic_cast<SceneComposedNodeItem*>(item);
+// proc->rebuildLinks();
+// }
+}
+
+void GuiEditor::arrangeProc()
+{
+ YACS::HMI::SubjectProc* subproc = QtGuiContext::getQtCurrent()->getSubjectProc();
+ SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[subproc];
+ SceneComposedNodeItem *proc = dynamic_cast<SceneComposedNodeItem*>(item);
+ proc->arrangeNodes(true);
+}
+
+void GuiEditor::showUndo(QWidget *parent)
+{
+ FormUndoRedo *undo = new FormUndoRedo(parent);
+ undo->tabWidget->setCurrentWidget(undo->undoTab);
+ undo->exec();
+}
+
+void GuiEditor::showRedo(QWidget *parent)
+{
+ FormUndoRedo *redo = new FormUndoRedo(parent);
+ redo->tabWidget->setCurrentWidget(redo->redoTab);
+ redo->exec();
+}
+
+/*! Replace accentuated characters from latin1 to US ascii equivalent without accent.
+* I did not found anything to do that in Qt...
+*/
+QString GuiEditor::asciiFilter(const QString & name)
+{
+ DEBTRACE(name.toStdString());
+ string aName = name.toAscii().data();
+ DEBTRACE(aName);
+ for (int i=0; i < aName.size(); i++)
+ {
+ int v = (unsigned char)(aName[i]);
+ DEBTRACE(v << " " << _table[v]);
+ aName[i] = _table[v];
+ }
+ DEBTRACE(aName);
+ return aName.c_str();
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _GUIEDITOR_HXX_
#define _GUIEDITOR_HXX_
+#include <QWidget>
+#include <QString>
#include <string>
namespace YACS
virtual ~GuiEditor();
void CreateNodeFromCatalog(const ItemMimeData* myData,
- SubjectComposedNode *cnode);
+ SubjectComposedNode *cnode,
+ bool createNewComponentInstance);
void AddTypeFromCatalog(const ItemMimeData* myData);
void CreateNode(std::string typeNode);
void CreateBloc();
void CreateForLoop();
- void CreateForEachLoop();
+ void CreateForEachLoop(std::string type );
void CreateWhileLoop();
void CreateSwitch();
+ void CreateOptimizerLoop();
void CreateContainer();
+ void CreateComponentInstance();
SubjectDataPort* CreateInputPort(SubjectElementaryNode* seNode,
std::string name,
void CutSubject();
void CopySubject();
void PasteSubject();
-
+ void PutSubjectInBloc();
+ void shrinkExpand();
void rebuildLinks();
void arrangeNodes(bool isRecursive);
+ void arrangeProc();
+ void showUndo(QWidget *parent = 0);
+ void showRedo(QWidget *parent = 0);
+ QString asciiFilter(const QString & name);
+
+ protected:
+ void _createNode(YACS::ENGINE::Catalog* catalog,
+ SubjectComposedNode *cnode,
+ std::string service,
+ std::string compoName,
+ bool createNewComponentInstance);
+ std::string _table;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include <Python.h>
#include "SALOME_LifeCycleCORBA.hxx"
#include "SALOME_NamingService.hxx"
_isRunning = false;
_isSuspended = false;
_isStopOnError = false;
+ _shutdownLevel=1;
_loadStateFile = "";
_breakpointList.clear();
DEBTRACE("GuiExecutor::~GuiExecutor");
}
+void GuiExecutor::closeContext()
+{
+ DEBTRACE("GuiExecutor::closeContext");
+ _context = 0;
+}
void GuiExecutor::startResumeDataflow(bool initialize)
{
DEBTRACE("GuiExecutor::runDataflow " << initialize);
+ if (!_context)
+ {
+ DEBTRACE("context closed");
+ return;
+ }
if (CORBA::is_nil(_engineRef))
{
DEBTRACE("Create YACS ORB engine!");
CORBA::ORB_ptr orb = runTime->getOrb();
SALOME_NamingService namingService(orb);
SALOME_LifeCycleCORBA lcc(&namingService);
- Engines::Component_var comp = lcc.FindOrLoad_Component("YACSContainer", "YACS" );
+ ostringstream containerName;
+ containerName << "localhost/YACSContainer" << QtGuiContext::getQtCurrent()->getStudyId();
+ Engines::EngineComponent_var comp = lcc.FindOrLoad_Component(containerName.str().c_str(), "YACS" );
_engineRef =YACS_ORB::YACS_Gen::_narrow(comp);
- assert(!CORBA::is_nil(_engineRef));
+ YASSERT(!CORBA::is_nil(_engineRef));
}
checkEndOfDataflow(); // --- to allow change of the _isRunning state
DEBTRACE("_procRef init");
}
+ YASSERT(!CORBA::is_nil(_procRef));
+
if (initialize)
_procRef->setExecMode(YACS_ORB::STEPBYSTEP);
else
try
{
_procRef->RunFromState(_loadStateFile.c_str());
- }
+ }
catch (...)
{
DEBTRACE("Runtime error: execution from the loaded state failed")
- return;
- }
+ return;
+ }
}
}
void GuiExecutor::resetDataflow()
{
DEBTRACE("GuiExecutor::resetDataflow");
+ //update _isRunning
+ checkEndOfDataflow();
if (_isRunning)
_procRef->stopExecution();
+ checkEndOfDataflow();
+
+ if (!_isRunning)
+ {
+ _isRunning = true;
+ _procRef->setExecMode(YACS_ORB::STEPBYSTEP);
+ //full reset: set all nodes in error to READY state and start execution
+ _procRef->RestartFromState("");
+ }
}
DEBTRACE("GuiExecutor::setStopOnError " << aMode);
if (_isRunning)
{
- _procRef->setStopOnError(aMode,
- (string("/tmp/dumpStateOnError_")
- + getenv("USER") + string(".xml")).c_str());
+#ifdef WNT
+ _procRef->setStopOnError(aMode, (getenv("TEMP") + string("\\dumpStateOnError_") + getenv("USER") + string(".xml")).c_str());
+#else
+ _procRef->setStopOnError(aMode, (string("/tmp/dumpStateOnError_") + getenv("USER") + string(".xml")).c_str());
+#endif
_isStopOnError = true;
}
}
void GuiExecutor::setBreakpointList(std::list<std::string> breakpointList)
{
DEBTRACE("GuiExecutor::setBreakpointList");
+ if (!_context)
+ {
+ DEBTRACE("context closed");
+ return;
+ }
_breakpointList.clear();
_breakpointList = breakpointList;
setBPList();
if ((_execMode == YACS::CONTINUE) && ! _breakpointList.empty())
{
- QtGuiContext::getQtCurrent()->getGMain()->_breakpointsModeAct->setChecked(true);
+ _context->getGMain()->_breakpointsModeAct->setChecked(true);
setBreakpointMode();
}
}
void GuiExecutor::addBreakpoint(std::string breakpoint)
{
DEBTRACE("addBreakpoint " << breakpoint);
+ if (!_context)
+ {
+ DEBTRACE("context closed");
+ return;
+ }
_breakpointList.push_back(breakpoint);
setBPList();
if ((_execMode == YACS::CONTINUE) && ! _breakpointList.empty())
{
- QtGuiContext::getQtCurrent()->getGMain()->_breakpointsModeAct->setChecked(true);
+ _context->getGMain()->_breakpointsModeAct->setChecked(true);
setBreakpointMode();
}
}
return msg;
}
+void GuiExecutor::shutdownProc()
+{
+ DEBTRACE("GuiExecutor::shutdownProc " << _shutdownLevel << "," << _isRunning);
+ checkEndOfDataflow();
+ if (!_isRunning)
+ _procRef->shutdownProc(_shutdownLevel);
+}
+
+void GuiExecutor::setInPortValue(YACS::ENGINE::DataPort* port, std::string value)
+{
+ DEBTRACE("GuiExecutor::setInPortValue");
+
+ YACS::ENGINE::Node* node = port->getNode();
+ YACS::ENGINE::ComposedNode* rootNode = node->getRootNode();
+
+ std::string nodeName;
+ if(rootNode == node)
+ nodeName = node->getName();
+ else
+ nodeName = rootNode->getChildName(node);
+
+ std::string msg = _procRef->setInPortValue(nodeName.c_str(), port->getName().c_str(), value.c_str());
+}
+
bool GuiExecutor::event(QEvent *e)
{
DEBTRACE("GuiExecutor::event");
int numid = yev->getYACSEvent().first;
string event = yev->getYACSEvent().second;
DEBTRACE("<" << numid << "," << event << ">");
+ if (!_context)
+ {
+ DEBTRACE("context closed");
+ return true;
+ }
if (event == "executor") // --- Executor notification: state
{
int execState = _procRef->getExecutorState();
if (execState == YACS::PAUSED)
_isSuspended = true;
}
- SubjectProc *sproc = GuiContext::getCurrent()->getSubjectProc();
- sproc->setExecState(execState);
-// theRunMode->onNotifyNextSteps(nextSteps);
+ SubjectProc *sproc = _context->getSubjectProc();
+ sproc->update(YACS::HMI::UPDATEPROGRESS, execState, sproc);
}
else // --- Node notification
{
return true;
int state = _procRef->getNodeState(numid);
int iGui = _serv->_engineToGuiMap[numid];
- assert(GuiContext::getCurrent()->_mapOfExecSubjectNode.count(iGui));
- SubjectNode *snode = GuiContext::getCurrent()->_mapOfExecSubjectNode[iGui];
+ YASSERT(_context->_mapOfExecSubjectNode.count(iGui));
+ SubjectNode *snode = _context->_mapOfExecSubjectNode[iGui];
DEBTRACE("node " << snode->getName() << " state=" << state);
- snode->setExecState(state);
YACS::ENGINE::Node *node = snode->getNode();
list<InputPort*> inports = node->getLocalInputPorts();
string val = _procRef->getInPortValue(numid, (*iti)->getName().c_str());
DEBTRACE("node " << snode->getName() << " inport " << (*iti)->getName()
<< " value " << val);
- assert(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(*iti));
- SubjectDataPort* port = GuiContext::getCurrent()->_mapOfSubjectDataPort[*iti];
+ YASSERT(_context->_mapOfSubjectDataPort.count(*iti));
+ SubjectDataPort* port = _context->_mapOfSubjectDataPort[*iti];
port->setExecValue(val);
port->update(YACS::HMI::UPDATEPROGRESS, 0, port);
}
string val = _procRef->getOutPortValue(numid, (*ito)->getName().c_str());
DEBTRACE("node " << snode->getName() << " outport " << (*ito)->getName()
<< " value " << val);
- assert(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(*ito));
- SubjectDataPort* port = GuiContext::getCurrent()->_mapOfSubjectDataPort[*ito];
+ YASSERT(_context->_mapOfSubjectDataPort.count(*ito));
+ SubjectDataPort* port = _context->_mapOfSubjectDataPort[*ito];
port->setExecValue(val);
port->update(YACS::HMI::UPDATEPROGRESS, 0, port);
}
+ snode->update(YACS::HMI::UPDATEPROGRESS, state, snode);
}
return true;
}
}
+YACS::ExecutorState GuiExecutor::updateSchema(string jobState)
+{
+ YACS::ExecutorState execState = YACS::NOTYETINITIALIZED;
+
+ int numid;
+ int state;
+ std::list<Node*> aNodeSet = _proc->getAllRecursiveConstituents();
+ for ( std::list<Node*>::iterator it = aNodeSet.begin(); it != aNodeSet.end(); it++ ){
+
+ numid = (*it)->getNumId();
+
+ state = _proc->getNodeState(numid);
+ SubjectNode *snode = _context->_mapOfExecSubjectNode[numid];
+
+ YACS::ENGINE::Node *node = snode->getNode();
+ list<InputPort*> inports = node->getLocalInputPorts();
+ list<InputPort*>::iterator iti = inports.begin();
+ for ( ; iti != inports.end(); ++iti)
+ {
+ string val = _proc->getInPortValue(numid, (*iti)->getName().c_str());
+ YASSERT(_context->_mapOfSubjectDataPort.count(*iti));
+ SubjectDataPort* port = _context->_mapOfSubjectDataPort[*iti];
+ port->setExecValue(val);
+ port->update(YACS::HMI::UPDATEPROGRESS, 0, port);
+ }
+ list<OutputPort*> outports = node->getLocalOutputPorts();
+ list<OutputPort*>::iterator ito = outports.begin();
+ for ( ; ito != outports.end(); ++ito)
+ {
+ string val = _proc->getOutPortValue(numid, (*ito)->getName().c_str());
+ YASSERT(_context->_mapOfSubjectDataPort.count(*ito));
+ SubjectDataPort* port = _context->_mapOfSubjectDataPort[*ito];
+ port->setExecValue(val);
+ port->update(YACS::HMI::UPDATEPROGRESS, 0, port);
+ }
+ snode->update(YACS::HMI::UPDATEPROGRESS, state, snode);
+ }
+ state = _proc->getRootNode()->getEffectiveState();
+ switch(state){
+ case YACS::LOADED:
+ case YACS::ACTIVATED:
+ if(jobState!="RUNNING")
+ execState = YACS::FINISHED;
+ else
+ execState = YACS::RUNNING;
+ break;
+ case YACS::FAILED:
+ case YACS::DONE:
+ execState = YACS::FINISHED;
+ break;
+ case YACS::SUSPENDED:
+ execState = YACS::PAUSED;
+ break;
+ }
+ SubjectProc *sproc = _context->getSubjectProc();
+ sproc->update(YACS::HMI::UPDATEPROGRESS, execState, sproc);
+
+ return execState;
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _GUIEXECUTOR_HXX_
#define _GUIEXECUTOR_HXX_
{
class Proc;
class Node;
+ class DataPort;
}
namespace HMI
GuiExecutor(YACS::ENGINE::Proc* proc);
virtual ~GuiExecutor();
+ void closeContext();
+
void startResumeDataflow(bool initialize = false);
bool checkEndOfDataflow(bool display = true);
void killDataflow();
void removeBreakpoint(std::string breakpoint);
void setNextStepList(std::list<std::string> nextStepList);
+ void setInPortValue(YACS::ENGINE::DataPort* port, std::string value);
+
void registerStatusObservers();
bool isRunning() const { return _isRunning; };
bool isStopOnError() const { return _isStopOnError; }
std::string getErrorReport(YACS::ENGINE::Node* node);
std::string getContainerLog();
std::string getContainerLog(YACS::ENGINE::Node* node);
+ void shutdownProc();
+ void setShutdownLevel(int level){_shutdownLevel=level;}
+ int getShutdownLevel(){return _shutdownLevel;}
+
+ YACS::ExecutorState updateSchema(std::string jobState);
virtual bool event(QEvent *e);
bool _isRunning;
bool _isSuspended;
bool _isStopOnError;
+ int _shutdownLevel;
std::list<std::string> _breakpointList;
std::string _loadStateFile;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "GuiObserver_i.hxx"
#include "GuiExecutor.hxx"
#include "Proc.hxx"
void GuiObserver_i::notifyObserver(CORBA::Long numid, const char* event)
{
- DEBTRACE("GuiObserver_i::notifyObserver");
+ DEBTRACE("GuiObserver_i::notifyObserver " << numid << " " << event);
pair<int,string> myEvent(numid, event);
YACSEvent* evt = new YACSEvent(myEvent);
QApplication::postEvent(_impl, evt); // Qt will delete it when done
void GuiObserver_i::setConversion()
{
DEBTRACE("GuiObserver_i::setConversion");
- assert(!CORBA::is_nil(_engineProc));
+ YASSERT(!CORBA::is_nil(_engineProc));
YACS_ORB::stringArray_var engineNames;
YACS_ORB::longArray_var engineIds;
//DEBTRACE("---");
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _GUIOBSERVER_I_HXX_
#define _GUIOBSERVER_I_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "ItemEdition.hxx"
#include "EditionProc.hxx"
#include "EditionBloc.hxx"
#include "EditionDataType.hxx"
#include "EditionElementaryNode.hxx"
#include "EditionForEachLoop.hxx"
+#include "EditionOptimizerLoop.hxx"
#include "EditionInputPort.hxx"
#include "EditionLoop.hxx"
#include "EditionWhile.hxx"
_stackId = QtGuiContext::getQtCurrent()->getStackedWidget()->addWidget(this);
DEBTRACE("_stackId " << _stackId);
- assert(!QtGuiContext::getQtCurrent()->_mapOfEditionItem.count(_subject));
- QtGuiContext::getQtCurrent()->_mapOfEditionItem[_subject] = _stackId;
+ YASSERT(!QtGuiContext::getQtCurrent()->_mapOfEditionItem.count(_subject));
+ QtGuiContext::getQtCurrent()->_mapOfEditionItem[_subject] = this;
//QtGuiContext::getQtCurrent()->getStackedWidget()->raiseWidget(_stackId);
}
{
DEBTRACE("---");
QtGuiContext::getQtCurrent()->getStackedWidget()->removeWidget(this);
+ QtGuiContext::getQtCurrent()->_mapOfEditionItem.erase(_subject);
DEBTRACE("---");
}
}
{
DEBTRACE("onApply");
string name = _wid->le_name->text().toStdString();
+ name = filterName(name);
bool nameEdited = false;
if (name != _name)
{
}
}
DEBTRACE(_isEdited << " " << nameEdited);
- _isEdited = _isEdited || nameEdited;
+ _isEdited = nameEdited;
setEdited(_isEdited);
}
setEdited(false);
}
+std::string ItemEdition::filterName(const std::string& name)
+{
+ string nameFiltered;
+ nameFiltered = "";
+ for (int i= 0; i< name.size(); i++)
+ {
+ unsigned char a = (unsigned char)(name[i]);
+ if ( ((a >= '0') && (a <= '9'))
+ || ((a >= 'A') && (a <= 'Z'))
+ || ((a >= 'a') && (a <= 'z'))
+ || ( a == '_'))
+ nameFiltered += a;
+ }
+ DEBTRACE(name << " " << nameFiltered);
+ return nameFiltered;
+}
+
void ItemEdition::onModifyName(const QString &text)
{
if (_name != text.toStdString()) setEdited(true);
void ItemEdition::setEdited(bool isEdited)
{
+ DEBTRACE("ItemEdition::setEdited " << isEdited);
if (isEdited)
{
QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.insert(_subject);
{
QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.erase(_subject);
_subject->update(EDIT, 0, _subject);
- if (QtGuiContext::getQtCurrent()->getSubjectProc())
+ if (QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty() && QtGuiContext::getQtCurrent()->getSubjectProc())
QtGuiContext::getQtCurrent()->getSubjectProc()->update(EDIT, 0, _subject);
}
son->getName().c_str());
break;
case YACS::HMI::FOREACHLOOP:
- case YACS::HMI::OPTIMIZERLOOP:
item = new EditionForEachLoop(son,
QtGuiContext::getQtCurrent()->getStackedWidget(),
son->getName().c_str());
break;
+ case YACS::HMI::OPTIMIZERLOOP:
+ item = new EditionOptimizerLoop(son, QtGuiContext::getQtCurrent()->getStackedWidget(),
+ son->getName().c_str());
+ break;
case YACS::HMI::FORLOOP:
item = new EditionLoop(son,
QtGuiContext::getQtCurrent()->getStackedWidget(),
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _ITEMEDITION_HXX_
#define _ITEMEDITION_HXX_
#include <QTextEdit>
-
+#include <string>
#include "guiObservers.hxx"
#include "FormEditItem.hxx"
virtual void select(bool isSelected);
virtual void setName(std::string name);
virtual void update(GuiEvent event, int type, Subject* son);
+ virtual void setEdited(bool isEdited);
+ static std::string filterName(const std::string& name);
protected:
- virtual void setEdited(bool isEdited);
bool _isEdited;
bool _haveScript;
};
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "ItemMimeData.hxx"
#include "guiObservers.hxx"
#include "Catalog.hxx"
+#include <QStringList>
+
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
ItemMimeData::ItemMimeData(): QMimeData()
{
- _sub = 0;
- _catalog = 0;
+ _sub.clear();
+ _catalog.clear();
_cataName.clear();
_compoName.clear();
_typeName.clear();
_swCase=0;
+ _control=false;
}
ItemMimeData::~ItemMimeData()
void ItemMimeData::setSubject(Subject *sub)
{
- _sub = sub;
+ _sub.push_back(sub);
}
void ItemMimeData::setCatalog(YACS::ENGINE::Catalog *cata)
{
- _catalog = cata;
+ _catalog.push_back(cata);
}
void ItemMimeData::setCataName(std::string cataName)
{
- _cataName = cataName;
+ _cataName.push_back(cataName);
}
void ItemMimeData::setCompo(std::string compo)
{
- _compoName = compo;
+ _compoName.push_back(compo);
}
void ItemMimeData::setType(std::string aType)
{
- _typeName = aType;
+ _typeName.push_back(aType);
}
void ItemMimeData::setCase(int aCase)
_swCase = aCase;
}
-Subject* ItemMimeData::getSubject() const
+Subject* ItemMimeData::getSubject(int i) const
{
- return _sub;
+ YASSERT(i < _sub.size());
+ return _sub[i];
}
-YACS::ENGINE::Catalog* ItemMimeData::getCatalog() const
+YACS::ENGINE::Catalog* ItemMimeData::getCatalog(int i) const
{
- return _catalog;
+ YASSERT(i < _catalog.size());
+ return _catalog[i];
}
-std::string ItemMimeData::getCataName() const
+std::string ItemMimeData::getCataName(int i) const
{
- return _cataName;
+ YASSERT(i < _cataName.size());
+ return _cataName[i];
}
-std::string ItemMimeData::getCompo() const
+std::string ItemMimeData::getCompo(int i) const
{
- return _compoName;
+ YASSERT(i < _compoName.size());
+ return _compoName[i];
}
-std::string ItemMimeData::getType() const
+std::string ItemMimeData::getType(int i) const
{
- return _typeName;
+ YASSERT(i < _typeName.size());
+ return _typeName[i];
}
int ItemMimeData::getCase() const
{
return _swCase;
}
+void ItemMimeData::setControl(bool control)
+{
+ _control=control;
+}
+bool ItemMimeData::getControl() const
+{
+ return _control;
+}
+
+int ItemMimeData::getDataSize() const
+{
+ int lg=0;
+ QStringList myFormats = formats();
+ for (int i=0; i<myFormats.size(); i++)
+ {
+ if (myFormats[i].contains("yacs/cata"))
+ {
+ lg = _cataName.size();
+ break;
+ }
+ else
+ {
+ lg = _sub.size();
+ break;
+ }
+ }
+ return lg;
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _ITEMMIMEDATA_HXX_
#define _ITEMMIMEDATA_HXX_
#include <QMimeData>
#include <string>
+#include <vector>
namespace YACS
{
virtual void setCompo(std::string compo);
virtual void setType(std::string aType);
virtual void setCase(int aCase);
- virtual Subject* getSubject() const;
- virtual YACS::ENGINE::Catalog* getCatalog() const;
- virtual std::string getCataName() const;
- virtual std::string getCompo() const;
- virtual std::string getType() const;
+ virtual Subject* getSubject(int i=0) const;
+ virtual YACS::ENGINE::Catalog* getCatalog(int i=0) const;
+ virtual std::string getCataName(int i=0) const;
+ virtual std::string getCompo(int i=0) const;
+ virtual std::string getType(int i=0) const;
virtual int getCase() const;
+ virtual bool getControl() const;
+ virtual void setControl(bool control);
+ virtual int getDataSize() const;
protected:
- Subject *_sub;
- YACS::ENGINE::Catalog *_catalog;
- std::string _cataName;
- std::string _compoName;
- std::string _typeName;
+ std::vector<Subject*> _sub;
+ std::vector<YACS::ENGINE::Catalog*> _catalog;
+ std::vector<std::string> _cataName;
+ std::vector<std::string> _compoName;
+ std::vector<std::string> _typeName;
int _swCase;
+ bool _control;
};
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "LinkAStar.hxx"
#include <map>
#include "YacsTrace.hxx"
using namespace std;
-//using namespace YACS::ENGINE;
using namespace YACS::HMI;
{
_closedList.clear();
_openList.clear();
-
+ _pq=std::priority_queue<Cost>();
}
LinkAStar::~LinkAStar()
{
_closedList.clear();
_openList.clear();
+ _pq=std::priority_queue<Cost>();
_from = from;
_to = to;
bool isPath = false;
if (tmp.getFCost() < _openList[pos].getFCost())
{
_openList[pos] = tmp; // --- new path better, update node
+ _pq.push(Cost(tmp.getFCost(),pos));
}
}
else
{
_openList[pos] = tmp; // --- add node
+ _pq.push(Cost(tmp.getFCost(),pos));
}
}
}
std::pair<int,int> LinkAStar::bestNode(const LNodeMap& aList)
{
- double fCost = (aList.begin()->second).getFCost();
- pair<int, int> pos = aList.begin()->first;
- for (LNodeMap::const_iterator it = aList.begin(); it != aList.end(); ++it)
- if ((it->second).getFCost() < fCost)
- {
- fCost = (it->second).getFCost();
- pos = it->first;
- }
+ std::pair<int, int> pos;
+ do
+ {
+ pos=_pq.top().pos;
+ _pq.pop();
+ }
+ while(aList.count(pos)==0);
return pos;
}
if (_openList.erase(pos) == 0)
DEBTRACE("node not in open list, can't delete");
}
-
-double LinkAStar::distance(int i1, int j1, int i2, int j2)
-{
- return sqrt(double((i1-i2)*(i1-i2) + (j1-j2)*(j1-j2)));
-}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _LINKASTAR_HXX_
#define _LINKASTAR_HXX_
#include "LinkMatrix.hxx"
#include <map>
+#include <queue>
#include <list>
+#include <cmath>
+#include <stdlib.h>
namespace YACS
{
typedef std::map<std::pair<int,int>, LCostNode> LNodeMap;
+ struct Cost
+ {
+ Cost(double f,std::pair<int,int> p):F(f),pos(p) {};
+ double F;
+ std::pair<int,int> pos;
+ bool operator<(const Cost& a) const
+ {
+ return (a.F <= F);
+ }
+ };
+
class LinkAStar
{
public:
void addNeighbours(std::pair<int,int> n);
std::pair<int,int> bestNode(const LNodeMap& aList);
void moveToClosedList(std::pair<int,int> n);
- double distance(int i1, int j1, int i2, int j2);
+ //inline double distance(int i1, int j1, int i2, int j2) { return std::sqrt(double((i1-i2)*(i1-i2) + (j1-j2)*(j1-j2)));};
+ //inline double distance(int i1, int j1, int i2, int j2) { return double((i1-i2)*(i1-i2) + (j1-j2)*(j1-j2));};
+ //manhattan distance is better for 4 connected cells
+ inline double distance(int i1, int j1, int i2, int j2) { return abs(i1-i2)+abs(j1-j2);};
protected:
const LinkMatrix &_linkMatrix;
LNodeMap _closedList;
LNodeMap _openList;
LNode _from;
LNode _to;
+ std::priority_queue<Cost> _pq;
};
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "LinkMatrix.hxx"
+#include "Scene.hxx"
#include "SceneComposedNodeItem.hxx"
#include "SceneElementaryNodeItem.hxx"
#include "SceneHeaderItem.hxx"
+#include "SceneHeaderNodeItem.hxx"
+#include "SceneCtrlPortItem.hxx"
#include "SceneLinkItem.hxx"
#include "QtGuiContext.hxx"
#include "InPort.hxx"
#include "OutPort.hxx"
+#include "Resource.hxx"
#include <cmath>
{
_im=0;
_jm=0;
+ _pas=10;
_sxm.clear();
_sym.clear();
_xm.clear();
{
getBoundingBox(_bloc,0);
explore(_bloc); // --- define the boundaries _xm[i] and _ym[j]
+ if (Scene::_addRowCols) addRowCols();
_im = _sxm.size();
_xm.reserve(_im);
DEBTRACE("_sxm.size()=" << _im);
for (int j=0; j<_jm; j++)
{
- char m[_im+1];
+ char* m = new char[_im+1];
for (int i=0; i<_im; i++)
if (cost(i,j))
m[i] = ' ';
m[i] = 'X';
m[_im] = 0;
DEBTRACE(m);
+ delete [] m;
}
}
QRectF bb = (item->mapToScene(item->boundingRect())).boundingRect();
qreal xp = bb.right();
qreal yp = (bb.top() + bb.bottom())*0.5;
+ DEBTRACE("xp,yp:"<<xp<<","<<yp);
int ifrom = -1;
for (int i=0; i<_im-1; i++)
- if (_xm[i+1] > xp)
+ if (_xm[i+1] >= xp && xp > _xm[i])
{
ifrom = i;
break;
}
int jfrom = -1;
for (int j=0; j<_jm-1; j++)
- if (_ym[j+1] > yp)
+ if (_ym[j+1] >= yp && yp > _ym[j])
{
jfrom = j;
break;
}
- while (!cost(ifrom,jfrom)) ifrom++; // --- from point is inside an obstacle
- //ifrom++;
+ //if ifrom or jfrom == -1 the port is outside the matrix
+ if(ifrom < 0 || jfrom < 0)return pair<int,int>(ifrom,jfrom);
+ while (ifrom < _im && !cost(ifrom,jfrom)) ifrom++; // --- from point is inside an obstacle
+
return pair<int,int>(ifrom,jfrom);
}
std::pair<int,int> LinkMatrix::cellFrom(YACS::ENGINE::OutGate* outp)
{
SubjectNode* subNode = _context->_mapOfSubjectNode[outp->getNode()];
- SceneItem* item = _context->_mapOfSceneItem[subNode];
+ SceneNodeItem* itemNode = dynamic_cast<SceneNodeItem*>(_context->_mapOfSceneItem[subNode]);
+ YASSERT(itemNode);
+ SceneHeaderNodeItem* itemHeader = dynamic_cast<SceneHeaderNodeItem*>(itemNode->getHeader());
+ YASSERT(itemHeader);
+ SceneCtrlPortItem *item = itemHeader->getCtrlOutPortItem();
+ YASSERT(item);
QRectF bb = (item->mapToScene(item->boundingRect())).boundingRect();
qreal xp = bb.right();
qreal yp = (bb.top() + bb.bottom())*0.5;
+ DEBTRACE("xp,yp:"<<xp<<","<<yp);
int ifrom = -1;
for (int i=0; i<_im-1; i++)
- if (_xm[i+1] > xp)
+ if (_xm[i+1] >= xp && xp > _xm[i])
{
ifrom = i;
break;
}
int jfrom = -1;
for (int j=0; j<_jm-1; j++)
- if (_ym[j+1] > yp)
+ if (_ym[j+1] >= yp && yp > _ym[j])
{
jfrom = j;
break;
}
- while (!cost(ifrom,jfrom)) ifrom++; // --- from point is inside an obstacle
- //ifrom++;
+ //if ifrom or jfrom == -1 the port is outside the matrix
+ if(ifrom < 0 || jfrom < 0)return pair<int,int>(ifrom,jfrom);
+ while (ifrom < _im && !cost(ifrom,jfrom)) ifrom++; // --- from point is inside an obstacle
+
return pair<int,int>(ifrom,jfrom);
}
QRectF bb = (item->mapToScene(item->boundingRect())).boundingRect();
qreal xp = bb.left();
qreal yp = (bb.top() + bb.bottom())*0.5;
+ DEBTRACE("xp,yp:"<<xp<<","<<yp);
int ito = -1;
for (int i=0; i<_im-1; i++)
- if (_xm[i+1] > xp)
+ if (_xm[i+1] >= xp && xp > _xm[i])
{
ito = i;
break;
}
int jto = -1;
for (int j=0; j<_jm-1; j++)
- if (_ym[j+1] > yp)
+ if (_ym[j+1] >= yp && yp > _ym[j])
{
jto = j;
break;
}
- while (!cost(ito,jto)) ito--; // --- from point is inside an obstacle
- //ito--;
+ //if ito or jto == -1 the port is outside the matrix
+ if(ito < 0 || jto < 0)return pair<int,int>(ito,jto);
+ while (ito >0 && !cost(ito,jto)) ito--; // --- to point is inside an obstacle
+
return pair<int,int>(ito,jto);
}
std::pair<int,int> LinkMatrix::cellTo(YACS::ENGINE::InGate* inp)
{
SubjectNode* subNode = _context->_mapOfSubjectNode[inp->getNode()];
- SceneItem* item = _context->_mapOfSceneItem[subNode];
+ SceneNodeItem* itemNode = dynamic_cast<SceneNodeItem*>(_context->_mapOfSceneItem[subNode]);
+ YASSERT(itemNode);
+ SceneHeaderNodeItem* itemHeader = dynamic_cast<SceneHeaderNodeItem*>(itemNode->getHeader());
+ YASSERT(itemHeader);
+ SceneCtrlPortItem *item = itemHeader->getCtrlInPortItem();
+ YASSERT(item);
QRectF bb = (item->mapToScene(item->boundingRect())).boundingRect();
qreal xp = bb.left();
qreal yp = (bb.top() + bb.bottom())*0.5;
+ DEBTRACE("xp,yp:"<<xp<<","<<yp);
int ito = -1;
for (int i=0; i<_im-1; i++)
- if (_xm[i+1] > xp)
+ if (_xm[i+1] >= xp && xp > _xm[i])
{
ito = i;
break;
}
int jto = -1;
for (int j=0; j<_jm-1; j++)
- if (_ym[j+1] > yp)
+ if (_ym[j+1] >= yp && yp > _ym[j])
{
jto = j;
break;
}
- while (!cost(ito,jto)) ito--; // --- from point is inside an obstacle
- //ito--;
+ //if ito or jto == -1 the port is outside the matrix
+ if(ito < 0 || jto < 0)return pair<int,int>(ito,jto);
+ while (ito > 0 && !cost(ito,jto)) ito--; // --- to point is inside an obstacle
+
return pair<int,int>(ito,jto);
}
LinkPath lp;
lp.clear();
int dim = lnp.size();
+ //use a random coefficient between 0.25 and 0.75 to try to separate links
+ double coef=-0.25+rand()%101*0.005;
+ coef=0.5 + coef* Resource::link_separation_weight/10.;
LNodePath::const_iterator it = lnp.begin();
for (int k=0; k<dim; k++)
{
int i = it->getX();
int j = it->getY();
+ DEBTRACE("i, j: " << i << " " << j << " Xmax, Ymax: " << _im << " " << _jm);
linkPoint a;
- a.x = 0.5*(_xm[i] + _xm[i+1]);
- a.y = 0.5*(_ym[j] + _ym[j+1]);
+
+ if ( (i+1)==_im ) {
+ a.x = _xm[i];
+ } else {
+ a.x = coef*_xm[i] + (1.-coef)*_xm[i+1];
+ };
+
+ if ( (j+1)==_jm ) {
+ a.y = _ym[j];
+ } else {
+ a.y = coef*_ym[j] + (1.-coef)*_ym[j+1];
+ };
+
lp.push_back(a);
DEBTRACE(a.x << " " << a.y);
++it;
return lp;
}
-int LinkMatrix::cost(int i, int j) const
+void LinkMatrix::incrementCost(LNodePath lnp)
{
- int ij = i*_jm +j;
- return _cost[ij];
+ int dim = lnp.size();
+ LNodePath::const_iterator it = lnp.begin();
+ for (; it != lnp.end(); ++it)
+ {
+ int i = it->getX();
+ int j = it->getY();
+ int ij = i*_jm +j;
+ _cost[ij] += Resource::link_separation_weight; // --- big cost, because distance is x2+y2
+
+ }
}
_sym.insert(bb.bottom() - margin);
}
}
+
+void LinkMatrix::addRowCols()
+{
+ {
+ set<double> sxmCpy = _sxm;
+ if (sxmCpy.empty()) return;
+ set<double>::iterator itx = sxmCpy.begin();
+ double xmin = *itx;
+ double xmax = xmin;
+ itx++;
+ for (; itx != sxmCpy.end(); ++itx)
+ {
+ xmax = *itx;
+ int nbpas = floor((xmax -xmin)/_pas);
+
+ if (nbpas >= 2)
+ {
+ double xpas = (xmax -xmin)/nbpas;
+ for (int i=1; i<nbpas; i++)
+ _sxm.insert(xmin +i*xpas);
+ }
+ xmin = xmax;
+ }
+ }
+ {
+ set<double> symCpy = _sym;
+ if (symCpy.empty()) return;
+ set<double>::iterator ity = symCpy.begin();
+ double ymin = *ity;
+ double ymax = ymin;
+ ity++;
+ for (; ity != symCpy.end(); ++ity)
+ {
+ ymax = *ity;
+ int nbpas = floor((ymax -ymin)/_pas);
+
+ if (nbpas >= 2)
+ {
+ double ypas = (ymax -ymin)/nbpas;
+ for (int i=1; i<nbpas; i++)
+ _sym.insert(ymin +i*ypas);
+ }
+ ymin = ymax;
+ }
+ }
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _LINKMATRIX_HXX_
#define _LINKMATRIX_HXX_
LinkMatrix(SceneComposedNodeItem* bloc);
virtual ~LinkMatrix();
void compute();
+ void addRowCols();
void explore(AbstractSceneItem *child, bool setObstacle=false);
void defineCost(AbstractSceneItem *child);
void getBoundingBox(SceneItem *obstacle, int margin, bool setObstacle=false);
std::list<linkdef> getListOfCtrlLinkDef();
std::list<linkdef> getListOfDataLinkDef();
LinkPath getPath(LNodePath lnp);
+ void incrementCost(LNodePath lnp);
- int cost(int i, int j) const;
+ inline int cost(int i, int j) const { return _cost[i*_jm +j]; };
inline int imax() const { return _im; };
inline int jmax() const { return _jm; };
SceneComposedNodeItem* _bloc;
int _im;
int _jm;
+ double _pas;
std::set<double> _sxm;
std::set<double> _sym;
std::vector<double> _xm;
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <iostream>
+#include <fstream>
+
+#include "ListJobs_GUI.hxx"
+#include "RuntimeSALOME.hxx"
+#include "GenericGui.hxx"
+#include "QtGuiContext.hxx"
+#include "YACSGuiLoader.hxx"
+#include "Logger.hxx"
+#include "YacsTrace.hxx"
+#include "LoadState.hxx"
+
+using namespace std;
+using namespace YACS::HMI;
+using namespace YACS::ENGINE;
+
+BatchJobsListDialog::BatchJobsListDialog(QString title,GenericGui* genericGui): QWidget(),_genericGui(genericGui),_proc(NULL) {
+
+ setWindowTitle(title);
+
+ // Connection to Salome Launcher
+ getSalomeLauncher();
+
+ // Add a layout
+ QBoxLayout* box = new QBoxLayout(QBoxLayout::TopToBottom, this);
+ setLayout(box);
+
+ _table = new QTableWidget(this);
+ _table->setColumnCount(4);
+
+ build_table();
+
+ // Add table
+ box->addWidget(_table);
+
+ // Add buttons
+ QWidget* buttons = build_buttons();
+ box->addWidget(buttons);
+
+ // No line selected
+ _ok->setEnabled(false);
+ _id = -1;
+
+ // Set timer to refresh table
+ _timer1 = new QTimer(this);
+ connect(_timer1, SIGNAL(timeout()), this, SLOT(build_table()));
+ _timer1->start(30000);
+
+}
+
+BatchJobsListDialog::~BatchJobsListDialog(){
+}
+
+void BatchJobsListDialog::getSalomeLauncher(){
+ YACS::ENGINE::RuntimeSALOME* runTime = YACS::ENGINE::getSALOMERuntime();
+ CORBA::ORB_ptr orb = runTime->getOrb();
+ SALOME_NamingService* NS = new SALOME_NamingService(orb);
+ CORBA::Object_var obj = NS->Resolve("/SalomeLauncher");
+ _salome_launcher = Engines::SalomeLauncher::_narrow(obj);
+ if (CORBA::is_nil(_salome_launcher))
+ throw YACS::Exception("Salome Launcher not reachable!!");
+}
+
+// Display list of current batch jobs and allow selection only on running jobs
+void BatchJobsListDialog::build_table() {
+
+ int irow = 0;
+
+ _table->clear();
+
+ Engines::JobsList* joblist = _salome_launcher->getJobsList();
+
+ int nblines = joblist->length();
+ _table->setRowCount(nblines);
+
+ QStringList titres;
+ titres << "Job Name" << "State" << "Resource" << "Launcher Id";
+ _table->setHorizontalHeaderLabels(titres);
+
+ for(int i=0;i<nblines;i++){
+ Engines::JobDescription descr = (*joblist)[i];
+ string jobType = CORBA::string_dup(descr.job_parameters.job_type);
+ // We display only jobs of type yacs_file
+ if(jobType.find("yacs_file")!=string::npos){
+ long jobId = descr.job_id;
+ ostringstream sstId;
+ sstId << jobId;
+ string jobName = CORBA::string_dup(descr.job_parameters.job_name);
+ string jobState = _salome_launcher->getJobState(jobId);
+ string jobMachine = CORBA::string_dup(descr.job_parameters.resource_required.name);
+ QTableWidgetItem* item0 = new QTableWidgetItem(jobName.c_str() , type_job);
+ QTableWidgetItem* item1 = new QTableWidgetItem(jobState.c_str() , type_state);
+ QTableWidgetItem* item2 = new QTableWidgetItem(jobMachine.c_str() , type_res );
+ QTableWidgetItem* item3 = new QTableWidgetItem(sstId.str().c_str(), type_id );
+ _table->setItem(irow, 0, item0);
+ _table->setItem(irow, 1, item1);
+ _table->setItem(irow, 2, item2);
+ _table->setItem(irow, 3, item3);
+ if(jobState != "RUNNING"){
+ item0->setFlags(Qt::NoItemFlags);
+ item1->setFlags(Qt::NoItemFlags);
+ item2->setFlags(Qt::NoItemFlags);
+ item3->setFlags(Qt::NoItemFlags);
+ }
+ else if(jobId == _id){
+ item0->setSelected(true);
+ item1->setSelected(true);
+ item2->setSelected(true);
+ item3->setSelected(true);
+ }
+ irow++;
+ }
+ }
+
+ connect(_table, SIGNAL( itemClicked(QTableWidgetItem*) ), this, SLOT( userCell(QTableWidgetItem*) ));
+
+}
+
+// Build buttons in a layout
+// -------------------------
+
+QWidget* BatchJobsListDialog::build_buttons() {
+ _ok = new QPushButton("OK" , this);
+ QPushButton* cancel = new QPushButton("Cancel", this);
+
+ connect(_ok , SIGNAL(clicked()), this, SLOT(userOK ()));
+ connect(cancel, SIGNAL(clicked()), this, SLOT(userCancel()));
+
+ QBoxLayout* layout = new QBoxLayout(QBoxLayout::LeftToRight, this);
+
+ layout->addWidget(_ok);
+ layout->addWidget(cancel);
+
+ QWidget* buttons = new QWidget(this);
+ buttons->setLayout(layout);
+
+ return(buttons);
+}
+
+// Click on a cell button
+// ----------------------
+
+void BatchJobsListDialog::userCell(QTableWidgetItem* cell) {
+ if ( cell->flags() ) {
+ int line = cell->row();
+ string sid = _table->item(line,3)->text().toStdString();
+ _id = atoi(sid.c_str());
+ _ok->setEnabled(true);
+
+ QTableWidget* table = cell->tableWidget();
+ for (int c=0; c<4; c++) {
+ QTableWidgetItem* it = table->item(line, c);
+ it->setSelected(true);
+ };
+ };
+}
+
+// Click on OK button
+// ------------------
+
+void BatchJobsListDialog::userOK() {
+
+ // get job file name
+ Engines::JobParameters* jobParam = _salome_launcher->getJobParameters(_id);
+ _jobFile = CORBA::string_dup(jobParam->job_file);
+ _dumpStateFile = QString("/tmp/%1/dumpState_%2.xml").arg(getenv("USER")).arg(QFileInfo(_jobFile).baseName());
+
+ // stop first timer and hide window
+ _timer1->stop();
+ hide();
+
+ // replace objref by string in YACS schema job file to avoid trying to reach remote objects
+ filterJobFile();
+
+ // display yacs graph
+ YACSGuiLoader *loader = _genericGui->getLoader();
+ _proc = loader->load(_filteredJobFile.toLatin1());
+ if (!_proc) {
+ QMessageBox msgBox(QMessageBox::Critical, "Import Batch Schema, native YACS XML format",
+ "The xml graph has not the native YACS XML format or is not readable." );
+ msgBox.exec();
+ }
+ else {
+ YACS::ENGINE::Logger* logger= _proc->getLogger("parser");
+ if(!logger->isEmpty()) {
+ DEBTRACE(logger->getStr());
+ };
+ _genericGui->createContext(_proc, _filteredJobFile, _filteredJobFile, false);
+ };
+
+ // start second timer to get remote graph state xml file
+ _timer2 = new QTimer(this);
+ connect(_timer2, SIGNAL(timeout()), this, SLOT(get_dump_file()));
+ _timer2->start(30000);
+ get_dump_file();
+}
+
+// Click on CANCEL button
+// ----------------------
+
+void BatchJobsListDialog::userCancel() {
+ _timer1->stop();
+ hide();
+}
+
+// get remote graph state xml file
+
+void BatchJobsListDialog::get_dump_file()
+{
+ int execState = YACS::NOTYETINITIALIZED;
+ // get batch job state
+ string jobState = _salome_launcher->getJobState(_id);
+ // get dump state remote file
+ bool ret = _salome_launcher->getJobDumpState(_id, QFileInfo(_dumpStateFile).absolutePath().toLatin1().constData());
+ if(ret){
+ // replace objref by string in dump state file
+ filterDumpStateFile();
+ // parse dump state file and load proc
+ YACS::ENGINE::loadState(_proc,_filteredDumpStateFile.toStdString());
+ // display remote graph states
+ GuiExecutor *executor = QtGuiContext::getQtCurrent()->getGuiExecutor();
+ execState = executor->updateSchema(jobState);
+ }
+ // stop timer if job is not running
+ if((execState!=YACS::RUNNING)&&(execState!=YACS::NOTYETINITIALIZED))
+ _timer2->stop();
+}
+
+// filtering of _jobFile to replace objref by string
+void BatchJobsListDialog::filterJobFile()
+{
+ _filteredJobFile = QString("/tmp/%1/%2.xml").arg(getenv("USER")).arg(QFileInfo(_jobFile).baseName());
+ // reading input file
+ ifstream infile(_jobFile.toStdString().c_str());
+ if(!infile){
+ string errmsg = "File " + _jobFile.toStdString() + " doesn't exist!!";
+ throw YACS::Exception(errmsg);
+ }
+ string buffer;
+ vector<string> objref;
+ while( !infile.eof() ){
+ getline(infile,buffer);
+ // look for objref and memorize them in vector
+ if( (buffer.find("objref") != string::npos) && (buffer.find("IDL") != string::npos) ){
+ size_t pos1 = buffer.find("\"");
+ size_t pos2 = buffer.find("\"",pos1+1);
+ objref.push_back(buffer.substr(pos1+1,pos2-pos1-1));
+ }
+ }
+ infile.close();
+ // reread the input file
+ infile.open(_jobFile.toStdString().c_str());
+ // open the output file
+ ofstream outfile(_filteredJobFile.toStdString().c_str());
+ if(!outfile){
+ string errmsg = "Impossible to create the file " + _filteredJobFile.toStdString() + "!!";
+ throw YACS::Exception(errmsg);
+ }
+ while( !infile.eof() ){
+ getline(infile,buffer);
+ // replace objref by string
+ if( ((buffer.find("objref") == string::npos) || (buffer.find("IDL") == string::npos)) && (buffer.find("/objref") == string::npos) ){
+ string tmp = buffer;
+ for(int i=0;i<objref.size();i++){
+ size_t pos = buffer.find(objref[i]);
+ if(pos != string::npos)
+ tmp = buffer.substr(0,pos) + "string" + buffer.substr(pos+objref[i].size());
+ }
+ outfile << tmp << endl;
+ }
+ }
+}
+
+// filtering of _dumpStateFile to replace objref by string
+void BatchJobsListDialog::filterDumpStateFile()
+{
+ string buffer;
+ _filteredDumpStateFile = QString("/tmp/%1/filtered_%2.xml").arg(getenv("USER")).arg(QFileInfo(_dumpStateFile).baseName());
+ ifstream infile(_dumpStateFile.toStdString().c_str());
+ if(!infile){
+ string errmsg = "File " + _dumpStateFile.toStdString() + " doesn't exist!!";
+ throw YACS::Exception(errmsg);
+ }
+ ofstream outfile(_filteredDumpStateFile.toStdString().c_str());
+ if(!outfile){
+ string errmsg = "Impossible to create the file " + _filteredDumpStateFile.toStdString() + "!!";
+ throw YACS::Exception(errmsg);
+ }
+ // replace objref by string in dump state file
+ while( !infile.eof() ){
+ getline(infile,buffer);
+ size_t pos = buffer.find("objref");
+ while(pos != string::npos){
+ buffer.replace(pos,6,"string");
+ pos = buffer.find("objref");
+ }
+ outfile << buffer << endl;
+ }
+}
+
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef LISTJOBS_GUI_H
+#define LISTJOBS_GUI_H
+
+#include <QtGui/QtGui>
+#include "SALOME_NamingService.hxx"
+#include "SALOME_ContainerManager.hh"
+
+// Kind of column
+// --------------
+
+#define type_job 0
+#define type_state 1
+#define type_res 2
+#define type_id 3
+
+// Class for the dialog box
+// ------------------------
+
+
+namespace YACS
+{
+
+ namespace ENGINE
+ {
+ class Proc;
+ }
+ namespace HMI
+ {
+ class GenericGui;
+
+ class BatchJobsListDialog: public QWidget {
+ Q_OBJECT
+
+ public:
+ BatchJobsListDialog(QString title,GenericGui* genericGui);
+ virtual ~BatchJobsListDialog();
+
+ private:
+ QWidget* build_buttons();
+ void getSalomeLauncher();
+ void filterJobFile();
+ void filterDumpStateFile();
+
+ private slots:
+ void userOK();
+ void userCancel();
+ void userCell(QTableWidgetItem* cell);
+ void build_table();
+ void get_dump_file();
+
+ protected:
+ QTimer* _timer1, *_timer2;
+ QPushButton* _ok;
+ QTableWidget* _table;
+ QString _jobFile;
+ QString _dumpStateFile;
+ QString _filteredJobFile;
+ QString _filteredDumpStateFile;
+ QString _hostname;
+ long _id;
+ Engines::SalomeLauncher_var _salome_launcher;
+ GenericGui* _genericGui;
+ YACS::ENGINE::Proc* _proc;
+ };
+ }
+}
+
+#endif // LISTJOBS_GUI_H
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "LogViewer.hxx"
#include <fstream>
#include <sstream>
void LogViewer::readFile(std::string fileName)
{
- std::fstream f(fileName.c_str());
+ std::ifstream f(fileName.c_str());
std::stringstream hfile;
hfile << f.rdbuf();
string atext = _label + "\n" + fileName + "\n\n";
browser->setText(qtext + hfile.str().c_str());
f.close();
}
+
+ContainerLogViewer::ContainerLogViewer(std::string label, QWidget *parent):LogViewer(label,parent)
+{
+ gridLayout->removeWidget(browser);
+ gridLayout->addWidget(browser, 0, 0, 1, 3);
+
+ QPushButton* next = new QPushButton("next execution",this);
+ gridLayout->addWidget(next, 1, 1, 1, 1);
+ connect(next,SIGNAL(clicked()),this, SLOT(onNext()));
+ QPushButton* previous = new QPushButton("previous execution",this);
+ gridLayout->addWidget(previous, 1, 2, 1, 1);
+ connect(previous,SIGNAL(clicked()),this, SLOT(onPrevious()));
+}
+
+void ContainerLogViewer::readFile(std::string fileName)
+{
+ LogViewer::readFile(fileName);
+ //move cursor to the end
+ QTextCursor cursor=browser->textCursor();
+ cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
+ browser->setTextCursor(cursor);
+}
+
+//go to next begin execution schema
+void ContainerLogViewer::onNext()
+{
+ QTextCursor orig = browser->textCursor();
+ QTextCursor find_result = browser->document()->find("**************************Begin schema execution", orig);
+
+ if(find_result.isNull())
+ {
+ //Try to find from the beginning
+ find_result = browser->document()->find("**************************Begin schema execution",0);
+ }
+
+ if(!find_result.isNull())
+ browser->setTextCursor(find_result);
+}
+
+//go to previous begin execution schema
+void ContainerLogViewer::onPrevious()
+{
+ QTextCursor orig = browser->textCursor();
+ QTextCursor find_result = browser->document()->find("**************************Begin schema execution",
+ orig, QTextDocument::FindBackward);
+ if(find_result.isNull())
+ {
+ //Try to find from the end
+ find_result = browser->document()->find("**************************Begin schema execution",
+ browser->document()->characterCount()-1, QTextDocument::FindBackward);
+ }
+
+ if(!find_result.isNull())
+ browser->setTextCursor(find_result);
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _LOGVIEWER_HXX_
#define _LOGVIEWER_HXX_
LogViewer(std::string label, QWidget *parent = 0);
virtual ~LogViewer();
void setText(std::string text);
- void readFile(std::string fileName);
+ virtual void readFile(std::string fileName);
protected:
std::string _label;
};
+class ContainerLogViewer: public LogViewer
+{
+ Q_OBJECT
+
+public slots:
+ virtual void onNext();
+ virtual void onPrevious();
+
+public:
+ ContainerLogViewer(std::string label, QWidget *parent = 0);
+ virtual void readFile(std::string fileName);
+};
+
#endif
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>logViewerDialog</class>
- <widget class="QDialog" name="logViewerDialog" >
- <property name="geometry" >
+ <widget class="QDialog" name="logViewerDialog">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>500</width>
+ <width>400</width>
<height>400</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="font" >
+ <font>
+ <family>Monospace</family>
+ </font>
+ </property>
+ <property name="windowTitle">
<string>Dialog</string>
</property>
- <layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" >
- <widget class="QTextEdit" name="browser" />
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QTextEdit" name="browser"/>
</item>
- <item row="1" column="0" >
- <widget class="QPushButton" name="pushButton" >
- <property name="text" >
+ <item row="1" column="0">
+ <widget class="QPushButton" name="pushButton">
+ <property name="text">
<string>close</string>
</property>
</widget>
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
libdir = $(prefix)/lib/salome
bindir = $(prefix)/bin/salome
lib_LTLIBRARIES = libGenericGui.la
-BUILT_SOURCES = \
+UIC_FILES = \
ui_FormComponent.h \
ui_FormContainer.h \
ui_FormEachLoop.h \
ui_FormEditTree.h \
ui_FormLoop.h \
ui_FormSchemaView.h \
+ ui_FormUndoRedo.h \
ui_LogViewer.h \
ui_TablePorts.h \
ui_TableSwitch.h \
- ui_CaseSwitch.h
+ ui_CaseSwitch.h \
+ ui_FormOptimizerLoop.h
+
+BUILT_SOURCES = \
+ $(UIC_FILES)
+
+EXTRA_DIST = \
+ FormComponent.ui \
+ FormContainer.ui \
+ FormEachLoop.ui \
+ FormEditItem.ui \
+ FormEditTree.ui \
+ FormLoop.ui \
+ FormSchemaView.ui \
+ FormUndoRedo.ui \
+ LogViewer.ui \
+ TablePorts.ui \
+ TableSwitch.ui \
+ CaseSwitch.ui \
+ FormOptimizerLoop.ui
libGenericGui_la_SOURCES = \
+ GenericGuiExport.hxx \
+ CaseSwitch.hxx \
CaseSwitch.cxx \
- CaseSwitch_moc.cxx \
+ CatalogWidget.hxx \
CatalogWidget.cxx \
+ EditionBloc.hxx \
EditionBloc.cxx \
- EditionBloc_moc.cxx \
+ EditionComponent.hxx \
EditionComponent.cxx \
- EditionComponent_moc.cxx \
+ EditionContainer.hxx \
EditionContainer.cxx \
- EditionContainer_moc.cxx \
+ EditionControlLink.hxx \
EditionControlLink.cxx \
- EditionControlLink_moc.cxx \
+ EditionDataLink.hxx \
EditionDataLink.cxx \
- EditionDataLink_moc.cxx \
+ EditionDataType.hxx \
EditionDataType.cxx \
- EditionDataType_moc.cxx \
+ EditionElementaryNode.hxx \
EditionElementaryNode.cxx \
- EditionElementaryNode_moc.cxx \
+ EditionForEachLoop.hxx \
EditionForEachLoop.cxx \
- EditionForEachLoop_moc.cxx \
+ EditionOptimizerLoop.hxx \
+ EditionOptimizerLoop.cxx \
+ EditionInputPort.hxx \
EditionInputPort.cxx \
- EditionInputPort_moc.cxx \
+ EditionLoop.hxx \
EditionLoop.cxx \
- EditionLoop_moc.cxx \
+ EditionNode.hxx \
EditionNode.cxx \
- EditionNode_moc.cxx \
+ EditionOutNode.hxx \
EditionOutNode.cxx \
- EditionOutNode_moc.cxx \
+ EditionOutputPort.hxx \
EditionOutputPort.cxx \
- EditionOutputPort_moc.cxx \
+ EditionPresetNode.hxx \
EditionPresetNode.cxx \
- EditionPresetNode_moc.cxx \
+ EditionProc.hxx \
EditionProc.cxx \
- EditionProc_moc.cxx \
+ EditionPyFunc.hxx \
EditionPyFunc.cxx \
- EditionPyFunc_moc.cxx \
+ EditionSalomeNode.hxx \
EditionSalomeNode.cxx \
- EditionSalomeNode_moc.cxx \
+ EditionScript.hxx \
EditionScript.cxx \
- EditionScript_moc.cxx \
+ EditionStudyInNode.hxx \
EditionStudyInNode.cxx \
- EditionStudyInNode_moc.cxx \
+ EditionStudyOutNode.hxx \
EditionStudyOutNode.cxx \
- EditionStudyOutNode_moc.cxx \
+ EditionSwitch.hxx \
EditionSwitch.cxx \
- EditionSwitch_moc.cxx \
+ EditionWhile.hxx \
EditionWhile.cxx \
- EditionWhile_moc.cxx \
+ FormComponent.hxx \
FormComponent.cxx \
- FormComponent_moc.cxx \
+ FormContainer.hxx \
FormContainer.cxx \
- FormContainer_moc.cxx \
+ FormEachLoop.hxx \
FormEachLoop.cxx \
- FormEachLoop_moc.cxx \
+ FormEditItem.hxx \
FormEditItem.cxx \
- FormEditItem_moc.cxx \
+ FormEditTree.hxx \
FormEditTree.cxx \
- FormEditTree_moc.cxx \
+ FormLoop.hxx \
FormLoop.cxx \
- FormLoop_moc.cxx \
+ FormOptimizerLoop.hxx \
+ FormOptimizerLoop.cxx \
+ FormSchemaView.hxx \
FormSchemaView.cxx \
- FormSchemaView_moc.cxx \
+ FormUndoRedo.hxx \
+ FormUndoRedo.cxx \
+ GenericGui.hxx \
GenericGui.cxx \
- GenericGui_moc.cxx \
+ GraphicsView.hxx \
GraphicsView.cxx \
- GraphicsView_moc.cxx \
+ GuiEditor.hxx \
GuiEditor.cxx \
+ GuiExecutor.hxx \
GuiExecutor.cxx \
+ GuiObserver_i.hxx \
GuiObserver_i.cxx \
+ ItemEdition.hxx \
ItemEdition.cxx \
- ItemEdition_moc.cxx \
+ ItemMimeData.hxx \
ItemMimeData.cxx \
+ LinkAStar.hxx \
LinkAStar.cxx \
+ LinkMatrix.hxx \
LinkMatrix.cxx \
+ ListJobs_GUI.hxx \
+ ListJobs_GUI.cxx \
+ LogViewer.hxx \
LogViewer.cxx \
- LogViewer_moc.cxx \
+ Menus.hxx \
Menus.cxx \
- Menus_moc.cxx \
+ Message.hxx \
Message.cxx \
+ PropertyEditor.hxx \
+ PropertyEditor.cxx \
+ QtGuiContext.hxx \
QtGuiContext.cxx \
+ Resource.hxx \
+ Resource.cxx \
+ SceneComposedNodeItem.hxx \
SceneComposedNodeItem.cxx \
+ SceneCtrlInPortItem.hxx \
SceneCtrlInPortItem.cxx \
+ SceneCtrlLinkItem.hxx \
SceneCtrlLinkItem.cxx \
+ SceneCtrlOutPortItem.hxx \
SceneCtrlOutPortItem.cxx \
+ SceneCtrlPortItem.hxx \
SceneCtrlPortItem.cxx \
Scene.cxx \
+ Scene.hxx \
+ SceneBlocItem.hxx \
SceneBlocItem.cxx \
+ SceneDataPortItem.hxx \
SceneDataPortItem.cxx \
+ SceneDSLinkItem.hxx \
+ SceneDSLinkItem.cxx \
+ SceneElementaryNodeItem.hxx \
SceneElementaryNodeItem.cxx \
+ SceneHeaderItem.hxx \
SceneHeaderItem.cxx \
+ SceneHeaderNodeItem.hxx \
SceneHeaderNodeItem.cxx \
+ SceneInPortItem.hxx \
SceneInPortItem.cxx \
+ SceneItem.hxx \
SceneItem.cxx \
+ SceneLinkItem.hxx \
SceneLinkItem.cxx \
+ SceneNodeItem.hxx \
SceneNodeItem.cxx \
+ SceneObserverItem.hxx \
SceneObserverItem.cxx \
+ SceneOutPortItem.hxx \
SceneOutPortItem.cxx \
+ ScenePortItem.hxx \
ScenePortItem.cxx \
+ SceneProcItem.hxx \
SceneProcItem.cxx \
+ SceneTextItem.hxx \
SceneTextItem.cxx \
+ SchemaComponentItem.hxx \
SchemaComponentItem.cxx \
- SchemaComponentItem_moc.cxx \
+ SchemaComposedNodeItem.hxx \
SchemaComposedNodeItem.cxx \
- SchemaComposedNodeItem_moc.cxx \
+ SchemaContainerItem.hxx \
SchemaContainerItem.cxx \
- SchemaContainerItem_moc.cxx \
+ SchemaDataTypeItem.hxx \
SchemaDataTypeItem.cxx \
- SchemaDataTypeItem_moc.cxx \
+ SchemaDirContainersItem.hxx \
SchemaDirContainersItem.cxx \
- SchemaDirContainersItem_moc.cxx \
+ SchemaDirLinksItem.hxx \
SchemaDirLinksItem.cxx \
- SchemaDirLinksItem_moc.cxx \
+ SchemaDirTypesItem.hxx \
SchemaDirTypesItem.cxx \
- SchemaDirTypesItem_moc.cxx \
+ SchemaInPortItem.hxx \
SchemaInPortItem.cxx \
- SchemaInPortItem_moc.cxx \
+ SchemaItem.hxx \
SchemaItem.cxx \
- SchemaItem_moc.cxx \
+ SchemaLinkItem.hxx \
SchemaLinkItem.cxx \
- SchemaLinkItem_moc.cxx \
+ SchemaModel.hxx \
SchemaModel.cxx \
- SchemaModel_moc.cxx \
+ SchemaNodeItem.hxx \
SchemaNodeItem.cxx \
- SchemaNodeItem_moc.cxx \
+ SchemaOutPortItem.hxx \
SchemaOutPortItem.cxx \
- SchemaOutPortItem_moc.cxx \
+ SchemaProcItem.hxx \
SchemaProcItem.cxx \
- SchemaProcItem_moc.cxx \
+ SchemaReferenceItem.hxx \
SchemaReferenceItem.cxx \
- SchemaReferenceItem_moc.cxx \
+ TablePortsEdition.hxx \
TablePortsEdition.cxx \
- TablePortsEdition_moc.cxx \
+ TableSwitch.hxx \
TableSwitch.cxx \
- TableSwitch_moc.cxx \
+ TreeView.hxx \
TreeView.cxx \
- TreeView_moc.cxx \
+ ValueDelegate.hxx \
ValueDelegate.cxx \
- ValueDelegate_moc.cxx \
+ VisitorSaveGuiSchema.hxx \
VisitorSaveGuiSchema.cxx \
- WrapGraphicsView_moc.cxx \
+ YACSWidgets.hxx \
+ YACSWidgets.cxx \
+ YACSGuiLoader.hxx \
YACSGuiLoader.cxx
+MOC_FILES = \
+ CaseSwitch_moc.cxx \
+ EditionBloc_moc.cxx \
+ EditionComponent_moc.cxx \
+ EditionContainer_moc.cxx \
+ EditionControlLink_moc.cxx \
+ EditionDataLink_moc.cxx \
+ EditionDataType_moc.cxx \
+ EditionElementaryNode_moc.cxx \
+ EditionForEachLoop_moc.cxx \
+ EditionOptimizerLoop_moc.cxx \
+ EditionInputPort_moc.cxx \
+ EditionLoop_moc.cxx \
+ EditionNode_moc.cxx \
+ EditionOutNode_moc.cxx \
+ EditionOutputPort_moc.cxx \
+ EditionPresetNode_moc.cxx \
+ EditionProc_moc.cxx \
+ EditionPyFunc_moc.cxx \
+ EditionSalomeNode_moc.cxx \
+ EditionScript_moc.cxx \
+ EditionStudyInNode_moc.cxx \
+ EditionStudyOutNode_moc.cxx \
+ EditionSwitch_moc.cxx \
+ EditionWhile_moc.cxx \
+ FormComponent_moc.cxx \
+ FormContainer_moc.cxx \
+ FormEachLoop_moc.cxx \
+ FormEditItem_moc.cxx \
+ FormEditTree_moc.cxx \
+ FormLoop_moc.cxx \
+ FormOptimizerLoop_moc.cxx \
+ FormSchemaView_moc.cxx \
+ FormUndoRedo_moc.cxx \
+ GenericGui_moc.cxx \
+ GraphicsView_moc.cxx \
+ ItemEdition_moc.cxx \
+ ListJobs_GUI_moc.cxx \
+ LogViewer_moc.cxx \
+ Menus_moc.cxx \
+ PropertyEditor_moc.cxx \
+ SchemaComponentItem_moc.cxx \
+ SchemaComposedNodeItem_moc.cxx \
+ SchemaContainerItem_moc.cxx \
+ SchemaDataTypeItem_moc.cxx \
+ SchemaDirContainersItem_moc.cxx \
+ SchemaDirLinksItem_moc.cxx \
+ SchemaDirTypesItem_moc.cxx \
+ SchemaInPortItem_moc.cxx \
+ SchemaItem_moc.cxx \
+ SchemaLinkItem_moc.cxx \
+ SchemaModel_moc.cxx \
+ SchemaNodeItem_moc.cxx \
+ SchemaOutPortItem_moc.cxx \
+ SchemaProcItem_moc.cxx \
+ SchemaReferenceItem_moc.cxx \
+ TablePortsEdition_moc.cxx \
+ TableSwitch_moc.cxx \
+ TreeView_moc.cxx \
+ YACSWidgets_moc.cxx \
+ ValueDelegate_moc.cxx
+
+nodist_libGenericGui_la_SOURCES = \
+ $(MOC_FILES)
libGenericGui_la_CXXFLAGS = \
$(qt4_cppflags) \
$(qsci4_cppflags) \
$(THREAD_DEF) \
$(PYTHON_CPPFLAGS) \
+ $(EXPAT_INCLUDES) \
$(GRAPHVIZ_CPPFLAGS) \
+ $(OMNIORB_CXXFLAGS) \
$(OMNIORB_INCLUDES) \
$(LIBXML_INCLUDES) \
+ $(EXPAT_INCLUDES) \
-I$(KERNEL_ROOT_DIR)/include/salome \
+ -I. \
+ -I$(srcdir) \
-I$(srcdir)/../bases \
-I$(srcdir)/../engine \
-I$(srcdir)/../runtime \
-I$(srcdir)/../yacsloader \
-I$(srcdir)/../hmi \
+ -I$(srcdir)/../salomewrap \
-I../../idl \
-I../yacsorb
../yacsloader/libYACSloader.la \
../salomewrap/libSalomeWrap.la \
../hmi/libHMI.la \
+ $(KERNEL_LDFLAGS) -lSalomeResourcesManager \
$(EXPAT_LIBS) $(LIBXML_LIBS) $(GRAPHVIZ_LIBADD)
-LIBICONS = \
- add_in_study.png \
- add_node.png \
- arrange_nodes.png \
- autoComputeLink.png \
- block_node.png \
- breakpoints_active.png \
- breakpoints.png \
- change_informations.png \
- component.png \
- connect_to_batch_session.png \
- container.png \
- control_link.png \
- control_view.png \
- copy.png \
- cut.png \
- dataflow_view.png \
- data_link.png \
- datastream_view.png \
- delete.png \
- execute_in_batch.png \
- export_dataflow.png \
- filter_next_steps.png \
- filter_notification.png \
- folder_cyan.png \
- folder_cyan_open.png \
- force2nodeLink.png \
- full_view.png \
- icon_down.png \
- icon_insert.png \
- icon_minus.png \
- icon_plus.png \
- icon_select.png \
- icon_select.png \
- icon_text.png \
- icon_up.png \
- import_dataflow.png \
- import_superv_dataflow.png \
- in_port.png \
- insert_file.png \
- kill.png \
- load_execution_state.png \
- loop_node.png \
- mode_continue.png \
- modify_dataflow.png \
- modify_superv_dataflow.png \
- ModuleYacs.png \
- new_batch_execution.png \
- new_block_node.png \
- new_corba_component.png \
- new_corba_service_node.png \
- new_cpp_node.png \
- new_dataflow.png \
- new_edition.png \
- new_execution.png \
- new_foreach_loop_node.png \
- new_for_loop_node.png \
- new_from_library_node.png \
- new_inline_function_node.png \
- new_inline_script_node.png \
- new_link.png \
- new_nodenode_service_node.png \
- new_salome_component.png \
- new_salomepy_component.png \
- new_salome_service_node.png \
- new_service_inline_node.png \
- new_switch_loop_node.png \
- new_while_loop_node.png \
- new_xml_node.png \
- node.png \
- ob_service_node.png \
- out_port.png \
- paste.png \
- pause.png \
- rebuild_links.png \
- reload.png \
- remote_run.png \
- reset.png \
- resume.png \
- run_active.png \
- run_object.png \
- run.png \
- sample.png \
- save_dataflow.png \
- save_dataflow_state.png \
- schema.png \
- simplifyLink.png \
- step_by_step_active.png \
- step_by_step.png \
- stream_link.png \
- suspend_resume.png \
- switch_node.png \
- table_view.png \
- toggle_stop_on_error.png \
- toggleVisibility.png \
- whatsThis.png
+ICONS = \
+ resources/add_in_study.png \
+ resources/add_node.png \
+ resources/addRowCols.png \
+ resources/arrange_nodes.png \
+ resources/autoComputeLink.png \
+ resources/block_node.png \
+ resources/breakpoints_active.png \
+ resources/breakpoints.png \
+ resources/centerOnNode.png \
+ resources/shrinkExpand.png \
+ resources/change_informations.png \
+ resources/component.png \
+ resources/connect_to_batch_session.png \
+ resources/container.png \
+ resources/control_link.png \
+ resources/control_view.png \
+ resources/copy.png \
+ resources/cut.png \
+ resources/dataflow_view.png \
+ resources/data_link.png \
+ resources/datastream_view.png \
+ resources/delete.png \
+ resources/emphasisLink.png \
+ resources/execute_in_batch.png \
+ resources/export_dataflow.png \
+ resources/filter_next_steps.png \
+ resources/filter_notification.png \
+ resources/folder_cyan.png \
+ resources/folder_cyan_open.png \
+ resources/force2nodeLink.png \
+ resources/full_view.png \
+ resources/hideLink.png \
+ resources/icon_down.png \
+ resources/icon_insert.png \
+ resources/icon_minus.png \
+ resources/icon_plus.png \
+ resources/icon_select.png \
+ resources/icon_text.png \
+ resources/icon_up.png \
+ resources/import_dataflow.png \
+ resources/import_superv_dataflow.png \
+ resources/in_port.png \
+ resources/insert_file.png \
+ resources/kill.png \
+ resources/load_execution_state.png \
+ resources/loop_node.png \
+ resources/mode_continue.png \
+ resources/modify_dataflow.png \
+ resources/modify_superv_dataflow.png \
+ resources/ModuleYacs.png \
+ resources/new_batch_execution.png \
+ resources/new_block_node.png \
+ resources/new_corba_component.png \
+ resources/new_corba_service_node.png \
+ resources/new_cpp_node.png \
+ resources/new_dataflow.png \
+ resources/new_edition.png \
+ resources/new_execution.png \
+ resources/new_foreach_loop_node.png \
+ resources/new_for_loop_node.png \
+ resources/new_from_library_node.png \
+ resources/new_inline_function_node.png \
+ resources/new_inline_script_node.png \
+ resources/new_link.png \
+ resources/new_nodenode_service_node.png \
+ resources/new_salome_component.png \
+ resources/new_salomepy_component.png \
+ resources/new_salome_service_node.png \
+ resources/new_service_inline_node.png \
+ resources/new_switch_loop_node.png \
+ resources/new_while_loop_node.png \
+ resources/new_xml_node.png \
+ resources/node.png \
+ resources/ob_service_node.png \
+ resources/out_port.png \
+ resources/paste.png \
+ resources/pause.png \
+ resources/rebuild_links.png \
+ resources/redo.png \
+ resources/reload.png \
+ resources/remote_run.png \
+ resources/reset.png \
+ resources/resume.png \
+ resources/run_active.png \
+ resources/run_object.png \
+ resources/run.png \
+ resources/batch.png \
+ resources/sample.png \
+ resources/save_dataflow.png \
+ resources/save_dataflow_state.png \
+ resources/schema.png \
+ resources/showLink.png \
+ resources/simplifyLink.png \
+ resources/step_by_step_active.png \
+ resources/step_by_step.png \
+ resources/straightLink.png \
+ resources/stream_link.png \
+ resources/suspend_resume.png \
+ resources/switch_node.png \
+ resources/table_view.png \
+ resources/toggle_stop_on_error.png \
+ resources/toggleVisibility.png \
+ resources/undo.png \
+ resources/whatsThis.png \
+ resources/zoomToBloc.png
salomeresdir = $(prefix)/share/salome/resources/@MODULE_NAME@
dist_salomeres_DATA = $(QMFILES) ${ICONS}
-ICONS = $(LIBICONS:%=resources/%)
ui_%.h: %.ui
clean-local-qt :
- rm -f *_moc.cxx *_qrc.cxx
+ rm -f *_moc.cxx *_qrc.cxx ui_*.h
-clean-local: clean-local-qt
\ No newline at end of file
+clean-local: clean-local-qt
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Menus.hxx"
#include "QtGuiContext.hxx"
#include "guiObservers.hxx"
#include "DataPort.hxx"
#include "DataNode.hxx"
+#include "ServiceNode.hxx"
#include "InlineNode.hxx"
#include <QMenu>
MenusBase::MenusBase()
{
- _dummyAct = new QAction(tr("No Action"), this);
+ _dummyAct = new QAction(tr("Elapse Time Statistics"), this);
// _dummyAct->setShortcut(tr("Ctrl+y"));
- _dummyAct->setStatusTip(tr("This is just the title"));
- _dummyAct->setToolTip(tr("the menu title"));
+ _dummyAct->setStatusTip(tr("Elapse Time Statistics"));
+ _dummyAct->setToolTip(tr("Elapse Time Statistics"));
connect(_dummyAct, SIGNAL(triggered()), this, SLOT(dummyAction()));
}
void MenusBase::dummyAction()
{
DEBTRACE("MenusBase::dummyAction");
+ QtGuiContext::_counters->stats();
+}
+
+void MenusBase::foreachAction(QAction* act)
+{
+ DEBTRACE(act->text().toStdString());
+ GenericGui *gmain = QtGuiContext::getQtCurrent()->getGMain();
+ gmain->createForEachLoop(act->text().toStdString());
}
void MenusBase::addHeader(QMenu &m, const QString &h)
m.addSeparator();
}
+void MenusBase::addForEachMenu(QMenu *m, QActionGroup* actgroup)
+{
+ QPixmap pixmap;
+ pixmap.load("icons:new_foreach_loop_node.png");
+
+ QMenu *ForEachMenu=m->addMenu(QIcon(pixmap),"ForEachLoop");
+
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ std::map<std::string, TypeCode*>::const_iterator it = proc->typeMap.begin();
+ QAction* act;
+ for (; it != proc->typeMap.end(); ++it)
+ {
+ act=actgroup->addAction((*it).first.c_str());
+ ForEachMenu->addAction(act);
+ }
+
+ connect(actgroup, SIGNAL(triggered(QAction*)), this, SLOT(foreachAction(QAction*)));
+
+}
+
//=======================================================================================
ComposedNodeMenu::ComposedNodeMenu() : MenusBase()
GenericGui *gmain = QtGuiContext::getQtCurrent()->getGMain();
bool isEdition = QtGuiContext::getQtCurrent()->isEdition();
QMenu menu(m, caller);
+ QActionGroup actgroup(this);
addHeader(menu, m);
if (isEdition)
{
CNmenu->addAction(gmain->_blockNodeAct);
CNmenu->addSeparator();
CNmenu->addAction(gmain->_FORNodeAct);
- CNmenu->addAction(gmain->_FOREACHNodeAct);
+ addForEachMenu(CNmenu,&actgroup);
CNmenu->addAction(gmain->_WHILENodeAct);
CNmenu->addAction(gmain->_SWITCHNodeAct);
+ CNmenu->addAction(gmain->_OptimizerLoopAct);
menu.addSeparator();
}
- menu.addAction(gmain->_toggleSceneItemVisibleAct);
+// menu.addAction(gmain->_toggleSceneItemVisibleAct);
menu.addAction(gmain->_arrangeLocalNodesAct);
menu.addAction(gmain->_arrangeRecurseNodesAct);
menu.addSeparator();
+ menu.addAction(gmain->_showOnlyCtrlLinksAct);
+ menu.addAction(gmain->_showCtrlLinksAct);
+ menu.addAction(gmain->_hideCtrlLinksAct);
+ menu.addAction(gmain->_emphasisPortLinksAct);
+ menu.addAction(gmain->_deEmphasizeAllAct);
+ menu.addSeparator();
+ menu.addAction(gmain->_zoomToBlocAct);
+ menu.addAction(gmain->_centerOnNodeAct);
+ menu.addAction(gmain->_shrinkExpand);
menu.addAction(gmain->_computeLinkAct);
- menu.addAction(gmain->_toggleAutomaticComputeLinkAct);
- menu.addAction(gmain->_toggleSimplifyLinkAct);
- menu.addAction(gmain->_toggleForce2NodesLinkAct);
+// menu.addAction(gmain->_toggleAutomaticComputeLinkAct);
+// menu.addAction(gmain->_toggleSimplifyLinkAct);
+// menu.addAction(gmain->_toggleForce2NodesLinkAct);
+// menu.addAction(gmain->_toggleAddRowColsAct);
if (isEdition)
{
menu.addSeparator();
menu.addAction(gmain->_cutItemAct);
menu.addAction(gmain->_copyItemAct);
menu.addAction(gmain->_pasteItemAct);
+ menu.addAction(gmain->_putInBlocAct);
+
+ Subject* sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
+ SubjectNode *sin = dynamic_cast<SubjectNode*>(sub);
+ if(sin && !sin->isValid())
+ {
+ menu.addSeparator();
+ menu.addAction(gmain->_getErrorReportAct);
+ menu.addAction(gmain->_getErrorDetailsAct);
+ }
+ }
+ else
+ {
+ menu.addAction(gmain->_getErrorReportAct);
+ menu.addAction(gmain->_getErrorDetailsAct);
}
menu.exec(globalPos);
}
bool isEdition = QtGuiContext::getQtCurrent()->isEdition();
QMenu menu(m, caller);
addHeader(menu, m);
+ QActionGroup actgroup(this);
if (isEdition)
{
menu.addAction(gmain->_runLoadedSchemaAct);
CNmenu->addAction(gmain->_blockNodeAct);
CNmenu->addSeparator();
CNmenu->addAction(gmain->_FORNodeAct);
- CNmenu->addAction(gmain->_FOREACHNodeAct);
+ addForEachMenu(CNmenu,&actgroup);
CNmenu->addAction(gmain->_WHILENodeAct);
CNmenu->addAction(gmain->_SWITCHNodeAct);
+ CNmenu->addAction(gmain->_OptimizerLoopAct);
menu.addSeparator();
menu.addAction(gmain->_pasteItemAct);
menu.addSeparator();
}
menu.addAction(gmain->_getYacsContainerLogAct);
menu.addSeparator();
- menu.addAction(gmain->_toggleSceneItemVisibleAct);
+ menu.addAction(gmain->_showAllLinksAct);
+ menu.addAction(gmain->_hideAllLinksAct);
+ menu.addAction(gmain->_deEmphasizeAllAct);
+ menu.addSeparator();
+// menu.addAction(gmain->_toggleSceneItemVisibleAct);
menu.addAction(gmain->_arrangeLocalNodesAct);
menu.addAction(gmain->_arrangeRecurseNodesAct);
menu.addSeparator();
+ menu.addAction(gmain->_zoomToBlocAct);
+ menu.addAction(gmain->_centerOnNodeAct);
menu.addAction(gmain->_computeLinkAct);
- menu.addAction(gmain->_toggleAutomaticComputeLinkAct);
- menu.addAction(gmain->_toggleSimplifyLinkAct);
- menu.addAction(gmain->_toggleForce2NodesLinkAct);
+// menu.addAction(gmain->_toggleAutomaticComputeLinkAct);
+// menu.addAction(gmain->_toggleSimplifyLinkAct);
+// menu.addAction(gmain->_toggleForce2NodesLinkAct);
+// menu.addAction(gmain->_toggleAddRowColsAct);
+ if (!isEdition)
+ {
+ menu.addAction(gmain->_getErrorReportAct);
+ menu.addAction(gmain->_getErrorDetailsAct);
+ menu.addAction(gmain->_shutdownProcAct);
+ }
menu.exec(globalPos);
}
-
//=======================================================================================
NodeMenu::NodeMenu() : MenusBase()
menu.addAction(gmain->_copyItemAct);
menu.addAction(gmain->_pasteItemAct);
}
+ menu.addSeparator();
+ menu.addAction(gmain->_showOnlyCtrlLinksAct);
+ menu.addAction(gmain->_showCtrlLinksAct);
+ menu.addAction(gmain->_hideCtrlLinksAct);
+ menu.addAction(gmain->_emphasisPortLinksAct);
+ menu.addAction(gmain->_deEmphasizeAllAct);
+ menu.addSeparator();
+ menu.addAction(gmain->_zoomToBlocAct);
+ menu.addAction(gmain->_centerOnNodeAct);
menu.exec(globalPos);
}
bool isEdition = QtGuiContext::getQtCurrent()->isEdition();
QMenu menu(m, caller);
addHeader(menu, m);
+ menu.addAction(gmain->_showOnlyLinkAct);
+ menu.addAction(gmain->_showLinkAct);
+ menu.addAction(gmain->_hideLinkAct);
+ menu.addAction(gmain->_emphasisLinkAct);
+ menu.addAction(gmain->_deEmphasizeAllAct);
if (isEdition)
{
+ menu.addSeparator();
menu.addAction(gmain->_deleteItemAct);
}
menu.exec(globalPos);
addHeader(menu, m);
if (isEdition)
{
+// Subject* sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
+// SubjectServiceNode *ssn = dynamic_cast<SubjectServiceNode*>(sub);
+// if (ssn)
+// {
+// menu.addAction(gmain->_newContainerAct);
+// menu.addSeparator();
+// }
+ Subject* sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
+ SubjectNode *sin = dynamic_cast<SubjectNode*>(sub);
+ if(sin && !sin->isValid())
+ {
+ menu.addAction(gmain->_getErrorReportAct);
+ menu.addSeparator();
+ }
menu.addAction(gmain->_deleteItemAct);
menu.addAction(gmain->_cutItemAct);
menu.addAction(gmain->_copyItemAct);
menu.addAction(gmain->_pasteItemAct);
+ menu.addAction(gmain->_putInBlocAct);
}
else
{
menu.addAction(gmain->_getContainerLogAct);
}
menu.addSeparator();
- menu.addAction(gmain->_toggleSceneItemVisibleAct);
+ menu.addAction(gmain->_showOnlyCtrlLinksAct);
+ menu.addAction(gmain->_showCtrlLinksAct);
+ menu.addAction(gmain->_hideCtrlLinksAct);
+ menu.addAction(gmain->_emphasisPortLinksAct);
+ menu.addAction(gmain->_deEmphasizeAllAct);
+ menu.addSeparator();
+ menu.addAction(gmain->_zoomToBlocAct);
+ menu.addAction(gmain->_centerOnNodeAct);
+ menu.addAction(gmain->_shrinkExpand);
+// menu.addSeparator();
+// menu.addAction(gmain->_toggleSceneItemVisibleAct);
menu.exec(globalPos);
}
bool isEdition = QtGuiContext::getQtCurrent()->isEdition();
QMenu menu(m, caller);
addHeader(menu, m);
+ menu.addAction(gmain->_showOnlyPortLinksAct);
+ menu.addAction(gmain->_showPortLinksAct);
+ menu.addAction(gmain->_hidePortLinksAct);
+ menu.addAction(gmain->_emphasisPortLinksAct);
+ menu.addAction(gmain->_deEmphasizeAllAct);
if (isEdition)
{
Subject* sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
if (sdp) parent = sdp->getPort()->getNode();
if (parent)
if (dynamic_cast<DataNode*>(parent) || dynamic_cast<InlineNode*>(parent))
- menu.addAction(gmain->_deleteItemAct);
+ {
+ menu.addSeparator();
+ menu.addAction(gmain->_deleteItemAct);
+ }
}
menu.exec(globalPos);
}
bool isEdition = QtGuiContext::getQtCurrent()->isEdition();
QMenu menu(m, caller);
addHeader(menu, m);
+ menu.addAction(gmain->_showOnlyPortLinksAct);
+ menu.addAction(gmain->_showPortLinksAct);
+ menu.addAction(gmain->_hidePortLinksAct);
+ menu.addAction(gmain->_emphasisPortLinksAct);
+ menu.addAction(gmain->_deEmphasizeAllAct);
if (isEdition)
{
Subject* sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
if (sdp) parent = sdp->getPort()->getNode();
if (parent)
if (dynamic_cast<DataNode*>(parent) || dynamic_cast<InlineNode*>(parent))
- menu.addAction(gmain->_deleteItemAct);
+ {
+ menu.addSeparator();
+ menu.addAction(gmain->_deleteItemAct);
+ }
}
menu.exec(globalPos);
}
bool isEdition = QtGuiContext::getQtCurrent()->isEdition();
QMenu menu(m, caller);
addHeader(menu, m);
+ menu.addAction(gmain->_showOnlyCtrlLinksAct);
+ menu.addAction(gmain->_showCtrlLinksAct);
+ menu.addAction(gmain->_hideCtrlLinksAct);
+ menu.addAction(gmain->_emphasisCtrlLinksAct);
+ menu.addAction(gmain->_deEmphasizeAllAct);
if (isEdition)
{
+ //menu.addSeparator();
//menu.addAction(gmain->_deleteItemAct);
}
menu.exec(globalPos);
bool isEdition = QtGuiContext::getQtCurrent()->isEdition();
QMenu menu(m, caller);
addHeader(menu, m);
+ menu.addAction(gmain->_showOnlyCtrlLinksAct);
+ menu.addAction(gmain->_showCtrlLinksAct);
+ menu.addAction(gmain->_hideCtrlLinksAct);
+ menu.addAction(gmain->_emphasisCtrlLinksAct);
+ menu.addAction(gmain->_deEmphasizeAllAct);
if (isEdition)
{
+ //menu.addSeparator();
//menu.addAction(gmain->_deleteItemAct);
}
menu.exec(globalPos);
menu.exec(globalPos);
}
+//=======================================================================================
+
+ContainerDirMenu::ContainerDirMenu() : MenusBase()
+{
+}
+
+ContainerDirMenu::~ContainerDirMenu()
+{
+}
+
+void ContainerDirMenu::popupMenu(QWidget *caller, const QPoint &globalPos, const QString& m)
+{
+ GenericGui *gmain = QtGuiContext::getQtCurrent()->getGMain();
+ bool isEdition = QtGuiContext::getQtCurrent()->isEdition();
+ QMenu menu(m, caller);
+ addHeader(menu, m);
+ if (isEdition)
+ {
+ menu.addAction(gmain->_newContainerAct);
+ }
+ menu.exec(globalPos);
+}
+
+//=======================================================================================
+
+ComponentInstanceMenu::ComponentInstanceMenu() : MenusBase()
+{
+}
+
+ComponentInstanceMenu::~ComponentInstanceMenu()
+{
+}
+
+void ComponentInstanceMenu::popupMenu(QWidget *caller, const QPoint &globalPos, const QString& m)
+{
+ GenericGui *gmain = QtGuiContext::getQtCurrent()->getGMain();
+ bool isEdition = QtGuiContext::getQtCurrent()->isEdition();
+ QMenu menu(m, caller);
+ addHeader(menu, m);
+ if (isEdition)
+ {
+ menu.addAction(gmain->_selectComponentInstanceAct);
+ menu.addAction(gmain->_newSalomeComponentAct);
+ }
+ menu.exec(globalPos);
+}
+
+//=======================================================================================
+
+ContainerMenu::ContainerMenu() : MenusBase()
+{
+}
+
+ContainerMenu::~ContainerMenu()
+{
+}
+
+void ContainerMenu::popupMenu(QWidget *caller, const QPoint &globalPos, const QString& m)
+{
+ GenericGui *gmain = QtGuiContext::getQtCurrent()->getGMain();
+ bool isEdition = QtGuiContext::getQtCurrent()->isEdition();
+ QMenu menu(m, caller);
+ addHeader(menu, m);
+ if (isEdition)
+ {
+ menu.addAction(gmain->_deleteItemAct);
+ }
+ menu.exec(globalPos);
+}
+
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _MENUS_HXX_
#define _MENUS_HXX_
virtual void popupMenu(QWidget *caller,
const QPoint &globalPos,
const QString& m = "MenuBase");
+ virtual void addForEachMenu(QMenu *m, QActionGroup* actgroup);
protected slots:
void dummyAction();
+ void foreachAction(QAction*);
protected:
virtual void addHeader(QMenu &m, const QString &h);
QAction *_dummyAct;
const QString& m = "Reference Menu");
};
+ class ContainerDirMenu: public MenusBase
+ {
+ Q_OBJECT
+ public:
+ ContainerDirMenu();
+ virtual ~ContainerDirMenu();
+ virtual void popupMenu(QWidget *caller,
+ const QPoint &globalPos,
+ const QString& m = "Containers Menu");
+ };
+
+ class ComponentInstanceMenu: public MenusBase
+ {
+ Q_OBJECT
+ public:
+ ComponentInstanceMenu();
+ virtual ~ComponentInstanceMenu();
+ virtual void popupMenu(QWidget *caller,
+ const QPoint &globalPos,
+ const QString& m = "ComponentInstance Menu");
+ };
+
+ class ContainerMenu: public MenusBase
+ {
+ Q_OBJECT
+ public:
+ ContainerMenu();
+ virtual ~ContainerMenu();
+ virtual void popupMenu(QWidget *caller,
+ const QPoint &globalPos,
+ const QString& m = "Container Menu");
+ };
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "Message.hxx"
#include <QMessageBox>
-#define _DEVDEBUG_
+//#define _DEVDEBUG_
#include "YacsTrace.hxx"
using namespace std;
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
#ifndef _MESSAGE_HXX_
#define _MESSAGE_HXX_
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "PropertyEditor.hxx"
+
+#include <QVBoxLayout>
+#include <QToolButton>
+#include <QIcon>
+#include <QLabel>
+#include <QMenu>
+#include <QVariant>
+#include <QActionGroup>
+#include <QHeaderView>
+#include <QLineEdit>
+#include <QInputDialog>
+#include <QMessageBox>
+#include "guiObservers.hxx"
+#include "Message.hxx"
+
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
+using namespace YACS::HMI;
+//using namespace YACS::ENGINE;
+
+/*! \class YACS::HMI::PropertyEditor
+ * \brief A class to edit properties of a subject
+ *
+ */
+
+PropertyEditor::PropertyEditor(Subject* subject,QWidget *parent):QWidget(parent),_subject(subject),_editing(false)
+{
+ std::vector<std::string> v=_subject->knownProperties();
+ for (int i=0; i<v.size(); ++i)
+ {
+ _knownProperties << QString::fromStdString(v[i]);
+ }
+
+ _removeAction=new QAction(QIcon("icons:icon_minus.png"),"Remove Property",this);
+ _addAction=new QAction(QIcon("icons:icon_plus.png"),"Add Property",this);
+
+ _table=new QTableWidget;
+ _table->setColumnCount(2);
+ QStringList headers;
+ headers << "Name" << "Value";
+ _table->setHorizontalHeaderLabels(headers);
+ _table->verticalHeader()->hide();
+ _table->setSelectionMode(QAbstractItemView::SingleSelection);
+
+ connect(_table, SIGNAL(itemChanged(QTableWidgetItem *)),this, SLOT(onItemChanged(QTableWidgetItem *)));
+ connect(_removeAction, SIGNAL(triggered()), this, SLOT(onRemoveProperty()));
+
+ QHBoxLayout* hboxLayout = new QHBoxLayout();
+ hboxLayout->setMargin(0);
+ QToolButton* tb_options = new QToolButton();
+ tb_options->setCheckable(true);
+ QIcon icon;
+ icon.addFile("icons:icon_down.png");
+ icon.addFile("icons:icon_up.png", QSize(), QIcon::Normal, QIcon::On);
+ tb_options->setIcon(icon);
+ hboxLayout->addWidget(tb_options);
+ connect(tb_options, SIGNAL(toggled(bool)), this, SLOT(on_tb_options_toggled(bool)));
+
+ QLabel* label=new QLabel("Properties ");
+ QFont font;
+ font.setBold(true);
+ font.setWeight(75);
+ label->setFont(font);
+ hboxLayout->addWidget(label);
+
+ _bar=new QToolBar();
+
+ QToolButton* button=new QToolButton();
+ button->setDefaultAction(_addAction);
+ button->setPopupMode(QToolButton::InstantPopup);
+ _bar->addWidget(button);
+
+ button=new QToolButton();
+ button->setDefaultAction(_removeAction);
+ _bar->addWidget(button);
+ hboxLayout->addWidget(_bar);
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->setMargin(0);
+ layout->addLayout(hboxLayout);
+ layout->addWidget(_table);
+ setLayout(layout);
+
+ _table->hide();
+ _bar->hide();
+
+ update();
+ updateMenu();
+
+ _editing=true;
+}
+
+PropertyEditor::~PropertyEditor()
+{
+}
+
+//! Qt slot to remove the selected item in the table
+/*!
+ */
+void PropertyEditor::onRemoveProperty()
+{
+ DEBTRACE("PropertyEditor::onRemoveProperty");
+ QList<QTableWidgetItem *> litems=_table->selectedItems();
+ if(litems.isEmpty())
+ return;
+ QTableWidgetItem *item =litems.first();
+ _propertyNames.removeOne(item->text());
+ _table->removeRow(_table->row(item));
+ updateMenu();
+ setProperties();
+}
+
+//! Qt slot to add a property item in the table
+/*!
+ * \param action : the triggered action
+ */
+void PropertyEditor::onAddProperty(QAction* action)
+{
+ DEBTRACE("PropertyEditor::onAddProperty " << action->text().toStdString());
+ bool ok;
+ QString text=action->text();
+ if(text == "Other ...")
+ {
+ text = QInputDialog::getText(this, tr("New Property"),tr("Name:"), QLineEdit::Normal, "", &ok);
+ if (!ok || text.isEmpty())
+ return;
+ }
+
+ if(_propertyNames.contains(text))
+ {
+ QMessageBox::warning ( 0, "Property already defined", "Property already defined");
+ return;
+ }
+
+ _editing=false;
+ int row=_table->rowCount();
+ _table->setRowCount(row+1);
+
+ QTableWidgetItem *newItem = new QTableWidgetItem(text);
+ newItem->setFlags(newItem->flags() & ~Qt::ItemIsEditable);
+ _table->setItem(row,0, newItem);
+
+ newItem = new QTableWidgetItem();
+ _table->setItem(row,1, newItem);
+ _propertyNames << text;
+ _editing=true;
+ updateMenu();
+}
+
+//! Qt slot to change the value of a property item in the table
+/*!
+ * \param item : the item changed
+ */
+void PropertyEditor::onItemChanged(QTableWidgetItem * item)
+{
+ DEBTRACE("PropertyEditor::onItemChanged " << _editing);
+ if(!_editing)
+ return;
+ setProperties();
+}
+
+//! Update the property items with their values in the subject
+/*!
+ */
+void PropertyEditor::update()
+{
+ DEBTRACE("PropertyEditor::update " );
+ _editing=false;
+ QTableWidgetItem *newItem;
+ int row=0;
+ _table->setRowCount(0);
+ _propertyNames << QStringList();
+ std::map<std::string,std::string> props=_subject->getProperties();
+ for (std::map<std::string, std::string>::iterator it = props.begin(); it != props.end(); ++it)
+ {
+ _table->setRowCount(row+1);
+ QTableWidgetItem *newItem = new QTableWidgetItem(it->first.c_str());
+ newItem->setFlags(newItem->flags() & ~Qt::ItemIsEditable);
+ _table->setItem(row,0, newItem);
+
+ newItem = new QTableWidgetItem(it->second.c_str());
+ _table->setItem(row,1, newItem);
+ _propertyNames << it->first.c_str();
+ row=row+1;
+ }
+ _editing=true;
+}
+
+//! Update the menu used to add properties with the already set properties
+/*!
+ */
+void PropertyEditor::updateMenu()
+{
+ DEBTRACE("PropertyEditor::updateMenu " );
+ QMenu* menu=new QMenu;
+ _addAction->setMenu(menu);
+
+ QActionGroup* actGroup=new QActionGroup(this);
+ connect(actGroup, SIGNAL(triggered(QAction*)), this, SLOT(onAddProperty(QAction*)));
+
+ QAction* anAction;
+ for (int i = 0; i < _knownProperties.size(); ++i)
+ {
+ if(_propertyNames.contains(_knownProperties.at(i)))
+ continue;
+ anAction= actGroup->addAction(_knownProperties.at(i));
+ anAction->setData(QVariant(_knownProperties.at(i)));
+ menu->addAction(anAction);
+ }
+ anAction= actGroup->addAction("Other ...");
+ menu->addAction(anAction);
+ anAction->setData(QVariant("..."));
+}
+
+//! Update the subject properties with the values stored in the table
+/*!
+ */
+void PropertyEditor::setProperties()
+{
+ DEBTRACE("PropertyEditor::setProperties " );
+ QTableWidgetItem *item;
+ std::string name;
+ std::string value;
+ std::map<std::string,std::string> props;
+ for (int i = 0; i < _table->rowCount(); ++i)
+ {
+ item=_table->item(i,0);
+ name=item->data(Qt::DisplayRole).toString().toStdString();
+ item=_table->item(i,1);
+ value=item->data(Qt::DisplayRole).toString().toStdString();
+ props[name]=value;
+ }
+ bool ret=_subject->setProperties(props);
+ if(!ret)
+ Message mess;
+}
+
+void PropertyEditor::on_tb_options_toggled(bool checked)
+{
+ DEBTRACE("PropertyEditor::on_tb_options_toggled " << checked);
+ if(checked)
+ {
+ _table->show();
+ _bar->show();
+ }
+ else
+ {
+ _table->hide();
+ _bar->hide();
+ }
+}
+
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _PROPERTYEDITOR_HXX_
+#define _PROPERTYEDITOR_HXX_
+
+#include <QWidget>
+#include <QTableWidget>
+#include <QTableWidgetItem>
+#include <QToolBar>
+#include <QAction>
+
+namespace YACS
+{
+ namespace HMI
+ {
+ class Subject;
+
+ class PropertyEditor: public QWidget
+ {
+ Q_OBJECT
+
+ public:
+ PropertyEditor(Subject* subject,QWidget *parent = 0);
+ virtual ~PropertyEditor();
+ void updateMenu();
+ void update();
+ void setProperties();
+
+ public slots:
+ virtual void onAddProperty(QAction* action);
+ virtual void onRemoveProperty();
+ virtual void onItemChanged(QTableWidgetItem * item);
+ virtual void on_tb_options_toggled(bool checked);
+
+ protected:
+ Subject* _subject;
+ QTableWidget* _table;
+ QToolBar* _bar;
+ QAction* _removeAction;
+ QAction* _addAction;
+ QStringList _knownProperties;
+ QStringList _propertyNames;
+ bool _editing;
+ };
+ }
+}
+
+#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "QtGuiContext.hxx"
+#include <QClipboard>
+#include "ItemMimeData.hxx"
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
using namespace YACS::HMI;
QtGuiContext * QtGuiContext::_QtCurrent = 0;
+counters *QtGuiContext::_counters = 0;
+bool QtGuiContext::_delayCalc = false;
std::set<QtGuiContext*> QtGuiContext::_setOfContext;
QtGuiContext::QtGuiContext(GenericGui *gmain) : GuiContext()
_subjectToCut = 0;
_subjectToCopy = 0;
_isEdition = true;
+ _isLoadingPresentation = false;
_studyId = 0;
- _isLoading = false;
_fileName = QString();
_mapOfSchemaItem.clear();
_mapOfSceneItem.clear();
_invoc = 0;
if (_subjectProc)
{
+ _proc->setEdition(false);
_subjectProc->clean();
delete _subjectProc;
_subjectProc = 0;
YACS::HMI::Subject* QtGuiContext::getSubjectToPaste(bool &isCut)
{
- isCut = (_subjectToCut != 0);
- if (isCut)
- return _subjectToCut;
- else
- return _subjectToCopy;
+ QClipboard *clipboard = QApplication::clipboard();
+ const QMimeData * data=clipboard->mimeData();
+ const ItemMimeData* myData = dynamic_cast<const ItemMimeData*>(data);
+ Subject * sub=0;
+
+ if(myData)
+ {
+ sub=myData->getSubject();
+ isCut=myData->getControl();
+ }
+
+ return sub;
}
void QtGuiContext::setSubjectToCut(YACS::HMI::Subject* sub)
{
- _subjectToCut = sub;
- _subjectToCopy = 0;
+ ItemMimeData *mime = new ItemMimeData;
+ mime->setSubject(sub);
+ mime->setControl(true);
+ QClipboard *clipboard = QApplication::clipboard();
+ clipboard->setMimeData(mime);
}
void QtGuiContext::setSubjectToCopy(YACS::HMI::Subject* sub)
{
- _subjectToCopy = sub;
- _subjectToCut = 0;
+ ItemMimeData *mime = new ItemMimeData;
+ mime->setSubject(sub);
+ mime->setControl(false);
+ QClipboard *clipboard = QApplication::clipboard();
+ clipboard->setMimeData(mime);
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _QTGUICONTEXT_HXX_
#define _QTGUICONTEXT_HXX_
+#include "GenericGuiExport.hxx"
#include "guiContext.hxx"
#include "SchemaModel.hxx"
#include "SchemaItem.hxx"
#include "FormEditTree.hxx"
#include "GraphicsView.hxx"
#include "GuiExecutor.hxx"
+#include "chrono.hxx"
#include <QGraphicsScene>
#include <QItemSelectionModel>
#include <QStackedWidget>
#include <QString>
#include <set>
+#include <SuitWrapper.hxx>
+
namespace YACS
{
namespace HMI
{
- class QtGuiContext: public GuiContext
+ class GENERICGUI_EXPORT QtGuiContext: public GuiContext
{
public:
QtGuiContext(YACS::HMI::GenericGui* gmain);
inline YACS::HMI::GuiExecutor* getGuiExecutor() {return _guiExecutor; };
inline bool isEdition() {return _isEdition; };
inline int getStudyId() {return _studyId; };
- inline bool isLoading() {return _isLoading; };
+ inline bool isLoadingPresentation() {return _isLoadingPresentation; };
YACS::HMI::Subject* getSubjectToPaste(bool &isCut);
inline void setGuiExecutor(YACS::HMI::GuiExecutor* guiEx) {_guiExecutor = guiEx; };
inline void setEdition(bool isEdition) {_isEdition = isEdition; };
inline void setStudyId(int studyId) {_studyId = studyId; };
- inline void setLoading(bool isLoading) {_isLoading = isLoading; };
+ inline void setLoadingPresentation(bool isLoadpres) {_isLoadingPresentation = isLoadpres; };
void setSubjectToCut(YACS::HMI::Subject* sub);
void setSubjectToCopy(YACS::HMI::Subject* sub);
std::map<YACS::HMI::Subject*, YACS::HMI::SchemaItem*> _mapOfSchemaItem;
std::map<YACS::HMI::Subject*, YACS::HMI::SceneItem*> _mapOfSceneItem;
- std::map<YACS::HMI::Subject*, int> _mapOfEditionItem;
+ std::map<YACS::HMI::Subject*, QWidget*> _mapOfEditionItem;
std::set<YACS::HMI::Subject*> _setOfModifiedSubjects;
static std::set<QtGuiContext*> _setOfContext;
+ static counters* _counters;
+ static bool _delayCalc;
protected:
static QtGuiContext* _QtCurrent;
YACS::HMI::Subject* _subjectToCut;
YACS::HMI::Subject* _subjectToCopy;
bool _isEdition;
+ bool _isLoadingPresentation;
int _studyId;
- bool _isLoading;
+ SuitWrapper* _wrapper;
};
}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "Resource.hxx"
+
+using namespace YACS::HMI;
+
+// Statics for general resources
+// -----------------------------
+
+bool Resource::COMPONENT_INSTANCE_NEW = COMPONENTINSTANCENEW;
+QString Resource::userCatalog = USERCATALOG;
+QString Resource::pythonExternalEditor = PYTHONEXTERNALEDITOR;
+bool Resource::addRowCols = ADDROWCOLS;
+bool Resource::straightLinks = STRAIGHTLINKS;
+bool Resource::autoComputeLinks = AUTOCOMPUTELINKS;
+bool Resource::simplifyLink = SIMPLIFYLINK;
+bool Resource::ensureVisibleWhenMoved = ENSUREVISIBLEWHENMOVED;
+int Resource::dockWidgetPriority = DOCKWIDGETPRIORITY;
+QFont Resource::pythonfont = PYTHONFONT;
+
+// Statics for color of states
+// ---------------------------
+
+QColor Resource::editedNodeBrushColor = EDITEDNODEBRUSHCOLOR;
+QColor Resource::normalNodeBrushColor = NORMALNODEBRUSHCOLOR;
+QColor Resource::runNodeBrushColor = RUNNODEBRUSHCOLOR;
+QColor Resource::validNodeColor = VALIDNODECOLOR;
+QColor Resource::invalidNodeColor = INVALIDNODECOLOR;
+
+QColor Resource::emphasizeBrushColor = EMPHASIZEBRUSHCOLOR;
+
+QColor Resource::NOTYETINITIALIZED = NOTYETINITIALIZED_;
+QColor Resource::INITIALISED = INITIALISED_;
+QColor Resource::RUNNING = RUNNING_;
+QColor Resource::WAITINGTASKS = WAITINGTASKS_;
+QColor Resource::PAUSED = PAUSED_;
+QColor Resource::FINISHED = FINISHED_;
+QColor Resource::STOPPED = STOPPED_;
+QColor Resource::UNKNOWN = UNKNOWN_;
+
+QColor Resource::UNDEFINED = UNDEFINED_;
+QColor Resource::INVALID = INVALID_;
+QColor Resource::READY = READY_;
+QColor Resource::TOLOAD = TOLOAD_;
+QColor Resource::LOADED = LOADED_;
+QColor Resource::TOACTIVATE = TOACTIVATE_;
+QColor Resource::ACTIVATED = ACTIVATED_;
+QColor Resource::DESACTIVATED = DESACTIVATED_;
+QColor Resource::DONE = DONE_;
+QColor Resource::SUSPENDED = SUSPENDED_;
+QColor Resource::LOADFAILED = LOADFAILED_;
+QColor Resource::EXECFAILED = EXECFAILED_;
+QColor Resource::PAUSE = PAUSE_;
+QColor Resource::INTERNALERR = INTERNALERR_;
+QColor Resource::DISABLED = DISABLED_;
+QColor Resource::FAILED = FAILED_;
+QColor Resource::ERROR = ERROR_;
+QColor Resource::DEFAULT = DEFAULT_;
+
+// Statics for color of links
+// --------------------------
+
+QColor Resource::link_draw_color = LINKDRAW_COLOR;
+QColor Resource::stream_link_draw_color = STREAMLINKDRAW_COLOR;
+QColor Resource::stream_link_select_color = STREAMLINK_SELECT_COLOR;
+QColor Resource::link_select_color = LINK_SELECT_COLOR;
+QColor Resource::control_link_select_color = CTRLLINK_SELECT_COLOR;
+QColor Resource::control_link_draw_color = CTRLLINKDRAW_COLOR;
+
+int Resource::link_pen_darkness = LINK_PEN_DARKNESS;
+int Resource::link_separation_weight = LINK_SEPARATION_WEIGHT;
+double Resource::link_thickness = LINK_THICKNESS;
+
+// Statics for color of nodes
+// --------------------------
+
+QColor Resource::Scene_pen = Scene_pen_;
+QColor Resource::Scene_hiPen = Scene_hiPen_;
+QColor Resource::Scene_brush = Scene_brush_;
+QColor Resource::Scene_hiBrush = Scene_hiBrush_;
+QColor Resource::ComposedNode_brush = ComposedNode_brush_;
+QColor Resource::ComposedNode_hiBrush = ComposedNode_hiBrush_;
+QColor Resource::ComposedNode_pen = ComposedNode_pen_;
+QColor Resource::ComposedNode_hiPen = ComposedNode_hiPen_;
+QColor Resource::ElementaryNode_brush = ElementaryNode_brush_;
+QColor Resource::ElementaryNode_hiBrush = ElementaryNode_hiBrush_;
+QColor Resource::ElementaryNode_pen = ElementaryNode_pen_;
+QColor Resource::ElementaryNode_hiPen = ElementaryNode_hiPen_;
+QColor Resource::Header_brush = Header_brush_;
+QColor Resource::Header_hiBrush = Header_hiBrush_;
+QColor Resource::Header_pen = Header_pen_;
+QColor Resource::Header_hiPen = Header_hiPen_;
+QColor Resource::CtrlPort_brush = CtrlPort_brush_;
+QColor Resource::CtrlPort_hiBrush = CtrlPort_hiBrush_;
+QColor Resource::CtrlPort_pen = CtrlPort_pen_;
+QColor Resource::CtrlPort_hiPen = CtrlPort_hiPen_;
+QColor Resource::DataPort_brush = DataPort_brush_;
+QColor Resource::DataPort_hiBrush = DataPort_hiBrush_;
+QColor Resource::DataPort_pen = DataPort_pen_;
+QColor Resource::DataPort_hiPen = DataPort_hiPen_;
+QColor Resource::DataStreamPort_brush = DataStreamPort_brush_;
+QColor Resource::DataStreamPort_hiBrush = DataStreamPort_hiBrush_;
+QColor Resource::DataStreamPort_pen = DataStreamPort_pen_;
+QColor Resource::DataStreamPort_hiPen = DataStreamPort_hiPen_;
+
+QColor Resource::dragOver = dragOver_;
+
+// Statics for geometry values for nodes
+// -------------------------------------
+
+int Resource::CtrlPort_Width = 24;
+int Resource::CtrlPort_Height = 20;
+int Resource::DataPort_Width = 72;
+int Resource::DataPort_Height = 25;
+
+int Resource::Thickness = 1;
+
+int Resource::Border_Margin = 4;
+int Resource::Space_Margin = 2;
+
+int Resource::Line_Space = 2;
+int Resource::Line_Width = 2;
+
+int Resource::Text_DX = 3;
+
+int Resource::Corner_Margin = ( Resource::Border_Margin + Resource::Space_Margin );
+int Resource::Header_Height = ( Resource::Corner_Margin + Resource::CtrlPort_Height + Resource::Line_Space + Resource::Line_Width + Resource::Line_Space );
+int Resource::Radius = 3;
+
+bool Resource::tabPanelsUp = TABPANELSUP;
+
+// Constructor
+// -----------
+
+Resource::Resource()
+{
+}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _RESOURCE_HXX_
+#define _RESOURCE_HXX_
+
+#include "GenericGuiExport.hxx"
+
+#include <QColor>
+#include <QFont>
+
+// Define the general names of the resources
+// -----------------------------------------
+
+#define _COMPONENT_INSTANCE_NEW "COMPONENT_INSTANCE_NEW"
+
+// Define the names of the resources for colors
+// --------------------------------------------
+
+#define _editedNodeBrushColor "editedNodeBrushColor"
+#define _normalNodeBrushColor "normalNodeBrushColor"
+#define _runNodeBrushColor "runNodeBrushColor"
+#define _validNodeColor "validNodeColor"
+#define _invalidNodeColor "invalidNodeColor"
+
+#define _NOTYETINITIALIZED "NOTYETINITIALIZED"
+#define _INITIALISED "INITIALISED"
+#define _RUNNING "RUNNING"
+#define _WAITINGTASKS "WAITINGTASKS"
+#define _PAUSED "PAUSED"
+#define _FINISHED "FINISHED"
+#define _STOPPED "STOPPED"
+#define _UNKNOWN "UNKNOWN"
+
+#define _UNDEFINED "UNDEFINED"
+#define _INVALID "INVALID"
+#define _READY "READY"
+#define _TOLOAD "TOLOAD"
+#define _LOADED "LOADED"
+#define _TOACTIVATE "TOACTIVATE"
+#define _ACTIVATED "ACTIVATED"
+#define _DESACTIVATED "DESACTIVATED"
+#define _DONE "DONE"
+#define _SUSPENDED "SUSPENDED"
+#define _LOADFAILED "LOADFAILED"
+#define _EXECFAILED "EXECFAILED"
+#define _PAUSE "PAUSE"
+#define _INTERNALERR "INTERNALERR"
+#define _DISABLED "DISABLED"
+#define _FAILED "FAILED"
+#define _ERROR "ERROR"
+#define _DEFAULT "DEFAULT"
+
+#define _Scene_pen "Scene_pen"
+#define _Scene_hiPen "Scene_hiPen"
+#define _Scene_brush "Scene_brush"
+#define _Scene_hiBrush "Scene_hiBrush"
+#define _ComposedNode_brush "ComposedNode_brush"
+#define _ComposedNode_hiBrush "ComposedNode_hiBrush"
+#define _ComposedNode_pen "ComposedNode_pen"
+#define _ComposedNode_hiPen "ComposedNode_hiPen"
+#define _ElementaryNode_brush "ElementaryNode_brush"
+#define _ElementaryNode_hiBrush "ElementaryNode_hiBrush"
+#define _ElementaryNode_pen "ElementaryNode_pen"
+#define _ElementaryNode_hiPen "ElementaryNode_hiPen"
+#define _Header_brush "Header_brush"
+#define _Header_hiBrush "Header_hiBrush"
+#define _Header_pen "Header_pen"
+#define _Header_hiPen "Header_hiPen"
+#define _CtrlPort_brush "CtrlPort_brush"
+#define _CtrlPort_hiBrush "CtrlPort_hiBrush"
+#define _CtrlPort_pen "CtrlPort_pen"
+#define _CtrlPort_hiPen "CtrlPort_hiPen"
+#define _DataPort_brush "DataPort_brush"
+#define _DataPort_hiBrush "DataPort_hiBrush"
+#define _DataPort_pen "DataPort_pen"
+#define _DataPort_hiPen "DataPort_hiPen"
+#define _DataStreamPort_brush "DataStreamPort_brush"
+#define _DataStreamPort_hiBrush "DataStreamPort_hiBrush"
+#define _DataStreamPort_pen "DataStreamPort_pen"
+#define _DataStreamPort_hiPen "DataStreamPort_hiPen"
+
+#define __dragOver "dragOver"
+
+// Default values
+// --------------
+
+#define COMPONENTINSTANCENEW true
+#define PYTHONFONT QFont("Courier")
+#define PYTHONEXTERNALEDITOR ""
+#define USERCATALOG "YACSUserCatalog.xml"
+#define ADDROWCOLS true
+#define STRAIGHTLINKS false
+#define AUTOCOMPUTELINKS true
+#define SIMPLIFYLINK true
+#define ENSUREVISIBLEWHENMOVED true
+#define TABPANELSUP true
+#define DOCKWIDGETPRIORITY 0
+
+#define EDITEDNODEBRUSHCOLOR QColor(255, 255, 190)
+#define NORMALNODEBRUSHCOLOR QColor(230, 235, 255)
+#define RUNNODEBRUSHCOLOR QColor(205, 218, 255)
+#define VALIDNODECOLOR QColor(128, 255, 128)
+#define INVALIDNODECOLOR QColor(255, 128, 128)
+
+#define EMPHASIZEBRUSHCOLOR QColor( 0, 255, 0)
+
+#define NOTYETINITIALIZED_ QColor(255, 243, 205)
+#define INITIALISED_ QColor(230, 255, 205)
+#define RUNNING_ QColor(205, 255, 218)
+#define WAITINGTASKS_ QColor(205, 255, 255)
+#define PAUSED_ QColor(205, 218, 255)
+#define FINISHED_ QColor(230, 205, 255)
+#define STOPPED_ QColor(255, 205, 243)
+#define UNKNOWN_ QColor(255, 205, 205)
+
+#define UNDEFINED_ Qt::lightGray
+#define INVALID_ Qt::red
+#define READY_ Qt::gray
+#define TOLOAD_ Qt::darkYellow
+#define LOADED_ Qt::darkMagenta
+#define TOACTIVATE_ Qt::darkCyan
+#define ACTIVATED_ Qt::darkBlue
+#define DESACTIVATED_ Qt::gray
+#define DONE_ Qt::darkGreen
+#define SUSPENDED_ Qt::gray
+#define LOADFAILED_ QColor(255, 0, 170)
+#define EXECFAILED_ QColor(255, 85, 0)
+#define PAUSE_ QColor(0, 255, 255)
+#define INTERNALERR_ QColor(255, 0, 85)
+#define DISABLED_ QColor(255, 170, 0)
+#define FAILED_ QColor(170, 85, 0)
+#define ERROR_ QColor(255, 0, 0)
+#define DEFAULT_ Qt::lightGray
+
+#define LINKDRAW_COLOR QColor( 0, 0, 192)
+#define LINK_SELECT_COLOR QColor(192, 192, 255)
+#define STREAMLINKDRAW_COLOR QColor(192, 192, 0)
+#define STREAMLINK_SELECT_COLOR QColor(255, 255, 192)
+#define CTRLLINKDRAW_COLOR QColor(192, 0, 192)
+#define CTRLLINK_SELECT_COLOR QColor(255, 192, 255)
+#define LINK_PEN_DARKNESS 150
+#define LINK_THICKNESS 1.0
+#define LINK_SEPARATION_WEIGHT 10
+
+#define Scene_pen_ QColor( 0, 0, 128)
+#define Scene_hiPen_ QColor( 0, 0, 190)
+#define Scene_brush_ QColor(128, 128, 128)
+#define Scene_hiBrush_ QColor(190, 190, 190)
+#define ComposedNode_brush_ QColor(213, 213, 213)
+#define ComposedNode_hiBrush_ QColor(225, 225, 225)
+#define ComposedNode_pen_ QColor(120, 120, 120)
+#define ComposedNode_hiPen_ QColor( 60, 60, 60)
+#define ElementaryNode_brush_ QColor(189, 230, 185)
+#define ElementaryNode_hiBrush_ QColor(209, 255, 205)
+#define ElementaryNode_pen_ QColor( 15, 180, 0)
+#define ElementaryNode_hiPen_ QColor( 11, 128, 0)
+#define Header_brush_ QColor(215, 220, 238)
+#define Header_hiBrush_ QColor(161, 178, 238)
+#define Header_pen_ QColor(120, 120, 120)
+#define Header_hiPen_ QColor( 60, 60, 60)
+#define CtrlPort_brush_ QColor(205, 210, 227)
+#define CtrlPort_hiBrush_ QColor(161, 176, 227)
+#define CtrlPort_pen_ QColor(120, 120, 120)
+#define CtrlPort_hiPen_ QColor( 60, 60, 60)
+#define DataPort_brush_ QColor(158, 227, 151)
+#define DataPort_hiBrush_ QColor(127, 227, 116)
+#define DataPort_pen_ QColor( 15, 180, 0)
+#define DataPort_hiPen_ QColor( 11, 128, 0)
+#define DataStreamPort_brush_ QColor(158, 227, 151)
+#define DataStreamPort_hiBrush_ QColor(127, 227, 116)
+#define DataStreamPort_pen_ QColor( 15, 180, 0)
+#define DataStreamPort_hiPen_ QColor( 11, 128, 0)
+
+#define dragOver_ QColor(255, 0, 0)
+
+// Define Resource class
+// ---------------------
+
+namespace YACS {
+ namespace HMI {
+ class GENERICGUI_EXPORT Resource {
+ public:
+ Resource();
+
+ public:
+ // General resource
+ static bool COMPONENT_INSTANCE_NEW;
+ static QString userCatalog;
+ static QString pythonExternalEditor;
+ static bool addRowCols;
+ static bool straightLinks;
+ static bool autoComputeLinks;
+ static bool simplifyLink;
+ static bool ensureVisibleWhenMoved;
+ static int dockWidgetPriority;
+
+ // Colors of state of nodes
+ static QColor editedNodeBrushColor;
+ static QColor normalNodeBrushColor;
+ static QColor runNodeBrushColor;
+ static QColor validNodeColor;
+ static QColor invalidNodeColor;
+
+ static QColor emphasizeBrushColor;
+
+ static QColor NOTYETINITIALIZED;
+ static QColor INITIALISED;
+ static QColor RUNNING;
+ static QColor WAITINGTASKS;
+ static QColor PAUSED;
+ static QColor FINISHED;
+ static QColor STOPPED;
+ static QColor UNKNOWN;
+
+ static QColor UNDEFINED;
+ static QColor INVALID;
+ static QColor READY;
+ static QColor TOLOAD;
+ static QColor LOADED;
+ static QColor TOACTIVATE;
+ static QColor ACTIVATED;
+ static QColor DESACTIVATED;
+ static QColor DONE;
+ static QColor SUSPENDED;
+ static QColor LOADFAILED;
+ static QColor EXECFAILED;
+ static QColor PAUSE;
+ static QColor INTERNALERR;
+ static QColor DISABLED;
+ static QColor FAILED;
+ static QColor ERROR;
+ static QColor DEFAULT;
+
+ // Python font
+ static QFont pythonfont;
+
+ // Link colors
+ static QColor link_draw_color;
+ static QColor stream_link_draw_color;
+ static QColor link_select_color;
+ static QColor stream_link_select_color;
+ static QColor control_link_draw_color;
+ static QColor control_link_select_color;
+
+ static int link_pen_darkness;
+ static int link_separation_weight;
+ static double link_thickness;
+
+ // Node colors
+ static QColor Scene_pen;
+ static QColor Scene_hiPen;
+ static QColor Scene_brush;
+ static QColor Scene_hiBrush;
+ static QColor ComposedNode_brush;
+ static QColor ComposedNode_hiBrush;
+ static QColor ComposedNode_pen;
+ static QColor ComposedNode_hiPen;
+ static QColor ElementaryNode_brush;
+ static QColor ElementaryNode_hiBrush;
+ static QColor ElementaryNode_pen;
+ static QColor ElementaryNode_hiPen;
+ static QColor Header_brush;
+ static QColor Header_hiBrush;
+ static QColor Header_pen;
+ static QColor Header_hiPen;
+ static QColor CtrlPort_brush;
+ static QColor CtrlPort_hiBrush;
+ static QColor CtrlPort_pen;
+ static QColor CtrlPort_hiPen;
+ static QColor DataPort_brush;
+ static QColor DataPort_hiBrush;
+ static QColor DataPort_pen;
+ static QColor DataPort_hiPen;
+ static QColor DataStreamPort_brush;
+ static QColor DataStreamPort_hiBrush;
+ static QColor DataStreamPort_pen;
+ static QColor DataStreamPort_hiPen;
+
+ static QColor dragOver;
+
+ // Node parameters
+ static int CtrlPort_Width;
+ static int CtrlPort_Height;
+ static int DataPort_Width;
+ static int DataPort_Height;
+
+ static int Thickness;
+
+ static int Border_Margin;
+ static int Space_Margin;
+
+ static int Line_Space;
+ static int Line_Width;
+
+ static int Text_DX;
+
+ static int Corner_Margin;
+ static int Header_Height;
+ static int Radius;
+
+ static bool tabPanelsUp;
+ };
+ }
+}
+
+#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Scene.hxx"
#include "SceneItem.hxx"
+#include "SceneTextItem.hxx"
#include "QtGuiContext.hxx"
#include <QGraphicsSceneMouseEvent>
+#include <QToolTip>
#include <cassert>
#include <cmath>
using namespace std;
using namespace YACS::HMI;
+bool Scene::_straightLinks = false;
bool Scene::_autoComputeLinks = true;
bool Scene::_simplifyLinks = true;
bool Scene::_force2NodesLink = true;
+bool Scene::_addRowCols = true;
Scene::Scene(QObject *parent): QGraphicsScene(parent)
{
{
return _zooming;
}
+
+void Scene::helpEvent(QGraphicsSceneHelpEvent *event)
+{
+ DEBTRACE("Scene::helpEvent");
+ QGraphicsItem *qit = itemAt(event->scenePos());
+ SceneItem * item = dynamic_cast<SceneItem*>(qit);
+ if (item)
+ {
+ QToolTip::showText(event->screenPos(), item->getToolTip());
+ return;
+ }
+ SceneTextItem * itemt = dynamic_cast<SceneTextItem*>(qit);
+ if (itemt)
+ {
+ QToolTip::showText(event->screenPos(), itemt->getToolTip());
+ return;
+ }
+ QToolTip::hideText();
+}
void Scene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
{
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCENE_HXX_
#define _SCENE_HXX_
Scene(QObject *parent = 0);
virtual ~Scene();
+ static bool _straightLinks;
static bool _autoComputeLinks;
static bool _simplifyLinks;
static bool _force2NodesLink;
+ static bool _addRowCols;
void setZoom(bool zooming);
bool isZooming();
protected:
+ virtual void helpEvent(QGraphicsSceneHelpEvent *event);
virtual void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* mouseEvent);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* mouseEvent);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SceneBlocItem.hxx"
#include "Scene.hxx"
#include "Menus.hxx"
#include <gvc.h>
#endif
+#ifndef ND_coord_i
+#define ND_coord_i(n) (n)->u.coord
+#endif
+
+#include "Resource.hxx"
+
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
void SceneBlocItem::arrangeChildNodes()
{
DEBTRACE("SceneBlocItem::arrangeChildNodes");
+ clock_t start_t, end_t;
+ start_t = clock();
+
SubjectComposedNode *scnode = dynamic_cast<SubjectComposedNode*>(getSubject());
- assert(scnode);
+ YASSERT(scnode);
ComposedNode *cnode = dynamic_cast<ComposedNode*>(scnode->getNode());
- assert(cnode);
+ YASSERT(cnode);
// ---- Create a graphviz context
if(!aGvc)
{
+ DEBTRACE(setlocale(LC_ALL,NULL));
+ //Graphviz is sensitive to locale : set the mimimal one ("C")for numeric
+ setlocale(LC_NUMERIC, "C");
aginit();
aGvc = gvContext();
}
// ---- Initialize and set attributes for the graph
Agsym_t* attr;
- if ( !(attr = agfindattr(_graph, "compound")))
- attr = agraphattr(_graph, "compound", "false");
- agxset(_graph, attr->index, "true");
+ if ( !(attr = agfindattr(_graph, (char *)"compound")))
+ attr = agraphattr(_graph, (char *)"compound", (char *)"false");
+ agxset(_graph, attr->index, (char *)"true");
- if ( !(attr = agfindattr(_graph, "rankdir")))
- attr = agraphattr(_graph, "rankdir", "TB");
- agxset(_graph, attr->index, "LR");
+ if ( !(attr = agfindattr(_graph, (char *)"rankdir")))
+ attr = agraphattr(_graph, (char *)"rankdir", (char *)"TB");
+ agxset(_graph, attr->index, (char *)"LR");
-// if ( !(attr = agfindattr(_graph, "ordering")))
-// attr = agraphattr(_graph, "ordering", "" );
-// agxset(_graph, attr->index, "in" );
+// if ( !(attr = agfindattr(_graph, (char *)"ordering")))
+// attr = agraphattr(_graph, (char *)"ordering", (char *)"" );
+// agxset(_graph, attr->index, (char *)"in" );
- if ( !(attr = agfindattr(_graph, "dpi")))
- attr = agraphattr(_graph, "dpi", "72");
- agxset(_graph, attr->index, "72"); // --- must be coherent with #define DPI
+ if ( !(attr = agfindattr(_graph, (char *)"dpi")))
+ attr = agraphattr(_graph, (char *)"dpi", (char *)"72");
+ agxset(_graph, attr->index, (char *)"72"); // --- must be coherent with #define DPI
// --- label is used to reserve place for bloc banners (adjust size with font !)
- if ( !(attr = agfindattr(_graph, "label")))
- attr = agraphattr(_graph, "label", "label");
- agxset(_graph, attr->index, "myLabel");
+ if ( !(attr = agfindattr(_graph, (char *)"label")))
+ attr = agraphattr(_graph, (char *)"label", (char *)"label");
+ agxset(_graph, attr->index, (char *)"myLabel");
- if ( !(attr = agfindattr(_graph, "labelloc")))
- attr = agraphattr(_graph, "labelloc", "top");
- agxset(_graph, attr->index, "top");
+ if ( !(attr = agfindattr(_graph, (char *)"labelloc")))
+ attr = agraphattr(_graph, (char *)"labelloc", (char *)"top");
+ agxset(_graph, attr->index, (char *)"top");
- if ( !(attr = agfindattr(_graph, "fontsize")))
- attr = agraphattr(_graph, "fontsize", "24");
- agxset(_graph, attr->index, "24");
+ if ( !(attr = agfindattr(_graph, (char *)"fontsize")))
+ attr = agraphattr(_graph, (char *)"fontsize", (char *)"24");
+ agxset(_graph, attr->index, (char *)"24");
- if ( !(attr = agfindattr(_graph, "splines")))
- attr = agraphattr(_graph, "splines", "");
- agxset(_graph, attr->index, "");
+ if ( !(attr = agfindattr(_graph, (char *)"splines")))
+ attr = agraphattr(_graph, (char *)"splines", (char *)"");
+ agxset(_graph, attr->index, (char *)"");
// --- Initialize attributes for nodes
- if ( !(attr = agfindattr( _graph->proto->n, "height")))
- attr = agnodeattr(_graph, "height", "" );
+ if ( !(attr = agfindattr( _graph->proto->n, (char *)"height")))
+ attr = agnodeattr(_graph, (char *)"height", (char *)"" );
- if ( !(attr = agfindattr( _graph->proto->n, "width")))
- attr = agnodeattr(_graph, "width", "" );
+ if ( !(attr = agfindattr( _graph->proto->n, (char *)"width")))
+ attr = agnodeattr(_graph, (char *)"width", (char *)"" );
- if ( !(attr = agfindattr( _graph->proto->n, "shape")))
- attr = agnodeattr(_graph, "shape", "" );
+ if ( !(attr = agfindattr( _graph->proto->n, (char *)"shape")))
+ attr = agnodeattr(_graph, (char *)"shape", (char *)"" );
- if ( !(attr = agfindattr( _graph->proto->n, "fixedsize")))
- attr = agnodeattr(_graph, "fixedsize", "false" );
+ if ( !(attr = agfindattr( _graph->proto->n, (char *)"fixedsize")))
+ attr = agnodeattr(_graph, (char *)"fixedsize", (char *)"false" );
// ---- Bind graph to graphviz context - must be done before layout
// ---- Compute a layout
//DEBTRACE("external render for test");
//gvRenderFilename(aGvc, _mainGraph, "dot", "graph1.dot");
DEBTRACE("compute layout");
- gvLayout(aGvc, _graph, "dot");
+ gvLayout(aGvc, _graph, (char *)"dot");
DEBTRACE("external render for test");
#ifdef _DEVDEBUG_
- gvRenderFilename(aGvc, _graph, "dot", "graph2.dot");
+ gvRenderFilename(aGvc, _graph, (char *)"dot", (char *)"graph2.dot");
#endif
#endif
}
DEBTRACE("Unknown Exception Graphviz layout ");
return;
}
+ {
+ end_t = clock();
+ double passe = (end_t -start_t);
+ passe = passe/CLOCKS_PER_SEC;
+ DEBTRACE("graphviz : " << passe);
+ start_t = end_t;
+ }
DEBTRACE("start of display");
// ---- layout Canvas nodes recursively
#endif
// --- update scene
+ {
+ end_t = clock();
+ double passe = (end_t -start_t);
+ passe = passe/CLOCKS_PER_SEC;
+ DEBTRACE("display : " << passe);
+ start_t = end_t;
+ }
}
void SceneBlocItem::getNodesInfo(YACS::ENGINE::ComposedNode *cnode)
width = QString(_format.c_str()).arg(lw, 0, 'g', 3);
DEBTRACE(aNode->name << " (" << nh << "," << nw << ") = (" << height.toStdString() << " ; " << width.toStdString() <<")");
- agxset( aNode, agfindattr(_graph->proto->n,"height")->index, (char*)(height.toAscii().data()));
- agxset( aNode, agfindattr(_graph->proto->n,"width")->index, (char*)(width.toAscii().data()));
- agxset( aNode, agfindattr(_graph->proto->n,"shape")->index, "box" );
- agxset( aNode, agfindattr(_graph->proto->n,"fixedsize")->index, "true" );
+ agxset( aNode, agfindattr(_graph->proto->n,(char *)"height")->index, (char*)(height.toAscii().data()));
+ agxset( aNode, agfindattr(_graph->proto->n,(char *)"width")->index, (char*)(width.toAscii().data()));
+ agxset( aNode, agfindattr(_graph->proto->n,(char *)"shape")->index, (char *)"box" );
+ agxset( aNode, agfindattr(_graph->proto->n,(char *)"fixedsize")->index, (char *)"true" );
}
// --- Create edges (i.e. links)
SubjectNode* subCompo = GuiContext::getCurrent()->_mapOfSubjectNode[cnode];
SceneItem* sci = QtGuiContext::getQtCurrent()->_mapOfSceneItem[subCompo];
SceneComposedNodeItem *sceneCompo = dynamic_cast<SceneComposedNodeItem*>(sci);
- assert(sceneCompo);
- qreal yHead = sceneCompo->getHeaderBottom() + sceneCompo->getMargin() + sceneCompo->getNml();
- qreal xOffset = sceneCompo->getMargin() + sceneCompo->getNml();
+ YASSERT(sceneCompo);
+ qreal yHead = sceneCompo->getHeaderBottom() + Resource::Space_Margin;
+ qreal xOffset = Resource::Space_Margin;
list<Node*> children = cnode->edGetDirectDescendants();
for (list<Node*>::iterator it = children.begin(); it != children.end(); ++it)
qreal halfHeight = sci->boundingRect().height()/2.;
sci->setPos(xOffset + xCenter -halfWidth, yHead + yCenter -halfHeight);
+ SceneNodeItem *scni = dynamic_cast<SceneNodeItem*>(sci);
+ if (scni) scni->setExpandedPos(QPointF(xOffset + xCenter -halfWidth, yHead + yCenter -halfHeight));
}
sceneCompo->checkGeometryChange();
if (Scene::_autoComputeLinks)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCENEBLOCITEM_HXX_
#define _SCENEBLOCITEM_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
+#define CHRONODEF
+#include "chrono.hxx"
+
#include "SceneBlocItem.hxx"
#include "SceneComposedNodeItem.hxx"
#include "SceneElementaryNodeItem.hxx"
#include "SceneInPortItem.hxx"
#include "SceneOutPortItem.hxx"
#include "SceneLinkItem.hxx"
+#include "SceneDSLinkItem.hxx"
#include "SceneCtrlLinkItem.hxx"
#include "LinkMatrix.hxx"
#include "LinkAStar.hxx"
#include <cassert>
+#include "Resource.hxx"
+
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
: SceneNodeItem(scene, parent, label, subject)
{
DEBTRACE("SceneComposedNodeItem::SceneComposedNodeItem " <<label.toStdString());
- _brushColor = QColor(213,213,213);
- _hiBrushColor = QColor(225,225,225);
- _penColor = QColor(120,120,120);
- _hiPenColor = QColor( 60, 60, 60);
+
+ _width = 2*Resource::Corner_Margin + 2*Resource::DataPort_Width + Resource::Space_Margin;
+ _height = Resource::Header_Height + Resource::DataPort_Height + Resource::Corner_Margin;
+
+ _hiBrushColor = Resource::ComposedNode_hiBrush;
+ _penColor = Resource::ComposedNode_pen;
+ _hiPenColor = Resource::ComposedNode_hiPen;
+ adjustColors();
_dragOver = false;
setAcceptDrops(true);
}
{
}
+void SceneComposedNodeItem::adjustColors()
+{
+ _brushColor = Resource::ComposedNode_brush.darker(100 +5*_level);
+ for (list<AbstractSceneItem*>::const_iterator it=_children.begin(); it!=_children.end(); ++it)
+ {
+ if (SceneComposedNodeItem *scnode = dynamic_cast<SceneComposedNodeItem*>(*it))
+ scnode->adjustColors();
+ }
+ }
+
QRectF SceneComposedNodeItem::childrenBoundingRect() const
{
QRectF ChildrenBRect =QRectF(x(), y(), 5, 5);
if (_header) ChildrenBRect = _header->getMinimalBoundingRect();
for (list<AbstractSceneItem*>::const_iterator it=_children.begin(); it!=_children.end(); ++it)
ChildrenBRect = ChildrenBRect.united(childBoundingRect(*it));
+ ChildrenBRect.setWidth (ChildrenBRect.width() + Resource::Border_Margin);
+ ChildrenBRect.setHeight(ChildrenBRect.height() + Resource::Border_Margin);
return ChildrenBRect;
}
QWidget *widget)
{
//DEBTRACE("SceneComposedNodeItem::paint " << _label.toStdString());
+
+ if (!isExpanded()) {
+ _width = 2*Resource::Corner_Margin + 2*Resource::DataPort_Width + Resource::Space_Margin;
+ _height = getHeaderBottom() + Resource::Corner_Margin;
+ };
+
painter->save();
- painter->setBrush(QBrush(Qt::NoBrush));
- painter->setPen(QPen(Qt::NoPen));
- painter->drawRect(QRectF(0, 0, _width, _height));
painter->setPen(getPenColor());
painter->setBrush(getBrushColor());
- painter->drawRect(QRectF(_nml, _nml,
- _width-2*_nml, _height-2*_nml));
+ painter->drawRect(QRectF(Resource::Border_Margin, Resource::Border_Margin, _width - 2*Resource::Border_Margin, _height - 2*Resource::Border_Margin));
painter->restore();
}
son);
_header->autoPosNewPort(item);
_inPorts.push_back(item);
+ if (Scene::_autoComputeLinks && !QtGuiContext::getQtCurrent()->isLoading())
+ {
+ YACS::HMI::SubjectProc* subproc = QtGuiContext::getQtCurrent()->getSubjectProc();
+ SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[subproc];
+ SceneComposedNodeItem *proc = dynamic_cast<SceneComposedNodeItem*>(item);
+ proc->rebuildLinks();
+ }
break;
case YACS::HMI::OUTPUTPORT:
case YACS::HMI::OUTPUTDATASTREAMPORT:
son);
_header->autoPosNewPort(item);
_outPorts.push_back(item);
+ if (Scene::_autoComputeLinks && !QtGuiContext::getQtCurrent()->isLoading())
+ {
+ YACS::HMI::SubjectProc* subproc = QtGuiContext::getQtCurrent()->getSubjectProc();
+ SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[subproc];
+ SceneComposedNodeItem *proc = dynamic_cast<SceneComposedNodeItem*>(item);
+ proc->rebuildLinks();
+ }
break;
default:
DEBTRACE("SceneComposedNodeItem::update() ADD, type not handled:" << type);
SceneItem * scin = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sinp];
ScenePortItem* from = dynamic_cast<ScenePortItem*>(scout);
ScenePortItem* to = dynamic_cast<ScenePortItem*>(scin);
- item = new SceneLinkItem(_scene,
- this,
- from, to,
- son->getName().c_str(),
- son);
+ if (dynamic_cast<SubjectInputDataStreamPort*>(sinp))
+ {
+ SceneDSLinkItem* item = new SceneDSLinkItem(_scene,
+ this,
+ from, to,
+ son->getName().c_str(),
+ son);
+ item->updateShape();
+ }
+ else
+ {
+ SceneLinkItem* item = new SceneLinkItem(_scene,
+ this,
+ from, to,
+ son->getName().c_str(),
+ son);
+ item->updateShape();
+ }
+ if (Scene::_autoComputeLinks && !QtGuiContext::getQtCurrent()->isLoading())
+ {
+ YACS::HMI::SubjectProc* subproc = QtGuiContext::getQtCurrent()->getSubjectProc();
+ SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[subproc];
+ SceneComposedNodeItem *proc = dynamic_cast<SceneComposedNodeItem*>(item);
+ proc->rebuildLinks();
+ }
}
break;
}
ScenePortItem* from = nodefrom->getCtrlOutPortItem();
ScenePortItem* to = nodeto->getCtrlInPortItem();
if (!to || !from) DEBTRACE("CONTROLLINK problem -----------------");
- item = new SceneCtrlLinkItem(_scene,
+ SceneCtrlLinkItem* item = new SceneCtrlLinkItem(_scene,
this,
from, to,
son->getName().c_str(),
son);
+ item->updateShape();
+ if (Scene::_autoComputeLinks && !QtGuiContext::getQtCurrent()->isLoading())
+ {
+ YACS::HMI::SubjectProc* subproc = QtGuiContext::getQtCurrent()->getSubjectProc();
+ SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[subproc];
+ SceneComposedNodeItem *proc = dynamic_cast<SceneComposedNodeItem*>(item);
+ proc->rebuildLinks();
+ }
}
break;
}
break;
case YACS::HMI::REMOVE:
//SceneObserverItem::update(event, type, son);
- reorganize();
break;
case YACS::HMI::SETCASE:
{
{
SceneItem * sinode = QtGuiContext::getQtCurrent()->_mapOfSceneItem[son];
sinode->setParent(this);
+ sinode->setLevel();
+ if (SceneComposedNodeItem *scnode = dynamic_cast<SceneComposedNodeItem*>(sinode))
+ scnode->adjustColors();
autoPosNewChild(sinode, _children, true);
}
break;
const std::list<AbstractSceneItem*> alreadySet,
bool isNew)
{
+ SceneItem *it = dynamic_cast<SceneItem*>(item);
+ YASSERT(it);
+
QRectF childrenBox;
- qreal xLeft = _margin + _nml;
- qreal yTop = getHeaderBottom() + _margin + _nml;
+ qreal xLeft = Resource::Corner_Margin;
+ qreal yTop = getHeaderBottom() + Resource::Space_Margin;
for (list<AbstractSceneItem*>::const_iterator it=alreadySet.begin(); it!=alreadySet.end(); ++it)
{
childrenBox = childrenBox.united(childBoundingRect(*it));
DEBTRACE("childrenBox valid " << childrenBox.right() << " " << childrenBox.bottom());
}
if (childrenBox.isValid())
- xLeft += childrenBox.right();
+ yTop = childrenBox.bottom() + 1.; // +1. to avoid collision with bottom (penwidth)
+ //xLeft += childrenBox.right();
DEBTRACE("left, top " << xLeft << " " << yTop);
QPointF topLeft(xLeft, yTop);
if (isNew) _children.push_back(item);
- item->setTopLeft(topLeft);
+ if (_eventPos.isNull())
+ {
+ //DEBTRACE("_eventPos.isNull");
+ item->setTopLeft(topLeft);
+ }
+ else
+ {
+ //DEBTRACE("_eventPos " << _eventPos.x() << " " << _eventPos.y());
+ item->setTopLeft(_eventPos);
+ }
+ collisionResolv(it, -it->boundingRect().bottomRight()); // as if the new item was coming from top left (previous position outside)
+ if (Scene::_autoComputeLinks && !QtGuiContext::getQtCurrent()->isLoading()) rebuildLinks();
+ _eventPos.setX(0);
+ _eventPos.setY(0);
}
void SceneComposedNodeItem::popupMenu(QWidget *caller, const QPoint &globalPos)
_children.remove(child);
}
+void SceneComposedNodeItem::reorganizeShrinkExpand() {
+ DEBTRACE("SceneComposedNodeItem::reorganizeShrinkExpand " << _expanded << " " << _label.toStdString());
+ bool isExpanding = isExpanded();
+
+ //update control links
+ std::list<SubjectControlLink*> lscl=dynamic_cast<SubjectNode*>(_subject)->getSubjectControlLinks();
+ for (std::list<SubjectControlLink*>::const_iterator it = lscl.begin(); it != lscl.end(); ++it) {
+ SceneLinkItem* lk = dynamic_cast<SceneLinkItem*>(QtGuiContext::getQtCurrent()->_mapOfSceneItem[*it]);
+
+ bool b1 = true, b2 = true;
+
+ SceneNodeItem* no = lk->getFromNode();
+ if (no) {
+ SceneComposedNodeItem* scni = dynamic_cast<SceneComposedNodeItem*>(no);
+ if (scni) {
+ b1 = scni!=this;
+ };
+ };
+
+ no = lk->getToNode();
+ if (no) {
+ SceneComposedNodeItem* scni = dynamic_cast<SceneComposedNodeItem*>(no);
+ if (scni) {
+ b2 = scni!=this;
+ };
+ };
+
+ if (b1 && b2) {
+ if (isExpanding) {
+ lk->show();
+ } else {
+ lk->hide();
+ };
+ };
+ };
+
+ shrinkExpandRecursive(isExpanding, true);
+ if (Scene::_autoComputeLinks)
+ {
+ SubjectProc* subproc = QtGuiContext::getQtCurrent()->getSubjectProc();
+ SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[subproc];
+ SceneComposedNodeItem *proc = dynamic_cast<SceneComposedNodeItem*>(item);
+ proc->rebuildLinks();
+ }
+}
+
+void SceneComposedNodeItem::shrinkExpandRecursive(bool isExpanding, bool fromHere)
+{
+ DEBTRACE("SceneComposedNodeItem::shrinkExpandRecursive " << isExpanding << " " << fromHere << " " << isExpanded() << " " << _label.toStdString());
+
+ if (!isExpanding)
+ { // ---collapsing: hide first children , then resize
+ for (list<AbstractSceneItem*>::const_iterator it=_children.begin(); it!=_children.end(); ++it)
+ {
+ SceneItem* item = dynamic_cast<SceneItem*>(*it);
+ item->shrinkExpandRecursive(false, false);
+ item->hide();
+ DEBTRACE("------------------------------- Hide " << item->getLabel().toStdString());
+ item->shrinkExpandLink(false);
+ }
+
+ if (_shownState == expandShown)
+ {
+ _expandedWidth = _width;
+ _expandedHeight = _height;
+ }
+
+ if (fromHere)
+ {
+ _shownState = shrinkShown;
+ }
+ else
+ {
+ _ancestorShrinked = true;
+ _shownState = shrinkHidden;
+ }
+
+ _width = 2*Resource::Corner_Margin + 2*Resource::DataPort_Width + Resource::Space_Margin;
+ if (_shownState == shrinkShown)
+ _height = getHeaderBottom() + Resource::Corner_Margin;
+ else
+ _height = Resource::Header_Height + Resource::Corner_Margin;
+
+ if (_shownState == shrinkHidden) // shrink of ancestor
+ setPos(0 ,0);
+ else
+ setPos(_expandedPos);
+ adjustHeader();
+ }
+ else
+ { // --- expanding: resize, then show children
+ _ancestorShrinked = false;
+
+ for (list<AbstractSceneItem*>::const_iterator it=_children.begin(); it!=_children.end(); ++it)
+ {
+ SceneItem* item = dynamic_cast<SceneItem*>(*it);
+ item->shrinkExpandRecursive(isExpanded(), false);
+ if (isExpanded())
+ {
+ item->show();
+ DEBTRACE("------------------------------- Show " << item->getLabel().toStdString());
+ }
+ else
+ {
+ item->hide();
+ DEBTRACE("------------------------------- Hide " << item->getLabel().toStdString());
+ }
+ item->shrinkExpandLink(fromHere);
+ }
+
+ if (isExpanded())
+ {
+ _width = _expandedWidth;
+ _height = _expandedHeight;
+ _shownState = expandShown;
+ }
+ else
+ {
+ _shownState = shrinkShown;
+ _width = 2*Resource::Corner_Margin + 2*Resource::DataPort_Width + Resource::Space_Margin;
+ _height = getHeaderBottom() + Resource::Corner_Margin;
+ }
+ setPos(_expandedPos);
+ adjustHeader();
+ }
+}
+
+void SceneComposedNodeItem::shrinkExpandLink(bool se) {
+ DEBTRACE("SceneComposedNodeItem::shrinkExpandLink " << se << " " << _label.toStdString());
+ se = se && isExpanded();
+ foreach (QGraphicsItem *child, childItems()) {
+ if (SceneItem *sci = dynamic_cast<SceneItem*>(child)) {
+ sci->shrinkExpandLink(se);
+ };
+ };
+}
+
void SceneComposedNodeItem::reorganize()
{
DEBTRACE("SceneComposedNodeItem::reorganize() " << _label.toStdString());
}
}
+void SceneComposedNodeItem::setShownState(shownState ss)
+{
+ _shownState = ss;
+ if (_shownState == shrinkHidden)
+ {
+ _ancestorShrinked = true;
+ hide();
+ }
+ else
+ {
+ _ancestorShrinked = false;
+ show();
+ }
+ adjustHeader();
+}
+
void SceneComposedNodeItem::collisionResolv(SceneItem* child, QPointF oldPos)
{
//DEBTRACE("SceneComposedNodeItem::collisionResolv " << _label.toStdString());
{
//DEBTRACE("collision detected with " << other->getLabel().toStdString());
QRectF otherBR = (other->mapToParent(other->boundingRect())).boundingRect();
- //oldPos = mapFromScene(oldPos);
qreal oldX = oldPos.x();
qreal oldY = oldPos.y();
qreal newX = child->pos().x();
bool blocThis = false;
if (fromTop)
{
- //newY = otherBR.top() - child->boundingRect().height() -_margin;
othY = newY + child->boundingRect().height();
pushOther = true;
+ other->_blocY = false;
}
if (fromLeft)
{
- //newX = otherBR.left() -child->boundingRect().width() - _margin;
othX = newX+ child->boundingRect().width();
pushOther = true;
+ other->_blocX = false;
}
if (fromBottom)
{
- newY = otherBR.bottom() + 1;
- blocThis = true;
+ if (other->_blocY)
+ {
+ newY = otherBR.bottom() + 1;
+ blocThis = true;
+ _blocY = true;
+ }
+ else
+ {
+ othY = newY - otherBR.height();
+ if ( othY < Resource::Space_Margin + getHeaderBottom() )
+ {
+ othY = Resource::Space_Margin + getHeaderBottom();
+ other->_blocY = true;
+ newY = otherBR.bottom() + 1;
+ _blocY = true;
+ blocThis = true;
+ }
+ else
+ pushOther = true;
+ }
}
if (fromRight)
{
- newX = otherBR.right()+ 1;
- blocThis = true;
+ if (other->_blocX)
+ {
+ newX = otherBR.right()+ 1;
+ blocThis = true;
+ _blocX = true;
+ }
+ else
+ {
+ othX = newX - otherBR.width();
+ if (othX < Resource::Space_Margin)
+ {
+ othX = Resource::Space_Margin;
+ other->_blocX = true;
+ newX = otherBR.right()+ 1;
+ _blocX = true;
+ blocThis = true;
+ }
+ else
+ pushOther = true;
+ }
}
//DEBTRACE("newX=" << newX << " newY=" << newY);
if (blocThis) child->setTopLeft(QPointF(newX, newY));
void SceneComposedNodeItem::rebuildLinks()
{
+ DEBTRACE("SceneComposedNodeItem::rebuildLinks " << QtGuiContext::_delayCalc);
+ if (QtGuiContext::_delayCalc)
+ return;
+ CHRONO(1);
+ CHRONO(2);
LinkMatrix matrix(this);
matrix.compute();
+ CHRONOSTOP(2);
+ CHRONO(3);
list<linkdef> alist = matrix.getListOfDataLinkDef();
list<linkdef> blist = matrix.getListOfCtrlLinkDef(); // add list operator ?
for (list<linkdef>::const_iterator ii = blist.begin(); ii != blist.end(); ++ii)
alist.push_back(*ii);
+ CHRONOSTOP(3);
+ CHRONO(4);
LinkAStar astar(matrix);
for (list<linkdef>::const_iterator it = alist.begin(); it != alist.end(); ++it)
{
linkdef ali = *it;
-// DEBTRACE("from("<<ali.from.first<<","<<ali.from.second
-// <<") to ("<<ali.to.first<<","<<ali.to.second
-// <<") " << ali.item->getLabel().toStdString());
+ DEBTRACE("from("<<ali.from.first<<","<<ali.from.second
+ <<") to ("<<ali.to.first<<","<<ali.to.second
+ <<") " << ali.item->getLabel().toStdString());
+ if(ali.from.first<0||ali.from.second<0||ali.to.first<0||ali.to.second<0) continue;
+ CHRONO(5);
bool isPath = astar.computePath(LNode(ali.from), LNode(ali.to));
+ CHRONOSTOP(5);
+ CHRONO(6);
if (! isPath) DEBTRACE("Link Path not found !");
- LinkPath apath = matrix.getPath(astar.givePath());
+ if (! isPath) continue;
+ LNodePath ijPath = astar.givePath();
+ if(Scene::_addRowCols)
+ matrix.incrementCost(ijPath);
+ LinkPath apath = matrix.getPath(ijPath);
// DEBTRACE(apath.size());
+ CHRONOSTOP(6);
+ CHRONO(7);
ali.item->setPath(apath);
}
-
}
void SceneComposedNodeItem::arrangeNodes(bool isRecursive)
{
DEBTRACE("SceneComposedItem::arrangeNodes " << isRecursive);
+ bool isExtern = !QtGuiContext::_delayCalc;
+ QtGuiContext::_delayCalc = true; // avoid rebuildLinks
+
SubjectComposedNode *scnode = dynamic_cast<SubjectComposedNode*>(getSubject());
- assert(scnode);
+ YASSERT(scnode);
ComposedNode *cnode = dynamic_cast<ComposedNode*>(scnode->getNode());
- assert(cnode);
+ YASSERT(cnode);
if (isRecursive)
{
SceneItem* sci = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sn];
if (sci) scni = dynamic_cast<SceneComposedNodeItem*>(sci);
}
- if (scni)
+ if (scni && (scni->getShownState() == expandShown))
{
DEBTRACE("call arrangeNode on child " << (*it)->getName());
scni->arrangeNodes(isRecursive);
}
else
arrangeChildNodes();
+
+ if (isExtern)
+ {
+ QtGuiContext::_delayCalc = false; // allow rebuildLinks
+ if (Scene::_autoComputeLinks)
+ rebuildLinks();
+ }
+}
+
+void SceneComposedNodeItem::arrangeChildNodes()
+{
+ reorganize();
}
void SceneComposedNodeItem::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
const ItemMimeData *myData = dynamic_cast<const ItemMimeData*>(event->mimeData());
if (!myData) return;
+ setEventPos(event->scenePos());
if (myData->hasFormat("yacs/cataService") || myData->hasFormat("yacs/cataNode"))
{
SubjectComposedNode *cnode = dynamic_cast<SubjectComposedNode*>(getSubject());
- QtGuiContext::getQtCurrent()->getGMain()->_guiEditor->CreateNodeFromCatalog(myData, cnode);
+ bool createNewComponentInstance=Resource::COMPONENT_INSTANCE_NEW;
+ // by default getControl gives false. In this case we use the user preference COMPONENT_INSTANCE_NEW
+ // to create the node. If getControl gives true we invert the user preference
+ if(myData->getControl())
+ createNewComponentInstance=!Resource::COMPONENT_INSTANCE_NEW;
+ QtGuiContext::getQtCurrent()->getGMain()->_guiEditor->CreateNodeFromCatalog(myData, cnode,createNewComponentInstance);
}
else if(myData->hasFormat("yacs/subjectNode"))
{
if (!sub) return;
SubjectNode *node = dynamic_cast<SubjectNode*>(sub);
if (!node) return;
+ if (dynamic_cast<SubjectProc*>(node)) return; // --- do not reparent proc !
SubjectComposedNode *cnode = dynamic_cast<SubjectComposedNode*>(getSubject());
if (cnode)
- if (node->reparent(cnode))
+ if (!node->reparent(cnode))
Message mess;
}
}
QColor SceneComposedNodeItem::getPenColor()
{
if (_dragOver)
- return QColor(255,0,0);
+ return Resource::dragOver;
if (isSelected())
return _hiPenColor;
else
QColor color;
if (isSelected())
color = _hiBrushColor;
+ else if (_emphasized)
+ color = Resource::emphasizeBrushColor;
else
color = _brushColor;
return color;
}
+void SceneComposedNodeItem::updateChildItems()
+{
+ SceneNodeItem::updateChildItems();
+ if(!_header)
+ return;
+ foreach (QGraphicsItem *child, _header->childItems())
+ {
+ if (SceneItem *sci = dynamic_cast<SceneItem*>(child))
+ {
+ sci->updateLinks();
+ }
+ }
+}
+
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCENECOMPOSEDNODEITEM_HXX_
#define _SCENECOMPOSEDNODEITEM_HXX_
virtual std::list<AbstractSceneItem*> getChildren();
virtual void removeChildFromList(AbstractSceneItem* child);
virtual void reorganize();
+ virtual void reorganizeShrinkExpand();
+ virtual void shrinkExpandRecursive(bool isExpanding, bool fromHere);
+ virtual void shrinkExpandLink(bool se);
virtual void collisionResolv(SceneItem* child, QPointF oldPos);
virtual void rebuildLinks();
+ virtual void updateChildItems();
virtual void arrangeNodes(bool isRecursive);
+ virtual void arrangeChildNodes();
+ virtual void adjustColors();
+ virtual void setShownState(shownState ss);
protected:
void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SceneCtrlInPortItem.hxx"
#include "SceneNodeItem.hxx"
#include "ItemMimeData.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCENECTRLINPORTITEM_HXX_
#define _SCENECTRLINPORTITEM_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SceneCtrlLinkItem.hxx"
#include "SceneCtrlPortItem.hxx"
#include "SceneElementaryNodeItem.hxx"
#include "SceneHeaderNodeItem.hxx"
#include "Scene.hxx"
#include "Menus.hxx"
+#include "Resource.hxx"
#include <QPointF>
QString label, Subject *subject)
: SceneLinkItem(scene, parent, from, to, label, subject)
{
- _penColor = QColor( 96, 0, 96);
- _hiPenColor = QColor( 128, 0, 128);
- _brushColor = QColor( 192, 0, 192);
- _hiBrushColor = QColor( 255, 192, 255);
+ _penColor = Resource::control_link_draw_color.darker(Resource::link_pen_darkness);
+ _hiPenColor = Resource::control_link_select_color.darker(Resource::link_pen_darkness);
+ _brushColor = Resource::control_link_draw_color;
+ _hiBrushColor = Resource::control_link_select_color;
}
SceneCtrlLinkItem::~SceneCtrlLinkItem()
DEBTRACE("localTo(" << localTo.x() << "," << localTo.y() << ")");
return mapFromItem(dpit, localTo);
}
+
+QColor SceneCtrlLinkItem::getPenColor()
+{
+ _penColor = Resource::control_link_draw_color.darker(Resource::link_pen_darkness);
+ _hiPenColor = Resource::control_link_select_color.darker(Resource::link_pen_darkness);
+ return SceneObserverItem::getPenColor();
+}
+
+QColor SceneCtrlLinkItem::getBrushColor()
+{
+ _brushColor = Resource::control_link_draw_color;
+ _hiBrushColor = Resource::control_link_select_color;
+ return SceneObserverItem::getBrushColor();
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCENECTRLLINKITEM_HXX_
#define _SCENECTRLLINKITEM_HXX_
virtual QPointF start();
virtual QPointF goal();
protected:
-
+ virtual QColor getBrushColor();
+ virtual QColor getPenColor();
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SceneCtrlOutPortItem.hxx"
// #include "QtGuiContext.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCENECTRLOUTPORTITEM_HXX_
#define _SCENECTRLOUTPORTITEM_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SceneCtrlPortItem.hxx"
#include "SceneTextItem.hxx"
#include "SceneNodeItem.hxx"
+#include "SceneHeaderNodeItem.hxx"
#include "Scene.hxx"
#include "ItemMimeData.hxx"
+#include "QtGuiContext.hxx"
// #include "QtGuiContext.hxx"
#include "Menus.hxx"
// #include <cassert>
+#include "Resource.hxx"
+
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
using namespace YACS::ENGINE;
using namespace YACS::HMI;
-const int SceneCtrlPortItem::_portWidth = 85;
-const int SceneCtrlPortItem::_portHeight = 25;
-
SceneCtrlPortItem::SceneCtrlPortItem(QGraphicsScene *scene, SceneItem *parent,
QString label)
: SceneItem(scene, parent, label), ScenePortItem(label)
{
- _width = _portWidth;
- _height = _portHeight;
setText(label);
- _brushColor = QColor(205,210,227);
- _hiBrushColor = QColor(161,176,227);
- _penColor = QColor(120,120,120);
- _hiPenColor = QColor( 60, 60, 60);
+ _width = Resource::CtrlPort_Width;
+ _height = Resource::CtrlPort_Height;
+ _brushColor = Resource::CtrlPort_brush;
+ _hiBrushColor = Resource::CtrlPort_hiBrush;
+ _penColor = Resource::CtrlPort_pen;
+ _hiPenColor = Resource::CtrlPort_hiPen;
}
SceneCtrlPortItem::~SceneCtrlPortItem()
{
//DEBTRACE("ScenePortItem::paint");
painter->save();
- painter->setPen(getPenColor());
- painter->setBrush(getBrushColor());
- painter->drawRoundRect(QRectF(0, 0, _width, _height), 33*_height/_width, 33);
+
+ QPen pen(getPenColor());
+ pen.setWidth(Resource::Thickness);
+ painter->setPen(pen);
+ SceneHeaderNodeItem* hd = dynamic_cast<SceneHeaderNodeItem*>(_parent);
+ painter->setBrush(hd->getValidColor());
+ painter->drawRoundedRect(QRectF(0, 0, Resource::CtrlPort_Width, Resource::CtrlPort_Height), Resource::Radius, Resource::Radius);
+
painter->restore();
}
if (!_text)
_text = new SceneTextItem(_scene,
this,
- label);
- else
- _text->setPlainText(label);
+ label, true );
}
SceneNodeItem* SceneCtrlPortItem::getParentNode()
<< " " << acceptedMouseButtons ());
if (!_scene->isZooming())
{
- if (_dragable && (event->button() == _dragButton))
+ getSubjectNode()->select(true);
+ if (_dragable && (event->button() == _dragButton) && QtGuiContext::getQtCurrent()->isEdition())
{
setCursor(Qt::ClosedHandCursor);
_draging = true;
+ _dragModifier= event->modifiers() & Qt::ControlModifier;
}
}
}
drag->setHotSpot(QPoint(15, 20));
drag->exec();
- setCursor(Qt::OpenHandCursor);
+ setCursor(Qt::ArrowCursor);
+ _draging = false;
+ _dragModifier= false;
}
}
setCursor(Qt::ArrowCursor);
}
_draging = false;
+ _dragModifier= false;
}
-
-
-int SceneCtrlPortItem::getPortWidth()
-{
- return _portWidth;
-}
-
-int SceneCtrlPortItem::getPortHeight()
-{
- return _portHeight;
-}
-
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCENECTRLPORTITEM_HXX_
#define _SCENECTRLPORTITEM_HXX_
QWidget *widget);
virtual SceneNodeItem* getParentNode();
SubjectNode* getSubjectNode();
- static int getPortWidth();
- static int getPortHeight();
protected:
virtual QString getMimeFormat();
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
- static const int _portWidth;
- static const int _portHeight;
bool _draging;
+ bool _dragModifier;
};
}
}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "SceneDSLinkItem.hxx"
+#include "Resource.hxx"
+
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
+using namespace std;
+using namespace YACS::ENGINE;
+using namespace YACS::HMI;
+
+SceneDSLinkItem::SceneDSLinkItem(QGraphicsScene *scene, SceneItem *parent,
+ ScenePortItem* from, ScenePortItem* to,
+ QString label, Subject *subject)
+ : SceneLinkItem(scene, parent, from, to, label, subject)
+{
+ _penColor = Resource::stream_link_draw_color.darker(Resource::link_pen_darkness);
+ _hiPenColor = Resource::stream_link_select_color.darker(Resource::link_pen_darkness);
+ _brushColor = Resource::stream_link_draw_color;
+ _hiBrushColor = Resource::stream_link_select_color;
+}
+
+SceneDSLinkItem::~SceneDSLinkItem()
+{
+}
+
+QColor SceneDSLinkItem::getPenColor()
+{
+ _penColor = Resource::stream_link_draw_color.darker(Resource::link_pen_darkness);
+ _hiPenColor = Resource::stream_link_select_color.darker(Resource::link_pen_darkness);
+ return SceneObserverItem::getPenColor();
+}
+
+QColor SceneDSLinkItem::getBrushColor()
+{
+ _brushColor = Resource::stream_link_draw_color;
+ _hiBrushColor = Resource::stream_link_select_color;
+ return SceneObserverItem::getBrushColor();
+}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _SCENEDSLINKITEM_HXX_
+#define _SCENEDSLINKITEM_HXX_
+
+#include "SceneLinkItem.hxx"
+
+namespace YACS
+{
+ namespace HMI
+ {
+
+ class SceneDSLinkItem: public SceneLinkItem
+ {
+ public:
+ SceneDSLinkItem(QGraphicsScene *scene, SceneItem *parent,
+ ScenePortItem* from, ScenePortItem* to,
+ QString label, Subject *subject);
+ virtual ~SceneDSLinkItem();
+
+ protected:
+ virtual QColor getBrushColor();
+ virtual QColor getPenColor();
+ };
+ }
+}
+
+#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SceneDataPortItem.hxx"
#include "SceneTextItem.hxx"
#include "SceneNodeItem.hxx"
+#include "SceneLinkItem.hxx"
#include "Scene.hxx"
-// #include "QtGuiContext.hxx"
-// #include "Menus.hxx"
-// #include <QGraphicsSceneHoverEvent>
-// #include <QPointF>
+#include "QtGuiContext.hxx"
-// #include <cassert>
+#include "Resource.hxx"
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
QString label, Subject *subject)
: SceneObserverItem(scene, parent, label, subject), ScenePortItem(label)
{
- _width = _portWidth;
- _height = _portHeight;
setText(label);
- _brushColor = QColor(158, 227, 151);
- _hiBrushColor = QColor(127, 227, 116);
- _penColor = QColor( 15, 180, 0);
- _hiPenColor = QColor( 11, 128, 0);
+ _width = Resource::DataPort_Width;
+ _height = Resource::DataPort_Height;
+ switch (getSubject()->getType())
+ {
+ case INPUTPORT:
+ case OUTPUTPORT:
+ _brushColor = Resource::DataPort_brush;
+ _hiBrushColor = Resource::DataPort_hiBrush;
+ _penColor = Resource::DataPort_pen;
+ _hiPenColor = Resource::DataPort_hiPen;
+ break;
+ case INPUTDATASTREAMPORT:
+ case OUTPUTDATASTREAMPORT:
+ _brushColor = Resource::DataStreamPort_brush;
+ _hiBrushColor = Resource::DataStreamPort_hiBrush;
+ _penColor = Resource::DataStreamPort_pen;
+ _hiPenColor = Resource::DataStreamPort_hiPen;
+ break;
+ }
}
SceneDataPortItem::~SceneDataPortItem()
{
+ DEBTRACE("ScenePortItem::~SceneDataPortItem");
}
void SceneDataPortItem::paint(QPainter *painter,
const QStyleOptionGraphicsItem *option,
QWidget *widget)
{
- //DEBTRACE("ScenePortItem::paint");
+ DEBTRACE("ScenePortItem::paint");
painter->save();
- painter->setPen(getPenColor());
+
+ QPen pen(getPenColor());
+ pen.setWidth(Resource::Thickness);
+ painter->setPen(pen);
painter->setBrush(getBrushColor());
- painter->drawRoundRect(QRectF(0, 0, _width, _height), 33*_height/_width, 33);
+ QRectF rect(0, 0, Resource::DataPort_Width, Resource::DataPort_Height);
+ painter->drawRoundedRect(rect, Resource::Radius, Resource::Radius);
+
painter->restore();
}
if (!_text)
_text = new SceneTextItem(_scene,
this,
- label);
- else
- _text->setPlainText(label);
+ label );
}
void SceneDataPortItem::update(GuiEvent event, int type, Subject* son)
{
DEBTRACE("SceneDataPortItem::update "<< eventName(event)<<" "<<type<<" "<<son);
+ SceneObserverItem::update(event, type, son);
switch (event)
{
case YACS::HMI::RENAME:
- _text->setPlainText(son->getName().c_str());
+ _text->setPlainTextTrunc(son->getName().c_str());
+ QGraphicsItem::update();
break;
case YACS::HMI::REMOVE:
SceneObserverItem::update(event, type, son);
return 0;
}
+void SceneDataPortItem::updateChildItems()
+{
+ DEBTRACE("SceneDataPortItem::updateChildItems " << _label.toStdString());
+ if(SubjectDataPort* sdp=dynamic_cast<SubjectDataPort*>(_subject))
+ {
+ std::list<SubjectLink*> lsl=sdp->getListOfSubjectLink();
+ for (std::list<SubjectLink*>::const_iterator it = lsl.begin(); it != lsl.end(); ++it)
+ {
+ SceneLinkItem* item = dynamic_cast<SceneLinkItem*>(QtGuiContext::getQtCurrent()->_mapOfSceneItem[*it]);
+ item->updateShape();
+ }
+ }
+}
+
+void SceneDataPortItem::updateLinks()
+{
+ DEBTRACE("SceneDataPortItem::updateLinks " << _label.toStdString());
+ if(SubjectDataPort* sdp=dynamic_cast<SubjectDataPort*>(_subject))
+ {
+ std::list<SubjectLink*> lsl=sdp->getListOfSubjectLink();
+ for (std::list<SubjectLink*>::const_iterator it = lsl.begin(); it != lsl.end(); ++it)
+ {
+ SceneLinkItem* item = dynamic_cast<SceneLinkItem*>(QtGuiContext::getQtCurrent()->_mapOfSceneItem[*it]);
+ item->updateShape();
+ }
+ }
+}
+
+void SceneDataPortItem::shrinkExpandLink(bool se)
+{
+ if(SubjectDataPort* sdp=dynamic_cast<SubjectDataPort*>(_subject))
+ {
+ std::list<SubjectLink*> lsl=sdp->getListOfSubjectLink();
+ for (std::list<SubjectLink*>::const_iterator it = lsl.begin(); it != lsl.end(); ++it)
+ {
+ SceneLinkItem* item = dynamic_cast<SceneLinkItem*>(QtGuiContext::getQtCurrent()->_mapOfSceneItem[*it]);
+ if (se) {
+ item->show();
+ } else {
+ item->hide();
+ };
+ }
+ }
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCENEDATAPORTITEM_HXX_
#define _SCENEDATAPORTITEM_HXX_
QWidget *widget);
virtual void update(GuiEvent event, int type, Subject* son);
virtual SceneNodeItem* getParent();
+ virtual void updateChildItems();
+ virtual void updateLinks();
+ virtual void shrinkExpandLink(bool se);
protected:
};
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SceneElementaryNodeItem.hxx"
#include "SceneInPortItem.hxx"
#include "SceneOutPortItem.hxx"
+#include "SceneComposedNodeItem.hxx"
#include "guiObservers.hxx"
#include "commandsProc.hxx"
#include "Scene.hxx"
#include "QtGuiContext.hxx"
#include "Menus.hxx"
+#include "Resource.hxx"
+
#include <cassert>
//#define _DEVDEBUG_
QString label, Subject *subject)
: SceneNodeItem(scene, parent, label, subject)
{
- _brushColor = QColor(189,230,185);
- _hiBrushColor = QColor(209,255,205);
- _penColor = QColor( 15,180, 0);
- _hiPenColor = QColor( 11,128, 0);
+ _maxPorts = 0;
+ _width = 2*Resource::Corner_Margin + 2*Resource::DataPort_Width + Resource::Space_Margin;
+ _height = Resource::Header_Height + Resource::Border_Margin;
+
+ _brushColor = Resource::ElementaryNode_brush;
+ _hiBrushColor = Resource::ElementaryNode_hiBrush;
+ _penColor = Resource::ElementaryNode_pen;
+ _hiPenColor = Resource::ElementaryNode_hiPen;
}
SceneElementaryNodeItem::~SceneElementaryNodeItem()
{
//DEBTRACE("SceneElementaryNodeItem::paint");
painter->save();
- painter->setBrush(QBrush(Qt::NoBrush));
- painter->setPen(QPen(Qt::NoPen));
- painter->drawRect(QRectF(0, 0, _width, _height));
- painter->setPen(getPenColor());
+ QPen pen(getPenColor());
+ pen.setWidth(Resource::Thickness);
+ painter->setPen(pen);
painter->setBrush(getBrushColor());
- painter->drawRect(QRectF(_nml, _nml,
- _width-2*_nml, _height-2*_nml));
+ int w = _width - 2*Resource::Border_Margin;
+ int h = _height - 2*Resource::Border_Margin;
+ painter->drawRect(QRectF(Resource::Border_Margin, Resource::Border_Margin, w, h));
painter->restore();
}
son);
autoPosNewPort(item, _inPorts.size());
_inPorts.push_back(item);
+ if (Scene::_autoComputeLinks && !QtGuiContext::getQtCurrent()->isLoading())
+ {
+ YACS::HMI::SubjectProc* subproc = QtGuiContext::getQtCurrent()->getSubjectProc();
+ SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[subproc];
+ SceneComposedNodeItem *proc = dynamic_cast<SceneComposedNodeItem*>(item);
+ proc->rebuildLinks();
+ }
break;
case YACS::HMI::OUTPUTPORT:
case YACS::HMI::OUTPUTDATASTREAMPORT:
son);
autoPosNewPort(item, _outPorts.size());
_outPorts.push_back(item);
+ if (Scene::_autoComputeLinks && !QtGuiContext::getQtCurrent()->isLoading())
+ {
+ YACS::HMI::SubjectProc* subproc = QtGuiContext::getQtCurrent()->getSubjectProc();
+ SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[subproc];
+ SceneComposedNodeItem *proc = dynamic_cast<SceneComposedNodeItem*>(item);
+ proc->rebuildLinks();
+ }
break;
// default:
// DEBTRACE("SceneElementaryNodeItem::update() ADD, type not handled:" << type);
}
}
+void SceneElementaryNodeItem::autoPosNewPort(AbstractSceneItem *item, int nbPorts) {
+ DEBTRACE("SceneElementaryNodeItem::autoPosNewPort "<< _label.toStdString());
+ SceneInPortItem* inPortItem = dynamic_cast<SceneInPortItem*>(item);
+ SceneOutPortItem* outPortItem = dynamic_cast<SceneOutPortItem*>(item);
+
+ bool toShow = (_shownState == expandShown);
+ if (toShow) {
+ qreal x;
+ if (inPortItem) {
+ x = Resource::Corner_Margin;
+ inPortItem->show();
+ } else {
+ x = Resource::Corner_Margin + Resource::DataPort_Width + Resource::Space_Margin;
+ outPortItem->show();
+ };
+ qreal y = Resource::Header_Height + nbPorts * (Resource::DataPort_Height + Resource::Space_Margin);
+
+ if (_maxPorts <= nbPorts) {
+ _maxPorts = nbPorts+1;
+ _height = Resource::Header_Height + Resource::Border_Margin;
+ _height += _maxPorts * (Resource::DataPort_Height + Resource::Space_Margin);
+ _incHeight = _height; // must just be more than the actual increment of height
+ DEBTRACE("SceneElementaryNodeItem::autoPosNewPort _height=" << _height);
+ };
+
+ item->setTopLeft(QPointF(x, y));
+
+ } else {
+ _height = Resource::Header_Height + Resource::Border_Margin;
+ qreal y = Resource::Corner_Margin;
+ if (inPortItem) {
+ item->setTopLeft(QPointF(Resource::Corner_Margin, y));
+ inPortItem->hide();
+ } else {
+ item->setTopLeft(QPointF(Resource::Corner_Margin + Resource::DataPort_Width + Resource::Space_Margin, y));
+ outPortItem->hide();
+ };
+ };
+}
+
void SceneElementaryNodeItem::popupMenu(QWidget *caller, const QPoint &globalPos)
{
ElementaryNodeMenu m;
m.popupMenu(caller, globalPos);
}
+void SceneElementaryNodeItem::reorganizeShrinkExpand()
+{
+ DEBTRACE("SceneElementaryNodeItem::reorganizeShrinkExpand " << isExpanded() << " " << _label.toStdString());
+ shrinkExpandRecursive(isExpanded(), true);
+ if (Scene::_autoComputeLinks)
+ {
+ SubjectProc* subproc = QtGuiContext::getQtCurrent()->getSubjectProc();
+ SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[subproc];
+ SceneComposedNodeItem *proc = dynamic_cast<SceneComposedNodeItem*>(item);
+ proc->rebuildLinks();
+ }
+}
+
+void SceneElementaryNodeItem::shrinkExpandRecursive(bool isExpanding, bool fromHere)
+{
+ DEBTRACE("SceneElementaryNodeItem::shrinkExpandRecursive " << isExpanding << " " << fromHere << " " << isExpanded() << " " << _label.toStdString());
+ if (isExpanding)
+ {
+ _ancestorShrinked = false;
+ if (isExpanded())
+ _shownState = expandShown;
+ else
+ _shownState = shrinkShown;
+ }
+ else
+ {
+ if (fromHere)
+ _shownState = shrinkShown;
+ else
+ {
+ _ancestorShrinked = true;
+ _shownState = shrinkHidden;
+ }
+ }
+
+ if (_shownState == shrinkHidden) // shrink of ancestor
+ setPos(0 ,0);
+ else
+ setPos(_expandedPos);
+
+ reorganize();
+}
+
void SceneElementaryNodeItem::reorganize()
{
DEBTRACE("SceneElementaryNodeItem::reorganize() " << _label.toStdString());
SubjectNode* snode = dynamic_cast<SubjectNode*>(_subject);
ElementaryNode* father = dynamic_cast<ElementaryNode*>(snode->getNode());
- assert(father);
+ YASSERT(father);
+
+ _maxPorts = 0;
- list<InputPort*> plisti = father->getSetOfInputPort();
- list<InputPort*>::iterator iti = plisti.begin();
+ list<InPort*> plisti = father->getSetOfInPort();
+ list<InPort*>::iterator iti = plisti.begin();
int nbPorts = 0;
for (; iti != plisti.end(); ++iti)
{
nbPorts++;
}
- list<OutputPort*> plisto = father->getSetOfOutputPort();
- list<OutputPort*>::iterator ito = plisto.begin();
+ list<OutPort*> plisto = father->getSetOfOutPort();
+ list<OutPort*>::iterator ito = plisto.begin();
nbPorts = 0;
for (; ito != plisto.end(); ++ito)
{
autoPosNewPort(item, nbPorts);
nbPorts++;
}
+ updateLinks();
}
+
+void SceneElementaryNodeItem::setShownState(shownState ss)
+{
+ _shownState = ss;
+ if (_shownState == shrinkHidden)
+ {
+ _ancestorShrinked = true;
+ hide();
+ }
+ else
+ {
+ _ancestorShrinked = false;
+ show();
+ }
+ reorganize();
+}
+
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCENEELEMENTARYNODEITEM_HXX_
#define _SCENEELEMENTARYNODEITEM_HXX_
QWidget *widget);
virtual void update(GuiEvent event, int type, Subject* son);
virtual void popupMenu(QWidget *caller, const QPoint &globalPos);
+ virtual void autoPosNewPort(AbstractSceneItem *item, int nbPorts);
virtual void reorganize();
+ virtual void reorganizeShrinkExpand();
+ virtual void shrinkExpandRecursive(bool isExpanding, bool fromHere);
+ virtual void setShownState(shownState ss);
protected:
+ int _maxPorts;
};
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SceneHeaderItem.hxx"
#include "SceneHeaderNodeItem.hxx"
#include "SceneTextItem.hxx"
#include "Scene.hxx"
#include <QGraphicsSceneMouseEvent>
+#include "Resource.hxx"
+
// #include "QtGuiContext.hxx"
// #include "Menus.hxx"
// #include <QGraphicsSceneHoverEvent>
QString label)
: SceneItem(scene, parent, label)
{
- assert(_parent);
- _height = 25;
- _width = _parent->getInternWidth();
+ YASSERT(_parent);
+ _width = 2*Resource::DataPort_Width - 2*Resource::CtrlPort_Width - Resource::Space_Margin;
+ _height = Resource::CtrlPort_Height;
_text=0;
- _brushColor = QColor(215,220,238);
- _hiBrushColor = QColor(161,178,238);
-// _penColor = QColor(120,120,120);
-// _hiPenColor = QColor( 60, 60, 60);
- _hasNml = false;
+ _brushColor = Resource::Header_brush;
+ _hiBrushColor = Resource::Header_hiBrush;
+ _penColor = Resource::Header_pen;
+ _hiPenColor = Resource::Header_hiPen;
}
SceneHeaderItem::~SceneHeaderItem()
QWidget *widget)
{
// DEBTRACE("SceneHeaderItem::paint");
- painter->save();
- painter->setPen(getPenColor());
- painter->setBrush(getBrushColor());
- painter->drawRoundRect(QRectF(0, 0, _width, _height), 33*_height/_width, 33);
- painter->restore();
}
void SceneHeaderItem::setText(QString label)
{
if (!_text)
- _text = new SceneTextItem(_scene,
- this,
- label);
+ _text = new SceneTextItem(_scene, this, label);
else
- _text->setPlainText(label);
+ _text->setPlainTextTrunc(label);
+ QGraphicsItem::update();
}
void SceneHeaderItem::popupMenu(QWidget *caller, const QPoint &globalPos)
void SceneHeaderItem::adjustGeometry()
{
- _width = _parent->getInternWidth() -1;
+ prepareGeometryChange();
+ _width = _parent->getWidth() - 2*Resource::Corner_Margin - 2*Resource::Space_Margin - 2*Resource::CtrlPort_Width;
+ update();
}
QColor SceneHeaderItem::getPenColor()
QColor SceneHeaderItem::getBrushColor()
{
QColor color = _brushColor;
- if (dynamic_cast<SceneHeaderNodeItem*>(getParent()))
- if (getParent()->getParent()->isSelected())
+ if (dynamic_cast<SceneHeaderNodeItem*>(this))
+ if (getParent()->isSelected())
color = _hiBrushColor;
if (_hover)
color = hoverColor(color);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCENEHEADERITEM_HXX_
#define _SCENEHEADERITEM_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SceneHeaderNodeItem.hxx"
#include "SceneComposedNodeItem.hxx"
#include "SceneProcItem.hxx"
#include "Scene.hxx"
#include "QtGuiContext.hxx"
+#include "GuiEditor.hxx"
+#include "Resource.hxx"
#include "Menus.hxx"
#include <QGraphicsSceneHoverEvent>
#include <QGraphicsSceneMouseEvent>
using namespace YACS::ENGINE;
using namespace YACS::HMI;
-QColor SceneHeaderNodeItem::_editedNodeBrushColor = QColor(255,255,190);
-QColor SceneHeaderNodeItem::_normalNodeBrushColor = QColor(230,235,255);
-QColor SceneHeaderNodeItem::_runNodeBrushColor = QColor(205,218,255);
-QColor SceneHeaderNodeItem::_validNodeColor = QColor(128,255,128);
-QColor SceneHeaderNodeItem::_invalidNodeColor = QColor(255,128,128);
-
SceneHeaderNodeItem::SceneHeaderNodeItem(QGraphicsScene *scene, SceneItem *parent,
QString label)
: SceneHeaderItem(scene, parent, label)
{
+ _width = 2*Resource::Corner_Margin + 2*Resource::DataPort_Width + Resource::Space_Margin;
+ _height = Resource::Header_Height;
+ _maxPorts = 0;
+
_header = 0;
_controlIn = 0;
_controlOut = 0;
_label = "H_" + _label;
+ _hasHeader = true;
+
+ _controlIn = new SceneCtrlInPortItem(_scene, this, "in");
+ _controlIn->setTopLeft(QPointF(Resource::Corner_Margin, Resource::Corner_Margin));
- _header = new SceneHeaderItem(_scene,
- this,
- "header_"+_label);
+ _header = new SceneHeaderItem(_scene, this, "header_"+_label);
_header->setText(label);
+ _header->setTopLeft(QPointF(Resource::Corner_Margin + Resource::CtrlPort_Width + Resource::Space_Margin, Resource::Corner_Margin));
+
+ _controlOut = new SceneCtrlOutPortItem(_scene, this, "out");
+ _controlOut->setTopLeft(QPointF(Resource::Corner_Margin + 2*Resource::DataPort_Width + Resource::Space_Margin - Resource::CtrlPort_Width, Resource::Corner_Margin));
- QPointF topLeft(_margin, _margin);
- _header->setTopLeft(topLeft);
- _hasHeader = true;
- _controlIn = new SceneCtrlInPortItem(_scene,
- this,
- "Ctrl_I");
- autoPosControl(_controlIn);
- _controlOut = new SceneCtrlOutPortItem(_scene,
- this,
- "Ctrl_O");
- autoPosControl(_controlOut);
if (QtGuiContext::getQtCurrent()->isEdition())
- _brushColor = _normalNodeBrushColor;
+ _brushColor = Resource::normalNodeBrushColor;
else
- _brushColor = _runNodeBrushColor;
+ _brushColor = Resource::runNodeBrushColor;
_execState = YACS::UNDEFINED;
- _sc = _validNodeColor;
+ _sc = Resource::validNodeColor;
_stateDef = "";
_isProc = dynamic_cast<SceneProcItem*>(_parent);
_isValid = true;
const QStyleOptionGraphicsItem *option,
QWidget *widget)
{
-// DEBTRACE("SceneHeaderNodeItem::paint");
+ //DEBTRACE("SceneHeaderNodeItem::paint");
painter->save();
- painter->setPen(getPenColor());
- painter->setBrush(getBrushColor());
- painter->drawRect(QRectF(0, 0, _width, _height));
- painter->setBrush(getValidColor(_isValid));
- painter->drawEllipse(QRectF((_width - SceneCtrlPortItem::getPortHeight())/2,
- getHeaderBottom() + _margin,
- SceneCtrlPortItem::getPortHeight(),
- SceneCtrlPortItem::getPortHeight()));
+
+ int x = Resource::Border_Margin + 1;
+ int y = Resource::Header_Height - Resource::Line_Space;
+ int w = Resource::Corner_Margin + 2*Resource::DataPort_Width + 2*Resource::Space_Margin;
+ if (_parent->getWidth() > w) w = _parent->getWidth() - Resource::Border_Margin;
+ QPen pen(getPenColor());
+ pen.setWidth(Resource::Line_Width);
+ painter->setPen(pen);
+ painter->drawLine(x, y, w, y);
+
+ x = Resource::Corner_Margin + Resource::CtrlPort_Width + Resource::Space_Margin;
+ y = Resource::Corner_Margin;
+ w = w - 2*Resource::CtrlPort_Width - 3*Resource::Space_Margin - Resource::Corner_Margin;
+ int h = Resource::CtrlPort_Height;
+ pen.setWidth(Resource::Thickness);
+ painter->setPen(pen);
+
+ SceneNodeItem* father = dynamic_cast<SceneNodeItem*>(_parent);
+ bool expanded = (father && father->isExpanded());
+ QColor baseColor = getBrushColor();
+ if (expanded)
+ painter->setBrush(baseColor);
+ else
+ {
+ int h, s, v, a, h2;
+ baseColor.getHsv(&h, &s, &v, &a);
+ DEBTRACE("h="<<h<<" s="<<s<<" v="<<v);
+ h2 = h+60;
+ if (h>359) h2 = h2-359;
+ QLinearGradient gradient;
+ gradient.setCoordinateMode(QGradient::ObjectBoundingMode);
+ gradient.setColorAt(0, baseColor.darker(200));
+ //gradient.setColorAt(1, baseColor.lighter(150));
+ //gradient.setColorAt(0, QColor::fromHsv(h-60, s, v, a));
+ gradient.setColorAt(1, QColor::fromHsv(h2, s, v, a));
+ QBrush brush(gradient);
+ painter->setBrush(brush);
+ }
+ painter->drawRoundedRect(QRect(x, y, w, h), Resource::Radius, Resource::Radius);
+
painter->restore();
}
qreal SceneHeaderNodeItem::getHeaderBottom() const
{
- qreal bottom = 0;
- if (_hasHeader)
- bottom = childBoundingRect(_header).bottom();
- return bottom;
+ if (_hasHeader) {
+ return Resource::Header_Height + _maxPorts * (Resource::DataPort_Height + Resource::Space_Margin);
+ } else {
+ return 0;
+ };
}
void SceneHeaderNodeItem::autoPosControl(AbstractSceneItem *item)
{
- SceneCtrlInPortItem* inPortItem = dynamic_cast<SceneCtrlInPortItem*>(item);
- bool isInPort = inPortItem;
-
- qreal xLeft = _margin;
- if (!isInPort) xLeft += getInternWidth() - SceneCtrlPortItem::getPortWidth();
+}
- qreal yTop = getHeaderBottom() + _margin;
+void SceneHeaderNodeItem::autoPosNewPort(AbstractSceneItem *item)
+{
+ DEBTRACE("SceneHeaderNodeItem::autoPosNewPort");
+ SceneInPortItem* inPortItem = dynamic_cast<SceneInPortItem*>(item);
+ int nbPorts;
+ qreal xLeft;
+ if (inPortItem) {
+ xLeft = Resource::Corner_Margin;
+ nbPorts = _inPorts.size();
+ _inPorts.push_back(inPortItem);
+ } else {
+ if (_parent->getWidth() > (2*Resource::Corner_Margin + 2*Resource::DataPort_Width + Resource::Space_Margin)) {
+ xLeft = _parent->getWidth() - Resource::Corner_Margin - Resource::DataPort_Width;
+ } else {
+ xLeft = Resource::Corner_Margin + Resource::DataPort_Width + Resource::Space_Margin;
+ };
+ nbPorts = _outPorts.size();
+ _outPorts.push_back(dynamic_cast<SceneOutPortItem*>(item));
+ };
+ qreal yTop = Resource::Header_Height;
+ qreal deltaY = Resource::DataPort_Height + Resource::Space_Margin;
+ yTop += nbPorts * deltaY;
+ if (nbPorts >=_maxPorts) {
+ _maxPorts = nbPorts+1;
+ };
//DEBTRACE("left, top " << xLeft << " " << yTop);
QPointF topLeft(xLeft, yTop);
item->setTopLeft(topLeft);
- //adaptComposedNode(getHeaderBottom() + _margin);
+ adaptComposedNode(dynamic_cast<SceneItem*>(item), deltaY);
}
-void SceneHeaderNodeItem::autoPosNewPort(AbstractSceneItem *item)
+void SceneHeaderNodeItem::reorganizePorts(shownState ss)
{
- SceneInPortItem* inPortItem = dynamic_cast<SceneInPortItem*>(item);
- bool isInPort = (inPortItem != 0);
+ DEBTRACE("SceneHeaderNodeItem::reorganizePorts() " << ss << " " << _label.toStdString());
+ qreal yTop;
+ qreal href = Resource::Header_Height;
+ bool isShown = (ss != shrinkHidden);
+ if (!isShown) href = Resource::Corner_Margin;
+
+std::list<SceneInPortItem*>::iterator iti = _inPorts.begin();
int nbPorts = 0;
- qreal xLeft = _margin;
- if (!isInPort)
+ for (; iti != _inPorts.end(); ++iti)
{
- xLeft += getInternWidth() - ScenePortItem::getPortWidth() -1;
- nbPorts = _outPorts.size();
- _outPorts.push_back(dynamic_cast<SceneOutPortItem*>(item));
+ yTop = href + nbPorts * (Resource::DataPort_Height + Resource::Space_Margin);
+ QPointF topLeft(Resource::Corner_Margin, yTop);
+ (*iti)->setTopLeft(topLeft);
+ if (isShown) nbPorts++; // otherwise (shrink from ancestor) put all ports at the same position
}
- else
+
+ std::list<SceneOutPortItem*>::iterator ito = _outPorts.begin();
+ nbPorts = 0;
+ qreal xLeft;
+ if (ss == expandShown) {
+ xLeft = _parent->getWidth() - Resource::Corner_Margin - Resource::DataPort_Width;
+ } else {
+ xLeft = Resource::Corner_Margin + Resource::DataPort_Width + Resource::Space_Margin;
+ };
+ for (; ito != _outPorts.end(); ++ito)
{
- nbPorts = _inPorts.size();
- _inPorts.push_back(inPortItem);
+ yTop = href + nbPorts * (Resource::DataPort_Height + Resource::Space_Margin);
+ QPointF topLeft(xLeft, yTop);
+ (*ito)->setTopLeft(topLeft);
+ if (isShown) nbPorts++; // otherwise (shrink from ancestor) put all ports at the same position
}
- qreal yTop = getHeaderBottom() +ScenePortItem::getPortHeight() + 2*_margin;
- qreal deltaY = ScenePortItem::getPortHeight() + _margin;
- yTop += nbPorts * deltaY;
- //DEBTRACE("left, top " << xLeft << " " << yTop);
- QPointF topLeft(xLeft, yTop);
- item->setTopLeft(topLeft);
- adaptComposedNode(deltaY);
+ //updateLinks();
}
void SceneHeaderNodeItem::popupMenu(QWidget *caller, const QPoint &globalPos)
void SceneHeaderNodeItem::adjustGeometry()
{
- _width = _parent->getInternWidth() -1;
+ DEBTRACE("SceneHeaderNodeItem::adjustGeometry() " << _label.toStdString());
+ prepareGeometryChange();
+ _width = _parent->getWidth();
if (_header) _header->adjustGeometry();
adjustPosPorts();
+ update();
}
void SceneHeaderNodeItem::adjustPosPorts()
{
- if (_controlOut) autoPosControl(_controlOut);
+ SceneNodeItem* father = dynamic_cast<SceneNodeItem*>(_parent);
+ YASSERT(father);
+ shownState ss = father->getShownState();
+ if (_controlOut)
+ {
+ int x = Resource::Corner_Margin + 2*Resource::DataPort_Width + Resource::Space_Margin;
+ if ((ss == expandShown) && (_parent->getWidth() > (x + Resource::Corner_Margin)))
+ x = _parent->getWidth() - Resource::Corner_Margin;
+ _controlOut->setTopLeft(QPointF(x - Resource::CtrlPort_Width, Resource::Corner_Margin));
+ };
+ reorganizePorts(ss);
}
QRectF SceneHeaderNodeItem::getMinimalBoundingRect() const
{
- qreal width = 3*_margin;
- if (_inPorts.size())
- width += ScenePortItem::getPortWidth();
- else
- width += SceneCtrlPortItem::getPortWidth()
- + SceneCtrlPortItem::getPortHeight() + 2*_margin;
- if (_outPorts.size())
- width += ScenePortItem::getPortWidth();
- else
- width += SceneCtrlPortItem::getPortWidth();
- qreal height = getHeaderBottom() + ScenePortItem::getPortHeight() + 2*_margin;
- int nbPorts = _inPorts.size();
+ qreal width = 2*Resource::Corner_Margin + 2*Resource::DataPort_Width + Resource::Space_Margin;
+ qreal height = Resource::Header_Height + Resource::Border_Margin;
+ int nbPorts = _inPorts.size();
if (_outPorts.size() > nbPorts) nbPorts = _outPorts.size();
- if (nbPorts) height += nbPorts*(ScenePortItem::getPortHeight() + _margin);
+ if (nbPorts) height += nbPorts*(Resource::DataPort_Height + Resource::Space_Margin);
//DEBTRACE(nbPorts << " " << width << " " << height);
return QRectF(x(), y(), width, height);
}
-void SceneHeaderNodeItem::adaptComposedNode(qreal deltaY)
+void SceneHeaderNodeItem::adaptComposedNode(SceneItem* port, qreal deltaY)
{
+ DEBTRACE("SceneHeaderNodeItem::adaptComposedNode " << deltaY);
QPointF oldPos(x(),y() - deltaY);
if (_parent)
{
if (SceneComposedNodeItem *bloc = dynamic_cast<SceneComposedNodeItem*>(_parent))
- bloc->collisionResolv(this, oldPos);
+ bloc->collisionResolv(port, oldPos);
//_parent->checkGeometryChange();
}
}
{
DEBTRACE("SceneHeaderNodeItem::setEdited " << isEdited);
if (isEdited)
- _brushColor = _editedNodeBrushColor;
+ _brushColor = Resource::editedNodeBrushColor;
else
{
if (QtGuiContext::getQtCurrent()->isEdition())
- _brushColor = _normalNodeBrushColor;
+ _brushColor = Resource::normalNodeBrushColor;
else
- _brushColor = _runNodeBrushColor;
+ _brushColor = Resource::runNodeBrushColor;
}
if (isEdited != _isEdited)
_parent->update();
if (_isProc)
switch (_execState)
{
- case YACS::NOTYETINITIALIZED: _sc.setHsv( 45, 50, 255); _stateDef = "Not Yet Initialized"; break;
- case YACS::INITIALISED: _sc.setHsv( 90, 50, 255); _stateDef = "Initialized"; break;
- case YACS::RUNNING: _sc.setHsv(135, 50, 255); _stateDef = "Running"; break;
- case YACS::WAITINGTASKS: _sc.setHsv(180, 50, 255); _stateDef = "Waiting Tasks"; break;
- case YACS::PAUSED: _sc.setHsv(225, 50, 255); _stateDef = "Paused"; break;
- case YACS::FINISHED: _sc.setHsv(270, 50, 255); _stateDef = "Finished"; break;
- case YACS::STOPPED: _sc.setHsv(315, 50, 255); _stateDef = "Stopped"; break;
- default: _sc.setHsv(360, 50, 255); _stateDef = "Unknown Status";
+ case YACS::NOTYETINITIALIZED: _sc = Resource::NOTYETINITIALIZED; _stateDef = "Not Yet Initialized"; break;
+ case YACS::INITIALISED: _sc = Resource::INITIALISED ; _stateDef = "Initialized" ; break;
+ case YACS::RUNNING: _sc = Resource::RUNNING ; _stateDef = "Running" ; break;
+ case YACS::WAITINGTASKS: _sc = Resource::WAITINGTASKS ; _stateDef = "Waiting Tasks" ; break;
+ case YACS::PAUSED: _sc = Resource::PAUSED ; _stateDef = "Paused" ; break;
+ case YACS::FINISHED: _sc = Resource::FINISHED ; _stateDef = "Finished" ; break;
+ case YACS::STOPPED: _sc = Resource::STOPPED ; _stateDef = "Stopped" ; break;
+ default: _sc = Resource::UNKNOWN ; _stateDef = "Unknown Status" ;
}
else
switch (_execState)
{
- case YACS::UNDEFINED: _sc=Qt::lightGray; _stateDef = "UNDEFINED"; break;
- case YACS::INVALID: _sc=Qt::red; _stateDef = "INVALID"; break;
- case YACS::READY: _sc=Qt::gray; _stateDef = "READY"; break;
- case YACS::TOLOAD: _sc=Qt::darkYellow; _stateDef = "TOLOAD"; break;
- case YACS::LOADED: _sc=Qt::darkMagenta; _stateDef = "LOADED"; break;
- case YACS::TOACTIVATE: _sc=Qt::darkCyan; _stateDef = "TOACTIVATE"; break;
- case YACS::ACTIVATED: _sc=Qt::darkBlue; _stateDef = "ACTIVATED"; break;
- case YACS::DESACTIVATED: _sc=Qt::gray; _stateDef = "DESACTIVATED"; break;
- case YACS::DONE: _sc=Qt::darkGreen; _stateDef = "DONE"; break;
- case YACS::SUSPENDED: _sc=Qt::gray; _stateDef = "SUSPENDED"; break;
- case YACS::LOADFAILED: _sc.setHsv(320,255,255); _stateDef = "LOADFAILED"; break;
- case YACS::EXECFAILED: _sc.setHsv( 20,255,255); _stateDef = "EXECFAILED"; break;
- case YACS::PAUSE: _sc.setHsv(180,255,255); _stateDef = "PAUSE"; break;
- case YACS::INTERNALERR: _sc.setHsv(340,255,255); _stateDef = "INTERNALERR"; break;
- case YACS::DISABLED: _sc.setHsv( 40,255,255); _stateDef = "DISABLED"; break;
- case YACS::FAILED: _sc.setHsv( 20,255,255); _stateDef = "FAILED"; break;
- case YACS::ERROR: _sc.setHsv( 0,255,255); _stateDef = "ERROR"; break;
- default: _sc=Qt::lightGray; _stateDef = "---";
+ case YACS::UNDEFINED: _sc = Resource::UNDEFINED ; _stateDef = "UNDEFINED" ; break;
+ case YACS::INVALID: _sc = Resource::INVALID ; _stateDef = "INVALID" ; break;
+ case YACS::READY: _sc = Resource::READY ; _stateDef = "READY" ; break;
+ case YACS::TOLOAD: _sc = Resource::TOLOAD ; _stateDef = "TOLOAD" ; break;
+ case YACS::LOADED: _sc = Resource::LOADED ; _stateDef = "LOADED" ; break;
+ case YACS::TOACTIVATE: _sc = Resource::TOACTIVATE ; _stateDef = "TOACTIVATE" ; break;
+ case YACS::ACTIVATED: _sc = Resource::ACTIVATED ; _stateDef = "ACTIVATED" ; break;
+ case YACS::DESACTIVATED: _sc = Resource::DESACTIVATED ; _stateDef = "DESACTIVATED" ; break;
+ case YACS::DONE: _sc = Resource::DONE ; _stateDef = "DONE" ; break;
+ case YACS::SUSPENDED: _sc = Resource::SUSPENDED ; _stateDef = "SUSPENDED" ; break;
+ case YACS::LOADFAILED: _sc = Resource::LOADFAILED ; _stateDef = "LOADFAILED" ; break;
+ case YACS::EXECFAILED: _sc = Resource::EXECFAILED ; _stateDef = "EXECFAILED" ; break;
+ case YACS::PAUSE: _sc = Resource::PAUSE ; _stateDef = "PAUSE" ; break;
+ case YACS::INTERNALERR: _sc = Resource::INTERNALERR ; _stateDef = "INTERNALERR" ; break;
+ case YACS::DISABLED: _sc = Resource::DISABLED ; _stateDef = "DISABLED" ; break;
+ case YACS::FAILED: _sc = Resource::FAILED ; _stateDef = "FAILED" ; break;
+ case YACS::ERROR: _sc = Resource::ERROR ; _stateDef = "ERROR" ; break;
+ default: _sc = Resource::DEFAULT ; _stateDef = "---" ;
}
+ DEBTRACE(" - stateDef = " << _stateDef.toStdString());
if(oldsc != _sc)
_parent->update();
}
event->ignore();
}
-QColor SceneHeaderNodeItem::getValidColor(bool isValid)
+void SceneHeaderNodeItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
+{
+ event->ignore();
+}
+
+QColor SceneHeaderNodeItem::getValidColor()
{
- if (isValid)
+ if (_isValid)
return _sc;
else
- return _invalidNodeColor;
+ return Resource::invalidNodeColor;
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCENEHEADERNODEITEM_HXX_
#define _SCENEHEADERNODEITEM_HXX_
virtual qreal getHeaderBottom() const;
virtual void autoPosControl(AbstractSceneItem *item);
virtual void autoPosNewPort(AbstractSceneItem *item);
+ virtual void reorganizePorts(shownState ss);
virtual void popupMenu(QWidget *caller, const QPoint &globalPos);
virtual void adjustGeometry();
virtual void adjustPosPorts();
virtual QRectF getMinimalBoundingRect() const;
- virtual void adaptComposedNode(qreal deltaY);
+ virtual void adaptComposedNode(SceneItem* port, qreal deltaY);
virtual void setEdited(bool isEdited);
virtual void setValid(bool isValid);
virtual void setExecState(int execState);
virtual SceneCtrlPortItem* getCtrlInPortItem();
virtual SceneCtrlPortItem* getCtrlOutPortItem();
+ QColor getValidColor();
protected:
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
- QColor getValidColor(bool isValid);
+ virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
SceneHeaderItem *_header;
SceneCtrlPortItem *_controlIn;
SceneCtrlPortItem *_controlOut;
std::list<SceneInPortItem*> _inPorts;
std::list<SceneOutPortItem*> _outPorts;
+ int _maxPorts;
QColor _sc;
QString _stateDef;
bool _isValid;
bool _isEdited;
-
- static QColor _editedNodeBrushColor;
- static QColor _normalNodeBrushColor;
- static QColor _runNodeBrushColor;
- static QColor _validNodeColor;
- static QColor _invalidNodeColor;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SceneInPortItem.hxx"
#include "SceneOutPortItem.hxx"
#include "SceneNodeItem.hxx"
#include <QGraphicsSceneDragDropEvent>
+#include "Resource.hxx"
+
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
SubjectDataPort* from = dynamic_cast<SubjectDataPort*>(subFrom);
SubjectDataPort* to = dynamic_cast<SubjectDataPort*>(subTo);
if (from && to)
- if (!SubjectDataPort::tryCreateLink(from, to))
+ if (!SubjectDataPort::tryCreateLink(from, to,myData->getControl()))
Message mess;
}
QColor SceneInPortItem::getPenColor()
{
if (_dragOver)
- return QColor(255,0,0);
+ return Resource::dragOver;
if (isSelected())
return _hiPenColor;
else
return _hiBrushColor;
QColor color;
+ color = _brushColor;
if (isSelected())
color = _hiBrushColor;
- else
- color = _brushColor;
-
+ if (_emphasized)
+ color = Resource::emphasizeBrushColor;
if (_hover)
color = hoverColor(color);
return color;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCENEINPORTITEM_HXX_
#define _SCENEINPORTITEM_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SceneItem.hxx"
#include "Scene.hxx"
#include "SceneNodeItem.hxx"
#include "SceneHeaderNodeItem.hxx"
#include "SceneProcItem.hxx"
+#include "SceneElementaryNodeItem.hxx"
#include "SceneComposedNodeItem.hxx"
#include "GuiEditor.hxx"
#include <cassert>
#include <cmath>
+#include "Resource.hxx"
+
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
case YACS::HMI::ENDLOAD:
guiEditor = QtGuiContext::getQtCurrent()->getGMain()->_guiEditor;
GuiContext::getCurrent()->getSubjectProc()->select(true);
- guiEditor->rebuildLinks();
+ //guiEditor->rebuildLinks();
break;
}
}
_parent = parent;
_label = label;
_level = 1;
- _margin = 4;
- _nml = 5;
_width = 6;
_height = 4;
- _penColor = QColor(0,0,128);
- _hiPenColor = QColor(0,0,190);
- _brushColor = QColor(128,128,128);
- _hiBrushColor = QColor(190,190,190);
+ _incHeight = 0; // used in elementaryNode when ports added
+ _penColor = Resource::Scene_pen;
+ _hiPenColor = Resource::Scene_hiPen;
+ _brushColor = Resource::Scene_brush;
+ _hiBrushColor = Resource::Scene_hiBrush;
_hasHeader = false;
- _hasNml= false;
_optimize = true; // to be set individually or globally by user (shrink items)
_dragable = false;
_dragButton = Qt::LeftButton;
return _level;
}
-qreal AbstractSceneItem::getMargin()
+void AbstractSceneItem::setLevel()
{
- return _margin;
+ if (_parent)
+ _level = _parent->getLevel() +1;
+ if (SceneItem *item = dynamic_cast<SceneItem*>(this))
+ foreach (QGraphicsItem *child, item->childItems())
+ if (AbstractSceneItem *sci = dynamic_cast<AbstractSceneItem*>(child))
+ sci->setLevel();
}
void AbstractSceneItem::reorganize()
{
}
-qreal AbstractSceneItem::getInternWidth()
-{
- return _width -2*_margin -2*_hasNml*_nml;
-}
-
-qreal AbstractSceneItem::getInternHeight()
-{
- return _height -2*_hasNml*_nml;
-}
-
QRectF AbstractSceneItem::childBoundingRect(AbstractSceneItem *child) const
{
QGraphicsItem *item = dynamic_cast<QGraphicsItem*>(child);
- assert(item);
+ YASSERT(item);
return (item->mapToParent(item->boundingRect())).boundingRect();
}
: QGraphicsItem(parent), AbstractSceneItem(scene, parent, label)
{
_hover = false;
+ _ancestorShrinked = false;
setToolTip(_label);
DEBTRACE("SceneItem::SceneItem "<<label.toStdString()<<" "<<this<<" "<<_parent<<" "<< _level);
setFlag(QGraphicsItem::ItemIsSelectable);
QWidget *widget)
{
//DEBTRACE("SceneItem::paint");
- painter->save();
- painter->setPen(getPenColor());
- painter->setBrush(getBrushColor());
- painter->drawRoundRect(QRectF(0, 0, _width, _height), 33*_height/_width, 33);
- painter->restore();
+// painter->save();
+// painter->setPen(getPenColor());
+// painter->setBrush(getBrushColor());
+// painter->drawRoundRect(QRectF(0, 0, _width, _height), 33*_height/_width, 33);
+// painter->restore();
}
void SceneItem::setTopLeft(QPointF topLeft)
{
- setPos(topLeft);
+ setPos(int(topLeft.x()), int(topLeft.y()));
if (_parent)
_parent->checkGeometryChange();
}
void SceneItem::checkGeometryChange()
{
- QRectF childrenBox = childrenBoundingRect();
- qreal newWidth = childrenBox.width() + 2*_margin;
- qreal newHeight = childrenBox.height() + 2*_margin;
- SceneNodeItem *aNode = dynamic_cast<SceneNodeItem*>(this);
- if (aNode)
+ DEBTRACE("SceneItem::checkGeometryChange: enter : " << _label.toStdString() << " width= " << _width << " height= " << _height);
+ qreal newWidth;
+ qreal newHeight;
+ bool resize = false;
+ SceneElementaryNodeItem* aElemNode = dynamic_cast<SceneElementaryNodeItem*>(this);
+ if (QtGuiContext::getQtCurrent()->isLoadingPresentation())
{
- newWidth += 2*_nml;
- newHeight += 2*_nml;
+ newWidth = _width;
+ newHeight = _height;
+ resize = true;
+ }
+ else
+ {
+ if (aElemNode)
+ {
+ newWidth = _width;
+ newHeight = _height;
+ resize = true;
+ DEBTRACE("elementaryNode resize true");
+ }
+ else
+ {
+ QRectF childrenBox = childrenBoundingRect();
+ newWidth = childrenBox.width();
+ newHeight = childrenBox.height();
+ DEBTRACE("composedNode newWidth= " << newWidth << " newHeight=" << newHeight);
+ }
}
- bool resize = false;
bool wider = (newWidth > _width + 0.5);
qreal deltaW = 0;
bool higher = (newHeight > _height + 0.5);
if (wider || (_optimize && (newWidth < _width)))
{
deltaW = newWidth - _width;
- _width = newWidth;
resize = true;
}
if (higher || (_optimize && (newHeight < _height)))
{
deltaH = newHeight - _height;
- _height = newHeight;
resize = true;
}
-// DEBTRACE("SceneItem::checkGeometryChange "<<_label.toStdString() <<
-// " " << wider << " " << higher << " " << changeWidth << " " << resize);
+ if (_incHeight >0) //when a port has been added in an elementaryNode, force the collision resolv
+ {
+ higher = true;
+ deltaH = _incHeight;
+ resize = true;
+ }
+ _incHeight = 0;
+ DEBTRACE("SceneItem::checkGeometryChange "<<_label.toStdString() <<
+ " " << wider << " " << higher << " " << changeWidth << " " << resize);
+
+ if (resize)
+ {
+ prepareGeometryChange();
+ _width = newWidth;
+ _height = newHeight;
+ }
+ SceneNodeItem *aNode = dynamic_cast<SceneNodeItem*>(this);
if (aNode)
{
if (changeWidth) aNode->adjustHeader();
if (SceneComposedNodeItem *bloc = dynamic_cast<SceneComposedNodeItem*>(_parent))
bloc->collisionResolv(aNode, oldPos);
}
+ if (changeWidth) aNode->updateLinks();
}
if (resize)
{
-// DEBTRACE("SceneItem::checkGeometryChange "<<_label.toStdString()<<" "<<_width<<" "<<_height);
- prepareGeometryChange();
+ update();
if (_parent)
_parent->checkGeometryChange();
}
+ if(resize && aNode)
+ aNode->setExpandedWH();
+}
+
+/*! generic behaviour for headers:
+ * obtain the tooltip from parent.
+ * Method to be redefined in derived classes.
+ */
+QString SceneItem::getToolTip()
+{
+ QString tooltip = _label;
+ SceneItem *parent = getParent();
+ if (parent)
+ tooltip = parent->getToolTip();
+ return tooltip;
}
// /*!
QColor SceneItem::hoverColor(QColor origColor)
{
- qreal h, s, v, a;
- origColor.getHsvF(&h, &s, &v, &a);
- v = 0.95*v;
- return QColor::fromHsvF(h, s, v, a);
+ qreal r, g, b, a;
+ origColor.getRgbF(&r, &g, &b, &a);
+ r = 0.96*r;
+ g = 0.96*g;
+ b = 0.96*b;
+ return QColor::fromRgbF(r, g, b, a);
+
+ // qreal h, s, v, a;
+ // origColor.getHsvF(&h, &s, &v, &a);
+ // s = 1.05*s;
+ // if (s>254.0) s=255.0;
+ // return QColor::fromHsvF(h, s, v, a);
}
void SceneItem::hoverEnterEvent(QGraphicsSceneHoverEvent * event)
m.popupMenu(caller, globalPos);
}
+void SceneItem::setEventPos(QPointF point)
+{
+ QPointF localPoint = mapFromScene(point);
+ if (localPoint.y() <= getHeaderBottom())
+ localPoint.setY(getHeaderBottom()+1);
+ _eventPos = localPoint;
+}
+
+void SceneItem::updateChildItems()
+{
+}
+
+void SceneItem::shrinkExpandLink(bool se)
+{
+}
+
+
+void SceneItem::shrinkExpandRecursive(bool isExpanding, bool fromHere)
+{
+}
+
+void SceneItem::updateLinks()
+{
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCENEITEM_HXX_
#define _SCENEITEM_HXX_
QWidget *widget) = 0;
virtual void setTopLeft(QPointF topLeft) = 0;
- virtual int getLevel();
- virtual qreal getMargin();
+ int getLevel();
+ void setLevel();
virtual void checkGeometryChange() = 0;
virtual void reorganize();
virtual QString getLabel();
virtual void addHeader();
virtual qreal getHeaderBottom();
- virtual qreal getWidth();
- virtual qreal getHeight();
+ qreal getWidth();
+ qreal getHeight();
virtual void setWidth(qreal width);
virtual void setHeight(qreal height);
- virtual qreal getInternWidth();
- virtual qreal getInternHeight();
virtual void popupMenu(QWidget *caller, const QPoint &globalPos) = 0;
virtual void activateSelection(bool selected);
virtual void setGeometryOptimization(bool optimize);
- inline bool hasNml() { return _hasNml; };
- inline qreal getNml() { return _hasNml*_nml; };
inline SceneItem* getParent() { return _parent; };
protected:
YACS::HMI::Scene *_scene;
QString _label;
int _level;
- qreal _margin;
- qreal _nml;
qreal _width;
qreal _height;
+ qreal _incHeight;
QColor _penColor;
QColor _brushColor;
QColor _hiPenColor;
QColor _hiBrushColor;
bool _hasHeader;
- bool _hasNml;
bool _optimize;
bool _dragable;
enum Qt::MouseButton _dragButton;
virtual void checkGeometryChange();
virtual void popupMenu(QWidget *caller, const QPoint &globalPos);
void setParent(SceneItem* parent);
+ virtual QString getToolTip();
+ void setEventPos(QPointF point);
+ virtual void updateChildItems();
+ virtual void updateLinks();
+ virtual void shrinkExpandLink(bool se);
+ virtual void shrinkExpandRecursive(bool isExpanding, bool fromHere);
+ bool isAncestorShrinked() { return _ancestorShrinked; };
protected:
// virtual bool sceneEvent(QEvent *event);
virtual QColor getBrushColor();
QColor hoverColor(QColor origColor);
bool _hover;
+ bool _ancestorShrinked;
+ QPointF _eventPos;
};
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
+#define CHRONODEF
+#include "chrono.hxx"
+
#include "SceneLinkItem.hxx"
#include "SceneDataPortItem.hxx"
+#include "SceneCtrlPortItem.hxx"
#include "SceneElementaryNodeItem.hxx"
#include "SceneHeaderNodeItem.hxx"
#include "Scene.hxx"
+#include "Resource.hxx"
#include "Menus.hxx"
-// #include <QGraphicsSceneHoverEvent>
#include <QPointF>
+#include <cmath>
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
{
_from = from;
_to = to;
- _penColor = QColor( 0, 0, 96);
- _hiPenColor = QColor( 0, 0, 128);
- _brushColor = QColor( 0, 0, 192);
- _hiBrushColor = QColor(192, 192, 255);
+ _penColor = Resource::link_draw_color.darker(Resource::link_pen_darkness);
+ _hiPenColor = Resource::link_select_color.darker(Resource::link_pen_darkness);
+ _brushColor = Resource::link_draw_color;
+ _hiBrushColor = Resource::link_select_color;
_level += 100;
setZValue(_level);
+ DEBTRACE("ZValue=" << zValue());
_lp.clear();
_directions.clear();
_nbPoints = 0;
+ _path = QPainterPath();
}
SceneLinkItem::~SceneLinkItem()
setZValue(_level+100);
else
setZValue(_level);
+ DEBTRACE("ZValue=" << zValue());
SceneObserverItem::select(isSelected);
}
return _path;
}
-void SceneLinkItem::setShape()
+void SceneLinkItem::setShape(int thickness)
{
+ DEBTRACE("---");
_path = QPainterPath();
_path.setFillRule(Qt::WindingFill);
QPointF pfrom = start();
QPointF pto = goal();
- if (_nbPoints)
+ DEBTRACE(Scene::_straightLinks);
+ if (_nbPoints && !Scene::_straightLinks)
{
- addArrow(pfrom, _lp[0], _RIGHT);
+ DEBTRACE("---");
+ addArrow(pfrom, _lp[0], _RIGHT, thickness);
for (int k=0; k<_nbPoints-1; k++)
- addArrow(_lp[k], _lp[k+1], _directions[k+1]);
- addArrow(_lp[_nbPoints-1], pto, _RIGHT);
+ addArrow(_lp[k], _lp[k+1], _directions[k+1], thickness);
+ addArrow(_lp[_nbPoints-1], pto, _RIGHT, thickness);
}
else
{
- _path.moveTo(pfrom.x() -1, pfrom.y() -1);
- _path.lineTo(pto.x() +1, pto.y() -1);
- _path.lineTo(pto.x() +1, pto.y() +1);
- _path.lineTo(pfrom.x() -1, pfrom.y() +1);
- _path.lineTo(pfrom.x() -1, pfrom.y() -1);
+ DEBTRACE("---");
+ double d = std::sqrt((pto.x() - pfrom.x())*(pto.x() - pfrom.x()) + (pto.y() - pfrom.y())*(pto.y() - pfrom.y()));
+ double sina = (pto.y() - pfrom.y())/d;
+ double cosa = (pto.x() - pfrom.x())/d;
+ double ep=3.0*thickness/2.0 * Resource::link_thickness;
+ _path.moveTo(pfrom.x() -ep*sina, pfrom.y() +ep*cosa);
+ _path.lineTo(pto.x() -ep*sina, pto.y() +ep*cosa);
+ _path.lineTo(pto.x() +ep*sina, pto.y() -ep*cosa);
+ _path.lineTo(pfrom.x() +ep*sina, pfrom.y() -ep*cosa);
+ _path.lineTo(pfrom.x() -ep*sina, pfrom.y() -ep*cosa);
+ //arrow
+ double x=(pto.x() + pfrom.x())/2.;
+ double y=(pto.y() + pfrom.y())/2.;
+ double l=8*ep;
+ double e=4*ep;
+ _path.moveTo(x+l*cosa,y+l*sina);
+ _path.lineTo(x+e*sina,y-e*cosa);
+ _path.lineTo(x-e*sina,y+e*cosa);
+ _path.lineTo(x+l*cosa,y+l*sina);
}
}
void SceneLinkItem::addArrow(QPointF pfrom,
QPointF pto,
- HMI::Direction dir)
+ YACS::HMI::Direction dir,
+ int thickness)
{
qreal x, y, width, height, length;
+ double ep=thickness * Resource::link_thickness;
switch (dir)
{
case _UP:
- x = pfrom.x() -1;
- y = pfrom.y() -1;
- width = 3;
- height = 2 + pto.y() -pfrom.y();
+ x = pfrom.x() -ep;
+ y = pfrom.y() -ep;
+ width = 3*ep;
+ height = 2*ep + pto.y() -pfrom.y();
length = height;
break;
case _RIGHT:
- x = pfrom.x() -1;
- y = pfrom.y() -1;
- width = 2 + pto.x() -pfrom.x();
- height = 3;
+ x = pfrom.x() -ep;
+ y = pfrom.y() -ep;
+ width = 2*ep + pto.x() -pfrom.x();
+ height = 3*ep;
length = width;
break;
case _DOWN:
- x = pto.x() -1;
- y = pto.y() -1;
- width = 3;
- height = 2 + pfrom.y() -pto.y();
+ x = pto.x() -ep;
+ y = pto.y() -ep;
+ width = 3*ep;
+ height = 2*ep + pfrom.y() -pto.y();
length = height;
break;
case _LEFT:
- x = pto.x() -1;
- y = pto.y() -1;
- width = 2 + pfrom.x() -pto.x();
- height = 3;
+ x = pto.x() -ep;
+ y = pto.y() -ep;
+ width = 2*ep + pfrom.x() -pto.x();
+ height = 3*ep;
length = width;
break;
}
if (length > 20)
{
- int e=5, h1=4, h2=8;
+ int e=5*ep, h1=4*ep, h2=8*ep;
switch (dir)
{
case _UP:
QWidget *widget)
{
//DEBTRACE("SceneLinkItem::paint " << _label.toStdString());
- if (_path.isEmpty()) setShape();
+ if (_path.isEmpty()) setShape(_emphasized+1);
painter->save();
QPen pen;
pen.setColor(getPenColor());
void SceneLinkItem::update(GuiEvent event, int type, Subject* son)
{
DEBTRACE("SceneLinkItem::update "<< eventName(event)<<" "<<type<<" "<<son);
+ switch (event)
+ {
+ case YACS::HMI::EMPHASIZE:
+ DEBTRACE("SceneObserverItem::update EMPHASIZE " << type);
+ if (type)
+ {
+ _emphasized = true;
+ setZValue(_level+100);
+ DEBTRACE("ZValue=" << zValue());
+ setShape(2);
+ }
+ else
+ {
+ _emphasized = false;
+ setZValue(_level);
+ DEBTRACE("ZValue=" << zValue());
+ setShape();
+ }
+ QGraphicsItem::update();
+ break;
+ case YACS::HMI::SWITCHSHAPE:
+ DEBTRACE("SceneObserverItem::update SWITCHSHAPE");
+ setShape(_emphasized+1);
+ QGraphicsItem::update();
+ break;
+ default:
+ ;
+ }
}
void SceneLinkItem::popupMenu(QWidget *caller, const QPoint &globalPos)
void SceneLinkItem::setPath(LinkPath lp)
{
DEBTRACE("SceneLinkItem::setPath " << lp.size());
+ CHRONO(10);
+ prepareGeometryChange();
_nbPoints = lp.size();
_lp.reserve(_nbPoints+1);
_directions.reserve(_nbPoints +2);
prevx = p.x();
prevy = p.y();
}
+
+ if(k==1)
+ {
+ //link should be direct (k=0) or orthogonal k>=2
+ k=2;
+ _lp[1]=_lp[0];
+ _lp[1].setY(goal().y());
+ if (goal().y() > start().y()) _directions[1] = _UP;
+ else _directions[1] = _DOWN;
+ }
+
+ if(k>2 && _directions[k-1]==_RIGHT)
+ {
+ //remove last point
+ k=k-1;
+ }
+
_nbPoints = k;
_lp[k-1].setY(goal().y());
_directions[k] = _RIGHT; // --- direction from point k-1 to goal
else
break;
}
+ CHRONOSTOP(10);
+ CHRONO(11);
if (Scene::_simplifyLinks) minimizeDirectionChanges();
+ CHRONOSTOP(11);
+ CHRONO(12);
if (Scene::_force2NodesLink) force2points();
for (k=0; k<_nbPoints; k++)
DEBTRACE("_lp[" << k << "](" << _lp[k].x() << "," << _lp[k].y() << ")");
- setShape();
+ setShape(_emphasized+1);
+ SceneItem::update();
}
/*!
// DEBTRACE("("<< _lp[i].x() << "," << _lp[i].y() << ") "
// << _directions[i]);
// }
+
+ if(newdir[newk]==_RIGHT)
+ {
+ //remove last point
+ newk=newk-1;
+ }
_nbPoints = newk+1;
for (int i=0; i<_nbPoints; i++)
{
DEBTRACE("localTo(" << localTo.x() << "," << localTo.y() << ")");
return mapFromItem(dpit, localTo);
}
+
+void SceneLinkItem::updateShape()
+{
+ prepareGeometryChange();
+ if (_nbPoints)
+ {
+ // a path has been calculated, update it
+ QPointF pfrom = start();
+ QPointF pto = goal();
+ _lp[0].setY(pfrom.y());
+ if(_lp[1].y() > _lp[0].y())_directions[1]=_UP;
+ else _directions[1]=_DOWN;
+ _lp[_nbPoints-1].setY(pto.y());
+ if(_lp[_nbPoints-1].y() > _lp[_nbPoints-2].y())_directions[_nbPoints-1]=_UP;
+ else _directions[_nbPoints-1]=_DOWN;
+ }
+ setShape(_emphasized+1);
+}
+
+QColor SceneLinkItem::getPenColor()
+{
+ _penColor = Resource::link_draw_color.darker(Resource::link_pen_darkness);
+ _hiPenColor = Resource::link_select_color.darker(Resource::link_pen_darkness);
+ return SceneObserverItem::getPenColor();
+}
+
+QColor SceneLinkItem::getBrushColor()
+{
+ _brushColor = Resource::link_draw_color;
+ _hiBrushColor = Resource::link_select_color;
+ return SceneObserverItem::getBrushColor();
+}
+
+// Get the node at the "from" place of the link
+SceneNodeItem* SceneLinkItem::getFromNode() {
+ SceneCtrlPortItem* p = dynamic_cast<SceneCtrlPortItem*>(_from);
+ if (p) {
+ return(p->getParentNode());
+ } else {
+ return(NULL);
+ };
+}
+
+// Get the node at the "to" place of the link
+SceneNodeItem* SceneLinkItem::getToNode() {
+ SceneCtrlPortItem* p = dynamic_cast<SceneCtrlPortItem*>(_to);
+ if (p) {
+ return(p->getParentNode());
+ } else {
+ return(NULL);
+ };
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCENELINKITEM_HXX_
#define _SCENELINKITEM_HXX_
#include <QPainterPath>
#include <vector>
+#ifdef WNT
+#ifdef _UP
+#undef _UP
+#endif
+#endif
+
namespace YACS
{
namespace HMI
} Direction;
class ScenePortItem;
+ class SceneNodeItem;
class SceneLinkItem: public SceneObserverItem
{
virtual void force2points();
virtual QPointF start();
virtual QPointF goal();
+ virtual void updateShape();
+ virtual SceneNodeItem* getFromNode();
+ virtual SceneNodeItem* getToNode();
protected:
- void setShape();
+ void setShape(int thickness = 1);
void addArrow(QPointF pfrom,
QPointF pto,
- HMI::Direction dir);
+ HMI::Direction dir,
+ int thickness = 1);
+ virtual QColor getBrushColor();
+ virtual QColor getPenColor();
QPainterPath _path;
ScenePortItem* _from;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SceneNodeItem.hxx"
#include "SceneComposedNodeItem.hxx"
+#include "SceneProcItem.hxx"
#include "SceneHeaderNodeItem.hxx"
#include "SceneInPortItem.hxx"
#include "SceneOutPortItem.hxx"
#include "SceneCtrlInPortItem.hxx"
#include "SceneCtrlOutPortItem.hxx"
+#include "SceneLinkItem.hxx"
#include "Scene.hxx"
#include "QtGuiContext.hxx"
#include "Menus.hxx"
+#include "GuiEditor.hxx"
+#include "InPort.hxx"
+#include "OutPort.hxx"
#include "Switch.hxx"
+#include "Resource.hxx"
#include <QGraphicsSceneHoverEvent>
#include <QPointF>
+#include <cmath>
#include <sstream>
#include <cassert>
+#include <vector>
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
_inPorts.clear();
_outPorts.clear();
_header = 0;
- _height = 50 + 2*_nml;
- _width = 2*ScenePortItem::getPortWidth() + 3*_margin + 2*_nml;
- _brushColor = QColor(0,0,128);
+ _brushColor = Resource::Scene_pen;
_moving = false;
- _hasNml = true;
+ _moved = false;
+ _blocX = false;
+ _blocY = false;
_dragable = true;
_dragButton = Qt::MidButton;
_execState = YACS::UNDEFINED;
+ _expanded = true;
+ _expandedPos = QPointF(0,0);
+ _expandedWidth = _width;
+ _expandedHeight = _height;
+ _shownState = expandShown;
}
SceneNodeItem::~SceneNodeItem()
void SceneNodeItem::setWidth(qreal width)
{
- _width = width;
- adjustHeader();
+ if (width != _width)
+ {
+ prepareGeometryChange();
+ _width = width;
+ _expandedWidth = _width;
+ adjustHeader();
+ QGraphicsItem::update();
+ }
}
void SceneNodeItem::setHeight(qreal height)
{
- _height = height;
+ if (height != _height)
+ {
+ prepareGeometryChange();
+ _height = height;
+ _expandedHeight = _height;
+ QGraphicsItem::update();
+ }
}
void SceneNodeItem::addHeader()
this,
getHeaderLabel());
updateState();
- QPointF topLeft(_margin + _nml, _margin + _nml);
- _header->setTopLeft(topLeft);
checkGeometryChange();
}
}
QWidget *widget)
{
//DEBTRACE("SceneNodeItem::paint");
- painter->save();
- painter->setBrush(QBrush(Qt::NoBrush));
- painter->setPen(QPen(Qt::NoPen));
- painter->drawRect(QRectF(0, 0, _width, _height));
-
- painter->setPen(getPenColor());
- painter->setBrush(getBrushColor());
- painter->drawRect(QRectF(_nml, _nml,
- _width-2*_nml, _height-2*_nml));
- painter->restore();
}
void SceneNodeItem::update(GuiEvent event, int type, Subject* son)
{
DEBTRACE("SceneNodeItem::update "<< eventName(event)<<" "<<type<<" "<<son);
+ SceneObserverItem::update(event, type, son);
SubjectNode *snode = 0;
Node *node = 0;
switch (event)
{
}
-qreal SceneNodeItem::getHeaderBottom()
+void SceneNodeItem::reorganizeShrinkExpand()
{
- qreal bottom = 0;
- if (_hasHeader)
- bottom = childBoundingRect(_header).bottom();
- return bottom;
}
-void SceneNodeItem::autoPosNewPort(AbstractSceneItem *item, int nbPorts)
+qreal SceneNodeItem::getHeaderBottom()
{
- SceneInPortItem* inPortItem = dynamic_cast<SceneInPortItem*>(item);
- bool isInPort = (inPortItem != 0);
-
- qreal xLeft = _margin + _nml;
- if (!isInPort) xLeft += ScenePortItem::getPortWidth() + _margin + _nml;
-
- qreal yTop = getHeaderBottom() + _margin;
- yTop += nbPorts *(ScenePortItem::getPortHeight() + _margin);
+ if (_hasHeader) {
+ return _header->getHeaderBottom();
+ } else {
+ return 0;
+ };
+}
- DEBTRACE("left, top " << xLeft << " " << yTop);
- QPointF topLeft(xLeft, yTop);
- item->setTopLeft(topLeft);
+void SceneNodeItem::autoPosNewPort(AbstractSceneItem *item, int nbPorts) {
}
void SceneNodeItem::popupMenu(QWidget *caller, const QPoint &globalPos)
SceneComposedNodeItem *proc = dynamic_cast<SceneComposedNodeItem*>(item);
proc->rebuildLinks();
}
+ if (_moved)
+ if (Resource::ensureVisibleWhenMoved)
+ QtGuiContext::getQtCurrent()->getView()->ensureVisible(this);
+ _moved = false;
}
void SceneNodeItem::mouseMoveEvent(QGraphicsSceneMouseEvent * event)
{
QPointF oldPos = pos();
QPointF aPos = oldPos + event->scenePos() - event->lastScenePos();
- if (aPos.x() < _margin + _nml)
- aPos.setX(_margin + _nml);
- if (aPos.y() < _margin + bloc->getHeaderBottom() + _nml)
- aPos.setY(_margin + bloc->getHeaderBottom() + _nml);
+ if (aPos != oldPos)
+ _moved = true;
+ if (aPos.x() > oldPos.x()) _blocX = false;
+ if (aPos.y() > oldPos.y()) _blocY = false;
+ if (aPos.x() < Resource::Border_Margin)
+ {
+ aPos.setX(Resource::Border_Margin);
+ _blocX = true;
+ }
+ if ( aPos.y() < bloc->getHeaderBottom() )
+ {
+ aPos.setY(bloc->getHeaderBottom());
+ _blocY = true;
+ }
setTopLeft(aPos);
bloc->collisionResolv(this, oldPos);
}
}
}
+void SceneNodeItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
+{
+ DEBTRACE("SceneNodeItem::mouseDoubleClickEvent");
+ if (dynamic_cast<SceneProcItem*>(this))
+ return;
+ QtGuiContext::getQtCurrent()->getGMain()->_guiEditor->shrinkExpand();
+}
+
void SceneNodeItem::setTopLeft(QPointF topLeft)
{
QPointF oldPos = pos();
setPos(topLeft);
+
+ //update links
+ updateLinks();
+
if (_parent)
{
if (SceneComposedNodeItem *bloc = dynamic_cast<SceneComposedNodeItem*>(_parent))
bloc->collisionResolv(this, oldPos);
_parent->checkGeometryChange();
}
+ _expandedPos = pos();
}
void SceneNodeItem::adjustHeader()
void SceneNodeItem::updateState()
{
SubjectNode *snode = dynamic_cast<SubjectNode*>(_subject);
- assert(snode);
+ YASSERT(snode);
Node *node = snode->getNode();
- assert(node);
+ YASSERT(node);
switch (node->getState())
{
case YACS::INVALID:
QString SceneNodeItem::getHeaderLabel()
{
+ DEBTRACE("SceneNodeItem::getHeaderLabel");
QString extLabel = _subject->getName().c_str();
SceneObserverItem *soi = 0;
return extLabel;
}
+
+void SceneNodeItem::updateLinks()
+{
+ //update control links
+ std::list<SubjectControlLink*> lscl=dynamic_cast<SubjectNode*>(_subject)->getSubjectControlLinks();
+ for (std::list<SubjectControlLink*>::const_iterator it = lscl.begin(); it != lscl.end(); ++it)
+ {
+ SceneLinkItem* item = dynamic_cast<SceneLinkItem*>(QtGuiContext::getQtCurrent()->_mapOfSceneItem[*it]);
+ item->updateShape();
+ }
+
+ //update data links through child items update (SceneDataPortItem)
+ updateChildItems();
+}
+
+void SceneNodeItem::updateChildItems()
+{
+ foreach (QGraphicsItem *child, childItems())
+ {
+ if (SceneItem *sci = dynamic_cast<SceneItem*>(child))
+ {
+ sci->updateLinks();
+ }
+ }
+}
+
+void SceneNodeItem::shrinkExpandLink(bool se)
+{
+ foreach (QGraphicsItem *child, childItems())
+ {
+ if (SceneItem *sci = dynamic_cast<SceneItem*>(child))
+ {
+ sci->shrinkExpandLink(se);
+ }
+ }
+}
+
+void SceneNodeItem::showOutScopeLinks()
+{
+ SubjectNode *snode = dynamic_cast<SubjectNode*>(_subject);
+ YASSERT(snode);
+ Node *node = snode->getNode();
+ YASSERT(node);
+ vector<pair<OutPort *, InPort *> > listLeaving = node->getSetOfLinksLeavingCurrentScope();
+ vector<pair<InPort *, OutPort *> > listIncoming = node->getSetOfLinksComingInCurrentScope();
+ vector<pair<OutPort *, InPort *> > outScope = listLeaving;
+ vector<pair<InPort *, OutPort *> >::iterator it1;
+ for (it1 = listIncoming.begin(); it1 != listIncoming.end(); ++it1)
+ {
+ pair<OutPort *, InPort *> outin = pair<OutPort *, InPort *>((*it1).second, (*it1).first);
+ outScope.push_back(outin);
+ }
+ vector<pair<OutPort*, InPort*> >::const_iterator it = outScope.begin();
+ for( ; it != outScope.end(); ++it)
+ {
+ YASSERT(QtGuiContext::getQtCurrent()->_mapOfSubjectLink.count(*it));
+ SubjectLink* slink = QtGuiContext::getQtCurrent()->_mapOfSubjectLink[*it];
+ YASSERT(QtGuiContext::getQtCurrent()->_mapOfSceneItem.count(slink));
+ SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[slink];
+ item->show();
+ }
+}
+
+void SceneNodeItem::setShownState(shownState ss)
+{
+ _shownState = ss;
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCENENODEITEM_HXX_
#define _SCENENODEITEM_HXX_
{
namespace HMI
{
+ typedef enum
+ {
+ expandShown,
+ shrinkShown,
+ shrinkHidden
+ } shownState;
+
class SceneHeaderItem;
class SceneHeaderNodeItem;
class SceneComposedNodeItem;
virtual void updateName();
virtual void arrangeNodes(bool isRecursive);
virtual void arrangeChildNodes();
+ virtual void reorganizeShrinkExpand();
+ virtual void updateChildItems();
+ virtual void shrinkExpandLink(bool se);
+ virtual void showOutScopeLinks();
+ virtual void updateLinks();
+ virtual void setShownState(shownState ss);
+ bool isExpanded() { return _expanded; };
+ void setExpanded(bool e){ _expanded = e; };
+ void setExpandedPos(QPointF epos) { _expandedPos = epos; };
+ qreal getExpandedX() { return _expandedPos.x(); };
+ qreal getExpandedY() { return _expandedPos.y(); };
+ void setExpandedWH() {_expandedWidth = _width; _expandedHeight = _height; };
+ void setExpandedWH(qreal w, qreal h) {_expandedWidth = w; _expandedHeight = h; };
+ qreal getExpandedWidth() { return _expandedWidth; };
+ qreal getExpandedHeight() { return _expandedHeight; };
+ shownState getShownState() {return _shownState; };
+ bool _blocX;
+ bool _blocY;
protected:
virtual QString getMimeFormat();
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
+ virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
virtual void updateState();
virtual void setExecState(int execState);
SceneHeaderNodeItem *_header;
int _execState;
bool _moving;
+ bool _moved;
+ bool _expanded;
QPointF _prevPos;
+ QPointF _expandedPos;
+ qreal _expandedWidth;
+ qreal _expandedHeight;
+ shownState _shownState;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SceneObserverItem.hxx"
#include "QtGuiContext.hxx"
#include "ItemMimeData.hxx"
#include "Scene.hxx"
+#include "SchemaItem.hxx"
+#include "Resource.hxx"
#include <QGraphicsSceneMouseEvent>
#include <QApplication>
{
_subject = subject;
_draging = false;
+ _dragModifier = false;
+ _emphasized = false;
_subject->attach(this);
QtGuiContext::getQtCurrent()->_mapOfSceneItem[_subject]=this;
}
void SceneObserverItem::update(GuiEvent event, int type, Subject* son)
{
DEBTRACE(" SceneObserverItem::update " << eventName(event)<< " " << type << " " << son);
+ switch (event)
+ {
+ case YACS::HMI::EMPHASIZE:
+ DEBTRACE("SceneObserverItem::update EMPHASIZE " << type);
+ if (type)
+ _emphasized = true;
+ else
+ _emphasized = false;
+ QGraphicsItem::update();
+ break;
+ default:
+ ;
+ }
}
void SceneObserverItem::select(bool isSelected)
else setSelected(false);
}
+QString SceneObserverItem::getToolTip()
+{
+ DEBTRACE("SceneObserverItem::getToolTip");
+ if (!_subject)
+ return _label;
+ if ( !QtGuiContext::getQtCurrent() || !QtGuiContext::getQtCurrent()->_mapOfSchemaItem.count(_subject))
+ return _label;
+ QString val ="";
+ SchemaItem * item = QtGuiContext::getQtCurrent()->_mapOfSchemaItem[_subject];
+ val = item->data(0, Qt::ToolTipRole).toString();
+ return val;
+}
+
void SceneObserverItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
DEBTRACE("SceneObserverItem::mousePressEvent " << _label.toStdString()
if (!_scene->isZooming())
{
_subject->select(true);
- if (_dragable && (event->button() == _dragButton))
+ if (_dragable && (event->button() == _dragButton) && QtGuiContext::getQtCurrent()->isEdition())
{
setCursor(Qt::ClosedHandCursor);
_draging = true;
+ _dragModifier= event->modifiers() & (Qt::ControlModifier | Qt::ShiftModifier);
}
}
}
drag->setMimeData(mime);
mime->setSubject(_subject);
mime->setData(getMimeFormat(), "_subject");
+ if(_dragModifier)
+ mime->setControl(false);
+ else
+ mime->setControl(true);
QPixmap pixmap(34, 34);
pixmap.fill(Qt::white);
drag->setHotSpot(QPoint(15, 20));
drag->exec();
- setCursor(Qt::OpenHandCursor);
+ //restore non drag state
+ setCursor(Qt::ArrowCursor);
+ _draging = false;
+ _dragModifier = false;
}
}
setCursor(Qt::ArrowCursor);
}
_draging = false;
+ _dragModifier = false;
+}
+
+QColor SceneObserverItem::getBrushColor()
+{
+ QColor color;
+ color = _brushColor;
+ if (isSelected())
+ color = _hiBrushColor;
+ if (_emphasized)
+ color = Resource::emphasizeBrushColor;
+ if (_hover)
+ color = hoverColor(color);
+ return color;
}
void SceneObserverItem::activateSelection(bool selected)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCENEOBSERVERITEM_HXX_
#define _SCENEOBSERVERITEM_HXX_
#include "SceneItem.hxx"
+#include <QString>
+
namespace YACS
{
namespace HMI
virtual void select(bool isSelected);
virtual void activateSelection(bool selected);
virtual Subject* getSubject();
+ virtual QString getToolTip();
protected:
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+ virtual QColor getBrushColor();
virtual QString getMimeFormat();
Subject* _subject;
bool _draging;
+ bool _dragModifier;
+ bool _emphasized;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SceneOutPortItem.hxx"
#include "SceneNodeItem.hxx"
#include "SceneItem.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCENEOUTPORTITEM_HXX_
#define _SCENEOUTPORTITEM_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "ScenePortItem.hxx"
+#include "Resource.hxx"
+
// #include "QtGuiContext.hxx"
// #include "Menus.hxx"
// #include <QGraphicsSceneHoverEvent>
using namespace YACS::ENGINE;
using namespace YACS::HMI;
-const int ScenePortItem::_portWidth = 100;
-const int ScenePortItem::_portHeight = 25;
-
ScenePortItem::ScenePortItem(QString label)
{
_text = 0;
ScenePortItem::~ScenePortItem()
{
}
-
-int ScenePortItem::getPortWidth()
-{
- return _portWidth;
-}
-
-int ScenePortItem::getPortHeight()
-{
- return _portHeight;
-}
-
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCENEPORTITEM_HXX_
#define _SCENEPORTITEM_HXX_
ScenePortItem(QString label);
virtual ~ScenePortItem();
virtual void setText(QString label)=0;
- static int getPortWidth();
- static int getPortHeight();
protected:
- static const int _portWidth;
- static const int _portHeight;
SceneTextItem* _text;
};
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SceneProcItem.hxx"
#include "Menus.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCENEPROCITEM_HXX_
#define _SCENEPROCITEM_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SceneTextItem.hxx"
// #include "QtGuiContext.hxx"
// #include <QGraphicsSceneHoverEvent>
#include <QPointF>
+#include "Resource.hxx"
+
// #include <cassert>
//#define _DEVDEBUG_
SceneTextItem::SceneTextItem(QGraphicsScene *scene, SceneItem *parent,
- QString label)
- : QGraphicsTextItem(label, parent), AbstractSceneItem(scene, parent, label)
+ QString label, bool center )
+ : QGraphicsTextItem(parent), AbstractSceneItem(scene, parent, label)
{
setToolTip(label);
+ _center = center;
DEBTRACE("SceneTextItem::SceneTextItem "<<label.toStdString()<<" "<<this<<" "<<_parent<<" "<< _level);
- setPos(x()+10, y());
}
SceneTextItem::~SceneTextItem()
QWidget *widget)
{
QGraphicsTextItem::paint(painter, option, widget);
+
+ int dx, fl;
+ if (_center) {
+ dx = 0;
+ fl = Qt::AlignCenter;
+ } else {
+ dx = Resource::Text_DX;
+ fl = Qt::AlignLeft | Qt::AlignVCenter;
+ };
+ painter->drawText(dx, 0, _parent->getWidth()-dx*2, _parent->getHeight(), fl, _label);
}
void SceneTextItem::setTopLeft(QPointF topLeft)
{
}
+void SceneTextItem::setPlainTextTrunc(QString label) {
+ _label = label;
+}
+
void SceneTextItem::checkGeometryChange()
{
}
void SceneTextItem::popupMenu(QWidget *caller, const QPoint &globalPos)
{
+ DEBTRACE("SceneTextItem::popupMenu " << _parent);
if (_parent) _parent->popupMenu(caller, globalPos);
}
+
+/*! generic behaviour for headers:
+ * obtain the tooltip from parent.
+ */
+QString SceneTextItem::getToolTip()
+{
+ QString tooltip = _label;
+ SceneItem *parent = getParent();
+ if (parent)
+ tooltip = parent->getToolTip();
+ return tooltip;
+}
+
+void SceneTextItem::setEventPos(QPointF point)
+{
+ _eventPos = mapFromScene(point);
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCENETEXTITEM_HXX_
#define _SCENETEXTITEM_HXX_
{
public:
SceneTextItem(QGraphicsScene *scene, SceneItem *parent,
- QString label);
+ QString label, bool center=false );
virtual ~SceneTextItem();
virtual QRectF boundingRect() const;
virtual void paint(QPainter *painter,
QWidget *widget);
virtual void setTopLeft(QPointF topLeft);
+ virtual void setPlainTextTrunc(QString label);
virtual void checkGeometryChange();
virtual void popupMenu(QWidget *caller, const QPoint &globalPos);
+ virtual QString getToolTip();
+ void setEventPos(QPointF point);
protected:
+ QPointF _eventPos;
+ bool _center;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SchemaComponentItem.hxx"
#include "QtGuiContext.hxx"
#include "SchemaModel.hxx"
#include "SchemaReferenceItem.hxx"
#include "guiObservers.hxx"
+#include "Menus.hxx"
#include <QIcon>
#include <cassert>
SchemaComponentItem::SchemaComponentItem(SchemaItem *parent, QString label, Subject* subject)
- : SchemaItem::SchemaItem(parent, label, subject)
+ : SchemaItem(parent, label, subject)
{
_itemDeco.replace(YLabel, QIcon("icons:component.png"));
}
DEBTRACE("ADDCHILDREF ");
model = QtGuiContext::getQtCurrent()->getSchemaModel();
SubjectReference *ref = dynamic_cast<SubjectReference*>(son);
- assert(ref);
+ YASSERT(ref);
SubjectServiceNode *service = dynamic_cast<SubjectServiceNode*>(ref->getReference());
- assert(service);
+ YASSERT(service);
YACS::ENGINE::Proc* proc = GuiContext::getCurrent()->getProc();
string serviceName = proc->getChildName(service->getNode());
DEBTRACE("ADDCHILDREF " << ref->getReference()->getName());
DEBTRACE("CUT on " << getSubject()->getName());
SchemaModel *model = QtGuiContext::getQtCurrent()->getSchemaModel();
SubjectReference *ref = dynamic_cast<SubjectReference*>(son);
- assert(ref);
+ YASSERT(ref);
DEBTRACE("CUT " << ref->getReference()->getName());
SchemaItem *toMove = QtGuiContext::getQtCurrent()->_mapOfSchemaItem[ref];
DEBTRACE("PASTE on " << getSubject()->getName());
SchemaModel *model = QtGuiContext::getQtCurrent()->getSchemaModel();
SubjectReference *ref = dynamic_cast<SubjectReference*>(son);
- assert(ref);
+ YASSERT(ref);
DEBTRACE("PASTE " << ref->getReference()->getName());
SchemaItem *toPaste = QtGuiContext::getQtCurrent()->_mapOfSchemaItem[ref];
;
}
}
+
+void SchemaComponentItem::popupMenu(QWidget *caller, const QPoint &globalPos)
+{
+ ComponentInstanceMenu m;
+ m.popupMenu(caller, globalPos);
+}
+
+QVariant SchemaComponentItem::editionWhatsThis(int column) const
+{
+ return "<p>To edit the component instance properties, select the component instance and use the input panel. <a href=\"modification.html#property-page-for-component-instance-definition\">More...</a></p>";
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCHEMACOMPONENTITEM_HXX_
#define _SCHEMACOMPONENTITEM_HXX_
public:
SchemaComponentItem(SchemaItem *parent, QString label, Subject* subject);
virtual void update(GuiEvent event, int type, Subject* son);
+ virtual void popupMenu(QWidget *caller, const QPoint &globalPos);
protected:
+ virtual QVariant editionWhatsThis(int column) const;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include <Python.h>
+#include "Resource.hxx"
#include "SchemaComposedNodeItem.hxx"
#include "SchemaNodeItem.hxx"
#include "SchemaInPortItem.hxx"
: SchemaItem(parent, label, subject)
{
DEBTRACE("SchemaComposedNodeItem::SchemaComposedNodeItem");
- _itemDeco.replace(YLabel, QIcon("icons:block_node.png"));
- _dirTypesItem = 0;
+ switch (subject->getType())
+ {
+ case YACS::HMI::BLOC:
+ _itemDeco.replace(YLabel, QIcon("icons:block_node.png"));
+ break;
+ case YACS::HMI::FORLOOP:
+ case YACS::HMI::FOREACHLOOP:
+ case YACS::HMI::WHILELOOP:
+ case YACS::HMI::OPTIMIZERLOOP:
+ _itemDeco.replace(YLabel, QIcon("icons:loop_node.png"));
+ break;
+ case YACS::HMI::SWITCH:
+ _itemDeco.replace(YLabel, QIcon("icons:switch_node.png"));
+ break;
+ default:
+ _itemDeco.replace(YLabel, QIcon("icons:block_node.png"));
+ }
+ _dirTypesItem = 0;
_dirContainersItem = 0;
_dirLinksItem = 0;
Subject *son = 0;
_dirLinksItem = new SchemaDirLinksItem(this, "Links", son);
model->endInsertRows();
- if (SubjectProc* sProc = dynamic_cast<SubjectProc*>(subject))
- {
- Catalog* builtinCatalog = getSALOMERuntime()->getBuiltinCatalog();
- sProc->addDataType(builtinCatalog, "bool");
- sProc->addDataType(builtinCatalog, "int");
- sProc->addDataType(builtinCatalog, "double");
- sProc->addDataType(builtinCatalog, "string");
- }
if (!model->isEdition())
{
setExecState(YACS::UNDEFINED);
}
SubjectComposedNode *scn = dynamic_cast<SubjectComposedNode*>(subject);
- assert(scn);
+ YASSERT(scn);
if (scn->hasValue())
{
_itemData.replace(YType, scn->getValue().c_str());
break;
case YACS::HMI::COMPONENT:
{
- assert(_dirContainersItem);
+ YASSERT(_dirContainersItem);
_dirContainersItem->addComponentItem(son);
}
break;
case YACS::HMI::CONTAINER:
{
- assert(_dirContainersItem);
+ YASSERT(_dirContainersItem);
_dirContainersItem->addContainerItem(son);
}
break;
case YACS::HMI::DATATYPE:
{
- assert(_dirTypesItem);
+ YASSERT(_dirTypesItem);
_dirTypesItem->addTypeItem(son);
}
break;
-// default:
-// DEBTRACE("SchemaComposedNodeItem::update() ADD, type not handled:" << type);
}
break;
+
+ case YACS::HMI::REMOVE:
+ switch (type)
+ {
+ case YACS::HMI::DATATYPE:
+ {
+ YASSERT(_dirTypesItem);
+ _dirTypesItem->removeTypeItem(son);
+ }
+ break;
+ }
+ break;
+
case YACS::HMI::UPDATE:
snode = dynamic_cast<SubjectNode*>(_subject);
- assert(snode);
+ YASSERT(snode);
node = snode->getNode();
- assert(node);
+ YASSERT(node);
switch (node->getState())
{
case YACS::INVALID:
case YACS::HMI::ADDLINK:
case YACS::HMI::ADDCONTROLLINK:
{
- assert(_dirLinksItem);
+ YASSERT(_dirLinksItem);
_dirLinksItem->addLinkItem(son);
}
break;
std::list<YACS::ENGINE::Node*> SchemaComposedNodeItem::getDirectDescendants() const
{
SubjectNode* SNode = dynamic_cast<SubjectNode*>(_subject);
- assert(SNode);
+ YASSERT(SNode);
ComposedNode* CNode = dynamic_cast<ComposedNode*>(SNode->getNode());
- assert(CNode);
+ YASSERT(CNode);
return CNode->edGetDirectDescendants();
}
{
//DEBTRACE("SchemaComposedNodeItem::flags");
Qt::ItemFlags pflag = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
+ if (!QtGuiContext::getQtCurrent() || !QtGuiContext::getQtCurrent()->isEdition())
+ return pflag;
+
Qt::ItemFlags flagEdit = 0;
int column = index.column();
switch (column)
{
case YValue:
- flagEdit = Qt::ItemIsEditable; // --- port value editable in model view
+ flagEdit = Qt::ItemIsEditable; // --- item value editable in model view (for node case in switch)
break;
}
{
ret =true;
SubjectComposedNode *cnode = dynamic_cast<SubjectComposedNode*>(getSubject());
- QtGuiContext::getQtCurrent()->getGMain()->_guiEditor->CreateNodeFromCatalog(myData, cnode);
+ bool createNewComponentInstance=Resource::COMPONENT_INSTANCE_NEW;
+ // by default getControl gives false. In this case we use the user preference COMPONENT_INSTANCE_NEW
+ // to create the node. If getControl gives true we invert the user preference
+ if(myData->getControl())
+ createNewComponentInstance=!Resource::COMPONENT_INSTANCE_NEW;
+ QtGuiContext::getQtCurrent()->getGMain()->_guiEditor->CreateNodeFromCatalog(myData, cnode,createNewComponentInstance);
}
else if(myData->hasFormat("yacs/subjectNode"))
{
void SchemaComposedNodeItem::setCaseValue()
{
+ DEBTRACE("SchemaComposedNodeItem::setCaseValue");
Subject *sub = _parentItem->getSubject();
SubjectSwitch *sSwitch = dynamic_cast<SubjectSwitch*>(sub);
if (!sSwitch) return;
SchemaModel *model = QtGuiContext::getQtCurrent()->getSchemaModel();
Switch *aSwitch = dynamic_cast<Switch*>(sSwitch->getNode());
- assert(aSwitch);
+ YASSERT(aSwitch);
SubjectNode *sNode = dynamic_cast<SubjectNode*>(_subject);
- assert(sNode);
+ YASSERT(sNode);
int rank = aSwitch->getRankOfNode(sNode->getNode());
if (rank == Switch::ID_FOR_DEFAULT_NODE)
_itemData.replace(YValue, "default");
_itemData.replace(YValue, rank);
model->setData(modelIndex(YValue), 0);
}
+
+QVariant SchemaComposedNodeItem::editionWhatsThis(int column) const
+{
+ return "<p>To edit the node properties, select the node and use the input panel. <a href=\"modification.html#property-page-for-block-node\">More...</a></p>";
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCHEMACOMPOSEDNODEITEM_HXX_
#define _SCHEMACOMPOSEDNODEITEM_HXX_
virtual void setCaseValue();
protected:
virtual QString getMimeFormat();
+ virtual QVariant editionWhatsThis(int column) const;
SchemaDirTypesItem *_dirTypesItem;
SchemaDirContainersItem *_dirContainersItem;
SchemaDirLinksItem *_dirLinksItem;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SchemaContainerItem.hxx"
#include "QtGuiContext.hxx"
#include "SchemaModel.hxx"
#include "SchemaComponentItem.hxx"
+#include "Menus.hxx"
#include <QIcon>
#include <cassert>
using namespace YACS::HMI;
SchemaContainerItem::SchemaContainerItem(SchemaItem *parent, QString label, Subject* subject)
- : SchemaItem::SchemaItem(parent, label, subject)
+ : SchemaItem(parent, label, subject)
{
DEBTRACE("SchemaContainerItem::SchemaContainerItem " << subject->getName());
SubjectContainer *scont = dynamic_cast<SubjectContainer*>(subject);
DEBTRACE("ADDCHILDREF ");
SchemaModel *model = QtGuiContext::getQtCurrent()->getSchemaModel();
SubjectReference *ref = dynamic_cast<SubjectReference*>(son);
- assert(ref);
+ YASSERT(ref);
DEBTRACE("ADDCHILDREF " << ref->getReference()->getName());
addComponentInstance(ref->getReference());
}
case YACS::HMI::REMOVECHILDREF:
{
- DEBTRACE("REMOVECHILDREF ");
+ DEBTRACE("REMOVECHILDREF on " << getSubject()->getName());
+ SchemaModel *model = QtGuiContext::getQtCurrent()->getSchemaModel();
+ SubjectReference *ref = dynamic_cast<SubjectReference*>(son);
+ YASSERT(ref);
+ DEBTRACE("REMOVECHILDREF " << ref->getReference()->getName());
+ SchemaItem *toRemove = QtGuiContext::getQtCurrent()->_mapOfSchemaItem[ref->getReference()];
+
+ int position = toRemove->row();
+ model->beginRemoveRows(modelIndex(), position, position);
+ removeChild(toRemove);
+ model->endRemoveRows();
}
break;
DEBTRACE("CUT on " << getSubject()->getName());
SchemaModel *model = QtGuiContext::getQtCurrent()->getSchemaModel();
SubjectReference *ref = dynamic_cast<SubjectReference*>(son);
- assert(ref);
+ YASSERT(ref);
DEBTRACE("CUT " << ref->getReference()->getName());
SchemaItem *toMove = QtGuiContext::getQtCurrent()->_mapOfSchemaItem[ref->getReference()];
DEBTRACE("PASTE on " << getSubject()->getName());
SchemaModel *model = QtGuiContext::getQtCurrent()->getSchemaModel();
SubjectReference *ref = dynamic_cast<SubjectReference*>(son);
- assert(ref);
+ YASSERT(ref);
DEBTRACE("PASTE " << ref->getReference()->getName());
SchemaItem *toPaste = QtGuiContext::getQtCurrent()->_mapOfSchemaItem[ref->getReference()];
break;
default:
+ SchemaItem::update(event, type, son);
;
}
}
subject);
model->endInsertRows();
}
+
+void SchemaContainerItem::popupMenu(QWidget *caller, const QPoint &globalPos)
+{
+ ContainerMenu m;
+ m.popupMenu(caller, globalPos);
+}
+
+QVariant SchemaContainerItem::editionWhatsThis(int column) const
+{
+ return "<p>To edit the container properties, select the container and use the input panel. <a href=\"modification.html#property-page-for-container\">More...</a></p>";
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCHEMACONTAINERITEM_HXX_
#define _SCHEMACONTAINERITEM_HXX_
SchemaContainerItem(SchemaItem *parent, QString label, Subject* subject);
virtual void update(GuiEvent event, int type, Subject* son);
void addComponentInstance(Subject* subject);
+ void popupMenu(QWidget *caller, const QPoint &globalPos);
protected:
+ virtual QVariant editionWhatsThis(int column) const;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SchemaDataTypeItem.hxx"
//#define _DEVDEBUG_
using namespace YACS::HMI;
SchemaDataTypeItem::SchemaDataTypeItem(SchemaItem *parent, QString label, Subject* subject)
- : SchemaItem::SchemaItem(parent, label, subject)
+ : SchemaItem(parent, label, subject)
{
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCHEMADATATTYPEITEM_HXX_
#define _SCHEMADATATTYPEITEM_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SchemaDirContainersItem.hxx"
#include "SchemaContainerItem.hxx"
#include "SchemaModel.hxx"
#include "QtGuiContext.hxx"
#include "ComponentInstance.hxx"
#include "Container.hxx"
+#include "Menus.hxx"
#include <QIcon>
#include <cassert>
using namespace YACS::HMI;
SchemaDirContainersItem::SchemaDirContainersItem(SchemaItem *parent, QString label, Subject* subject)
- : SchemaItem::SchemaItem(parent, label, subject)
+ : SchemaItem(parent, label, subject)
{
_itemDeco.replace(YLabel, QIcon("icons:folder_cyan.png"));
_schemaContItemMap.clear();
_waitingCompItemMap.clear();
}
+void SchemaDirContainersItem::popupMenu(QWidget *caller, const QPoint &globalPos)
+{
+ ContainerDirMenu m;
+ m.popupMenu(caller, globalPos);
+}
+
+
+
/*! When loading a schema, a container may appear after a component using this container.
* After creating the SchemaContainerItem, check if there are SchemaComponentItems to
* to create as children of this SchemaContainerItem
{
DEBTRACE("SchemaDirContainersItem::addComponentItem");
SubjectComponent *aSComp = dynamic_cast<SubjectComponent*>(subject);
- assert(aSComp);
+ YASSERT(aSComp);
ComponentInstance* component = aSComp->getComponent();
- assert(component);
+ YASSERT(component);
string contName = "DefaultContainer";
Container *container = component->getContainer();
}
}
- assert(_schemaContItemMap.count(contName));
+ YASSERT(_schemaContItemMap.count(contName));
SchemaContainerItem *sci = _schemaContItemMap[contName];
aSComp->associateToContainer(static_cast<SubjectContainer*>(sci->getSubject()));
}
+
+QVariant SchemaDirContainersItem::editionWhatsThis(int column) const
+{
+ return "<p>Containers used in this schema appears in this folder.\n" \
+ "You can add containers by using the context menu (entry \"Create container\") " \
+ "and then edit its properties in the input panel. <a href=\"modification.html#property-page-for-container\">More...</a></p>";
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCHEMADIRTCONTAINERSITEM_HXX_
#define _SCHEMADIRTCONTAINERSITEM_HXX_
SchemaDirContainersItem(SchemaItem *parent, QString label, Subject* subject);
void addContainerItem(Subject* subject);
void addComponentItem(Subject* subject);
+ virtual void popupMenu(QWidget *caller, const QPoint &globalPos);
protected:
+ virtual QVariant editionWhatsThis(int column) const;
std::map<std::string, SchemaContainerItem*> _schemaContItemMap;
std::multimap<std::string, Subject*> _waitingCompItemMap;
};
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SchemaDirLinksItem.hxx"
#include "SchemaLinkItem.hxx"
#include "SchemaModel.hxx"
using namespace YACS::HMI;
SchemaDirLinksItem::SchemaDirLinksItem(SchemaItem *parent, QString label, Subject* subject)
- : SchemaItem::SchemaItem(parent, label, subject)
+ : SchemaItem(parent, label, subject)
{
_itemDeco.replace(YLabel, QIcon("icons:folder_cyan.png"));
}
QVariant SchemaDirLinksItem::editionWhatsThis(int column) const
{
-return "Links between ports or nodes under that block level appears in this folder.\n" \
+return "<p>Links between ports or nodes under that block level appears in this folder.\n" \
"You can add data links (between ports) and control links (between nodes) " \
"by drag from origin (out node or out port) to destination (in node or in port) " \
- "either in 2D graphic view or tree view.";
+ "either in 2D graphic view or tree view. <a href=\"modification.html#create-a-link\">More...</a></p>";
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCHEMADIRTLINKSITEM_HXX_
#define _SCHEMADIRTLINKSITEM_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SchemaDirTypesItem.hxx"
#include "SchemaDataTypeItem.hxx"
#include "SchemaModel.hxx"
using namespace YACS::HMI;
SchemaDirTypesItem::SchemaDirTypesItem(SchemaItem *parent, QString label, Subject* subject)
- : SchemaItem::SchemaItem(parent, label, subject)
+ : SchemaItem(parent, label, subject)
{
_itemDeco.replace(YLabel, QIcon("icons:folder_cyan.png"));
}
SchemaModel *model = QtGuiContext::getQtCurrent()->getSchemaModel();
int nbsons = childCount();
SubjectDataType *sdt = dynamic_cast<SubjectDataType*>(subject);
- assert(sdt);
+ YASSERT(sdt);
+ DEBTRACE(nbsons);
model->beginInsertRows(modelIndex(), nbsons, nbsons);
SchemaItem *item = new SchemaDataTypeItem(this,
sdt->getAlias().c_str(),
model->endInsertRows();
}
+void SchemaDirTypesItem::removeTypeItem(Subject* subject)
+{
+ DEBTRACE("SchemaDirTypesItem::removeTypeItem");
+ SchemaModel *model = QtGuiContext::getQtCurrent()->getSchemaModel();
+ YASSERT(QtGuiContext::getQtCurrent()->_mapOfSchemaItem.count(subject));
+ SchemaItem *toRemove = QtGuiContext::getQtCurrent()->_mapOfSchemaItem[subject];
+ int position = toRemove->row();
+ DEBTRACE(position);
+ model->beginRemoveRows(modelIndex(), position, position);
+ removeChild(toRemove);
+ model->endRemoveRows();
+}
+
Qt::ItemFlags SchemaDirTypesItem::flags(const QModelIndex &index)
{
//DEBTRACE("SchemaDirTypesItem::flags");
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCHEMADIRTTYPESITEM_HXX_
#define _SCHEMADIRTTYPESITEM_HXX_
public:
SchemaDirTypesItem(SchemaItem *parent, QString label, Subject* subject);
void addTypeItem(Subject* subject);
+ void removeTypeItem(Subject* subject);
virtual Qt::ItemFlags flags(const QModelIndex &index);
virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action);
protected:
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SchemaInPortItem.hxx"
#include "ItemMimeData.hxx"
#include "QtGuiContext.hxx"
* column 3 = value
*/
SchemaInPortItem::SchemaInPortItem(SchemaItem *parent, QString label, Subject* subject)
- : SchemaItem::SchemaItem(parent, label, subject)
+ : SchemaItem(parent, label, subject)
{
SubjectDataPort *subPort = dynamic_cast<SubjectDataPort*>(subject);
_isDataStream = false;
{
DataPort *dport = subPort->getPort();
TypeOfElem typort = ProcInvoc::getTypeOfPort(dport);
+ TypeOfElem typnode = ProcInvoc::getTypeOfNode(dport->getNode());
// _itemData.replace(YType, dport->edGetType()->getKindRepr());
_itemData.replace(YType, dport->edGetType()->name());
_itemForeground.replace(YType, QColor("black"));
InputPort *inport = 0;
+ if(typnode==YACS::HMI::STUDYOUTNODE)
+ {
+ //It's a study out node
+ if(typort==YACS::HMI::INPUTPORT)
+ {
+ _itemDeco.replace(YLabel, QIcon("icons:in_port.png"));
+ inport = dynamic_cast<InputPort*>(dport);
+ std::string val=inport->getAsString();
+ if(val != "")
+ {
+ _itemData.replace(YValue, val.c_str());
+ if (inport->edGetNumberOfLinks())
+ _itemForeground.replace(YValue, QColor("green"));
+ else
+ _itemForeground.replace(YValue, QColor("red"));
+ }
+ else
+ {
+ _itemData.replace(YValue, "not initialized");
+ _itemForeground.replace(YValue, QColor("red"));
+ }
+ }
+ return;
+ }
+
switch (typort)
{
case YACS::HMI::INPUTPORT:
SubjectInputPort *sip = dynamic_cast<SubjectInputPort*>(son);
if (sip)
{
- DataFlowPort *port = dynamic_cast<DataFlowPort*>(sip->getPort());
+ InputPort* port = dynamic_cast<InputPort*>(sip->getPort());
+ TypeOfElem typnode = ProcInvoc::getTypeOfNode(port->getNode());
DEBTRACE(port->getAsString());
- _itemData.replace(YValue, port->getAsString().c_str());
- _itemForeground.replace(YValue, QColor("green"));
+ if(typnode==YACS::HMI::STUDYOUTNODE)
+ {
+ if(port->getAsString().empty())
+ {
+ _itemData.replace(YValue, "not initialized");
+ if (port->edGetNumberOfLinks())
+ _itemForeground.replace(YValue, QColor("blue"));
+ else
+ _itemForeground.replace(YValue, QColor("red"));
+ }
+ else
+ {
+ _itemData.replace(YValue, port->getAsString().c_str());
+ if (port->edGetNumberOfLinks())
+ _itemForeground.replace(YValue, QColor("green"));
+ else
+ _itemForeground.replace(YValue, QColor("red"));
+ }
+ }
+ else
+ {
+ _itemData.replace(YValue, port->getAsString().c_str());
+ _itemForeground.replace(YValue, QColor("green"));
+ }
+ model->setData(modelIndex(YValue), 0); // --- to emit dataChanged signal
+ }
+ }
+ break;
+ case UPDATE:
+ {
+ SubjectInputPort *sip = dynamic_cast<SubjectInputPort*>(_subject);
+ if (sip)
+ {
+ InputPort* port = dynamic_cast<InputPort*>(sip->getPort());
+ TypeOfElem typnode = ProcInvoc::getTypeOfNode(port->getNode());
+ TypeOfElem typort = ProcInvoc::getTypeOfPort(port);
+ _itemData.replace(YType, port->edGetType()->name());
+ _itemForeground.replace(YType, QColor("black"));
+ if(typnode==YACS::HMI::STUDYOUTNODE)
+ {
+ if(port->getAsString().empty())
+ {
+ _itemData.replace(YValue, "not initialized");
+ if (port->edGetNumberOfLinks())
+ _itemForeground.replace(YValue, QColor("blue"));
+ else
+ _itemForeground.replace(YValue, QColor("red"));
+ }
+ else
+ {
+ _itemData.replace(YValue, port->getAsString().c_str());
+ if (port->edGetNumberOfLinks())
+ _itemForeground.replace(YValue, QColor("green"));
+ else
+ _itemForeground.replace(YValue, QColor("red"));
+ }
+ }
+ else
+ {
+ if (port->edGetNumberOfLinks())
+ {
+ _itemData.replace(YValue, "linked");
+ _itemForeground.replace(YValue, QColor("blue"));
+ }
+ else if (port->edIsManuallyInitialized())
+ {
+ _itemData.replace(YValue, port->getAsString().c_str());
+ _itemForeground.replace(YValue, QColor("green"));
+ }
+ else
+ {
+ _itemData.replace(YValue, "not initialized");
+ _itemForeground.replace(YValue, QColor("red"));
+ }
+ }
model->setData(modelIndex(YValue), 0); // --- to emit dataChanged signal
}
}
{
//DEBTRACE("SchemaInPortItem::flags");
Qt::ItemFlags pflag = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled;
- if (! QtGuiContext::getQtCurrent()->isEdition())
- return pflag;
Qt::ItemFlags flagEdit = 0;
int column = index.column();
SubjectDataPort *sdp = dynamic_cast<SubjectDataPort*>(_subject);
Node *parent = sdp->getPort()->getNode();
if (parent)
- if (dynamic_cast<DataNode*>(parent) || dynamic_cast<InlineNode*>(parent))
+ if ( (dynamic_cast<DataNode*>(parent) || dynamic_cast<InlineNode*>(parent)) &&
+ QtGuiContext::getQtCurrent()->isEdition() )
flagEdit = Qt::ItemIsEditable; // --- port name editable
}
break;
case 2:
- flagEdit = Qt::ItemIsEditable; // --- port value editable
+ if (!_isDataStream)
+ flagEdit = Qt::ItemIsEditable; // --- port value editable
}
return pflag | flagEdit;
}
if (!sub) break;
SubjectDataPort* from = dynamic_cast<SubjectDataPort*>(sub);
if (from && to)
- if (!SubjectDataPort::tryCreateLink(from, to))
+ if (!SubjectDataPort::tryCreateLink(from, to,myData->getControl()))
Message mess;
break;
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCHEMAINPORTITEM_HXX_
#define _SCHEMAINPORTITEM_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SchemaItem.hxx"
#include "QtGuiContext.hxx"
+#include "Resource.hxx"
#include "Menus.hxx"
#include "ItemMimeData.hxx"
if (_parentItem)
_parentItem->appendChild(this);
_execState = YACS::UNDEFINED;
+ _emphasized = false;
}
SchemaItem::~SchemaItem()
_itemBackground.replace(YLabel, model->stdBackBrush());
model->setData(modelIndex(YLabel), 0); // --- to emit dataChanged signal
break;
+ case EMPHASIZE:
+ if (type)
+ _itemBackground.replace(YLabel, model->emphasizeBackBrush());
+ else
+ _itemBackground.replace(YLabel, model->stdBackBrush());
+ model->setData(modelIndex(YLabel), 0); // --- to emit dataChanged signal
+ break;
default:
break;
}
QVariant SchemaItem::editionToolTip(int column) const
{
- QString val = QString("Edition: ") + _itemData.value(column).toString();
+ QString val = QString("Edition: ") + _itemData.value(0).toString();
+ QString val1 = _itemData.value(1).toString();
+ QString val2 = _itemData.value(2).toString();
+ if (!val1.isEmpty()) val += QString(" | ") + val1;
+ if (!val2.isEmpty()) val += QString(" | ") + val2;
return val;
}
QVariant SchemaItem::runToolTip(int column) const
{
- QString val = QString("Execution: ") + _itemData.value(column).toString();
+ QString val = QString("Execution: ") + _itemData.value(0).toString();
+ QString val1 = _itemData.value(1).toString();
+ QString val2 = _itemData.value(2).toString();
+ if (!val1.isEmpty()) val += QString(" | ") + val1;
+ if (!val2.isEmpty()) val += QString(" | ") + val2;
return val;
}
QColor sc;
switch (_execState)
{
- case YACS::UNDEFINED: sc=Qt::lightGray; stateDef = "UNDEFINED"; break;
- case YACS::INVALID: sc=Qt::red; stateDef = "INVALID"; break;
- case YACS::READY: sc=Qt::darkGray; stateDef = "READY"; break;
- case YACS::TOLOAD: sc=Qt::darkYellow; stateDef = "TOLOAD"; break;
- case YACS::LOADED: sc=Qt::darkMagenta; stateDef = "LOADED"; break;
- case YACS::TOACTIVATE: sc=Qt::darkCyan; stateDef = "TOACTIVATE"; break;
- case YACS::ACTIVATED: sc=Qt::darkBlue; stateDef = "ACTIVATED"; break;
- case YACS::DESACTIVATED: sc=Qt::gray; stateDef = "DESACTIVATED"; break;
- case YACS::DONE: sc=Qt::darkGreen; stateDef = "DONE"; break;
- case YACS::SUSPENDED: sc=Qt::gray; stateDef = "SUSPENDED"; break;
- case YACS::LOADFAILED: sc.setHsv(320,255,255); stateDef = "LOADFAILED"; break;
- case YACS::EXECFAILED: sc.setHsv( 20,255,255); stateDef = "EXECFAILED"; break;
- case YACS::PAUSE: sc.setHsv(180,255,255); stateDef = "PAUSE"; break;
- case YACS::INTERNALERR: sc.setHsv(340,255,255); stateDef = "INTERNALERR"; break;
- case YACS::DISABLED: sc.setHsv( 40,255,255); stateDef = "DISABLED"; break;
- case YACS::FAILED: sc.setHsv( 20,255,255); stateDef = "FAILED"; break;
- case YACS::ERROR: sc.setHsv( 0,255,255); stateDef = "ERROR"; break;
- default: sc=Qt::lightGray; stateDef = "---";
+ case YACS::UNDEFINED: sc = Resource::UNDEFINED ; stateDef = "UNDEFINED" ; break;
+ case YACS::INVALID: sc = Resource::INVALID ; stateDef = "INVALID" ; break;
+ case YACS::READY: sc = Resource::READY ; stateDef = "READY" ; break;
+ case YACS::TOLOAD: sc = Resource::TOLOAD ; stateDef = "TOLOAD" ; break;
+ case YACS::LOADED: sc = Resource::LOADED ; stateDef = "LOADED" ; break;
+ case YACS::TOACTIVATE: sc = Resource::TOACTIVATE ; stateDef = "TOACTIVATE" ; break;
+ case YACS::ACTIVATED: sc = Resource::ACTIVATED ; stateDef = "ACTIVATED" ; break;
+ case YACS::DESACTIVATED: sc = Resource::DESACTIVATED; stateDef = "DESACTIVATED"; break;
+ case YACS::DONE: sc = Resource::DONE ; stateDef = "DONE" ; break;
+ case YACS::SUSPENDED: sc = Resource::SUSPENDED ; stateDef = "SUSPENDED" ; break;
+ case YACS::LOADFAILED: sc = Resource::LOADFAILED ; stateDef = "LOADFAILED" ; break;
+ case YACS::EXECFAILED: sc = Resource::EXECFAILED ; stateDef = "EXECFAILED" ; break;
+ case YACS::PAUSE: sc = Resource::PAUSE ; stateDef = "PAUSE" ; break;
+ case YACS::INTERNALERR: sc = Resource::INTERNALERR ; stateDef = "INTERNALERR" ; break;
+ case YACS::DISABLED: sc = Resource::DISABLED ; stateDef = "DISABLED" ; break;
+ case YACS::FAILED: sc = Resource::FAILED ; stateDef = "FAILED" ; break;
+ case YACS::ERROR: sc = Resource::ERROR ; stateDef = "ERROR" ; break;
+ default: sc = Resource::DEFAULT ; stateDef = "---" ;
}
_itemData.replace(YState, stateDef);
_itemForeground.replace(YState, sc);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCHEMAITEM_HXX_
#define _SCHEMAITEM_HXX_
virtual void reparent(SchemaItem *parent);
virtual void setCaseValue();
+ bool isEmphasized() {return _emphasized; };
+ void setEmphasize(bool emphasize) {_emphasized = emphasize; };
+
protected:
virtual QVariant editionToolTip(int column) const;
virtual QVariant runToolTip(int column) const;
SchemaItem *_parentItem;
Subject* _subject;
int _execState;
+ bool _emphasized;
};
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SchemaLinkItem.hxx"
#include "Menus.hxx"
+#include "DataStreamPort.hxx"
#include <QIcon>
using namespace YACS::HMI;
SchemaLinkItem::SchemaLinkItem(SchemaItem *parent, QString label, Subject* subject)
- : SchemaItem::SchemaItem(parent, label, subject)
+ : SchemaItem(parent, label, subject)
{
- _itemDeco.replace(YLabel, QIcon("icons:new_link.png"));
+ switch (subject->getType())
+ {
+ case YACS::HMI::CONTROLLINK:
+ _itemDeco.replace(YLabel, QIcon("icons:control_link.png"));
+ break;
+ case YACS::HMI::DATALINK:
+ _itemDeco.replace(YLabel, QIcon("icons:data_link.png"));
+ if (SubjectLink *slink = dynamic_cast<SubjectLink*>(subject))
+ {
+ if (dynamic_cast<YACS::ENGINE::DataStreamPort*>(slink->getSubjectOutPort()->getPort()))
+ _itemDeco.replace(YLabel, QIcon("icons:stream_link.png"));
+ }
+ break;
+ default:
+ _itemDeco.replace(YLabel, QIcon("icons:new_link.png"));
+ }
}
void SchemaLinkItem::update(GuiEvent event, int type, Subject* son)
QVariant SchemaLinkItem::editionWhatsThis(int column) const
{
-return "Links between ports or nodes under that block level appears in this folder.\n" \
+return "<p>Links between ports or nodes under that block level appears in this folder.\n" \
"You can add data links (between ports) and control links (between nodes) " \
"by drag from origin (out node or out port) to destination (in node or in port) " \
- "either in 2D graphic view or tree view.";
+ "either in 2D graphic view or tree view. <a href=\"modification.html#create-a-link\">More...</a></p>";
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCHEMALINKITEM_HXX_
#define _SCHEMALINKITEM_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SchemaModel.hxx"
#include "SchemaItem.hxx"
#include "SchemaNodeItem.hxx"
_context->attach(this);
_stdBackBrush = QColor("white");
_editedBackBrush = QColor("yellow");
+ _emphasizeBackBrush = QColor("magenta");
_isEdition = true;
}
QVariant SchemaModel::headerData(int section, Qt::Orientation orientation, int role) const
{
- DEBTRACE("SchemaModel::headerData");
+ //DEBTRACE("SchemaModel::headerData");
if (role != Qt::DisplayRole)
return QVariant();
return _editedBackBrush;
}
+const QBrush& SchemaModel::emphasizeBackBrush()
+{
+ return _emphasizeBackBrush;
+}
+
void SchemaModel::setNewRoot(YACS::HMI::Subject *root)
{
_root = root;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCHEMAMODEL_HXX_
#define _SCHEMAMODEL_HXX_
const QBrush& stdBackBrush();
const QBrush& editedBackBrush();
+ const QBrush& emphasizeBackBrush();
+
virtual QMimeData* mimeData(const QModelIndexList &indexes) const;
virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action,
int row, int column, const QModelIndex& parent);
QBrush _stdBackBrush;
QBrush _editedBackBrush;
+ QBrush _emphasizeBackBrush;
bool _isEdition;
};
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SchemaNodeItem.hxx"
#include "SchemaInPortItem.hxx"
#include "SchemaOutPortItem.hxx"
break;
case YACS::HMI::ORDER:
{
- assert(QtGuiContext::getQtCurrent()->_mapOfSchemaItem.count(son));
+ YASSERT(QtGuiContext::getQtCurrent()->_mapOfSchemaItem.count(son));
//bool isInput = dynamic_cast<SubjectInputPort*>(son);
snode = dynamic_cast<SubjectNode*>(_subject);
- assert(snode);
+ YASSERT(snode);
Node* node = snode->getNode();
ElementaryNode* father = dynamic_cast<ElementaryNode*>(node);
- assert(father);
+ YASSERT(father);
int nbChildren = childCount();
model->beginRemoveRows(modelIndex(), 0, nbChildren-1);
break;
case YACS::HMI::UPDATE:
snode = dynamic_cast<SubjectNode*>(_subject);
- assert(snode);
+ YASSERT(snode);
node = snode->getNode();
- assert(node);
+ YASSERT(node);
switch (node->getState())
{
case YACS::INVALID:
Qt::ItemFlags SchemaNodeItem::flags(const QModelIndex &index)
{
- Qt::ItemFlags pflag = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsDropEnabled;
+ Qt::ItemFlags pflag = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsDropEnabled;
+ if ( !QtGuiContext::getQtCurrent() || !QtGuiContext::getQtCurrent()->isEdition())
+ return pflag;
+ if (QtGuiContext::getQtCurrent()->isEdition())
+ pflag = pflag | Qt::ItemIsDragEnabled;
Qt::ItemFlags flagEdit = 0;
int column = index.column();
switch (column)
{
-// case 0:
-// flagEdit = Qt::ItemIsEditable; // --- port name editable in model view
-// break;
case YValue:
- flagEdit = Qt::ItemIsEditable; // --- port value editable in model view
+ flagEdit = Qt::ItemIsEditable; // --- item value editable in model view (for node case in switch)
break;
}
DEBTRACE("SchemaNodeItem::toggleState");
SchemaItem::toggleState();
GuiExecutor *guiExec = QtGuiContext::getQtCurrent()->getGuiExecutor();
- assert(guiExec);
+ YASSERT(guiExec);
SubjectNode *subjectNode = dynamic_cast<SubjectNode*>(getSubject());
- assert(subjectNode);
+ YASSERT(subjectNode);
string nodeName = QtGuiContext::getQtCurrent()->getProc()->getChildName(subjectNode->getNode());
DEBTRACE("nodeName=" << nodeName);
void SchemaNodeItem::setCaseValue()
{
+ DEBTRACE("SchemaNodeItem::setCaseValue");
Subject *sub = _parentItem->getSubject();
SubjectSwitch *sSwitch = dynamic_cast<SubjectSwitch*>(sub);
if (!sSwitch) return;
SchemaModel *model = QtGuiContext::getQtCurrent()->getSchemaModel();
Switch *aSwitch = dynamic_cast<Switch*>(sSwitch->getNode());
- assert(aSwitch);
+ YASSERT(aSwitch);
SubjectNode *sNode = dynamic_cast<SubjectNode*>(_subject);
- assert(sNode);
+ YASSERT(sNode);
int rank = aSwitch->getRankOfNode(sNode->getNode());
if (rank == Switch::ID_FOR_DEFAULT_NODE)
_itemData.replace(YValue, "default");
QVariant SchemaNodeItem::editionWhatsThis(int column) const
{
- return "To edit the node properties, select the node and use the input panel.\n";
+ return "<p>To edit the node properties, select the node and use the input panel. <a href=\"modification.html#property-page-for-node\">More...</a></p>";
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCHEMANODEITEM_HXX_
#define _SCHEMANODEITEM_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SchemaOutPortItem.hxx"
#include "ItemMimeData.hxx"
#include "QtGuiContext.hxx"
* column 3: YValue = value
*/
SchemaOutPortItem::SchemaOutPortItem(SchemaItem *parent, QString label, Subject* subject)
- : SchemaItem::SchemaItem(parent, label, subject)
+ : SchemaItem(parent, label, subject)
{
SubjectDataPort *subPort = dynamic_cast<SubjectDataPort*>(subject);
if (subPort)
}
}
break;
+ case UPDATE:
+ {
+ SubjectOutputPort *sop = dynamic_cast<SubjectOutputPort*>(son);
+ if (sop)
+ {
+ DataFlowPort *port = dynamic_cast<DataFlowPort*>(sop->getPort());
+ _itemData.replace(YType, port->edGetType()->name());
+ _itemForeground.replace(YType, QColor("black"));
+ }
+ }
+ break;
case UPDATEPROGRESS:
{
SubjectOutputPort *sip = dynamic_cast<SubjectOutputPort*>(son);
{
//DEBTRACE("SchemaOutPortItem::flags");
Qt::ItemFlags pflag = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled;
- if (! QtGuiContext::getQtCurrent()->isEdition())
+ if (QtGuiContext::getQtCurrent()->isEdition())
+ pflag = pflag | Qt::ItemIsDragEnabled;
+ else
return pflag;
Qt::ItemFlags flagEdit = 0;
case 2:
SubjectDataPort *sdp = dynamic_cast<SubjectDataPort*>(_subject);
Node *node = sdp->getPort()->getNode();
- PresetNode *pnode = dynamic_cast<PresetNode*>(node);
+ //PresetNode *pnode = dynamic_cast<PresetNode*>(node);
+ DataNode *pnode = dynamic_cast<DataNode*>(node);
if (! pnode) break;
flagEdit = Qt::ItemIsEditable; // --- port value editable for preset node
break;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCHEMAOUTPORTITEM_HXX_
#define _SCHEMAOUTPORTITEM_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SchemaProcItem.hxx"
#include "Menus.hxx"
#include "QtGuiContext.hxx"
+#include "Resource.hxx"
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
QColor sc;
switch (_execState)
{
- case YACS::NOTYETINITIALIZED: sc.setHsv( 45, 50, 255); stateDef = "Not Yet Initialized"; break;
- case YACS::INITIALISED: sc.setHsv( 90, 50, 255); stateDef = "Initialized"; break;
- case YACS::RUNNING: sc.setHsv(135, 50, 255); stateDef = "Running"; break;
- case YACS::WAITINGTASKS: sc.setHsv(180, 50, 255); stateDef = "Waiting Tasks"; break;
- case YACS::PAUSED: sc.setHsv(225, 50, 255); stateDef = "Paused"; break;
- case YACS::FINISHED: sc.setHsv(270, 50, 255); stateDef = "Finished"; break;
- case YACS::STOPPED: sc.setHsv(315, 50, 255); stateDef = "Stopped"; break;
- default: sc.setHsv(360, 50, 255); stateDef = "Unknown Status";
+ case YACS::NOTYETINITIALIZED: sc = YACS::HMI::Resource::NOTYETINITIALIZED; stateDef = "Not Yet Initialized"; break;
+ case YACS::INITIALISED: sc = YACS::HMI::Resource::INITIALISED ; stateDef = "Initialized"; break;
+ case YACS::RUNNING: sc = YACS::HMI::Resource::RUNNING ; stateDef = "Running"; break;
+ case YACS::WAITINGTASKS: sc = YACS::HMI::Resource::WAITINGTASKS ; stateDef = "Waiting Tasks"; break;
+ case YACS::PAUSED: sc = YACS::HMI::Resource::PAUSED ; stateDef = "Paused"; break;
+ case YACS::FINISHED: sc = YACS::HMI::Resource::FINISHED ; stateDef = "Finished"; break;
+ case YACS::STOPPED: sc = YACS::HMI::Resource::STOPPED ; stateDef = "Stopped"; break;
+ default: sc = YACS::HMI::Resource::UNKNOWN ; stateDef = "Unknown Status";
}
_itemData.replace(YState, stateDef);
_itemForeground.replace(YState, Qt::darkBlue);
_itemBackground.replace(YState, sc);
}
+
+QVariant SchemaProcItem::editionToolTip(int column) const
+{
+ QString val = QString("Edition: ") + _itemData.value(0).toString();
+ QString val1 = _itemData.value(2).toString();
+ QString val2 = QtGuiContext::getQtCurrent()->getFileName();
+ if (!val1.isEmpty()) val += QString(" | ") + val1;
+ if (!val2.isEmpty()) val += QString(" | ") + val2;
+ return val;
+}
+
+QVariant SchemaProcItem::runToolTip(int column) const
+{
+ QString val = QString("Execution: ") + _itemData.value(0).toString();
+ QString val1 = _itemData.value(2).toString();
+ QString val2 = QtGuiContext::getQtCurrent()->getFileName();
+ if (!val1.isEmpty()) val += QString(" | ") + val1;
+ if (!val2.isEmpty()) val += QString(" | ") + val2;
+ return val;
+}
+
+QVariant SchemaProcItem::editionWhatsThis(int column) const
+{
+ return "<p>To edit the schema properties, select the schema and use the input panel. <a href=\"modification.html#property-page-for-schema\">More...</a></p>";
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCHEMAPROCITEM_HXX_
#define _SCHEMAPROCITEM_HXX_
virtual ~SchemaProcItem();
virtual void popupMenu(QWidget *caller, const QPoint &globalPos);
protected:
+ virtual QVariant editionWhatsThis(int column) const;
virtual void setExecState(int execState);
+ virtual QVariant editionToolTip(int column) const;
+ virtual QVariant runToolTip(int column) const;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SchemaReferenceItem.hxx"
#include "Menus.hxx"
+#include "QtGuiContext.hxx"
#include <QIcon>
using namespace YACS::HMI;
SchemaReferenceItem::SchemaReferenceItem(SchemaItem *parent, QString label, Subject* subject)
- : SchemaItem::SchemaItem(parent, label, subject)
+ : SchemaItem(parent, label, subject)
{
_itemDeco.replace(YLabel, QIcon("icons:ob_service_node.png"));
_itemForeground.replace(YLabel,QColor("green"));
void SchemaReferenceItem::update(GuiEvent event, int type, Subject* son)
{
- DEBTRACE("SchemaReferenceItem::update");
- SchemaItem::update(event, type, son);
+ DEBTRACE("SchemaReferenceItem::update "<< eventName(event) <<" "<<type<<" "<<son);
+ if(event==RENAME)
+ {
+ SchemaModel *model = QtGuiContext::getQtCurrent()->getSchemaModel();
+ _label = son->getName().c_str();
+ _itemData.replace(YLabel, _label);
+ model->setData(modelIndex(YLabel), 0); // --- to emit dataChanged signal
+ }
+ else
+ SchemaItem::update(event, type, son);
}
void SchemaReferenceItem::popupMenu(QWidget *caller, const QPoint &globalPos)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SCHEMAREFERENCEITEM_HXX_
#define _SCHEMAREFERENCEITEM_HXX_
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#ifndef _SUITWRAPPER_HXX_
-#define _SUITWRAPPER_HXX_
-
-#include <QAction>
-#include <QString>
-#include <QIcon>
-#include <QObject>
-#include <QWidget>
-#include <QGraphicsScene>
-
-namespace YACS
-{
- namespace HMI
- {
- //! viewer QGraphicsScene: deriver SUIT_ViewModel comme QxGraph_Viewer
- // deriver idem SUIT_ViewManager et SUIT_ViewWindows
-
- //! wrapping for SalomeApp_Module
-
- class SuitWrapper
- {
-
- public:
- SuitWrapper(QObject* wrapped);
- ~SuitWrapper();
-
- QWidget* getNewWindow(QGraphicsScene *scene);
- int AssociateViewToWindow(QGraphicsView* gView, QWidget* viewWindow);
- int activeStudyId();
-
- QAction* createAction(const int id,
- const QString& toolTip,
- const QIcon& icon,
- const QString& menu,
- const QString& status,
- const int shortCut,
- QObject* parent =0,
- bool checkable = false,
- QObject* receiver =0,
- const char* member =0);
-
- int createMenu(const QString& subMenu,
- const int parentMenuId,
- const int menuId = -1,
- const int groupId = -1,
- const int index = -1);
-
- int createMenu(const QString& subMenu,
- const QString& parentMenu,
- const int menuId = -1,
- const int groupId = -1,
- const int index = -1);
-
- int createMenu(const int actionId,
- const int menuId,
- const int groupId = -1,
- const int index = -1);
-
- int createMenu(const int actionId,
- const QString& menu,
- const int groupId = -1,
- const int index = -1);
-
- int createMenu(QAction* action,
- const int menuId,
- const int actionId = -1,
- const int groupId = -1,
- const int index = -1);
-
- int createMenu(QAction* action,
- const QString& menu,
- const int actionId = -1,
- const int groupId = -1,
- const int index = -1);
-
- int createTool(const QString& name);
-
- int createTool(const int actionId,
- const int toolbarId,
- const int index = -1);
-
- int createTool(const int actionId,
- const QString& toolbar,
- const int index = -1);
-
- int createTool(QAction* action,
- const int toolbarId,
- const int actionId = -1,
- const int index = -1);
-
- int createTool(QAction* action,
- const QString& toolbar,
- const int actionId = -1,
- const int index = -1);
-
- static QAction* separator();
-
- void setMenuShown(QAction* act, bool show);
- void setToolShown(QAction* act, bool show);
-
- void createNewSchema(const QString& schemaName,
- QWidget* viewWindow);
- bool renameSchema(const QString& oldName,
- const QString& newName,
- QWidget* viewWindow);
- void createNewRun(const QString& schemaName,
- const QString& runName,
- QWidget* refWindow,
- QWidget* viewWindow);
-
- protected:
- QObject* _wrapped; // SalomeApp_module or Standalone Application
-
- };
- }
-}
-#endif
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>fm_TablePorts</class>
- <widget class="QWidget" name="fm_TablePorts" >
- <property name="geometry" >
+ <widget class="QWidget" name="fm_TablePorts">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>370</width>
- <height>237</height>
+ <width>230</width>
+ <height>132</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QSplitter" name="splitter" >
- <property name="orientation" >
+ <layout class="QGridLayout">
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QSplitter" name="splitter">
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <widget class="QWidget" name="layoutWidget" >
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QPushButton" name="pb_up" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <widget class="QWidget" name="layoutWidget">
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QPushButton" name="pb_up">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="toolTip" >
+ <property name="toolTip">
<string>move up the selected port one step, cycle</string>
</property>
- <property name="text" >
+ <property name="text">
<string/>
</property>
- <property name="icon" >
+ <property name="icon">
<iconset>
<normaloff>icons:icon_up.png</normaloff>icons:icon_up.png</iconset>
</property>
</widget>
</item>
- <item row="0" column="1" >
- <widget class="QPushButton" name="pb_down" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <item row="0" column="1">
+ <widget class="QPushButton" name="pb_down">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="toolTip" >
+ <property name="toolTip">
<string>move down the selected port one step, cycle</string>
</property>
- <property name="text" >
+ <property name="text">
<string/>
</property>
- <property name="icon" >
+ <property name="icon">
<iconset>
<normaloff>icons:icon_down.png</normaloff>icons:icon_down.png</iconset>
</property>
</widget>
</item>
- <item row="0" column="2" >
- <widget class="QPushButton" name="pb_insert" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <item row="0" column="2">
+ <widget class="QPushButton" name="pb_insert">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="toolTip" >
+ <property name="toolTip">
<string>insert a new port before the selected port</string>
</property>
- <property name="text" >
+ <property name="text">
<string/>
</property>
- <property name="icon" >
+ <property name="icon">
<iconset>
<normaloff>icons:icon_insert.png</normaloff>icons:icon_insert.png</iconset>
</property>
</widget>
</item>
- <item row="0" column="3" >
- <widget class="QPushButton" name="pb_remove" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <item row="0" column="3">
+ <widget class="QPushButton" name="pb_remove">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="toolTip" >
+ <property name="toolTip">
<string>remove the selected port</string>
</property>
- <property name="text" >
+ <property name="text">
<string/>
</property>
- <property name="icon" >
+ <property name="icon">
<iconset>
<normaloff>icons:icon_minus.png</normaloff>icons:icon_minus.png</iconset>
</property>
</widget>
</item>
- <item row="0" column="4" >
- <widget class="QComboBox" name="cb_insert" >
- <property name="toolTip" >
+ <item row="0" column="4">
+ <widget class="QComboBox" name="cb_insert">
+ <property name="toolTip">
<string>port creation: select a port type</string>
</property>
</widget>
</widget>
</widget>
</item>
- <item row="1" column="0" >
- <widget class="QTableView" name="tv_ports" />
+ <item row="1" column="0">
+ <widget class="YACS::HMI::YTableView" name="tv_ports">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
</item>
</layout>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>YACS::HMI::YTableView</class>
+ <extends>QTableView</extends>
+ <header>YACSWidgets.hxx</header>
+ </customwidget>
+ </customwidgets>
<resources/>
<connections/>
</ui>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TablePortsEdition.hxx"
#include "SchemaItem.hxx"
#include "QtGuiContext.hxx"
#include "InputPort.hxx"
#include "OutputPort.hxx"
#include "ElementaryNode.hxx"
+#include "Scene.hxx"
+#include "SceneItem.hxx"
+#include "SceneComposedNodeItem.hxx"
#include <QItemSelectionModel>
#include <QDialog>
emit popupShow();
}
+void YComboBox::keyPressEvent(QKeyEvent *e)
+{
+ //accept all key events but do nothing to avoid creating ports with keys
+}
+
+#ifndef QT_NO_WHEELEVENT
+void YComboBox::wheelEvent(QWheelEvent *e)
+{
+ //idem
+}
+#endif
+
TablePortsEdition::TablePortsEdition(bool inPorts, QWidget *parent)
{
cb_insert->setToolTip("port creation: select a port type");
connect(cb_insert, SIGNAL(popupHide()),
- this, SLOT(on_cb_insert_popupHide()));
+ this, SLOT(oncb_insert_popupHide()));
connect(cb_insert, SIGNAL(popupShow()),
- this, SLOT(on_cb_insert_popupShow()));
+ this, SLOT(oncb_insert_popupShow()));
connect(cb_insert, SIGNAL(activated(const QString&)),
- this, SLOT(on_cb_insert_activated(const QString&)));
+ this, SLOT(oncb_insert_activated(const QString&)));
}
TablePortsEdition::~TablePortsEdition()
{
Subject *sub = item->parent()->getSubject();
SubjectElementaryNode* sen = dynamic_cast<SubjectElementaryNode*>(sub);
- assert(sen);
+ YASSERT(sen);
sen->OrderDataPorts(spToMove,isUp);
+ if (Scene::_autoComputeLinks)
+ {
+ YACS::HMI::SubjectProc* subproc = QtGuiContext::getQtCurrent()->getSubjectProc();
+ SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[subproc];
+ SceneComposedNodeItem *proc = dynamic_cast<SceneComposedNodeItem*>(item);
+ proc->rebuildLinks();
+ }
+
+ QItemSelectionModel *selectionModel = tv_ports->selectionModel();
+ QModelIndex topLeft=item->modelIndex(0);
+ QItemSelection selection(topLeft, topLeft);
+ selectionModel->select(selection, QItemSelectionModel::Select);
}
}
sub = item->parent()->getSubject();
SubjectElementaryNode* sen = dynamic_cast<SubjectElementaryNode*>(sub);
- assert(sen);
+ YASSERT(sen);
ElementaryNode* father = dynamic_cast<ElementaryNode*>(sen->getNode());
if (isInput)
cb_insert->showPopup();
}
-void TablePortsEdition::on_cb_insert_activated(const QString& text)
+void TablePortsEdition::oncb_insert_activated(const QString& text)
{
- DEBTRACE("TablePortsEdition::on_cb_insert_currentIndexChanged " << text.toStdString());
+ DEBTRACE("TablePortsEdition::oncb_insert_activated " << text.toStdString());
SubjectDataPort *spBefore = 0;
QModelIndexList items = tv_ports->selectionModel()->selection().indexes();
QModelIndex index;
YACS::ENGINE::Catalog *catalog =
QtGuiContext::getQtCurrent()->getGMain()->getCatalogWidget()->getCatalogFromType(portType);
if (!catalog) catalog = QtGuiContext::getQtCurrent()->getCurrentCatalog();
- assert(catalog);
+ YASSERT(catalog);
GuiEditor *editor = QtGuiContext::getQtCurrent()->getGMain()->_guiEditor;
SubjectDataPort * sdp = 0;
if (_inPorts)
}
}
-void TablePortsEdition::on_cb_insert_popupHide()
+void TablePortsEdition::oncb_insert_popupHide()
{
- DEBTRACE("TablePortsEdition::on_cb_insert_popupHide");
+ DEBTRACE("TablePortsEdition::oncb_insert_popupHide");
if (cb_insert->currentIndex() < 0)
_nbUp = 0; // --- no selection, no port creation, no move
DEBTRACE(_nbUp);
}
-void TablePortsEdition::on_cb_insert_popupShow()
+void TablePortsEdition::oncb_insert_popupShow()
{
- DEBTRACE("TablePortsEdition::on_cb_insert_popupShow");
+ DEBTRACE("TablePortsEdition::oncb_insert_popupShow");
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _TABLEPORTSEDITION_HXX_
#define _TABLEPORTSEDITION_HXX_
virtual void hidePopup();
virtual void showPopup();
+ protected:
+ void keyPressEvent(QKeyEvent *e);
+#ifndef QT_NO_WHEELEVENT
+ void wheelEvent(QWheelEvent *e);
+#endif
+
signals:
void popupHide();
void popupShow();
void on_pb_down_clicked();
void on_pb_insert_clicked();
void on_pb_remove_clicked();
- void on_cb_insert_activated(const QString& text);
- void on_cb_insert_popupHide();
- void on_cb_insert_popupShow();
+ void oncb_insert_activated(const QString& text);
+ void oncb_insert_popupHide();
+ void oncb_insert_popupShow();
protected:
void upOrDown(int isUp);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TableSwitch.hxx"
#include "QtGuiContext.hxx"
#include "SchemaItem.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _TABLESWITCH_HXX_
#define _TABLESWITCH_HXX_
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>TableSwitch</class>
- <widget class="QWidget" name="TableSwitch" >
- <property name="geometry" >
+ <widget class="QWidget" name="TableSwitch">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>370</width>
- <height>300</height>
+ <width>125</width>
+ <height>127</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" >
- <layout class="QHBoxLayout" name="horizontalLayout" >
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
<item>
- <widget class="QLabel" name="label" >
- <property name="text" >
+ <widget class="QLabel" name="label">
+ <property name="text">
<string>Select</string>
</property>
</widget>
</item>
<item>
- <widget class="QSpinBox" name="sb_select" />
+ <widget class="QSpinBox" name="sb_select"/>
</item>
</layout>
</item>
- <item row="1" column="0" >
- <widget class="QTableView" name="tv_nodes" />
+ <item row="1" column="0">
+ <widget class="QTableView" name="tv_nodes"/>
</item>
</layout>
</widget>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TreeView.hxx"
#include "SchemaItem.hxx"
#include "QtGuiContext.hxx"
void TreeView::viewSelection(const QModelIndex &ind)
{
- scrollTo(ind);
+ QModelIndex ind0 = ind.sibling(ind.row(), 0);
+ //DEBTRACE("TreeView::viewSelection " << ind.row() << " " << ind.column() << " / " << ind0.row() << " " << ind0.column());
+ scrollTo(ind0);
}
void TreeView::resizeColumns()
bool TreeView::event(QEvent *event)
{
+ if (event->type() == QEvent::WhatsThisClicked)
+ {
+ QWhatsThisClickedEvent* clicked = static_cast<QWhatsThisClickedEvent*>(event);
+ QtGuiContext::getQtCurrent()->getGMain()->onHelpContextModule("YACS",clicked->href());
+ return true; // what's this remains open if true is returned
+ }
+
if (event->type() == QEvent::ToolTip)
{
QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event);
*/
void TreeView::onCommitData(QWidget *editor)
{
- DEBTRACE("EditionElementaryNode::onCommitData " << editor);
+ DEBTRACE("TreeView::onCommitData " << editor);
GenericEditor* gedit = dynamic_cast<GenericEditor*>(editor);
- assert(gedit);
+ YASSERT(gedit);
QString val = gedit->GetStrValue();
- DEBTRACE(val.toStdString());
- Subject *sub = gedit->getSubject();
- assert(sub);
- SubjectDataPort *sdp = dynamic_cast<SubjectDataPort*>(sub);
- assert(sdp);
string strval = val.toStdString();
+ DEBTRACE(strval);
bool isOk = false;
- if (gedit->getColumnInSubject() == YValue)
+ Subject *sub = gedit->getSubject();
+ YASSERT(sub);
+ SubjectDataPort *sdp = dynamic_cast<SubjectDataPort*>(sub);
+ if (sdp)
{
- if (sdp->getPort()->edGetType()->kind() == YACS::ENGINE::String)
- strval = "\"" + strval + "\"";
- DEBTRACE(strval);
- isOk = sdp->setValue(strval);
- }
+ if (gedit->getColumnInSubject() == YValue)
+ {
+ if (sdp->getPort()->edGetType()->kind() == YACS::ENGINE::String)
+ strval = "\"" + strval + "\"";
+ DEBTRACE(strval);
+ isOk = sdp->setValue(strval);
- else // --- YLabel
+ GuiExecutor* executor = QtGuiContext::getQtCurrent()->getGuiExecutor();
+ if (executor) executor->setInPortValue(sdp->getPort(), strval);
+ }
+ else // --- YLabel
+ {
+ isOk = sdp->setName(strval);
+ }
+ }
+ else
{
- isOk = sdp->setName(strval);
+ SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
+ YASSERT(snode);
+ sub = snode->getParent();
+ SubjectSwitch *sswitch = dynamic_cast<SubjectSwitch*>(sub);
+ YASSERT(sswitch);
+ isOk = sswitch->setCase(strval, snode);
}
if (_valueDelegate)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _TREEVIEW_HXX_
#define _TREEVIEW_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "ValueDelegate.hxx"
#include "guiObservers.hxx"
#include "SchemaItem.hxx"
#include "DataPort.hxx"
+#include "StudyPorts.hxx"
#include "TypeCode.hxx"
#include "Switch.hxx"
+#include "ItemEdition.hxx"
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
QString GenericEditor::GetStrValue()
{
+ return "";
}
Subject* GenericEditor::getSubject()
// -----------------------------------------------------------------------------
+NameEditor::NameEditor(Subject* subject,
+ const ValueDelegate* delegate,
+ int column,
+ QWidget * parent)
+ : QLineEdit(parent), GenericEditor()
+{
+ DEBTRACE("NameEditor::NameEditor");
+ setDelegate(delegate);
+ setSubject(subject);
+ setColumn(column);
+}
+
+NameEditor::~NameEditor()
+{
+}
+
+QString NameEditor::GetStrValue()
+{
+ DEBTRACE("Name::GetStrValue " << text().toStdString());
+ string filtered = ItemEdition::filterName(text().toStdString());
+ return filtered.c_str();
+}
+
+void NameEditor::setData(QVariant val)
+{
+ DEBTRACE("NameEditor::setData " << this);
+ DEBTRACE(val.canConvert<QString>());
+ DEBTRACE(val.toString().toStdString());
+ string filtered = ItemEdition::filterName(val.toString().toStdString());
+ setText(filtered.c_str());
+}
+
+// -----------------------------------------------------------------------------
+
IntEditor::IntEditor(Subject* subject,
const ValueDelegate* delegate,
int column,
if (sport)
{
YACS::ENGINE::DataPort *port = sport->getPort();
+ YACS::ENGINE::InputStudyPort* istport=dynamic_cast<YACS::ENGINE::InputStudyPort*>(port);
+ YACS::ENGINE::OutputStudyPort* ostport=dynamic_cast<YACS::ENGINE::OutputStudyPort*>(port);
YACS::ENGINE::TypeCode *tc = port->edGetType();
YACS::ENGINE::DynType dt = tc->kind();
- if (dt == YACS::ENGINE::Int)
+ if (!istport && !ostport && dt == YACS::ENGINE::Int)
editor = new IntEditor(subject, this, column, parent);
}
else if (snode)
}
}
+ if (column == YLabel)
+ {
+ sport = dynamic_cast<SubjectDataPort*>(subject);
+ if (sport)
+ editor = new NameEditor(subject, this, column, parent);
+ }
+
if (!editor) editor = new GeneralEditor(subject, this, column, parent);
return editor;
}
{
DEBTRACE("ValueDelegate::setEditorData");
GenericEditor* gedit = dynamic_cast<GenericEditor*>(editor);
- assert(gedit);
+ YASSERT(gedit);
QString edited = gedit->GetStrValue();
DEBTRACE(edited.toStdString());
Subject *sub = gedit->getSubject();
{
DEBTRACE("ValueDelegate::setModelData");
GenericEditor* gedit = dynamic_cast<GenericEditor*>(editor);
- assert(gedit);
+ YASSERT(gedit);
QString value = gedit->GetStrValue();
DEBTRACE(value.toStdString());
//model->setData(index, value, Qt::EditRole); // real set done by update
{
DEBTRACE("ValueDelegate::setResultEditing " << isOk);
GenericEditor* gedit = dynamic_cast<GenericEditor*>(editor);
- assert(gedit);
+ YASSERT(gedit);
Subject *sub = gedit->getSubject();
string val = gedit->GetStrValue().toStdString();
DEBTRACE(sub->getName() << " " << val);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _VALUEDELEGATE_HXX
#define _VALUEDELEGATE_HXX
virtual void setData(QVariant val);
};
+ class NameEditor: public QLineEdit, public GenericEditor
+ {
+ Q_OBJECT
+
+ public:
+ NameEditor(Subject* subject,
+ const ValueDelegate* delegate,
+ int column = 0,
+ QWidget* parent = 0);
+ virtual ~NameEditor();
+ virtual QString GetStrValue();
+ virtual void setData(QVariant val);
+ };
+
class IntEditor: public QSpinBox, public GenericEditor
{
Q_OBJECT
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "VisitorSaveGuiSchema.hxx"
#include "Proc.hxx"
#include "QtGuiContext.hxx"
#include "guiObservers.hxx"
#include "SceneItem.hxx"
+#include "SceneNodeItem.hxx"
#include <cassert>
Node* node = *iter;
SubjectNode * snode = QtGuiContext::getQtCurrent()->_mapOfSubjectNode[node];
SceneItem* item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[snode];
- assert(item);
- writeItem(_proc->getChildName(node), item);
+ YASSERT(item);
+ SceneNodeItem* inode = dynamic_cast<SceneNodeItem*>(item);
+ YASSERT(inode);
+ writeItem(_proc->getChildName(node), inode);
}
SubjectNode * sproc = QtGuiContext::getQtCurrent()->getSubjectProc();
SceneItem* item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sproc];
- assert(item);
- writeItem("__ROOT__", item);
+ YASSERT(item);
+ SceneNodeItem* inode = dynamic_cast<SceneNodeItem*>(item);
+ YASSERT(inode);
+ writeItem("__ROOT__", inode);
}
- void VisitorSaveGuiSchema::writeItem(std::string name, SceneItem* item)
+ void VisitorSaveGuiSchema::writeItem(std::string name, SceneNodeItem* item)
{
int depth = 1;
_out << indent(depth) << "<presentation";
- _out << " name=\"" << name << "\"";
- _out << " x=\"" << item->x() << "\"";
- _out << " y=\"" << item->y() << "\"";
- _out << " width=\"" << item->getWidth() << "\"";
- _out << " height=\""<< item->getHeight() << "\"";
+ _out << " name=\"" << name << "\"";
+ _out << " x=\"" << item->x() << "\"";
+ _out << " y=\"" << item->y() << "\"";
+ _out << " width=\"" << item->getWidth() << "\"";
+ _out << " height=\"" << item->getHeight() << "\"";
+ _out << " expanded=\"" << item->isExpanded() << "\"";
+ _out << " expx=\"" << item->getExpandedX() << "\"";
+ _out << " expy=\"" << item->getExpandedY() << "\"";
+ _out << " expWidth=\"" << item->getExpandedWidth() << "\"";
+ _out << " expHeight=\"" << item->getExpandedHeight() << "\"";
+ _out << " shownState=\"" << item->getShownState() << "\"";
_out << "/>" << endl;
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _VISITORSAVEGUISCHEMA_HXX_
#define _VISITORSAVEGUISCHEMA_HXX_
namespace HMI
{
class SceneItem;
+ class SceneNodeItem;
class VisitorSaveGuiSchema : public YACS::ENGINE::VisitorSaveSalomeSchema
{
protected:
virtual void writePresentation();
- virtual void writeItem(std::string name, SceneItem* item);
+ virtual void writeItem(std::string name, SceneNodeItem* item);
YACS::ENGINE::Proc* _proc;
};
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#ifndef _WRAPGRAPHICSVIEW_HXX_
-#define _WRAPGRAPHICSVIEW_HXX_
-
-#include <QGraphicsView>
-#include <QContextMenuEvent>
-
-namespace YACS
-{
- namespace HMI
- {
- class WrapGraphicsView: public QGraphicsView
- {
- Q_OBJECT
-
- public:
- WrapGraphicsView(QWidget *parent = 0);
- virtual ~WrapGraphicsView();
-
- public slots:
- virtual void onViewFitAll();
- virtual void onViewFitArea();
- virtual void onViewZoom();
- virtual void onViewPan();
- virtual void onViewGlobalPan();
- virtual void onViewReset();
- };
- }
-}
-#endif
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#include "YACSGuiLoader.hxx"
#include "Proc.hxx"
{
}
+void YACSGuiLoader::reset()
+{
+ _inputMap.clear();
+}
+
YACS::ENGINE::Proc* YACSGuiLoader::load(const char *filename)
{
_inputMap.clear();
- YACS::YACSLoader::load(filename);
+ return YACS::YACSLoader::load(filename);
}
std::map<YACS::ENGINE::Node*, PrsData> YACSGuiLoader::getPrsData(YACS::ENGINE::Proc* proc)
Node* node = 0;
string name = (*it).first;
- if (name != "__ROOT__")
- node = proc->getChildByName(name);
- else
+ if (name == "__ROOT__")
node = proc;
-
+ else
+ {
+ try
+ {
+ node = proc->getChildByName(name);
+ }
+ catch(Exception& ex)
+ {
+ continue;
+ }
+ }
_prsMap[node] = (*it).second;
}
return _prsMap;
if ( _defaultParsersMap["presentation"] )
{
presentationtype_parser* aP = (presentationtype_parser*)_defaultParsersMap["presentation"];
- _inputMap[aP->name_] = PrsData(aP->x_, aP->y_, aP->width_, aP->height_);
- DEBTRACE(aP->name_ << " " << aP->x_ << " " << aP->y_ << " " << aP->width_ << " " << aP->height_);
+ _inputMap[aP->name_] = PrsData(aP->x_, aP->y_, aP->width_, aP->height_, aP->expx_, aP->expy_,
+ aP->expWidth_, aP->expHeight_, aP->expanded_, aP->shownState_);
+ DEBTRACE(aP->name_ << " " << aP->x_ << " " << aP->y_ << " " << aP->width_ << " " << aP->height_ << " "
+ << aP->expx_ << " " << aP->expy_ << " " << aP->expWidth_ << " " << aP->expHeight_ << " " << aP->expanded_ << " " << aP->shownState_);
}
}
}
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifndef _YACSGUILOADER_HXX_
#define _YACSGUILOADER_HXX_
{
float _x, _y;
float _width, _height;
+ float _expx, _expy;
+ float _expWidth, _expHeight;
+ bool _expanded;
+ int _shownState;
PrsData()
{
_x = _y = 0;
_width = _height = 1.;
+ _expx = _expy = 0;
+ _expWidth = _expHeight = 0;
+ _expanded = true;
+ _shownState = 0;
}
PrsData(float x,
float y,
float width,
- float height)
+ float height,
+ float expx,
+ float expy,
+ float expWidth,
+ float expHeight,
+ bool expanded,
+ int shownState)
{
_x = x;
_y = y;
_width = width;
_height = height;
+ _expx = expx;
+ _expy = expy;
+ _expWidth = expWidth;
+ _expHeight = expHeight;
+ _expanded = expanded;
+ _shownState = shownState;
}
};
public:
YACSGuiLoader();
virtual ~YACSGuiLoader();
+ virtual void reset();
virtual YACS::ENGINE::Proc* load (const char *filename);
std::map<YACS::ENGINE::Node*, PrsData> getPrsData(YACS::ENGINE::Proc* proc);
std::string name_;
float x_, y_;
float width_, height_;
+ float expx_, expy_;
+ float expWidth_, expHeight_;
+ bool expanded_;
+ int shownState_;
YACSGuiLoader* collector_;
required("y",attr);
required("width",attr);
required("height",attr);
+ //required("expanded", attr);
for (int i = 0; attr[i]; i += 2)
{
- if(std::string(attr[i]) == "name") name(attr[i+1]);
- if(std::string(attr[i]) == "x") x(attr[i+1]);
- if(std::string(attr[i]) == "y") y(attr[i+1]);
- if(std::string(attr[i]) == "width") width(attr[i+1]);
- if(std::string(attr[i]) == "height") height(attr[i+1]);
+ if(std::string(attr[i]) == "name") name(attr[i+1]);
+ if(std::string(attr[i]) == "x") x(attr[i+1]);
+ if(std::string(attr[i]) == "y") y(attr[i+1]);
+ if(std::string(attr[i]) == "width") width(attr[i+1]);
+ if(std::string(attr[i]) == "height") height(attr[i+1]);
+ if(std::string(attr[i]) == "expx") expx(attr[i+1]);
+ if(std::string(attr[i]) == "expy") expy(attr[i+1]);
+ if(std::string(attr[i]) == "expWidth") expWidth(attr[i+1]);
+ if(std::string(attr[i]) == "expHeight") expHeight(attr[i+1]);
+ if(std::string(attr[i]) == "expanded") expanded(attr[i+1]);
+ if(std::string(attr[i]) == "shownState") shownState(attr[i+1]);
}
if ( collector_ )
name_ = "";
x_ = y_ = 0.;
width_ = height_ = 1;
+ expx_ = expy_ = 0.;
+ expanded_ = true;
+ shownState_ = 0;
}
virtual void name(const std::string& name)
{
height_ = QString(height.c_str()).toFloat();
}
- };
+
+ virtual void expx(const std::string& x)
+ {
+ expx_ = QString(x.c_str()).toFloat();
+ }
+
+ virtual void expy(const std::string& y)
+ {
+ expy_ = QString(y.c_str()).toFloat();
+ }
+
+ virtual void expWidth(const std::string& x)
+ {
+ expWidth_ = QString(x.c_str()).toFloat();
+ }
+
+ virtual void expHeight(const std::string& y)
+ {
+ expHeight_ = QString(y.c_str()).toFloat();
+ }
+
+ virtual void expanded(const std::string& expanded)
+ {
+ expanded_ = QString(expanded.c_str()).toInt();
+ }
+
+ virtual void shownState(const std::string& shownState)
+ {
+ shownState_ = QString(shownState.c_str()).toInt();
+ }
+ };
}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "YACSWidgets.hxx"
+#include <QApplication>
+#include <QClipboard>
+
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
+using namespace YACS::HMI;
+
+YTableView::YTableView(QWidget *parent)
+ : QTableView(parent)
+{
+}
+
+bool YTableView::event(QEvent *e)
+{
+ if (e->type() == QEvent::ShortcutOverride)
+ {
+ e->accept();
+ return true;
+ }
+ return QTableView::event(e);
+}
+
+QModelIndex YTableView::moveCursor(CursorAction cursorAction,Qt::KeyboardModifiers modifiers)
+{
+ QModelIndex ix = currentIndex();
+
+ if (!ix.isValid())
+ return QTableView::moveCursor(cursorAction, modifiers);
+
+ if(cursorAction==QAbstractItemView::MoveNext || cursorAction==QAbstractItemView::MovePrevious)
+ {
+ int row=ix.row();
+ QModelIndex parent=ix.parent();
+ int rowCount=model()->rowCount(parent);
+
+ while(1)
+ {
+ if(cursorAction==QAbstractItemView::MoveNext)
+ {
+ row=row+1;
+ if(row >= rowCount)
+ row=0;
+ }
+ else
+ {
+ row=row-1;
+ if(row < 0)
+ row=rowCount -1;
+ }
+ if(!isRowHidden(row))
+ break;
+ }
+ return model()->index(row, ix.column(), parent);
+ }
+ return QTableView::moveCursor(cursorAction, modifiers);
+}
+
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _YACSWIDGETS_HXX_
+#define _YACSWIDGETS_HXX_
+
+#include <QTableView>
+#include <QKeyEvent>
+
+namespace YACS
+{
+ namespace HMI
+ {
+ class YTableView: public QTableView
+ {
+ Q_OBJECT
+ public:
+ YTableView(QWidget *parent = 0);
+ protected:
+ QModelIndex moveCursor(CursorAction cursorAction,Qt::KeyboardModifiers modifiers);
+ bool event(QEvent *e);
+ };
+ }
+}
+
+
+#endif
x insertion, deplacement, destruction port
x algorithmes placement noeuds
x proc menu edition: ajout action execution
+x sauvegarde position des noeuds dans xml, lors du passage en exec
+x tooltips plus complets sur arbre et scenes
+x afficher les types de donnees DataStream dans arbre et edition -> en exec: tooltips
+x numerotation automatique objets cree tient compte des noms existant
+x couleur differente des liens datastream
-- sauvegarde position des noeuds dans xml, lors du passage en exec
-
+= ajouter un bouton create container dans panneau composant du noeud
- edition port outNode (xml): definir fichier sortie
- edition ports studyInNode, studyOutNode (controle types possibles...)
- edition ForEachLoop: type, samples ? (nbBranch OK)
- edition, modification objet
- affichage etat schema modifie depuis derniere sauvegarde fichier
-- couleur differente des liens datastream,
- des liens de donnees simples (sans controle associe)
+= couleur differente des liens de donnees simples (sans controle associe)
+- icones differentes pour edition et run dans object browser
- differents designs / canvas (interface generique)
- vues differentes (expanded/collapsed, edition/execution)
- drag & drop de ports pour l'ordre dans le tableau, dans la scene
- creation de liens par menu
- distinguer les liens simples (sans contrôle)
+x distinguer les liens simples (sans contrôle)
- deplacement de noeud a la souris: pouvoir passer par dessus un bloc
(pressed + touche...) transparence, finir le deplacement que s'il y a
la place, ou pousser le bloc ?
- pousser les noeuds et les blocs vers le haut ou la gauche ?
+- creer le noeud sous la souris s'il y a la place
- creation de noeud : recadrage de la vue
- selection : recadrage de la vue
(regle de correspondance de noms ? respect de l'ordre ?)
- dessiner les liens avec des ponts quand des liens se croisent !
- 2eme vue avec schema complet et cadre de la vue principale
-- panneau de preferences des couleurs
+- panneau de preferences : couleurs... (Cf. V4)
- differents modes pour la creation d'instances de composant
+- option de configuration : creer un service sans changer d'instance
- selection multiple de noeuds pour les affecter a une meme instance, ou tous les noeuds d'un bloc
- pouvoir initialiser un port dans le panneau edition du port
x revoir methode SubjectNode.reparent(_parent) sous forme de commande
x renommage node pas propage dans les noeuds fils (rename or cut/paste)
x en execution, marquer execution mode dans arbre
-
-- SIGSEV en sortie de SALOME apres destruction de la fenetre execution
-- panneau edition container, rubriue instance ? a clarifier
-- destruction d'un lien, impact sur la disposition des noeuds
+x redessiner tout de suite les liens apres mouse release ( sans devoir bouger la souris)
+x editer sauvegarder les proprietes des containers
+x panneau edition container, rubrique instance:
+ a supprimer ou renommer runtime name, ou mettre dans les advanced parameters
+x gerer tous les parametres du container, verifier coherence avec la doc
+x mise a jour panneau container si changement container dans salomeNode
+x renommage container:
+ x pas actif depuis le panel container (container, composant, service)
+ x arbre service pas a jour
+ x indicateur en edition (jaune) pas a jour dans l'arbre
+x cut paste d'un noeud pour l'enlever d'une forLoop (toujours fils de la forloop: case prise, destruction...)
+x QtGuiContext::getQtCurrent()->_mapOfEditionItem.count(_subject)' failed apres cut paste et creation de lien
+x passage en execution: arbre pas toujours cree la premiere fois
+x message incomprehensible lors de l'ajout d'un deuxieme noeud dans un forloop
+x libelle comboBox ajout de ports dans panneau edition: folklorique (newSchema_1)
+x fermeture schema non sauvegarde : dialogues de sauvegarde
+x lien nouvellement créé droit et très fin, pas toujours visible
+x panneau edition function Node: controler nom de fonction saisie (validation)
+x panneau edition function Node: remonter le nom de fonction
+x remontee d'erreur en edition: le contenu de la log proc ne change pas, quand c'est en erreur
+
+= SIGSEV en sortie de SALOME apres destruction de la fenetre execution
+x destruction d'un lien, impact sur la disposition des noeuds
+
+- remontee d'erreur en execution : log d'erreurs consolidees dans les blocs, affichee dans la proc
+- cases a cocher link automatique peu visibles
+= verifier le python des scripts a l'edition (compiler)
+= pas de tooltip quand on est sur le texte du scene item
+= tooltip curieux HEADER...
+- faire apparaitre le nom du composant quelque part sur le sceneNodeItem (tooltip ?)
- execution noeud default de switch : pas marque DONE dans arbre et vue 2D
- cut paste dans switch: valeur use case attribue automatiquement pas affiche
-- passage en execution: arbre pas toujours cree la premiere fois
- update etat des inputPort apres creation de lien dans tableau, (linked, not initialized)
- import de schema CORBA (foreach_LongCorba): exception
- chargement de schema pendant qu'un autre est running:
abort GuiExecutor Assertion `GuiContext::getCurrent()->_mapOfExecSubjectNode.count(iGui)' failed
-- cut paste d'un noeud pour l'enlever d'une forLoop (toujours fils de la forloop: case prise, destruction...)
-- QtGuiContext::getQtCurrent()->_mapOfEditionItem.count(_subject)' failed apres cut paste et creation de lien
- renommage d'un item autre que noeud non repercute:
il manque des fonctions de renommage:
-- renommage container:
- - pas actif depuis le panel container (container, composant, service)
- - arbre service pas a jour
- - indicateur en edition (jaune) pas a jour dans l'arbre
- renommage node:
- pas propage dans les liens (noms de liens)
- arbre reference service sous component pas a jour
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _HMIEXPORT_HXX_
+#define _HMIEXPORT_HXX_
+
+#ifdef WNT
+# if defined HMI_EXPORTS
+# define HMI_EXPORT __declspec( dllexport )
+# else
+# define HMI_EXPORT __declspec( dllimport )
+# endif
+#else
+# define HMI_EXPORT
+#endif
+
+#endif
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm/unix/make_begin.am
lib_LTLIBRARIES = libHMI.la
libHMI_la_CXXFLAGS = \
$(THREAD_DEF) \
$(PYTHON_CPPFLAGS) \
- $(OMNIORB_INCLUDES) \
+ $(OMNIORB_CXXFLAGS) $(OMNIORB_INCLUDES) \
$(LIBXML_INCLUDES) \
-I$(KERNEL_ROOT_DIR)/include/salome \
-I$(srcdir)/../bases \
-I../yacsorb
EXTRA_DIST = \
+HMIExport.hxx \
commands.hxx commandsProc.hxx \
guiContext.hxx guiObservers.hxx
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#include "browseCatalog.h"
-#include "guiContext.hxx"
-#include "Catalog.hxx"
-#include "ComponentDefinition.hxx"
-#include "ServiceNode.hxx"
-#include "editTree.h"
-#include "guiObservers.hxx"
-
-#include <qlistview.h>
-
-#include <iostream>
-//#define _DEVDEBUG_
-#include "YacsTrace.hxx"
-
-using namespace std;
-
-using namespace YACS;
-using namespace YACS::HMI;
-
-
-
-BrowseCatalog::BrowseCatalog(editTree* editTree,
- Subject* sub,
- int cataType,
- QWidget* parent,
- const char* name,
- bool modal,
- WFlags fl)
- : catalog(parent, name, modal, fl), _editTree(editTree), _subject(sub), _cataType(cataType)
-{
- resetTree();
-}
-
-BrowseCatalog::~BrowseCatalog()
-{
-}
-
-void BrowseCatalog::resetTree()
-{
- lv1->clear();
- lv1->setRootIsDecorated( TRUE );
- _currentCatalog = YACS::HMI::GuiContext::getCurrent()->getCurrentCatalog();
- if (_currentCatalog)
- switch (_cataType)
- {
- case CATALOGNODE:
- {
- map<string, YACS::ENGINE::ComponentDefinition*>::const_iterator itComp;
- for (itComp = _currentCatalog->_componentMap.begin();
- itComp != _currentCatalog->_componentMap.end();
- ++itComp)
- {
- string compoName = (*itComp).first;
- YACS::ENGINE::ComponentDefinition* compo = (*itComp).second;
- DEBTRACE("Component: " << compoName);
- QListViewItem *item = new QListViewItem(lv1, compoName.c_str());
- map<string, YACS::ENGINE::ServiceNode*>::iterator itServ;
- for (itServ = compo->_serviceMap.begin(); itServ != compo->_serviceMap.end(); ++itServ)
- {
- string serviceName = (*itServ).first;
- YACS::ENGINE::ServiceNode* service = (*itServ).second;
- DEBTRACE(" Service: " << serviceName);
- QListViewItem *sitem = new QListViewItem(item, serviceName.c_str());
- _serviceMap[sitem] = pair<string,string>(compoName,serviceName);
- }
- }
- break;
- }
- case CATALOGINPUTPORT:
- case CATALOGOUTPUTPORT:
- case CATALOGIDSPORT:
- case CATALOGODSPORT:
- case CATALOGDATATYPE:
- {
- map<string, YACS::ENGINE::TypeCode*>::const_iterator itType;
- for(itType = _currentCatalog->_typeMap.begin();
- itType != _currentCatalog->_typeMap.end();
- ++itType)
- {
- string typeName = (*itType).first;
- YACS::ENGINE::TypeCode* typcod = (*itType).second;
- DEBTRACE("Type Code " << typeName);
- QListViewItem *item = new QListViewItem(lv1, typeName.c_str());
- _typeCodeMap[item] = typeName;
- }
- break;
- }
- default:
- DEBTRACE("BrowseCatalog::resetTree: type not handled " << _cataType);
- }
-}
-
-void BrowseCatalog::addSelection()
-{
- QListViewItem *it =lv1->selectedItem();
- if (it) // an item selected
- switch (_cataType)
- {
- case CATALOGNODE:
- {
- _editTree->newNode(_currentCatalog, _subject, _serviceMap[it]);
- break;
- }
- case CATALOGDATATYPE:
- {
- _editTree->newDataType(_currentCatalog, _subject, _typeCodeMap[it]);
- break;
- }
- case CATALOGINPUTPORT:
- {
- _editTree->newDFInputPort(_currentCatalog, _subject, _typeCodeMap[it]);
- break;
- }
- case CATALOGOUTPUTPORT:
- {
- _editTree->newDFOutputPort(_currentCatalog, _subject, _typeCodeMap[it]);
- break;
- }
- case CATALOGIDSPORT:
- {
- _editTree->newDSInputPort(_currentCatalog, _subject, _typeCodeMap[it]);
- break;
- }
- case CATALOGODSPORT:
- {
- _editTree->newDSOutputPort(_currentCatalog, _subject, _typeCodeMap[it]);
- break;
- }
- default:
- DEBTRACE("BrowseCatalog::resetTree: type not handled " << _cataType);
- }
-}
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#ifndef _BROWSECATALOG_H_
-#define _BROWSECATALOG_H_
-
-#include "catalog.h"
-
-#include <qlistview.h>
-#include <list>
-#include <string>
-#include <map>
-
-#include <qlistview.h>
-
-namespace YACS
-{
- namespace ENGINE
- {
- class Catalog;
-/* class ServiceNode; */
- }
-
- namespace HMI
- {
-
- typedef enum
- {
- CATALOGNODE,
- CATALOGDATATYPE,
- CATALOGINPUTPORT,
- CATALOGOUTPUTPORT,
- CATALOGIDSPORT,
- CATALOGODSPORT,
- CATALOGCOMPOSEDNODE
- } TypeOfCatalogItem;
-
- class editTree;
- class Subject;
-
- class BrowseCatalog: public catalog
- {
- Q_OBJECT
-
- public:
- BrowseCatalog(editTree* editTree,
- Subject* sub,
- int cataType,
- QWidget* parent = 0,
- const char* name = 0,
- bool modal = FALSE,
- WFlags fl = 0 );
- virtual ~BrowseCatalog();
- virtual void resetTree();
- public slots:
- virtual void addSelection();
- protected:
- YACS::ENGINE::Catalog* _currentCatalog;
- std::map<QListViewItem*,std::pair<std::string,std::string> > _serviceMap;
- std::map<QListViewItem*,std::string> _typeCodeMap;
- editTree* _editTree;
- Subject* _subject;
- int _cataType;
- };
-
- }
-}
-#endif
+++ /dev/null
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>catalog</class>
-<widget class="QDialog">
- <property name="name">
- <cstring>catalog</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>411</width>
- <height>337</height>
- </rect>
- </property>
- <property name="caption">
- <string>Catalog</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLayoutWidget" row="1" column="0">
- <property name="name">
- <cstring>layout10</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <spacer>
- <property name="name">
- <cstring>spacer8</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>201</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget class="QPushButton">
- <property name="name">
- <cstring>btAddSel</cstring>
- </property>
- <property name="text">
- <string>add selection</string>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget class="QListView" row="0" column="0">
- <column>
- <property name="text">
- <string>Column 1</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <item>
- <property name="text">
- <string>New Item</string>
- </property>
- <property name="pixmap">
- <pixmap></pixmap>
- </property>
- </item>
- <property name="name">
- <cstring>lv1</cstring>
- </property>
- </widget>
- </grid>
-</widget>
-<connections>
- <connection>
- <sender>btAddSel</sender>
- <signal>clicked()</signal>
- <receiver>catalog</receiver>
- <slot>addSelection()</slot>
- </connection>
-</connections>
-<slots>
- <slot>addSelection()</slot>
-</slots>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#include "chooseName.h"
-#include "guiObservers.hxx"
-#include <qlabel.h>
-#include <qlineedit.h>
-
-using namespace std;
-
-using namespace YACS;
-using namespace YACS::HMI;
-//#define _DEVDEBUG_
-
-#include "YacsTrace.hxx"
-
-#include <string>
-
-
-ChooseName::ChooseName( std::string parentName,
- std::string typeName,
- std::string defaultName,
- QWidget* parent,
- const char* name,
- bool modal,
- WFlags fl )
- : diChooseName(parent, name, modal, fl)
-{
-// _parentName = parentName;
-// _typeName = typeName;
-// _defaultName = defaultName;
- tlParentPath->setText(parentName.c_str());
- tlTypeValue->setText(typeName.c_str());
- leName->setText(defaultName.c_str());
- _choosenName = defaultName;
- _isOk = false;
-}
-
-ChooseName::~ChooseName()
-{
-}
-
-void ChooseName::accept()
-{
- _choosenName = leName->text().latin1();
- _isOk = true;
- diChooseName::accept();
-}
-
-void ChooseName::reject()
-{
- diChooseName::reject();
-}
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#ifndef __CHOOSENAME_H_
-#define __CHOOSENAME_H_
-
-#include "dichoosename.h"
-
-namespace YACS
-{
- namespace HMI
- {
-
- class ChooseName: public diChooseName
- {
- Q_OBJECT
-
- public slots:
- void accept();
- void reject();
- public:
- ChooseName( std::string parentName,
- std::string typeName,
- std::string defaultName,
- QWidget* parent = 0,
- const char* name = 0,
- bool modal = FALSE,
- WFlags fl = 0 );
- ~ChooseName();
- std::string getChoosenName() { return _choosenName; };
- bool isOk() { return _isOk; };
- protected:
- std::string _choosenName;
- bool _isOk;
- };
-
- }
-}
-#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "commands.hxx"
+#include "guiContext.hxx"
+#include "Proc.hxx"
+#include "Catalog.hxx"
+#include "RuntimeSALOME.hxx"
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
+#include <sstream>
using namespace std;
using namespace YACS;
using namespace YACS::HMI;
+int Invocator::_ctr = 0;
+
Command::Command()
{
_subCommands.clear();
+ _normalReverse = true;
}
+//! the command is executed a first time after its registration for undo redo, then on redo
+/*!
+ * Execute may induce subcommands to be registered during its execution.
+ * Subcommands must be deleted before redo, to be recreated by redo.
+ * CommandDestroy is a special case, where subcommands are registered before Execute, and
+ * undo action calls executeSubOnly instead of reverse. Subcommands pf CommandDestroy must
+ * not be deleted.
+ */
bool Command::execute()
{
+ if ( !GuiContext::getCurrent() || !GuiContext::getCurrent()->getInvoc() )
+ return false;
+
+ bool commandInProgress = !GuiContext::getCurrent()->getInvoc()->isSpecialReverse();
+ if (commandInProgress)
+ GuiContext::getCurrent()->getInvoc()->_commandsInProgress.push_back(this);
+
bool ret=true;
+ if (GuiContext::getCurrent()->getInvoc()->_isRedo && _normalReverse)
+ {
+ for (int i=0; i<_subCommands.size(); i++)
+ delete _subCommands[i];
+ _subCommands.clear();
+ }
ret = localExecute();
+ if (ret) GuiContext::getCurrent()->setNotSaved(true);
+
+ if (commandInProgress)
+ GuiContext::getCurrent()->getInvoc()->_commandsInProgress.pop_back();
+ return ret;
+}
+
+//! Reverse action: undo
+/*! Recursive reverse of sub commands then local action
+ * @param isNormal: true for ordinary command, false for command Destroy
+ */
+bool Command::reverse(bool isNormal)
+{
+ bool ret=true;
if (! _subCommands.empty())
{
- list<Command*>::iterator it;
- for (it=_subCommands.begin(); it!=_subCommands.end(); it++)
+ for (int i=0; i<_subCommands.size(); i++)
{
+ ret =_subCommands[i]->reverse(isNormal);
if (!ret) break;
- ret = (*it)->execute();
}
}
+ if (ret)
+ {
+ if (isNormal) // true for all commands but commandDestroy
+ ret = localReverse();
+ else
+ ret = localExecute(); // subCommand of command Destroy
+ }
return ret;
}
-bool Command::reverse()
+//! execute only sub commands in a reverse action
+/*!
+ * for undo of commandDestroy, only sub commands of commandDestroy must be executed,
+ * via subcommand->reverse(false)
+ */
+bool Command::executeSubOnly()
{
bool ret=true;
if (! _subCommands.empty())
{
- list<Command*>::reverse_iterator it;
- for (it=_subCommands.rbegin(); it!=_subCommands.rend(); it++)
+ for (int i=0; i<_subCommands.size(); i++)
{
- ret =(*it)->execute();
+ ret =_subCommands[i]->reverse(false);
if (!ret) break;
}
}
- if (ret) ret = localReverse();
+ return ret;
+}
+
+std::string Command::dump()
+{
+ return "=== generic command dump ===";
+}
+
+std::string Command::recursiveDump(int level)
+{
+ string prefix = "";
+ for (int i=0; i<level; i++) prefix += " ";
+ string ret = prefix + dump() + "\n";
+ for (int i=0; i<_subCommands.size(); i++)
+ ret += _subCommands[i]->recursiveDump(level+1);
return ret;
}
_subCommands.push_back(command);
}
+
+
+
+
Invocator::Invocator()
{
+ _commandsDone.clear();
+ _commandsUndone.clear();
+ _commandsInProgress.clear();
+ _isRedo = false;
+ _isUndo = false;
+ _specialReverse = false;
+ _undoCata = new YACS::ENGINE::Catalog("undoCata");
+ YACS::ENGINE::RuntimeSALOME* runTime = YACS::ENGINE::getSALOMERuntime();
+ _undoProc= runTime->createProc("undoProc");
}
void Invocator::add(Command* command)
{
- _commandsDone.push(command); // to do after execute ok
+ DEBTRACE("Invocator::add");
+ if(_isUndo)
+ return;
+ if (GuiContext::getCurrent()->getInvoc()->isSpecialReverse())
+ {
+ delete command;
+ return;
+ }
+ if (_commandsInProgress.empty())
+ {
+ _commandsDone.push_back(command); // --- to do after execute ok
+ _commandsUndone.clear(); // --- undone stack is no more relevant
+ }
+ else
+ {
+ DEBTRACE("addSubCommand");
+ _commandsInProgress.back()->addSubCommand(command);
+ }
}
bool Invocator::undo()
{
+ DEBTRACE("Invocator::undo");
bool ret = true;
+
+ {
+ stringstream ret1;
+ ret1 << "_commandsDone" << endl;
+ for (int i=0; i<_commandsDone.size(); i++)
+ ret1 << i << _commandsDone[i]->recursiveDump(2);
+ DEBTRACE(ret1.str());
+ stringstream ret2;
+ ret2 << "_commandsUndone" << endl;
+ for (int i=0; i<_commandsUndone.size(); i++)
+ ret2 << i << _commandsUndone[i]->recursiveDump(2);
+ DEBTRACE(ret2.str());
+ }
+
if (! _commandsDone.empty())
{
- _commandsDone.pop();
- ret = _commandsDone.top()->reverse();
- _commandsUndone.push(_commandsDone.top());
+ bool isNormal = _commandsDone.back()->isNormalReverse();
+ _specialReverse = !isNormal;
+ _isUndo=true;
+ if (isNormal)
+ ret = _commandsDone.back()->reverse(isNormal);
+ else
+ ret = _commandsDone.back()->executeSubOnly();
+ _isUndo=false;
+ _commandsUndone.push_back(_commandsDone.back());
+ _commandsDone.pop_back();
+ _specialReverse = false;
}
+
+ {
+ stringstream ret1;
+ ret1 << "_commandsDone" << endl;
+ for (int i=0; i<_commandsDone.size(); i++)
+ ret1 << i << _commandsDone[i]->recursiveDump(2);
+ DEBTRACE(ret1.str());
+ stringstream ret2;
+ ret2 << "_commandsUndone" << endl;
+ for (int i=0; i<_commandsUndone.size(); i++)
+ ret2 << i << _commandsUndone[i]->recursiveDump(2);
+ DEBTRACE(ret2.str());
+ }
+
return ret;
}
bool Invocator::redo()
{
+ DEBTRACE("Invocator::redo");
bool ret = true;
+
+ {
+ stringstream ret1;
+ ret1 << "_commandsDone" << endl;
+ for (int i=0; i<_commandsDone.size(); i++)
+ ret1 << i << _commandsDone[i]->recursiveDump(2);
+ DEBTRACE(ret1.str());
+ stringstream ret2;
+ ret2 << "_commandsUndone" << endl;
+ for (int i=0; i<_commandsUndone.size(); i++)
+ ret2 << i << _commandsUndone[i]->recursiveDump(2);
+ DEBTRACE(ret2.str());
+ }
+
if (! _commandsUndone.empty())
{
- _commandsUndone.pop();
- ret = _commandsUndone.top()->execute();
- _commandsDone.push(_commandsUndone.top());
+ _isRedo=true;
+ ret = _commandsUndone.back()->execute();
+ _isRedo=false;
+ _commandsDone.push_back(_commandsUndone.back());
+ _commandsUndone.pop_back();
}
+
+ {
+ stringstream ret1;
+ ret1 << "_commandsDone" << endl;
+ for (int i=0; i<_commandsDone.size(); i++)
+ ret1 << i << _commandsDone[i]->recursiveDump(2);
+ DEBTRACE(ret1.str());
+ stringstream ret2;
+ ret2 << "_commandsUndone" << endl;
+ for (int i=0; i<_commandsUndone.size(); i++)
+ ret2 << i << _commandsUndone[i]->recursiveDump(2);
+ DEBTRACE(ret2.str());
+ }
+
return ret;
}
+std::list<std::string> Invocator::getDone()
+{
+ list<string> listDone;
+ listDone.clear();
+ for (int i=0; i<_commandsDone.size(); i++)
+ listDone.push_back(_commandsDone[i]->recursiveDump());
+ return listDone;
+}
+
+std::list<std::string> Invocator::getUndone()
+{
+ list<string> listUndone;
+ listUndone.clear();
+ for (int i=0; i<_commandsUndone.size(); i++)
+ listUndone.push_back(_commandsUndone[i]->recursiveDump());
+ return listUndone;
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _COMMANDS_HXX_
#define _COMMANDS_HXX_
+#include "HMIExport.hxx"
#include <list>
-#include <stack>
#include <string>
+#include <vector>
namespace YACS
{
+ namespace ENGINE
+ {
+ class Proc;
+ class Catalog;
+ }
+
namespace HMI
{
class Command
public:
Command();
virtual bool execute();
- virtual bool reverse();
- //virtual std::string getCommandType() = 0; // utiliser un dynamic_cast plutot
+ virtual bool reverse(bool isNormal=true);
+ virtual bool executeSubOnly();
+ virtual std::string dump();
+ std::string recursiveDump(int level =0);
void addSubCommand(Command* command);
+ bool isNormalReverse() { return _normalReverse; };
protected:
virtual bool localExecute() = 0;
virtual bool localReverse() = 0;
- std::list<Command*> _subCommands;
+ std::vector<Command*> _subCommands;
+ bool _normalReverse;
};
- class Invocator
+ class HMI_EXPORT Invocator
{
+ friend class Command;
public:
Invocator();
void add(Command* command);
bool undo();
bool redo();
+ std::list<std::string> getDone();
+ std::list<std::string> getUndone();
+ YACS::ENGINE::Proc *getUndoProc() { return _undoProc; };
+ YACS::ENGINE::Catalog *getUndoCata() { return _undoCata; };
+ bool isSpecialReverse() { return _specialReverse; };
+ static int _ctr;
+
protected:
- std::stack<Command*> _commandsDone;
- std::stack<Command*> _commandsUndone;
+ std::vector<Command*> _commandsDone;
+ std::vector<Command*> _commandsUndone;
+ std::vector<Command*> _commandsInProgress;
+ YACS::ENGINE::Proc *_undoProc;
+ YACS::ENGINE::Catalog *_undoCata;
+ bool _isRedo;
+ bool _isUndo;
+ bool _specialReverse;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include <Python.h>
#include "commandsProc.hxx"
#include "DataPort.hxx"
#include "InputDataStreamPort.hxx"
#include "OutputDataStreamPort.hxx"
+#include "StudyPorts.hxx"
#include "PresetPorts.hxx"
#include "ComponentDefinition.hxx"
#include "SalomeContainer.hxx"
using namespace YACS::ENGINE;
using namespace YACS::HMI;
+
+static std::map<int, std::string> createErrorMsgMap()
+{
+ std::map<int, std::string> m;
+ m[1] = "\nUse the [Ctrl] Drag_N_Drop method if you want to create a input/output link without the associated control link";
+ return m;
+}
+
+std::map<int, std::string> ErrorMsg = createErrorMsgMap();
+
+void setErrorMsg(YACS::Exception& ex)
+{
+ DEBTRACE("errorNumber= "<<ex.errNumber);
+ if(ex.errNumber > 0 && ErrorMsg.count(ex.errNumber) != 0)
+ {
+ DEBTRACE(ErrorMsg[ex.errNumber]);
+ GuiContext::getCurrent()->_lastErrorMessage = ex.what() + ErrorMsg[ex.errNumber];
+ }
+ else
+ GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+}
+
std::map<int, std::string> ProcInvoc::_typeNameMap;
// ----------------------------------------------------------------------------
std::string type,
std::string position,
std::string name,
+ bool newCompoInst,
int swCase)
: Command(), _catalog(catalog), _compoName(compo), _typeName(type),
- _position(position), _name(name), _swCase(swCase)
+ _position(position), _name(name), _newCompoInst(newCompoInst), _swCase(swCase)
{
- _nodeToClone = 0;
- if (_compoName.empty())
- {
- if (_catalog->_nodeMap.count(_typeName))
- _nodeToClone = _catalog->_nodeMap[_typeName];
- else if (_catalog->_composednodeMap.count(_typeName))
- _nodeToClone = _catalog->_composednodeMap[_typeName];
- }
- else
- if (_catalog->_componentMap.count(_compoName))
- {
- YACS::ENGINE::ComponentDefinition* compodef = _catalog->_componentMap[_compoName];
- if (compodef->_serviceMap.count(_typeName))
- _nodeToClone = compodef->_serviceMap[_typeName];
- }
- if (_nodeToClone)
- _typeNode = ProcInvoc::getTypeOfNode(_nodeToClone);
+ DEBTRACE("CommandAddNodeFromCatalog " << compo << " " << type << " " << position << " " << name);
+ _node=0;
+ _snode=0;
}
+std::string CommandAddNodeFromCatalog::dump()
+{
+ string ret ="CommandAddNodeFromCatalog " + _compoName + " " + _typeName + " " + _position + " " + _name;
+ return ret;
+}
YACS::ENGINE::Node *CommandAddNodeFromCatalog::getNode()
{
return _node;
}
+YACS::HMI::SubjectNode *CommandAddNodeFromCatalog::getSubjectNode()
+{
+ return _snode;
+}
+
bool CommandAddNodeFromCatalog::localExecute()
{
+ DEBTRACE("CommandAddNodeFromCatalog::localExecute");
+
Node *son = 0;
+ Node *nodeToClone = 0;
try
{
+ if (_compoName.empty())
+ {
+ if (_catalog->_nodeMap.count(_typeName))
+ nodeToClone = _catalog->_nodeMap[_typeName];
+ else if (_catalog->_composednodeMap.count(_typeName))
+ nodeToClone = _catalog->_composednodeMap[_typeName];
+ }
+ else
+ if (_catalog->_componentMap.count(_compoName))
+ {
+ YACS::ENGINE::ComponentDefinition* compodef = _catalog->_componentMap[_compoName];
+ if (compodef->_serviceMap.count(_typeName))
+ nodeToClone = compodef->_serviceMap[_typeName];
+ }
+ if (nodeToClone)
+ _typeNode = ProcInvoc::getTypeOfNode(nodeToClone);
+
+ GuiContext::getCurrent()->setCurrentCatalog(_catalog);
Proc* proc = GuiContext::getCurrent()->getProc();
Node* node = proc;
+ ServiceNode *service = 0;
+
if (!_position.empty()) node = proc->getChildByName(_position);
ComposedNode* father =dynamic_cast<ComposedNode*> (node);
- if (father && _nodeToClone)
+ if (father && nodeToClone)
{
- son = _nodeToClone->clone(0);
+ son = nodeToClone->clone(0);
son->setName(_name);
+ service = dynamic_cast<ServiceNode*>(son);
+ }
+
+ // Node creation eventually reusing old component instance
+ ComponentInstance *compo = 0;
+ if (service)
+ compo = service->getComponent();
+
+ if(compo)
+ {
+ std::string compoName=compo->getCompoName();
+ DEBTRACE(compoName);
+ std::string compoInstName=compo->getInstanceName();
+ DEBTRACE(compoInstName);
+ if(!_newCompoInst)
+ {
+ ComponentInstance *lastcompo = GuiContext::getCurrent()->_mapOfLastComponentInstance[compoName];
+ DEBTRACE(lastcompo);
+ if(lastcompo)
+ {
+ DEBTRACE(lastcompo->getInstanceName());
+ service->setComponent(lastcompo); // use the last component instance of the same type and not a new instance
+ }
+ else
+ GuiContext::getCurrent()->_mapOfLastComponentInstance[compoName]=compo;
+ }
+ else
+ GuiContext::getCurrent()->_mapOfLastComponentInstance[compoName]=compo;
}
+
if (son)
{
TypeOfElem fatherType = ProcInvoc::getTypeOfNode(father);
(dynamic_cast<YACS::ENGINE::OptimizerLoop*>(father))->edSetNode(son);
break;
default:
- assert(0);
+ YASSERT(0);
}
}
_node = son;
+ if (!_node)
+ throw YACS::Exception("node from catalog is not correct: check if catalog is up to date!");
+
+ SubjectComposedNode *sfather = dynamic_cast<SubjectComposedNode*>(GuiContext::getCurrent()->_mapOfSubjectNode[father]);
+ _snode= sfather->addSubjectNode(_node, "", _catalog, _compoName, _typeName);
+ _snode->loadChildren();
+ _snode->loadLinks();
}
catch (Exception& ex)
{
DEBTRACE("CommandAddNode::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
if (son) delete son;
_node = 0;
}
bool CommandAddNodeFromCatalog::localReverse()
{
+ DEBTRACE("CommandAddNodeFromCatalog::localReverse");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ string nodeName;
+ if (_position.empty())
+ nodeName= _name;
+ else
+ nodeName = _position + "." + _name;
+ DEBTRACE(nodeName);
+ _node = proc->getChildByName(nodeName);
+ YASSERT(_node);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(_node));
+ _snode = GuiContext::getCurrent()->_mapOfSubjectNode[_node];
+
+ Subject *father=_snode->getParent();
+ DEBTRACE(father);
+ DEBTRACE(father->getName());
+ Subject::erase(_snode);
+ _snode= 0;
+ _node = 0;
+ if (father)
+ {
+ DEBTRACE("REMOVE");
+ father->select(true);
+ father->update(REMOVE,0,0);
+ }
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandAddNodeFromCatalog::localReverse(): " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
}
// ----------------------------------------------------------------------------
: Command(), _position(position), _newParent(newParent)
{
DEBTRACE("CommandReparentNode::CommandReparentNode " << _position << " " << _newParent);
+ _oldParent = "";
+}
+
+std::string CommandReparentNode::dump()
+{
+ string ret ="CommandReparentNode " + _position + " " + _newParent;
+ return ret;
}
bool CommandReparentNode::localExecute()
{
+ DEBTRACE("CommandReparentNode::localExecute");
Proc* proc = GuiContext::getCurrent()->getProc();
Node* node = 0;
try
if (Loop *loop = dynamic_cast<Loop*>(newFather))
if (!loop->edGetDirectDescendants().empty())
throw YACS::Exception("Already a node in a new parent of Loop type");
+ if (DynParaLoop * dpl = dynamic_cast<DynParaLoop*>(newFather))
+ if (dpl->getExecNode() != NULL)
+ throw YACS::Exception("Already an execution node in the new parent of type dynamic loop");
Node *nodeSameName = 0;
try
{
if (nodeSameName)
throw YACS::Exception("there is already a child of same name in the new parent");
SubjectNode * snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ Subject *subo = GuiContext::getCurrent()->_mapOfSubjectNode[oldFather];
+ Subject *subn = GuiContext::getCurrent()->_mapOfSubjectNode[newFather];
+ SubjectComposedNode* sop = dynamic_cast<SubjectComposedNode*>(subo);
+ SubjectComposedNode* snp = dynamic_cast<SubjectComposedNode*>(subn);
+ //save existing links
+ snode->saveLinks();
snode->removeExternalLinks();
snode->removeExternalControlLinks();
+ sop->houseKeepingAfterCutPaste(true, snode);
oldFather->edRemoveChild(node);
newFather->edAddChild(node);
+ snp->houseKeepingAfterCutPaste(false, snode);
+ //restore links
+ snode->restoreLinks();
+ if (oldFather == proc) _oldParent = proc->getName();
+ else _oldParent = proc->getChildName(oldFather);
+ _newpos = proc->getChildName(node);
+ sop->update(CUT, ProcInvoc::getTypeOfNode(node), snode);
+ snp->update(PASTE, ProcInvoc::getTypeOfNode(node), snode);
+ snode->recursiveUpdate(RENAME, 0, snode);
+ snode->_parent = snp;
}
catch (Exception& ex)
{
- DEBTRACE("CommandRenameNode::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ DEBTRACE("CommandReparentNode::localExecute() : " << ex.what());
+ setErrorMsg(ex);
+ node = 0;
+ }
+ catch (...)
+ {
+ GuiContext::getCurrent()->_lastErrorMessage = "Unknown exception";
node = 0;
}
return (node != 0);
bool CommandReparentNode::localReverse()
{
+ DEBTRACE("CommandReparentNode::localReverse " << _newpos << " " << _oldParent);
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node = 0;
+ try
+ {
+ node = proc->getChildByName(_newpos);
+ ComposedNode *father = node->getFather();
+ ComposedNode *oldFather = proc;
+ Node *oldF = 0;
+ if (_oldParent != proc->getName())
+ {
+ oldF = proc->getChildByName(_oldParent);
+ oldFather = dynamic_cast<ComposedNode*>(oldF);
+ }
+ SubjectNode * snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ Subject *subn = GuiContext::getCurrent()->_mapOfSubjectNode[father];
+ Subject *subo = GuiContext::getCurrent()->_mapOfSubjectNode[oldFather];
+ SubjectComposedNode* snp = dynamic_cast<SubjectComposedNode*>(subn);
+ SubjectComposedNode* sop = dynamic_cast<SubjectComposedNode*>(subo);
+ //save existing links
+ snode->saveLinks();
+ snode->removeExternalLinks();
+ snode->removeExternalControlLinks();
+ snp->houseKeepingAfterCutPaste(true, snode);
+ father->edRemoveChild(node);
+ oldFather->edAddChild(node);
+ sop->houseKeepingAfterCutPaste(false, snode);
+ //restore links
+ snode->restoreLinks();
+ snp->update(CUT, ProcInvoc::getTypeOfNode(node), snode);
+ sop->update(PASTE, ProcInvoc::getTypeOfNode(node), snode);
+ snode->recursiveUpdate(RENAME, 0, snode);
+ snode->_parent = sop;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandReparentNode::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ node = 0;
+ }
+ catch (...)
+ {
+ GuiContext::getCurrent()->_lastErrorMessage = "Unknown exception";
+ node = 0;
+ }
+ return (node != 0);
+}
+
+// ----------------------------------------------------------------------------
+CommandPutInComposedNode::CommandPutInComposedNode(std::string position,
+ std::string newParent,std::string type)
+ : Command(), _position(position), _newParent(newParent), _type(type)
+{
+ DEBTRACE("CommandPutInComposedNode::CommandPutInComposedNode " << _position << " " << _newParent);
+ _newpos ="";
+}
+
+std::string CommandPutInComposedNode::dump()
+{
+ string ret ="CommandPutInComposedNode " + _position + " " + _newParent + " " + _type;
+ return ret;
+}
+
+
+bool CommandPutInComposedNode::localExecute()
+{
+ DEBTRACE("CommandPutInComposedNode::localExecute");
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node = 0;
+ try
+ {
+ if (_position == proc->getName())
+ throw YACS::Exception("You cannot put the proc (main bloc) in a " + _type);
+ node = proc->getChildByName(_position);
+ ComposedNode *oldFather = node->getFather();
+ SubjectNode * snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ Subject *subo = GuiContext::getCurrent()->_mapOfSubjectNode[oldFather];
+ SubjectComposedNode* sop = dynamic_cast<SubjectComposedNode*>(subo);
+ //save existing links
+ snode->saveLinks();
+ //remove external links
+ snode->removeExternalLinks();
+ snode->removeExternalControlLinks();
+ //remove subject node from subject old father
+ sop->houseKeepingAfterCutPaste(true, snode);
+ //remove node from old father
+ oldFather->edRemoveChild(node);
+ //refresh node views
+ sop->update(CUT, ProcInvoc::getTypeOfNode(node), snode);
+
+ //create a ComposedNode (type _type) with name _newParent
+ YACS::ENGINE::Catalog *catalog = YACS::ENGINE::getSALOMERuntime()->getBuiltinCatalog();
+ Node* nodeToClone = catalog->_composednodeMap[_type];
+ Node* composednode = nodeToClone->clone(0);
+ composednode->setName(_newParent);
+ //add the new composednode as child of oldfather
+ oldFather->edAddChild(composednode);
+ //create the subject composednode
+ SubjectNode *scomposednode = sop->addSubjectNode(composednode,"",catalog,"",_type);
+
+ //add the old node as child of new composednode
+ (dynamic_cast<YACS::ENGINE::ComposedNode*>(composednode))->edAddChild(node);
+ _newpos = proc->getChildName(node);
+ //add the subject node to subject composednode
+ (dynamic_cast<SubjectComposedNode*>(scomposednode))->houseKeepingAfterCutPaste(false, snode);
+ snode->setParent(scomposednode);
+ //restore links
+ snode->restoreLinks();
+ //refresh all views
+ scomposednode->update(PASTE, ProcInvoc::getTypeOfNode(node), snode);
+ snode->recursiveUpdate(RENAME, 0, snode);
+ snode->select(true);
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandPutInComposedNode::localExecute() : " << ex.what());
+ setErrorMsg(ex);
+ node = 0;
+ }
+ catch (...)
+ {
+ GuiContext::getCurrent()->_lastErrorMessage = "Unknown exception";
+ node = 0;
+ }
+ return (node != 0);
}
+bool CommandPutInComposedNode::localReverse()
+{
+ DEBTRACE("CommandPutInComposedNode::localReverse");
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node = 0;
+ try
+ {
+ YASSERT(_newpos != proc->getName())
+ node = proc->getChildByName(_newpos);
+ ComposedNode *oldFather = node->getFather();
+ SubjectNode * snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ Subject *subo = GuiContext::getCurrent()->_mapOfSubjectNode[oldFather];
+ SubjectComposedNode* sop = dynamic_cast<SubjectComposedNode*>(subo);
+ //save existing links
+ snode->saveLinks();
+ //remove external links
+ snode->removeExternalLinks();
+ snode->removeExternalControlLinks();
+ //remove subject node from subject old father
+ sop->houseKeepingAfterCutPaste(true, snode);
+ //remove node from old father
+ oldFather->edRemoveChild(node);
+ //refresh node views, temporary paste in proc to keep widgets associated to node
+ sop->update(CUT, ProcInvoc::getTypeOfNode(node), snode);
+ GuiContext::getCurrent()->getSubjectProc()->update(PASTE, ProcInvoc::getTypeOfNode(node), snode);
+
+ //remove composed node oldFather
+ ComposedNode *oldGrandFather = oldFather->getFather();
+ Subject *subog = GuiContext::getCurrent()->_mapOfSubjectNode[oldGrandFather];
+ SubjectComposedNode* sogp = dynamic_cast<SubjectComposedNode*>(subog);
+ Subject::erase(sop);
+
+ //add the old node as child of new composednode
+ oldGrandFather->edAddChild(node);
+ _newpos = proc->getChildName(node);
+ //add the subject node to subject composednode
+ sogp->houseKeepingAfterCutPaste(false, snode);
+ snode->setParent(sogp);
+ //restore links
+ snode->restoreLinks();
+ //refresh all views
+ GuiContext::getCurrent()->getSubjectProc()->update(CUT, ProcInvoc::getTypeOfNode(node), snode);
+ sogp->update(PASTE, ProcInvoc::getTypeOfNode(node), snode);
+ snode->recursiveUpdate(RENAME, 0, snode);
+ snode->select(true);
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandPutInComposedNode::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ node = 0;
+ }
+ return (node != 0);
+}
// ----------------------------------------------------------------------------
-CommandCopyNode::CommandCopyNode(std::string position,
- std::string newParent)
- : Command(), _position(position), _newParent(newParent), _clone(0)
+CommandCopyNode::CommandCopyNode(YACS::ENGINE::Proc *fromproc,
+ std::string position,
+ std::string newParent,
+ int swCase)
+ : Command(), _fromproc(fromproc), _position(position), _newParent(newParent), _newName(""), _clone(0), _case(swCase)
{
DEBTRACE("CommandCopyNode::CommandCopyNode " << _position << " " << _newParent);
}
+std::string CommandCopyNode::dump()
+{
+ string ret ="CommandCopyNode " + _position + " " + _newParent;
+ return ret;
+}
+
YACS::ENGINE::Node *CommandCopyNode::getNode()
{
return _clone;
bool CommandCopyNode::localExecute()
{
+ DEBTRACE("CommandCopyNode::localExecute");
Proc* proc = GuiContext::getCurrent()->getProc();
Node* node = 0;
try
{
- if (_position == proc->getName())
+ if (_position == _fromproc->getName())
throw YACS::Exception("Copy the proc (main bloc) is impossible");
- node = proc->getChildByName(_position);
+ node = _fromproc->getChildByName(_position);
ComposedNode *oldFather = node->getFather();
ComposedNode *newFather = proc;
Node *newF = 0;
_clone = node->clone(0);
if (!_clone)
throw YACS::Exception("Node cannot be cloned");
- int nodeSuffix = 0;
+ int nodeSuffix = -1;
bool sameName = true;
stringstream s;
do
{
s.str("");
- s << node->getName() << nodeSuffix;
+ s << node->getName();
+ if (nodeSuffix >= 0) // --- first try <0 means without suffix
+ s << nodeSuffix;
DEBTRACE(s.str());
try
{
}
while(sameName);
_clone->setName(s.str());
- newFather->edAddChild(_clone);
+ _newName = _clone->getName();
+
+ if (YACS::ENGINE::Switch* theswitch = dynamic_cast<YACS::ENGINE::Switch*>(newFather))
+ {
+ DEBTRACE("father is a switch " << newFather->getName());
+ int theCase=_case;
+ if(theswitch->edGetNode(_case))
+ {
+ //the case is already used. Try another one
+ theCase=theswitch->getMaxCase()+1;
+ }
+ theswitch->edSetNode(theCase,_clone);
+ }
+ else
+ newFather->edAddChild(_clone);
+
+ _newName = _clone->getQualifiedName();
+ DEBTRACE(_newName);
+
+ SubjectNode *sub = GuiContext::getCurrent()->_mapOfSubjectNode[newFather];
+ SubjectComposedNode *snp = dynamic_cast<SubjectComposedNode*>(sub);
+ SubjectNode *son = snp->addSubjectNode(_clone);
+ son->loadChildren();
+ son->loadLinks();
}
catch (Exception& ex)
{
- DEBTRACE("CommandRenameNode::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ DEBTRACE("CommandCopyNode::localExecute() : " << ex.what());
+ setErrorMsg(ex);
_clone = 0;
}
return (_clone != 0);
bool CommandCopyNode::localReverse()
{
+ DEBTRACE("CommandCopyNode::localReverse " << _position << " " << _newParent);
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ string nodeName = _newParent + "." + _newName;
+ if (_newParent == proc->getName())
+ nodeName = _newName;
+ DEBTRACE(nodeName);
+ _clone = proc->getChildByName(nodeName);
+
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(_clone));
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[_clone];
+ Subject *father = snode->getParent();
+ Subject::erase(snode);
+ _clone = 0;
+ if (father)
+ {
+ DEBTRACE("REMOVE");
+ father->select(true);
+ father->update(REMOVE,0,0);
+ }
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandCopyNode::localReverse(): " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+ return true;
}
// ----------------------------------------------------------------------------
: Command(), _position(position), _name(name)
{
DEBTRACE("CommandRenameNode::CommandRenameNode " << _position << " " << _name);
+ _oldName ="";
+ _newpos="";
+}
+
+std::string CommandRenameNode::dump()
+{
+ string ret ="CommandRenameNode " + _position + " " + _name;
+ return ret;
}
bool CommandRenameNode::localExecute()
{
+ DEBTRACE("CommandRenameNode::localExecute");
Proc* proc = GuiContext::getCurrent()->getProc();
Node* node = proc;
try
{
if (_position != proc->getName()) node = proc->getChildByName(_position);
+ _oldName = node->getName();
node->setName(_name);
+ if (node == proc)
+ _newpos = _name;
+ else
+ _newpos = proc->getChildName(node);
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ if (snode)
+ snode->recursiveUpdate(RENAME, 0, snode);
}
catch (Exception& ex)
{
DEBTRACE("CommandRenameNode::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
node = 0;
}
return (node != 0);
bool CommandRenameNode::localReverse()
{
+ DEBTRACE("CommandRenameNode::localReverse");
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node = proc;
+ try
+ {
+ if (_newpos != proc->getName()) node = proc->getChildByName(_newpos);
+ YASSERT(node->getName() == _name);
+ node->setName(_oldName);
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ if (snode)
+ snode->recursiveUpdate(RENAME, 0, snode);
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandRenameNode::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ node = 0;
+ }
+ return (node != 0);
}
// ----------------------------------------------------------------------------
DEBTRACE("CommandRenameContainer::CommandRenameContainer " << _oldName << " " << _newName);
}
+std::string CommandRenameContainer::dump()
+{
+ string ret ="CommandRenameContainer " +_oldName + " " + _newName;
+ return ret;
+}
+
bool CommandRenameContainer::localExecute()
{
+ DEBTRACE("CommandRenameContainer::localExecute");
Proc* proc = GuiContext::getCurrent()->getProc();
Container *container = 0;
try
{
- if (! proc->containerMap.count(_oldName)) return 0;
+ YASSERT(proc->containerMap.count(_oldName));
container = proc->containerMap[_oldName];
+ if (proc->containerMap.count(_newName))
+ {
+ GuiContext::getCurrent()->_lastErrorMessage = "Container name already existing";
+ return 0;
+ }
proc->containerMap.erase(_oldName);
container->setName(_newName);
proc->containerMap[_newName] = container;
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectContainer.count(container));
+ SubjectContainer *scont = GuiContext::getCurrent()->_mapOfSubjectContainer[container];
+ scont-> update(RENAME, 0, scont);
+ scont->notifyComponentsChange(ASSOCIATE, CONTAINER, scont);
}
catch (Exception& ex)
{
DEBTRACE("CommandRenameContainer::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
container = 0;
}
return (container != 0);
bool CommandRenameContainer::localReverse()
{
+ DEBTRACE("CommandRenameContainer::localReverse");
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Container *container = 0;
+ try
+ {
+ YASSERT(proc->containerMap.count(_newName));
+ container = proc->containerMap[_newName];
+ proc->containerMap.erase(_newName);
+ container->setName(_oldName);
+ proc->containerMap[_oldName] = container;
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectContainer.count(container));
+ SubjectContainer *scont = GuiContext::getCurrent()->_mapOfSubjectContainer[container];
+ scont-> update(RENAME, 0, scont);
+ scont->notifyComponentsChange(ASSOCIATE, CONTAINER, scont);
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandRenameContainer::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ container = 0;
+ }
+ return (container != 0);
}
// ----------------------------------------------------------------------------
CommandRenameInDataPort::CommandRenameInDataPort(std::string position,
std::string oldName,
- std::string newName)
- : Command(), _position(position), _oldName(oldName), _newName(newName)
+ std::string newName, TypeOfElem portType)
+ : Command(), _position(position), _oldName(oldName), _newName(newName), _portType(portType)
{
DEBTRACE("CommandRenameInDataPort::CommandRenameInDataPort "
<< _position << " " << _oldName<< " " << _newName);
}
+std::string CommandRenameInDataPort::dump()
+{
+ string ret ="CommandRenameInDataPort " + _position + " " + _oldName + " " + _newName;
+ return ret;
+}
+
bool CommandRenameInDataPort::localExecute()
{
+ DEBTRACE("CommandRenameInDataPort::localExecute");
Proc* proc = GuiContext::getCurrent()->getProc();
Node* node = proc;
try
try
{
- port = node->getInPort(_newName);
+ if(_portType==INPUTPORT)
+ port = node->getInputPort(_newName);
+ else
+ port = node->getInputDataStreamPort(_newName);
}
catch (Exception& e) {} // --- raised when no existing port with _newName
if (port)
- return false; // --- there is already a port with the new name
+ throw Exception("there is already a port with the new name");
- port = node->getInPort(_oldName);
+ if(_portType==INPUTPORT)
+ port = node->getInputPort(_oldName);
+ else
+ port = node->getInputDataStreamPort(_oldName);
port->setName(_newName);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(port));
+ SubjectDataPort *sport = GuiContext::getCurrent()->_mapOfSubjectDataPort[port];
+ sport->update(RENAME, 0, sport);
}
catch (Exception& ex)
{
DEBTRACE("CommandRenameInDataPort::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
node = 0;
}
return (node != 0);
bool CommandRenameInDataPort::localReverse()
{
+ DEBTRACE("CommandRenameInDataPort::localReverse");
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node = proc;
+ try
+ {
+ if (_position != proc->getName()) node = proc->getChildByName(_position);
+ InPort * port = 0;
+
+ try
+ {
+ if(_portType==INPUTPORT)
+ port = node->getInputPort(_oldName);
+ else
+ port = node->getInputDataStreamPort(_oldName);
+ }
+ catch (Exception& e) {} // --- raised when no existing port with _newName
+ if (port)
+ throw Exception("there is already a port with the old name");
+
+ if(_portType==INPUTPORT)
+ port = node->getInputPort(_newName);
+ else
+ port = node->getInputDataStreamPort(_newName);
+ port->setName(_oldName);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(port));
+ SubjectDataPort *sport = GuiContext::getCurrent()->_mapOfSubjectDataPort[port];
+ sport->update(RENAME, 0, sport);
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandRenameInDataPort::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ node = 0;
+ }
+ return (node != 0);
}
// ----------------------------------------------------------------------------
CommandRenameOutDataPort::CommandRenameOutDataPort(std::string position,
std::string oldName,
- std::string newName)
- : Command(), _position(position), _oldName(oldName), _newName(newName)
+ std::string newName, TypeOfElem portType)
+ : Command(), _position(position), _oldName(oldName), _newName(newName), _portType(portType)
{
DEBTRACE("CommandRenameOutDataPort::CommandRenameOutDataPort "
<< _position << " " << _oldName<< " " << _newName);
}
+std::string CommandRenameOutDataPort::dump()
+{
+ string ret ="CommandRenameOutDataPort " + _position + " " + _oldName + " " + _newName;
+ return ret;
+}
+
bool CommandRenameOutDataPort::localExecute()
{
+ DEBTRACE("CommandRenameOutDataPort::localExecute");
Proc* proc = GuiContext::getCurrent()->getProc();
Node* node = proc;
try
OutPort * port = 0;
try
{
- port = node->getOutPort(_newName);
+ if(_portType==OUTPUTPORT)
+ port = node->getOutputPort(_newName);
+ else
+ port = node->getOutputDataStreamPort(_newName);
}
catch (Exception& e) {} // --- raised when no existing port with _newName
if (port)
- return false; // --- there is already a port with the new name
+ throw Exception("there is already a port with the new name");
- port = node->getOutPort(_oldName);
+ if(_portType==OUTPUTPORT)
+ port = node->getOutputPort(_oldName);
+ else
+ port = node->getOutputDataStreamPort(_oldName);
port->setName(_newName);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(port));
+ SubjectDataPort *sport = GuiContext::getCurrent()->_mapOfSubjectDataPort[port];
+ sport->update(RENAME, 0, sport);
}
catch (Exception& ex)
{
DEBTRACE("CommandRenameOutDataPort::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
node = 0;
}
return (node != 0);
bool CommandRenameOutDataPort::localReverse()
{
+ DEBTRACE("CommandRenameOutDataPort::localReverse");
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node = proc;
+ try
+ {
+ if (_position != proc->getName()) node = proc->getChildByName(_position);
+ OutPort * port = 0;
+ try
+ {
+ if(_portType==OUTPUTPORT)
+ port = node->getOutputPort(_oldName);
+ else
+ port = node->getOutputDataStreamPort(_oldName);
+ }
+ catch (Exception& e) {} // --- raised when no existing port with _newName
+ if (port)
+ throw Exception("there is already a port with the old name");
+
+ if(_portType==OUTPUTPORT)
+ port = node->getOutputPort(_newName);
+ else
+ port = node->getOutputDataStreamPort(_newName);
+ port->setName(_oldName);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(port));
+ SubjectDataPort *sport = GuiContext::getCurrent()->_mapOfSubjectDataPort[port];
+ sport->update(RENAME, 0, sport);
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandRenameOutDataPort::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ node = 0;
+ }
+ return (node != 0);
}
// ----------------------------------------------------------------------------
DEBTRACE("CommandAddDataTypeFromCatalog::CommandAddDataTypeFromCatalog: " << typeName);
}
+std::string CommandAddDataTypeFromCatalog::dump()
+{
+ string ret ="CommandAddDataTypeFromCatalog " + _typeName;
+ return ret;
+}
+
YACS::ENGINE::TypeCode *CommandAddDataTypeFromCatalog::getTypeCode()
{
bool CommandAddDataTypeFromCatalog::localExecute()
{
+ DEBTRACE("CommandAddDataTypeFromCatalog::localExecute");
Proc* proc = GuiContext::getCurrent()->getProc();
if (proc->typeMap.count(_typeName))
{
DEBTRACE("typecode already existing in proc: " << _typeName);
- //GuiContext::getCurrent()->_lastErrorMessage = "typecode already existing in proc: " + _typeName;
- //return false;
- return true;
+ GuiContext::getCurrent()->_lastErrorMessage = "typeCode already existing in proc: " + _typeName;
+ return false;
}
else
if (_catalog->_typeMap.count(_typeName))
{
DEBTRACE("typecode found in catalog, cloned: " << _typeName);
proc->typeMap[_typeName] = _catalog->_typeMap[_typeName]->clone();
- return true;
+ proc->typeMap[_typeName]->incrRef();
+ SubjectProc *sproc = GuiContext::getCurrent()->getSubjectProc();
+ SubjectDataType *son = sproc->addSubjectDataType(getTypeCode(), _typeName);
+ return (son!=0);
}
GuiContext::getCurrent()->_lastErrorMessage = "typecode not found in catalog: " + _typeName;
return false;
bool CommandAddDataTypeFromCatalog::localReverse()
{
+ DEBTRACE("CommandAddDataTypeFromCatalog::localReverse");
+ try
+ {
+ SubjectProc *sproc = GuiContext::getCurrent()->getSubjectProc();
+ sproc->removeSubjectDataType(_typeName);
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandAddDataTypeFromCatalog::localReverse(): " << ex.what());
+ setErrorMsg(ex);
+ return 0;
+ }
}
: Command(), _catalog(catalog), _typePort(type), _node(node), _name(name)
{
_inputPort = 0;
+ _sip = 0;
+}
+
+std::string CommandAddInputPortFromCatalog::dump()
+{
+ string ret ="CommandAddInputPortFromCatalog " + _typePort + " " + _node + " " + _name;
+ return ret;
}
YACS::ENGINE::InputPort *CommandAddInputPortFromCatalog::getInputPort()
{
return _inputPort;
}
+
+SubjectInputPort* CommandAddInputPortFromCatalog::getSubjectInputPort()
+{
+ return _sip;
+}
bool CommandAddInputPortFromCatalog::localExecute()
{
ElementaryNode* father = dynamic_cast<ElementaryNode*>(node);
if (father)
{
- if (_catalog->_typeMap.count(_typePort))
+ //try proc types and then catalog if not in proc
+ if(proc->typeMap.count(_typePort))
+ son = father->edAddInputPort(_name, proc->typeMap[_typePort]);
+ else if (_catalog->_typeMap.count(_typePort))
son = father->edAddInputPort(_name, _catalog->_typeMap[_typePort]);
else
{
}
}
_inputPort = son;
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ _sip = snode->addSubjectInputPort(son, _name);
+ snode->update(SYNCHRO,0,0); // when output port tab in node edition is visible
}
catch (Exception& ex)
{
DEBTRACE("CommandAddInputPortFromCatalog::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
if (son) delete son;
_inputPort = 0;
}
bool CommandAddInputPortFromCatalog::localReverse()
{
-}
-
-// ----------------------------------------------------------------------------
-
-CommandAddOutputPortFromCatalog::CommandAddOutputPortFromCatalog(YACS::ENGINE::Catalog *catalog,
- std::string type,
- std::string node,
- std::string name)
+ DEBTRACE("CommandAddInputPortFromCatalog::localReverse");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node *node = proc->getChildByName(_node);
+ ElementaryNode* enode = dynamic_cast<ElementaryNode*>(node);
+ YASSERT(enode);
+ _inputPort = enode->getInputPort(_name);
+ YASSERT(_inputPort);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(_inputPort));
+ _sip = dynamic_cast<SubjectInputPort*>(GuiContext::getCurrent()->_mapOfSubjectDataPort[_inputPort]);
+ YASSERT(_sip);
+
+ Subject *father=_sip->getParent();
+ Subject::erase(_sip);
+ _sip = 0;
+ _inputPort = 0;
+ if (father)
+ {
+ DEBTRACE("REMOVE");
+ father->select(true);
+ father->update(REMOVE,0,0);
+ }
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandAddInputPortFromCatalog::localReverse(): " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+CommandAddOutputPortFromCatalog::CommandAddOutputPortFromCatalog(YACS::ENGINE::Catalog *catalog,
+ std::string type,
+ std::string node,
+ std::string name)
: Command(), _catalog(catalog), _typePort(type), _node(node), _name(name)
{
_outputPort = 0;
+ _sop = 0;
+}
+
+std::string CommandAddOutputPortFromCatalog::dump()
+{
+ string ret ="CommandAddOutputPortFromCatalog " + _typePort + " " + _node + " " + _name;
+ return ret;
}
YACS::ENGINE::OutputPort *CommandAddOutputPortFromCatalog::getOutputPort()
return _outputPort;
}
+SubjectOutputPort* CommandAddOutputPortFromCatalog::getSubjectOutputPort()
+{
+ return _sop;
+}
+
bool CommandAddOutputPortFromCatalog::localExecute()
{
DEBTRACE("CommandAddOutputPortFromCatalog::localExecute");
ElementaryNode* father =dynamic_cast<ElementaryNode*> (node);
if (father)
{
- if (_catalog->_typeMap.count(_typePort))
+ //try proc types and then catalog if not in proc
+ if(proc->typeMap.count(_typePort))
+ son = father->edAddOutputPort(_name, proc->typeMap[_typePort]);
+ else if (_catalog->_typeMap.count(_typePort))
son = father->edAddOutputPort(_name, _catalog->_typeMap[_typePort]);
else
{
}
}
_outputPort = son;
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ _sop = snode->addSubjectOutputPort(son, _name);
+ snode->update(SYNCHRO,0,0); // when input port tab in node edition is visible
}
catch (Exception& ex)
{
DEBTRACE("CommandAddOutputPortFromCatalog::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
if (son) delete son;
_outputPort = 0;
}
bool CommandAddOutputPortFromCatalog::localReverse()
{
+ DEBTRACE("CommandAddOutputPortFromCatalog::localReverse");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node *node = proc->getChildByName(_node);
+ ElementaryNode* enode = dynamic_cast<ElementaryNode*>(node);
+ YASSERT(enode);
+ _outputPort = enode->getOutputPort(_name);
+ YASSERT(_outputPort);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(_outputPort));
+ _sop = dynamic_cast<SubjectOutputPort*>(GuiContext::getCurrent()->_mapOfSubjectDataPort[_outputPort]);
+ YASSERT(_sop);
+
+ Subject *father=_sop->getParent();
+ Subject::erase(_sop);
+ _sop = 0;
+ _outputPort = 0;
+ if (father)
+ {
+ DEBTRACE("REMOVE");
+ father->select(true);
+ father->update(REMOVE,0,0);
+ }
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandAddOutputPortFromCatalog::localReverse(): " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
}
// ----------------------------------------------------------------------------
: Command(), _catalog(catalog), _typePort(type), _node(node), _name(name)
{
_IDSPort = 0;
+ _sip = 0;
+}
+
+std::string CommandAddIDSPortFromCatalog::dump()
+{
+ string ret ="CommandAddIDSPortFromCatalog " + _typePort + " " + _node + " " + _name;
+ return ret;
}
YACS::ENGINE::InputDataStreamPort *CommandAddIDSPortFromCatalog::getIDSPort()
{
+ DEBTRACE("CommandAddIDSPortFromCatalog");
return _IDSPort;
}
+SubjectInputDataStreamPort* CommandAddIDSPortFromCatalog::getSubjectIDSPort()
+{
+ return _sip;
+}
+
bool CommandAddIDSPortFromCatalog::localExecute()
{
+ DEBTRACE("CommandAddIDSPortFromCatalog::localExecute");
InputDataStreamPort *son = 0;
try
{
}
}
_IDSPort = son;
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ _sip = snode->addSubjectIDSPort(son, _name);
}
catch (Exception& ex)
{
DEBTRACE("CommandAddIDSPortFromCatalog::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
if (son) delete son;
_IDSPort = 0;
}
bool CommandAddIDSPortFromCatalog::localReverse()
{
+ DEBTRACE("CommandAddIDSPortFromCatalog::localReverse");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node *node = proc->getChildByName(_node);
+ ElementaryNode* enode = dynamic_cast<ElementaryNode*>(node);
+ YASSERT(enode);
+ _IDSPort = enode->getInputDataStreamPort(_name);
+ YASSERT(_IDSPort);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(_IDSPort));
+ _sip = dynamic_cast<SubjectInputDataStreamPort*>(GuiContext::getCurrent()->_mapOfSubjectDataPort[_IDSPort]);
+ YASSERT(_sip);
+
+ Subject *father=_sip->getParent();
+ Subject::erase(_sip);
+ _IDSPort =0;
+ _sip = 0;
+ if (father)
+ {
+ DEBTRACE("REMOVE");
+ father->select(true);
+ father->update(REMOVE,0,0);
+ }
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandAddIDSPortFromCatalog::localReverse(): " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
}
// ----------------------------------------------------------------------------
std::string name)
: Command(), _catalog(catalog), _typePort(type), _node(node), _name(name)
{
+ DEBTRACE("CommandAddODSPortFromCatalog");
_ODSPort = 0;
+ _sop = 0;
+}
+
+std::string CommandAddODSPortFromCatalog::dump()
+{
+ string ret ="CommandAddODSPortFromCatalog " + _typePort + " " + _node + " " + _name;
+ return ret;
}
YACS::ENGINE::OutputDataStreamPort *CommandAddODSPortFromCatalog::getODSPort()
return _ODSPort;
}
+SubjectOutputDataStreamPort* CommandAddODSPortFromCatalog::getSubjectODSPort()
+{
+ return _sop;
+}
+
bool CommandAddODSPortFromCatalog::localExecute()
{
+ DEBTRACE("CommandAddODSPortFromCatalog::localExecute");
OutputDataStreamPort *son = 0;
try
{
}
}
_ODSPort = son;
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ _sop = snode->addSubjectODSPort(son, _name);
}
catch (Exception& ex)
{
DEBTRACE("CommandAddODSPortFromCatalog::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
if (son) delete son;
_ODSPort = 0;
}
bool CommandAddODSPortFromCatalog::localReverse()
{
+ DEBTRACE("CommandAddODSPortFromCatalog::localReverse");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node *node = proc->getChildByName(_node);
+ ElementaryNode* enode = dynamic_cast<ElementaryNode*>(node);
+ YASSERT(enode);
+ _ODSPort = enode->getOutputDataStreamPort(_name);
+ YASSERT(_ODSPort);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(_ODSPort));
+ _sop = dynamic_cast<SubjectOutputDataStreamPort*>(GuiContext::getCurrent()->_mapOfSubjectDataPort[_ODSPort]);
+ YASSERT(_sop);
+
+ Subject *father=_sop->getParent();
+ Subject::erase(_sop);
+ _sop = 0;
+ _ODSPort = 0;
+ if (father)
+ {
+ DEBTRACE("REMOVE");
+ father->select(true);
+ father->update(REMOVE,0,0);
+ }
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandAddODSPortFromCatalog::localReverse(): " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
}
// ----------------------------------------------------------------------------
int isUp)
: Command(), _node(node), _port(port), _isUp(isUp), _rank(-1)
{
+ DEBTRACE("CommandOrderInputPorts");
+}
+
+std::string CommandOrderInputPorts::dump()
+{
+ ostringstream s;
+ s << _isUp;
+ string ret ="CommandOrderInputPorts " + _node + " " + _port + " " + s.str();
+ return ret;
}
bool CommandOrderInputPorts::localExecute()
list<InputPort*> plist = father->getSetOfInputPort();
list<InputPort*>::iterator pos = find(plist.begin(), plist.end(), portToMove);
- if (_isUp)
+ int isUp = _isUp;
+ if (isUp)
{
if(pos == plist.begin())
pos=plist.end(); // --- cycle
else
- do { pos--; _isUp--; } while (_isUp);
+ do { pos--; isUp--; } while (isUp);
}
else
{
plist.push_back(portToMove);
}
father->edOrderInputPorts(plist);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ SubjectDataPort *sport = GuiContext::getCurrent()->_mapOfSubjectDataPort[portToMove];
+ snode->update(ORDER, true, sport);
+ snode->update(SYNCHRO, true, sport); // --- synchronise edition and scene
}
catch (Exception& ex)
{
DEBTRACE("CommandOrderInputPorts::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
father = 0;
}
return (father != 0);
bool CommandOrderInputPorts::localReverse()
{
+ DEBTRACE("CommandOrderInputPorts::localReverse " << _node << " " << _port << " " << _isUp);
+ ElementaryNode* father = 0;
+ try
+ {
+ int isUpRev = -_isUp;
+ if (isUpRev == 0) isUpRev =1;
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node = proc->getChildByName(_node);
+ father = dynamic_cast<ElementaryNode*> (node);
+ if (!father) return false;
+ InputPort *portToMove = father->getInputPort(_port);
+ DEBTRACE(portToMove->getName());
+
+ list<InputPort*> plist = father->getSetOfInputPort();
+ list<InputPort*>::iterator pos = find(plist.begin(), plist.end(), portToMove);
+
+ if (isUpRev>0)
+ {
+ if(pos == plist.begin())
+ pos=plist.end(); // --- cycle
+ else
+ do { pos--; isUpRev--; } while (isUpRev);
+ }
+ else
+ {
+ pos++;
+ if (pos == plist.end())
+ pos = plist.begin(); // --- cycle
+ else
+ do { pos++; isUpRev++; } while (isUpRev<0);// --- insert before the 2nd next port
+ }
+
+ InputPort *portBefore = 0;
+ if (pos != plist.end())
+ portBefore = (*pos);
+
+ plist.remove(portToMove);
+ if (portBefore)
+ {
+ DEBTRACE(portBefore->getName());
+ pos = find(plist.begin(), plist.end(), portBefore);
+ _rank = 0;
+ for (list<InputPort*>::iterator it = plist.begin(); it != pos; ++it)
+ _rank++;
+ plist.insert(pos, portToMove);
+ }
+ else
+ {
+ _rank = plist.size();
+ plist.push_back(portToMove);
+ }
+ father->edOrderInputPorts(plist);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ SubjectDataPort *sport = GuiContext::getCurrent()->_mapOfSubjectDataPort[portToMove];
+ snode->update(ORDER, true, sport);
+ snode->update(SYNCHRO, true, sport); // --- synchronise edition and scene
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandOrderInputPorts::localExecute() : " << ex.what());
+ setErrorMsg(ex);
+ father = 0;
+ }
+ return (father != 0);
}
// ----------------------------------------------------------------------------
int isUp)
: Command(), _node(node), _port(port), _isUp(isUp), _rank(-1)
{
+ DEBTRACE("CommandOrderOutputPorts");
+}
+
+std::string CommandOrderOutputPorts::dump()
+{
+ ostringstream s;
+ s << _isUp;
+ string ret ="CommandOrderOutputPorts " + _node + " " + _port + " " + s.str();
+ return ret;
}
bool CommandOrderOutputPorts::localExecute()
list<OutputPort*> plist = father->getSetOfOutputPort();
list<OutputPort*>::iterator pos = find(plist.begin(), plist.end(), portToMove);
- if (_isUp)
+ int isUp = _isUp;
+ if (isUp)
{
if(pos == plist.begin())
pos=plist.end(); // --- cycle
else
- do { pos--; _isUp--; } while (_isUp);
+ do { pos--; isUp--; } while (isUp);
}
else
{
plist.push_back(portToMove);
}
father->edOrderOutputPorts(plist);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ SubjectDataPort *sport = GuiContext::getCurrent()->_mapOfSubjectDataPort[portToMove];
+ snode->update(ORDER, false, sport);
+ snode->update(SYNCHRO, false, sport); // --- synchronise edition and scene
}
catch (Exception& ex)
{
DEBTRACE("CommandOrderOutputPorts::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
father = 0;
}
return (father != 0);
bool CommandOrderOutputPorts::localReverse()
{
+ DEBTRACE("CommandOrderOutputPorts::localReverse " << _node << " " << _port << " " << _isUp);
+ ElementaryNode* father = 0;
+ try
+ {
+ int isUpRev = -_isUp;
+ if (isUpRev == 0) isUpRev =1;
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node = proc->getChildByName(_node);
+ father = dynamic_cast<ElementaryNode*> (node);
+ if (!father) return false;
+ OutputPort *portToMove = father->getOutputPort(_port);
+ DEBTRACE(portToMove->getName());
+
+ list<OutputPort*> plist = father->getSetOfOutputPort();
+ list<OutputPort*>::iterator pos = find(plist.begin(), plist.end(), portToMove);
+
+ if (isUpRev>0)
+ {
+ if(pos == plist.begin())
+ pos=plist.end(); // --- cycle
+ else
+ do { pos--; isUpRev--; } while (isUpRev);
+ }
+ else
+ {
+ pos++;
+ if (pos == plist.end())
+ pos = plist.begin(); // --- cycle
+ else
+ do { pos++; isUpRev++; } while (isUpRev<0);// --- insert before the 2nd next port
+ }
+
+ OutputPort *portBefore = 0;
+ if (pos != plist.end())
+ portBefore = (*pos);
+
+ plist.remove(portToMove);
+ if (portBefore)
+ {
+ DEBTRACE(portBefore->getName());
+ pos = find(plist.begin(), plist.end(), portBefore);
+ _rank = 0;
+ for (list<OutputPort*>::iterator it = plist.begin(); it != pos; ++it)
+ _rank++;
+ plist.insert(pos, portToMove);
+ }
+ else
+ {
+ _rank = plist.size();
+ plist.push_back(portToMove);
+ }
+ father->edOrderOutputPorts(plist);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ SubjectDataPort *sport = GuiContext::getCurrent()->_mapOfSubjectDataPort[portToMove];
+ snode->update(ORDER, false, sport);
+ snode->update(SYNCHRO, false, sport); // --- synchronise edition and scene
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandOrderOutputPorts::localExecute() : " << ex.what());
+ setErrorMsg(ex);
+ father = 0;
+ }
+ return (father != 0);
}
// ----------------------------------------------------------------------------
-CommandDestroy::CommandDestroy(std::string position, Subject* subject)
- : Command(), _position(position), _subject(subject)
+CommandDestroy::CommandDestroy(TypeOfElem elemType,
+ std::string startnode, std::string startport, TypeOfElem startportType,
+ std::string endnode, std::string endport, TypeOfElem endportType)
+ : Command(), _elemType(elemType), _startnode(startnode), _startport(startport),
+ _endnode(endnode), _endport(endport), _startportType(startportType), _endportType(endportType)
{
DEBTRACE("CommandDestroy::CommandDestroy");
- //todo: store what is needed to recreate the subject
+ _normalReverse = false;
+}
+
+std::string CommandDestroy::dump()
+{
+ string ret ="CommandDestroy " + ProcInvoc::getTypeName(_elemType);
+ ret += " " + _startnode + " " + _startport;
+ ret += " " + _endnode + " " + _endport;
+ return ret;
}
bool CommandDestroy::localExecute()
DEBTRACE("CommandDestroy::localExecute");
try
{
-// Subject* parent=_subject->getParent();
-// if(parent && _subject->getType() != UNKNOWN) parent->update(REMOVE,_subject->getType(),_subject);
-
- Subject::erase(_subject);
-
-// if(parent)
-// parent->update(REMOVE,0,0);
-
- _subject = 0;
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Subject *subject = 0;
+ Subject *father = 0;
+ switch (_elemType)
+ {
+ case SALOMEPROC:
+ case BLOC:
+ case FOREACHLOOP:
+ case OPTIMIZERLOOP:
+ case FORLOOP:
+ case WHILELOOP:
+ case SWITCH:
+ case PYTHONNODE:
+ case PYFUNCNODE:
+ case CORBANODE:
+ case SALOMENODE:
+ case CPPNODE:
+ case SALOMEPYTHONNODE:
+ case XMLNODE:
+ case SPLITTERNODE:
+ case DFTODSFORLOOPNODE:
+ case DSTODFFORLOOPNODE:
+ case PRESETNODE:
+ case OUTNODE:
+ case STUDYINNODE:
+ case STUDYOUTNODE:
+ {
+ Node* node = proc;
+ if (!_startnode.empty()) node = proc->getChildByName(_startnode);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
+ subject = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ father = subject->getParent();
+ }
+ break;
+ case INPUTPORT:
+ {
+ Node* node = proc->getChildByName(_startnode);
+ InPort* inp = node->getInputPort(_startport);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(inp));
+ subject = GuiContext::getCurrent()->_mapOfSubjectDataPort[inp];
+ father = subject->getParent();
+ }
+ break;
+ case INPUTDATASTREAMPORT:
+ {
+ Node* node = proc->getChildByName(_startnode);
+ InPort* inp = node->getInputDataStreamPort(_startport);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(inp));
+ subject = GuiContext::getCurrent()->_mapOfSubjectDataPort[inp];
+ father = subject->getParent();
+ }
+ break;
+ case OUTPUTPORT:
+ {
+ Node* node = proc->getChildByName(_startnode);
+ OutPort* outp = node->getOutputPort(_startport);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(outp));
+ subject = GuiContext::getCurrent()->_mapOfSubjectDataPort[outp];
+ father = subject->getParent();
+ }
+ break;
+ case OUTPUTDATASTREAMPORT:
+ {
+ Node* node = proc->getChildByName(_startnode);
+ OutPort* outp = node->getOutputDataStreamPort(_startport);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(outp));
+ subject = GuiContext::getCurrent()->_mapOfSubjectDataPort[outp];
+ father = subject->getParent();
+ }
+ break;
+ case DATALINK:
+ {
+ Node* outn = proc->getChildByName(_startnode);
+ Node* inn = proc->getChildByName(_endnode);
+
+ OutPort* outp;
+ InPort* inp;
+
+ if(_startportType == OUTPUTPORT)
+ outp = outn->getOutputPort(_startport);
+ else
+ outp = outn->getOutputDataStreamPort(_startport);
+
+ if(_endportType == INPUTPORT)
+ inp = inn->getInputPort(_endport);
+ else
+ inp = inn->getInputDataStreamPort(_endport);
+
+ pair<OutPort*,InPort*> keymap = pair<OutPort*,InPort*>(outp,inp);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectLink.count(keymap));
+ subject = GuiContext::getCurrent()->_mapOfSubjectLink[keymap];
+ father = subject->getParent();
+ }
+ break;
+ case CONTROLLINK:
+ {
+ Node* outn = proc->getChildByName(_startnode);
+ Node* inn = proc->getChildByName(_endnode);
+ pair<Node*,Node*> keymap = pair<Node*,Node*>(outn,inn);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectControlLink.count(keymap));
+ subject = GuiContext::getCurrent()->_mapOfSubjectControlLink[keymap];
+ father = subject->getParent();
+ }
+ break;
+ case CONTAINER:
+ {
+ Container *container = proc->containerMap[_startnode];
+ subject = GuiContext::getCurrent()->_mapOfSubjectContainer[container];
+ break;
+ }
+ case COMPONENT:
+ case REFERENCE:
+ case DATATYPE:
+ case UNKNOWN:
+ throw Exception("Command Destroy not implemented for that type");
+ break;
+ }
+ YASSERT(subject);
+ Subject::erase(subject);
+ if (father)
+ {
+ father->select(true);
+ father->update(REMOVE, 0, 0);
+ }
+ subject = 0;
return true;
}
catch (Exception& ex)
{
DEBTRACE("CommandDestroy::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
return false;
}
}
bool CommandDestroy::localReverse()
{
+ DEBTRACE("CommandDestroy::localReverse");
+ //! nothing to do here, all is done in subcommands
+ return true;
}
// ----------------------------------------------------------------------------
: Command(), _node(node), _port(port), _value(value)
{
DEBTRACE("CommandSetInPortValue::CommandSetInPortValue " << node << " " << port << " " << value);
+ _oldValue = "";
+}
+
+std::string CommandSetInPortValue::dump()
+{
+ string ret ="CommandSetInPortValue " + _node + " " + _port + " " + _value;
+ return ret;
}
bool CommandSetInPortValue::localExecute()
{
- PyObject *result;
+ DEBTRACE("CommandSetInPortValue::localExecute");
+ InputPort* inp ;
+ InputPresetPort *inpp = 0;
+ InputStudyPort *insp = 0;
+ DataNode *dnode = 0;
+ SubjectDataPort *sinp = 0;
try
{
Proc* proc = GuiContext::getCurrent()->getProc();
Node* node = proc->getChildByName(_node);
- InputPort* inp = node->getInputPort(_port);
- result = YACS::ENGINE::getSALOMERuntime()->convertStringToPyObject(_value.c_str());
+ inp = node->getInputPort(_port);
+ inpp = dynamic_cast<InputPresetPort*>(inp);
+ insp = dynamic_cast<InputStudyPort*>(inp);
+ dnode = dynamic_cast<DataNode*>(node);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(inp));
+ sinp = GuiContext::getCurrent()->_mapOfSubjectDataPort[inp];
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetInPortValue::localExecute() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+
+ if(insp && dnode)
+ {
+ //It's a study port
+ _oldValue = insp->getAsString();
+ DEBTRACE("old value="<< _oldValue);
+ dnode->setData(insp, _value );
+ sinp->update(SETVALUE, 0, sinp);
+ return true;
+ }
+
+ PyObject *result;
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ try
+ {
+ _oldValue = inp->getAsString();
+ if (_oldValue == "None") _oldValue = "";
+ DEBTRACE("old value="<< _oldValue);
+ std::string strval;
+ if (inp->edGetType()->kind() == YACS::ENGINE::String || inp->edGetType()->isA(Runtime::_tc_file))
+ strval = "\"" + _value + "\"";
+ else
+ strval = _value;
+ result = YACS::ENGINE::getSALOMERuntime()->convertStringToPyObject(strval.c_str());
inp->edInit("Python", result);
Py_DECREF(result);
+
+ PyGILState_Release(gstate);
+ sinp->update(SETVALUE, 0, sinp);
return true;
}
catch (Exception& ex)
{
DEBTRACE("CommandSetInPortValue::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
//Py_DECREF(result);
+ PyGILState_Release(gstate);
+ setErrorMsg(ex);
return false;
}
}
bool CommandSetInPortValue::localReverse()
{
-}
-
-// ----------------------------------------------------------------------------
-
-CommandSetOutPortValue::CommandSetOutPortValue(std::string node,
- std::string port,
- std::string value)
- : Command(), _node(node), _port(port), _value(value)
-{
- DEBTRACE("CommandSetOutPortValue::CommandSetOutPortValue " << node << " " << port << " " << value);
-}
-
-bool CommandSetOutPortValue::localExecute()
-{
- OutputPresetPort *outpp = 0;
+ DEBTRACE("CommandSetInPortValue::localReverse");
+ InputPort* inp ;
+ InputPresetPort *inpp = 0;
+ InputStudyPort *insp = 0;
DataNode *dnode = 0;
+ SubjectDataPort *sinp = 0;
try
{
Proc* proc = GuiContext::getCurrent()->getProc();
Node* node = proc->getChildByName(_node);
- OutputPort* outp = node->getOutputPort(_port);
- outpp = dynamic_cast<OutputPresetPort*>(outp);
+ inp = node->getInputPort(_port);
+ inpp = dynamic_cast<InputPresetPort*>(inp);
+ insp = dynamic_cast<InputStudyPort*>(inp);
dnode = dynamic_cast<DataNode*>(node);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(inp));
+ sinp = GuiContext::getCurrent()->_mapOfSubjectDataPort[inp];
}
catch (Exception& ex)
{
- DEBTRACE("CommandSetOutPortValue::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ DEBTRACE("CommandSetInPortValue::localExecute() : " << ex.what());
+ setErrorMsg(ex);
return false;
}
- if (!outpp)
+ if(insp && dnode)
{
- DEBTRACE("Set value on output port only possible on a presetPort");
- GuiContext::getCurrent()->_lastErrorMessage = "Set value on output port only possible on a presetPort";
- return false;
+ //It's a study port
+ _value = insp->getAsString();
+ DEBTRACE("value="<< _value);
+ DEBTRACE("old value="<< _oldValue);
+ dnode->setData(insp, _oldValue );
+ sinp->update(SETVALUE, 0, sinp);
+ return true;
}
- if (!dnode)
+ PyObject *result = Py_None;
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ try
{
- DEBTRACE("Set value on output port only possible on a dataNode");
- GuiContext::getCurrent()->_lastErrorMessage = "Set value on output port only possible on a dataNode";
- return false;
- }
-
+ _value = inp->getAsString();
+ DEBTRACE("value="<< _value);
+ DEBTRACE("old value="<< _oldValue);
+ if (!_oldValue.empty())
+ {
+ std::string strval;
+ if (inp->edGetType()->kind() == YACS::ENGINE::String || inp->edGetType()->isA(Runtime::_tc_file))
+ strval = "\"" + _oldValue + "\"";
+ else
+ strval = _oldValue;
+ result = YACS::ENGINE::getSALOMERuntime()->convertStringToPyObject(strval.c_str());
+ }
+ inp->edInit("Python", result);
+ Py_DECREF(result);
+ PyGILState_Release(gstate);
+ sinp->update(SETVALUE, 0, sinp);
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetInPortValue::localExecute() : " << ex.what());
+ //Py_DECREF(result);
+ PyGILState_Release(gstate);
+ setErrorMsg(ex);
+ return false;
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+CommandSetOutPortValue::CommandSetOutPortValue(std::string node,
+ std::string port,
+ std::string value)
+ : Command(), _node(node), _port(port), _value(value)
+{
+ DEBTRACE("CommandSetOutPortValue::CommandSetOutPortValue " << node << " " << port << " " << value);
+ _oldValue = "";
+}
+
+std::string CommandSetOutPortValue::dump()
+{
+ string ret ="CommandSetOutPortValue " + _node + " " + _port + " " + _value;
+ return ret;
+}
+
+bool CommandSetOutPortValue::localExecute()
+{
+ DEBTRACE("CommandSetOutPortValue::localExecute");
+ OutputPresetPort *outpp = 0;
+ OutputStudyPort *outsp = 0;
+ DataNode *dnode = 0;
+ SubjectDataPort *soutp = 0;
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node = proc->getChildByName(_node);
+ OutputPort* outp = node->getOutputPort(_port);
+ outpp = dynamic_cast<OutputPresetPort*>(outp);
+ outsp = dynamic_cast<OutputStudyPort*>(outp);
+ dnode = dynamic_cast<DataNode*>(node);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(outp));
+ soutp = GuiContext::getCurrent()->_mapOfSubjectDataPort[outp];
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetOutPortValue::localExecute() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+
+ if (!outpp && !outsp)
+ {
+ DEBTRACE("Set value on output port only possible on a presetPort or a studyPort");
+ GuiContext::getCurrent()->_lastErrorMessage = "Set value on output port only possible on a presetPort or a studyPort";
+ return false;
+ }
+
+ if (!dnode)
+ {
+ DEBTRACE("Set value on output port only possible on a dataNode");
+ GuiContext::getCurrent()->_lastErrorMessage = "Set value on output port only possible on a dataNode";
+ return false;
+ }
+
+ if(outsp)
+ {
+ //It's a study port
+ _oldValue = outsp->getAsString();
+ DEBTRACE("old value="<< _oldValue);
+ dnode->setData(outsp, _value );
+ soutp->update(SETVALUE, 0, soutp);
+ return true;
+ }
+
PyObject *result;
try
{
- result = YACS::ENGINE::getSALOMERuntime()->convertStringToPyObject(_value.c_str());
+ _oldValue = outpp->getAsString();
+ if (_oldValue == "None") _oldValue = "";
+ DEBTRACE("old value="<< _oldValue);
+ std::string strval;
+ if (outpp->edGetType()->kind() == YACS::ENGINE::String || outpp->edGetType()->isA(Runtime::_tc_file))
+ strval = "\"" + _value + "\"";
+ else
+ strval = _value;
+ result = YACS::ENGINE::getSALOMERuntime()->convertStringToPyObject(strval.c_str());
}
catch (Exception& ex)
{
- DEBTRACE("CommandSetInPortValue::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
- //Py_DECREF(result);
+ DEBTRACE("CommandSetOutPortValue::localExecute() : " << ex.what());
+ setErrorMsg(ex);
return false;
}
val = convertPyObjectXml(outpp->edGetType(), result);
DEBTRACE(val);
dnode->setData(outpp, val );
+ soutp->update(SETVALUE, 0, soutp);
}
catch (Exception& ex)
{
- PyGILState_Release(gstate);
DEBTRACE("CommandSetOutPortValue::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
- PyGILState_Release(gstate);
+ setErrorMsg(ex);
Py_DECREF(result);
+ PyGILState_Release(gstate);
return false;
}
bool CommandSetOutPortValue::localReverse()
{
+ DEBTRACE("CommandSetOutPortValue::localReverse");
+ OutputPresetPort *outpp = 0;
+ OutputStudyPort *outsp = 0;
+ DataNode *dnode = 0;
+ SubjectDataPort *soutp = 0;
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node = proc->getChildByName(_node);
+ OutputPort* outp = node->getOutputPort(_port);
+ outpp = dynamic_cast<OutputPresetPort*>(outp);
+ outsp = dynamic_cast<OutputStudyPort*>(outp);
+ dnode = dynamic_cast<DataNode*>(node);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(outp));
+ soutp = GuiContext::getCurrent()->_mapOfSubjectDataPort[outp];
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetOutPortValue::localExecute() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+
+ if (!outpp && !outsp)
+ {
+ DEBTRACE("Set value on output port only possible on a presetPort or a studyPort");
+ GuiContext::getCurrent()->_lastErrorMessage = "Set value on output port only possible on a presetPort or a studyPort";
+ return false;
+ }
+
+ if (!dnode)
+ {
+ DEBTRACE("Set value on output port only possible on a dataNode");
+ GuiContext::getCurrent()->_lastErrorMessage = "Set value on output port only possible on a dataNode";
+ return false;
+ }
+
+ if(outsp)
+ {
+ //It's a study port
+ _value = outsp->getAsString();
+ DEBTRACE("value="<< _value);
+ DEBTRACE("old value="<< _oldValue);
+ dnode->setData(outsp, _oldValue );
+ soutp->update(SETVALUE, 0, soutp);
+ return true;
+ }
+
+ PyObject *result = Py_None;
+ try
+ {
+ _value = outpp->getAsString();
+ DEBTRACE("value="<< _value);
+ DEBTRACE("old value="<< _oldValue);
+ if (!_oldValue.empty())
+ {
+ std::string strval;
+ if (outpp->edGetType()->kind() == YACS::ENGINE::String || outpp->edGetType()->isA(Runtime::_tc_file))
+ strval = "\"" + _value + "\"";
+ else
+ strval = _value;
+ result = YACS::ENGINE::getSALOMERuntime()->convertStringToPyObject(strval.c_str());
+ }
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetOutPortValue::localExecute() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+
+ string val;
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ try
+ {
+ DEBTRACE(PyObject_Str(result));
+ val = convertPyObjectXml(outpp->edGetType(), result);
+ DEBTRACE(val);
+ dnode->setData(outpp, val );
+ soutp->update(SETVALUE, 0, soutp);
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetOutPortValue::localExecute() : " << ex.what());
+ setErrorMsg(ex);
+ Py_DECREF(result);
+ PyGILState_Release(gstate);
+ return false;
+ }
+
+ Py_DECREF(result);
+ PyGILState_Release(gstate);
+ return true;
}
// ----------------------------------------------------------------------------
: Command(), _switch(aSwitch), _value(value)
{
DEBTRACE("CommandSetSwitchSelect::CommandSetSwitchSelect");
+ _oldValue = "0";
+}
+
+std::string CommandSetSwitchSelect::dump()
+{
+ string ret ="CommandSetSwitchSelect " + _switch + " " + _value;
+ return ret;
}
bool CommandSetSwitchSelect::localExecute()
{
+ DEBTRACE("CommandSetSwitchSelect::localExecute");
try
{
Proc* proc = GuiContext::getCurrent()->getProc();
Switch* aSwitch = dynamic_cast<Switch*>(proc->getChildByName(_switch));
InputPort *condPort = aSwitch->edGetConditionPort();
+ _oldValue = condPort->getAsString();
+ if (_oldValue == "None") _oldValue = "0";
int val = atoi(_value.c_str());
condPort->edInit(val);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(aSwitch));
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[aSwitch];
+ snode->update(SETSELECT, 0, snode);
}
catch (Exception& ex)
{
DEBTRACE("CommandSetSwitchSelect::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
return false;
}
}
bool CommandSetSwitchSelect::localReverse()
{
+ DEBTRACE("CommandSetSwitchSelect::localReverse");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Switch* aSwitch = dynamic_cast<Switch*>(proc->getChildByName(_switch));
+ InputPort *condPort = aSwitch->edGetConditionPort();
+ int val = atoi(_oldValue.c_str());
+ condPort->edInit(val);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(aSwitch));
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[aSwitch];
+ snode->update(SETSELECT, 0, snode);
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetSwitchSelect::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
}
// ----------------------------------------------------------------------------
: Command(), _switch(aSwitch), _node(node), _value(value)
{
DEBTRACE("CommandSetSwitchCase::CommandSetSwitchCase");
+ _oldValue = 0;
+ _oldNode = "";
+}
+
+std::string CommandSetSwitchCase::dump()
+{
+ string ret ="CommandSetSwitchCase " + _switch + " " + _node + " " + _value;
+ return ret;
}
bool CommandSetSwitchCase::localExecute()
{
+ DEBTRACE("CommandSetSwitchCase::localExecute");
try
{
+ DEBTRACE("CommandSetSwitchCase::localExecute");
Proc* proc = GuiContext::getCurrent()->getProc();
Switch* aSwitch = dynamic_cast<Switch*>(proc->getChildByName(_switch));
Node* node = proc->getChildByName(_node);
throw YACS::Exception("Set Switch Case impossible: value already used");
}
int oldVal = aSwitch->getRankOfNode(node);
- Node *aNode = aSwitch->edReleaseCase(oldVal);
- aNode = aSwitch->edSetNode(val, aNode);
+ aSwitch->edChangeCase(oldVal,val);
+ _oldValue = oldVal;
+ _oldNode = proc->getChildName(node);
DEBTRACE("CommandSetSwitchCase::localExecute OK " << val);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(aSwitch));
+ SubjectNode *ssw = GuiContext::getCurrent()->_mapOfSubjectNode[aSwitch];
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ ssw->update(SETCASE, val, snode);
+ snode->recursiveUpdate(RENAME, 0, snode);
return true;
}
catch (Exception& ex)
{
DEBTRACE("CommandSetSwitchCase::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
return false;
}
}
bool CommandSetSwitchCase::localReverse()
{
+ DEBTRACE("CommandSetSwitchCase::localReverse");
+ try
+ {
+ DEBTRACE("CommandSetSwitchCase::localReverse");
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Switch* aSwitch = dynamic_cast<Switch*>(proc->getChildByName(_switch));
+ Node* node = proc->getChildByName(_oldNode);
+ int val = _oldValue;
+ if (aSwitch->edGetNode(val))
+ {
+ throw YACS::Exception("Set Switch Case impossible: value already used");
+ }
+ int oldVal = aSwitch->getRankOfNode(node);
+ aSwitch->edChangeCase(oldVal,val);
+ DEBTRACE("CommandSetSwitchCase::localReverse OK " << val);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(aSwitch));
+ SubjectNode *ssw = GuiContext::getCurrent()->_mapOfSubjectNode[aSwitch];
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ ssw->update(SETCASE, val, snode);
+ snode->recursiveUpdate(RENAME, 0, snode);
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetSwitchCase::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
}
// ----------------------------------------------------------------------------
: Command(), _forLoop(forLoop), _value(value)
{
DEBTRACE("CommandSetForLoopSteps::CommandSetForLoopSteps");
+ _oldValue = 0;
}
+
+std::string CommandSetForLoopSteps::dump()
+{
+ string ret ="CommandSetForLoopSteps " + _forLoop + " " + _value;
+ return ret;
+}
bool CommandSetForLoopSteps::localExecute()
{
+ DEBTRACE("CommandSetForLoopSteps::localExecute");
try
{
+ DEBTRACE("CommandSetForLoopSteps::localExecute");
Proc* proc = GuiContext::getCurrent()->getProc();
ForLoop* forLoop = dynamic_cast<ForLoop*>(proc->getChildByName(_forLoop));
InputPort *nbSteps = forLoop->edGetNbOfTimesInputPort();
+ _oldValue = atoi(forLoop->edGetNbOfTimesInputPort()->getAsString().c_str());
int val = atoi(_value.c_str());
nbSteps->edInit(val);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(forLoop));
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[forLoop];
+ snode->update(SETVALUE, 0, snode);
return true;
}
catch (Exception& ex)
{
- DEBTRACE("CommandSetSwitchSelect::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ DEBTRACE("CommandSetForLoopSteps::localExecute() : " << ex.what());
+ setErrorMsg(ex);
return false;
}
}
bool CommandSetForLoopSteps::localReverse()
{
+ DEBTRACE("CommandSetForLoopSteps::localReverse");
+ try
+ {
+ DEBTRACE("CommandSetForLoopSteps::localReverse");
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ ForLoop* forLoop = dynamic_cast<ForLoop*>(proc->getChildByName(_forLoop));
+ InputPort *nbSteps = forLoop->edGetNbOfTimesInputPort();
+ nbSteps->edInit(_oldValue);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(forLoop));
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[forLoop];
+ snode->update(SETVALUE, 0, snode);
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetForLoopSteps::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
}
// ----------------------------------------------------------------------------
: Command(), _whileLoop(whileLoop), _value(value)
{
DEBTRACE("CommandSetWhileCondition::CommandSetWhileCondition");
+ _oldValue = 0;
+}
+
+std::string CommandSetWhileCondition::dump()
+{
+ string ret ="CommandSetWhileCondition " + _whileLoop + " " + _value;
+ return ret;
}
bool CommandSetWhileCondition::localExecute()
{
+ DEBTRACE("CommandSetWhileCondition::localExecute");
try
{
Proc* proc = GuiContext::getCurrent()->getProc();
WhileLoop* whileLoop = dynamic_cast<WhileLoop*>(proc->getChildByName(_whileLoop));
InputPort *cond = whileLoop->edGetConditionPort();
+ _oldValue = atoi(whileLoop->edGetConditionPort()->getAsString().c_str());
bool val = atoi(_value.c_str());
cond->edInit(val);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(whileLoop));
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[whileLoop];
+ snode->update(SETVALUE, 0, snode);
return true;
}
catch (Exception& ex)
{
- DEBTRACE("CommandSetSwitchSelect::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ DEBTRACE("CommandSetWhileCondition::localExecute() : " << ex.what());
+ setErrorMsg(ex);
return false;
}
}
bool CommandSetWhileCondition::localReverse()
{
+ DEBTRACE("CommandSetWhileCondition::localReverse");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ WhileLoop* whileLoop = dynamic_cast<WhileLoop*>(proc->getChildByName(_whileLoop));
+ InputPort *cond = whileLoop->edGetConditionPort();
+ cond->edInit(_oldValue);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(whileLoop));
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[whileLoop];
+ snode->update(SETVALUE, 0, snode);
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetWhileCondition::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
}
// ----------------------------------------------------------------------------
: Command(), _forEach(forEach), _value(value)
{
DEBTRACE("CommandSetForEachBranch::CommandSetForEachBranch");
+ _oldValue = 0;
}
-
+
+std::string CommandSetForEachBranch::dump()
+{
+ string ret ="CommandSetForEachBranch " + _forEach + " " + _value;
+ return ret;
+}
+
bool CommandSetForEachBranch::localExecute()
{
+ DEBTRACE("CommandSetForEachBranch::localExecute");
try
{
Proc* proc = GuiContext::getCurrent()->getProc();
- ForEachLoop* forEach = dynamic_cast<ForEachLoop*>(proc->getChildByName(_forEach));
- InputPort *nbBranches = forEach->getInputPort("nbBranches");
+ Node* node=proc->getChildByName(_forEach);
+ InputPort *nbBranches = node->getInputPort("nbBranches");
+ _oldValue = atoi(nbBranches->getAsString().c_str());
int val = atoi(_value.c_str());
nbBranches->edInit(val);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(nbBranches));
+ SubjectDataPort *spo = GuiContext::getCurrent()->_mapOfSubjectDataPort[static_cast<DataPort*>(nbBranches)];
+ spo->update(SETVALUE, 0, spo);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ snode->update(SETVALUE, 0, snode);
return true;
}
catch (Exception& ex)
{
- DEBTRACE("CommandSetSwitchSelect::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ DEBTRACE("CommandSetForEachBranch::localExecute() : " << ex.what());
+ setErrorMsg(ex);
return false;
}
}
bool CommandSetForEachBranch::localReverse()
{
-}
-
-// ----------------------------------------------------------------------------
-
-CommandAddLink::CommandAddLink(std::string outNode, std::string outPort,
- std::string inNode, std::string inPort,bool control)
- : Command(), _outNode(outNode), _outPort(outPort), _inNode(inNode), _inPort(inPort),_control(control)
-{
- DEBTRACE("CommandAddLink::CommandAddLink "<<outNode<<"."<<outPort<<"->"<<inNode<<"."<<inPort<<" "<<control);
-}
-
-bool CommandAddLink::localExecute()
-{
- DEBTRACE(_outNode<<"."<<_outPort<<"->"<<_inNode<<"."<<_inPort<<" "<<_control);
+ DEBTRACE("CommandSetForEachBranch::localReverse");
try
{
Proc* proc = GuiContext::getCurrent()->getProc();
- Node* outn = proc->getChildByName(_outNode);
- Node* inn = proc->getChildByName(_inNode);
- OutPort* outp = outn->getOutPort(_outPort);
- InPort* inp = inn->getInPort(_inPort);
- ComposedNode *cla = ComposedNode::getLowestCommonAncestor(outn->getFather(),inn->getFather());
- DEBTRACE(cla->getName());
- if (dynamic_cast<OutputDataStreamPort*>(outp))
- cla->edAddLink(outp,inp);
- else if(_control)
- cla->edAddDFLink(outp,inp);
- else
- cla->edAddLink(outp,inp);
+ Node* node=proc->getChildByName(_forEach);
+ InputPort *nbBranches = node->getInputPort("nbBranches");
+ nbBranches->edInit(_oldValue);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(nbBranches));
+ SubjectDataPort *spo = GuiContext::getCurrent()->_mapOfSubjectDataPort[static_cast<DataPort*>(nbBranches)];
+ spo->update(SETVALUE, 0, spo);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ snode->update(SETVALUE, 0, snode);
return true;
}
catch (Exception& ex)
{
- DEBTRACE("CommandAddLink::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ DEBTRACE("CommandSetForEachBranch::localReverse() : " << ex.what());
+ setErrorMsg(ex);
return false;
}
}
-bool CommandAddLink::localReverse()
+// ----------------------------------------------------------------------------
+
+CommandSetAlgo::CommandSetAlgo(std::string optimizer, std::string alglib, std::string symbol)
+ : Command(), _optimizer(optimizer), _alglib(alglib), _symbol(symbol)
{
+ DEBTRACE("CommandSetAlgo::CommandSetAlgo" << _optimizer << " " << _alglib << " " << _symbol);
+ _oldAlglib = "";
+ _oldSymbol = "";
}
-// ----------------------------------------------------------------------------
-
-CommandAddControlLink::CommandAddControlLink(std::string outNode, std::string inNode)
- : Command(), _outNode(outNode), _inNode(inNode)
+std::string CommandSetAlgo::dump()
{
- DEBTRACE("CommandAddControlLink::CommandAddControlLink "<<outNode<<"-->>"<<inNode);
+ string ret ="CommandSetAlgo " + _optimizer + " " + _alglib + " " + _symbol;
+ return ret;
}
-bool CommandAddControlLink::localExecute()
+bool CommandSetAlgo::localExecute()
{
+ DEBTRACE("CommandSetAlgo::localExecute");
try
{
Proc* proc = GuiContext::getCurrent()->getProc();
- Node* outn = proc;
- if (! _outNode.empty())
- outn = proc->getChildByName(_outNode);
- Node* inn = proc;
- if (! _inNode.empty())
- inn = proc->getChildByName(_inNode);
- ComposedNode *cla = ComposedNode::getLowestCommonAncestor(outn,inn);
- DEBTRACE(cla->getName());
- return cla->edAddCFLink(outn,inn);
+ OptimizerLoop* loop = dynamic_cast<OptimizerLoop*>(proc->getChildByName(_optimizer));
+ loop->setAlgorithm(_alglib,_symbol);
+ _oldAlglib = _alglib;
+ _oldSymbol = _symbol;
+ InputPort *port = loop->edGetPortForOutPool();
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(static_cast<DataPort*>(port)));
+ SubjectDataPort *spo = GuiContext::getCurrent()->_mapOfSubjectDataPort[static_cast<DataPort*>(port)];
+ spo->update(UPDATE, 0, spo);
+ OutputPort *oport = loop->edGetSamplePort();
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(static_cast<DataPort*>(oport)));
+ spo = GuiContext::getCurrent()->_mapOfSubjectDataPort[static_cast<DataPort*>(oport)];
+ spo->update(UPDATE, 0, spo);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(loop));
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[loop];
+ snode->update(SETVALUE, 0, snode);
+ return true;
}
catch (Exception& ex)
{
- DEBTRACE("CommandAddControlLink::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ DEBTRACE("CommandSetAlgo::localExecute() : " << ex.what());
+ setErrorMsg(ex);
return false;
}
}
-bool CommandAddControlLink::localReverse()
+bool CommandSetAlgo::localReverse()
{
+ DEBTRACE("CommandSetAlgo::localReverse");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ OptimizerLoop* loop = dynamic_cast<OptimizerLoop*>(proc->getChildByName(_optimizer));
+ loop->setAlgorithm(_oldAlglib,_oldSymbol);
+ InputPort *port = loop->edGetPortForOutPool();
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(static_cast<DataPort*>(port)));
+ SubjectDataPort *spo = GuiContext::getCurrent()->_mapOfSubjectDataPort[static_cast<DataPort*>(port)];
+ spo->update(UPDATE, 0, spo);
+ OutputPort *oport = loop->edGetSamplePort();
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(static_cast<DataPort*>(oport)));
+ spo = GuiContext::getCurrent()->_mapOfSubjectDataPort[static_cast<DataPort*>(oport)];
+ spo->update(UPDATE, 0, spo);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(loop));
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[loop];
+ snode->update(SETVALUE, 0, snode);
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetAlgo::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+ return true;
}
// ----------------------------------------------------------------------------
-CommandAddContainer::CommandAddContainer(std::string name,
- std::string refContainer)
- : Command(), _name(name), _containerToClone(refContainer), _container(0)
+CommandAddLink::CommandAddLink(std::string outNode, std::string outPort, TypeOfElem outPortType,
+ std::string inNode, std::string inPort, TypeOfElem inPortType, bool control)
+ : Command(), _outNode(outNode), _outPort(outPort), _outPortType(outPortType),
+ _inNode(inNode), _inPort(inPort), _inPortType(inPortType), _control(control)
{
- DEBTRACE("CommandAddContainer::CommandAddContainer " << name << " " << refContainer);
+ DEBTRACE("CommandAddLink::CommandAddLink "<<outNode<<"."<<outPort<<"->"<<inNode<<"."<<inPort<<" "<<control);
+ _controlCreatedWithDF = false;
}
-bool CommandAddContainer::localExecute()
+std::string CommandAddLink::dump()
{
- try
+ string s = "false";
+ if (_control) s = "true";
+ string ret ="CommandAddLink " + _outNode + " " + _outPort + " " + _inNode + " " + _inPort + " " + s;
+ return ret;
+}
+
+bool CommandAddLink::localExecute()
+{
+ DEBTRACE("CommandAddLink::localExecute");
+ DEBTRACE(_outNode<<"."<<_outPort<<"->"<<_inNode<<"."<<_inPort<<" "<<_control);
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* outn = proc->getChildByName(_outNode);
+ Node* inn = proc->getChildByName(_inNode);
+ OutPort* outp;
+ InPort* inp;
+
+ // --- is a control link already existing ?
+ bool preexistingControl = false;
+ {
+ Node* outn2=outn;
+ Node* inn2=inn;
+ ComposedNode* father = ComposedNode::getLowestCommonAncestor(outn2,inn2);
+ if(outn2==father || inn2==father)
+ preexistingControl = true;
+ else
+ {
+ while(outn2->getFather() != father)
+ outn2 = outn2->getFather();
+ while(inn2->getFather() != father)
+ inn2 = inn2->getFather();
+ OutGate *ogate = outn2->getOutGate();
+ InGate *igate = inn2->getInGate();
+ if (ogate->isAlreadyInSet(igate))
+ preexistingControl = true;
+ }
+ }
+
+ if(_outPortType == OUTPUTPORT)
+ outp = outn->getOutputPort(_outPort);
+ else
+ outp = outn->getOutputDataStreamPort(_outPort);
+
+ if(_inPortType == INPUTPORT)
+ inp = inn->getInputPort(_inPort);
+ else
+ inp = inn->getInputDataStreamPort(_inPort);
+
+ ComposedNode *cla = ComposedNode::getLowestCommonAncestor(outn->getFather(),inn->getFather());
+ DEBTRACE(cla->getName());
+ if (dynamic_cast<OutputDataStreamPort*>(outp))
+ cla->edAddLink(outp,inp);
+ else if(_control)
+ cla->edAddDFLink(outp,inp);
+ else
+ cla->edAddLink(outp,inp);
+
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(cla));
+ SubjectNode *sub = GuiContext::getCurrent()->_mapOfSubjectNode[cla];
+ SubjectComposedNode *scla = dynamic_cast<SubjectComposedNode*>(sub);
+ DEBTRACE(scla->getName());
+ SubjectNode *sno = GuiContext::getCurrent()->_mapOfSubjectNode[outn];
+ SubjectNode *sni = GuiContext::getCurrent()->_mapOfSubjectNode[inn];
+ SubjectDataPort *subOutport = GuiContext::getCurrent()->_mapOfSubjectDataPort[outp];
+ SubjectDataPort *subInport = GuiContext::getCurrent()->_mapOfSubjectDataPort[inp];
+ SubjectLink *slink = scla->addSubjectLink(sno, subOutport, sni, subInport);
+
+ // --- if control link, identify the nodes linked and draw the control link if not already existing
+
+ if (_control)
+ {
+ ComposedNode* father = ComposedNode::getLowestCommonAncestor(outn,inn);
+ if(outn==father || inn==father) return true;
+ while(outn->getFather() != father)
+ outn = outn->getFather();
+ while(inn->getFather() != father)
+ inn = inn->getFather();
+ OutGate *ogate = outn->getOutGate();
+ InGate *igate = inn->getInGate();
+ if (ogate->isAlreadyInSet(igate))
+ {
+ if (!preexistingControl)
+ _controlCreatedWithDF = true;
+ pair<Node*,Node*> keyLink(outn,inn);
+ if (!GuiContext::getCurrent()->_mapOfSubjectControlLink.count(keyLink))
+ {
+ SubjectNode *sfno = GuiContext::getCurrent()->_mapOfSubjectNode[outn];
+ SubjectNode *sfni = GuiContext::getCurrent()->_mapOfSubjectNode[inn];
+ if (!sfno || !sfni) return true;
+ SubjectControlLink *sclink = scla->addSubjectControlLink(sfno, sfni);
+ }
+ }
+ }
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandAddLink::localExecute() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+}
+
+bool CommandAddLink::localReverse()
+{
+ DEBTRACE("CommandAddLink::localReverse");
+ try
+ {
+ SubjectLink *slink =0;
+ SubjectControlLink *sclink = 0;
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* outn = proc->getChildByName(_outNode);
+ Node* inn = proc->getChildByName(_inNode);
+ OutPort* outp;
+ InPort* inp;
+ if(_outPortType == OUTPUTPORT)
+ outp = outn->getOutputPort(_outPort);
+ else
+ outp = outn->getOutputDataStreamPort(_outPort);
+ if(_inPortType == INPUTPORT)
+ inp = inn->getInputPort(_inPort);
+ else
+ inp = inn->getInputDataStreamPort(_inPort);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectLink.count(pair<OutPort*,InPort*>(outp,inp)));
+ slink = GuiContext::getCurrent()->_mapOfSubjectLink[pair<OutPort*,InPort*>(outp,inp)];
+ if (_controlCreatedWithDF)
+ {
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectControlLink.count(pair<Node*,Node*>(outn,inn)));
+ sclink = GuiContext::getCurrent()->_mapOfSubjectControlLink[pair<Node*,Node*>(outn,inn)];
+ }
+
+ Subject *father = slink->getParent();
+ Subject::erase(slink);
+ slink = 0;
+ if (father)
+ {
+ DEBTRACE("REMOVE");
+ father->select(true);
+ father->update(REMOVE,0,0);
+ }
+ if (!sclink)
+ return true;
+ father=sclink->getParent();
+ Subject::erase(sclink);
+ sclink = 0;
+ if (father)
+ {
+ DEBTRACE("REMOVE");
+ father->select(true);
+ father->update(REMOVE,0,0);
+ }
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandAddLink::localReverse(): " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+CommandAddControlLink::CommandAddControlLink(std::string outNode, std::string inNode)
+ : Command(), _outNode(outNode), _inNode(inNode)
+{
+ DEBTRACE("CommandAddControlLink::CommandAddControlLink "<<outNode<<"-->>"<<inNode);
+}
+
+std::string CommandAddControlLink::dump()
+{
+ string ret ="CommandAddControlLink " + _outNode + " " + _inNode;
+ return ret;
+}
+
+bool CommandAddControlLink::localExecute()
+{
+ DEBTRACE("CommandAddControlLink::localExecute");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* outn = proc;
+ if (! _outNode.empty())
+ outn = proc->getChildByName(_outNode);
+ Node* inn = proc;
+ if (! _inNode.empty())
+ inn = proc->getChildByName(_inNode);
+ ComposedNode *cla = ComposedNode::getLowestCommonAncestor(outn,inn);
+ DEBTRACE(cla->getName());
+ bool ret= cla->edAddCFLink(outn,inn);
+ if(ret==false)
+ GuiContext::getCurrent()->_lastErrorMessage = "Link already exists";
+
+ cla = ComposedNode::getLowestCommonAncestor(outn->getFather(),
+ inn->getFather());
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(cla));
+ SubjectNode *sub = GuiContext::getCurrent()->_mapOfSubjectNode[cla];
+ SubjectComposedNode *scla = dynamic_cast<SubjectComposedNode*>(sub);
+ DEBTRACE(scla->getName());
+ SubjectNode *sno = GuiContext::getCurrent()->_mapOfSubjectNode[outn];
+ SubjectNode *sni = GuiContext::getCurrent()->_mapOfSubjectNode[inn];
+ SubjectControlLink *sclink = scla->addSubjectControlLink(sno,sni);
+ return ret;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandAddControlLink::localExecute() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+}
+
+bool CommandAddControlLink::localReverse()
+{
+ DEBTRACE("CommandAddControlLink::localReverse");
+ try
+ {
+ SubjectControlLink *sclink = 0;
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* outn = proc->getChildByName(_outNode);
+ Node* inn = proc->getChildByName(_inNode);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectControlLink.count(pair<Node*,Node*>(outn,inn)));
+ sclink = GuiContext::getCurrent()->_mapOfSubjectControlLink[pair<Node*,Node*>(outn,inn)];
+
+ Subject *father=sclink->getParent();
+ Subject::erase(sclink);
+ sclink = 0;
+ if (father)
+ {
+ DEBTRACE("REMOVE");
+ father->select(true);
+ father->update(REMOVE,0,0);
+ }
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandAddControlLink::localReverse(): " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+CommandAddContainer::CommandAddContainer(std::string name,
+ std::string refContainer)
+ : Command(), _name(name), _containerToClone(refContainer), _subcont(0)
+{
+ DEBTRACE("CommandAddContainer::CommandAddContainer " << name << " " << refContainer);
+}
+
+std::string CommandAddContainer::dump()
+{
+ string ret ="CommandAddContainer " + _name + " " + _containerToClone;
+ return ret;
+}
+
+bool CommandAddContainer::localExecute()
+{
+ DEBTRACE("CommandAddContainer::localExecute");
+ try
{
Proc* proc = GuiContext::getCurrent()->getProc();
if (proc->containerMap.count(_name))
if (proc->containerMap.count(_containerToClone))
{
Container *ref = proc->containerMap[_containerToClone];
- assert(ref);
+ YASSERT(ref);
container->setProperties(ref->getProperties());
}
else
return false;
}
}
- _container = container;
- _container->setName(_name);
- proc->containerMap[_name] = _container;
+ container->setName(_name);
+ container->setProc(proc);
+ proc->containerMap[_name] = container;
+
+ SubjectProc* sproc = GuiContext::getCurrent()->getSubjectProc();
+ _subcont = sproc->addSubjectContainer(container, _name);
return true;
}
catch (Exception& ex)
{
DEBTRACE("CommandAddContainer::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
return false;
}
}
bool CommandAddContainer::localReverse()
{
+ DEBTRACE("CommandAddContainer::localReverse");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ YASSERT(proc->containerMap.count(_name));
+ Container *container = proc->containerMap[_name];
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectContainer.count(container));
+ _subcont = GuiContext::getCurrent()->_mapOfSubjectContainer[container];
+ YASSERT(!_subcont->isUsed());
+ SubjectProc* sproc = GuiContext::getCurrent()->getSubjectProc();
+ sproc->removeSubjectContainer(_subcont);
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandAddContainer::localExecute() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+CommandSetNodeProperties::CommandSetNodeProperties(std::string position, std::map<std::string,std::string> properties)
+ : Command(), _position(position), _properties(properties)
+{
+ DEBTRACE("CommandSetNodeProperties::CommandSetNodeProperties " << position);
+ _oldProp.clear();
+}
+
+std::string CommandSetNodeProperties::dump()
+{
+ string ret ="CommandSetNodeProperties " + _position;
+ return ret;
+}
+
+bool CommandSetNodeProperties::localExecute()
+{
+ DEBTRACE("CommandSetNodeProperties::localExecute");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node = proc;
+
+ if (!_position.empty()) node = proc->getChildByName(_position);
+
+ if (node)
+ {
+ _oldProp = node->getPropertyMap();
+ node->setProperties(_properties);
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ snode->update(SETVALUE, 0, snode);
+ return true;
+ }
+ GuiContext::getCurrent()->_lastErrorMessage = "node not found: " + _position;
+ return false;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetNodeProperties::localExecute() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+}
+
+bool CommandSetNodeProperties::localReverse()
+{
+ DEBTRACE("CommandSetNodeProperties::localReverse");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node = proc;
+
+ if (!_position.empty()) node = proc->getChildByName(_position);
+
+ if (node)
+ {
+ node->setProperties(_oldProp);
+ SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ snode->update(SETVALUE, 0, snode);
+ return true;
+ }
+ GuiContext::getCurrent()->_lastErrorMessage = "node not found: " + _position;
+ return false;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetNodeProperties::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+CommandSetComponentInstanceProperties::CommandSetComponentInstanceProperties(std::string compoinstance,
+ std::map<std::string,std::string> properties)
+ : Command(), _compoinstance(compoinstance), _properties(properties)
+{
+ DEBTRACE("CommandSetComponentInstanceProperties::CommandSetComponentInstanceProperties " << compoinstance);
+ _oldProp.clear();
+}
+
+std::string CommandSetComponentInstanceProperties::dump()
+{
+ string ret ="CommandSetComponentInstanceProperties " + _compoinstance;
+ return ret;
+}
+
+bool CommandSetComponentInstanceProperties::localExecute()
+{
+ DEBTRACE("CommandSetComponentInstanceProperties::localExecute");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ if (proc->componentInstanceMap.count(_compoinstance))
+ {
+ ComponentInstance *ref = proc->componentInstanceMap[_compoinstance];
+ YASSERT(ref);
+ _oldProp = ref->getProperties();
+ _oldAnon = ref->isAnonymous();
+ ref->setProperties(_properties);
+ ref->setAnonymous(false);
+ SubjectComponent* subcompo = GuiContext::getCurrent()->_mapOfSubjectComponent[ref];
+ subcompo->update(SETVALUE, 0, subcompo);
+ return true;
+ }
+ GuiContext::getCurrent()->_lastErrorMessage = "compoinstance not found: " + _compoinstance;
+ return false;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetComponentInstanceProperties::localExecute() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
}
-YACS::ENGINE::Container* CommandAddContainer::getContainer()
+bool CommandSetComponentInstanceProperties::localReverse()
{
- return _container;
+ DEBTRACE("CommandSetComponentInstanceProperties::localReverse");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ if (proc->componentInstanceMap.count(_compoinstance))
+ {
+ ComponentInstance *ref = proc->componentInstanceMap[_compoinstance];
+ YASSERT(ref);
+ ref->setProperties(_oldProp);
+ ref->setAnonymous(_oldAnon);
+ SubjectComponent* subcompo = GuiContext::getCurrent()->_mapOfSubjectComponent[ref];
+ subcompo->update(SETVALUE, 0, subcompo);
+ return true;
+ }
+ GuiContext::getCurrent()->_lastErrorMessage = "compoinstance not found: " + _compoinstance;
+ return false;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetComponentInstanceProperties::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
}
// ----------------------------------------------------------------------------
: Command(), _container(container), _properties(properties)
{
DEBTRACE("CommandSetContainerProperties::CommandSetContainerProperties " << container);
+ _oldProp.clear();
+}
+
+std::string CommandSetContainerProperties::dump()
+{
+ string ret ="CommandSetContainerProperties " + _container;
+ return ret;
}
bool CommandSetContainerProperties::localExecute()
{
+ DEBTRACE("CommandSetContainerProperties::localExecute");
try
{
Proc* proc = GuiContext::getCurrent()->getProc();
if (proc->containerMap.count(_container))
{
Container *ref = proc->containerMap[_container];
- assert(ref);
+ YASSERT(ref);
+ _oldProp = ref->getProperties();
ref->setProperties(_properties);
return true;
}
catch (Exception& ex)
{
DEBTRACE("CommandSetContainerProperties::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
return false;
}
}
bool CommandSetContainerProperties::localReverse()
{
+ DEBTRACE("CommandSetContainerProperties::localReverse");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ if (proc->containerMap.count(_container))
+ {
+ Container *ref = proc->containerMap[_container];
+ YASSERT(ref);
+ ref->setProperties(_oldProp);
+ return true;
+ }
+ GuiContext::getCurrent()->_lastErrorMessage = "container not found: " + _container;
+ return false;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetContainerProperties::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
}
// ----------------------------------------------------------------------------
: Command(), _nodeName(node), _portName(port), _isInport(isInport), _properties(properties)
{
DEBTRACE("CommandSetDSPortProperties::CommandSetDSPortProperties " << node << "." << port << " " << isInport);
+ _oldProp.clear();
}
+std::string CommandSetDSPortProperties::dump()
+{
+ string s = "false";
+ if (_isInport) s = "true";
+ string ret ="CommandSetDSPortProperties " + _nodeName + " " + _portName + " " + s;
+ return ret;
+}
+
bool CommandSetDSPortProperties::localExecute()
{
+ DEBTRACE("CommandSetDSPortProperties::localExecute");
try
{
Proc* proc = GuiContext::getCurrent()->getProc();
DSPort = node->getInputDataStreamPort(_portName);
else
DSPort = node->getOutputDataStreamPort(_portName);
+ _oldProp = DSPort->getProperties();
DSPort->setProperties(_properties);
return true;
}
catch (Exception& ex)
{
- DEBTRACE("CommandSetDSPortProperties::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ DEBTRACE("CommandSetDSPortProperties::localExecute() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+}
+
+bool CommandSetDSPortProperties::localReverse()
+{
+ DEBTRACE("CommandSetDSPortProperties::localReverse");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node = proc->getChildByName(_nodeName);
+ DataStreamPort* DSPort = 0;
+ if (_isInport)
+ DSPort = node->getInputDataStreamPort(_portName);
+ else
+ DSPort = node->getOutputDataStreamPort(_portName);
+ DSPort->setProperties(_oldProp);
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetDSPortProperties::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+CommandSetLinkProperties::CommandSetLinkProperties(std::string startnode, std::string startport,
+ std::string endnode, std::string endport,
+ std::map<std::string,std::string> properties)
+ : Command(), _startNodeName(startnode), _startPortName(startport),
+ _endNodeName(endnode), _endPortName(endport),
+ _properties(properties)
+{
+ DEBTRACE("CommandSetLinkProperties::CommandSetLinkProperties " );
+ _oldProp.clear();
+}
+
+std::string CommandSetLinkProperties::dump()
+{
+ string ret ="CommandSetLinkProperties " + _startNodeName + " " + _startPortName + " " + _endNodeName + " " + _endPortName;
+ return ret;
+}
+
+bool CommandSetLinkProperties::localExecute()
+{
+ DEBTRACE("CommandSetLinkProperties::localExecute");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node;
+ InputDataStreamPort* inDSPort = 0;
+ OutputDataStreamPort* outDSPort = 0;
+
+ node = proc->getChildByName(_startNodeName);
+ outDSPort = node->getOutputDataStreamPort(_startPortName);
+ outDSPort->setProperties(_properties);
+
+ node = proc->getChildByName(_endNodeName);
+ inDSPort = node->getInputDataStreamPort(_endPortName);
+ _oldProp = inDSPort->getProperties();
+ inDSPort->setProperties(_properties);
+
+ std::pair<OutPort*,InPort*> keymap = std::pair<OutPort*,InPort*>(outDSPort,inDSPort);
+ SubjectLink* subject = GuiContext::getCurrent()->_mapOfSubjectLink[keymap];
+ subject->update(SETVALUE, 0, subject);
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetDSPortProperties::localExecute() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+}
+
+bool CommandSetLinkProperties::localReverse()
+{
+ DEBTRACE("CommandSetLinkProperties::localReverse");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node;
+ InputDataStreamPort* inDSPort = 0;
+ OutputDataStreamPort* outDSPort = 0;
+
+ node = proc->getChildByName(_startNodeName);
+ outDSPort = node->getOutputDataStreamPort(_startPortName);
+ outDSPort->setProperties(_properties);
+
+ node = proc->getChildByName(_endNodeName);
+ inDSPort = node->getInputDataStreamPort(_endPortName);
+ inDSPort->setProperties(_oldProp);
+
+ std::pair<OutPort*,InPort*> keymap = std::pair<OutPort*,InPort*>(outDSPort,inDSPort);
+ SubjectLink* subject = GuiContext::getCurrent()->_mapOfSubjectLink[keymap];
+ subject->update(SETVALUE, 0, subject);
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetDSPortProperties::localReverse() : " << ex.what());
+ setErrorMsg(ex);
return false;
}
}
-
-bool CommandSetDSPortProperties::localReverse()
-{
-}
// ----------------------------------------------------------------------------
: Command(), _nodeName(node), _funcName(funcName)
{
DEBTRACE("CommandSetFuncNodeFunctionName::CommandSetFuncNodeFunctionName " << node << " " <<funcName);
+ _oldName.clear();
+}
+
+std::string CommandSetFuncNodeFunctionName::dump()
+{
+ string ret ="CommandSetFuncNodeFunctionName " + _nodeName + " " + _funcName;
+ return ret;
}
bool CommandSetFuncNodeFunctionName::localExecute()
{
+ DEBTRACE("CommandSetFuncNodeFunctionName::localExecute");
try
{
Proc* proc = GuiContext::getCurrent()->getProc();
}
if (YACS::ENGINE::InlineFuncNode* funcNode = dynamic_cast<YACS::ENGINE::InlineFuncNode*>(node))
{
+ _oldName = funcNode->getFname();
funcNode->setFname(_funcName);
return true;
}
catch (Exception& ex)
{
DEBTRACE("CommandSetFuncNodeFunctionName::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
return false;
}
}
bool CommandSetFuncNodeFunctionName::localReverse()
{
+ DEBTRACE("CommandSetFuncNodeFunctionName::localReverse");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node = proc->getChildByName(_nodeName);
+ if (YACS::ENGINE::InlineFuncNode* funcNode = dynamic_cast<YACS::ENGINE::InlineFuncNode*>(node))
+ {
+ funcNode->setFname(_oldName);
+ return true;
+ }
+ else
+ {
+ GuiContext::getCurrent()->_lastErrorMessage = "node is not an InlineFuncNode: " + _nodeName;
+ return false;
+ }
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetFuncNodeFunctionName::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
}
// ----------------------------------------------------------------------------
: Command(), _nodeName(node), _script(script)
{
DEBTRACE("CommandSetInlineNodeScript::CommandSetInlineNodeScript " << node << " " <<script);
+ _oldScript.clear();
+}
+
+std::string CommandSetInlineNodeScript::dump()
+{
+ string ret ="CommandSetInlineNodeScript " + _nodeName;
+ return ret;
}
bool CommandSetInlineNodeScript::localExecute()
{
+ DEBTRACE("CommandSetInlineNodeScript::localExecute");
try
{
Proc* proc = GuiContext::getCurrent()->getProc();
}
if (YACS::ENGINE::InlineNode* inlineNode = dynamic_cast<YACS::ENGINE::InlineNode*>(node))
{
+ _oldScript = inlineNode->getScript();
inlineNode->setScript(_script);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
+ SubjectNode* snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ snode->update(SYNCHRO,0,snode);
return true;
}
else
catch (Exception& ex)
{
DEBTRACE("CommandSetInlineNodeScript::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
return false;
}
}
bool CommandSetInlineNodeScript::localReverse()
{
+ DEBTRACE("CommandSetInlineNodeScript::localReverse");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node = proc->getChildByName(_nodeName);
+ if (YACS::ENGINE::InlineNode* inlineNode = dynamic_cast<YACS::ENGINE::InlineNode*>(node))
+ {
+ inlineNode->setScript(_oldScript);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
+ SubjectNode* snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ snode->update(SYNCHRO,0,snode);
+ return true;
+ }
+ else
+ {
+ GuiContext::getCurrent()->_lastErrorMessage = "node is not an InlineNode: " + _nodeName;
+ return false;
+ }
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetInlineNodeScript::localExecute() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
}
// ----------------------------------------------------------------------------
-CommandAddComponentInstance::CommandAddComponentInstance(std::string compoName)
- : Command(), _compoName(compoName), _compoInst(0)
+CommandAddComponentInstance::CommandAddComponentInstance(std::string compoName,
+ std::string container,
+ std::string name)
+ : Command(), _compoName(compoName), _container(container), _name(name), _subcompo(0)
{
DEBTRACE("CommandAddComponentInstance::CommandAddComponentInstance " <<_compoName);
}
+std::string CommandAddComponentInstance::dump()
+{
+ string ret ="CommandAddComponentInstance " + _compoName + " " + _container + " " + _name;
+ return ret;
+}
+
bool CommandAddComponentInstance::localExecute()
{
+ DEBTRACE("CommandAddComponentInstance::localExecute "<< _compoName << " " << _container << " " << _name);
try
{
Proc* proc = GuiContext::getCurrent()->getProc();
- _compoInst = new SalomeComponent(_compoName);
- pair<string,int> key = pair<string,int>(_compoName, _compoInst->getNumId());
- proc->componentInstanceMap[key] = _compoInst;
+ YASSERT(proc->containerMap.count(_container));
+ Container *cont = proc->containerMap[_container];
+ ComponentInstance* compoInst = new SalomeComponent(_compoName);
+ compoInst->setContainer(cont);
+ proc->addComponentInstance(compoInst, _name);
+
+ SubjectProc *sproc = GuiContext::getCurrent()->getSubjectProc();
+ _subcompo = sproc->addSubjectComponent(compoInst);
+ _name = compoInst->getInstanceName();
+ DEBTRACE(_name);
return true;
}
catch (Exception& ex)
{
DEBTRACE("CommandAddComponentInstance::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
return false;
}
}
bool CommandAddComponentInstance::localReverse()
{
+ DEBTRACE("CommandAddComponentInstance::localReverse");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ YASSERT(proc->componentInstanceMap.count(_name));
+ ComponentInstance *compo = proc->componentInstanceMap[_name];
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectComponent.count(compo));
+ _subcompo = GuiContext::getCurrent()->_mapOfSubjectComponent[compo];
+ YASSERT(!_subcompo->hasServices());
+ Container *cont = compo->getContainer();
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectContainer.count(cont));
+ SubjectContainer *subcont = GuiContext::getCurrent()->_mapOfSubjectContainer[cont];
+ subcont->detachComponent(_subcompo);
+ GuiContext::getCurrent()->_mapOfSubjectComponent.erase(compo);
+ proc->removeComponentInstance(compo);
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandAddComponentInstance::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+}
+
+// ----------------------------------------------------------------------------
+CommandSetExecutionMode::CommandSetExecutionMode(std::string nodeName, std::string mode)
+ : Command(), _mode(mode),_nodeName(nodeName)
+{
+ DEBTRACE("CommandSetExecutionMode::CommandSetExecutionMode " << nodeName << " " << mode);
+ _oldmode = "local";
+}
+
+std::string CommandSetExecutionMode::dump()
+{
+ string ret ="CommandSetExecutionMode " + _mode + " " + _nodeName;
+ return ret;
+}
+
+bool CommandSetExecutionMode::localExecute()
+{
+ DEBTRACE("CommandSetExecutionMode::localExecute");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node = proc->getChildByName(_nodeName);
+ if (YACS::ENGINE::InlineNode* pyNode = dynamic_cast<YACS::ENGINE::InlineNode*>(node))
+ {
+ _oldmode = pyNode->getExecutionMode();
+ pyNode->setExecutionMode(_mode);
+ SubjectNode* snode = GuiContext::getCurrent()->_mapOfSubjectNode[pyNode];
+ snode->update(UPDATE, 0, 0);
+ return true;
+ }
+ else
+ {
+ GuiContext::getCurrent()->_lastErrorMessage = "node is not an InlineNode: " + _nodeName;
+ return false;
+ }
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetExecutionMode::localExecute() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+}
+
+bool CommandSetExecutionMode::localReverse()
+{
+ DEBTRACE("CommandSetExecutionMode::localReverse");
+ try
+ {
+ if (_oldmode == _mode) return true;
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node = proc->getChildByName(_nodeName);
+ if (YACS::ENGINE::InlineNode* pyNode = dynamic_cast<YACS::ENGINE::InlineNode*>(node))
+ {
+ pyNode->setExecutionMode(_oldmode);
+ SubjectNode* snode = GuiContext::getCurrent()->_mapOfSubjectNode[pyNode];
+ snode->update(UPDATE, 0, 0);
+ return true;
+ }
+ else
+ {
+ GuiContext::getCurrent()->_lastErrorMessage = "node is not an InlineNode: " + _nodeName;
+ return false;
+ }
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetExecutionMode::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+ return true;
+}
+
+
+// ----------------------------------------------------------------------------
+
+CommandSetContainer::CommandSetContainer(std::string nodeName, std::string container)
+ : Command(), _container(container),_nodeName(nodeName)
+{
+ DEBTRACE("CommandSetContainer::CommandSetContainer " << nodeName << " " << container);
+ _oldcont = "DefaultContainer";
+}
+
+std::string CommandSetContainer::dump()
+{
+ string ret ="CommandSetContainer " + _container + " " + _nodeName;
+ return ret;
+}
+
+bool CommandSetContainer::localExecute()
+{
+ DEBTRACE("CommandSetContainer::localExecute");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ if (proc->containerMap.count(_container))
+ {
+ Container *cont = proc->containerMap[_container];
+ Node* node = proc->getChildByName(_nodeName);
+ if (YACS::ENGINE::InlineNode* pyNode = dynamic_cast<YACS::ENGINE::InlineNode*>(node))
+ {
+ Container* oldcont = pyNode->getContainer();
+ if(oldcont)
+ _oldcont = pyNode->getContainer()->getName();
+ pyNode->setContainer(cont);
+ SubjectNode* snode = GuiContext::getCurrent()->_mapOfSubjectNode[pyNode];
+ SubjectContainer *subcont = GuiContext::getCurrent()->_mapOfSubjectContainer[cont];
+ snode->update(ASSOCIATE, 0, subcont);
+ return true;
+ }
+ else
+ {
+ GuiContext::getCurrent()->_lastErrorMessage = "node is not an InlineNode: " + _nodeName;
+ return false;
+ }
+ }
+ else
+ GuiContext::getCurrent()->_lastErrorMessage = "Container not found: " + _container;
+ return false;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetContainer::localExecute() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
}
-YACS::ENGINE::ComponentInstance* CommandAddComponentInstance::getComponentInstance()
+bool CommandSetContainer::localReverse()
{
- return _compoInst;
+ DEBTRACE("CommandSetContainer::localReverse");
+ try
+ {
+ if (_oldcont == _container) return true;
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ if (proc->containerMap.count(_oldcont))
+ {
+ Container *cont = proc->containerMap[_oldcont];
+ Node* node = proc->getChildByName(_nodeName);
+ if (YACS::ENGINE::InlineNode* pyNode = dynamic_cast<YACS::ENGINE::InlineNode*>(node))
+ {
+ pyNode->setContainer(cont);
+ SubjectNode* snode = GuiContext::getCurrent()->_mapOfSubjectNode[pyNode];
+ SubjectContainer *subcont = GuiContext::getCurrent()->_mapOfSubjectContainer[cont];
+ snode->update(ASSOCIATE, 0, subcont);
+ return true;
+ }
+ else
+ {
+ GuiContext::getCurrent()->_lastErrorMessage = "node is not an InlineNode: " + _nodeName;
+ return false;
+ }
+ }
+ else
+ GuiContext::getCurrent()->_lastErrorMessage = "Container not found: " + _oldcont;
+ return false;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandSetContainer::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+ return true;
}
+
// ----------------------------------------------------------------------------
-CommandAssociateComponentToContainer::CommandAssociateComponentToContainer(std::pair<std::string,int> key,
+CommandAssociateComponentToContainer::CommandAssociateComponentToContainer(std::string instanceName,
std::string container)
- : Command(), _key(key), _container(container)
+ : Command(), _container(container),_instanceName(instanceName)
{
- DEBTRACE("CommandAssociateComponentToContainer::CommandAssociateComponentToContainer "
- << key.first << " " << key.second << " " << container);
+ DEBTRACE("CommandAssociateComponentToContainer::CommandAssociateComponentToContainer " << instanceName << " " << container);
+ _oldcont = "DefaultContainer";
+}
+
+std::string CommandAssociateComponentToContainer::dump()
+{
+ string ret ="CommandAssociateComponentToContainer " + _container + " " + _instanceName;
+ return ret;
}
bool CommandAssociateComponentToContainer::localExecute()
{
+ DEBTRACE("CommandAssociateComponentToContainer::localExecute");
try
{
Proc* proc = GuiContext::getCurrent()->getProc();
if (proc->containerMap.count(_container))
{
Container *cont = proc->containerMap[_container];
- if (proc->componentInstanceMap.count(_key))
+ if (proc->componentInstanceMap.count(_instanceName))
{
- ComponentInstance *compo = proc->componentInstanceMap[_key];
+ DEBTRACE(_instanceName);
+ ComponentInstance *compo = proc->componentInstanceMap[_instanceName];
+ if (compo->getContainer())
+ _oldcont = compo->getContainer()->getName();
compo->setContainer(cont);
+
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectComponent.count(compo));
+ SubjectComponent *scomp = GuiContext::getCurrent()->_mapOfSubjectComponent[compo];
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectContainer.count(cont));
+ SubjectContainer *subcont = GuiContext::getCurrent()->_mapOfSubjectContainer[cont];
+ scomp->addSubjectReference(subcont);
+ if (scomp->_subRefContainer)
+ subcont->moveComponent(scomp->_subRefContainer);
+ else
+ scomp->_subRefContainer = subcont->attachComponent(scomp);
+ scomp->notifyServicesChange(ASSOCIATE, CONTAINER, subcont);
return true;
}
else
- GuiContext::getCurrent()->_lastErrorMessage = "Component instance not found: " + _key.first;
+ GuiContext::getCurrent()->_lastErrorMessage = "Component instance not found: " + _instanceName;
}
else
GuiContext::getCurrent()->_lastErrorMessage = "Container not found: " + _container;
catch (Exception& ex)
{
DEBTRACE("CommandAssociateComponentToContainer::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
return false;
}
}
bool CommandAssociateComponentToContainer::localReverse()
{
+ DEBTRACE("CommandAssociateComponentToContainer::localReverse");
+ try
+ {
+ if (_oldcont == _container) return true;
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ if (proc->containerMap.count(_oldcont))
+ {
+ Container *cont = proc->containerMap[_oldcont];
+ if (proc->componentInstanceMap.count(_instanceName))
+ {
+ DEBTRACE(_instanceName);
+ ComponentInstance *compo = proc->componentInstanceMap[_instanceName];
+ compo->setContainer(cont);
+
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectComponent.count(compo));
+ SubjectComponent *scomp = GuiContext::getCurrent()->_mapOfSubjectComponent[compo];
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectContainer.count(cont));
+ SubjectContainer *subcont = GuiContext::getCurrent()->_mapOfSubjectContainer[cont];
+ scomp->addSubjectReference(subcont);
+ if (scomp->_subRefContainer)
+ subcont->moveComponent(scomp->_subRefContainer);
+ else
+ scomp->_subRefContainer = subcont->attachComponent(scomp);
+ scomp->notifyServicesChange(ASSOCIATE, CONTAINER, subcont);
+ return true;
+ }
+ else
+ GuiContext::getCurrent()->_lastErrorMessage = "Component instance not found: " + _instanceName;
+ }
+ else
+ GuiContext::getCurrent()->_lastErrorMessage = "Container not found: " + _oldcont;
+ return false;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandAssociateComponentToContainer::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+ return true;
}
// ----------------------------------------------------------------------------
CommandAssociateServiceToComponent::CommandAssociateServiceToComponent(std::string service,
- std::pair<std::string,int> key)
- : Command(), _service(service), _key(key)
+ std::string instanceName)
+ : Command(), _service(service), _instanceName(instanceName)
+{
+ DEBTRACE("CommandAssociateServiceToComponent::CommandAssociateServiceToComponent "<< service << " " <<instanceName);
+ _oldInstance="";
+}
+
+std::string CommandAssociateServiceToComponent::dump()
{
- DEBTRACE("CommandAssociateServiceToComponent::CommandAssociateServiceToComponent "
- << service << " " << key.first << " " << key.second);
+ string ret ="CommandAssociateServiceToComponent " + _service + " " + _instanceName;
+ return ret;
}
bool CommandAssociateServiceToComponent::localExecute()
{
+ DEBTRACE("CommandAssociateServiceToComponent::localExecute");
try
{
Proc* proc = GuiContext::getCurrent()->getProc();
Node* node = proc->getChildByName(_service);
if (ServiceNode *service = dynamic_cast<ServiceNode*>(node))
{
- if (proc->componentInstanceMap.count(_key))
+ if (proc->componentInstanceMap.count(_instanceName))
{
- ComponentInstance *compo = proc->componentInstanceMap[_key];
+ DEBTRACE(_instanceName);
+ ComponentInstance *compo = proc->componentInstanceMap[_instanceName];
service->setComponent(compo);
+
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(service));
+ SubjectNode* snode = GuiContext::getCurrent()->_mapOfSubjectNode[service];
+ SubjectServiceNode *ssnode = dynamic_cast<SubjectServiceNode*>(snode);
+ YASSERT(ssnode);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectComponent.count(compo));
+ SubjectComponent *subCompo = GuiContext::getCurrent()->_mapOfSubjectComponent[compo];
+ snode->addSubjectReference(subCompo);
+ if (ssnode->_subRefComponent)
+ {
+ SubjectComponent* oldcomp = dynamic_cast<SubjectComponent*>(ssnode->_subRefComponent->getParent());
+ YASSERT(oldcomp);
+ _oldInstance = oldcomp->getName();
+ _oldcont = oldcomp->getComponent()->getContainer()->getName();
+ subCompo->moveService(ssnode->_subRefComponent);
+ }
+ else
+ ssnode->_subRefComponent = subCompo->attachService(ssnode);
+
return true;
}
else
- GuiContext::getCurrent()->_lastErrorMessage = "Component instance not found: " + _key.first;
+ GuiContext::getCurrent()->_lastErrorMessage = "Component instance not found: " + _instanceName;
}
else
- GuiContext::getCurrent()->_lastErrorMessage = "Node is note a service node: " + _service;
+ GuiContext::getCurrent()->_lastErrorMessage = "Node is not a service node: " + _service;
return false;
}
catch (Exception& ex)
{
DEBTRACE("CommandAssociateServiceToComponent::localExecute() : " << ex.what());
- GuiContext::getCurrent()->_lastErrorMessage = ex.what();
+ setErrorMsg(ex);
return false;
}
}
bool CommandAssociateServiceToComponent::localReverse()
{
+ DEBTRACE("CommandAssociateServiceToComponent::localReverse");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ if (_service == proc->getName()) return false; // proc is not an elementary node
+ Node* node = proc->getChildByName(_service);
+ if (ServiceNode *service = dynamic_cast<ServiceNode*>(node))
+ {
+ ComponentInstance *compo;
+ if (!proc->componentInstanceMap.count(_oldInstance))
+ {
+ //component instance does not exist anymore recreate it
+ ComponentInstance *oldcompo = service->getComponent();
+ compo = oldcompo->clone();
+ compo->setName(_oldInstance);
+ proc->addComponentInstance(compo, _oldInstance);
+ Container *cont = proc->containerMap[_oldcont];
+ compo->setContainer(cont);
+ SubjectProc *sproc = GuiContext::getCurrent()->getSubjectProc();
+ sproc->addSubjectComponent(compo);
+ }
+ else
+ {
+ compo = proc->componentInstanceMap[_oldInstance];
+ }
+
+ DEBTRACE(_oldInstance);
+ service->setComponent(compo);
+
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(service));
+ SubjectNode* snode = GuiContext::getCurrent()->_mapOfSubjectNode[service];
+ SubjectServiceNode *ssnode = dynamic_cast<SubjectServiceNode*>(snode);
+ YASSERT(ssnode);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectComponent.count(compo));
+ SubjectComponent *subCompo = GuiContext::getCurrent()->_mapOfSubjectComponent[compo];
+ snode->addSubjectReference(subCompo);
+ if (ssnode->_subRefComponent)
+ subCompo->moveService(ssnode->_subRefComponent);
+ else
+ ssnode->_subRefComponent = subCompo->attachService(ssnode);
+
+ return true;
+ }
+ else
+ GuiContext::getCurrent()->_lastErrorMessage = "Node is not a service node: " + _service;
+ return false;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandAssociateServiceToComponent::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
}
// ----------------------------------------------------------------------------
+
+CommandAddComponentFromCatalog::CommandAddComponentFromCatalog(YACS::ENGINE::Catalog* catalog,
+ std::string position,
+ std::string compo,
+ std::string service)
+ : Command(), _catalog(catalog), _position(position), _compo(compo), _service(service)
+{
+ DEBTRACE("CommandAddComponentFromCatalog::CommandAddComponentFromCatalog " << position << " " << compo << " " << service);
+ _nameInProc="";
+ _createdInstance = false;
+}
+
+std::string CommandAddComponentFromCatalog::dump()
+{
+ string ret = "CommandAddComponentFromCatalog " + _position + " " + _compo + " " + _service;
+ return ret;
+}
+
+bool CommandAddComponentFromCatalog::localExecute()
+{
+ DEBTRACE("CommandAddComponentFromCatalog::localExecute");
+ try
+ {
+ DEBTRACE("_nameInProc: " << _nameInProc);
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node = proc;
+ if (!_position.empty()) node = proc->getChildByName(_position);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
+ SubjectNode* snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ SubjectServiceNode *ssnode = dynamic_cast<SubjectServiceNode*>(snode);
+ YASSERT(ssnode);
+ if (_catalog->_componentMap.count(_compo))
+ {
+ YACS::ENGINE::ComponentDefinition* compodef = _catalog->_componentMap[_compo];
+ if (compodef->_serviceMap.count(_service))
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ ComponentInstance *instance =ssnode->_serviceNode->getComponent();
+ YASSERT(instance);
+ SubjectComponent* subCompo = 0;
+ _createdInstance = false;
+ if(!GuiContext::getCurrent()->_mapOfSubjectComponent.count(instance))
+ {
+ _createdInstance = true;
+ //automatic rename of the component instance by the proc on first execute
+ DEBTRACE("name given to proc:" << _nameInProc);
+ proc->addComponentInstance(instance,_nameInProc, true);
+ _nameInProc= instance->getInstanceName();
+ DEBTRACE("name given by proc:" << _nameInProc);
+ subCompo = GuiContext::getCurrent()->getSubjectProc()->addSubjectComponent(instance);
+ }
+ else
+ subCompo = GuiContext::getCurrent()->_mapOfSubjectComponent[instance];
+ YASSERT(subCompo);
+ ssnode->addSubjectReference(subCompo);
+ YASSERT(! ssnode->_subRefComponent);
+ ssnode->_subRefComponent = subCompo->attachService(ssnode);
+ }
+ }
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandAddComponentFromCatalog::localExecute() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+}
+
+bool CommandAddComponentFromCatalog::localReverse()
+{
+ DEBTRACE("CommandAddComponentFromCatalog::localReverse");
+ try
+ {
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ Node* node = proc;
+ if (!_position.empty()) node = proc->getChildByName(_position);
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
+ SubjectNode* snode = GuiContext::getCurrent()->_mapOfSubjectNode[node];
+ SubjectServiceNode *ssnode = dynamic_cast<SubjectServiceNode*>(snode);
+ YASSERT(ssnode);
+
+ DEBTRACE("_nameInProc: " << _nameInProc);
+ YASSERT(proc->componentInstanceMap.count(_nameInProc));
+ ComponentInstance *compo = proc->componentInstanceMap[_nameInProc];
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectComponent.count(compo));
+ SubjectComponent *subCompo = GuiContext::getCurrent()->_mapOfSubjectComponent[compo];
+
+ subCompo->detachService(ssnode);
+ if (subCompo->hasServices())
+ throw YACS::Exception("Component instance with services attached, not removed");
+ Container *cont = compo->getContainer();
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectContainer.count(cont));
+ SubjectContainer *subcont = GuiContext::getCurrent()->_mapOfSubjectContainer[cont];
+ subcont->detachComponent(subCompo);
+ //remove componentInstance from proc, from context
+ if (_createdInstance)
+ {
+ GuiContext::getCurrent()->_mapOfSubjectComponent.erase(compo);
+ proc->removeComponentInstance(compo);
+ }
+ DEBTRACE("_nameInProc: " << _nameInProc);
+ return true;
+ }
+ catch (Exception& ex)
+ {
+ DEBTRACE("CommandAddComponentFromCatalog::localReverse() : " << ex.what());
+ setErrorMsg(ex);
+ return false;
+ }
+}
+
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _COMMANDSPROC_HXX_
#define _COMMANDSPROC_HXX_
+#include "HMIExport.hxx"
#include "commands.hxx"
#include <list>
namespace HMI
{
+ class SubjectNode;
+ class SubjectInputPort;
+ class SubjectOutputPort;
+ class SubjectInputDataStreamPort;
+ class SubjectOutputDataStreamPort;
+ class SubjectLink;
+ class SubjectControlLink;
+ class SubjectContainer;
+ class SubjectComponent;
typedef enum
{
OUTPUTPORT,
INPUTDATASTREAMPORT,
OUTPUTDATASTREAMPORT,
- DATALINK,
- CONTROLLINK,
+ DATALINK,
+ CONTROLLINK,
CONTAINER,
COMPONENT,
REFERENCE,
UNKNOWN
} TypeOfElem;
- class ProcInvoc: public Invocator
+ class HMI_EXPORT ProcInvoc: public Invocator
{
public:
ProcInvoc();
std::string type,
std::string position,
std::string name,
+ bool newCompoInst=true,
int swCase =0);
YACS::ENGINE::Node *getNode();
+ YACS::HMI::SubjectNode *getSubjectNode();
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
YACS::ENGINE::Catalog* _catalog;
- YACS::ENGINE::Node *_nodeToClone;
TypeOfElem _typeNode;
std::string _compoName;
std::string _typeName;
std::string _position;
std::string _name;
+ bool _newCompoInst;
int _swCase;
YACS::ENGINE::Node *_node;
+ YACS::HMI::SubjectNode *_snode;
};
class CommandReparentNode: public Command
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
+ std::string _position;
+ std::string _newParent;
+ std::string _oldParent;
+ std::string _newpos;
+ };
+
+ class CommandPutInComposedNode: public Command
+ {
+ public:
+ CommandPutInComposedNode(std::string position,
+ std::string newParent,std::string type);
+ protected:
+ virtual bool localExecute();
+ virtual bool localReverse();
+ virtual std::string dump();
std::string _position;
std::string _newParent;
+ std::string _type;
+ std::string _newpos;
};
class CommandCopyNode: public Command
{
public:
- CommandCopyNode(std::string position,
- std::string newParent);
+ CommandCopyNode(YACS::ENGINE::Proc* fromproc,
+ std::string position,
+ std::string newParent,
+ int acase=0);
YACS::ENGINE::Node *getNode();
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _position;
std::string _newParent;
+ std::string _newName;
+ int _case;
YACS::ENGINE::Node *_clone;
+ YACS::ENGINE::Proc *_fromproc;
};
class CommandRenameNode: public Command
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _position;
std::string _name;
+ std::string _oldName;
+ std::string _newpos;
};
class CommandRenameContainer: public Command
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _oldName;
std::string _newName;
};
public:
CommandRenameInDataPort(std::string position,
std::string oldName,
- std::string newName);
+ std::string newName, TypeOfElem portType);
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _position;
std::string _oldName;
std::string _newName;
+ TypeOfElem _portType;
};
class CommandRenameOutDataPort: public Command
public:
CommandRenameOutDataPort(std::string position,
std::string oldName,
- std::string newName);
+ std::string newName, TypeOfElem portType);
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _position;
std::string _oldName;
std::string _newName;
+ TypeOfElem _portType;
};
class CommandAddDataTypeFromCatalog: public Command
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
YACS::ENGINE::Catalog* _catalog;
std::string _typeName;
};
std::string node,
std::string name);
YACS::ENGINE::InputPort *getInputPort();
+ SubjectInputPort* getSubjectInputPort();
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
YACS::ENGINE::Catalog* _catalog;
std::string _typePort;
std::string _node;
std::string _name;
YACS::ENGINE::InputPort *_inputPort;
+ SubjectInputPort* _sip;
};
class CommandAddOutputPortFromCatalog: public Command
std::string node,
std::string name);
YACS::ENGINE::OutputPort *getOutputPort();
+ SubjectOutputPort* getSubjectOutputPort();
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
YACS::ENGINE::Catalog* _catalog;
std::string _typePort;
std::string _node;
std::string _name;
YACS::ENGINE::OutputPort *_outputPort;
+ SubjectOutputPort* _sop;
};
class CommandAddIDSPortFromCatalog: public Command
std::string node,
std::string name);
YACS::ENGINE::InputDataStreamPort *getIDSPort();
+ SubjectInputDataStreamPort* getSubjectIDSPort();
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
YACS::ENGINE::Catalog* _catalog;
std::string _typePort;
std::string _node;
std::string _name;
YACS::ENGINE::InputDataStreamPort *_IDSPort;
+ SubjectInputDataStreamPort* _sip;
};
class CommandAddODSPortFromCatalog: public Command
std::string node,
std::string name);
YACS::ENGINE::OutputDataStreamPort *getODSPort();
+ SubjectOutputDataStreamPort* getSubjectODSPort();
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
YACS::ENGINE::Catalog* _catalog;
std::string _typePort;
std::string _node;
std::string _name;
YACS::ENGINE::OutputDataStreamPort *_ODSPort;
+ SubjectOutputDataStreamPort* _sop;
};
class CommandOrderInputPorts: public Command
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _node;
std::string _port;
int _isUp;
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _node;
std::string _port;
int _isUp;
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _node;
std::string _port;
std::string _value;
+ std::string _oldValue;
};
class CommandSetOutPortValue: public Command
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _node;
std::string _port;
std::string _value;
+ std::string _oldValue;
};
class CommandSetSwitchSelect: public Command
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _switch;
std::string _value;
+ std::string _oldValue;
};
class CommandSetSwitchCase: public Command
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _switch;
std::string _node;
+ std::string _oldNode;
std::string _value;
+ int _oldValue;
};
class CommandSetForLoopSteps: public Command
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _forLoop;
std::string _value;
+ int _oldValue;
};
class CommandSetWhileCondition: public Command
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _whileLoop;
std::string _value;
+ bool _oldValue;
};
class CommandSetForEachBranch: public Command
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _forEach;
std::string _value;
+ int _oldValue;
+ };
+
+ class CommandSetAlgo: public Command
+ {
+ public:
+ CommandSetAlgo(std::string optimizer, std::string alglib, std::string symbol);
+ protected:
+ virtual bool localExecute();
+ virtual bool localReverse();
+ virtual std::string dump();
+ std::string _optimizer;
+ std::string _alglib;
+ std::string _symbol;
+ std::string _oldAlglib;
+ std::string _oldSymbol;
};
class CommandAddLink: public Command
{
public:
- CommandAddLink(std::string outNode, std::string outPort,
- std::string inNode, std::string inPort,bool control=true);
+ CommandAddLink(std::string outNode, std::string outPort, TypeOfElem outPortType,
+ std::string inNode, std::string inPort, TypeOfElem inPortType, bool control=true);
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _outNode;
std::string _outPort;
+ TypeOfElem _outPortType;
std::string _inNode;
std::string _inPort;
+ TypeOfElem _inPortType;
bool _control;
+ bool _controlCreatedWithDF;
};
class CommandAddControlLink: public Command
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _outNode;
std::string _inNode;
};
public:
CommandAddContainer(std::string name,
std::string refContainer ="");
- virtual YACS::ENGINE::Container* getContainer();
+ SubjectContainer* getSubjectContainer() { return _subcont; };
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _name;
std::string _containerToClone;
- YACS::ENGINE::Container* _container;
+ SubjectContainer *_subcont;
};
class CommandSetContainerProperties: public Command
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _container;
std::map<std::string,std::string> _properties;
+ std::map<std::string,std::string> _oldProp;
+ };
+
+ class CommandSetNodeProperties: public Command
+ {
+ public:
+ CommandSetNodeProperties(std::string position,
+ std::map<std::string,std::string> properties);
+ protected:
+ virtual bool localExecute();
+ virtual bool localReverse();
+ virtual std::string dump();
+ std::string _position;
+ std::map<std::string,std::string> _properties;
+ std::map<std::string,std::string> _oldProp;
+ };
+
+ class CommandSetComponentInstanceProperties: public Command
+ {
+ public:
+ CommandSetComponentInstanceProperties(std::string compoinstance,
+ std::map<std::string,std::string> properties);
+ protected:
+ virtual bool localExecute();
+ virtual bool localReverse();
+ virtual std::string dump();
+ std::string _compoinstance;
+ std::map<std::string,std::string> _properties;
+ std::map<std::string,std::string> _oldProp;
+ bool _oldAnon;
};
class CommandSetDSPortProperties: public Command
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _nodeName;
std::string _portName;
bool _isInport;
std::map<std::string,std::string> _properties;
+ std::map<std::string,std::string> _oldProp;
+ };
+
+ class CommandSetLinkProperties: public Command
+ {
+ public:
+ CommandSetLinkProperties(std::string startnode, std::string startport,
+ std::string endnode, std::string endport,
+ std::map<std::string,std::string> properties);
+ protected:
+ virtual bool localExecute();
+ virtual bool localReverse();
+ virtual std::string dump();
+ std::string _startNodeName;
+ std::string _startPortName;
+ std::string _endNodeName;
+ std::string _endPortName;
+ std::map<std::string,std::string> _properties;
+ std::map<std::string,std::string> _oldProp;
};
class CommandSetFuncNodeFunctionName: public Command
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _nodeName;
std::string _funcName;
+ std::string _oldName;
};
class CommandSetInlineNodeScript: public Command
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _nodeName;
std::string _script;
+ std::string _oldScript;
};
class CommandAddComponentInstance: public Command
{
public:
- CommandAddComponentInstance(std::string compoName);
- virtual YACS::ENGINE::ComponentInstance* getComponentInstance();
+ CommandAddComponentInstance(std::string compoName,
+ std::string container,
+ std::string name ="");
+ SubjectComponent* getSubjectComponent() {return _subcompo; };
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _compoName;
- YACS::ENGINE::ComponentInstance *_compoInst;
+ std::string _container;
+ std::string _name;
+ SubjectComponent *_subcompo;
+ };
+
+ class CommandSetExecutionMode: public Command
+ {
+ public:
+ CommandSetExecutionMode(std::string nodeName, std::string mode);
+ protected:
+ virtual bool localExecute();
+ virtual bool localReverse();
+ virtual std::string dump();
+ std::string _mode;
+ std::string _nodeName;
+ std::string _oldmode;
+ };
+
+ class CommandSetContainer: public Command
+ {
+ public:
+ CommandSetContainer(std::string nodeName, std::string container);
+ protected:
+ virtual bool localExecute();
+ virtual bool localReverse();
+ virtual std::string dump();
+ std::string _container;
+ std::string _nodeName;
+ std::string _oldcont;
};
class CommandAssociateComponentToContainer: public Command
{
public:
- CommandAssociateComponentToContainer(std::pair<std::string,int> key,
+ CommandAssociateComponentToContainer(std::string instanceName,
std::string container);
protected:
virtual bool localExecute();
virtual bool localReverse();
- std::pair<std::string,int> _key;
+ virtual std::string dump();
std::string _container;
+ std::string _instanceName;
+ std::string _oldcont;
};
class CommandAssociateServiceToComponent: public Command
{
public:
CommandAssociateServiceToComponent(std::string service,
- std::pair<std::string,int> key);
+ std::string instanceName);
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
std::string _service;
- std::pair<std::string,int> _key;
+ std::string _instanceName;
+ std::string _oldInstance;
+ std::string _oldcont;
};
+ class CommandAddComponentFromCatalog: public Command
+ {
+ public:
+ CommandAddComponentFromCatalog(YACS::ENGINE::Catalog* catalog,
+ std::string position,
+ std::string compo,
+ std::string service);
+ protected:
+ virtual bool localExecute();
+ virtual bool localReverse();
+ virtual std::string dump();
+ YACS::ENGINE::Catalog* _catalog;
+ std::string _position;
+ std::string _compo;
+ std::string _service;
+ std::string _nameInProc;
+ bool _createdInstance;
+ };
+
+
class Subject;
class CommandDestroy: public Command
{
public:
- CommandDestroy(std::string position, Subject* subject);
+ CommandDestroy(TypeOfElem elemType,
+ std::string startnode, std::string startport, TypeOfElem startportType,
+ std::string endnode, std::string endport, TypeOfElem endportType);
protected:
virtual bool localExecute();
virtual bool localReverse();
+ virtual std::string dump();
protected:
- std::string _position;
- Subject* _subject;
+ TypeOfElem _elemType;
+ std::string _startnode;
+ std::string _startport;
+ TypeOfElem _startportType;
+ std::string _endnode;
+ std::string _endport;
+ TypeOfElem _endportType;
+
+// std::string _position;
+// Subject* _subject;
+// std::string _name;
};
}
+++ /dev/null
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>diChooseName</class>
-<widget class="QDialog">
- <property name="name">
- <cstring>diChooseName</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>378</width>
- <height>163</height>
- </rect>
- </property>
- <property name="caption">
- <string>Choose Name</string>
- </property>
- <property name="sizeGripEnabled">
- <bool>true</bool>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLayoutWidget" row="0" column="0">
- <property name="name">
- <cstring>layout13</cstring>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLayoutWidget" row="1" column="0">
- <property name="name">
- <cstring>Layout1</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <property name="margin">
- <number>0</number>
- </property>
- <property name="spacing">
- <number>6</number>
- </property>
- <widget class="QPushButton">
- <property name="name">
- <cstring>buttonHelp</cstring>
- </property>
- <property name="text">
- <string>&Help</string>
- </property>
- <property name="accel">
- <string>F1</string>
- </property>
- <property name="autoDefault">
- <bool>true</bool>
- </property>
- </widget>
- <spacer>
- <property name="name">
- <cstring>Horizontal Spacing2</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget class="QPushButton">
- <property name="name">
- <cstring>buttonOk</cstring>
- </property>
- <property name="text">
- <string>&OK</string>
- </property>
- <property name="accel">
- <string></string>
- </property>
- <property name="autoDefault">
- <bool>true</bool>
- </property>
- <property name="default">
- <bool>true</bool>
- </property>
- </widget>
- <widget class="QPushButton">
- <property name="name">
- <cstring>buttonCancel</cstring>
- </property>
- <property name="text">
- <string>&Cancel</string>
- </property>
- <property name="accel">
- <string></string>
- </property>
- <property name="autoDefault">
- <bool>true</bool>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget class="QLayoutWidget" row="0" column="0">
- <property name="name">
- <cstring>layout12</cstring>
- </property>
- <vbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLayoutWidget">
- <property name="name">
- <cstring>layout9</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>tlParent</cstring>
- </property>
- <property name="text">
- <string>parent:</string>
- </property>
- </widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>tlParentPath</cstring>
- </property>
- <property name="text">
- <string>path of parent item</string>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget class="QLayoutWidget">
- <property name="name">
- <cstring>layout10</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>tlItemType</cstring>
- </property>
- <property name="text">
- <string>item type:</string>
- </property>
- </widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>tlTypeValue</cstring>
- </property>
- <property name="text">
- <string>type of item</string>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget class="QLayoutWidget">
- <property name="name">
- <cstring>layout11</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>textLabel3</cstring>
- </property>
- <property name="text">
- <string>name:</string>
- </property>
- </widget>
- <widget class="QLineEdit">
- <property name="name">
- <cstring>leName</cstring>
- </property>
- </widget>
- </hbox>
- </widget>
- </vbox>
- </widget>
- </grid>
- </widget>
- </grid>
-</widget>
-<connections>
- <connection>
- <sender>buttonOk</sender>
- <signal>clicked()</signal>
- <receiver>diChooseName</receiver>
- <slot>accept()</slot>
- </connection>
- <connection>
- <sender>buttonCancel</sender>
- <signal>clicked()</signal>
- <receiver>diChooseName</receiver>
- <slot>reject()</slot>
- </connection>
-</connections>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#include "editCanvas.h"
-#include "guiContext.hxx"
-
-//#define _DEVDEBUG_
-#include "YacsTrace.hxx"
-
-#include <string>
-#include <cassert>
-
-using namespace std;
-
-using namespace YACS;
-using namespace YACS::HMI;
-
-#define LX 60
-#define LY 40
-#define OX 20
-#define OY 5
-#define PX 6
-#define PY 6
-#define DX 3
-#define DY 3
-
-// ----------------------------------------------------------------------------
-
-EditCanvas::EditCanvas( YACS::HMI::Subject *context,
- QCanvas* c, QWidget* parent,
- const char* name, WFlags f)
- : GuiObserver(), _context(context), QCanvasView(c,parent,name,f)
-{
- _context->attach(this);
- //_previousSelected = 0;
-}
-
-void EditCanvas::update(GuiEvent event, int type, Subject* son)
-{
- DEBTRACE("editCanvas::update");
- switch (event)
- {
- case YACS::HMI::NEWROOT:
- setNewRoot(son);
- break;
- default:
- DEBTRACE("editCanvas::update(), event not handled: "<< event);
- }
-}
-
-void EditCanvas::setNewRoot(YACS::HMI::Subject *root)
-{
- YACS::ENGINE::Proc* proc = GuiContext::getCurrent()->getProc();
-// SubjectProc* subjectProc =GuiContext::getCurrent()->getSubjectProc();
- _rootItem = new ComposedNodeCanvasItem(0, proc->getName(), root);
-}
-
-void EditCanvas::contentsMousePressEvent(QMouseEvent* e)
-{
- QCanvasItemList l = canvas()->collisions(e->pos());
- double zmax = - 1.E9;
- QCanvasItem *item = 0;
- for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it)
- {
-// if ( (*it)->rtti() == QCanvasRectangle::RTTI )
-// DEBTRACE("A QCanvasRectangle lies somewhere at this point");
- if ((*it)->z() > zmax)
- {
- zmax = (*it)->z();
- item = *it;
- }
- }
- if (item)
- {
- CanvasItem* citem = dynamic_cast<CanvasItem*>(item);
- if (citem)
- citem->getSubject()->select(true);
- }
-}
-
-// ----------------------------------------------------------------------------
-
-CanvasItem::CanvasItem(CanvasItem *parent, QString label, Subject* subject) :
- GuiObserver(), QCanvasRectangle(OX,OY,LX,LY,YACS::HMI::GuiContext::getCurrent()->getCanvas())
-{
- _parent = parent;
- _label = label;
- _subject = subject;
- _subject->attach(this);
- _level = 1;
- _root = this;
- if (_parent)
- {
- _level = _parent->getLevel() +1;
- _root = _parent->getRoot();
- }
- _ofx = OX; _ofy = OY; _lx = LX; _ly = LY;
-}
-
-CanvasItem::~CanvasItem()
-{
- DEBTRACE("CanvasItem::~CanvasItem " << _subject->getName());
- QCanvasItem* can = GuiContext::getCurrent()->getSelectedCanvasItem();
- if (can == this)
- GuiContext::getCurrent()->setSelectedCanvasItem(0);
-// QCanvas * canvas = GuiContext::getCurrent()->getCanvas();
-// canvas->update();
-}
-
-CanvasItem *CanvasItem::getParent()
-{
- return _parent;
-}
-
-CanvasItem *CanvasItem::getRoot()
-{
- return _root;
-}
-
-void CanvasItem::select(bool isSelected)
-{
- DEBTRACE("CanvasItem::select: " << isSelected << " " << this);
- QColor col;
- if (isSelected)
- {
- col = getSelectedColor();
- QCanvasItem* can = GuiContext::getCurrent()->getSelectedCanvasItem();
- if (can)
- {
- CanvasItem* citem = dynamic_cast<CanvasItem*>(can);
- DEBTRACE("previous: " << citem);
- if (citem != this)
- {
- assert(citem);
- citem->select(false);
- }
- }
- GuiContext::getCurrent()->setSelectedCanvasItem(this);
- }
- else
- col = getNormalColor();
- setBrush(col);
- show();
- QCanvas * canvas = GuiContext::getCurrent()->getCanvas();
- canvas->update();
-}
-
-QColor CanvasItem::getNormalColor()
-{
- return QColor(180,180,180);
-}
-
-QColor CanvasItem::getSelectedColor()
-{
- return QColor(215,215,215);
-}
-
-Subject* CanvasItem::getSubject()
-{
- return _subject;
-}
-
-int CanvasItem::getLevel()
-{
- return _level;
-}
-
-int CanvasItem::getOfx()
-{
- _ofx = (_level +1)*OX;
- return _ofx;
-}
-
-int CanvasItem::getOfy()
-{
- int oy = OY;
- if (_parent)
- {
- ComposedNodeCanvasItem* parent = dynamic_cast<ComposedNodeCanvasItem*>(_parent);
- assert(parent);
- oy = parent->getOfyChild(this);
- }
- _ofy = oy;
- return _ofy;
-}
-
-int CanvasItem::getLx()
-{
- return _lx;
-}
-
-int CanvasItem::getLy()
-{
- return _ly;
-}
-
-int CanvasItem::getOfxInPort(CanvasItem *child)
-{
- return getOfx() +DX; // used only in derivation
-}
-
-int CanvasItem::getOfxOutPort(CanvasItem *child)
-{
- return getOfy() +DY; // used only in derivation
-}
-
-void CanvasItem::redraw()
-{
-// DEBTRACE("CanvasItem::redraw");
-}
-
-void CanvasItem::drawNode(int ofx, int ofy, int lx, int ly, int level)
-{
- setBrush(getNormalColor());
- setPen( QPen(Qt::black, 2) );
- setSize(lx,ly);
- setX(ofx);
- setY(ofy);
- setZ(level);
- show();
-}
-
-// ----------------------------------------------------------------------------
-
-NodeCanvasItem::NodeCanvasItem(CanvasItem *parent, QString label, Subject* subject)
- : CanvasItem(parent, label, subject)
-{
- _inPorts.clear();
- _outPorts.clear();
-}
-
-NodeCanvasItem::~NodeCanvasItem()
-{
- DEBTRACE("NodeCanvasItem::~NodeCanvasItem " << _subject->getName());
-}
-
-void NodeCanvasItem::removeInPort(CanvasItem* inport)
-{
- _inPorts.remove(inport);
-}
-
-void NodeCanvasItem::removeOutPort(CanvasItem* outport)
-{
- _outPorts.remove(outport);
-}
-
-// ----------------------------------------------------------------------------
-
-ElementaryNodeCanvasItem::ElementaryNodeCanvasItem(CanvasItem *parent, QString label, Subject* subject)
- : NodeCanvasItem(parent, label, subject)
-{
-}
-
-ElementaryNodeCanvasItem::~ElementaryNodeCanvasItem()
-{
- DEBTRACE("ElementaryNodeCanvasItem::~ElementaryNodeCanvasItem " << _subject->getName());
- if (_parent)
- {
- ComposedNodeCanvasItem* cnci = dynamic_cast<ComposedNodeCanvasItem*>(_parent);
- if (cnci) cnci->removeChild(this);
- }
-}
-
-int ElementaryNodeCanvasItem::getLx()
-{
- return LX;
-}
-
-int ElementaryNodeCanvasItem::getLy()
-{
- return LY;
-}
-
-void ElementaryNodeCanvasItem::update(GuiEvent event, int type, Subject* son)
-{
- DEBTRACE("ElementaryNodeCanvasItem::update");
- CanvasItem *item;
- switch (event)
- {
- case YACS::HMI::ADD:
- switch (type)
- {
- case YACS::HMI::INPUTPORT:
- case YACS::HMI::INPUTDATASTREAMPORT:
- item = new InPortCanvasItem(this,
- son->getName(),
- son);
- _inPorts.push_back(item);
- _root->redraw();
- break;
- case YACS::HMI::OUTPUTPORT:
- case YACS::HMI::OUTPUTDATASTREAMPORT:
- item = new OutPortCanvasItem(this,
- son->getName(),
- son);
- _outPorts.push_back(item);
- _root->redraw();
- break;
- default:
- DEBTRACE("ElementaryNodeCanvasItem::update() ADD, type not handled:" << type);
- }
- break;
- default:
- DEBTRACE("ElementaryNodeCanvasItem::update(), event not handled: << event");
- }
-}
-
-void ElementaryNodeCanvasItem::redraw()
-{
-// DEBTRACE(" ElementaryNodeCanvasItem::redraw() "<<getOfx()<<" "<<getOfy()<<" "<<getLx()<<" "<<getLy());
- QCanvas * canvas = GuiContext::getCurrent()->getCanvas();
- drawNode(getOfx(), getOfy(), getLx(), getLy(), getLevel());
- for (list<CanvasItem*>::iterator it = _inPorts.begin(); it!=_inPorts.end(); ++it)
- (*it)->redraw();
- for (list<CanvasItem*>::iterator it = _outPorts.begin(); it!=_outPorts.end(); ++it)
- (*it)->redraw();
- canvas->update();
-}
-
-QColor ElementaryNodeCanvasItem::getNormalColor()
-{
- return QColor(171,167,118);
-}
-
-QColor ElementaryNodeCanvasItem::getSelectedColor()
-{
- return QColor(219,213,151);
-}
-
-int ElementaryNodeCanvasItem::getOfxInPort(CanvasItem *child)
-{
- int ofx = getOfx() +DX;
- for (list<CanvasItem*>::iterator it = _inPorts.begin(); it!=_inPorts.end(); ++it)
- {
- if ((*it) == static_cast<CanvasItem*>(child)) break;
- else ofx += PX+ DX;
- }
- return ofx;
-}
-
-int ElementaryNodeCanvasItem::getOfxOutPort(CanvasItem *child)
-{
- int ofx = getOfx() +DX;
- for (list<CanvasItem*>::iterator it = _outPorts.begin(); it!=_outPorts.end(); ++it)
- {
- if ((*it) == static_cast<CanvasItem*>(child)) break;
- else ofx += PX+ DX;
- }
- return ofx;
-}
-
-// ----------------------------------------------------------------------------
-
-ComposedNodeCanvasItem::ComposedNodeCanvasItem(CanvasItem *parent, QString label, Subject* subject)
- : NodeCanvasItem(parent, label, subject)
-{
- _children.clear();
-}
-
-
-ComposedNodeCanvasItem::~ComposedNodeCanvasItem()
-{
- DEBTRACE("ComposedNodeCanvasItem::~ComposedNodeCanvasItem " << _subject->getName());
- if (_parent)
- {
- ComposedNodeCanvasItem* cnci = dynamic_cast<ComposedNodeCanvasItem*>(_parent);
- if (cnci) cnci->removeChild(this);
- }
-}
-
-int ComposedNodeCanvasItem::getLx()
-{
- int lx = 0;
- for (list<CanvasItem*>::iterator it = _children.begin(); it!=_children.end(); ++it)
- {
- int val = (*it)->getLx();
- if (val > lx) lx = val;
- }
- if (lx == 0) lx = LX;
- lx += 2*OX;
- _lx = lx;
- return _lx;
-}
-
-int ComposedNodeCanvasItem::getLy()
-{
- int ly = 0;
- for (list<CanvasItem*>::iterator it = _children.begin(); it!=_children.end(); ++it)
- ly += (*it)->getLy() + OY;
- if (ly == 0) ly = LY + OY;
- ly += OY;
- _ly = ly;
- return _ly;
-}
-
-int ComposedNodeCanvasItem::getOfyChild(CanvasItem *child)
-{
- int oy = getOfy();
- for (list<CanvasItem*>::iterator it = _children.begin(); it!=_children.end(); ++it)
- {
- if ((*it) == static_cast<CanvasItem*>(child)) break;
- else oy += (*it)->getLy() + OY;
- }
- oy += OY;
- return oy;
-}
-
-
-void ComposedNodeCanvasItem::update(GuiEvent event, int type, Subject* son)
-{
- DEBTRACE("ComposedNodeCanvasItem::update");
- CanvasItem *item;
- switch (event)
- {
- case YACS::HMI::ADD:
- switch (type)
- {
- case YACS::HMI::BLOC:
- case YACS::HMI::FORLOOP:
- case YACS::HMI::WHILELOOP:
- case YACS::HMI::SWITCH:
- case YACS::HMI::FOREACHLOOP:
- case YACS::HMI::OPTIMIZERLOOP:
- item = new ComposedNodeCanvasItem(this,
- son->getName(),
- son);
- _children.push_back(item);
- _root->redraw();
- break;
- case YACS::HMI::PYTHONNODE:
- case YACS::HMI::PYFUNCNODE:
- case YACS::HMI::CORBANODE:
- case YACS::HMI::CPPNODE:
- case YACS::HMI::SALOMENODE:
- case YACS::HMI::SALOMEPYTHONNODE:
- case YACS::HMI::XMLNODE:
- case YACS::HMI::PRESETNODE:
- case YACS::HMI::OUTNODE:
- case YACS::HMI::STUDYINNODE:
- case YACS::HMI::STUDYOUTNODE:
- item = new ElementaryNodeCanvasItem(this,
- son->getName(),
- son);
- _children.push_back(item);
- _root->redraw();
- break;
- case YACS::HMI::INPUTPORT:
- case YACS::HMI::INPUTDATASTREAMPORT:
- item = new InPortCanvasItem(this,
- son->getName(),
- son);
- _inPorts.push_back(item);
- _root->redraw();
- break;
- case YACS::HMI::OUTPUTPORT:
- case YACS::HMI::OUTPUTDATASTREAMPORT:
- item = new OutPortCanvasItem(this,
- son->getName(),
- son);
- _outPorts.push_back(item);
- _root->redraw();
- break;
- default:
- DEBTRACE("ComposedNodeCanvasItem::update() ADD, type not handled:" << type);
- }
- break;
- default:
- DEBTRACE("ComposedNodeCanvasItem::update(), event not handled: << event");
- }
-}
-
-void ComposedNodeCanvasItem::removeChild(CanvasItem* child)
-{
- _children.remove(child);
-}
-
-void ComposedNodeCanvasItem::redraw()
-{
-// DEBTRACE(" ComposedNodeCanvasItem::redraw() "<<getOfx()<<" "<<getOfy()<<" "<<getLx()<<" "<<getLy());
- QCanvas * canvas = GuiContext::getCurrent()->getCanvas();
- drawNode(getOfx(), getOfy(), getLx(), getLy(), getLevel());
- for (list<CanvasItem*>::iterator it = _children.begin(); it!=_children.end(); ++it)
- (*it)->redraw();
- for (list<CanvasItem*>::iterator it = _inPorts.begin(); it!=_inPorts.end(); ++it)
- (*it)->redraw();
- for (list<CanvasItem*>::iterator it = _outPorts.begin(); it!=_outPorts.end(); ++it)
- (*it)->redraw();
- canvas->update();
-}
-
-QColor ComposedNodeCanvasItem::getNormalColor()
-{
- return QColor(130,177,149);
-}
-
-QColor ComposedNodeCanvasItem::getSelectedColor()
-{
- return QColor(166,227,191);
-}
-
-int ComposedNodeCanvasItem::getOfxInPort(CanvasItem *child)
-{
- int ofx = getOfx() +DX;
- for (list<CanvasItem*>::iterator it = _inPorts.begin(); it!=_inPorts.end(); ++it)
- {
- if ((*it) == static_cast<CanvasItem*>(child)) break;
- else ofx += PX+ DX;
- }
- return ofx;
-}
-
-int ComposedNodeCanvasItem::getOfxOutPort(CanvasItem *child)
-{
- int ofx = getOfx() +DX;
- for (list<CanvasItem*>::iterator it = _outPorts.begin(); it!=_outPorts.end(); ++it)
- {
- if ((*it) == static_cast<CanvasItem*>(child)) break;
- else ofx += PX+ DX;
- }
- return ofx;
-}
-
-// ----------------------------------------------------------------------------
-
-InPortCanvasItem::InPortCanvasItem(CanvasItem *parent, QString label, Subject* subject)
- : CanvasItem(parent, label, subject)
-{
-}
-
-InPortCanvasItem::~InPortCanvasItem()
-{
- DEBTRACE("InPortCanvasItem::~InPortCanvasItem " << _subject->getName());
- if(_parent)
- {
- NodeCanvasItem* nci = dynamic_cast<NodeCanvasItem*>(_parent);
- if(nci) nci->removeInPort(this);
- }
-}
-
-QColor InPortCanvasItem::getNormalColor()
-{
- return QColor(144,37,37);
-}
-
-QColor InPortCanvasItem::getSelectedColor()
-{
- return QColor(255,66,66);
-}
-
-void InPortCanvasItem::update(GuiEvent event, int type, Subject* son)
-{
- DEBTRACE("InPortCanvasItem::update");
-}
-
-int InPortCanvasItem::getLx()
-{
- return PX;
-}
-
-int InPortCanvasItem::getLy()
-{
- return PY;
-}
-
-int InPortCanvasItem::getOfx()
-{
- int ofx = 0;
- if (_parent)
- {
- ofx = _parent->getOfxInPort(this);
- }
- _ofx = ofx;
- return _ofx;
-}
-
-int InPortCanvasItem::getOfy()
-{
- int ofy = 0;
- if (_parent)
- ofy = _parent->getOfy() + DY;
- _ofy = ofy;
- return _ofy;
-}
-
-void InPortCanvasItem::redraw()
-{
-// DEBTRACE(" InportCanvasItem::redraw() "<<getOfx()<<" "<<getOfy()<<" "<<getLx()<<" "<<getLy());
- QCanvas * canvas = GuiContext::getCurrent()->getCanvas();
- drawNode(getOfx(), getOfy(), getLx(), getLy(), getLevel());
- canvas->update();
-}
-
-// ----------------------------------------------------------------------------
-
-OutPortCanvasItem::OutPortCanvasItem(CanvasItem *parent, QString label, Subject* subject)
- : CanvasItem(parent, label, subject)
-{
-}
-
-OutPortCanvasItem::~OutPortCanvasItem()
-{
- DEBTRACE("OutPortCanvasItem::~OutPortCanvasItem " << _subject->getName());
- if(_parent)
- {
- NodeCanvasItem* nci = dynamic_cast<NodeCanvasItem*>(_parent);
- if(nci) nci->removeOutPort(this);
- }
-}
-
-QColor OutPortCanvasItem::getNormalColor()
-{
- return QColor(144,37,37);
-}
-
-QColor OutPortCanvasItem::getSelectedColor()
-{
- return QColor(255,66,66);
-}
-
-void OutPortCanvasItem::update(GuiEvent event, int type, Subject* son)
-{
- DEBTRACE("OutPortCanvasItem::update");
-}
-
-int OutPortCanvasItem::getLx()
-{
- return PX;
-}
-
-int OutPortCanvasItem::getLy()
-{
- return PY;
-}
-
-int OutPortCanvasItem::getOfx()
-{
- int ofx = 0;
- if (_parent)
- {
- ofx = _parent->getOfxOutPort(this);
- }
- _ofx = ofx;
- return _ofx;
-}
-
-int OutPortCanvasItem::getOfy()
-{
- int ofy = 0;
- if (_parent)
- ofy = _parent->getOfy() + LY -(PY + DY);
- _ofy = ofy;
- return _ofy;
-}
-
-void OutPortCanvasItem::redraw()
-{
-// DEBTRACE(" OutportCanvasItem::redraw() "<<getOfx()<<" "<<getOfy()<<" "<<getLx()<<" "<<getLy());
- QCanvas * canvas = GuiContext::getCurrent()->getCanvas();
- drawNode(getOfx(), getOfy(), getLx(), getLy(), getLevel());
- canvas->update();
-}
-
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#ifndef _EDITCANVAS_H_
-#define _EDITCANVAS_H_
-
-#include "guiObservers.hxx"
-
-#include <qcanvas.h>
-
-#include <string>
-
-namespace YACS
-{
- namespace HMI
- {
- class CanvasItem;
- class ComposedNodeCanvasItem;
-
- class EditCanvas : public QCanvasView, public GuiObserver
- {
- Q_OBJECT
-
- public:
- EditCanvas(YACS::HMI::Subject *context,
- QCanvas* c, QWidget* parent=0, const char* name=0, WFlags f=0);
- virtual void update(GuiEvent event, int type, Subject* son);
- void setNewRoot(YACS::HMI::Subject *root);
-
- protected:
- YACS::HMI::Subject *_context;
- ComposedNodeCanvasItem *_rootItem;
- void contentsMousePressEvent(QMouseEvent* e);
-
- signals:
-
- private:
- };
-
- class CanvasItem : public QCanvasRectangle, public GuiObserver
- {
- public:
- CanvasItem(CanvasItem *parent, QString label, Subject* subject);
- virtual ~CanvasItem();
- CanvasItem *getParent();
- CanvasItem *getRoot();
- virtual void select(bool isSelected);
- virtual QColor getNormalColor();
- virtual QColor getSelectedColor();
- virtual Subject* getSubject();
- int getLevel();
- virtual int getOfx();
- virtual int getOfy();
- virtual int getLx();
- virtual int getLy();
- virtual int getOfxInPort(CanvasItem *child);
- virtual int getOfxOutPort(CanvasItem *child);
- virtual void redraw();
- virtual void drawNode(int ofx, int ofy, int lx, int ly, int level);
- protected:
- Subject* _subject;
- CanvasItem *_parent;
- CanvasItem *_root;
- int _level;
- int _ofx, _ofy, _lx, _ly;
- QString _label;
- };
-
- class NodeCanvasItem: public CanvasItem
- {
- public:
- NodeCanvasItem(CanvasItem *parent, QString label, Subject* subject);
- virtual ~NodeCanvasItem();
- virtual void removeInPort(CanvasItem* inport);
- virtual void removeOutPort(CanvasItem* outport);
- std::list<CanvasItem*> _inPorts;
- std::list<CanvasItem*> _outPorts;
- };
-
- class ElementaryNodeCanvasItem: public NodeCanvasItem
- {
- public:
- ElementaryNodeCanvasItem(CanvasItem *parent, QString label, Subject* subject);
- virtual ~ElementaryNodeCanvasItem();
- virtual QColor getNormalColor();
- virtual QColor getSelectedColor();
- virtual void update(GuiEvent event, int type, Subject* son);
- virtual int getLx();
- virtual int getLy();
- virtual void redraw();
- virtual int getOfxInPort(CanvasItem *child);
- virtual int getOfxOutPort(CanvasItem *child);
- };
-
- class ComposedNodeCanvasItem: public NodeCanvasItem
- {
- public:
- ComposedNodeCanvasItem(CanvasItem *parent, QString label, Subject* subject);
- virtual ~ComposedNodeCanvasItem();
- virtual QColor getNormalColor();
- virtual QColor getSelectedColor();
- virtual void update(GuiEvent event, int type, Subject* son);
- virtual void removeChild(CanvasItem* child);
- virtual int getLx();
- virtual int getLy();
- virtual int getOfyChild(CanvasItem *child);
- virtual void redraw();
- virtual int getOfxInPort(CanvasItem *child);
- virtual int getOfxOutPort(CanvasItem *child);
- protected:
- std::list<CanvasItem*> _children;
- };
-
- class InPortCanvasItem: public CanvasItem
- {
- public:
- InPortCanvasItem(CanvasItem *parent, QString label, Subject* subject);
- virtual ~InPortCanvasItem();
- virtual QColor getNormalColor();
- virtual QColor getSelectedColor();
- virtual void update(GuiEvent event, int type, Subject* son);
- virtual int getLx();
- virtual int getLy();
- virtual int getOfx();
- virtual int getOfy();
- virtual void redraw();
- };
-
- class OutPortCanvasItem: public CanvasItem
- {
- public:
- OutPortCanvasItem(CanvasItem *parent, QString label, Subject* subject);
- virtual ~OutPortCanvasItem();
- virtual QColor getNormalColor();
- virtual QColor getSelectedColor();
- virtual void update(GuiEvent event, int type, Subject* son);
- virtual int getLx();
- virtual int getLy();
- virtual int getOfx();
- virtual int getOfy();
- virtual void redraw();
- };
-
- }
-}
-
-#endif
-
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#include "RuntimeSALOME.hxx"
-#include "editTree.h"
-#include "Proc.hxx"
-#include "Node.hxx"
-#include "guiContext.hxx"
-#include "Catalog.hxx"
-#include "browseCatalog.h"
-#include "chooseName.h"
-#include "ServiceNode.hxx"
-
-#include <iostream>
-
-//#define _DEVDEBUG_
-#include "YacsTrace.hxx"
-
-#include <qpopupmenu.h>
-#include <qfiledialog.h>
-#include <qlabel.h>
-#include <qcursor.h>
-#include <qmessagebox.h>
-
-
-#include <string>
-#include <sstream>
-#include <iostream>
-
-using namespace std;
-
-using namespace YACS;
-using namespace YACS::HMI;
-
-
-/*!
- *
- */
-
-ViewItem::ViewItem(QListView *parent, QString label, Subject* subject)
- : QListViewItem(parent, label)
-{
- _parent = parent;
- _subject = subject;
- _cf = Qt::black;
- _subject->attach(this);
-}
-
-/*!
- *
- */
-
-ViewItem::ViewItem(ViewItem *parent, QString label, Subject* subject)
- : GuiObserver(), QListViewItem(parent, label)
-{
- _parent = parent->getParent();
- _subject = subject;
- _cf = Qt::black;
- _subject->attach(this);
-}
-
-/*!
- *
- */
-
-ViewItem::~ViewItem()
-{
-}
-
-/*!
- *
- */
-
-void ViewItem::setState(int state)
-{
-}
-
-/*!
- *
- */
-
-QListView *ViewItem::getParent()
-{
- return _parent;
-}
-
-/*!
- *
- */
-
-Subject* ViewItem::getSubject()
-{
- return _subject;
-}
-
-/*!
- *
- */
-
-void ViewItem::select(bool isSelected)
-{
- DEBTRACE("ViewItem::select() "<< isSelected << " " << this);
- _parent->setSelected(this, isSelected);
- _parent->ensureItemVisible(this);
-}
-
-void ViewItem::update(GuiEvent event, int type, Subject* son)
-{
- DEBTRACE("ViewItem::update");
- ViewItem *item = 0;
- switch (event)
- {
- case RENAME:
- DEBTRACE("ViewItem::update RENAME " << _subject->getName());
- setText(0,_subject->getName());
- break;
- case ADDREF:
- DEBTRACE("ViewItem::update ADDREF " << _subject->getName());
- item = new ReferenceViewItem(this,
- son->getName(),
- son);
- break;
- default:
- DEBTRACE("ViewItem::update(), event not handled: " << event);
- GuiObserver::update(event, type, son);
- }
-}
-
-/*!
- *
- */
-
-void ViewItem::paintCell( QPainter *p, const QColorGroup &cg,
- int column, int width, int alignment )
-{
- QColorGroup _cg( cg );
- QColor c = _cg.text();
- if (column == 1) _cg.setColor( QColorGroup::Text, _cf );
- QListViewItem::paintCell( p, _cg, column, width, alignment );
- if (column == 1) _cg.setColor( QColorGroup::Text, c );
-}
-
-// ----------------------------------------------------------------------------
-
-/*!
- *
- */
-
-NodeViewItem::NodeViewItem(ViewItem *parent,
- QString label,
- Subject* subject)
- : ViewItem::ViewItem(parent, label, subject)
-{
-}
-
-void NodeViewItem::update(GuiEvent event, int type, Subject* son)
-{
- DEBTRACE("NodeViewItem::update");
- ViewItem *item = 0;
- switch (event)
- {
- case YACS::HMI::ADD:
- switch (type)
- {
- case YACS::HMI::INPUTPORT:
- case YACS::HMI::OUTPUTPORT:
- case YACS::HMI::INPUTDATASTREAMPORT:
- case YACS::HMI::OUTPUTDATASTREAMPORT:
- item = new PortViewItem(this,
- son->getName(),
- son);
- break;
- default:
- DEBTRACE("NodeViewItem::update(), ADD, type not handled: " << type);
- }
- break;
- default:
- DEBTRACE("NodeViewItem::update(), event not handled: " << event);
- ViewItem::update(event, type, son);
- }
-}
-
-// ----------------------------------------------------------------------------
-
-/*!
- *
- */
-
-ComposedNodeViewItem::ComposedNodeViewItem(QListView *parent,
- QString label,
- Subject* subject)
- : ViewItem::ViewItem(parent, label, subject)
-{
-}
-
-/*!
- *
- */
-
-
-ComposedNodeViewItem::ComposedNodeViewItem(ViewItem *parent,
- QString label,
- Subject* subject)
- : ViewItem::ViewItem(parent, label, subject)
-{
-}
-
-void ComposedNodeViewItem::update(GuiEvent event, int type, Subject* son)
-{
- DEBTRACE("ComposedNodeViewItem::update");
- ViewItem *item = 0;
- switch (event)
- {
- case YACS::HMI::ADD:
- switch (type)
- {
- case YACS::HMI::BLOC:
- case YACS::HMI::FORLOOP:
- case YACS::HMI::WHILELOOP:
- case YACS::HMI::SWITCH:
- case YACS::HMI::FOREACHLOOP:
- case YACS::HMI::OPTIMIZERLOOP:
- item = new ComposedNodeViewItem(this,
- son->getName(),
- son);
- break;
- case YACS::HMI::PYTHONNODE:
- case YACS::HMI::PYFUNCNODE:
- case YACS::HMI::CORBANODE:
- case YACS::HMI::CPPNODE:
- case YACS::HMI::SALOMENODE:
- case YACS::HMI::SALOMEPYTHONNODE:
- case YACS::HMI::XMLNODE:
- case YACS::HMI::PRESETNODE:
- case YACS::HMI::OUTNODE:
- case YACS::HMI::STUDYINNODE:
- case YACS::HMI::STUDYOUTNODE:
- item = new NodeViewItem(this,
- son->getName(),
- son);
- break;
- case YACS::HMI::INPUTPORT:
- case YACS::HMI::OUTPUTPORT:
- case YACS::HMI::INPUTDATASTREAMPORT:
- case YACS::HMI::OUTPUTDATASTREAMPORT:
- item = new PortViewItem(this,
- son->getName(),
- son);
- break;
- case YACS::HMI::COMPONENT:
- item = new ComponentViewItem(this,
- son->getName(),
- son);
- break;
- case YACS::HMI::CONTAINER:
- item = new ContainerViewItem(this,
- son->getName(),
- son);
- break;
- case YACS::HMI::DATATYPE:
- item = new DataTypeViewItem(this,
- son->getName(),
- son);
- break;
- default:
- DEBTRACE("ComposedNodeViewItem::update() ADD, type not handled:" << type);
- }
- break;
- case YACS::HMI::ADDLINK:
- case YACS::HMI::ADDCONTROLLINK:
- item = new LinkViewItem(this,
- son->getName(),
- son);
- break;
- default:
- DEBTRACE("ComposedNodeViewItem::update(), event not handled: "<< event);
- ViewItem::update(event, type, son);
- }
-}
-
-// ----------------------------------------------------------------------------
-
-PortViewItem::PortViewItem(ViewItem *parent, QString label, Subject* subject)
- : ViewItem::ViewItem(parent, label, subject)
-{
-}
-
-void PortViewItem::update(GuiEvent event, int type, Subject* son)
-{
- DEBTRACE("PortViewItem::update");
- ViewItem::update(event, type, son);
-}
-
-// ----------------------------------------------------------------------------
-
-LinkViewItem::LinkViewItem(ViewItem *parent, QString label, Subject* subject)
- : ViewItem::ViewItem(parent, label, subject)
-{
-}
-
-void LinkViewItem::update(GuiEvent event, int type, Subject* son)
-{
- DEBTRACE("LinkViewItem::update");
- ViewItem::update(event, type, son);
-}
-
-// ----------------------------------------------------------------------------
-
-ComponentViewItem::ComponentViewItem(ViewItem *parent, QString label, Subject* subject)
- : ViewItem::ViewItem(parent, label, subject)
-{
-}
-
-void ComponentViewItem::update(GuiEvent event, int type, Subject* son)
-{
- DEBTRACE("ComponentViewItem::update");
- ViewItem::update(event, type, son);
-}
-
-// ----------------------------------------------------------------------------
-
-ContainerViewItem::ContainerViewItem(ViewItem *parent, QString label, Subject* subject)
- : ViewItem::ViewItem(parent, label, subject)
-{
-}
-
-void ContainerViewItem::update(GuiEvent event, int type, Subject* son)
-{
- DEBTRACE("ContainerViewItem::update");
- ViewItem::update(event, type, son);
-}
-
-// ----------------------------------------------------------------------------
-
-DataTypeViewItem::DataTypeViewItem(ViewItem *parent, QString label, Subject* subject)
- : ViewItem::ViewItem(parent, label, subject)
-{
-}
-
-void DataTypeViewItem::update(GuiEvent event, int type, Subject* son)
-{
- DEBTRACE("DataTypeViewItem::update");
- ViewItem::update(event, type, son);
-}
-
-// ----------------------------------------------------------------------------
-
-ReferenceViewItem::ReferenceViewItem(ViewItem *parent, QString label, Subject* subject)
- : ViewItem::ViewItem(parent, label, subject)
-{
-}
-
-void ReferenceViewItem::update(GuiEvent event, int type, Subject* son)
-{
- DEBTRACE("ReferenceViewItem::update");
- ViewItem::update(event, type, son);
-}
-
-// ----------------------------------------------------------------------------
-
-
-/*!
- *
- */
-
-editTree::editTree(YACS::HMI::Subject *context,
- QWidget* parent,
- const char* name,
- WFlags fl) : GuiObserver(), wiEditTree(parent, name, fl)
-{
- _context = context;
- _parent = parent;
- _root = 0;
- _previousSelected = 0;
- _selectedSubjectOutPort = 0;
- _selectedSubjectNode = 0;
- _selectedSubjectComponent = 0;
- _selectedSubjectService = 0;
- resetTreeNode(lv);
- _context->attach(this);
- connect( lv, SIGNAL(selectionChanged()),
- this, SLOT(select()) );
-// connect( lv, SIGNAL(clicked(QListViewItem *)),
-// this, SLOT(select()) );
-// connect( lv, SIGNAL(selectionChanged(QListViewItem *)),
-// this, SLOT(select(QListViewItem *)) );
-// connect( lv, SIGNAL(clicked(QListViewItem *)),
-// this, SLOT(select(QListViewItem *)) );
-}
-
-/*!
- *
- */
-
-editTree::~editTree()
-{
-}
-
-void editTree::update(GuiEvent event, int type, Subject* son)
-{
- DEBTRACE("editTree::update");
- switch (event)
- {
- case YACS::HMI::NEWROOT:
- setNewRoot(son);
- break;
- default:
- DEBTRACE("editTree::update(), event not handled: "<< event);
- }
-}
-
-void editTree::setNewRoot(YACS::HMI::Subject *root)
-{
- _root=root;
- _previousSelected=0;
- resetTreeNode(lv);
-}
-
-void editTree::addViewItemInMap(YACS::HMI::ViewItem* item, YACS::HMI::Subject* subject)
-{
- _viewItemsMap[subject] = item;
-}
-
-YACS::HMI::ViewItem* editTree::getViewItem(YACS::HMI::Subject* subject)
-{
- return _viewItemsMap[subject];
-}
-
-/*!
- *
- */
-
-void editTree::resetTreeNode(QListView *lv)
-{
- lv->clear();
- lv->setColumnWidth(0,400);
-// lv->addColumn( "state", 100);
- lv->setRootIsDecorated( TRUE );
- if (_root)
- {
- string name = _root->getName();
- ViewItem *start = new ComposedNodeViewItem(lv, name, _root);
- addViewItemInMap(start, _root);
- }
-}
-
-/*!
- *
- */
-
-void editTree::printName()
-{
- QListViewItem *it = lv->selectedItem();
- if (it)
- {
- DEBTRACE("my name is Bond, James Bond... "<< this);
- }
- else
- {
- DEBTRACE("nobody "<< this);
- }
-}
-
-YACS::HMI::Subject* editTree::getSelectedSubject()
-{
- Subject *sub = 0;
- QListViewItem *it = lv->selectedItem();
- if (it)
- {
- ViewItem *item = dynamic_cast<ViewItem*> (it);
- if (item) sub = item->getSubject();
- }
- return sub;
-}
-
-void editTree::destroy()
-{
- DEBTRACE("editTree::destroy");
- Subject *sub =getSelectedSubject();
- if (sub)
- {
- Subject *parent = sub->getParent();
- if (parent)
- {
- parent->destroy(sub);
- }
- }
-}
-
-void editTree::addLink()
-{
- DEBTRACE("editTree::addLink");
- Subject *sub =getSelectedSubject();
- if (sub)
- {
- if (dynamic_cast<SubjectOutputPort*>(sub) || dynamic_cast<SubjectOutputDataStreamPort*>(sub))
- _selectedSubjectOutPort = static_cast<SubjectDataPort*>(sub);
- else if (dynamic_cast<SubjectNode*>(sub))
- _selectedSubjectNode = static_cast<SubjectNode*>(sub);
- }
-}
-
-void editTree::editPortProperties()
-{
- DEBTRACE("editTree::editPortProperties");
- Subject *sub =getSelectedSubject();
- if (sub)
- {
- if (SubjectOutputDataStreamPort* subODS = dynamic_cast<SubjectOutputDataStreamPort*>(sub))
- {
- map<string, string> properties = subODS->getProperties();
- properties["prop1"] = "val1";
- properties["prop2"] = "val2";
- subODS->setProperties(properties);
- properties = subODS->getProperties();
- map<string, string>::iterator it;
- for (it = properties.begin(); it !=properties.end(); ++it)
- DEBTRACE("OutputDataStreamPort property " << (*it).first << " " << (*it).second);
- }
- else if (SubjectInputDataStreamPort* subIDS = dynamic_cast<SubjectInputDataStreamPort*>(sub))
- {
- map<string, string> properties = subIDS->getProperties();
- properties["prop1"] = "val1";
- properties["prop2"] = "val2";
- subIDS->setProperties(properties);
- properties = subIDS->getProperties();
- map<string, string>::iterator it;
- for (it = properties.begin(); it !=properties.end(); ++it)
- DEBTRACE("InputDataStreamPort property " << (*it).first << " " << (*it).second);
- }
- }
-}
-
-void editTree::addComponent()
-{
- DEBTRACE("editTree::addComponent");
- stringstream name;
- name << "component";
- name << "_" << GuiContext::getCurrent()->getNewId();
- ChooseName chooseName("root", "component", name.str());
- chooseName.exec();
- if (chooseName.isOk())
- {
- string theName = chooseName.getChoosenName();
- bool ret = GuiContext::getCurrent()->getSubjectProc()->addComponent(theName);
- if (!ret) QMessageBox::warning(this, "Component not Created", GuiContext::getCurrent()->_lastErrorMessage );
- }
-}
-
-void editTree::addContainer()
-{
- DEBTRACE("editTree::addContainer");
- std::stringstream name;
- name << "container" << GuiContext::getCurrent()->getNewId();
- ChooseName chooseName("root", "container", name.str());
- chooseName.exec();
- if (chooseName.isOk())
- {
- string theName = chooseName.getChoosenName();
- bool ret = GuiContext::getCurrent()->getSubjectProc()->addContainer(theName);
- if (!ret) QMessageBox::warning(this, "Container not Created", GuiContext::getCurrent()->_lastErrorMessage );
- }
-}
-
-void editTree::associateServiceToComponent()
-{
- DEBTRACE("editTree::associateServiceToComponent");
- Subject *sub =getSelectedSubject();
- if (sub)
- {
- if (SubjectServiceNode *subserv = dynamic_cast<SubjectServiceNode*>(sub))
- _selectedSubjectService = subserv;
- }
-}
-
-void editTree::associateComponentToContainer()
-{
- DEBTRACE("editTree::associateComponentToContainer");
- Subject *sub =getSelectedSubject();
- if (sub)
- {
- if (SubjectComponent *subcomp = dynamic_cast<SubjectComponent*>(sub))
- _selectedSubjectComponent = subcomp;
- }
-}
-
-void editTree::editContainerProperties()
-{
- DEBTRACE("editTree::editContainerProperties");
- Subject *sub =getSelectedSubject();
- if (sub)
- {
- if (SubjectContainer *subcont = dynamic_cast<SubjectContainer*>(sub))
- {
- map<string, string> properties = subcont->getProperties();
- properties["prop1"] = "val1";
- properties["prop2"] = "val2";
- subcont->setProperties(properties);
- properties = subcont->getProperties();
- map<string, string>::iterator it;
- for (it = properties.begin(); it !=properties.end(); ++it)
- DEBTRACE("container property " << (*it).first << " " << (*it).second);
- }
- }
-}
-
-void editTree::newNode(int key)
-{
- DEBTRACE("editTree::newNode(Catalog* catalog, string type): "<< this);
- YACS::ENGINE::Catalog* catalog = _catalogItemsMap[key].first;
- std::string type = _catalogItemsMap[key].second;
- Subject *sub =getSelectedSubject();
- if (sub)
- {
- YACS::HMI::SubjectComposedNode *subject = dynamic_cast< YACS::HMI::SubjectComposedNode*>(sub);
- if (subject)
- {
- std::stringstream name;
- name << type << GuiContext::getCurrent()->getNewId();
- YACS::HMI::SubjectSwitch *aSwitch = dynamic_cast< YACS::HMI::SubjectSwitch*>(subject);
- if (aSwitch)
- {
- map<int, SubjectNode*> bodyMap = aSwitch->getBodyMap();
- int swCase = 0;
- if (bodyMap.empty()) swCase = 1;
- else
- {
- map<int, SubjectNode*>::reverse_iterator rit = bodyMap.rbegin();
- swCase = (*rit).first + 1;
- }
- aSwitch->addNode(catalog, "", type, name.str(), swCase);
- }
- else
- subject->addNode(catalog, "", type, name.str());
- }
- }
- else DEBTRACE("editTree::newNode(Catalog* catalog, string type): no ComposedNode selected "<< this);
-}
-
-void editTree::newNode(YACS::ENGINE::Catalog* catalog,
- Subject* sub,
- std::pair<std::string,std::string> compoServ)
-{
- DEBTRACE("editTree::newNode(catalog, subject, std::pair<std::string,std::string> compoServ)");
- std::string compo = compoServ.first;
- std::string service = compoServ.second;
- std::stringstream name;
- name << compo << "_" << service << GuiContext::getCurrent()->getNewId();
- YACS::HMI::SubjectComposedNode *subject = dynamic_cast< YACS::HMI::SubjectComposedNode*>(sub);
- if (subject)
- {
- YACS::HMI::SubjectSwitch *aSwitch = dynamic_cast< YACS::HMI::SubjectSwitch*>(subject);
- if (aSwitch)
- {
- map<int, SubjectNode*> bodyMap = aSwitch->getBodyMap();
- int swCase = 0;
- if (bodyMap.empty()) swCase = 1;
- else
- {
- map<int, SubjectNode*>::reverse_iterator rit = bodyMap.rbegin();
- swCase = (*rit).first + 1;
- }
- aSwitch->addNode(catalog, compo, service, name.str(), swCase);
- }
- else
- subject->addNode(catalog, compo, service, name.str());
- }
-}
-
-void editTree::newDataType(YACS::ENGINE::Catalog* catalog,
- Subject* sub,
- std::string typeName)
-{
- DEBTRACE("editTree::newDataType " << sub->getName() << " " << typeName);
- YACS::HMI::SubjectProc *subproc = GuiContext::getCurrent()->getSubjectProc();
- subproc->addDataType(catalog, typeName);
-}
-
-
-void editTree::newInputPort(int key)
-{
- DEBTRACE("editTree::newInputPort(Catalog* catalog, string type): "<< this);
- YACS::ENGINE::Catalog* catalog = _catalogItemsMap[key].first;
- std::string type = _catalogItemsMap[key].second;
- Subject *sub =getSelectedSubject();
- newDFInputPort(catalog, sub, type);
-}
-
-void editTree::newOutputPort(int key)
-{
- DEBTRACE("editTree::newOutputPort(Catalog* catalog, string type): "<< this);
- YACS::ENGINE::Catalog* catalog = _catalogItemsMap[key].first;
- std::string type = _catalogItemsMap[key].second;
- Subject *sub =getSelectedSubject();
- newDFOutputPort(catalog, sub, type);
-}
-
-void editTree::newDFInputPort(YACS::ENGINE::Catalog* catalog,
- Subject* sub,
- std::string typeName)
-{
- if (sub)
- {
- YACS::HMI::SubjectElementaryNode *subject = dynamic_cast< YACS::HMI::SubjectElementaryNode*>(sub);
- if (subject)
- {
- std::stringstream name;
- name << "InDF_" << typeName << GuiContext::getCurrent()->getNewId();
- ChooseName chooseName(subject->getName(), typeName, name.str());
- chooseName.exec();
- if (chooseName.isOk())
- {
- string theName = chooseName.getChoosenName();
- bool ret = subject->addInputPort(catalog, typeName, theName);
- if (!ret) QMessageBox::warning(this, "Input Port not Created", GuiContext::getCurrent()->_lastErrorMessage );
- }
- }
- }
-}
-
-void editTree::newDFOutputPort(YACS::ENGINE::Catalog* catalog,
- Subject* sub,
- std::string typeName)
-{
- if (sub)
- {
- YACS::HMI::SubjectElementaryNode *subject = dynamic_cast< YACS::HMI::SubjectElementaryNode*>(sub);
- if (subject)
- {
- std::stringstream name;
- name << "OutDF_" << typeName << GuiContext::getCurrent()->getNewId();
- ChooseName chooseName(subject->getName(), typeName, name.str());
- chooseName.exec();
- if (chooseName.isOk())
- {
- string theName = chooseName.getChoosenName();
- bool ret = subject->addOutputPort(catalog, typeName, theName);
- if (!ret) QMessageBox::warning(this, "Output Port not Created", GuiContext::getCurrent()->_lastErrorMessage );
- }
- }
- }
-}
-
-void editTree::newDSInputPort(YACS::ENGINE::Catalog* catalog,
- Subject* sub,
- std::string typeName)
-{
- if (sub)
- {
- YACS::HMI::SubjectElementaryNode *subject = dynamic_cast< YACS::HMI::SubjectElementaryNode*>(sub);
- if (subject)
- {
- std::stringstream name;
- name << "InDS_" << typeName << GuiContext::getCurrent()->getNewId();
- ChooseName chooseName(subject->getName(), typeName, name.str());
- chooseName.exec();
- if (chooseName.isOk())
- {
- string theName = chooseName.getChoosenName();
- bool ret = subject->addIDSPort(catalog, typeName, theName);
- if (!ret) QMessageBox::warning(this, "Input Port not Created", GuiContext::getCurrent()->_lastErrorMessage );
- }
- }
- }
-}
-
-void editTree::newDSOutputPort(YACS::ENGINE::Catalog* catalog,
- Subject* sub,
- std::string typeName)
-{
- if (sub)
- {
- YACS::HMI::SubjectElementaryNode *subject = dynamic_cast< YACS::HMI::SubjectElementaryNode*>(sub);
- if (subject)
- {
- std::stringstream name;
- name << "OutDS_" << typeName << GuiContext::getCurrent()->getNewId();
- ChooseName chooseName(subject->getName(), typeName, name.str());
- chooseName.exec();
- if (chooseName.isOk())
- {
- string theName = chooseName.getChoosenName();
- bool ret = subject->addODSPort(catalog, typeName, theName);
- if (!ret) QMessageBox::warning(this, "Output Port not Created", GuiContext::getCurrent()->_lastErrorMessage );
- }
- }
- }
-}
-
-
-void editTree::newDFInputPort()
-{
- DEBTRACE("editTree::newDFInputPort");
- Subject *sub =getSelectedSubject();
- if (sub)
- {
- YACS::HMI::SubjectElementaryNode *subject = dynamic_cast< YACS::HMI::SubjectElementaryNode*>(sub);
- if (subject)
- catalog(CATALOGINPUTPORT);
- }
-
-}
-
-void editTree::newDFOutputPort()
-{
- DEBTRACE("editTree::newDFOutputPort");
- Subject *sub =getSelectedSubject();
- if (sub)
- {
- YACS::HMI::SubjectElementaryNode *subject = dynamic_cast< YACS::HMI::SubjectElementaryNode*>(sub);
- if (subject)
- catalog(CATALOGOUTPUTPORT);
- }
-}
-void editTree::newDSInputPort()
-{
- DEBTRACE("editTree::newDSInputPort");
- Subject *sub =getSelectedSubject();
- if (sub)
- {
- YACS::HMI::SubjectElementaryNode *subject = dynamic_cast< YACS::HMI::SubjectElementaryNode*>(sub);
- if (subject)
- catalog(CATALOGIDSPORT);
- }
-
-}
-
-void editTree::newDSOutputPort()
-{
- DEBTRACE("editTree::newDSOutputPort");
- Subject *sub =getSelectedSubject();
- if (sub)
- {
- YACS::HMI::SubjectElementaryNode *subject = dynamic_cast< YACS::HMI::SubjectElementaryNode*>(sub);
- if (subject)
- catalog(CATALOGODSPORT);
- }
-}
-
-void editTree::catalog(int cataType)
-{
- Subject *sub =getSelectedSubject();
- if (sub)
- {
- BrowseCatalog *brCat = new BrowseCatalog(this, sub, cataType);
- brCat->exec();
- }
-}
-
-void editTree::setCatalog(int isproc)
-{
- Subject *sub =getSelectedSubject();
- if (sub)
- {
- if (isproc)
- {
- QString fn = QFileDialog::getOpenFileName( QString::null,
- tr( "XML-Files (*.xml);;All Files (*)" ),
- this,
- "load YACS scheme file dialog as catalog",
- "Choose a filename to load" );
- if ( !fn.isEmpty() )
- {
- YACS::ENGINE::Catalog* aCatalog = YACS::ENGINE::getSALOMERuntime()->loadCatalog( "proc", fn.latin1());
- GuiContext::getCurrent()->setProcCatalog(aCatalog);
- GuiContext::getCurrent()->setCurrentCatalog(aCatalog);
- }
- }
- else
- {
- GuiContext::getCurrent()->setCurrentCatalog(GuiContext::getCurrent()->getSessionCatalog());
- }
- }
-}
-
-
-/*!
- *
- */
-
-void editTree::select()
-{
- DEBTRACE("editTree::select() "<< this);
- QListViewItem *it =lv->selectedItem();
- ViewItem *item = 0;
- if (it) // an item selected
- {
- if (it != _previousSelected) // a new item is selected
- {
- _previousSelected = it;
- item = dynamic_cast<ViewItem*> (it);
- }
- }
- else if (_previousSelected) // nothing selected, deselect previous
- {
- it = _previousSelected;
- _previousSelected = 0;
- item = dynamic_cast<ViewItem*> (it);
- }
- if (item)
- {
- item->getSubject()->select(it->isSelected());
- if (_selectedSubjectOutPort)
- {
- Subject *sub = item->getSubject();
- if (dynamic_cast<SubjectInputPort*>(sub) || dynamic_cast<SubjectInputDataStreamPort*>(sub))
- {
- SubjectDataPort *sdp = dynamic_cast<SubjectDataPort*>(sub);
- assert(sdp);
- SubjectDataPort::tryCreateLink(_selectedSubjectOutPort, sdp);
- _selectedSubjectOutPort = 0;
- }
- }
- if (_selectedSubjectNode)
- {
- Subject *sub = item->getSubject();
- if (SubjectNode* subNode = dynamic_cast<SubjectNode*>(sub))
- {
- SubjectNode::tryCreateLink(_selectedSubjectNode, subNode);
- _selectedSubjectNode = 0;
- }
- }
- if (_selectedSubjectService)
- {
- Subject *sub = item->getSubject();
- if (SubjectComponent *subcomp = dynamic_cast<SubjectComponent*>(sub))
- {
- _selectedSubjectService->associateToComponent(subcomp);
- _selectedSubjectService = 0;
- }
- }
- if (_selectedSubjectComponent)
- {
- Subject *sub = item->getSubject();
- if (SubjectContainer *subcont = dynamic_cast<SubjectContainer*>(sub))
- {
- _selectedSubjectComponent->associateToContainer(subcont);
- _selectedSubjectComponent = 0;
- }
- }
- }
-}
-
-/*!
- *
- */
-
-void editTree::select(QListViewItem *it)
-{
- DEBTRACE("editTree::select(QListViewItem *item) "<< this);
- ViewItem *item = dynamic_cast<ViewItem*> (it);
- if (item) item->getSubject()->select(it->isSelected());
-}
-
-/*!
- *
- */
-
-void editTree::contextMenuEvent( QContextMenuEvent * )
-{
- QListViewItem *it =lv->selectedItem();
- ViewItem *item = 0;
- if (it)
- {
- if (item = dynamic_cast<ComposedNodeViewItem*> (it))
- ComposedNodeContextMenu();
- else if (item = dynamic_cast<NodeViewItem*> (it))
- NodeContextMenu();
- else if (item = dynamic_cast<PortViewItem*> (it))
- PortContextMenu();
- else if (item = dynamic_cast<LinkViewItem*> (it))
- LinkContextMenu();
- else if (item = dynamic_cast<ComponentViewItem*> (it))
- ComponentContextMenu();
- else if (item = dynamic_cast<ContainerViewItem*> (it))
- ContainerContextMenu();
- }
-}
-
-/*!
- *
- */
-
-void editTree::ComposedNodeContextMenu()
-{
- DEBTRACE("editTree::ComposedNodeContextMenu");
- QPopupMenu* contextMenu = new QPopupMenu();
- Q_CHECK_PTR( contextMenu );
- QLabel *caption = new QLabel( "<font color=darkblue><u><b>"
- "ComposedNode Context Menu</b></u></font>",
- contextMenu );
- caption->setAlignment( Qt::AlignCenter );
- int id;
- contextMenu->insertItem( caption );
- contextMenu->insertItem( "Message", this, SLOT(printName()) );
- contextMenu->insertItem( "Delete", this, SLOT(destroy()) );
- contextMenu->insertItem( "add control link to other node", this, SLOT(addLink()) );
- _keymap = 0;
- _catalogItemsMap.clear();
- YACS::ENGINE::Catalog *builtinCatalog = YACS::ENGINE::getSALOMERuntime()->getBuiltinCatalog();
- {
- map<string,YACS::ENGINE::Node*>::iterator it;
- for (it=builtinCatalog->_nodeMap.begin(); it!=builtinCatalog->_nodeMap.end(); ++it)
- {
- string nodeType = "new " + (*it).first;
- //DEBTRACE(nodeType);
- id =contextMenu->insertItem( nodeType.c_str(), this,
- SLOT(newNode(int)) );
- std::pair<YACS::ENGINE::Catalog*, std::string> p(builtinCatalog, (*it).first);
- _catalogItemsMap[_keymap] = p;
- contextMenu->setItemParameter(id, _keymap++);
- }
- }
- {
- map<string,YACS::ENGINE::ComposedNode*>::iterator it;
- for (it=builtinCatalog->_composednodeMap.begin(); it!=builtinCatalog->_composednodeMap.end(); ++it)
- {
- string nodeType = "new " + (*it).first;
- //DEBTRACE(nodeType);
- id =contextMenu->insertItem( nodeType.c_str(), this,
- SLOT(newNode(int)) );
- std::pair<YACS::ENGINE::Catalog*, std::string> p(builtinCatalog, (*it).first);
- _catalogItemsMap[_keymap] = p;
- contextMenu->setItemParameter(id, _keymap++);
- }
- }
- id = contextMenu->insertItem( "set current catalog to session", this, SLOT(setCatalog(int)) );
- contextMenu->setItemParameter(id, 0);
- id = contextMenu->insertItem( "set current catalog to proc", this, SLOT(setCatalog(int)) );
- contextMenu->setItemParameter(id, 1);
- id = contextMenu->insertItem( "new node from current Catalog", this, SLOT(catalog(int)) );
- contextMenu->setItemParameter(id, CATALOGNODE);
- contextMenu->exec( QCursor::pos() );
- delete contextMenu;
-}
-
-/*!
- *
- */
-
-void editTree::NodeContextMenu()
-{
- QPopupMenu* contextMenu = new QPopupMenu();
- Q_CHECK_PTR( contextMenu );
- QLabel *caption = new QLabel( "<font color=darkblue><u><b>"
- "Elementary Node Context Menu</b></u></font>",
- contextMenu );
- caption->setAlignment( Qt::AlignCenter );
- contextMenu->insertItem( caption );
- contextMenu->insertItem( "Message", this, SLOT(printName()) );
- contextMenu->insertItem( "Delete", this, SLOT(destroy()) );
- contextMenu->insertItem( "add Component", this, SLOT(addComponent()) );
- contextMenu->insertItem( "associate to Component", this, SLOT(associateServiceToComponent()) );
- contextMenu->insertItem( "add control link to other node", this, SLOT(addLink()) );
- _keymap = 0;
- _catalogItemsMap.clear();
- YACS::ENGINE::Catalog *builtinCatalog = YACS::ENGINE::getSALOMERuntime()->getBuiltinCatalog();
- {
- int id;
- map<string,YACS::ENGINE::TypeCode*>::iterator it;
- for (it=builtinCatalog->_typeMap.begin(); it!=builtinCatalog->_typeMap.end(); ++it)
- {
- std::pair<YACS::ENGINE::Catalog*, std::string> p(builtinCatalog, (*it).first);
- {
- string typeCode = "new input port " + (*it).first;
- DEBTRACE(typeCode);
- id =contextMenu->insertItem( typeCode.c_str(), this,
- SLOT(newInputPort(int)) );
- _catalogItemsMap[_keymap] = p;
- contextMenu->setItemParameter(id, _keymap++);
- }
- {
- string typeCode = "new output port " + (*it).first;
- DEBTRACE(typeCode);
- id =contextMenu->insertItem( typeCode.c_str(), this,
- SLOT(newOutputPort(int)) );
- _catalogItemsMap[_keymap] = p;
- contextMenu->setItemParameter(id, _keymap++);
- }
- }
- id = contextMenu->insertItem( "set current catalog to session", this, SLOT(setCatalog(int)) );
- contextMenu->setItemParameter(id, 0);
- id = contextMenu->insertItem( "set current catalog to proc", this, SLOT(setCatalog(int)) );
- contextMenu->setItemParameter(id, 1);
- id = contextMenu->insertItem( "new InputPort from catalog", this, SLOT(newDFInputPort()));
- id = contextMenu->insertItem( "new OutputPort from catalog", this, SLOT(newDFOutputPort()));
- id = contextMenu->insertItem( "new DataStream InputPort from catalog", this, SLOT(newDSInputPort()));
- id = contextMenu->insertItem( "new DataStream OutputPort from catalog", this, SLOT(newDSOutputPort()));
- id = contextMenu->insertItem( "add Data Type from current Catalog", this, SLOT(catalog(int)) );
- contextMenu->setItemParameter(id, CATALOGDATATYPE);
- }
- contextMenu->exec( QCursor::pos() );
- delete contextMenu;
-}
-
-void editTree::PortContextMenu()
-{
- QPopupMenu* contextMenu = new QPopupMenu();
- Q_CHECK_PTR( contextMenu );
- QLabel *caption = new QLabel( "<font color=darkblue><u><b>"
- "Port Context Menu</b></u></font>",
- contextMenu );
- caption->setAlignment( Qt::AlignCenter );
- contextMenu->insertItem( caption );
- contextMenu->insertItem( "Message", this, SLOT(printName()) );
- contextMenu->insertItem( "Delete", this, SLOT(destroy()) );
- contextMenu->insertItem( "Add link", this, SLOT(addLink()) );
- contextMenu->insertItem( "edit properties", this, SLOT(editPortProperties()) );
- contextMenu->exec( QCursor::pos() );
- delete contextMenu;
-}
-
-void editTree::LinkContextMenu()
-{
- QPopupMenu* contextMenu = new QPopupMenu();
- Q_CHECK_PTR( contextMenu );
- QLabel *caption = new QLabel( "<font color=darkblue><u><b>"
- "Link Context Menu</b></u></font>",
- contextMenu );
- caption->setAlignment( Qt::AlignCenter );
- contextMenu->insertItem( caption );
- contextMenu->insertItem( "Message", this, SLOT(printName()) );
- contextMenu->insertItem( "Delete", this, SLOT(destroy()) );
- contextMenu->exec( QCursor::pos() );
- delete contextMenu;
-}
-
-void editTree::ComponentContextMenu()
-{
- QPopupMenu* contextMenu = new QPopupMenu();
- Q_CHECK_PTR( contextMenu );
- QLabel *caption = new QLabel( "<font color=darkblue><u><b>"
- "Component Context Menu</b></u></font>",
- contextMenu );
- caption->setAlignment( Qt::AlignCenter );
- contextMenu->insertItem( caption );
- contextMenu->insertItem( "Message", this, SLOT(printName()) );
- contextMenu->insertItem( "add Container", this, SLOT(addContainer()) );
- contextMenu->insertItem( "associate to Container", this, SLOT(associateComponentToContainer()) );
- contextMenu->exec( QCursor::pos() );
- delete contextMenu;
-}
-
-void editTree::ContainerContextMenu()
-{
- QPopupMenu* contextMenu = new QPopupMenu();
- Q_CHECK_PTR( contextMenu );
- QLabel *caption = new QLabel( "<font color=darkblue><u><b>"
- "Container Context Menu</b></u></font>",
- contextMenu );
- caption->setAlignment( Qt::AlignCenter );
- contextMenu->insertItem( caption );
- contextMenu->insertItem( "Message", this, SLOT(printName()) );
- contextMenu->insertItem( "edit container properties", this, SLOT(editContainerProperties()) );
- contextMenu->exec( QCursor::pos() );
- delete contextMenu;
-}
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#ifndef _EDITTREE_H_
-#define _EDITTREE_H_
-
-#include "guiObservers.hxx"
-
-#include "wiedittree.h"
-#include <qlistview.h>
-
-#include <map>
-#include <utility>
-
-namespace YACS
-{
- namespace ENGINE
- {
- class Catalog;
- }
-
- namespace HMI
- {
-
- class ViewItem: public QListViewItem, public GuiObserver
- {
- public:
- ViewItem(QListView *parent, QString label, Subject* subject);
- ViewItem(ViewItem *parent, QString label, Subject* subject);
- virtual ~ViewItem();
- void setState(int state);
- virtual void paintCell( QPainter *p, const QColorGroup &cg,
- int column, int width, int alignment );
- virtual QListView *getParent();
- virtual void select(bool isSelected);
- virtual void update(GuiEvent event, int type, Subject* son);
- virtual Subject* getSubject();
- protected:
- int _state;
- QColor _cf;
- Subject* _subject;
- QListView *_parent;
- };
-
- class editTree: public wiEditTree, public GuiObserver
- {
- Q_OBJECT
-
- public slots:
- void printName();
- void newNode(int key);
- void newNode(YACS::ENGINE::Catalog* catalog,
- Subject* sub,
- std::pair<std::string,std::string> compoServ);
- void newDataType(YACS::ENGINE::Catalog* catalog,
- Subject* sub,
- std::string typeName);
- void newInputPort(int key);
- void newOutputPort(int key);
- void newDFInputPort();
- void newDFOutputPort();
- void newDSInputPort();
- void newDSOutputPort();
- void newDFInputPort(YACS::ENGINE::Catalog* catalog,
- Subject* sub,
- std::string typeName);
- void newDFOutputPort(YACS::ENGINE::Catalog* catalog,
- Subject* sub,
- std::string typeName);
- void newDSInputPort(YACS::ENGINE::Catalog* catalog,
- Subject* sub,
- std::string typeName);
- void newDSOutputPort(YACS::ENGINE::Catalog* catalog,
- Subject* sub,
- std::string typeName);
- void select();
- void select(QListViewItem *it);
- void destroy();
- void addLink();
- void editPortProperties();
- void addComponent();
- void associateServiceToComponent();
- void addContainer();
- void associateComponentToContainer();
- void editContainerProperties();
- void catalog(int cataType);
- void setCatalog(int isproc);
- public:
- editTree(YACS::HMI::Subject *context,
- QWidget* parent = 0,
- const char* name = 0,
- WFlags fl = 0 );
- virtual ~editTree();
- virtual void update(GuiEvent event, int type, Subject* son);
- void setNewRoot(YACS::HMI::Subject *root);
- void addViewItemInMap(YACS::HMI::ViewItem* item, YACS::HMI::Subject* subject);
- YACS::HMI::ViewItem* getViewItem(YACS::HMI::Subject* subject);
- YACS::HMI::Subject* getSelectedSubject();
- protected:
- void contextMenuEvent ( QContextMenuEvent * );
- void ComposedNodeContextMenu();
- void NodeContextMenu();
- void PortContextMenu();
- void LinkContextMenu();
- void ComponentContextMenu();
- void ContainerContextMenu();
- void resetTreeNode(QListView *lv);
- QWidget* _parent;
- Subject *_context;
- Subject *_root;
- QListViewItem *_previousSelected;
- SubjectDataPort *_selectedSubjectOutPort;
- SubjectNode *_selectedSubjectNode;
- SubjectComponent *_selectedSubjectComponent;
- SubjectServiceNode *_selectedSubjectService;
- std::map<YACS::HMI::Subject*,YACS::HMI::ViewItem*> _viewItemsMap;
- std::map<int, std::pair<YACS::ENGINE::Catalog*, std::string> > _catalogItemsMap;
- int _keymap;
- };
-
- class NodeViewItem: public ViewItem
- {
- public:
- NodeViewItem(ViewItem *parent, QString label, Subject* subject);
- virtual void update(GuiEvent event, int type, Subject* son);
- protected:
- };
-
-
- class ComposedNodeViewItem: public ViewItem
- {
- public:
- ComposedNodeViewItem(QListView *parent, QString label, Subject* subject);
- ComposedNodeViewItem(ViewItem *parent, QString label, Subject* subject);
- virtual void update(GuiEvent event, int type, Subject* son);
- protected:
- };
-
- class PortViewItem: public ViewItem
- {
- public:
- PortViewItem(ViewItem *parent, QString label, Subject* subject);
- virtual void update(GuiEvent event, int type, Subject* son);
- protected:
- };
-
- class LinkViewItem: public ViewItem
- {
- public:
- LinkViewItem(ViewItem *parent, QString label, Subject* subject);
- virtual void update(GuiEvent event, int type, Subject* son);
- protected:
- };
-
- class ComponentViewItem: public ViewItem
- {
- public:
- ComponentViewItem(ViewItem *parent, QString label, Subject* subject);
- virtual void update(GuiEvent event, int type, Subject* son);
- protected:
- };
-
- class ContainerViewItem: public ViewItem
- {
- public:
- ContainerViewItem(ViewItem *parent, QString label, Subject* subject);
- virtual void update(GuiEvent event, int type, Subject* son);
- protected:
- };
-
- class DataTypeViewItem: public ViewItem
- {
- public:
- DataTypeViewItem(ViewItem *parent, QString label, Subject* subject);
- virtual void update(GuiEvent event, int type, Subject* son);
- protected:
- };
-
- class ReferenceViewItem: public ViewItem
- {
- public:
- ReferenceViewItem(ViewItem *parent, QString label, Subject* subject);
- virtual void update(GuiEvent event, int type, Subject* son);
- protected:
- };
-
- }
-}
-
-#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "RuntimeSALOME.hxx"
#include "guiContext.hxx"
#include "Proc.hxx"
_proc = 0;
_subjectProc = 0;
_numItem = 0;
+ _isNotSaved = false;
+ _isLoading = false;
_mapOfSubjectNode.clear();
_mapOfSubjectDataPort.clear();
_mapOfSubjectContainer.clear();
_mapOfSubjectDataType.clear();
_mapOfExecSubjectNode.clear();
+ _mapOfLastComponentInstance.clear();
_lastErrorMessage ="";
_xmlSchema ="";
_YACSEngineContainer = pair<string, string>("YACSServer","localhost");
_mapOfSubjectComponent.clear();
_mapOfSubjectContainer.clear();
_mapOfSubjectDataType.clear();
+ _mapOfLastComponentInstance.clear();
+ _lastErrorMessage ="";
_subjectProc = new SubjectProc(proc, this);
_mapOfSubjectNode[static_cast<Node*>(proc)] = _subjectProc;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _GUICONTEXT_HXX_
#define _GUICONTEXT_HXX_
+#include "HMIExport.hxx"
#include "Proc.hxx"
#include "Catalog.hxx"
#include "commandsProc.hxx"
namespace HMI
{
- class GuiContext: public Subject
+ class HMI_EXPORT GuiContext: public Subject
{
public:
GuiContext();
inline long getNewId() {return _numItem++; };
inline std::string getXMLSchema() {return _xmlSchema; };
inline std::pair<std::string, std::string> getYACSCont() {return _YACSEngineContainer; }
+ inline bool isNotSaved() {return _isNotSaved; };
+ inline bool isLoading() {return _isLoading; };
inline void setSessionCatalog(YACS::ENGINE::Catalog* cata) {_sessionCatalog = cata; };
inline void setProcCatalog(YACS::ENGINE::Catalog* cata) {_procCatalog = cata; };
inline void setCurrentCatalog(YACS::ENGINE::Catalog* cata) {_currentCatalog = cata; };
inline void setXMLSchema(std::string xmlSchema) {_xmlSchema = xmlSchema; };
inline void setYACSContainer(std::pair<std::string, std::string> yc) {_YACSEngineContainer = yc; };
+ inline void setNotSaved(bool isNotSaved) {_isNotSaved = isNotSaved; };
+ inline void setLoading(bool isLoading) {_isLoading = isLoading; };
inline static GuiContext* getCurrent() {return _current; };
inline static void setCurrent(GuiContext* context) { _current=context; };
std::map<YACS::ENGINE::Container*, YACS::HMI::SubjectContainer*> _mapOfSubjectContainer;
std::map<std::string, YACS::HMI::SubjectDataType*> _mapOfSubjectDataType;
std::map<int,YACS::HMI::SubjectNode*> _mapOfExecSubjectNode;
+ std::map<std::string, YACS::ENGINE::ComponentInstance*> _mapOfLastComponentInstance;
std::string _lastErrorMessage;
protected:
YACS::HMI::ProcInvoc* _invoc;
YACS::HMI::SubjectProc *_subjectProc;
long _numItem;
+ bool _isNotSaved;
+ bool _isLoading;
static GuiContext* _current;
std::string _xmlSchema;
std::pair<std::string, std::string> _YACSEngineContainer; // --- <ContainerName, HostName>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include <Python.h>
#include "guiObservers.hxx"
#include "commandsProc.hxx"
#include "SalomeComponent.hxx"
#include "ComponentDefinition.hxx"
#include "TypeCode.hxx"
+#include "RuntimeSALOME.hxx"
#include "guiContext.hxx"
// ----------------------------------------------------------------------------
-void Subject::erase(Subject* sub)
+void Subject::erase(Subject* sub, Command *command, bool post)
{
- sub->clean();
+ Subject* parent =sub->getParent();
+ sub->clean(command);
delete sub;
+ if (!post) // --- avoid recursion in erase, see cleanPostErase
+ GuiContext::getCurrent()->getSubjectProc()->cleanPostErase();
}
// ----------------------------------------------------------------------------
Subject::Subject(Subject *parent) : _parent(parent)
{
_destructible = true;
+ _askRegisterUndo = false;
}
/*!
* treatment relative to the derived class, then a call to the parent class clean
* method.
*/
-void Subject::clean()
+void Subject::clean(Command *command)
{
- localClean();
+ localclean(command);
}
/*!
* Remaining Observers in the list are detached, if an observer has no more
* Subject to observe, it can be deleted.
*/
-void Subject::localClean()
+void Subject::localclean(Command *command)
{
DEBTRACE("Subject::localClean ");
set<GuiObserver*>::iterator it;
_setObs.clear();
}
+void Subject::registerUndoDestroy()
+{
+ DEBTRACE("Subject::registerUndoDestroy");
+}
+
void Subject::attach(GuiObserver *obs)
{
DEBTRACE("Subject::attach " << obs);
return false;
}
+std::map<std::string, std::string> Subject::getProperties()
+{
+ std::map<std::string, std::string> empty;
+ return empty;
+}
+
+bool Subject::setProperties(std::map<std::string, std::string> properties)
+{
+ return true;
+}
+
+std::vector<std::string> Subject::knownProperties()
+{
+ std::vector<std::string> empty;
+ return empty;
+}
+
void Subject::select(bool isSelected)
{
DEBTRACE("Subject::select " << isSelected << " " << this);
for (set<GuiObserver *>::iterator it = copySet.begin(); it != copySet.end(); ++it)
{
//DEBTRACE("Subject::update " << *it);
- (*it)->update(event, type, son);
+ try
+ {
+ (*it)->update(event, type, son);
+ }
+ catch(Exception& ex)
+ {
+ std::cerr << "Internal error in Subject::update: " << ex.what() << std::endl;
+ }
+ catch(...)
+ {
+ std::cerr << "Internal error in Subject::update: " << std::endl;
+ }
}
}
return _parent;
}
+void Subject::setParent(Subject* son)
+{
+ _parent=son;
+}
+
+//! From user action in Ihm, destroy an object
+/*!
+ * Called from GuiEditor::DeleteSubject(parent, toRemove).
+ * The subject (this) is the parent of the subject (son) to remove.
+ * Son must represent a Node, a DataPort, a Link or a ControlLink.
+ * All other objects can only be destroyed automatically, not via an user command.
+ * Only the destruction originated from user, using this method, are registered for undo-redo.
+ */
bool Subject::destroy(Subject *son)
{
string toDestroy = son->getName();
DEBTRACE("Subject::destroy " << toDestroy);
Proc *proc = GuiContext::getCurrent()->getProc();
- string position = "";
+ string startnode = "";
+ string endnode = "";
+ string startport = "";
+ string endport = "";
+ TypeOfElem startportType;
+ TypeOfElem endportType;
if (dynamic_cast<SubjectProc*>(son))
- position = proc->getName();
+ startnode = proc->getName();
else
{
if (SubjectNode *subNode = dynamic_cast<SubjectNode*>(son))
{
- if (subNode->getNode()->getFather() )
- position = proc->getChildName(subNode->getNode());
+ if (subNode->getNode()->getFather() )
+ startnode = proc->getChildName(subNode->getNode());
}
else if (dynamic_cast<SubjectDataPort*>(son))
{
SubjectNode *subNodep = dynamic_cast<SubjectNode*>(son->getParent());
- if (dynamic_cast<SubjectProc*>(subNodep))
- position = proc->getName();
- else
- position = proc->getChildName(subNodep->getNode());
+ startnode = proc->getChildName(subNodep->getNode());
+ startport = son->getName();
+ startportType = son->getType();
}
- else if (dynamic_cast<SubjectLink*>(son))
+ else if (SubjectLink* slink = dynamic_cast<SubjectLink*>(son))
{
- SubjectNode *subNodep = dynamic_cast<SubjectNode*>(son->getParent());
- if (dynamic_cast<SubjectProc*>(subNodep))
- position = proc->getName();
- else
- position = proc->getChildName(subNodep->getNode());
+ startnode = proc->getChildName(slink->getSubjectOutNode()->getNode());
+ endnode = proc->getChildName(slink->getSubjectInNode()->getNode());
+ startport = slink->getSubjectOutPort()->getName();
+ endport = slink->getSubjectInPort()->getName();
+ startportType = slink->getSubjectOutPort()->getType();
+ endportType = slink->getSubjectInPort()->getType();
+ }
+ else if (SubjectControlLink* sclink = dynamic_cast<SubjectControlLink*>(son))
+ {
+ startnode = proc->getChildName(sclink->getSubjectOutNode()->getNode());
+ endnode = proc->getChildName(sclink->getSubjectInNode()->getNode());
+ }
+ else if (SubjectContainer* scont = dynamic_cast<SubjectContainer*>(son))
+ {
+ if(scont->getName() == "DefaultContainer")
+ {
+ GuiContext::getCurrent()->_lastErrorMessage = "You can't delete the default container";
+ return false;
+ }
+ if(scont->isUsed())
+ {
+ GuiContext::getCurrent()->_lastErrorMessage = "You can't delete a container that contains components";
+ return false;
+ }
+ startnode = scont->getName();
+ }
+ else
+ {
+ GuiContext::getCurrent()->_lastErrorMessage = "No command Destroy for that type";
+ return false;
}
}
if (son->isDestructible())
{
- CommandDestroy* command = new CommandDestroy(position, son);
+ CommandDestroy* command = new CommandDestroy(son->getType(), startnode, startport, startportType, endnode, endport, endportType);
if (command->execute())
{
DEBTRACE("Destruction done: " << toDestroy);
- update(REMOVE, 0, 0);
+ GuiContext::getCurrent()->getInvoc()->add(command);
return true;
}
else delete command;
// ----------------------------------------------------------------------------
+SubjectObserver::SubjectObserver(Subject* ref):_reference(ref)
+{
+}
+SubjectObserver::~SubjectObserver()
+{
+}
+void SubjectObserver::select(bool isSelected)
+{
+ DEBTRACE("SubjectObserver::select " << isSelected);
+ //propagate nothing
+}
+void SubjectObserver::update(GuiEvent event, int type, Subject* son)
+{
+ DEBTRACE("SubjectObserver::update " << type << "," << eventName(event) << "," << son);
+ //propagate only RENAME events
+ if(event == RENAME)
+ _reference->update(event,type,son);
+}
+
SubjectReference::SubjectReference(Subject* ref, Subject *parent)
: Subject(parent), _reference(ref)
{
+ _sobs=new SubjectObserver(this);
+ ref->attach(_sobs);
}
SubjectReference::~SubjectReference()
{
+ delete _sobs;
}
-void SubjectReference::clean()
+void SubjectReference::clean(Command *command)
{
- localClean();
- Subject::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ Subject::clean(command);
}
-void SubjectReference::localClean()
+void SubjectReference::localclean(Command *command)
{
DEBTRACE("SubjectReference::localClean ");
}
if (father)
try
{
- Bloc *bloc = dynamic_cast<Bloc*>(father);
- if (bloc) bloc->edRemoveChild(_node);
- else
+ // Remove child except if it's the splitter node of a ForEachLoop
+ if (dynamic_cast<ForEachLoop*>(father) == NULL ||
+ getName() != ForEachLoop::NAME_OF_SPLITTERNODE)
{
- Loop *loop = dynamic_cast<Loop*>(father);
- if (loop) loop->edRemoveChild(_node);
- else
- {
- ForEachLoop *feloop = dynamic_cast<ForEachLoop*>(father);
- if (feloop && getName() != ForEachLoop::NAME_OF_SPLITTERNODE) {
- DEBTRACE("SubjectNode::localClean: remove for each loop body");
- feloop->edRemoveChild(_node);
- }
- else
- {
- Switch *aSwitch = dynamic_cast<Switch*>(father);
- if (aSwitch) aSwitch->edRemoveChild(_node);
- }
- }
+ father->edRemoveChild(_node);
}
}
catch (YACS::Exception &e)
}
}
-void SubjectNode::clean()
+void SubjectNode::clean(Command *command)
{
- localClean();
- Subject::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ Subject::clean(command);
}
-void SubjectNode::localClean()
+void SubjectNode::localclean(Command *command)
{
DEBTRACE("SubjectNode::localClean ");
removeExternalLinks();
if (_parent)
{
if( SubjectBloc* sb = dynamic_cast<SubjectBloc*>(_parent) )
- sb->removeNode(this);
+ sb->removeNode(this);
else if( SubjectForLoop* sfl = dynamic_cast<SubjectForLoop*>(_parent) )
- sfl->completeChildrenSubjectList( 0 );
+ sfl->completeChildrenSubjectList( 0 );
else if( SubjectWhileLoop* swl = dynamic_cast<SubjectWhileLoop*>(_parent) )
- swl->completeChildrenSubjectList( 0 );
- else if( SubjectForEachLoop* sfel = dynamic_cast<SubjectForEachLoop*>(_parent) )
- sfel->completeChildrenSubjectList( 0 );
+ swl->completeChildrenSubjectList( 0 );
+ else if( SubjectDynParaLoop* sdpl = dynamic_cast<SubjectDynParaLoop*>(_parent) )
+ sdpl->removeNode(this);
else if( SubjectSwitch* ss = dynamic_cast<SubjectSwitch*>(_parent) )
ss->removeNode(this);
}
}
+void SubjectNode::registerUndoDestroy()
+{
+ DEBTRACE("SubjectNode::registerUndoDestroy " << getName());
+
+ Proc *undoProc = GuiContext::getCurrent()->getInvoc()->getUndoProc();
+ ComposedNode *oldFather = _node->getFather();
+
+ // --- clone the node in undoProc
+
+ ostringstream blocName;
+ blocName << "undoBloc_" << Invocator::_ctr++;
+ Bloc *undoBloc = new Bloc(blocName.str());
+ undoProc->edAddChild(undoBloc);
+ ComposedNode *newFather = undoBloc;
+ Node *clone = _node->clone(0);
+ newFather->edAddChild(clone);
+
+ // --- register a CommandCopyNode from undoProc
+
+ Proc *proc = GuiContext::getCurrent()->getProc();
+ string position = proc->getName();
+ if (proc != dynamic_cast<Proc*>(_node->getFather())) position = proc->getChildName(_node->getFather());
+
+ int swCase=0;
+ if (Switch* aswitch = dynamic_cast<Switch*>(_node->getFather()))
+ {
+ //the node is in a switch, save the case
+ swCase=aswitch->getRankOfNode(_node);
+ }
+
+ CommandCopyNode *command = new CommandCopyNode(undoProc,
+ undoProc->getChildName(clone),
+ position, swCase);
+ GuiContext::getCurrent()->getInvoc()->add(command);
+
+ // --- identify all the children service node
+
+ list<ServiceNode*> serviceList;
+ serviceList.clear();
+ ServiceNode *service = 0;
+ ComposedNode *cnode = 0;
+ if (service = dynamic_cast<ServiceNode*>(_node))
+ serviceList.push_back(service);
+ else
+ cnode = dynamic_cast<ComposedNode*>(_node);
+ if (cnode)
+ {
+ list<Node*> children = cnode->getAllRecursiveNodes();
+ list<Node*>::iterator it = children.begin();
+ for (; it != children.end(); ++it)
+ if (service = dynamic_cast<ServiceNode*>(*it))
+ serviceList.push_back(service);
+ }
+
+ // --- for all the children service node, find the componentInstance,
+ // see if the componentInstance has other services that will stay alive after the destroy
+ // if not, register a CommandAddComponentInstance
+ //
+
+ list<ServiceNode*>::const_iterator ita = serviceList.begin();
+ for (; ita != serviceList.end(); ++ita)
+ {
+ bool instanceUsedOutside = false;
+ service = *ita;
+ ComponentInstance *compo = service->getComponent();
+ if (!compo) break;
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectComponent.count(compo));
+ SubjectComponent *scomp = GuiContext::getCurrent()->_mapOfSubjectComponent[compo];
+ //list<ServiceNode*> compServiceSet;
+ set<SubjectServiceNode*>::const_iterator itset = scomp->_subServiceSet.begin();
+ for (; itset != scomp->_subServiceSet.end(); ++itset)
+ {
+ ServiceNode *sn = dynamic_cast<ServiceNode*>((*itset)->getNode());
+ if (sn && (sn != service))
+ {
+ //compServiceSet.push_back(sn);
+ instanceUsedOutside = true;
+ list<ServiceNode*>::const_iterator itb = serviceList.begin();
+ for (; itb != serviceList.end(); ++itb)
+ {
+ if ((*itb) == sn)
+ {
+ instanceUsedOutside = false;
+ break;
+ }
+ }
+ if (instanceUsedOutside)
+ break;
+ }
+ }
+
+ string instanceName = compo->getInstanceName();
+ if (!instanceUsedOutside)
+ {
+ string compoName = compo->getCompoName();
+ string containerName = compo->getContainer()->getName();
+ CommandAddComponentInstance *comaci = new CommandAddComponentInstance(compoName, containerName, instanceName);
+ GuiContext::getCurrent()->getInvoc()->add(comaci);
+ }
+
+ string servicePos = proc->getChildName(service);
+ CommandAssociateServiceToComponent *comastc = new CommandAssociateServiceToComponent(servicePos,
+ instanceName);
+ GuiContext::getCurrent()->getInvoc()->add(comastc);
+ }
+
+ // --- explore all the external links and register commands for recreation
+
+ vector<pair<OutPort *, InPort *> > listLeaving = getNode()->getSetOfLinksLeavingCurrentScope();
+ vector<pair<InPort *, OutPort *> > listIncoming = getNode()->getSetOfLinksComingInCurrentScope();
+ vector<pair<OutPort *, InPort *> > globalList = listLeaving;
+ vector<pair<InPort *, OutPort *> >::iterator it1;
+ for (it1 = listIncoming.begin(); it1 != listIncoming.end(); ++it1)
+ {
+ pair<OutPort *, InPort *> outin = pair<OutPort *, InPort *>((*it1).second, (*it1).first);
+ globalList.push_back(outin);
+ }
+ vector<pair<OutPort *, InPort *> >::iterator it2;
+ for (it2 = globalList.begin(); it2 != globalList.end(); ++it2)
+ {
+ SubjectLink* subject = 0;
+ if (GuiContext::getCurrent()->_mapOfSubjectLink.count(*it2))
+ {
+ subject = GuiContext::getCurrent()->_mapOfSubjectLink[*it2];
+ YASSERT(subject);
+ DEBTRACE("register undo destroy link " << subject->getName());
+ subject->registerUndoDestroy();
+ }
+ }
+
+ // --- explore all the external control links and register commands for recreation
+
+ list<SubjectControlLink*> cplcl = getSubjectControlLinks();
+ list<SubjectControlLink*>::iterator its;
+ Node* node = getNode();
+ for (its = cplcl.begin(); its != cplcl.end(); ++its)
+ {
+ bool inside = true;
+ Node *nout = (*its)->getSubjectOutNode()->getNode();
+ Node *nin = (*its)->getSubjectInNode()->getNode();
+ inside = inside && (node == nout);
+ inside = inside && (node == nin);
+ if (!inside)
+ {
+ (*its)->registerUndoDestroy();
+ }
+ }
+}
+
bool SubjectNode::reparent(Subject* parent)
{
DEBTRACE("SubjectNode::reparent");
- Subject *sop = getParent(); // --- old parent subject
+ Subject *sub = getParent(); // --- old parent subject
+ SubjectComposedNode *sop = dynamic_cast<SubjectComposedNode*>(sub);
+ YASSERT(sop);
SubjectComposedNode *snp = dynamic_cast<SubjectComposedNode*>(parent); // --- new parent subject
if (!snp)
{
return false;
}
ComposedNode *cnp = dynamic_cast<ComposedNode*>(snp->getNode());
- assert(cnp);
+ YASSERT(cnp);
Proc *proc = GuiContext::getCurrent()->getProc();
+ Proc *fromproc=_node->getProc();
+ if(proc != fromproc)
+ {
+ GuiContext::getCurrent()->_lastErrorMessage = "cut is not yet possible across procs";
+ DEBTRACE(GuiContext::getCurrent()->_lastErrorMessage);
+ return false;
+ }
string position = "";
if (proc != dynamic_cast<Proc*>(_node))
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
- sop->update(CUT, ProcInvoc::getTypeOfNode(_node), this);
- snp->update(PASTE, ProcInvoc::getTypeOfNode(_node), this);
- recursiveUpdate(RENAME, 0, this);
- _parent = snp;
return true;
}
else delete command;
return false;
}
ComposedNode *cnp = dynamic_cast<ComposedNode*>(snp->getNode());
- assert(cnp);
+ YASSERT(cnp);
Proc *proc = GuiContext::getCurrent()->getProc();
+ Proc *fromproc=_node->getProc();
string position = "";
- if (proc != dynamic_cast<Proc*>(_node))
- position = proc->getChildName(_node);
+ if (fromproc != dynamic_cast<Proc*>(_node))
+ position = fromproc->getChildName(_node);
else
position = _node->getName();
else
newParent = cnp->getName();
- CommandCopyNode *command = new CommandCopyNode(position, newParent);
+ CommandCopyNode *command = new CommandCopyNode(fromproc, position, newParent);
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
- Node *clone = command->getNode();
- DEBTRACE(snp->getName());
- DEBTRACE(clone->getName());
- SubjectNode *son = snp->addSubjectNode(clone);
- son->loadChildren();
- son->loadLinks();
return true;
}
else delete command;
return _node;
}
+int SubjectNode::isValid()
+{
+ return _node->isValid();
+}
+
bool SubjectNode::setName(std::string name)
{
DEBTRACE("SubjectNode::setName " << name);
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
- recursiveUpdate(RENAME, 0, this);
return true;
}
else delete command;
update(UPDATE, ntyp , 0 );
}
+void SubjectNode::saveLinks()
+{
+ DEBTRACE("SubjectNode::saveLinks");
+ loutgate= _node->getInGate()->getBackLinks();
+ singate= _node->getOutGate()->edSetInGate();
+ std::list<OutGate *>::const_iterator ito;
+ for(ito=loutgate.begin();ito != loutgate.end();ito++)
+ {
+ Node* n1=(*ito)->getNode();
+ Node* n2=_node;
+ DEBTRACE(n1->getName()<< " " << n2->getName());
+ }
+ std::set<InGate *>::const_iterator iti;
+ for(iti=singate.begin();iti != singate.end();iti++)
+ {
+ Node* n1=_node;
+ Node* n2=(*iti)->getNode();
+ DEBTRACE(n1->getName()<< " " << n2->getName());
+ }
+
+ dataLinks.clear();
+ dataflowLinks.clear();
+
+ std::vector< std::pair<OutPort *, InPort *> > listLeaving = getNode()->getSetOfLinksLeavingCurrentScope();
+ std::vector< std::pair<OutPort *, InPort *> >::iterator it3;
+ for (it3 = listLeaving.begin(); it3 != listLeaving.end(); ++it3)
+ {
+ OutPort* p1=(*it3).first;
+ InPort* p2=(*it3).second;
+ Node* n1=p1->getNode();
+ Node* n2=p2->getNode();
+ //are nodes in sequence (control link direct or indirect) ?
+ ComposedNode* fath= ComposedNode::getLowestCommonAncestor(n1,n2);
+ if(n1 == fath ||n2 == fath)
+ {
+ //consider it as a data only link
+ DEBTRACE("It's a data link: " << n1->getName() << "." << p1->getName() << " -> "<< n2->getName() << "." << p2->getName());
+ dataLinks.push_back(std::pair<OutPort *, InPort *>(p1,p2));
+ continue;
+ }
+ while(n1->getFather() != fath) n1=n1->getFather();
+ while(n2->getFather() != fath) n2=n2->getFather();
+ OutGate* outg=n1->getOutGate();
+ if(!outg->isAlreadyInSet(n2->getInGate()))
+ {
+ DEBTRACE("It's a data link: "<<p1->getNode()->getName()<<"."<<p1->getName()<<" -> "<< p2->getNode()->getName()<<"."<<p2->getName());
+ dataLinks.push_back(std::pair<OutPort *, InPort *>(p1,p2));
+ }
+ else
+ {
+ DEBTRACE("It's a dataflow link: "<<p1->getNode()->getName()<<"."<<p1->getName()<<" -> "<< p2->getNode()->getName()<<"."<<p2->getName());
+ dataflowLinks.push_back(std::pair<OutPort *, InPort *>(p1,p2));
+ }
+ }
+
+ std::vector< std::pair<InPort *, OutPort *> > listIncoming = getNode()->getSetOfLinksComingInCurrentScope();
+ std::vector< std::pair<InPort *, OutPort *> >::iterator it4;
+ for (it4 = listIncoming.begin(); it4 != listIncoming.end(); ++it4)
+ {
+ OutPort* p1=(*it4).second;
+ InPort* p2=(*it4).first;
+ Node* n1=p1->getNode();
+ Node* n2=p2->getNode();
+ //are nodes in sequence (control link direct or indirect) ?
+ ComposedNode* fath= ComposedNode::getLowestCommonAncestor(n1,n2);
+ if(n1 == fath ||n2 == fath)
+ {
+ //consider it as a data only link
+ DEBTRACE("It's a data link: " << n1->getName() << "." << p1->getName() << " -> "<< n2->getName() << "." << p2->getName());
+ dataLinks.push_back(std::pair<OutPort *, InPort *>(p1,p2));
+ continue;
+ }
+ while(n1->getFather() != fath) n1=n1->getFather();
+ while(n2->getFather() != fath) n2=n2->getFather();
+ OutGate* outg=n1->getOutGate();
+ if(!outg->isAlreadyInSet(n2->getInGate()))
+ {
+ DEBTRACE("It's a data link: "<<p1->getNode()->getName()<<"."<<p1->getName()<<" -> "<< p2->getNode()->getName()<<"."<<p2->getName());
+ dataLinks.push_back(std::pair<OutPort *, InPort *>(p1,p2));
+ }
+ else
+ {
+ DEBTRACE("It's a dataflow link: "<<p1->getNode()->getName()<<"."<<p1->getName()<<" -> "<< p2->getNode()->getName()<<"."<<p2->getName());
+ dataflowLinks.push_back(std::pair<OutPort *, InPort *>(p1,p2));
+ }
+ }
+}
+
+void SubjectNode::restoreLinks()
+{
+ DEBTRACE("SubjectNode::restoreLinks");
+ //restore simple data links
+ std::vector< std::pair<OutPort *, InPort *> >::iterator it3;
+ for (it3 = dataLinks.begin(); it3 != dataLinks.end(); ++it3)
+ {
+ OutPort* p1=(*it3).first;
+ InPort* p2=(*it3).second;
+ Node* n1=p1->getNode();
+ Node* n2=p2->getNode();
+ ComposedNode* fath= ComposedNode::getLowestCommonAncestor(n1,n2);
+ try
+ {
+ fath->edAddLink(p1,p2);
+ }
+ catch(Exception& ex)
+ {
+ // if a link can't be restored ignore it. It's possible when a node is reparented to a foreachloop
+ continue;
+ }
+ SubjectComposedNode *scla = dynamic_cast<SubjectComposedNode*>(GuiContext::getCurrent()->_mapOfSubjectNode[fath]);
+ SubjectNode *sno = GuiContext::getCurrent()->_mapOfSubjectNode[static_cast<Node*>(n1)];
+ SubjectNode *sni = GuiContext::getCurrent()->_mapOfSubjectNode[static_cast<Node*>(n2)];
+ SubjectDataPort *spo = GuiContext::getCurrent()->_mapOfSubjectDataPort[static_cast<DataPort*>(p1)];
+ SubjectDataPort *spi = GuiContext::getCurrent()->_mapOfSubjectDataPort[static_cast<DataPort*>(p2)];
+ scla->addSubjectLink(sno,spo,sni,spi);
+ }
+ //restore dataflow links
+ for (it3 = dataflowLinks.begin(); it3 != dataflowLinks.end(); ++it3)
+ {
+ OutPort* p1=(*it3).first;
+ InPort* p2=(*it3).second;
+ Node* n1=p1->getNode();
+ Node* n2=p2->getNode();
+ ComposedNode* fath= ComposedNode::getLowestCommonAncestor(n1,n2);
+ try
+ {
+ fath->edAddDFLink(p1,p2);
+ }
+ catch(Exception& ex)
+ {
+ // if a link can't be restored ignore it. It's possible when a node is reparented to a foreachloop
+ continue;
+ }
+ SubjectComposedNode *scla = dynamic_cast<SubjectComposedNode*>(GuiContext::getCurrent()->_mapOfSubjectNode[fath]);
+ SubjectNode *sno = GuiContext::getCurrent()->_mapOfSubjectNode[static_cast<Node*>(n1)];
+ SubjectNode *sni = GuiContext::getCurrent()->_mapOfSubjectNode[static_cast<Node*>(n2)];
+ SubjectDataPort *spo = GuiContext::getCurrent()->_mapOfSubjectDataPort[static_cast<DataPort*>(p1)];
+ SubjectDataPort *spi = GuiContext::getCurrent()->_mapOfSubjectDataPort[static_cast<DataPort*>(p2)];
+ scla->addSubjectLink(sno,spo,sni,spi);
+ if(n1==fath || n2==fath) continue;
+ while(n1->getFather() != fath) n1=n1->getFather();
+ while(n2->getFather() != fath) n2=n2->getFather();
+ OutGate *ogate = n1->getOutGate();
+ InGate *igate = n2->getInGate();
+ if (ogate->isAlreadyInSet(igate))
+ {
+ pair<Node*,Node*> keyLink(n1,n2);
+ if (!GuiContext::getCurrent()->_mapOfSubjectControlLink.count(keyLink))
+ {
+ SubjectNode *sfno = GuiContext::getCurrent()->_mapOfSubjectNode[static_cast<Node*>(n1)];
+ SubjectNode *sfni = GuiContext::getCurrent()->_mapOfSubjectNode[static_cast<Node*>(n2)];
+ scla->addSubjectControlLink(sfno, sfni);
+ }
+ }
+ }
+
+ //reconnect control links
+ // links from another node to this node
+ std::list<OutGate *>::const_iterator it;
+ for(it=loutgate.begin();it != loutgate.end();it++)
+ {
+ Node* n1=(*it)->getNode();
+ Node* n2=_node;
+ if(GuiContext::getCurrent()->_mapOfSubjectNode.count(n1)==0)
+ {
+ //It's an internal node or a destroyed one : don't treat it
+ continue;
+ }
+ ComposedNode* fath= ComposedNode::getLowestCommonAncestor(n1,n2);
+ if(n1 == fath)continue;
+ if(n2 == fath)continue;
+ //add a control link only if nodes are not in the same descendance
+ while(n1->getFather() != fath) n1=n1->getFather();
+ while(n2->getFather() != fath) n2=n2->getFather();
+ OutGate *ogate = n1->getOutGate();
+ InGate *igate = n2->getInGate();
+ if (!ogate->isAlreadyInSet(igate))
+ {
+ fath->edAddCFLink(n1,n2);
+ SubjectComposedNode *scla = dynamic_cast<SubjectComposedNode*>(GuiContext::getCurrent()->_mapOfSubjectNode[fath]);
+ SubjectNode * subOutNode = GuiContext::getCurrent()->_mapOfSubjectNode[n1];
+ SubjectNode * subInNode = GuiContext::getCurrent()->_mapOfSubjectNode[n2];
+ scla->addSubjectControlLink(subOutNode,subInNode);
+ }
+ }
+
+ std::set<InGate *>::const_iterator it2;
+ for(it2=singate.begin();it2 != singate.end();it2++)
+ {
+ Node* n1=_node;
+ Node* n2=(*it2)->getNode();
+ if(GuiContext::getCurrent()->_mapOfSubjectNode.count(n2)==0)
+ {
+ //It's an internal node or a destroyed one : don't treat it
+ continue;
+ }
+ ComposedNode* fath= ComposedNode::getLowestCommonAncestor(n1,n2);
+ if(n1 == fath)continue;
+ if(n2 == fath)continue;
+ //add a control link only if nodes are not in the same descendance
+ while(n1->getFather() != fath) n1=n1->getFather();
+ while(n2->getFather() != fath) n2=n2->getFather();
+ OutGate *ogate = n1->getOutGate();
+ InGate *igate = n2->getInGate();
+ if (!ogate->isAlreadyInSet(igate))
+ {
+ fath->edAddCFLink(n1,n2);
+ SubjectComposedNode *scla = dynamic_cast<SubjectComposedNode*>(GuiContext::getCurrent()->_mapOfSubjectNode[fath]);
+ SubjectNode * subOutNode = GuiContext::getCurrent()->_mapOfSubjectNode[n1];
+ SubjectNode * subInNode = GuiContext::getCurrent()->_mapOfSubjectNode[n2];
+ scla->addSubjectControlLink(subOutNode,subInNode);
+ }
+ }
+}
+
+bool SubjectNode::putInComposedNode(std::string name,std::string type)
+{
+ Proc *proc = GuiContext::getCurrent()->getProc();
+ string position = "";
+ if (proc != dynamic_cast<Proc*>(_node)) position = proc->getChildName(_node);
+
+ CommandPutInComposedNode *command = new CommandPutInComposedNode(position, name, type);
+ if (command->execute())
+ {
+ GuiContext::getCurrent()->getInvoc()->add(command);
+ return true;
+ }
+ else delete command;
+ DEBTRACE(GuiContext::getCurrent()->_lastErrorMessage);
+ return false;
+}
+
SubjectInputPort* SubjectNode::addSubjectInputPort(YACS::ENGINE::InputPort *port,
std::string name)
{
if (!name.empty()) son->setName(name);
update(ADD, INPUTPORT ,son);
YACS::ENGINE::TypeCode *typcod = port->edGetType();
- GuiContext::getCurrent()->getSubjectProc()->addSubjectDataType(typcod, typcod->name());
+ if (!GuiContext::getCurrent()->getSubjectProc()->addComSubjectDataType(typcod, typcod->name()))
+ GuiContext::getCurrent()->getSubjectProc()->addSubjectDataType(typcod, typcod->name()); // --- new type of forEachLoop
return son;
}
if (!name.empty()) son->setName(name);
update(ADD, OUTPUTPORT ,son);
YACS::ENGINE::TypeCode *typcod = port->edGetType();
- GuiContext::getCurrent()->getSubjectProc()->addSubjectDataType(typcod, typcod->name());
+ GuiContext::getCurrent()->getSubjectProc()->addComSubjectDataType(typcod, typcod->name());
return son;
}
if (!name.empty()) son->setName(name);
update(ADD, INPUTDATASTREAMPORT ,son);
YACS::ENGINE::TypeCode *typcod = port->edGetType();
- GuiContext::getCurrent()->getSubjectProc()->addSubjectDataType(typcod, typcod->name());
+ GuiContext::getCurrent()->getSubjectProc()->addComSubjectDataType(typcod, typcod->name());
return son;
}
if (!name.empty()) son->setName(name);
update(ADD, OUTPUTDATASTREAMPORT ,son);
YACS::ENGINE::TypeCode *typcod = port->edGetType();
- GuiContext::getCurrent()->getSubjectProc()->addSubjectDataType(typcod, typcod->name());
+ GuiContext::getCurrent()->getSubjectProc()->addComSubjectDataType(typcod, typcod->name());
return son;
}
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
- ComposedNode *cla = ComposedNode::getLowestCommonAncestor(outNode->getFather(),
- inNode->getFather());
- SubjectComposedNode *scla = dynamic_cast<SubjectComposedNode*>(subOutNode->getParent());
- ComposedNode *ancestor = outNode->getFather();
- while (ancestor && ancestor != cla)
- {
- ancestor = ancestor->getFather();
- scla = dynamic_cast<SubjectComposedNode*>(scla->getParent());
- assert(scla);
- }
- DEBTRACE(scla->getName());
- scla->addSubjectControlLink(subOutNode,subInNode);
return true;
}
else
if (GuiContext::getCurrent()->_mapOfSubjectLink.count(*it2))
{
subject = GuiContext::getCurrent()->_mapOfSubjectLink[*it2];
- assert(subject);
+ YASSERT(subject);
DEBTRACE("link to remove " << subject->getName());
erase(subject);
GuiContext::getCurrent()->_mapOfSubjectLink.erase(*it2);
}
}
+std::map<std::string, std::string> SubjectNode::getProperties()
+{
+ return _node->getPropertyMap();
+}
+
+bool SubjectNode::setProperties(std::map<std::string, std::string> properties)
+{
+ Proc *proc = GuiContext::getCurrent()->getProc();
+ string position = "";
+ if (proc != dynamic_cast<Proc*>(_node)) position = proc->getChildName(_node);
+
+ CommandSetNodeProperties *command = new CommandSetNodeProperties(position, properties);
+ if (command->execute())
+ {
+ GuiContext::getCurrent()->getInvoc()->add(command);
+ return true;
+ }
+ else delete command;
+ return false;
+}
+
// ----------------------------------------------------------------------------
SubjectComposedNode::SubjectComposedNode(YACS::ENGINE::ComposedNode *composedNode,
DEBTRACE("SubjectComposedNode::~SubjectComposedNode " << getName());
}
-void SubjectComposedNode::clean()
+void SubjectComposedNode::clean(Command *command)
{
- localClean();
- SubjectNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectNode::clean(command);
}
-void SubjectComposedNode::localClean()
+void SubjectComposedNode::localclean(Command *command)
{
DEBTRACE("SubjectComposedNode::localClean ");
}
SubjectNode* SubjectComposedNode::addNode(YACS::ENGINE::Catalog *catalog,
- std::string compo,
- std::string type,
- std::string name)
+ std::string compo,
+ std::string type,
+ std::string name,
+ bool newCompoInst)
{
DEBTRACE("SubjectComposedNode::addNode("<<catalog<<","<<compo<<","<<type<<","<<name<<")");
SubjectNode* body = 0;
+ GuiContext::getCurrent()->_lastErrorMessage = "YACS Internal Error: SubjectComposedNode::addNode";
return body;
}
std::string compo,
std::string type,
std::string name,
+ bool newCompoInst,
int swCase)
{
Proc *proc = GuiContext::getCurrent()->getProc();
type,
position,
name,
+ newCompoInst,
swCase);
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
Node * node = command->getNode();
- SubjectNode *son = addSubjectNode(node,"",catalog,compo,type);
- son->loadChildren();
- son->loadLinks();
- return son;
+ return command->getSubjectNode();
}
else delete command;
return 0;
break;
default:
throw YACS::Exception("Not implemented");
- //assert(0);
+ //YASSERT(0);
}
- assert(son);
+ YASSERT(son);
GuiContext::getCurrent()->_mapOfSubjectNode[static_cast<Node*>(node)] = son;
GuiContext::getCurrent()->_mapOfExecSubjectNode[node->getNumId()] = son;
if (!name.empty()) son->setName(name);
{
try
{
- SubjectNode * son = addSubjectNode(*iter);
- son->loadChildren();
+ SubjectNode * son = addSubjectNode(*iter);
+ son->loadChildren();
}
catch(YACS::Exception& ex)
{
SubjectDataPort *spi)
{
DEBTRACE("SubjectComposedNode::addSubjectLink");
- SubjectLink *son = new SubjectLink(sno, spo, sni, spi, this);
- OutPort *outp = sno->getNode()->getOutPort(spo->getName());
- InPort *inp = sni->getNode()->getInPort(spi->getName());
+ OutPort *outp = dynamic_cast<OutPort*>(spo->getPort());
+ InPort *inp = dynamic_cast<InPort*>(spi->getPort());
pair<OutPort*,InPort*> keyLink(outp,inp);
+ //Don't create a new subject if it already exists
+ if(GuiContext::getCurrent()->_mapOfSubjectLink.count(keyLink)!=0)
+ return GuiContext::getCurrent()->_mapOfSubjectLink[keyLink];
+
+ SubjectLink *son = new SubjectLink(sno, spo, sni, spi, this);
GuiContext::getCurrent()->_mapOfSubjectLink[keyLink] = son;
_listSubjectLink.push_back(son);
spo->addSubjectLink(son);
spi->addSubjectLink(son);
update(ADDLINK, DATALINK, son);
+ spi->update(UPDATE, DATALINK, spo);
+ spo->update(UPDATE, DATALINK, spi);
DEBTRACE("addSubjectLink: " << getName() << " " << son->getName());
return son;
}
void SubjectComposedNode::removeLink(SubjectLink* link)
{
- DEBTRACE("removeSubjectLink: " << link->getName());
+ DEBTRACE("removeLink: " << link->getName());
OutPort *outp = dynamic_cast<OutPort*>(link->getSubjectOutPort()->getPort());
InPort *inp = dynamic_cast<InPort*>(link->getSubjectInPort()->getPort());
SubjectControlLink* SubjectComposedNode::addSubjectControlLink(SubjectNode *sno,
SubjectNode *sni)
{
- SubjectControlLink *son = new SubjectControlLink(sno, sni, this);
Node *outn = sno->getNode();
Node *inn = sni->getNode();
pair<Node*,Node*> keyLink(outn,inn);
+ //Don't create a new subject if it already exists
+ if(GuiContext::getCurrent()->_mapOfSubjectControlLink.count(keyLink)!=0)
+ return GuiContext::getCurrent()->_mapOfSubjectControlLink[keyLink];
+ SubjectControlLink *son = new SubjectControlLink(sno, sni, this);
GuiContext::getCurrent()->_mapOfSubjectControlLink[keyLink] = son;
_listSubjectControlLink.push_back(son);
sno->addSubjectControlLink(son);
}
}
+void SubjectComposedNode::houseKeepingAfterCutPaste(bool isCut, SubjectNode *son)
+{
+}
+
/*!
* loadLinks is used when an existing scheme has been loaded in memory, to create gui representation.
* Gui representation of links is done after node representation (loadChildren).
if (cnSon)
{
SubjectNode *subSon = GuiContext::getCurrent()->_mapOfSubjectNode[static_cast<Node*>(*iter)];
- assert(subSon);
+ YASSERT(subSon);
SubjectComposedNode *subCnSon = dynamic_cast<SubjectComposedNode*>(subSon);
- assert (subCnSon);
+ YASSERT(subCnSon);
subCnSon->loadLinks();
}
}
DEBTRACE("SubjectBloc::~SubjectBloc " << getName());
}
-void SubjectBloc::clean()
+void SubjectBloc::clean(Command *command)
{
- localClean();
- SubjectComposedNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectComposedNode::clean(command);
}
-void SubjectBloc::localClean()
+void SubjectBloc::localclean(Command *command)
{
DEBTRACE("SubjectBloc::localClean ");
set<SubjectNode*>::iterator it;
}
SubjectNode* SubjectBloc::addNode(YACS::ENGINE::Catalog *catalog,
- std::string compo,
- std::string type,
- std::string name)
+ std::string compo,
+ std::string type,
+ std::string name,
+ bool newCompoInst)
{
DEBTRACE("SubjectBloc::addNode( " << catalog << ", " << compo << ", " << type << ", " << name << " )");
- SubjectNode* child = createNode(catalog, compo, type, name);
+ SubjectNode* child = createNode(catalog, compo, type, name, newCompoInst);
return child;
}
+void SubjectBloc::houseKeepingAfterCutPaste(bool isCut, SubjectNode *son)
+{
+ if (isCut)
+ removeNode(son);
+ else
+ completeChildrenSubjectList(son);
+}
+
void SubjectBloc::completeChildrenSubjectList(SubjectNode *son)
{
_children.insert(son);
if (node)
{
- set<SubjectNode*>::iterator it = _children.begin();
+ set<SubjectNode*>::const_iterator it = _children.begin();
for ( ; it != _children.end(); it++ )
if ( (*it)->getNode() == node )
{
- aChild = (*it);
- break;
+ aChild = (*it);
+ break;
}
}
SubjectProc::SubjectProc(YACS::ENGINE::Proc *proc, Subject *parent)
: SubjectBloc(proc, parent), _proc(proc)
{
+ _postEraseList.clear();
}
SubjectProc::~SubjectProc()
DEBTRACE("SubjectProc::~SubjectProc " << getName());
}
-void SubjectProc::clean()
+void SubjectProc::clean(Command *command)
{
- localClean();
- SubjectBloc::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectBloc::clean(command);
}
-void SubjectProc::localClean()
+void SubjectProc::localclean(Command *command)
{
DEBTRACE("SubjectProc::localClean ");
}
+void SubjectProc::cleanPostErase()
+{
+ DEBTRACE("SubjectProc::cleanPostErase");
+ for (int i=0; i<_postEraseList.size(); i++)
+ {
+ DEBTRACE("cleanPostErase " << _postEraseList[i]->getName());
+ erase(_postEraseList[i],0, true); // --- true: do not call recursively erase
+ }
+ _postEraseList.clear();
+}
+
void SubjectProc::loadProc()
{
DEBTRACE("SubjectProc::loadProc " << getName());
+ loadTypes();
loadContainers();
loadComponents();
loadChildren();
loadLinks();
}
+//! Load types for a SubjectProc
+/*!
+ * This method loads (on import or on creation) all types of the builtin catalog and all types defined in the Proc
+ */
+void SubjectProc::loadTypes()
+{
+ Catalog* builtinCatalog = getSALOMERuntime()->getBuiltinCatalog();
+ std::map<std::string, TypeCode *>::iterator pt;
+ for(pt=builtinCatalog->_typeMap.begin();pt!=builtinCatalog->_typeMap.end();pt++)
+ {
+ addSubjectDataType((*pt).second , (*pt).first);
+ }
+ for(pt=_proc->typeMap.begin();pt!=_proc->typeMap.end();pt++)
+ {
+ addSubjectDataType((*pt).second , (*pt).first);
+ }
+}
+
/*!
* loadComponents is used when an existing scheme has been loaded in memory,
* to create subjects for components stored in the schema file, but are not
void SubjectProc::loadComponents()
{
Proc* aProc = GuiContext::getCurrent()->getProc();
- for (map<pair<string,int>, ComponentInstance*>::const_iterator itComp = aProc->componentInstanceMap.begin();
+ for (map<string, ComponentInstance*>::const_iterator itComp = aProc->componentInstanceMap.begin();
itComp != aProc->componentInstanceMap.end(); ++itComp)
- if ( GuiContext::getCurrent()->_mapOfSubjectComponent.find((*itComp).second)
- ==
- GuiContext::getCurrent()->_mapOfSubjectComponent.end() )
- { // engine object for component already exists => add only a subject for it
- addSubjectComponent((*itComp).second);
- }
+ {
+ GuiContext::getCurrent()->_mapOfLastComponentInstance[itComp->second->getCompoName()]=itComp->second;
+
+ if ( GuiContext::getCurrent()->_mapOfSubjectComponent.find((*itComp).second)
+ ==
+ GuiContext::getCurrent()->_mapOfSubjectComponent.end() )
+ { // engine object for component already exists => add only a subject for it
+ addSubjectComponent((*itComp).second);
+ }
+ }
}
/*!
for (map<string, Container*>::const_iterator itCont = aProc->containerMap.begin();
itCont != aProc->containerMap.end(); ++itCont)
if ( GuiContext::getCurrent()->_mapOfSubjectContainer.find((*itCont).second)
- ==
- GuiContext::getCurrent()->_mapOfSubjectContainer.end() )
+ ==
+ GuiContext::getCurrent()->_mapOfSubjectContainer.end() )
// engine object for container already exists => add only a subject for it
addSubjectContainer((*itCont).second, (*itCont).second->getName());
}
-SubjectComponent* SubjectProc::addComponent(std::string name)
+SubjectComponent* SubjectProc::addComponent(std::string compoName, std::string containerName)
{
- DEBTRACE("SubjectProc::addComponent " << name);
- CommandAddComponentInstance *command = new CommandAddComponentInstance(name);
+ DEBTRACE("SubjectProc::addComponent " << compoName << " " << containerName);
+ CommandAddComponentInstance *command = new CommandAddComponentInstance(compoName, containerName);
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
- ComponentInstance *compo = command->getComponentInstance();
- SubjectComponent *son = addSubjectComponent(compo);
- return son;
+ return command->getSubjectComponent();
}
else delete command;
return 0;
CommandAddContainer *command = new CommandAddContainer(name,ref);
if (command->execute())
{
- GuiContext::getCurrent()->getInvoc()->add(command);
- Container *cont = command->getContainer();
- SubjectContainer *son = addSubjectContainer(cont, name);
- GuiContext::getCurrent()->getProc()->containerMap[name] = cont;
- return son;
+ GuiContext::getCurrent()->getInvoc()->add(command);
+ return command->getSubjectContainer();
}
else
delete command;
return 0;
}
-SubjectDataType* SubjectProc::addDataType(YACS::ENGINE::Catalog* catalog, std::string typeName)
+bool SubjectProc::addDataType(YACS::ENGINE::Catalog* catalog, std::string typeName)
{
DEBTRACE("SubjectProc::addDataType " << typeName);
CommandAddDataTypeFromCatalog *command = new CommandAddDataTypeFromCatalog(catalog, typeName);
{
DEBTRACE("new datatype " << typeName);
GuiContext::getCurrent()->getInvoc()->add(command);
- SubjectDataType *son = addSubjectDataType(command->getTypeCode(), typeName);
- return son;
+ return true;
}
else delete command;
return 0;
{
DEBTRACE("SubjectProc::addSubjectContainer " << name);
SubjectContainer *son = new SubjectContainer(cont, this);
+ // In edition mode do not clone containers
+ cont->attachOnCloning();
GuiContext::getCurrent()->_mapOfSubjectContainer[cont] = son;
update(ADD, CONTAINER, son);
return son;
}
+/*! register a sub command when importing a node from catalog with new data types
+ *
+ */
+SubjectDataType* SubjectProc::addComSubjectDataType(YACS::ENGINE::TypeCode *type, std::string alias)
+{
+ string typeName = type->name();
+ DEBTRACE("SubjectProc::addComSubjectDataType " << typeName);
+ SubjectDataType* son = 0;
+ if (GuiContext::getCurrent()->isLoading())
+ son = addSubjectDataType(type,alias); // no sub command registration
+ else
+ {
+ Catalog *catalog = GuiContext::getCurrent()->getCurrentCatalog();
+ CommandAddDataTypeFromCatalog *command = new CommandAddDataTypeFromCatalog(catalog,
+ typeName);
+ if (command->execute())
+ GuiContext::getCurrent()->getInvoc()->add(command);
+ else delete command;
+ }
+ return son;
+}
+
+
SubjectDataType* SubjectProc::addSubjectDataType(YACS::ENGINE::TypeCode *type, std::string alias)
{
string typeName = type->name();
update(ADD, DATATYPE, son);
}
else
- GuiContext::getCurrent()->_lastErrorMessage = "Typecode " + typeName + " already had added in proc";
+ GuiContext::getCurrent()->_lastErrorMessage = "Typecode " + typeName + " was already added in proc";
return son;
}
-void SubjectProc::removeSubjectDataType( YACS::ENGINE::TypeCode* theType )
+void SubjectProc::removeSubjectDataType(std::string typeName)
{
- if ( !theType )
- return;
-
- YACS::HMI::GuiContext* aContext = GuiContext::getCurrent();
- if ( !aContext )
- return;
-
- YACS::ENGINE::Proc* aProc = aContext->getProc();
- if ( !aProc )
- return;
-
- string typeName = theType->name();
- if ( !aProc->typeMap.count( typeName ) )
- return;
-
- YACS::ENGINE::TypeCode* aTypeCode = aProc->typeMap[ typeName ];
- if ( !aTypeCode )
- return;
-
- if ( !aContext->_mapOfSubjectDataType.count( typeName ) )
- return;
-
- YACS::HMI::SubjectDataType* aSDataType = aContext->_mapOfSubjectDataType[ typeName ];
- if ( !aSDataType )
- return;
-
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ YASSERT(proc->typeMap.count(typeName));
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataType.count(typeName));
+ TypeCode* aTypeCode = proc->typeMap[typeName];
+ SubjectDataType* aSDataType = GuiContext::getCurrent()->_mapOfSubjectDataType[typeName];
unsigned int aRefCnt = aTypeCode->getRefCnt();
- if ( aRefCnt == 1 )
- {
-// update( REMOVE, DATATYPE, aSDataType );
- aContext->_mapOfSubjectDataType.erase( typeName );
- aProc->typeMap.erase( typeName );
- }
-
+ DEBTRACE("SubjectProc::removeSubjectDataType: " << typeName << " " << aRefCnt);
+ GuiContext::getCurrent()->_mapOfSubjectDataType.erase(typeName);
+ proc->typeMap.erase(typeName);
+ erase(aSDataType); // do all the necessary updates
aTypeCode->decrRef();
}
+void SubjectProc::removeSubjectContainer(SubjectContainer* scont)
+{
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectContainer.count(scont->getContainer()));
+ erase(scont); // do all the necessary updates
+}
+
+
// ----------------------------------------------------------------------------
SubjectElementaryNode::SubjectElementaryNode(YACS::ENGINE::ElementaryNode *elementaryNode,
DEBTRACE("SubjectElementaryNode::~SubjectElementaryNode " << getName());
}
-void SubjectElementaryNode::clean()
+void SubjectElementaryNode::clean(Command *command)
{
- localClean();
- SubjectNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectNode::clean(command);
}
-void SubjectElementaryNode::localClean()
+void SubjectElementaryNode::localclean(Command *command)
{
DEBTRACE("SubjectElementaryNode::localClean ");
}
Proc *proc = GuiContext::getCurrent()->getProc();
string position = "";
if (proc != dynamic_cast<Proc*>(_node)) position = proc->getChildName(_node);
- else assert(0);
+ else YASSERT(0);
CommandAddInputPortFromCatalog *command = new CommandAddInputPortFromCatalog(catalog,
type,
position,
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
- InputPort * port = command->getInputPort();
- SubjectInputPort *son = addSubjectInputPort(port, name);
+ SubjectInputPort *son = command->getSubjectInputPort();
return son;
}
else delete command;
Proc *proc = GuiContext::getCurrent()->getProc();
string position = "";
if (proc != dynamic_cast<Proc*>(_node)) position = proc->getChildName(_node);
- else assert(0);
+ else YASSERT(0);
CommandAddOutputPortFromCatalog *command = new CommandAddOutputPortFromCatalog(catalog,
type,
position,
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
- OutputPort * port = command->getOutputPort();
- SubjectOutputPort *son = addSubjectOutputPort(port, name);
+ SubjectOutputPort *son = command->getSubjectOutputPort();
return son;
}
else delete command;
Proc *proc = GuiContext::getCurrent()->getProc();
string position = "";
if (proc != dynamic_cast<Proc*>(_node)) position = proc->getChildName(_node);
- else assert(0);
+ else YASSERT(0);
CommandAddIDSPortFromCatalog *command = new CommandAddIDSPortFromCatalog(catalog,
type,
position,
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
- InputDataStreamPort * port = command->getIDSPort();
- SubjectInputDataStreamPort *son = addSubjectIDSPort(port, name);
+ SubjectInputDataStreamPort *son = command->getSubjectIDSPort();
return son;
}
else delete command;
Proc *proc = GuiContext::getCurrent()->getProc();
string position = "";
if (proc != dynamic_cast<Proc*>(_node)) position = proc->getChildName(_node);
- else assert(0);
+ else YASSERT(0);
CommandAddODSPortFromCatalog *command = new CommandAddODSPortFromCatalog(catalog,
type,
position,
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
- OutputDataStreamPort * port = command->getODSPort();
- SubjectOutputDataStreamPort *son = addSubjectODSPort(port, name);
+ SubjectOutputDataStreamPort *son = command->getSubjectODSPort();
return son;
}
else delete command;
Proc *proc = GuiContext::getCurrent()->getProc();
string position = "";
if (proc != dynamic_cast<Proc*>(_node)) position = proc->getChildName(_node);
- else assert(0);
+ else YASSERT(0);
if (!portToMove) return false;
string nameToMove = portToMove->getName();
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
- update(ORDER, isInput, portToMove);
- update(SYNCHRO, isInput, portToMove); // --- synchronise edition and scene
return true;
}
return false;
addSubjectODSPort(*itods);
}
+void SubjectElementaryNode::saveLinks()
+{
+ SubjectNode::saveLinks();
+}
+
+void SubjectElementaryNode::restoreLinks()
+{
+ SubjectNode::restoreLinks();
+}
+
+
// ----------------------------------------------------------------------------
return _inlineNode->getScript();
}
-void SubjectInlineNode::clean()
+void SubjectInlineNode::clean(Command *command)
{
- localClean();
- SubjectElementaryNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectElementaryNode::clean(command);
}
-void SubjectInlineNode::localClean()
+void SubjectInlineNode::localclean(Command *command)
{
DEBTRACE("SubjectInlineNode::localClean ");
}
+bool SubjectInlineNode::setExecutionMode(const std::string& mode)
+{
+ DEBTRACE("SubjectInlineNode::setExecutionMode ");
+ Proc *proc = GuiContext::getCurrent()->getProc();
+
+ CommandSetExecutionMode *command = new CommandSetExecutionMode(proc->getChildName(_node), mode);
+ if (command->execute())
+ {
+ if (!GuiContext::getCurrent()->isLoading()) // do not register command when loading a schema
+ GuiContext::getCurrent()->getInvoc()->add(command);
+ else delete command;
+ return true;
+ }
+ else delete command;
+ return false;
+}
+
+bool SubjectInlineNode::setContainer(SubjectContainer* scont)
+{
+ DEBTRACE("SubjectInlineNode::setContainer ");
+ Proc *proc = GuiContext::getCurrent()->getProc();
+
+ CommandSetContainer *command = new CommandSetContainer(proc->getChildName(_node), scont->getName());
+ if (command->execute())
+ {
+ if (!GuiContext::getCurrent()->isLoading()) // do not register command when loading a schema
+ GuiContext::getCurrent()->getInvoc()->add(command);
+ else delete command;
+ return true;
+ }
+ else delete command;
+ return false;
+}
+
// ----------------------------------------------------------------------------
SubjectServiceNode::~SubjectServiceNode()
{
DEBTRACE("SubjectServiceNode::~SubjectServiceNode " << getName());
+ ComponentInstance *instance = _serviceNode->getComponent();
+ if (!instance) return;
+ if (GuiContext::getCurrent()->_mapOfSubjectComponent.count(instance))
+ {
+ SubjectComponent *scomp = GuiContext::getCurrent()->_mapOfSubjectComponent[instance];
+ if (!scomp->hasServices())
+ GuiContext::getCurrent()->getSubjectProc()->addPostErase(scomp);
+ }
}
-void SubjectServiceNode::clean()
+void SubjectServiceNode::clean(Command *command)
{
- localClean();
- SubjectElementaryNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectElementaryNode::clean(command);
}
-void SubjectServiceNode::localClean()
+void SubjectServiceNode::localclean(Command *command)
{
DEBTRACE("SubjectServiceNode::localClean ");
+ if (_subRefComponent)
+ {
+ SubjectComponent *scomp = dynamic_cast<SubjectComponent*>(_subRefComponent->getParent());
+ if (scomp)
+ scomp->removeSubServiceFromSet(this);
+ }
if (_subjectReference)
{
// update( REMOVE, REFERENCE, _subjectReference );
std::string service)
{
DEBTRACE("SubjectServiceNode::setComponentFromCatalog " << compo);
- if (catalog->_componentMap.count(compo))
- {
- YACS::ENGINE::ComponentDefinition* compodef = catalog->_componentMap[compo];
- if (compodef->_serviceMap.count(service))
- {
- Proc* proc = GuiContext::getCurrent()->getProc();
- ComponentInstance *instance = 0;
- instance = new SalomeComponent(compo);
- pair<string,int> key = pair<string,int>(compo, instance->getNumId());
- proc->componentInstanceMap[key] = instance;
- SubjectComponent* subCompo = GuiContext::getCurrent()->getSubjectProc()->addSubjectComponent(instance);
- assert(subCompo);
- addSubjectReference(subCompo);
- _serviceNode->setComponent(instance);
- if (_subRefComponent)
- subCompo->moveService(_subRefComponent);
- else
- _subRefComponent = subCompo->attachService(this);
- }
- }
+
+ Proc* proc = GuiContext::getCurrent()->getProc();
+ string position = proc->getChildName(_node);
+ CommandAddComponentFromCatalog* command =
+ new CommandAddComponentFromCatalog(catalog,
+ position,
+ compo,
+ service);
+ if (command->execute())
+ GuiContext::getCurrent()->getInvoc()->add(command);
+ else delete command;
+ return;
}
/*!
SubjectComponent* subCompo = 0;
if (! GuiContext::getCurrent()->_mapOfSubjectComponent.count(instance))
{
- DEBTRACE("SubjectServiceNode::setComponent : create subject for compo = " << compo.c_str());
- pair<string,int> key = pair<string,int>(compo, instance->getNumId());
- proc->componentInstanceMap[key] = instance;
- subCompo =
- GuiContext::getCurrent()->getSubjectProc()->addSubjectComponent(instance);
+ DEBTRACE("SubjectServiceNode::setComponent : create subject for compo = " << compo.c_str());
+ if(proc->componentInstanceMap.count(instance->getInstanceName())==0)
+ {
+ std::cerr << "PROBLEM : ComponentInstance should be registered in proc, add it " << instance->getInstanceName() << std::endl;
+ proc->componentInstanceMap[instance->getInstanceName()] = instance;
+ Container* cont=instance->getContainer();
+ //check if the associated container is consistent with containerMap
+ if(cont)
+ if (proc->containerMap.count(cont->getName()) == 0)
+ {
+ //container exists but is not in containerMap. Clone it, it's probably the result of copy paste from outside the proc
+ Container* newcont;
+ if(cont->isAttachedOnCloning())
+ {
+ cont->dettachOnCloning();
+ newcont=cont->clone();
+ cont->attachOnCloning();
+ newcont->attachOnCloning();
+ }
+ else
+ newcont=cont->clone();
+
+ proc->containerMap[cont->getName()]=newcont;
+ instance->setContainer(newcont);
+ GuiContext::getCurrent()->getSubjectProc()->addSubjectContainer(newcont, newcont->getName());
+ }
+ else
+ {
+ if(cont != proc->containerMap[cont->getName()])
+ {
+ //the associated container is not the same as the one in containerMap: use the containerMap one
+ instance->setContainer(proc->containerMap[cont->getName()]);
+ }
+ }
+ }
+ subCompo = GuiContext::getCurrent()->getSubjectProc()->addSubjectComponent(instance);
}
else
{
- DEBTRACE("SubjectServiceNode::setComponent : get already created subject for compo = " <<compo.c_str());
+ DEBTRACE("SubjectServiceNode::setComponent : get already created subject for compo = " <<compo.c_str());
subCompo = GuiContext::getCurrent()->_mapOfSubjectComponent[instance];
}
- assert(subCompo);
+ YASSERT(subCompo);
addSubjectReference(subCompo);
if (_subRefComponent)
subCompo->moveService(_subRefComponent);
SubjectReference* oldSReference = _subjectReference;
string aName = GuiContext::getCurrent()->getProc()->getChildName(_serviceNode);
CommandAssociateServiceToComponent *command =
- new CommandAssociateServiceToComponent(aName, subcomp->getKey());
+ new CommandAssociateServiceToComponent(aName, subcomp->getName());
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
- addSubjectReference(subcomp);
- if (_subRefComponent)
- subcomp->moveService(_subRefComponent);
- else
- _subRefComponent = subcomp->attachService(this);
return true;
}
else delete command;
return false;
}
-void SubjectServiceNode::removeSubjectReference(Subject *ref)
-{
- DEBTRACE("Subject::removeSubjectReference " << getName() << " " << ref->getName());
-// update( REMOVE, REFERENCE, ref );
- erase( ref );
-}
-
void SubjectServiceNode::addSubjectReference(Subject *ref)
{
DEBTRACE("Subject::addSubjectReference " << getName() << " " << ref->getName());
DEBTRACE("SubjectPythonNode::~SubjectPythonNode " << getName());
}
-void SubjectPythonNode::clean()
+void SubjectPythonNode::clean(Command *command)
{
- localClean();
- SubjectInlineNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectInlineNode::clean(command);
}
-void SubjectPythonNode::localClean()
+void SubjectPythonNode::localclean(Command *command)
{
DEBTRACE("SubjectPythonNode::localClean ");
}
return false;
}
-void SubjectPyFuncNode::clean()
+void SubjectPyFuncNode::clean(Command *command)
{
- localClean();
- SubjectInlineNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectInlineNode::clean(command);
}
-void SubjectPyFuncNode::localClean()
+void SubjectPyFuncNode::localclean(Command *command)
{
DEBTRACE("SubjectPyFuncNode::localClean ");
}
-
// ----------------------------------------------------------------------------
SubjectCORBANode::SubjectCORBANode(YACS::ENGINE::CORBANode *corbaNode, Subject *parent)
DEBTRACE("SubjectCORBANode::~SubjectCORBANode " << getName());
}
-void SubjectCORBANode::clean()
+void SubjectCORBANode::clean(Command *command)
{
- localClean();
- SubjectServiceNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectServiceNode::clean(command);
}
-void SubjectCORBANode::localClean()
+void SubjectCORBANode::localclean(Command *command)
{
DEBTRACE("SubjectCORBANode::localClean ");
}
DEBTRACE("SubjectCppNode::~SubjectCppNode " << getName());
}
-void SubjectCppNode::clean()
+void SubjectCppNode::clean(Command *command)
{
- localClean();
- SubjectServiceNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectServiceNode::clean(command);
}
-void SubjectCppNode::localClean()
+void SubjectCppNode::localclean(Command *command)
{
DEBTRACE("SubjectCppNode::localClean ");
}
DEBTRACE("SubjectSalomeNode::~SubjectSalomeNode " << getName());
}
-void SubjectSalomeNode::clean()
+void SubjectSalomeNode::clean(Command *command)
{
- localClean();
- SubjectServiceNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectServiceNode::clean(command);
}
-void SubjectSalomeNode::localClean()
+void SubjectSalomeNode::localclean(Command *command)
{
DEBTRACE("SubjectSalomeNode::localClean ");
}
DEBTRACE("SubjectSalomePythonNode::~SubjectSalomePythonNode " << getName());
}
-void SubjectSalomePythonNode::clean()
+void SubjectSalomePythonNode::clean(Command *command)
{
- localClean();
- SubjectServiceNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectServiceNode::clean(command);
}
-void SubjectSalomePythonNode::localClean()
+void SubjectSalomePythonNode::localclean(Command *command)
{
DEBTRACE("SubjectSalomePythonNode::localClean ");
}
DEBTRACE("SubjectXmlNode::~SubjectXmlNode " << getName());
}
-void SubjectXmlNode::clean()
+void SubjectXmlNode::clean(Command *command)
{
- localClean();
- SubjectServiceNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectServiceNode::clean(command);
}
-void SubjectXmlNode::localClean()
+void SubjectXmlNode::localclean(Command *command)
{
DEBTRACE("SubjectXmlNode::localClean ");
}
DEBTRACE("SubjectSplitterNode::~SubjectSplitterNode " << getName());
}
-void SubjectSplitterNode::clean()
+void SubjectSplitterNode::clean(Command *command)
{
- localClean();
- SubjectElementaryNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectElementaryNode::clean(command);
}
-void SubjectSplitterNode::localClean()
+void SubjectSplitterNode::localclean(Command *command)
{
DEBTRACE("SubjectSplitterNode::localClean ");
}
DEBTRACE("SubjectDataNode::~SubjectDataNode " << getName());
}
-void SubjectDataNode::clean()
+void SubjectDataNode::clean(Command *command)
{
- localClean();
- SubjectElementaryNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectElementaryNode::clean(command);
}
-void SubjectDataNode::localClean()
+void SubjectDataNode::localclean(Command *command)
{
DEBTRACE("SubjectDataNode::localClean ");
}
DEBTRACE("SubjectPresetNode::~SubjectPresetNode " << getName());
}
-void SubjectPresetNode::clean()
+void SubjectPresetNode::clean(Command *command)
{
- localClean();
- SubjectDataNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectDataNode::clean(command);
}
-void SubjectPresetNode::localClean()
+void SubjectPresetNode::localclean(Command *command)
{
DEBTRACE("SubjectPresetNode::localClean ");
}
DEBTRACE("SubjectOutNode::~SubjectOutNode " << getName());
}
-void SubjectOutNode::clean()
+void SubjectOutNode::clean(Command *command)
{
- localClean();
- SubjectDataNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectDataNode::clean(command);
}
-void SubjectOutNode::localClean()
+void SubjectOutNode::localclean(Command *command)
{
DEBTRACE("SubjectOutNode::localClean ");
}
DEBTRACE("SubjectStudyInNode::~SubjectStudyInNode " << getName());
}
-void SubjectStudyInNode::clean()
+void SubjectStudyInNode::clean(Command *command)
{
- localClean();
- SubjectDataNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectDataNode::clean(command);
}
-void SubjectStudyInNode::localClean()
+void SubjectStudyInNode::localclean(Command *command)
{
DEBTRACE("SubjectStudyInNode::localClean ");
}
DEBTRACE("SubjectStudyOutNode::~SubjectStudyOutNode " << getName());
}
-void SubjectStudyOutNode::clean()
+void SubjectStudyOutNode::clean(Command *command)
{
- localClean();
- SubjectDataNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectDataNode::clean(command);
}
-void SubjectStudyOutNode::localClean()
+void SubjectStudyOutNode::localclean(Command *command)
{
DEBTRACE("SubjectStudyOutNode::localClean ");
}
DEBTRACE("SubjectForLoop::~SubjectForLoop " << getName());
}
-void SubjectForLoop::clean()
+void SubjectForLoop::clean(Command *command)
{
- localClean();
- SubjectComposedNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectComposedNode::clean(command);
}
-void SubjectForLoop::localClean()
+void SubjectForLoop::localclean(Command *command)
{
DEBTRACE("SubjectForLoop::localClean ");
if (_body)
}
SubjectNode* SubjectForLoop::addNode(YACS::ENGINE::Catalog *catalog,
- std::string compo,
- std::string type,
- std::string name)
+ std::string compo,
+ std::string type,
+ std::string name,
+ bool newCompoInst)
{
- DEBTRACE("SubjectForLoop::addNode(catalog, compo, type, name)");
+ DEBTRACE("SubjectForLoop::addNode("<<catalog<<","<<compo<<","<<type<<","<<name<<")");
SubjectNode* body = 0;
- if (_body) return body;
- body = createNode(catalog, compo, type, name);
+ if (_body)
+ {
+ GuiContext::getCurrent()->_lastErrorMessage = "If you need several nodes in a loop, put the nodes in a bloc";
+ return body;
+ }
+ body = createNode(catalog, compo, type, name, newCompoInst);
return body;
}
+void SubjectForLoop::houseKeepingAfterCutPaste(bool isCut, SubjectNode *son)
+{
+ if (isCut)
+ _body = 0;
+ else
+ _body = son;
+}
+
void SubjectForLoop::completeChildrenSubjectList(SubjectNode *son)
{
_body = son;
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
- update(SETVALUE, 0, this);
return true;
}
else delete command;
DEBTRACE("SubjectWhileLoop::~SubjectWhileLoop " << getName());
}
-void SubjectWhileLoop::clean()
+void SubjectWhileLoop::clean(Command *command)
{
- localClean();
- SubjectComposedNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectComposedNode::clean(command);
}
-void SubjectWhileLoop::localClean()
+void SubjectWhileLoop::localclean(Command *command)
{
DEBTRACE("SubjectWhileLoop::localClean ");
if (_body)
}
SubjectNode* SubjectWhileLoop::addNode(YACS::ENGINE::Catalog *catalog,
- std::string compo,
- std::string type,
- std::string name)
+ std::string compo,
+ std::string type,
+ std::string name,
+ bool newCompoInst)
{
DEBTRACE("SubjectWhileLoop::addNode(catalog, compo, type, name)");
SubjectNode* body = 0;
- if (_body) return body;
- body = createNode(catalog, compo, type, name);
+ if (_body)
+ {
+ GuiContext::getCurrent()->_lastErrorMessage = "If you need several nodes in a loop, put the nodes in a bloc";
+ return body;
+ }
+ body = createNode(catalog, compo, type, name, newCompoInst);
return body;
}
+void SubjectWhileLoop::houseKeepingAfterCutPaste(bool isCut, SubjectNode *son)
+{
+ if (isCut)
+ _body = 0;
+ else
+ _body = son;
+}
+
void SubjectWhileLoop::completeChildrenSubjectList(SubjectNode *son)
{
_body = son;
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
- update(SETVALUE, 0, this);
return true;
}
else delete command;
DEBTRACE("SubjectSwitch::~SubjectSwitch " << getName());
}
-void SubjectSwitch::clean()
+void SubjectSwitch::clean(Command *command)
{
- localClean();
- SubjectComposedNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectComposedNode::clean(command);
}
-void SubjectSwitch::localClean()
+void SubjectSwitch::localclean(Command *command)
{
DEBTRACE("SubjectSwitch::localClean ");
map<int, SubjectNode*>::iterator it;
}
SubjectNode* SubjectSwitch::addNode(YACS::ENGINE::Catalog *catalog,
- std::string compo,
- std::string type,
- std::string name,
- int swCase,
- bool replace)
+ std::string compo,
+ std::string type,
+ std::string name,
+ bool newCompoInst,
+ int swCase,
+ bool replace)
{
DEBTRACE("SubjectSwitch::addNode("<<catalog<<","<<compo<<","<<type<<","<<name<<","<<swCase<<","<<(int)replace<<")");
SubjectNode* body = 0;
- if (!replace && _bodyMap.count(swCase)) return body;
- body = createNode(catalog, compo, type, name, swCase);
+ if (!replace && _bodyMap.count(swCase))
+ {
+ GuiContext::getCurrent()->_lastErrorMessage = "If you need several nodes in a switch case, put the nodes in a bloc";
+ return body;
+ }
+ body = createNode(catalog, compo, type, name, newCompoInst, swCase);
return body;
}
{
if ( (*it).second == son )
{
- isFound = true;
- id = (*it).first;
- break;
+ isFound = true;
+ id = (*it).first;
+ break;
}
}
if (isFound)
return _bodyMap;
}
+void SubjectSwitch::houseKeepingAfterCutPaste(bool isCut, SubjectNode *son)
+{
+ DEBTRACE("SubjectSwitch::houseKeepingAfterCutPaste");
+ if (isCut)
+ _bodyMap.erase(_switch->getRankOfNode(son->getNode()));
+ else
+ _bodyMap[_switch->getRankOfNode(son->getNode())] = son;
+}
+
+
void SubjectSwitch::completeChildrenSubjectList(SubjectNode *son)
{
+ DEBTRACE("SubjectSwitch::completeChildrenSubjectList");
_bodyMap[_switch->getRankOfNode(son->getNode())] = son;
}
for (it = _bodyMap.begin(); it != _bodyMap.end(); ++it)
if ( (*it).second->getNode() == node )
{
- aChild = (*it).second;
- break;
+ aChild = (*it).second;
+ break;
}
}
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
- update(SETSELECT, 0, this);
return true;
}
else delete command;
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
- update(SETCASE, newRank, snode);
return true;
}
else delete command;
// ----------------------------------------------------------------------------
-SubjectForEachLoop::SubjectForEachLoop(YACS::ENGINE::ForEachLoop *forEachLoop, Subject *parent)
- : SubjectComposedNode(forEachLoop, parent), _forEachLoop(forEachLoop)
+SubjectDynParaLoop::SubjectDynParaLoop(YACS::ENGINE::DynParaLoop * dynParaLoop, Subject * parent)
+ : SubjectComposedNode(dynParaLoop, parent), _dynParaLoop(dynParaLoop)
{
- _body = 0;
- _splitter = 0;
+ _subjectExecNode = NULL;
+ _subjectInitNode = NULL;
+ _subjectFinalizeNode = NULL;
}
-SubjectForEachLoop::~SubjectForEachLoop()
+SubjectDynParaLoop::~SubjectDynParaLoop()
{
- DEBTRACE("SubjectForEachLoop::~SubjectForEachLoop " << getName());
+ DEBTRACE("SubjectDynParaLoop::~SubjectDynParaLoop " << getName());
}
-void SubjectForEachLoop::clean()
+void SubjectDynParaLoop::recursiveUpdate(GuiEvent event, int type, Subject * son)
{
- Node* aSplitterEngine = 0;
- if (_splitter) aSplitterEngine = _splitter->getNode();
+ update(event, type, son);
+ if (_subjectExecNode)
+ _subjectExecNode->recursiveUpdate(event, type, son);
+ if (_subjectInitNode)
+ _subjectInitNode->recursiveUpdate(event, type, son);
+ if (_subjectFinalizeNode)
+ _subjectFinalizeNode->recursiveUpdate(event, type, son);
+}
+
+SubjectNode * SubjectDynParaLoop::addNode(YACS::ENGINE::Catalog * catalog,
+ std::string compo,
+ std::string type,
+ std::string name,
+ bool newCompoInst)
+{
+ DEBTRACE("SubjectDynParaLoop::addNode(catalog, compo, type, name)");
+ if (_subjectExecNode)
+ {
+ GuiContext::getCurrent()->_lastErrorMessage = "If you need several nodes in a loop, "
+ "put the nodes in a bloc";
+ return NULL;
+ }
+ return createNode(catalog, compo, type, name, newCompoInst);
+}
- localClean();
- SubjectComposedNode::clean();
+void SubjectDynParaLoop::houseKeepingAfterCutPaste(bool isCut, SubjectNode * son)
+{
+ if (isCut)
+ removeNode(son);
+ else
+ _subjectExecNode = son;
+}
- if (_forEachLoop && aSplitterEngine)
+void SubjectDynParaLoop::clean(Command * command)
+{
+ if (_askRegisterUndo)
{
- DEBTRACE("SubjectForEachLoop::clean: remove for each loop splitter");
- _forEachLoop->edRemoveChild(aSplitterEngine);
+ _askRegisterUndo = false;
+ registerUndoDestroy();
}
+ localclean(command);
+ SubjectComposedNode::clean(command);
}
-void SubjectForEachLoop::localClean()
+void SubjectDynParaLoop::localclean(Command * command)
{
- DEBTRACE("SubjectForEachLoop::localClean ");
- if (_body)
+ DEBTRACE("SubjectDynParaLoop::localClean ");
+ if (_subjectExecNode)
{
- DEBTRACE(_body->getName());
- erase(_body);
+ DEBTRACE(_subjectExecNode->getName());
+ erase(_subjectExecNode);
}
- if (_splitter)
+ if (_subjectInitNode)
{
- DEBTRACE(_splitter->getName());
- erase(_splitter);
+ DEBTRACE(_subjectInitNode->getName());
+ erase(_subjectInitNode);
+ }
+ if (_subjectFinalizeNode)
+ {
+ DEBTRACE(_subjectFinalizeNode->getName());
+ erase(_subjectFinalizeNode);
}
}
-void SubjectForEachLoop::recursiveUpdate(GuiEvent event, int type, Subject* son)
+void SubjectDynParaLoop::completeChildrenSubjectList(SubjectNode * son)
{
- update(event, type, son);
- if (_body)
- _body->recursiveUpdate(event, type, son);
+ YASSERT(son);
+ if (son->getNode() == _dynParaLoop->getExecNode())
+ _subjectExecNode = son;
+ else if (son->getNode() == _dynParaLoop->getInitNode())
+ _subjectInitNode = son;
+ else if (son->getNode() == _dynParaLoop->getFinalizeNode())
+ _subjectFinalizeNode = son;
+ else
+ YASSERT(false);
}
-SubjectNode* SubjectForEachLoop::addNode(YACS::ENGINE::Catalog *catalog,
- std::string compo,
- std::string type,
- std::string name)
+void SubjectDynParaLoop::removeNode(SubjectNode * child)
{
- DEBTRACE("SubjectForEachLoop::addNode(catalog, compo, type, name)");
- SubjectNode* body = 0;
- if (_body) return body;
- body = createNode(catalog, compo, type, name);
- return body;
+ YASSERT(child);
+ if (child == _subjectExecNode)
+ _subjectExecNode = NULL;
+ else if (child == _subjectInitNode)
+ _subjectInitNode = NULL;
+ else if (child == _subjectFinalizeNode)
+ _subjectFinalizeNode = NULL;
+ else
+ YASSERT(false);
}
-void SubjectForEachLoop::completeChildrenSubjectList(SubjectNode *son)
+SubjectNode * SubjectDynParaLoop::getChild(YACS::ENGINE::Node * node) const
{
- if ( !son )
- {
- _body = son;
- return;
- }
-
- string name = son->getName();
- DEBTRACE("SubjectForEachLoop::completeChildrenSubjectList " << name);
- if (name == ForEachLoop::NAME_OF_SPLITTERNODE)
- _splitter = son;
- else
- _body = son;
+ return _subjectExecNode;
}
-bool SubjectForEachLoop::setNbBranches(std::string nbBranches)
+bool SubjectDynParaLoop::setNbBranches(std::string nbBranches)
{
- DEBTRACE("SubjectForEachLoop::setNbBranches " << nbBranches);
- Proc *proc = GuiContext::getCurrent()->getProc();
- CommandSetForEachBranch *command =
+ DEBTRACE("SubjectDynParaLoop::setNbBranches " << nbBranches);
+ Proc * proc = GuiContext::getCurrent()->getProc();
+ CommandSetForEachBranch * command =
new CommandSetForEachBranch(proc->getChildName(getNode()), nbBranches);
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
- update(SETVALUE, 0, this);
return true;
}
else delete command;
return false;
}
-bool SubjectForEachLoop::hasValue()
+bool SubjectDynParaLoop::hasValue()
{
return true;
}
-std::string SubjectForEachLoop::getValue()
+std::string SubjectDynParaLoop::getValue()
{
- return _forEachLoop->getInputPort("nbBranches")->getAsString();
+ return _dynParaLoop->edGetNbOfBranchesPort()->getAsString();
}
-
// ----------------------------------------------------------------------------
-SubjectOptimizerLoop::SubjectOptimizerLoop(YACS::ENGINE::OptimizerLoop *optimizerLoop,
- Subject *parent)
- : SubjectComposedNode(optimizerLoop, parent), _optimizerLoop(optimizerLoop)
+SubjectForEachLoop::SubjectForEachLoop(YACS::ENGINE::ForEachLoop *forEachLoop, Subject *parent)
+ : SubjectDynParaLoop(forEachLoop, parent), _forEachLoop(forEachLoop)
{
- _body = 0;
+ _splitter = 0;
}
-SubjectOptimizerLoop::~SubjectOptimizerLoop()
+SubjectForEachLoop::~SubjectForEachLoop()
{
- DEBTRACE("SubjectOptimizerLoop::~SubjectOptimizerLoop " << getName());
+ DEBTRACE("SubjectForEachLoop::~SubjectForEachLoop " << getName());
}
-void SubjectOptimizerLoop::clean()
+void SubjectForEachLoop::clean(Command *command)
{
- localClean();
- SubjectComposedNode::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ Node* aSplitterEngine = 0;
+ if (_splitter) aSplitterEngine = _splitter->getNode();
+
+ localclean(command);
+ SubjectDynParaLoop::clean(command);
+
+ if (_forEachLoop && aSplitterEngine)
+ {
+ DEBTRACE("SubjectForEachLoop::clean: remove for each loop splitter");
+ _forEachLoop->edRemoveChild(aSplitterEngine);
+ }
}
-void SubjectOptimizerLoop::localClean()
+void SubjectForEachLoop::localclean(Command *command)
{
- DEBTRACE("SubjectOptimizerLoop::localClean ");
- if (_body)
- erase(_body);
+ DEBTRACE("SubjectForEachLoop::localClean ");
+ if (_splitter)
+ {
+ DEBTRACE(_splitter->getName());
+ erase(_splitter);
+ }
}
-void SubjectOptimizerLoop::recursiveUpdate(GuiEvent event, int type, Subject* son)
+void SubjectForEachLoop::completeChildrenSubjectList(SubjectNode *son)
{
- update(event, type, son);
- if (_body)
- _body->recursiveUpdate(event, type, son);
+ if (son && son->getName() == ForEachLoop::NAME_OF_SPLITTERNODE)
+ _splitter = son;
+ else
+ SubjectDynParaLoop::completeChildrenSubjectList(son);
}
-SubjectNode* SubjectOptimizerLoop::addNode(YACS::ENGINE::Catalog *catalog,
- std::string compo,
- std::string type,
- std::string name)
+void SubjectForEachLoop::removeNode(SubjectNode * child)
+{
+ YASSERT(child);
+ if (child->getName() == ForEachLoop::NAME_OF_SPLITTERNODE)
+ _splitter = NULL;
+ else {
+ SubjectDynParaLoop::removeNode(child);
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+SubjectOptimizerLoop::SubjectOptimizerLoop(YACS::ENGINE::OptimizerLoop *optimizerLoop,
+ Subject *parent)
+ : SubjectDynParaLoop(optimizerLoop, parent), _optimizerLoop(optimizerLoop)
{
- DEBTRACE("SubjectOptimizerLoop::addNode(catalog, compo, type, name)");
- SubjectNode* body = 0;
- if (_body) return body;
- body = createNode(catalog, compo, type, name);
- return body;
}
-void SubjectOptimizerLoop::completeChildrenSubjectList(SubjectNode *son)
+SubjectOptimizerLoop::~SubjectOptimizerLoop()
{
- _body = son;
+ DEBTRACE("SubjectOptimizerLoop::~SubjectOptimizerLoop " << getName());
+}
+
+void SubjectOptimizerLoop::clean(Command *command)
+{
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectDynParaLoop::clean(command);
+}
+
+void SubjectOptimizerLoop::localclean(Command *command)
+{
+ DEBTRACE("SubjectOptimizerLoop::localClean ");
+}
+
+bool SubjectOptimizerLoop::setAlgorithm(const std::string& alglib,const std::string& symbol)
+{
+ DEBTRACE("SubjectOptimizerLoop::setAlgorithm " << alglib << " " << symbol);
+ Proc *proc = GuiContext::getCurrent()->getProc();
+ CommandSetAlgo *command = new CommandSetAlgo(proc->getChildName(getNode()), alglib, symbol);
+ if (command->execute())
+ {
+ GuiContext::getCurrent()->getInvoc()->add(command);
+ return true;
+ }
+ else delete command;
+ return false;
}
// ----------------------------------------------------------------------------
if (isDestructible())
{
Node* node = _dataPort->getNode();
- assert(node);
+ YASSERT(node);
ElementaryNode * father = dynamic_cast<ElementaryNode*>(node);
if (father)
{
}
}
-void SubjectDataPort::clean()
+void SubjectDataPort::clean(Command *command)
{
- localClean();
- Subject::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ Subject::clean(command);
}
-void SubjectDataPort::localClean()
+void SubjectDataPort::localclean(Command *command)
{
DEBTRACE("SubjectDataPort::localClean ");
list<SubjectLink*> lsl = getListOfSubjectLink();
Command *command = 0;
bool isIn = dynamic_cast<InPort*>(_dataPort);
if (isIn)
- command = new CommandRenameInDataPort(position, _dataPort->getName(),name);
+ command = new CommandRenameInDataPort(position, _dataPort->getName(),name, getType());
else
- command = new CommandRenameOutDataPort(position, _dataPort->getName(),name);
+ command = new CommandRenameOutDataPort(position, _dataPort->getName(),name, getType());
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
- update(RENAME, 0, this);
return true;
}
else delete command;
if (outp && outp->isAlreadyLinkedWith(inp))
{
DEBTRACE("isAlreadyLinkedWith");
+ GuiContext::getCurrent()->_lastErrorMessage = "Ports are already linked";
return false;
}
string outNodePos = "";
SubjectNode *sno = dynamic_cast<SubjectNode*>(subOutport->getParent());
- assert(sno);
+ YASSERT(sno);
Node *outNode = sno->getNode();
outNodePos = proc->getChildName(outNode);
string outportName = subOutport->getName();
string inNodePos = "";
SubjectNode *sni = dynamic_cast<SubjectNode*>(subInport->getParent());
- assert(sni);
+ YASSERT(sni);
Node *inNode = sni->getNode();
inNodePos = proc->getChildName(inNode);
string inportName = subInport->getName();
- CommandAddLink *command = new CommandAddLink(outNodePos, outportName,
- inNodePos, inportName,control);
+ CommandAddLink *command = new CommandAddLink(outNodePos, outportName, subOutport->getType(),
+ inNodePos, inportName, subInport->getType(), control);
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
-
- ComposedNode *cla = ComposedNode::getLowestCommonAncestor(outNode->getFather(),
- inNode->getFather());
- SubjectComposedNode *scla = dynamic_cast<SubjectComposedNode*>(sno->getParent());
- ComposedNode *ancestor = outNode->getFather();
- while (ancestor && ancestor != cla)
- {
- ancestor = ancestor->getFather();
- scla = dynamic_cast<SubjectComposedNode*>(scla->getParent());
- assert(scla);
- }
- DEBTRACE(scla->getName());
- scla->addSubjectLink(sno, subOutport, sni, subInport);
return true;
}
else
return _execValue;
}
+void SubjectDataPort::registerUndoDestroy()
+{
+ DEBTRACE("SubjectDataPort::registerUndoDestroy");
+ Proc *proc = GuiContext::getCurrent()->getProc();
+ SubjectNode *sno = dynamic_cast<SubjectNode*>(getParent());
+ YASSERT(sno);
+ Node *node = sno->getNode();
+ string nodeName = proc->getChildName(node);
+ string portName = getName();
+ ElementaryNode* father = dynamic_cast<ElementaryNode*>(node);
+ YASSERT(father);
+
+ DataPort *port = getPort();
+ TypeCode *dtyp = port->edGetType();
+ string typeName = dtyp->name();
+ Catalog *undoCata = GuiContext::getCurrent()->getInvoc()->getUndoCata();
+ undoCata->_typeMap[typeName] = dtyp;
+
+ Command *command = 0;
+ Command *comm2 =0;
+ TypeOfElem elemType = getType();
+ switch (elemType)
+ {
+ case INPUTPORT:
+ command = new CommandAddInputPortFromCatalog(undoCata, typeName, nodeName, portName);
+ {
+ int rang = 1;
+ int nbUp = 0;
+ list<InputPort*> plist = father->getSetOfInputPort();
+ list<InputPort*>::iterator pos = plist.begin();
+ for (; (*pos) != port; pos++)
+ rang++;
+ nbUp = plist.size() -rang;
+ if (nbUp)
+ comm2 = new CommandOrderInputPorts(nodeName, portName, nbUp);
+ }
+ break;
+ case OUTPUTPORT:
+ command = new CommandAddOutputPortFromCatalog(undoCata, typeName, nodeName, portName);
+ {
+ int rang = 1;
+ int nbUp = 0;
+ list<OutputPort*> plist = father->getSetOfOutputPort();
+ list<OutputPort*>::iterator pos = plist.begin();
+ for (; (*pos) != port; pos++)
+ rang++;
+ nbUp = plist.size() -rang;
+ if (nbUp)
+ comm2 = new CommandOrderOutputPorts(nodeName, portName, nbUp);
+ }
+ break;
+ case INPUTDATASTREAMPORT:
+ command = new CommandAddIDSPortFromCatalog(undoCata, typeName, nodeName, portName);
+ break;
+ case OUTPUTDATASTREAMPORT:
+ command = new CommandAddODSPortFromCatalog(undoCata, typeName, nodeName, portName);
+ break;
+ }
+ if (command)
+ GuiContext::getCurrent()->getInvoc()->add(command);
+ if (comm2)
+ GuiContext::getCurrent()->getInvoc()->add(comm2);
+ //save links
+ list<SubjectLink*> lsl = getListOfSubjectLink();
+ for (list<SubjectLink*>::iterator it = lsl.begin(); it != lsl.end(); ++it)
+ {
+ (*it)->registerUndoDestroy();
+ }
+}
+
// ----------------------------------------------------------------------------
DEBTRACE("SubjectInputPort::~SubjectInputPort " << getName());
}
-void SubjectInputPort::clean()
+void SubjectInputPort::clean(Command *command)
{
- localClean();
- SubjectDataPort::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectDataPort::clean(command);
}
-void SubjectInputPort::localClean()
+void SubjectInputPort::localclean(Command *command)
{
DEBTRACE("SubjectInputPort::localClean ");
if (_parent)
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
- update(SETVALUE, 0, this);
return true;
}
else delete command;
SubjectOutputPort::SubjectOutputPort(YACS::ENGINE::OutputPort *port, Subject *parent)
: SubjectDataPort(port, parent), _outputPort(port)
{
- Node *node = _outputPort->getNode();
- if (ForEachLoop* foreach = dynamic_cast<ForEachLoop*>(node))
+ if (DynParaLoop* dynloop = dynamic_cast<DynParaLoop*>(_outputPort->getNode()))
{
- if (_outputPort->getName() == "SmplPrt") _destructible = false;
- }
- else if (OptimizerLoop* optil = dynamic_cast<OptimizerLoop*>(node))
- {
- if (_outputPort->getName() == "SmplPrt") _destructible = false;
+ if (_outputPort == dynloop->edGetSamplePort()) _destructible = false;
}
}
DEBTRACE("SubjectOutputPort::~SubjectOutputPort " << getName());
}
-void SubjectOutputPort::clean()
+void SubjectOutputPort::clean(Command *command)
{
- localClean();
- SubjectDataPort::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectDataPort::clean(command);
}
-void SubjectOutputPort::localClean()
+void SubjectOutputPort::localclean(Command *command)
{
DEBTRACE("SubjectOutputPort::localClean ");
if (_parent)
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
- update(SETVALUE, 0, this);
return true;
}
else delete command;
std::map<std::string, std::string> SubjectInputDataStreamPort::getProperties()
{
- return _inputDataStreamPort->getPropertyMap();
+ return _inputDataStreamPort->getProperties();
+}
+
+std::vector<std::string> SubjectInputDataStreamPort::knownProperties()
+{
+ std::vector<std::string> props;
+ props.push_back("StorageLevel");
+ //props.push_back("DependencyType");
+ props.push_back("DateCalSchem");
+ props.push_back("Alpha");
+ props.push_back("DeltaT");
+ props.push_back("InterpolationSchem");
+ props.push_back("ExtrapolationSchem");
+ return props;
}
bool SubjectInputDataStreamPort::setProperties(std::map<std::string, std::string> properties)
return false;
}
-void SubjectInputDataStreamPort::clean()
+void SubjectInputDataStreamPort::clean(Command *command)
{
- localClean();
- SubjectDataPort::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectDataPort::clean(command);
}
-void SubjectInputDataStreamPort::localClean()
+void SubjectInputDataStreamPort::localclean(Command *command)
{
DEBTRACE("SubjectInputDataStreamPort::localClean ");
}
+void SubjectInputDataStreamPort::registerUndoDestroy()
+{
+ DEBTRACE("SubjectInputDataStreamPort::registerUndoDestroy");
+ SubjectDataPort::registerUndoDestroy();
+ map<string,string> properties = getProperties();
+ if (properties.empty())
+ return;
+ Proc *proc = GuiContext::getCurrent()->getProc();
+ SubjectNode *sno = dynamic_cast<SubjectNode*>(getParent());
+ YASSERT(sno);
+ Node *node = sno->getNode();
+ string nodeName = proc->getChildName(node);
+ string portName = getName();
+ Command *command = new CommandSetDSPortProperties(nodeName, portName, true, properties);
+ GuiContext::getCurrent()->getInvoc()->add(command);
+}
+
// ----------------------------------------------------------------------------
SubjectOutputDataStreamPort::SubjectOutputDataStreamPort(YACS::ENGINE::OutputDataStreamPort *port,
std::map<std::string, std::string> SubjectOutputDataStreamPort::getProperties()
{
- return _outputDataStreamPort->getPropertyMap();
+ return _outputDataStreamPort->getProperties();
}
bool SubjectOutputDataStreamPort::setProperties(std::map<std::string, std::string> properties)
return false;
}
-void SubjectOutputDataStreamPort::clean()
+void SubjectOutputDataStreamPort::clean(Command *command)
{
- localClean();
- SubjectDataPort::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ SubjectDataPort::clean(command);
}
-void SubjectOutputDataStreamPort::localClean()
+void SubjectOutputDataStreamPort::localclean(Command *command)
{
DEBTRACE("SubjectOutputDataStreamPort::localClean ");
}
+void SubjectOutputDataStreamPort::registerUndoDestroy()
+{
+ DEBTRACE("SubjectOutputDataStreamPort::registerUndoDestroy");
+ SubjectDataPort::registerUndoDestroy();
+ map<string,string> properties = getProperties();
+ if (properties.empty())
+ return;
+ Proc *proc = GuiContext::getCurrent()->getProc();
+ SubjectNode *sno = dynamic_cast<SubjectNode*>(getParent());
+ YASSERT(sno);
+ Node *node = sno->getNode();
+ string nodeName = proc->getChildName(node);
+ string portName = getName();
+ Command *command = new CommandSetDSPortProperties(nodeName, portName, false, properties);
+ GuiContext::getCurrent()->getInvoc()->add(command);
+}
+
// ----------------------------------------------------------------------------
SubjectLink::SubjectLink(SubjectNode* subOutNode,
SubjectLink::~SubjectLink()
{
DEBTRACE("SubjectLink::~SubjectLink " << getName());
+ _inPort->update(UPDATE,DATALINK,_outPort);
+ _outPort->update(UPDATE,DATALINK,_inPort);
}
-void SubjectLink::clean()
+void SubjectLink::clean(Command *command)
{
- localClean();
- Subject::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ Subject::clean(command);
}
-void SubjectLink::localClean()
+void SubjectLink::localclean(Command *command)
{
DEBTRACE("SubjectLink::localClean ");
if (_parent)
{
DEBTRACE("clean link: " << _parent->getName() << " " << getName());
SubjectComposedNode* father = dynamic_cast<SubjectComposedNode*>(_parent);
- assert(father);
+ YASSERT(father);
father->removeLink(this); // --- clean subjects first
_cla = dynamic_cast<ComposedNode*>(father->getNode());
- assert(_cla);
+ YASSERT(_cla);
_outp = dynamic_cast<OutPort*>(_outPort->getPort());
- assert(_outp);
+ YASSERT(_outp);
_inp = dynamic_cast<InPort*>(_inPort->getPort());
- assert(_inp);
+ YASSERT(_inp);
if (isDestructible())
_cla->edRemoveLink(_outp, _inp);
}
{
return _name;
}
+
+std::map<std::string, std::string> SubjectLink::getProperties()
+{
+ return getSubjectInPort()->getProperties();
+}
+
+std::vector<std::string> SubjectLink::knownProperties()
+{
+ return getSubjectInPort()->knownProperties();
+}
+
+bool SubjectLink::setProperties(std::map<std::string, std::string> properties)
+{
+ Proc *proc = GuiContext::getCurrent()->getProc();
+ CommandSetLinkProperties *command =
+ new CommandSetLinkProperties(proc->getChildName(getSubjectOutPort()->getPort()->getNode()), getSubjectOutPort()->getName(),
+ proc->getChildName(getSubjectInPort()->getPort()->getNode()), getSubjectInPort()->getName(),
+ properties);
+ if (command->execute())
+ {
+ GuiContext::getCurrent()->getInvoc()->add(command);
+ return true;
+ }
+ else delete command;
+ return false;
+}
+
+void SubjectLink::registerUndoDestroy()
+{
+ DEBTRACE("SubjectLink::registerUndoDestroy");
+ Proc *proc = GuiContext::getCurrent()->getProc();
+ Node *outn = getSubjectOutNode()->getNode();
+ Node *inn = getSubjectInNode()->getNode();
+ DataPort *outp = getSubjectOutPort()->getPort();
+ DataPort *inp = getSubjectInPort()->getPort();
+ CommandAddLink *command = new CommandAddLink(proc->getChildName(outn),
+ outp->getName(),
+ getSubjectOutPort()->getType(),
+ proc->getChildName(inn),
+ inp->getName(),
+ getSubjectInPort()->getType(),
+ false);
+ GuiContext::getCurrent()->getInvoc()->add(command);
+
+ map<string, string> properties = getProperties();
+ if (properties.empty())
+ return;
+
+ CommandSetLinkProperties *command2 = new CommandSetLinkProperties(proc->getChildName(outn),
+ outp->getName(),
+ proc->getChildName(inn),
+ inp->getName(),
+ properties);
+ GuiContext::getCurrent()->getInvoc()->add(command2);
+}
+
// ----------------------------------------------------------------------------
SubjectControlLink::SubjectControlLink(SubjectNode* subOutNode,
}
}
-void SubjectControlLink::clean()
+void SubjectControlLink::clean(Command *command)
{
- localClean();
- Subject::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ Subject::clean(command);
}
-void SubjectControlLink::localClean()
+void SubjectControlLink::localclean(Command *command)
{
DEBTRACE("SubjectControlLink::localClean ");
if (_parent)
{
DEBTRACE("clean control link: " << _parent->getName() << " " << getName());
SubjectComposedNode* father = dynamic_cast<SubjectComposedNode*>(_parent);
- assert(father);
+ YASSERT(father);
father->removeControlLink(this); // --- clean subjects first
_cla = dynamic_cast<ComposedNode*>(father->getNode());
- assert(_cla);
+ YASSERT(_cla);
}
}
return _name;
}
+void SubjectControlLink::registerUndoDestroy()
+{
+ DEBTRACE("SubjectControlLink::registerUndoDestroy");
+ Proc *proc = GuiContext::getCurrent()->getProc();
+ Node *outn = getSubjectOutNode()->getNode();
+ Node *inn = getSubjectInNode()->getNode();
+ CommandAddControlLink *command = new CommandAddControlLink(proc->getChildName(outn),
+ proc->getChildName(inn));
+ GuiContext::getCurrent()->getInvoc()->add(command);
+}
+
// ----------------------------------------------------------------------------
SubjectComponent::SubjectComponent(YACS::ENGINE::ComponentInstance* component, Subject *parent)
_compoInst->incrRef();
_subRefContainer = 0;
_subServiceSet.clear();
+ _subReferenceMap.clear();
}
SubjectComponent::~SubjectComponent()
Proc* aProc = GuiContext::getCurrent()->getProc();
if ( aProc )
{
- pair<string,int> key = pair<string,int>(_compoInst->getCompoName(),_compoInst->getNumId());
- aProc->componentInstanceMap.erase(key);
+ aProc->componentInstanceMap.erase(_compoInst->getInstanceName());
GuiContext::getCurrent()->_mapOfSubjectComponent.erase(_compoInst);
}
_compoInst->decrRef();
}
-void SubjectComponent::clean()
+void SubjectComponent::clean(Command *command)
{
- localClean();
- Subject::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ Subject::clean(command);
}
-void SubjectComponent::localClean()
+void SubjectComponent::localclean(Command *command)
{
- DEBTRACE("SubjectComponent::localClean ");
+ DEBTRACE("SubjectComponent::localClean " << this);
Proc* aProc = GuiContext::getCurrent()->getProc();
if ( aProc )
{
parent->erase(son);
parent->update(REMOVE,0,0);
}
+
+ Container* container = _compoInst->getContainer();
+ if (!container) return;
+ SubjectContainer *subContainer;
+ YASSERT(GuiContext::getCurrent()->_mapOfSubjectContainer.count(container));
+ subContainer = GuiContext::getCurrent()->_mapOfSubjectContainer[container];
+ subContainer->removeSubComponentFromSet(this);
}
}
{
SubjectContainer *subContainer;
if (GuiContext::getCurrent()->_mapOfSubjectContainer.count(container))
- subContainer = GuiContext::getCurrent()->_mapOfSubjectContainer[container];
+ subContainer = GuiContext::getCurrent()->_mapOfSubjectContainer[container];
else
- subContainer =
- GuiContext::getCurrent()->getSubjectProc()->addSubjectContainer(container, container->getName());
+ subContainer =
+ GuiContext::getCurrent()->getSubjectProc()->addSubjectContainer(container, container->getName());
addSubjectReference(subContainer);
if (_subRefContainer)
subContainer->moveComponent(_subRefContainer);
bool SubjectComponent::associateToContainer(SubjectContainer* subcont)
{
- DEBTRACE("SubjectComponent::associateToContainer " << getName() << subcont->getName());
+ DEBTRACE("SubjectComponent::associateToContainer " << getName() << " " << subcont->getName());
CommandAssociateComponentToContainer *command =
- new CommandAssociateComponentToContainer(getKey(), subcont->getName());
+ new CommandAssociateComponentToContainer(_compoInst->getInstanceName(), subcont->getName());
if (command->execute())
{
- GuiContext::getCurrent()->getInvoc()->add(command);
-
- addSubjectReference(subcont);
- if (_subRefContainer)
- subcont->moveComponent(_subRefContainer);
- else
- _subRefContainer = subcont->attachComponent(this);
- notifyServicesChange(ASSOCIATE, CONTAINER, subcont);
+ if (!GuiContext::getCurrent()->isLoading()) // do not register command when loading a schema
+ GuiContext::getCurrent()->getInvoc()->add(command);
+ else delete command;
return true;
}
else delete command;
SubjectReference* SubjectComponent::attachService(SubjectServiceNode* service)
{
- _subServiceSet.insert(service);
+ DEBTRACE("SubjectComponent::attachService");
SubjectReference *son = new SubjectReference(service, this);
+ _subServiceSet.insert(service);
+ _subReferenceMap[service] = son;
update(ADDCHILDREF, SALOMENODE, son);
return son;
}
-void SubjectComponent::detachService(SubjectReference* reference)
+void SubjectComponent::detachService(SubjectServiceNode* service)
{
- _subServiceSet.erase(dynamic_cast<SubjectServiceNode*>(reference->getReference()));
+ DEBTRACE("SubjectComponent::detachService");
+ YASSERT(_subReferenceMap.count(service));
+ SubjectReference *reference = _subReferenceMap[service];
update(REMOVECHILDREF, SALOMENODE, reference);
+ _subServiceSet.erase(service);
+ _subReferenceMap.erase(service);
+ service->removeSubRefComponent();
erase(reference);
}
void SubjectComponent::moveService(SubjectReference* reference)
{
+ DEBTRACE("SubjectComponent::moveService");
SubjectComponent* oldcomp = dynamic_cast<SubjectComponent*>(reference->getParent());
- assert(oldcomp);
+ YASSERT(oldcomp);
SubjectServiceNode* service = dynamic_cast<SubjectServiceNode*>(reference->getReference());
oldcomp->removeSubServiceFromSet(service);
_subServiceSet.insert(service);
-
+ _subReferenceMap[service] = reference;
oldcomp->update(CUT, SALOMENODE, reference);
reference->reparent(this);
update(PASTE, SALOMENODE, reference);
+ if (!oldcomp->hasServices())
+ Subject::erase(oldcomp);
}
void SubjectComponent::removeSubServiceFromSet(SubjectServiceNode *service)
{
+ DEBTRACE("SubjectComponent::removeSubServiceFromSet " << getName() << " " << service->getName());
_subServiceSet.erase(service);
+ _subReferenceMap.erase(service);
}
void SubjectComponent::notifyServicesChange(GuiEvent event, int type, Subject* son)
{
+ DEBTRACE("SubjectComponent::notifyServicesChange");
set<SubjectServiceNode*>::iterator it = _subServiceSet.begin();
for(; it != _subServiceSet.end(); ++it)
{
}
}
+bool SubjectComponent::setProperties(std::map<std::string, std::string> properties)
+{
+ CommandSetComponentInstanceProperties *command = new CommandSetComponentInstanceProperties(getName(), properties);
+ if (command->execute())
+ {
+ GuiContext::getCurrent()->getInvoc()->add(command);
+ return true;
+ }
+ else delete command;
+ return false;
+}
+
+std::map<std::string, std::string> SubjectComponent::getProperties()
+{
+ return _compoInst->getProperties();
+}
+
// ----------------------------------------------------------------------------
SubjectContainer::SubjectContainer(YACS::ENGINE::Container* container, Subject *parent)
: Subject(parent), _container(container)
{
_subComponentSet.clear();
+ _subReferenceMap.clear();
}
SubjectContainer::~SubjectContainer()
Proc* aProc = GuiContext::getCurrent()->getProc();
if ( aProc )
{
- aProc->containerMap.erase(_container->getName());
-
map<ComponentInstance*,SubjectComponent*> mapOfSubjectComponentCpy
= GuiContext::getCurrent()->_mapOfSubjectComponent;
map<ComponentInstance*,SubjectComponent*>::iterator it = mapOfSubjectComponentCpy.begin();
for ( ; it!=mapOfSubjectComponentCpy.end(); it++ )
if ( (*it).first && (*it).first->getContainer() == _container )
{
- (*it).first->setContainer(0);
- GuiContext::getCurrent()->getSubjectProc()->destroy((*it).second);
+ (*it).first->setContainer(0);
+ GuiContext::getCurrent()->getSubjectProc()->destroy((*it).second);
}
GuiContext::getCurrent()->_mapOfSubjectContainer.erase(_container);
+ aProc->removeContainer(_container);
}
}
bool SubjectContainer::setName(std::string name)
{
DEBTRACE("SubjectContainer::setName " << name);
+ if (name == getName())
+ return true;
CommandRenameContainer* command = new CommandRenameContainer(getName(), name);
if (command->execute())
{
GuiContext::getCurrent()->getInvoc()->add(command);
- update(RENAME, 0, this);
- notifyComponentsChange(ASSOCIATE, CONTAINER, this);
return true;
}
else delete command;
SubjectReference* SubjectContainer::attachComponent(SubjectComponent* component)
{
- _subComponentSet.insert(component);
+ DEBTRACE("SubjectContainer::attachComponent");
SubjectReference *son = new SubjectReference(component, this);
+ _subComponentSet.insert(component);
+ _subReferenceMap[component] = son;
update(ADDCHILDREF, COMPONENT, son);
return son;
}
-void SubjectContainer::detachComponent(SubjectReference* reference)
+void SubjectContainer::detachComponent(SubjectComponent* component)
{
- _subComponentSet.erase(dynamic_cast<SubjectComponent*>(reference->getReference()));
+ DEBTRACE("SubjectContainer::detachComponent");
+ YASSERT(_subReferenceMap.count(component));
+ SubjectReference *reference = _subReferenceMap[component];
update(REMOVECHILDREF, COMPONENT, reference);
+ _subComponentSet.erase(component);
+ _subReferenceMap.erase(component);
erase(reference);
}
void SubjectContainer::moveComponent(SubjectReference* reference)
{
+ DEBTRACE("SubjectContainer::moveComponent");
SubjectContainer* oldcont = dynamic_cast<SubjectContainer*>(reference->getParent());
- assert(oldcont);
+ YASSERT(oldcont);
SubjectComponent* component = dynamic_cast<SubjectComponent*>(reference->getReference());
_subComponentSet.insert(component);
+ _subReferenceMap[component] = reference;
oldcont->removeSubComponentFromSet(component);
oldcont->update(CUT, COMPONENT, reference);
reference->reparent(this);
void SubjectContainer::removeSubComponentFromSet(SubjectComponent *component)
{
+ DEBTRACE("SubjectContainer::removeSubComponentFromSet");
_subComponentSet.erase(component);
+ _subReferenceMap.erase(component);
}
void SubjectContainer::notifyComponentsChange(GuiEvent event, int type, Subject* son)
{
+ DEBTRACE("SubjectContainer::notifyComponentsChange");
set<SubjectComponent*>::iterator it = _subComponentSet.begin();
for(; it != _subComponentSet.end(); ++it)
{
}
-void SubjectContainer::clean()
+void SubjectContainer::clean(Command *command)
{
- localClean();
- Subject::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ Subject::clean(command);
}
-void SubjectContainer::localClean()
+void SubjectContainer::localclean(Command *command)
{
DEBTRACE("SubjectContainer::localClean ");
Proc* aProc = GuiContext::getCurrent()->getProc();
if ( (*it).first && (*it).first->getContainer() == _container )
{
compo=(*it).second;
- (*it).first->setContainer(0);
+ (*it).first->setContainer(0);
compos.push_back((*it).second);
}
while(!compos.empty())
return _container;
}
+void SubjectContainer::registerUndoDestroy()
+{
+ DEBTRACE("SubjectContainer::registerUndoDestroy");
+ Command *command = new CommandAddContainer(getName(),"");
+ GuiContext::getCurrent()->getInvoc()->add(command);
+}
+
// ----------------------------------------------------------------------------
SubjectDataType::SubjectDataType(YACS::ENGINE::TypeCode *typeCode, Subject *parent, std::string alias)
{
}
-void SubjectDataType::clean()
+void SubjectDataType::clean(Command *command)
{
- localClean();
- Subject::clean();
+ if (_askRegisterUndo)
+ {
+ _askRegisterUndo = false;
+ registerUndoDestroy();
+ }
+ localclean(command);
+ Subject::clean(command);
}
-void SubjectDataType::localClean()
+void SubjectDataType::localclean(Command *command)
{
DEBTRACE("SubjectDataType::localClean ");
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _GUIOBSERVERS_HXX_
#define _GUIOBSERVERS_HXX_
#include <set>
#include <string>
#include <map>
+#include <vector>
#include <list>
+#include "HMIExport.hxx"
#include "Dispatcher.hxx"
#include "commandsProc.hxx"
class Bloc;
class Proc;
class ForLoop;
+ class DynParaLoop;
class ForEachLoop;
class WhileLoop;
class Switch;
class ComponentInstance;
class Container;
class TypeCode;
+ class OutGate;
+ class InGate;
}
namespace HMI
PASTE,
ORDER,
EDIT,
- UPDATE,
- UPDATEPROGRESS,
+ UPDATE,
+ UPDATEPROGRESS,
SYNCHRO,
- UP,
- DOWN,
+ UP,
+ DOWN,
RENAME,
NEWROOT,
ENDLOAD,
SETVALUE,
SETCASE,
SETSELECT,
- GEOMETRY
+ GEOMETRY,
+ EMPHASIZE,
+ SWITCHSHAPE
} GuiEvent;
class ProcInvoc;
class GuiObserver;
class SubjectReference;
- class Subject: public YACS::ENGINE::Observer
+ class HMI_EXPORT Subject: public YACS::ENGINE::Observer
{
public:
+ friend class CommandReparentNode;
Subject(Subject *parent=0);
virtual ~Subject();
virtual void attach(GuiObserver *obs);
virtual void update(GuiEvent event, int type, Subject* son);
virtual std::string getName();
virtual bool setName(std::string name);
+ virtual bool setProperties(std::map<std::string, std::string> properties);
+ virtual std::map<std::string, std::string> getProperties();
+ virtual std::vector<std::string> knownProperties();
virtual Subject* getParent();
+ virtual void setParent(Subject* son);
virtual bool destroy(Subject *son);
virtual void loadChildren();
virtual void loadLinks();
virtual void addSubjectReference(Subject *ref);
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
+ void registerUndoDestroy();
+ void askRegisterUndoDestroy() {_askRegisterUndo=true; };
bool isDestructible() { return _destructible; };
- static void erase(Subject* sub);
+ static void erase(Subject* sub, Command *command=0, bool post=false);
virtual TypeOfElem getType(){return UNKNOWN;}
protected:
std::set<GuiObserver *> _setObs;
Subject *_parent;
bool _destructible;
+ bool _askRegisterUndo;
};
- class GuiObserver
+ class HMI_EXPORT GuiObserver
{
public:
GuiObserver();
static std::map<int, std::string> _eventNameMap;
};
+ class HMI_EXPORT SubjectObserver:public GuiObserver
+ {
+ public:
+ SubjectObserver(Subject* ref);
+ virtual ~SubjectObserver();
+ virtual void select(bool isSelected);
+ virtual void update(GuiEvent event, int type, Subject* son);
+ protected:
+ Subject* _reference;
+ };
+
class SubjectReference: public Subject
{
public:
virtual std::string getName();
virtual Subject* getReference() const;
virtual void reparent(Subject *parent);
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual TypeOfElem getType(){return REFERENCE;}
protected:
Subject* _reference;
+ SubjectObserver* _sobs;
};
class SubjectLink;
class SubjectControlLink;
- class SubjectDataPort: public Subject
+ class HMI_EXPORT SubjectDataPort: public Subject
{
public:
SubjectDataPort(YACS::ENGINE::DataPort* port, Subject *parent);
virtual bool setName(std::string name);
virtual YACS::ENGINE::DataPort* getPort();
static bool tryCreateLink(SubjectDataPort *subOutport, SubjectDataPort *subInport,bool control=true);
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
void addSubjectLink(SubjectLink* subject) { _listSubjectLink.push_back(subject); };
void removeSubjectLink(SubjectLink* subject) { _listSubjectLink.remove(subject); };
std::list<SubjectLink*> getListOfSubjectLink() { return _listSubjectLink; };
virtual bool setValue(std::string value);
void setExecValue(std::string value);
std::string getExecValue();
+ void registerUndoDestroy();
protected:
YACS::ENGINE::DataPort *_dataPort;
std::list<SubjectLink*> _listSubjectLink;
public:
SubjectInputPort(YACS::ENGINE::InputPort *port, Subject *parent);
virtual ~SubjectInputPort();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual bool setValue(std::string value);
virtual TypeOfElem getType(){return INPUTPORT;}
protected:
public:
SubjectOutputPort(YACS::ENGINE::OutputPort *port, Subject *parent);
virtual ~SubjectOutputPort();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual bool setValue(std::string value);
virtual TypeOfElem getType(){return OUTPUTPORT;}
protected:
virtual ~SubjectInputDataStreamPort();
virtual bool setProperties(std::map<std::string, std::string> properties);
virtual std::map<std::string, std::string> getProperties();
- virtual void clean();
- void localClean();
+ virtual std::vector<std::string> knownProperties();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual TypeOfElem getType(){return INPUTDATASTREAMPORT;}
+ void registerUndoDestroy();
protected:
YACS::ENGINE::InputDataStreamPort *_inputDataStreamPort;
};
virtual ~SubjectOutputDataStreamPort();
virtual bool setProperties(std::map<std::string, std::string> properties);
virtual std::map<std::string, std::string> getProperties();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual TypeOfElem getType(){return OUTPUTDATASTREAMPORT;}
+ void registerUndoDestroy();
protected:
YACS::ENGINE::OutputDataStreamPort *_outputDataStreamPort;
};
- class SubjectNode: public Subject
+ class HMI_EXPORT SubjectNode: public Subject
{
public:
+ friend class CommandAddInputPortFromCatalog;
+ friend class CommandAddOutputPortFromCatalog;
+ friend class CommandAddIDSPortFromCatalog;
+ friend class CommandAddODSPortFromCatalog;
SubjectNode(YACS::ENGINE::Node *node, Subject *parent);
virtual ~SubjectNode();
+ virtual bool setProperties(std::map<std::string, std::string> properties);
+ virtual std::map<std::string, std::string> getProperties();
virtual bool reparent(Subject* parent);
virtual bool copy(Subject* parent);
virtual std::string getName();
virtual bool setName(std::string name);
virtual YACS::ENGINE::Node* getNode();
- virtual void clean();
- SubjectControlLink* addSubjectControlLink(SubjectControlLink *sub) { _listSubjectControlLink.push_back(sub); };
+ virtual void clean(Command *command=0);
+ void registerUndoDestroy();
+ SubjectControlLink* addSubjectControlLink(SubjectControlLink *sub) { _listSubjectControlLink.push_back(sub); return sub; };
void removeSubjectControlLink(SubjectControlLink* sub) { _listSubjectControlLink.remove(sub); };
std::list<SubjectLink*> getSubjectLinks() const { return _listSubjectLink; };
std::list<SubjectControlLink*> getSubjectControlLinks() const { return _listSubjectControlLink; };
std::list<SubjectOutputPort*> getSubjectOutputPorts() const { return _listSubjectOutputPort; };
std::list<SubjectInputDataStreamPort*> getSubjectInputDataStreamPorts() const { return _listSubjectIDSPort; };
std::list<SubjectOutputDataStreamPort*> getSubjectOutputDataStreamPorts() const { return _listSubjectODSPort; };
- void localClean();
+ void localclean(Command *command=0);
virtual void update(GuiEvent event, int type, Subject* son);
virtual void recursiveUpdate(GuiEvent event, int type, Subject* son);
virtual void removeExternalLinks();
virtual void removeExternalControlLinks();
+ virtual void saveLinks();
+ virtual void restoreLinks();
+ virtual bool putInComposedNode(std::string name,std::string type);
+ virtual int isValid();
void setExecState(int execState);
static bool tryCreateLink(SubjectNode *subOutNode, SubjectNode *subInNode);
std::list<SubjectLink*> _listSubjectLink;
std::list<SubjectControlLink*> _listSubjectControlLink;
int _execState;
+ std::list<YACS::ENGINE::OutGate *> loutgate;
+ std::set<YACS::ENGINE::InGate *> singate;
+ std::vector< std::pair<YACS::ENGINE::OutPort *, YACS::ENGINE::InPort *> > dataLinks;
+ std::vector< std::pair<YACS::ENGINE::OutPort *, YACS::ENGINE::InPort *> > dataflowLinks;
};
class SubjectComposedNode: public SubjectNode
SubjectComposedNode(YACS::ENGINE::ComposedNode *composedNode, Subject *parent);
virtual ~SubjectComposedNode();
virtual SubjectNode* addNode(YACS::ENGINE::Catalog *catalog,
- std::string compo,
- std::string type,
- std::string name);
+ std::string compo,
+ std::string type,
+ std::string name,
+ bool newCompoInst);
virtual SubjectNode* getChild(YACS::ENGINE::Node* node=0) const { return 0; }
virtual void loadChildren();
virtual void loadLinks();
virtual void removeLink(SubjectLink* link);
virtual void removeControlLink(SubjectControlLink* link);
virtual void removeExternalControlLinks();
+ virtual void houseKeepingAfterCutPaste(bool isCut, SubjectNode *son);
virtual bool hasValue();
virtual std::string getValue();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
static SubjectComposedNode* getLowestCommonAncestor(SubjectNode* snode1, SubjectNode* snode2);
protected:
virtual SubjectNode *createNode(YACS::ENGINE::Catalog *catalog,
std::string compo,
std::string type,
std::string name,
+ bool newCompoInst,
int swCase=0);
YACS::ENGINE::ComposedNode *_composedNode;
};
SubjectBloc(YACS::ENGINE::Bloc *bloc, Subject *parent);
virtual ~SubjectBloc();
virtual SubjectNode* addNode(YACS::ENGINE::Catalog *catalog,
- std::string compo,
- std::string type,
- std::string name);
+ std::string compo,
+ std::string type,
+ std::string name,
+ bool newCompoInst);
virtual void removeNode(SubjectNode* child);
virtual void completeChildrenSubjectList(SubjectNode *son);
virtual SubjectNode* getChild(YACS::ENGINE::Node* node=0) const;
virtual void recursiveUpdate(GuiEvent event, int type, Subject* son);
- virtual void clean();
- void localClean();
+ virtual void houseKeepingAfterCutPaste(bool isCut, SubjectNode *son);
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual TypeOfElem getType(){return BLOC;}
protected:
YACS::ENGINE::Bloc *_bloc;
};
class SubjectComponent;
- class SubjectContainer: public Subject
+ class HMI_EXPORT SubjectContainer: public Subject
{
public:
SubjectContainer(YACS::ENGINE::Container* container, Subject *parent);
virtual std::map<std::string, std::string> getProperties();
virtual bool setProperties(std::map<std::string, std::string> properties);
virtual SubjectReference* attachComponent(SubjectComponent* component);
- virtual void detachComponent(SubjectReference* reference);
+ virtual void detachComponent(SubjectComponent* component);
virtual void moveComponent(SubjectReference* reference);
virtual void removeSubComponentFromSet(SubjectComponent *component);
virtual void notifyComponentsChange(GuiEvent event, int type, Subject* son);
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
YACS::ENGINE::Container* getContainer() const;
+ bool isUsed() {return !_subComponentSet.empty(); };
virtual TypeOfElem getType(){return CONTAINER;}
+ void registerUndoDestroy();
protected:
YACS::ENGINE::Container* _container;
std::set<SubjectComponent*> _subComponentSet;
+ std::map<SubjectComponent*,SubjectReference*> _subReferenceMap;
};
class SubjectServiceNode;
- class SubjectComponent: public Subject
+ class HMI_EXPORT SubjectComponent: public Subject
{
public:
+ friend class SubjectNode;
SubjectComponent(YACS::ENGINE::ComponentInstance* component, Subject *parent);
virtual ~SubjectComponent();
virtual std::string getName();
virtual void setContainer();
virtual bool associateToContainer(SubjectContainer* subcont);
virtual SubjectReference* attachService(SubjectServiceNode* service);
- virtual void detachService(SubjectReference* reference);
+ virtual void detachService(SubjectServiceNode* service);
virtual void moveService(SubjectReference* reference);
virtual void removeSubServiceFromSet(SubjectServiceNode *service);
+ virtual bool setProperties(std::map<std::string, std::string> properties);
+ virtual std::map<std::string, std::string> getProperties();
virtual void notifyServicesChange(GuiEvent event, int type, Subject* son);
virtual std::pair<std::string, int> getKey();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ bool hasServices() { return !_subServiceSet.empty(); };
+ void localclean(Command *command=0);
YACS::ENGINE::ComponentInstance* getComponent() const;
virtual TypeOfElem getType(){return COMPONENT;}
+ SubjectReference* _subRefContainer;
protected:
int _id;
YACS::ENGINE::ComponentInstance* _compoInst;
- SubjectReference* _subRefContainer;
std::set<SubjectServiceNode*> _subServiceSet;
+ std::map<SubjectServiceNode*,SubjectReference*> _subReferenceMap;
};
class SubjectDataType: public Subject
virtual std::string getName();
virtual std::string getAlias();
virtual YACS::ENGINE::TypeCode* getTypeCode();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual TypeOfElem getType(){return DATATYPE;}
protected:
YACS::ENGINE::TypeCode *_typeCode;
void loadProc();
void loadComponents();
void loadContainers();
- virtual SubjectComponent* addComponent(std::string name);
+ void loadTypes();
+ virtual SubjectComponent* addComponent(std::string compoName, std::string containerName="");
virtual SubjectContainer* addContainer(std::string name, std::string ref="");
- virtual SubjectDataType* addDataType(YACS::ENGINE::Catalog* catalog, std::string typeName);
+ virtual bool addDataType(YACS::ENGINE::Catalog* catalog, std::string typeName);
SubjectComponent* addSubjectComponent(YACS::ENGINE::ComponentInstance* compo);
SubjectContainer* addSubjectContainer(YACS::ENGINE::Container* cont,
std::string name = "");
+ SubjectDataType* addComSubjectDataType(YACS::ENGINE::TypeCode *type, std::string alias);
SubjectDataType* addSubjectDataType(YACS::ENGINE::TypeCode *type, std::string alias);
- void removeSubjectDataType(YACS::ENGINE::TypeCode *type);
- virtual void clean();
- void localClean();
+ void removeSubjectDataType(std::string typeName);
+ void removeSubjectContainer(SubjectContainer* scont);
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
+ void addPostErase(Subject* sub) {_postEraseList.push_back(sub); };
+ void cleanPostErase();
virtual TypeOfElem getType(){return SALOMEPROC;}
protected:
YACS::ENGINE::Proc *_proc;
+ std::vector<Subject*> _postEraseList;
};
class SubjectForLoop: public SubjectComposedNode
SubjectForLoop(YACS::ENGINE::ForLoop *forLoop, Subject *parent);
virtual ~SubjectForLoop();
virtual SubjectNode* addNode(YACS::ENGINE::Catalog *catalog,
- std::string compo,
- std::string type,
- std::string name);
+ std::string compo,
+ std::string type,
+ std::string name,
+ bool newCompoInst);
virtual void recursiveUpdate(GuiEvent event, int type, Subject* son);
virtual void completeChildrenSubjectList(SubjectNode *son);
virtual SubjectNode* getChild(YACS::ENGINE::Node* node=0) const { return _body; }
virtual bool setNbSteps(std::string nbSteps);
virtual bool hasValue();
virtual std::string getValue();
- virtual void clean();
- void localClean();
+ virtual void houseKeepingAfterCutPaste(bool isCut, SubjectNode *son);
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual TypeOfElem getType(){return FORLOOP;}
protected:
YACS::ENGINE::ForLoop *_forLoop;
SubjectWhileLoop(YACS::ENGINE::WhileLoop *whileLoop, Subject *parent);
virtual ~SubjectWhileLoop();
virtual SubjectNode* addNode(YACS::ENGINE::Catalog *catalog,
- std::string compo,
- std::string type,
- std::string name);
+ std::string compo,
+ std::string type,
+ std::string name,
+ bool newCompoInst);
virtual void recursiveUpdate(GuiEvent event, int type, Subject* son);
virtual void completeChildrenSubjectList(SubjectNode *son);
virtual SubjectNode* getChild(YACS::ENGINE::Node* node=0) const { return _body; }
virtual bool setCondition(std::string condition);
virtual bool hasValue();
virtual std::string getValue();
- virtual void clean();
- void localClean();
+ virtual void houseKeepingAfterCutPaste(bool isCut, SubjectNode *son);
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual TypeOfElem getType(){return WHILELOOP;}
protected:
YACS::ENGINE::WhileLoop *_whileLoop;
SubjectNode* _body;
};
- class SubjectSwitch: public SubjectComposedNode
+ class HMI_EXPORT SubjectSwitch: public SubjectComposedNode
{
public:
SubjectSwitch(YACS::ENGINE::Switch *aSwitch, Subject *parent);
virtual ~SubjectSwitch();
virtual SubjectNode* addNode(YACS::ENGINE::Catalog *catalog,
- std::string compo,
- std::string type,
- std::string name,
- int swCase,
- bool replace = false);
+ std::string compo,
+ std::string type,
+ std::string name,
+ bool newCompoInst,
+ int swCase,
+ bool replace = false);
virtual void recursiveUpdate(GuiEvent event, int type, Subject* son);
virtual void removeNode(SubjectNode* son);
std::map<int, SubjectNode*> getBodyMap();
virtual bool setCase(std::string caseId, SubjectNode* snode);
virtual bool hasValue();
virtual std::string getValue();
- virtual void clean();
- void localClean();
+ virtual void houseKeepingAfterCutPaste(bool isCut, SubjectNode *son);
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual TypeOfElem getType(){return SWITCH;}
protected:
YACS::ENGINE::Switch *_switch;
std::map<int, SubjectNode*> _bodyMap;
};
- class SubjectForEachLoop: public SubjectComposedNode
+ class SubjectDynParaLoop: public SubjectComposedNode
{
public:
- SubjectForEachLoop(YACS::ENGINE::ForEachLoop *forEachLoop, Subject *parent);
- virtual ~SubjectForEachLoop();
- virtual SubjectNode* addNode(YACS::ENGINE::Catalog *catalog,
- std::string compo,
- std::string type,
- std::string name);
- virtual void recursiveUpdate(GuiEvent event, int type, Subject* son);
- virtual void completeChildrenSubjectList(SubjectNode *son);
- virtual SubjectNode* getChild(YACS::ENGINE::Node* node=0) const { return _body; }
+ SubjectDynParaLoop(YACS::ENGINE::DynParaLoop * dynParaLoop, Subject * parent);
+ virtual ~SubjectDynParaLoop();
+ virtual SubjectNode * addNode(YACS::ENGINE::Catalog * catalog,
+ std::string compo,
+ std::string type,
+ std::string name,
+ bool newCompoInst);
+ virtual void recursiveUpdate(GuiEvent event, int type, Subject * son);
+ virtual void completeChildrenSubjectList(SubjectNode * son);
+ virtual void removeNode(SubjectNode * child);
+ virtual SubjectNode * getChild(YACS::ENGINE::Node * node = NULL) const;
virtual bool setNbBranches(std::string nbBranches);
virtual bool hasValue();
virtual std::string getValue();
- virtual void clean();
- void localClean();
+ virtual void houseKeepingAfterCutPaste(bool isCut, SubjectNode * son);
+ virtual void clean(Command * command = NULL);
+ void localclean(Command * command = NULL);
+ protected:
+ YACS::ENGINE::DynParaLoop * _dynParaLoop;
+ SubjectNode * _subjectExecNode;
+ SubjectNode * _subjectInitNode;
+ SubjectNode * _subjectFinalizeNode;
+ };
+
+ class SubjectForEachLoop: public SubjectDynParaLoop
+ {
+ public:
+ SubjectForEachLoop(YACS::ENGINE::ForEachLoop *forEachLoop, Subject *parent);
+ virtual ~SubjectForEachLoop();
+ virtual void completeChildrenSubjectList(SubjectNode *son);
+ virtual void removeNode(SubjectNode * child);
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual TypeOfElem getType(){return FOREACHLOOP;}
protected:
YACS::ENGINE::ForEachLoop *_forEachLoop;
- SubjectNode* _body;
SubjectNode* _splitter;
};
- class SubjectOptimizerLoop: public SubjectComposedNode
+ class SubjectOptimizerLoop: public SubjectDynParaLoop
{
public:
SubjectOptimizerLoop(YACS::ENGINE::OptimizerLoop *optimizerLoop, Subject *parent);
virtual ~SubjectOptimizerLoop();
- virtual SubjectNode* addNode(YACS::ENGINE::Catalog *catalog,
- std::string compo,
- std::string type,
- std::string name);
- virtual void recursiveUpdate(GuiEvent event, int type, Subject* son);
- virtual void completeChildrenSubjectList(SubjectNode *son);
- virtual SubjectNode* getChild(YACS::ENGINE::Node* node=0) const { return _body; }
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual TypeOfElem getType(){return OPTIMIZERLOOP;}
+ virtual bool setAlgorithm(const std::string& alglib,const std::string& symbol);
protected:
YACS::ENGINE::OptimizerLoop *_optimizerLoop;
- SubjectNode* _body;
};
class SubjectElementaryNode: public SubjectNode
virtual bool OrderDataPorts(SubjectDataPort* portToMove, int isUp);
virtual void removePort(SubjectDataPort* port);
virtual void loadChildren();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
+ virtual void saveLinks();
+ virtual void restoreLinks();
protected:
YACS::ENGINE::ElementaryNode *_elementaryNode;
};
virtual ~SubjectInlineNode();
virtual bool setScript(std::string script);
virtual std::string getScript();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
+ virtual bool setContainer(SubjectContainer* scont);
+ virtual bool setExecutionMode(const std::string& mode);
protected:
YACS::ENGINE::InlineNode *_inlineNode;
};
public:
SubjectPythonNode(YACS::ENGINE::PythonNode *pythonNode, Subject *parent);
virtual ~SubjectPythonNode();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual TypeOfElem getType(){return PYTHONNODE;}
protected:
YACS::ENGINE::PythonNode *_pythonNode;
SubjectPyFuncNode(YACS::ENGINE::PyFuncNode *pyFuncNode, Subject *parent);
virtual ~SubjectPyFuncNode();
virtual bool setFunctionName(std::string funcName);
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual TypeOfElem getType(){return PYFUNCNODE;}
protected:
YACS::ENGINE::PyFuncNode *_pyFuncNode;
class SubjectServiceNode: public SubjectElementaryNode
{
+ friend class CommandAssociateServiceToComponent;
+ friend class CommandAddComponentFromCatalog;
public:
SubjectServiceNode(YACS::ENGINE::ServiceNode *serviceNode, Subject *parent);
virtual ~SubjectServiceNode();
std::string service);
virtual void setComponent();
virtual bool associateToComponent(SubjectComponent *subcomp);
- virtual void removeSubjectReference(Subject *ref);
+ virtual void removeSubRefComponent() { _subRefComponent = 0; };
+ virtual void removeSubjectReference(){ _subjectReference = 0; };
virtual void addSubjectReference(Subject *ref);
virtual SubjectReference* getSubjectReference();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
protected:
YACS::ENGINE::ServiceNode *_serviceNode;
SubjectReference* _subjectReference;
public:
SubjectCORBANode(YACS::ENGINE::CORBANode *corbaNode, Subject *parent);
virtual ~SubjectCORBANode();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
+ virtual TypeOfElem getType(){return CORBANODE;}
protected:
YACS::ENGINE::CORBANode *_corbaNode;
};
public:
SubjectCppNode(YACS::ENGINE::CppNode *cppNode, Subject *parent);
virtual ~SubjectCppNode();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
+ virtual TypeOfElem getType(){return CPPNODE;}
protected:
YACS::ENGINE::CppNode *_cppNode;
};
public:
SubjectSalomeNode(YACS::ENGINE::SalomeNode *salomeNode, Subject *parent);
virtual ~SubjectSalomeNode();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual TypeOfElem getType(){return SALOMENODE;}
protected:
YACS::ENGINE::SalomeNode *_salomeNode;
SubjectSalomePythonNode(YACS::ENGINE::SalomePythonNode *salomePythonNode,
Subject *parent);
virtual ~SubjectSalomePythonNode();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual TypeOfElem getType(){return SALOMEPYTHONNODE;}
protected:
YACS::ENGINE::SalomePythonNode *_salomePythonNode;
public:
SubjectXmlNode(YACS::ENGINE::XmlNode *xmlNode, Subject *parent);
virtual ~SubjectXmlNode();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual TypeOfElem getType(){return XMLNODE;}
protected:
YACS::ENGINE::XmlNode *_xmlNode;
SubjectSplitterNode(YACS::ENGINE::SplitterNode *splitterNode, Subject *parent);
virtual ~SubjectSplitterNode();
virtual std::string getName();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual TypeOfElem getType(){return SPLITTERNODE;}
protected:
YACS::ENGINE::SplitterNode *_splitterNode;
public:
SubjectDataNode(YACS::ENGINE::DataNode *dataNode, Subject *parent);
virtual ~SubjectDataNode();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
protected:
YACS::ENGINE::DataNode *_dataNode;
};
public:
SubjectPresetNode(YACS::ENGINE::PresetNode *presetNode, Subject *parent);
virtual ~SubjectPresetNode();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual TypeOfElem getType(){return PRESETNODE;}
protected:
YACS::ENGINE::PresetNode *_presetNode;
public:
SubjectOutNode(YACS::ENGINE::OutNode *outNode, Subject *parent);
virtual ~SubjectOutNode();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual TypeOfElem getType(){return OUTNODE;}
protected:
YACS::ENGINE::OutNode *_outNode;
public:
SubjectStudyInNode(YACS::ENGINE::StudyInNode *studyInNode, Subject *parent);
virtual ~SubjectStudyInNode();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual TypeOfElem getType(){return STUDYINNODE;}
protected:
YACS::ENGINE::StudyInNode *_studyInNode;
public:
SubjectStudyOutNode(YACS::ENGINE::StudyOutNode *studyOutNode, Subject *parent);
virtual ~SubjectStudyOutNode();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
virtual TypeOfElem getType(){return STUDYOUTNODE;}
protected:
YACS::ENGINE::StudyOutNode *_studyOutNode;
Subject *parent);
virtual ~SubjectLink();
virtual std::string getName();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
SubjectNode* getSubjectOutNode() { return _subOutNode; };
SubjectNode* getSubjectInNode() { return _subInNode; };
SubjectDataPort* getSubjectOutPort() { return _outPort; };
SubjectDataPort* getSubjectInPort() { return _inPort; };
+ virtual bool setProperties(std::map<std::string, std::string> properties);
+ virtual std::map<std::string, std::string> getProperties();
+ virtual std::vector<std::string> knownProperties();
virtual TypeOfElem getType(){return DATALINK;}
+ void registerUndoDestroy();
protected:
SubjectNode* _subOutNode;
SubjectDataPort* _outPort;
Subject *parent);
virtual ~SubjectControlLink();
virtual std::string getName();
- virtual void clean();
- void localClean();
+ virtual void clean(Command *command=0);
+ void localclean(Command *command=0);
SubjectNode* getSubjectOutNode() { return _subOutNode; };
SubjectNode* getSubjectInNode() { return _subInNode; };
virtual TypeOfElem getType(){return CONTROLLINK;}
+ void registerUndoDestroy();
protected:
SubjectNode* _subOutNode;
SubjectNode* _subInNode;
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#include "RuntimeSALOME.hxx"
-#include "Proc.hxx"
-
-#include "mainempty.h"
-#include "editTree.h"
-#include "editCanvas.h"
-#include "guiObservers.hxx"
-#include "commandsProc.hxx"
-#include "guiContext.hxx"
-#include "nodeEdition.h"
-#include "parsers.hxx"
-#include "Logger.hxx"
-#include "LinkInfo.hxx"
-#include "VisitorSaveSalomeSchema.hxx"
-
-#include "SALOME_NamingService.hxx"
-#include "SALOME_ModuleCatalog.hxx"
-#include "SALOME_ModuleCatalog.hh"
-
-#include <qapplication.h>
-#include <qfiledialog.h>
-#include <qdockwindow.h>
-#include <qtoolbox.h>
-#include <qcolor.h>
-#include <qcanvas.h>
-#include <qwidget.h>
-#include <qwidgetstack.h>
-#include <qlayout.h>
-
-#include <sstream>
-#include <iostream>
-#include <stdexcept>
-
-//#define _DEVDEBUG_
-#include "YacsTrace.hxx"
-using namespace std;
-
-void AttachDebugger()
-{
- if(getenv ("DEBUGGER"))
- {
- std::stringstream exec;
- exec << "$DEBUGGER guidemo " << getpid() << "&";
- std::cerr << exec.str() << std::endl;
- system(exec.str().c_str());
- while(1);
- }
-}
-
-void terminateHandler(void)
-{
- std::cerr << "Terminate: not managed exception !" << std::endl;
- AttachDebugger();
-}
-
-void unexpectedHandler(void)
-{
- std::cerr << "Unexpected: unexpected exception !" << std::endl;
- AttachDebugger();
-}
-
-class myMainform: public mainform
-{
-public:
- myMainform(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
- virtual ~myMainform();
- virtual void fileExit();
- virtual void fileOpen();
- virtual void fileNew();
- virtual void fileSave();
- virtual void fileSaveAs();
- virtual void fileCheckLoad();
- virtual void addTree(Qt::Dock pos);
- virtual void setCanvas();
- virtual void setStackOfWidgets();
-protected:
- virtual void load(const QString &f);
- YACS::ENGINE::Proc* _proc;
- YACS::YACSLoader *_loader;
-};
-
-
-myMainform::myMainform(QWidget* parent, const char* name, WFlags fl)
- : mainform(parent, name, fl)
-{
- YACS::ENGINE::RuntimeSALOME::setRuntime();
- _loader = new YACS::YACSLoader();
- _loader->registerProcCataLoader();
- YACS::HMI::GuiContext* context = new YACS::HMI::GuiContext();
- YACS::HMI::GuiContext::setCurrent(context);
- setMinimumWidth(1260);
- setMinimumHeight(800);
- setCanvas();
- addTree(Qt::DockLeft);
- addTree(Qt::DockRight);
- // addTree(Qt::DockLeft);
- setStackOfWidgets();
-
- try
- {
- YACS::ENGINE::RuntimeSALOME* runTime = YACS::ENGINE::getSALOMERuntime();
- CORBA::ORB_ptr orb = runTime->getOrb();
- if (orb)
- {
- SALOME_NamingService namingService(orb);
- CORBA::Object_ptr obj = namingService.Resolve("/Kernel/ModulCatalog");
- SALOME_ModuleCatalog::ModuleCatalog_var aModuleCatalog =
- SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj);
- if (! CORBA::is_nil(aModuleCatalog))
- {
- DEBTRACE("SALOME_ModuleCatalog::ModuleCatalog found");
- std::string anIOR = orb->object_to_string( aModuleCatalog );
- YACS::ENGINE::Catalog* aCatalog = runTime->loadCatalog( "session", anIOR );
- YACS::HMI::GuiContext::getCurrent()->setSessionCatalog(aCatalog);
- std::map< std::string, YACS::ENGINE::ComponentDefinition * >::iterator it;
- for (it = aCatalog->_componentMap.begin();it != aCatalog->_componentMap.end(); ++it)
- DEBTRACE("Component: " <<(*it).first);
- }
- }
- }
- catch(ServiceUnreachable& e)
- {
- DEBTRACE("Caught Exception. "<<e);
- }
-}
-
-myMainform::~myMainform()
-{
- delete _proc;
-}
-
-void myMainform::fileNew()
-{
- YACS::ENGINE::RuntimeSALOME* runTime = YACS::ENGINE::getSALOMERuntime();
- _proc = runTime->createProc("newSchema");
- YACS::HMI::GuiContext::getCurrent()->setProc(_proc);
-}
-
-void myMainform::setCanvas()
-{
- QCanvas * canvas = YACS::HMI::GuiContext::getCurrent()->getCanvas();
- YACS::HMI::EditCanvas *editor
- = new YACS::HMI::EditCanvas(YACS::HMI::GuiContext::getCurrent(), canvas, this);
- canvas->setBackgroundColor(QColor(204,237,239));
- setCentralWidget(editor);
-}
-
-void myMainform::addTree(Qt::Dock pos)
-{
- QDockWindow *dw = new QDockWindow( QDockWindow::InDock, this );
- dw->setResizeEnabled( TRUE );
- dw->setVerticalStretchable( TRUE );
- addDockWindow( dw, pos );
- setDockEnabled( dw, DockTop, FALSE );
- setDockEnabled( dw, DockBottom, FALSE );
- dw->setCloseMode( QDockWindow::Never );
-
- YACS::HMI::editTree *dbtree =
- new YACS::HMI::editTree(YACS::HMI::GuiContext::getCurrent(), dw);
- dw->setWidget(dbtree);
- dw->setCaption( tr("edit tree"));
-}
-
-void myMainform::setStackOfWidgets()
-{
- QDockWindow *dw = new QDockWindow( QDockWindow::InDock, this );
- dw->setResizeEnabled( TRUE );
- dw->setVerticalStretchable( TRUE );
- addDockWindow( dw, DockRight );
- setDockEnabled( dw, DockTop, FALSE );
- setDockEnabled( dw, DockBottom, FALSE );
- dw->setCloseMode( QDockWindow::Never );
-
- QWidgetStack *ws = new QWidgetStack(dw);
- YACS::HMI::GuiContext::getCurrent()->setWidgetStack(ws);
- QWidget* WStackPage = new QWidget( ws, "WStackPage" );
- QHBoxLayout* wiEditionsLayout = new QHBoxLayout( this, 11, 6, "wiEditionsLayout");
- ws->addWidget( WStackPage, 0 );
- wiEditionsLayout->addWidget( ws );
-
- dw->setWidget(ws);
- dw->setCaption( tr("edit stack"));
-
- YACS::HMI::Subject* context = YACS::HMI::GuiContext::getCurrent();
- YACS::HMI::NodeEdition* rootEdit = new YACS::HMI::NodeEdition(context,
- ws,
- context->getName().c_str());
-}
-
-void myMainform::fileOpen()
-{
- QString fn = QFileDialog::getOpenFileName( QString::null,
- tr( "XML-Files (*.xml);;All Files (*)" ),
- this,
- "load YACS scheme file dialog",
- "Choose a filename to load" );
- if ( !fn.isEmpty() )
- {
- DEBTRACE("***************************************************************************");
- DEBTRACE("file loaded : " <<fn.latin1());
- DEBTRACE("***************************************************************************");
- _proc = _loader->load(fn.latin1());
- YACS::ENGINE::Logger* logger= _proc->getLogger("parser");
- if(!logger->isEmpty())
- {
- DEBTRACE(logger->getStr());
- }
- YACS::HMI::GuiContext::getCurrent()->setProc(_proc);
- }
-}
-
-void myMainform::fileExit()
-{
- close();
-}
-
-void myMainform::fileSave()
-{
- fileSaveAs();
-}
-
-void myMainform::fileSaveAs()
-{
- QString fn = QFileDialog::getSaveFileName(QString::null,
- tr( "XML-Files (*.xml)" ),
- this,
- "save YACS scheme file dialog",
- "Choose a filename to save under" );
- if ( !fn.isEmpty() )
- {
- YACS::ENGINE::Proc* proc = YACS::HMI::GuiContext::getCurrent()->getProc();
- YACS::ENGINE::LinkInfo info(YACS::ENGINE::LinkInfo::ALL_DONT_STOP);
- proc->checkConsistency(info);
- if (info.areWarningsOrErrors())
- DEBTRACE(info.getGlobalRepr());
- YACS::ENGINE::VisitorSaveSalomeSchema vss(proc);
- vss.openFileSchema(fn.latin1());
- proc->accept(&vss);
- vss.closeFileSchema();
- }
-}
-
-/*!
- * Select several xml files in a directory to check load and delete of all the files.
- * Mainly used do test delete mechanism.
- */
-void myMainform::fileCheckLoad()
-{
- QStringList files = QFileDialog::getOpenFileNames(tr( "XML-Files (*.xml)" ),
- QString::null,
- this,
- "check load on samples xml files",
- "Select one or more files to load" );
- QStringList list = files;
- QStringList::Iterator it = list.begin();
- while( it != list.end() )
- {
- QString fn = *it;
- if ( !fn.isEmpty() )
- {
- DEBTRACE("***************************************************************************");
- DEBTRACE("file loaded : " <<fn.latin1());
- DEBTRACE("***************************************************************************");
- _proc = _loader->load(fn.latin1());
- YACS::ENGINE::Logger* logger= _proc->getLogger("parser");
- if(!logger->isEmpty())
- {
- DEBTRACE(logger->getStr());
- }
- YACS::HMI::GuiContext::getCurrent()->setProc(_proc);
- }
- ++it;
- }
- }
-
-/*!
- * Not used any more ?
- */
-void myMainform::load(const QString &f)
-{
- if (!QFile::exists(f))
- return;
- QFile file(f);
- if (!file.open(IO_ReadOnly))
- return;
- QTextStream ts(&file);
- QString txt = ts.read();
- }
-
-int main( int argc, char **argv )
-{
- if(getenv ("DEBUGGER"))
- {
-// setsig(SIGSEGV,&Handler);
- set_terminate(&terminateHandler);
- set_unexpected(&unexpectedHandler);
- }
- QApplication a( argc, argv );
- myMainform *myAppli =new myMainform();
- myAppli->show();
- a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
- return a.exec();
-}
-
+++ /dev/null
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>mainform</class>
-<widget class="QMainWindow">
- <property name="name">
- <cstring>mainform</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>600</width>
- <height>480</height>
- </rect>
- </property>
- <property name="caption">
- <string>Check widget</string>
- </property>
-</widget>
-<menubar>
- <property name="name">
- <cstring>MenuBar</cstring>
- </property>
- <item text="&File" name="fileMenu">
- <action name="fileNewAction"/>
- <action name="fileOpenAction"/>
- <action name="fileSaveAction"/>
- <action name="fileSaveAsAction"/>
- <action name="checkLoadAction"/>
- <separator/>
- <action name="filePrintAction"/>
- <separator/>
- <action name="fileExitAction"/>
- </item>
- <item text="&Edit" name="editMenu">
- <action name="editUndoAction"/>
- <action name="editRedoAction"/>
- <separator/>
- <action name="editCutAction"/>
- <action name="editCopyAction"/>
- <action name="editPasteAction"/>
- <separator/>
- <action name="editFindAction"/>
- </item>
- <item text="&Help" name="helpMenu">
- <action name="helpContentsAction"/>
- <action name="helpIndexAction"/>
- <separator/>
- <action name="helpAboutAction"/>
- </item>
-</menubar>
-<toolbars>
- <toolbar dock="2">
- <property name="name">
- <cstring>toolBar</cstring>
- </property>
- <property name="label">
- <string>Tools</string>
- </property>
- <action name="fileNewAction"/>
- <action name="fileOpenAction"/>
- <action name="fileSaveAction"/>
- <action name="fileSaveAsAction"/>
- <separator/>
- <action name="editCutAction"/>
- <action name="editCopyAction"/>
- <action name="editPasteAction"/>
- <action name="editFindAction"/>
- </toolbar>
-</toolbars>
-<actions>
- <action>
- <property name="name">
- <cstring>fileNewAction</cstring>
- </property>
- <property name="iconSet">
- <iconset>filenew.png</iconset>
- </property>
- <property name="text">
- <string>New</string>
- </property>
- <property name="menuText">
- <string>&New</string>
- </property>
- <property name="accel">
- <string>Ctrl+N</string>
- </property>
- </action>
- <action>
- <property name="name">
- <cstring>fileOpenAction</cstring>
- </property>
- <property name="iconSet">
- <iconset>fileopen.png</iconset>
- </property>
- <property name="text">
- <string>Open</string>
- </property>
- <property name="menuText">
- <string>&Open...</string>
- </property>
- <property name="accel">
- <string>Ctrl+O</string>
- </property>
- </action>
- <action>
- <property name="name">
- <cstring>fileSaveAction</cstring>
- </property>
- <property name="iconSet">
- <iconset>filesave.png</iconset>
- </property>
- <property name="text">
- <string>Save</string>
- </property>
- <property name="menuText">
- <string>&Save</string>
- </property>
- <property name="accel">
- <string>Ctrl+S</string>
- </property>
- </action>
- <action>
- <property name="name">
- <cstring>fileSaveAsAction</cstring>
- </property>
- <property name="iconSet">
- <iconset>filenew.png</iconset>
- </property>
- <property name="text">
- <string>Save As</string>
- </property>
- <property name="menuText">
- <string>Save &As...</string>
- </property>
- <property name="accel">
- <string></string>
- </property>
- </action>
- <action>
- <property name="name">
- <cstring>filePrintAction</cstring>
- </property>
- <property name="iconSet">
- <iconset>print.png</iconset>
- </property>
- <property name="text">
- <string>Print</string>
- </property>
- <property name="menuText">
- <string>&Print...</string>
- </property>
- <property name="accel">
- <string>Ctrl+P</string>
- </property>
- </action>
- <action>
- <property name="name">
- <cstring>fileExitAction</cstring>
- </property>
- <property name="text">
- <string>Exit</string>
- </property>
- <property name="menuText">
- <string>E&xit</string>
- </property>
- <property name="accel">
- <string></string>
- </property>
- </action>
- <action>
- <property name="name">
- <cstring>editUndoAction</cstring>
- </property>
- <property name="iconSet">
- <iconset>undo.png</iconset>
- </property>
- <property name="text">
- <string>Undo</string>
- </property>
- <property name="menuText">
- <string>&Undo</string>
- </property>
- <property name="accel">
- <string>Ctrl+Z</string>
- </property>
- </action>
- <action>
- <property name="name">
- <cstring>editRedoAction</cstring>
- </property>
- <property name="iconSet">
- <iconset>redo.png</iconset>
- </property>
- <property name="text">
- <string>Redo</string>
- </property>
- <property name="menuText">
- <string>&Redo</string>
- </property>
- <property name="accel">
- <string>Ctrl+Y</string>
- </property>
- </action>
- <action>
- <property name="name">
- <cstring>editCutAction</cstring>
- </property>
- <property name="iconSet">
- <iconset>editcut.png</iconset>
- </property>
- <property name="text">
- <string>Cut</string>
- </property>
- <property name="menuText">
- <string>Cu&t</string>
- </property>
- <property name="accel">
- <string>Ctrl+X</string>
- </property>
- </action>
- <action>
- <property name="name">
- <cstring>editCopyAction</cstring>
- </property>
- <property name="iconSet">
- <iconset>editcopy.png</iconset>
- </property>
- <property name="text">
- <string>Copy</string>
- </property>
- <property name="menuText">
- <string>&Copy</string>
- </property>
- <property name="accel">
- <string>Ctrl+C</string>
- </property>
- </action>
- <action>
- <property name="name">
- <cstring>editPasteAction</cstring>
- </property>
- <property name="iconSet">
- <iconset>editpaste.png</iconset>
- </property>
- <property name="text">
- <string>Paste</string>
- </property>
- <property name="menuText">
- <string>&Paste</string>
- </property>
- <property name="accel">
- <string>Ctrl+V</string>
- </property>
- </action>
- <action>
- <property name="name">
- <cstring>editFindAction</cstring>
- </property>
- <property name="iconSet">
- <iconset>searchfind.png</iconset>
- </property>
- <property name="text">
- <string>Find</string>
- </property>
- <property name="menuText">
- <string>&Find...</string>
- </property>
- <property name="accel">
- <string>Ctrl+F</string>
- </property>
- </action>
- <action>
- <property name="name">
- <cstring>helpContentsAction</cstring>
- </property>
- <property name="text">
- <string>Contents</string>
- </property>
- <property name="menuText">
- <string>&Contents...</string>
- </property>
- <property name="accel">
- <string></string>
- </property>
- </action>
- <action>
- <property name="name">
- <cstring>helpIndexAction</cstring>
- </property>
- <property name="text">
- <string>Index</string>
- </property>
- <property name="menuText">
- <string>&Index...</string>
- </property>
- <property name="accel">
- <string></string>
- </property>
- </action>
- <action>
- <property name="name">
- <cstring>helpAboutAction</cstring>
- </property>
- <property name="text">
- <string>About</string>
- </property>
- <property name="menuText">
- <string>&About</string>
- </property>
- <property name="accel">
- <string></string>
- </property>
- </action>
- <action>
- <property name="name">
- <cstring>checkLoadAction</cstring>
- </property>
- <property name="text">
- <string>check Load</string>
- </property>
- <property name="menuText">
- <string>check Load</string>
- </property>
- </action>
-</actions>
-<connections>
- <connection>
- <sender>fileNewAction</sender>
- <signal>activated()</signal>
- <receiver>mainform</receiver>
- <slot>fileNew()</slot>
- </connection>
- <connection>
- <sender>fileOpenAction</sender>
- <signal>activated()</signal>
- <receiver>mainform</receiver>
- <slot>fileOpen()</slot>
- </connection>
- <connection>
- <sender>fileSaveAction</sender>
- <signal>activated()</signal>
- <receiver>mainform</receiver>
- <slot>fileSave()</slot>
- </connection>
- <connection>
- <sender>fileSaveAsAction</sender>
- <signal>activated()</signal>
- <receiver>mainform</receiver>
- <slot>fileSaveAs()</slot>
- </connection>
- <connection>
- <sender>filePrintAction</sender>
- <signal>activated()</signal>
- <receiver>mainform</receiver>
- <slot>filePrint()</slot>
- </connection>
- <connection>
- <sender>fileExitAction</sender>
- <signal>activated()</signal>
- <receiver>mainform</receiver>
- <slot>fileExit()</slot>
- </connection>
- <connection>
- <sender>editUndoAction</sender>
- <signal>activated()</signal>
- <receiver>mainform</receiver>
- <slot>editUndo()</slot>
- </connection>
- <connection>
- <sender>editRedoAction</sender>
- <signal>activated()</signal>
- <receiver>mainform</receiver>
- <slot>editRedo()</slot>
- </connection>
- <connection>
- <sender>editCutAction</sender>
- <signal>activated()</signal>
- <receiver>mainform</receiver>
- <slot>editCut()</slot>
- </connection>
- <connection>
- <sender>editCopyAction</sender>
- <signal>activated()</signal>
- <receiver>mainform</receiver>
- <slot>editCopy()</slot>
- </connection>
- <connection>
- <sender>editPasteAction</sender>
- <signal>activated()</signal>
- <receiver>mainform</receiver>
- <slot>editPaste()</slot>
- </connection>
- <connection>
- <sender>editFindAction</sender>
- <signal>activated()</signal>
- <receiver>mainform</receiver>
- <slot>editFind()</slot>
- </connection>
- <connection>
- <sender>helpIndexAction</sender>
- <signal>activated()</signal>
- <receiver>mainform</receiver>
- <slot>helpIndex()</slot>
- </connection>
- <connection>
- <sender>helpContentsAction</sender>
- <signal>activated()</signal>
- <receiver>mainform</receiver>
- <slot>helpContents()</slot>
- </connection>
- <connection>
- <sender>helpAboutAction</sender>
- <signal>activated()</signal>
- <receiver>mainform</receiver>
- <slot>helpAbout()</slot>
- </connection>
- <connection>
- <sender>checkLoadAction</sender>
- <signal>activated()</signal>
- <receiver>mainform</receiver>
- <slot>fileCheckLoad()</slot>
- </connection>
-</connections>
-<slots>
- <slot>fileNew()</slot>
- <slot>fileOpen()</slot>
- <slot>fileSave()</slot>
- <slot>fileSaveAs()</slot>
- <slot>filePrint()</slot>
- <slot>fileExit()</slot>
- <slot>editUndo()</slot>
- <slot>editRedo()</slot>
- <slot>editCut()</slot>
- <slot>editCopy()</slot>
- <slot>editPaste()</slot>
- <slot>editFind()</slot>
- <slot>helpIndex()</slot>
- <slot>helpContents()</slot>
- <slot>helpAbout()</slot>
- <slot>fileCheckLoad()</slot>
-</slots>
-<pixmapinproject/>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#include "nodeEdition.h"
-#include "guiContext.hxx"
-#include "Port.hxx"
-#include "InlineNode.hxx"
-#include "TypeCode.hxx"
-
-#include <qlineedit.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-
-#ifdef HAVE_QEXTSCINTILLA_H
-#include <qextscintilla.h>
-#include <qextscintillalexerpython.h>
-#endif
-
-//#define _DEVDEBUG_
-#include "YacsTrace.hxx"
-
-#include <string>
-#include <cassert>
-
-using namespace std;
-
-using namespace YACS;
-using namespace YACS::HMI;
-
-#ifdef HAVE_QEXTSCINTILLA_H
-class myQextScintilla: public QextScintilla
-{
-public:
- myQextScintilla(QWidget *parent=0, const char *name=0, WFlags f=0)
- : QextScintilla(parent, name, f) {};
- ~myQextScintilla(){};
- virtual QSize sizeHint() const { return QSize(350, 150); };
-};
-#endif
-
-itemEdition::itemEdition(Subject* subject)
- : GuiObserver(), _subject(subject)
-{
- _subject->attach(this);
- _stackId = -1;
- _name = _subject->getName();
- _type = "Unknown";
- _category = "Unknown";
- ProcInvoc* invoc = GuiContext::getCurrent()->getInvoc();
- if (SubjectNode * sub = dynamic_cast<SubjectNode*>(_subject))
- {
- _category = "Node";
- _type = invoc->getTypeName(invoc->getTypeOfNode(sub->getNode()));
- }
- else if (SubjectDataPort * sub = dynamic_cast<SubjectDataPort*>(_subject))
- {
- _category = "Port";
- _type = invoc->getTypeName(invoc->getTypeOfPort(sub->getPort()));
- }
- else if (SubjectLink * sub = dynamic_cast<SubjectLink*>(_subject))
- {
- _category = "Link";
- _type = "Link";
- }
- else if (SubjectControlLink * sub = dynamic_cast<SubjectControlLink*>(_subject))
- {
- _category = "ControlLink";
- _type = "Control Link";
- }
- else if (SubjectDataType * sub = dynamic_cast<SubjectDataType*>(_subject))
- {
- _category = "Data";
- switch (sub->getTypeCode()->kind())
- {
- case YACS::ENGINE::Double: _type = "double"; break;
- case YACS::ENGINE::Int: _type = "int"; break;
- case YACS::ENGINE::String: _type = "string"; break;
- case YACS::ENGINE::Bool: _type = "bool"; break;
- case YACS::ENGINE::Objref: _type = "Objref"; break;
- case YACS::ENGINE::Sequence: _type = "Sequence"; break;
- case YACS::ENGINE::Array: _type = "Array"; break;
- case YACS::ENGINE::Struct: _type = "Struct"; break;
- default: _type = "None or Unknown";
- }
- }
- else if (SubjectComponent * sub = dynamic_cast<SubjectComponent*>(_subject))
- {
- _category = "Component";
- _type = "Salome Component";
- }
- else if (SubjectContainer * sub = dynamic_cast<SubjectContainer*>(_subject))
- {
- _category = "Container";
- _type = "Salome Container";
- }
-}
-
-itemEdition::~itemEdition()
-{
-}
-
-void itemEdition::select(bool isSelected)
-{
- DEBTRACE("NodeEdition::select " << isSelected);
- if (isSelected)
- GuiContext::getCurrent()->getWidgetStack()->raiseWidget(_stackId);
-}
-
-
-void itemEdition::update(GuiEvent event, int type, Subject* son)
-{
-}
-
-Subject* itemEdition::getSubject()
-{
- return _subject;
-}
-
-
-NodeEdition::NodeEdition(Subject* subject,
- QWidget* parent,
- const char* name,
- WFlags fl)
- : wiNodeEdition(parent, name, fl), itemEdition(subject)
-{
- DEBTRACE("NodeEdition::NodeEdition " << name);
- string category = _category + " type:";
- laNodeType->setText(category.c_str());
- category = _category + " name:";
- laNodeName->setText(category.c_str());
- liNodeType->setText(_type);
- liNodeName->setText(_name.c_str());
- liNodeType->setText(_type);
- setEdited(false);
- _haveScript = false;
- _sci = 0;
- _subInlineNode = 0;
- _subFuncNode = 0;
- _funcName ="";
- _liFuncName = 0;
- if (_subFuncNode = dynamic_cast<SubjectPyFuncNode*>(_subject))
- if (YACS::ENGINE::InlineFuncNode *pyFuncNode
- = dynamic_cast<YACS::ENGINE::InlineFuncNode*>(_subFuncNode->getNode()))
- {
- _funcName = pyFuncNode->getFname();
- QLabel* laFuncName = new QLabel( this, "laFuncName" );
- layout5->addWidget( laFuncName );
- laFuncName->setText("Function Name:");
- _liFuncName = new QLineEdit( this, "liFuncName" );
- layout5->addWidget( _liFuncName );
- _liFuncName->setText(_funcName);
- connect(_liFuncName, SIGNAL(textChanged(const QString&)), this, SLOT(onFuncNameModified(const QString&)));
- }
- else assert(0);
- if (_subInlineNode = dynamic_cast<SubjectInlineNode*>(_subject))
- {
- _haveScript = true;
-#ifdef HAVE_QEXTSCINTILLA_H
- _sci = new myQextScintilla( this, "Python Editor" );
-#else
- _sci = new QTextEdit( this, "Python Editor" );
-#endif
- wiNodeEditionLayout->removeItem(spacer2);
- layout5->addWidget( _sci );
-#ifdef HAVE_QEXTSCINTILLA_H
- _sci->setUtf8(1);
- QextScintillaLexerPython *lex = new QextScintillaLexerPython(_sci);
- _sci->setLexer(lex);
- _sci->setBraceMatching(QextScintilla::SloppyBraceMatch);
- _sci->setAutoIndent(1);
- _sci->setIndentationWidth(4);
- _sci->setIndentationGuides(1);
- _sci->setIndentationsUseTabs(0);
- _sci->setAutoCompletionThreshold(2);
-#endif
- if (YACS::ENGINE::InlineNode* pyNode = dynamic_cast<YACS::ENGINE::InlineNode*>(_subInlineNode->getNode()))
- {
- _sci->append(pyNode->getScript());
- }
- connect(_sci, SIGNAL(textChanged()), this, SLOT(onScriptModified()));
- }
- _stackId = GuiContext::getCurrent()->getWidgetStack()->addWidget(this);
- DEBTRACE("_stackId " << _stackId);
- //GuiContext::getCurrent()->getWidgetStack()->raiseWidget(_stackId);
-}
-
-NodeEdition::~NodeEdition()
-{
-}
-
-void NodeEdition::setName(std::string name)
-{
- _name = name;
- setEdited(false);
-}
-
-void NodeEdition::onApply()
-{
- string name = liNodeName->text().latin1();
- bool nameEdited = false;
- if (name != _name)
- {
- nameEdited = true;
- bool ret = _subject->setName(name);
- if (ret)
- {
- nameEdited = false;
- _name = name;
- }
- }
- bool funcNameEdited = false;
- if (_subFuncNode)
- {
- funcNameEdited = true;
- string funcName = _liFuncName->text().latin1();
- if (funcName != _funcName)
- {
- bool ret = _subFuncNode->setFunctionName(funcName);
- if (ret)
- {
- funcNameEdited = false;
- _funcName = funcName;
- }
- }
- }
- bool scriptEdited = false;
- if (_haveScript)
- {
- if (_sci->isModified())
- {
- scriptEdited = true;
- bool ret = _subInlineNode->setScript(_sci->text().latin1());
- if (ret)
- {
- scriptEdited = false;
- }
- }
- }
- bool edited = nameEdited || funcNameEdited || scriptEdited;
- setEdited(edited);
-}
-
-void NodeEdition::onCancel()
-{
- liNodeName->setText(_name.c_str());
- if (_haveScript)
- _sci->setText(_subInlineNode->getScript());
- if (_subFuncNode)
- _liFuncName->setText(_funcName);
- setEdited(false);
-}
-
-void NodeEdition::onModify(const QString &text)
-{
- if (_name != text.latin1()) setEdited(true);
-}
-
-void NodeEdition::onFuncNameModified(const QString &text)
-{
- if (_funcName != text.latin1()) setEdited(true);
-}
-
-void NodeEdition::onScriptModified()
-{
- setEdited(true);
-}
-
-void NodeEdition::setEdited(bool isEdited)
-{
- btApply->setEnabled(isEdited);
- btCancel->setEnabled(isEdited);
-}
-
-void NodeEdition::update(GuiEvent event, int type, Subject* son)
-{
- DEBTRACE("NodeEdition::update ");
- NodeEdition *item = 0;
- switch (event)
- {
- case NEWROOT:
- item = new NodeEdition(son,
- GuiContext::getCurrent()->getWidgetStack(),
- son->getName().c_str());
- break;
- case ADD:
- switch (type)
- {
- case YACS::HMI::SALOMEPROC:
- case YACS::HMI::BLOC:
- case YACS::HMI::FOREACHLOOP:
- case YACS::HMI::OPTIMIZERLOOP:
- case YACS::HMI::FORLOOP:
- case YACS::HMI::WHILELOOP:
- case YACS::HMI::SWITCH:
- case YACS::HMI::PYTHONNODE:
- case YACS::HMI::PYFUNCNODE:
- case YACS::HMI::CORBANODE:
- case YACS::HMI::SALOMENODE:
- case YACS::HMI::CPPNODE:
- case YACS::HMI::SALOMEPYTHONNODE:
- case YACS::HMI::XMLNODE:
- case YACS::HMI::PRESETNODE:
- case YACS::HMI::OUTNODE:
- case YACS::HMI::STUDYINNODE:
- case YACS::HMI::STUDYOUTNODE:
- case YACS::HMI::SPLITTERNODE:
- case YACS::HMI::DFTODSFORLOOPNODE:
- case YACS::HMI::DSTODFFORLOOPNODE:
- case YACS::HMI::INPUTPORT:
- case YACS::HMI::OUTPUTPORT:
- case YACS::HMI::INPUTDATASTREAMPORT:
- case YACS::HMI::OUTPUTDATASTREAMPORT:
- case YACS::HMI::CONTAINER:
- case YACS::HMI::COMPONENT:
- case YACS::HMI::REFERENCE:
- case YACS::HMI::DATATYPE:
- item = new NodeEdition(son,
- GuiContext::getCurrent()->getWidgetStack(),
- son->getName().c_str());
- break;
- default:
- DEBTRACE("NodeEdition::update() ADD, type not handled:" << type);
- }
- break;
- case ADDLINK:
- switch (type)
- {
- case YACS::HMI::DATALINK:
- item = new NodeEdition(son,
- GuiContext::getCurrent()->getWidgetStack(),
- son->getName().c_str());
- break;
- default:
- DEBTRACE("NodeEdition::update() ADDLINK, type not handled:" << type);
- }
- break;
- case ADDCONTROLLINK:
- switch (type)
- {
- case YACS::HMI::CONTROLLINK:
- item = new NodeEdition(son,
- GuiContext::getCurrent()->getWidgetStack(),
- son->getName().c_str());
- break;
- default:
- DEBTRACE("NodeEdition::update() ADDCONTROLLINK, type not handled:" << type);
- }
- break;
- default:
- DEBTRACE("NodeEdition::update(), event not handled: " << event);
- }
-}
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#ifndef _NODEEDITION_H_
-#define _NODEEDITION_H_
-
-#include "yacsconfig.h"
-#include <qtextedit.h>
-#include "guiObservers.hxx"
-
-#include "winodeedition.h"
-
-#ifdef HAVE_QEXTSCINTILLA_H
-class QextScintilla;
-#endif
-
-namespace YACS
-{
- namespace HMI
- {
-
- class itemEdition: public GuiObserver
- {
- public:
- itemEdition(Subject* subject);
- virtual ~itemEdition();
- virtual void select(bool isSelected);
- virtual void update(GuiEvent event, int type, Subject* son);
- virtual Subject* getSubject();
- protected:
- Subject* _subject;
- int _stackId;
- std::string _name;
- std::string _type;
- std::string _category;
- };
-
- class NodeEdition: public wiNodeEdition, public itemEdition
- {
- Q_OBJECT
-
- public slots:
- virtual void onApply();
- virtual void onCancel();
- virtual void onModify(const QString &text);
- virtual void onFuncNameModified(const QString &text);
- virtual void onScriptModified();
- public:
- NodeEdition(Subject* subject,
- QWidget* parent = 0,
- const char* name = 0,
- WFlags fl = 0 );
- virtual ~NodeEdition();
- virtual void setName(std::string name);
- virtual void update(GuiEvent event, int type, Subject* son);
-
- protected:
- virtual void setEdited(bool isEdited);
- bool _isEdited;
- bool _haveScript;
-#ifdef HAVE_QEXTSCINTILLA_H
- QextScintilla* _sci;
-#else
- QTextEdit* _sci;
-#endif
- SubjectInlineNode *_subInlineNode;
- SubjectPyFuncNode* _subFuncNode;
- std::string _funcName;
- QLineEdit* _liFuncName;
- };
-
- }
-}
-
-
-
-#endif
+++ /dev/null
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>wiEditTree</class>
-<widget class="QWidget">
- <property name="name">
- <cstring>wiEditTree</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>328</width>
- <height>346</height>
- </rect>
- </property>
- <property name="caption">
- <string>YACS Tree</string>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QListView">
- <column>
- <property name="text">
- <string>Column 1</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <item>
- <property name="text">
- <string>New Item</string>
- </property>
- <property name="pixmap">
- <pixmap></pixmap>
- </property>
- </item>
- <property name="name">
- <cstring>lv</cstring>
- </property>
- </widget>
- </hbox>
-</widget>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
+++ /dev/null
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>wiNodeEdition</class>
-<widget class="QWidget">
- <property name="name">
- <cstring>wiNodeEdition</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>270</width>
- <height>255</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="caption">
- <string>Node Edition</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <spacer row="1" column="0">
- <property name="name">
- <cstring>spacer2</cstring>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>21</width>
- <height>81</height>
- </size>
- </property>
- </spacer>
- <widget class="QLayoutWidget" row="2" column="0">
- <property name="name">
- <cstring>layout1</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QPushButton">
- <property name="name">
- <cstring>btApply</cstring>
- </property>
- <property name="text">
- <string>apply</string>
- </property>
- </widget>
- <spacer>
- <property name="name">
- <cstring>spacer1</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget class="QPushButton">
- <property name="name">
- <cstring>btCancel</cstring>
- </property>
- <property name="text">
- <string>cancel edition</string>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget class="QLayoutWidget" row="0" column="0">
- <property name="name">
- <cstring>layout5</cstring>
- </property>
- <vbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>laNodeType</cstring>
- </property>
- <property name="text">
- <string>node type:</string>
- </property>
- </widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>liNodeType</cstring>
- </property>
- <property name="frameShape">
- <enum>LineEditPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>Sunken</enum>
- </property>
- <property name="text">
- <string>node</string>
- </property>
- </widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>laNodeName</cstring>
- </property>
- <property name="text">
- <string>node name:</string>
- </property>
- </widget>
- <widget class="QLineEdit">
- <property name="name">
- <cstring>liNodeName</cstring>
- </property>
- </widget>
- </vbox>
- </widget>
- </grid>
-</widget>
-<connections>
- <connection>
- <sender>btApply</sender>
- <signal>clicked()</signal>
- <receiver>wiNodeEdition</receiver>
- <slot>onApply()</slot>
- </connection>
- <connection>
- <sender>btCancel</sender>
- <signal>clicked()</signal>
- <receiver>wiNodeEdition</receiver>
- <slot>onCancel()</slot>
- </connection>
- <connection>
- <sender>liNodeName</sender>
- <signal>textChanged(const QString&)</signal>
- <receiver>wiNodeEdition</receiver>
- <slot>onModify(const QString&)</slot>
- </connection>
-</connections>
-<slots>
- <slot>onApply()</slot>
- <slot>onCancel()</slot>
- <slot>onModify(const QString &text)</slot>
-</slots>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm/unix/make_begin.am
include $(top_srcdir)/adm/unix/make_end.am
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
"""
"""
import sys,os
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
from qt import *
import CONNECTOR
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
import sys,traceback
from qt import *
from qtcanvas import *
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# -*- coding: iso-8859-15 -*-
#
"""
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
from qt import QSizePolicy,QMultiLineEdit
try:
from qtext import QextScintilla,QextScintillaLexerPython
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
import sys
from qt import *
from qtcanvas import *
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
"""Ce module fournit des icones (QPixmap) pour afficher dans l'arbre
Ces icones sont obtenues a partir d'un nom et conservees dans un cache.
La source des icones est soit une string xpm soit un fichier gif ou autre
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
import sys
from qt import *
import CONNECTOR
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
import sys
import pilot
import SALOMERuntime
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
from qt import *
import CONNECTOR
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# -*- coding: iso-8859-15 -*-
#
"""Ce module permet de créer des vues sous forme d'arbre
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
class AdaptationError(TypeError):
pass
class LiskovViolation(AdaptationError):
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
from qt import *
import Tree
from BoxManager import BoxManager
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
from qt import *
import browser
import cataitems
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
import sys
from qt import *
import browser
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
from qt import *
import Item
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
from qt import *
import browser_session
import browser_catalog
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
import sys
import pilot
import Item
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
IconNew = [
"20 18 14 1",
". c None",
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
import sys
from qt import *
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
from qt import *
import traceback
import Editor
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
import sys
import omniORB
from omniORB import CORBA
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# -*- coding: iso-8859-1 -*-
#
import sys
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "CORBACORBAConv.hxx"
#include "CORBAPorts.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __CORBACORBACONV_HXX__
#define __CORBACORBACONV_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
//To trace CORBA ref count, uncomment the following line
//#define REFCNT
//
CORBA::ORB_ptr orb;
try
{
- DEBTRACE( "+++++++++++++++++" << getName() << " +++++++++++++++++" );
+ DEBTRACE( "+++++++++++++++++" << getCompoName() << " +++++++++++++++++" );
orb = getSALOMERuntime()->getOrb();
_objComponent= orb->string_to_object(getCompoName().c_str());
#ifdef REFCNT
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _CORBACOMPONENT_HXX_
#define _CORBACOMPONENT_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "CORBACppConv.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __CORBACPPCONV_HXX__
#define __CORBACPPCONV_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "CORBANeutralConv.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __CORBANEUTRALCONV_HXX__
#define __CORBANEUTRALCONV_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
//#define REFCNT
//
#ifdef REFCNT
//! Execute the service on the component associated to the node
void CORBANode::execute()
{
- DEBTRACE( "+++++++++++++ CorbaNode::execute: " << getName() << " +++++++++++++++" );
+ YACSTRACE(1, "+++++++++++++ CorbaNode::execute: " << getName() << " +++++++++++++++" );
{
//DII request building :
// a service gets all its in parameters first
}
try
{
- CORBA::Boolean ret=compo->init_service(_method.c_str());
- if(!ret)
- {
- _errorDetails="Problem with component '"+_ref+"' in init_service of service '"+ _method + "'";
- throw Exception(_errorDetails);
- }
+ if (!_multi_port_node)
+ {
+ CORBA::Boolean ret=compo->init_service(_method.c_str());
+ if(!ret)
+ {
+ _errorDetails="Problem with component '"+_ref+"' in init_service of service '"+ _method + "'";
+ throw Exception(_errorDetails);
+ }
+ //Should check that component port types are the same as those declared in the xml file
+ }
+ else
+ {
+ CORBA::Boolean ret=compo->init_service_with_multiple(_method.c_str(), _param);
+ if(!ret)
+ {
+ _errorDetails="Problem with component '"+_ref+"' in init_service_with_multiple of service '"+ _method + "'";
+ throw Exception(_errorDetails);
+ }
+ }
}
catch(...)
{
}
}
+void
+SalomeNode::addDatastreamPortToInitMultiService(const std::string & port_name, int number)
+{
+ int index = _param.length();
+ _param.length(index + 1);
+ _param[index].name = CORBA::string_dup(port_name.c_str());
+ _param[index].number = number;
+}
+
//! Connect the datastream ports of the component associated to the node
void SalomeNode::connectService()
{
void SalomeNode::disconnectService()
{
DEBTRACE( "SalomeNode::disconnectService: "<<getName());
- if(ids.size() == 0)return;
+ // in some rare cases, disconnectService can be called from 2 different threads
+ YACS::BASES::Lock lock(&_mutex);
+
+ if(ids.size() == 0)
+ return;
SALOME_NamingService NS(getSALOMERuntime()->getOrb()) ;
SALOME_LifeCycleCORBA LCC(&NS) ;
}
ids.clear();
}
+
+void SalomeNode::cleanNodes()
+{
+ disconnectService();
+}
+
#endif
//! Execute the service on the component associated to the node
void SalomeNode::execute()
{
- DEBTRACE( "+++++++++++++++++ SalomeNode::execute: " << getName() << " " << _method << " +++++++++++++++++" )
+ YACSTRACE(1,"+++++++++++++++++ SalomeNode::execute: " << getName() << " " << _method << " +++++++++++++++++" );
{
CORBA::Object_var objComponent=((SalomeComponent*)_component)->getCompoPtr();
- Engines::Component_var compo=Engines::Component::_narrow(objComponent);
+ Engines::EngineComponent_var compo=Engines::EngineComponent::_narrow(objComponent);
// Set component properties
- if(_propertyMap.size() > 0)
+ std::map<std::string,std::string> amap=getProperties();
+ if(amap.size() > 0)
{
Engines::FieldsDict_var dico = new Engines::FieldsDict;
- dico->length(_propertyMap.size());
+ dico->length(amap.size());
std::map<std::string,std::string>::const_iterator it;
int i=0;
- for(it = _propertyMap.begin(); it != _propertyMap.end(); ++it)
+ for(it = amap.begin(); it != amap.end(); ++it)
{
dico[i].key=CORBA::string_dup(it->first.c_str());
dico[i].value <<=it->second.c_str();
{
text=text+"component '" +_ref+ "' has no service '" + _method+ "'";
}
+ else if(excname == "BAD_PARAM")
+ {
+ text=text+"A parameter (input or output) passed to the call is out of range or otherwise considered illegal.\n";
+ text=text+"Minor code: "+sysexc->NP_minorString();
+ }
else if(excname == "MARSHAL" && sysexc->minor() == omni::MARSHAL_PassEndOfMessage)
{
text=text+"probably an error in arguments of service '" + _method + "' from component '" +_ref+ "'";
try
{
CORBA::Object_var objComponent=((SalomeComponent*)_component)->getCompoPtr();
- Engines::Component_var compo=Engines::Component::_narrow(objComponent);
+ Engines::EngineComponent_var compo=Engines::EngineComponent::_narrow(objComponent);
if( !CORBA::is_nil(compo) )
{
Engines::Container_var cont= compo->GetContainerRef();
}
return msg;
}
+
+void SalomeNode::shutdown(int level)
+{
+ DEBTRACE("SalomeNode::shutdown " << level);
+ if(_component)
+ _component->shutdown(level);
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _CORBANODE_HXX_
#define _CORBANODE_HXX_
+#include "YACSRuntimeSALOMEExport.hxx"
#include "ServiceNode.hxx"
+#include "Mutex.hxx"
#include "yacsconfig.h"
#ifdef DSC_PORTS
#include "DSC_Engines.hh"
* \see InputCorbaPort
* \see OutputCorbaPort
*/
- class CORBANode : public ServiceNode
+ class YACSRUNTIMESALOME_EXPORT CORBANode : public ServiceNode
{
protected:
Node *simpleClone(ComposedNode *father, bool editionOnly) const;
* \see InputCorbaPort
* \see OutputCorbaPort
*/
- class SalomeNode : public ServiceNode
+ class YACSRUNTIMESALOME_EXPORT SalomeNode : public ServiceNode
{
protected:
Node *simpleClone(ComposedNode *father, bool editionOnly) const;
virtual void initService();
virtual void connectService();
virtual void disconnectService();
+ virtual void cleanNodes();
std::list<Engines::ConnectionManager::connectionId> ids;
#endif
+ virtual void shutdown(int level);
virtual std::string getContainerLog();
+
+ virtual void addDatastreamPortToInitMultiService(const std::string & port_name,
+ int number);
+ private:
+ YACS::BASES::Mutex _mutex;
+ Engines::Superv_Component::seq_multiple_param _param;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
//#define REFCNT
//
#ifdef REFCNT
CORBA::Object_var obj;
if(data >>= CORBA::Any::to_object(obj))
{
- SALOME::GenericObj_var gobj=SALOME::GenericObj::_narrow(obj);
+ SALOME::GenericObj_var gobj;
+ try
+ {
+ gobj=SALOME::GenericObj::_narrow(obj);
+ }
+ catch(const CORBA::SystemException& )
+ {
+ return;
+ }
if(!CORBA::is_nil(gobj))
{
DEBTRACE("It's a SALOME::GenericObj");
- gobj->Destroy();
+ gobj->UnRegister();
}
else
DEBTRACE("It's a CORBA::Object but not a SALOME::GenericObj");
CORBA::Object_var obj;
if(data >>= CORBA::Any::to_object(obj))
{
- SALOME::GenericObj_var gobj=SALOME::GenericObj::_narrow(obj);
+ SALOME::GenericObj_var gobj;
+ try
+ {
+ gobj=SALOME::GenericObj::_narrow(obj);
+ }
+ catch(const CORBA::SystemException& )
+ {
+ return;
+ }
if(!CORBA::is_nil(gobj))
{
DEBTRACE("It's a SALOME::GenericObj");
#ifdef REFCNT
DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)data->pd_tc.in())->pd_ref_count);
#endif
+ YACS::BASES::Lock lock(&_mutex);
#ifdef _DEVDEBUG_
display(data);
#endif
return new InputCorbaPort(*this,newHelder);
}
-void *InputCorbaPort::get() const throw(Exception)
+void *InputCorbaPort::get() const throw(YACS::Exception)
{
return (void *)&_data;
}
PyObject * InputCorbaPort::getPyObj()
{
+ YACS::BASES::Lock lock(&_mutex);
CORBA::TypeCode_var tc=getAny()->type();
if (!tc->equivalent(CORBA::_tc_null))
return convertCorbaPyObject(edGetType(),getAny());
void OutputCorbaPort::put(CORBA::Any *data) throw (ConversionException)
{
InputPort *p;
+
+ {
+ YACS::BASES::Lock lock(&_mutex);
#ifdef REFCNT
- DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)data->pd_tc.in())->pd_ref_count);
+ DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)data->pd_tc.in())->pd_ref_count);
#endif
#ifdef REFCNT
- DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)_data.pd_tc.in())->pd_ref_count);
+ DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)_data.pd_tc.in())->pd_ref_count);
#endif
- releaseObj(_data);
+ releaseObj(_data);
- _data=*data;
+ _data=*data;
- //no registerObj : we steal the output reference of the node
+ //no registerObj : we steal the output reference of the node
+ }
#ifdef REFCNT
DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)_data.pd_tc.in())->pd_ref_count);
PyObject * OutputCorbaPort::getPyObj()
{
+ YACS::BASES::Lock lock(&_mutex);
CORBA::TypeCode_var tc=getAny()->type();
if (!tc->equivalent(CORBA::_tc_null))
return convertCorbaPyObject(edGetType(),getAny());
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _CORBAPORTS_HXX_
#define _CORBAPORTS_HXX_
#include <omniORB4/CORBA.h>
+#include "YACSRuntimeSALOMEExport.hxx"
#include "InputPort.hxx"
#include "OutputPort.hxx"
+#include "Mutex.hxx"
+
#include <string>
namespace YACS
*
* \see CORBANode
*/
- class InputCorbaPort : public InputPort
+ class YACSRUNTIMESALOME_EXPORT InputCorbaPort : public InputPort
{
public:
InputCorbaPort(const std::string& name, Node *node, TypeCode * type);
CORBA::Any _data;
CORBA::Any * _initData;
CORBA::ORB_ptr _orb;
+ private:
+ YACS::BASES::Mutex _mutex;
};
class OutputCorbaPort;
- std::ostream & operator<<( std::ostream &os,
- const YACS::ENGINE::OutputCorbaPort& p);
+ YACSRUNTIMESALOME_EXPORT std::ostream & operator<<(std::ostream &os,
+ const YACS::ENGINE::OutputCorbaPort& p);
- class OutputCorbaPort : public OutputPort
+ class YACSRUNTIMESALOME_EXPORT OutputCorbaPort : public OutputPort
{
friend std::ostream &operator<< ( std::ostream &os,
const OutputCorbaPort& p);
protected:
CORBA::Any _data;
CORBA::ORB_ptr _orb;
+ private:
+ YACS::BASES::Mutex _mutex;
};
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "RuntimeSALOME.hxx"
#include "CORBAPythonConv.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __CORBAPYTHONCONV_HXX__
#define __CORBAPYTHONCONV_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "CORBAXMLConv.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __CORBAXMLCONV_HXX__
#define __CORBAXMLCONV_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "CalStreamPort.hxx"
#include "SalomeComponent.hxx"
#include "CORBANode.hxx"
void InputCalStreamPort::setLevel(const std::string& value)
{
DEBTRACE("InputCalStreamPort::setLevel: " << value);
- _level =atoi(value.c_str());
+ std::istringstream iss(value);
+ int temp;
+ if (!(iss >> temp)|| temp<1)
+ throw Exception("StorageLevel property must be an integer > 0");
+ _level=temp;
}
void InputCalStreamPort::setAlpha(const std::string& value)
{
- double temp=atof(value.c_str());
- if(temp<0. || temp >1.)
- {
- throw Exception("Alpha property must be > 0 and < 1");
- }
+ std::istringstream iss(value);
+ double temp;
+ if (!(iss >> temp)||temp<0. || temp >1.)
+ throw Exception("Alpha property must be a float > 0 and < 1");
_alpha=temp;
}
void InputCalStreamPort::setDelta(const std::string& value)
{
- double temp=atof(value.c_str());
- if(temp<0. || temp >1.)
- {
- throw Exception("DeltaT property must be > 0 and < 1");
- }
+ std::istringstream iss(value);
+ double temp;
+ if (!(iss >> temp)||temp<0. || temp >1.)
+ throw Exception("DeltaT property must be > 0 and < 1");
_delta=temp;
}
void InputCalStreamPort::setInterp(const std::string& value)
return new OutputCalStreamPort(*this,newHelder);
}
-bool OutputCalStreamPort::addInPort(InPort *inPort) throw(Exception)
+bool OutputCalStreamPort::addInPort(InPort *inPort) throw(YACS::Exception)
{
DEBTRACE("OutputCalStreamPort::addInPort " << InputCalStreamPort::NAME );
if(inPort->getNameOfTypeOfCurrentInstance()!=InputCalStreamPort::NAME)
}
-int OutputCalStreamPort::removeInPort(InPort *inPort, bool forward) throw(Exception)
+int OutputCalStreamPort::removeInPort(InPort *inPort, bool forward) throw(YACS::Exception)
{
DEBTRACE("OutputCalStreamPort::removeInPort");
if(inPort->getNameOfTypeOfCurrentInstance()!=InputCalStreamPort::NAME && !forward)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __CALSTREAMPORT_HXX__
#define __CALSTREAMPORT_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "CppCORBAConv.hxx"
#include "RuntimeSALOME.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __CPPCORBACONV_HXX__
#define __CPPCORBACONV_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "RuntimeSALOME.hxx"
#include "CppComponent.hxx"
#include "CppContainer.hxx"
#include "TypeCode.hxx"
#include "CppNode.hxx"
-#include "DynLibLoader.hxx"
using namespace YACS::ENGINE;
f << "(type Bool) " << A.getBoolValue();
break;
case Objref :
- f << "(type Objref)";
+ f << "(type Objref)";
break;
case Sequence :
- f << "(type Sequence) ";
- {
+ f << "(type Sequence) ";
+ {
int i;
- const SequenceAny * sA = dynamic_cast<const SequenceAny *>(&A);
- for (i=0; i<sA->size(); i++)
- f << " " << *((*sA)[i]);
- }
+ const SequenceAny * sA = dynamic_cast<const SequenceAny *>(&A);
+ for (i=0; i<sA->size(); i++)
+ f << " " << *((*sA)[i]);
+ }
break;
}
return f;
CppComponent::CppComponent(const std::string &name) : ComponentInstance(name)
{
_container = getRuntime()->createContainer(CppNode::KIND);
- if (!_container->isAlreadyStarted())
- _container->start();
+ if (!_container->isAlreadyStarted(this))
+ _container->start(this);
CppContainer * _containerC = dynamic_cast<CppContainer *> (_container);
_containerC->createInternalInstance(name, __obj, __run, __terminate);
__terminate(other.__terminate), __obj(0)
{
_container = getRuntime()->createContainer(CppNode::KIND);
- if (!_container->isAlreadyStarted())
- _container->start();
+ if (!_container->isAlreadyStarted(this))
+ _container->start(this);
CppContainer * _containerC = dynamic_cast<CppContainer *> (_container);
_containerC->createInternalInstance(_compoName, __obj, __run, __terminate);
DEBTRACE("CppComponent::~CppComponent()");
if (__terminate) __terminate(&__obj);
if (_container)
- ((CppContainer *) _container)->unregisterComponentInstance(this);
+ ((CppContainer *) _container)->unregisterComponentInstance(this);
}
void CppComponent::run (const char * service, int nbIn, int nbOut,
- Any ** argIn, Any ** argOut) throw (YACS::Exception)
+ Any ** argIn, Any ** argOut) throw (YACS::Exception)
{
int i;
returnInfo return_code;
#ifdef _DEVDEBUG_
std::ostringstream sDebug;
- sDebug << _name << "::" << service << "(";
+ sDebug << getInstanceName() << "::" << service << "(";
for (i=0; i<nbIn; i++) {
sDebug << *(argIn[i]);
if (i<nbIn-1)
void CppComponent::load()
{
if (!_container) {
- _container = getRuntime()->createContainer(CppNode::KIND);
+ _container = getRuntime()->createContainer(CppNode::KIND);
}
if(_container) {
-
+
CppContainer * containerC= dynamic_cast< CppContainer *> (_container);
containerC->lock();//To be sure
- if(!_container->isAlreadyStarted())
+ if(!_container->isAlreadyStarted(this))
{
try
{
- _container->start();
+ _container->start(this);
}
catch(Exception& e)
{
containerC->unLock();
containerC->lock();//To be sure
- YACS::BASES::DynLibLoader D(_compoName + "Local");
-
bool isLoadable = containerC->loadComponentLibrary(_compoName);
if (isLoadable)
containerC->createInternalInstance(_compoName, __obj, __run, __terminate);
containerC->unLock();
return;
}
-
+
}
ServiceNode* CppComponent::createNode(const std::string& name)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __YACS_CppCOMPONENT__
#define __YACS_CppCOMPONENT__
CppComponent(const std::string & name);
CppComponent(void * obj, RunFunction r, TerminateFunction t,
- const std::string & name)
+ const std::string & name)
: __obj(obj), __run(r), __terminate(t), ComponentInstance(name) {}
CppComponent(const CppComponent& other);
virtual ~CppComponent();
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include <iostream>
#include <sstream>
+#ifdef WNT
+#include <windows.h>
+#define dlopen LoadLibrary
+#define dlclose FreeLibrary
+#define dlsym GetProcAddress
+#else
#include <dlfcn.h>
+#endif
#include "CppContainer.hxx"
#include "CppComponent.hxx"
_mutex.unlock();
}
-bool CppContainer::isAlreadyStarted() const
+bool CppContainer::isAlreadyStarted(const ComponentInstance *inst) const
{
return NULL != _trueCont;
}
-void CppContainer::start() throw (YACS::Exception)
+void CppContainer::start(const ComponentInstance *inst) throw (YACS::Exception)
{
- _trueCont = LocalContainer::get();
+ _trueCont = LocalContainer::get();
}
Container *CppContainer::clone() const
}
void CppContainer::createInternalInstance(const std::string & name, void *&obj,
- RunFunction &r, TerminateFunction &t)
+ RunFunction &r, TerminateFunction &t)
{
DEBTRACE("CppContainer::createInternalInstance");
if (_trueCont)
}
-std::string CppContainer::getPlacementId() const
+std::string CppContainer::getPlacementId(const ComponentInstance *inst) const
{
- return "/";
+ return "/";
}
-void CppContainer::checkCapabilityToDealWith(const ComponentInstance *inst) const throw (Exception)
+std::string CppContainer::getFullPlacementId(const ComponentInstance *inst) const
+{
+ return "/";
+}
+
+void CppContainer::checkCapabilityToDealWith(const ComponentInstance *inst) const throw(YACS::Exception)
{
if(inst->getKind()!=CppComponent::KIND)
throw Exception("CppContainer::checkCapabilityToDealWith : CppContainer is not able to deal with this type of ComponentInstance.");
std::multimap<std::string, CppComponent *>::iterator iI, iJ;
for (iI=_instance_map.begin(); iI != _instance_map.end(); iI = iJ)
{
- iJ = iI++;
- iI->second->setContainer(NULL);
- delete iI->second;
+ iJ = iI++;
+ iI->second->setContainer(NULL);
+ delete iI->second;
}
_instance_map.clear();
_instance_mapMutex.unlock(); // unlock
}
void LocalContainer::createInternalInstance(const char *name, void *&obj,
- RunFunction &r, TerminateFunction &t)
+ RunFunction &r, TerminateFunction &t)
{
LocalLibrary L;
void LocalContainer::unregisterComponentInstance(CppComponent * C)
{
- _instance_mapMutex.lock(); // lock to be alone
- _instance_map.erase(C->getCompoName());
- _instance_mapMutex.unlock(); // unlock
+ _instance_mapMutex.lock(); // lock to be alone
+ _instance_map.erase(C->getCompoName());
+ _instance_mapMutex.unlock(); // unlock
}
inline void toupper (std::string & s)
#endif
DEBTRACE("impl_name = " << impl_name);
- void* handle;
#if defined( WNT )
- handle = dlopen( impl_name.c_str() , 0 ) ;
+ HMODULE handle;
+ handle = dlopen( impl_name.c_str() ) ;
#else
+ void* handle;
handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ;
#endif
const char * sError;
- sError = dlerror();
+#if defined( WNT )
+ sError = "Not available here !";
+#endif
+#if defined( WNT )
+ if (!handle)
+#else
+ sError = dlerror();
if ((sError = dlerror()) || !handle)
+#endif
{
std::stringstream msg;
msg << "Can't load shared library : " << impl_name
void *ihandle, *rhandle, *phandle = NULL, *thandle = NULL;
ihandle = dlsym(handle, "__init");
+#if defined( WNT )
+ if (!ihandle)
+#else
if (sError = dlerror())
+#endif
{
dlclose(handle);
std::stringstream msg;
}
rhandle = dlsym(handle, "__run");
+#if defined( WNT )
+ if (!rhandle)
+#else
if (sError = dlerror())
+#endif
{
dlclose(handle);
std::stringstream msg;
}
thandle = dlsym(handle, "__terminate");
+#if defined( WNT )
+ if (!thandle)
+#else
if (sError = dlerror())
+#endif
{
dlclose(handle);
std::stringstream msg;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __Cpp_CONTAINER_HXX__
#define __Cpp_CONTAINER_HXX__
#include "Container.hxx"
#include "CppComponent.hxx"
+#ifdef WNT
+#include <windows.h>
+#endif
+
namespace YACS
{
namespace ENGINE
struct LocalLibrary {
+#if defined( WNT )
+ HMODULE handle;
+#else
void * handle;
+#endif
InitFunction initHandle;
RunFunction runHandle;
PingFunction pingHandle;
TerminateFunction terminateHandle;
+#if defined( WNT )
+ LocalLibrary(HMODULE h, InitFunction i, RunFunction r,
+#else
LocalLibrary(void *h, InitFunction i, RunFunction r,
+#endif
PingFunction p, TerminateFunction t)
- : handle(h), initHandle(i), runHandle(r),
+ : handle(h), initHandle(i), runHandle(r),
pingHandle(p), terminateHandle(t) {}
LocalLibrary()
- : handle(NULL), initHandle(NULL), runHandle(NULL),
+ : handle(NULL), initHandle(NULL), runHandle(NULL),
pingHandle(NULL), terminateHandle(NULL) {}
bool good() {
bool forcedLoad = false);
CppComponent * createComponentInstance(const char * componentName);
void createInternalInstance(const char * componentName,
- void *& obj, RunFunction &r, TerminateFunction &t);
+ void *& obj, RunFunction &r, TerminateFunction &t);
void unLoadComponentLibrary(const std::string & aCompName);
void unregisterComponentInstance(CppComponent * C);
CppContainer();
virtual ~CppContainer();
- bool isAlreadyStarted() const;
- void start() throw (YACS::Exception);
- std::string getPlacementId() const;
+ bool isAlreadyStarted(const ComponentInstance *inst) const;
+ void start(const ComponentInstance *inst) throw (YACS::Exception);
+ std::string getPlacementId(const ComponentInstance *inst) const;
+ std::string getFullPlacementId(const ComponentInstance *inst) const;
YACS::ENGINE::Container *clone() const;
void lock();
bool loadComponentLibrary(const std::string & componentName) throw (YACS::Exception);
CppComponent * createComponentInstance(const std::string & componentName, int studyID = 0);
void createInternalInstance(const std::string & componentName,
- void *& obj, RunFunction &r, TerminateFunction &t);
+ void *& obj, RunFunction &r, TerminateFunction &t);
void unregisterComponentInstance(CppComponent * C);
protected:
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "CppCppConv.hxx"
#include "CppPorts.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef CPPCPPCONV_HXX_
#define CPPCPPCONV_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "CppNeutralConv.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __CPPNEUTRALCONV_HXX__
#define __CPPNEUTRALCONV_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "CppNode.hxx"
#include "InputPort.hxx"
#include "OutputPort.hxx"
#include "CppPorts.hxx"
#include "CppContainer.hxx"
#include "CppComponent.hxx"
+#include "TypeCode.hxx"
#include <iostream>
#include <set>
}
if (_component)
- {
- CppComponent * _componentC = dynamic_cast<CppComponent *>(_component);
- if (!_componentC)
- throw YACS::Exception("CppNode::execute : bad type of component");
- _componentC->run(_method.c_str(), nIn, nOut, In, Out);
+ {
+ CppComponent * _componentC = dynamic_cast<CppComponent *>(_component);
+ if (!_componentC)
+ throw YACS::Exception("CppNode::execute : bad type of component");
+ _componentC->run(_method.c_str(), nIn, nOut, In, Out);
}
else if (_run)
- _run(nIn, nOut, In, Out);
+ _run(nIn, nOut, In, Out);
//output parameters
std::list<OutputPort *>::iterator iter2;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _CPPNODE_HXX_
#define _CPPNODE_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "CppPorts.hxx"
#include "Node.hxx"
return _data;
}
-void *InputCppPort::get() const throw(Exception)
+void *InputCppPort::get() const throw(YACS::Exception)
{
return (void*) _data;
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _CPPPORTS_HXX_
#define _CPPPORTS_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "CppPythonConv.hxx"
#include "TypeConversions.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __CPPPYTHONCONV_HXX__
#define __CPPPYTHONCONV_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "CppXMLConv.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __CPPXMLCONV_HXX__
#define __CPPXMLCONV_HXX__
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "DistributedPythonNode.hxx"
+#include "RuntimeSALOME.hxx"
+#include "SalomeContainer.hxx"
+#include "PythonNode.hxx"
+
+#include "PythonPorts.hxx"
+#include "YacsTrace.hxx"
+#include "PyStdout.hxx"
+
+using namespace YACS::ENGINE;
+using namespace std;
+
+const char DistributedPythonNode::KIND[]="DistPython";
+const char DistributedPythonNode::IMPL_NAME[]="Python";
+const char DistributedPythonNode::SALOME_CONTAINER_METHOD_IDL[]="createPyNode";
+
+Node *DistributedPythonNode::simpleClone(ComposedNode *father, bool editionOnly) const
+{
+ return new DistributedPythonNode(*this,father);
+}
+
+DistributedPythonNode::DistributedPythonNode(const std::string& name):ServerNode(name),_context(0),_pyfuncSer(0),_pyfuncUnser(0)
+{
+ initMySelf();
+}
+
+DistributedPythonNode::DistributedPythonNode(const DistributedPythonNode& other, ComposedNode *father):ServerNode(other,father),_context(0),_pyfuncSer(0),_pyfuncUnser(0)
+{
+ initMySelf();
+}
+
+DistributedPythonNode::~DistributedPythonNode()
+{
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ Py_DECREF(_context);
+ PyGILState_Release(gstate);
+}
+
+void DistributedPythonNode::load()
+{
+ ServerNode::load();
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ if( PyDict_SetItemString( _context, "__builtins__", getSALOMERuntime()->getBuiltins() ))
+ {
+ stringstream msg;
+ msg << "Impossible to set builtins" << __FILE__ << ":" << __LINE__;
+ PyGILState_Release(gstate);
+ _errorDetails=msg.str();
+ throw Exception(msg.str());
+ }
+ const char picklizeScript[]="import cPickle\ndef pickleForDistPyth2009(*args,**kws):\n return cPickle.dumps((args,kws),-1)\n\ndef unPickleForDistPyth2009(st):\n args=cPickle.loads(st)\n return args\n";
+ PyObject *res=PyRun_String(picklizeScript,Py_file_input,_context,_context);
+ if(res == NULL)
+ {
+ _errorDetails="";
+ PyObject* new_stderr = newPyStdOut(_errorDetails);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ PyErr_Print();
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ Py_DECREF(new_stderr);
+
+ PyGILState_Release(gstate);
+ throw Exception("Error during execution");
+ return;
+ }
+ Py_DECREF(res);
+ _pyfuncSer=PyDict_GetItemString(_context,"pickleForDistPyth2009");
+ _pyfuncUnser=PyDict_GetItemString(_context,"unPickleForDistPyth2009");
+ if(_pyfuncSer == NULL)
+ {
+ _errorDetails="";
+ PyObject* new_stderr = newPyStdOut(_errorDetails);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ PyErr_Print();
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ Py_DECREF(new_stderr);
+
+ PyGILState_Release(gstate);
+ throw Exception("Error during execution");
+ }
+ if(_pyfuncUnser == NULL)
+ {
+ _errorDetails="";
+ PyObject* new_stderr = newPyStdOut(_errorDetails);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ PyErr_Print();
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ Py_DECREF(new_stderr);
+
+ PyGILState_Release(gstate);
+ throw Exception("Error during execution");
+ }
+ DEBTRACE( "---------------End PyfuncSerNode::load function---------------" );
+ PyGILState_Release(gstate);
+}
+
+void DistributedPythonNode::execute()
+{
+ YACSTRACE(1,"+++++++++++++++++ DistributedPythonNode::execute: " << getName() << " " << getFname() << " +++++++++++++++++" );
+ {
+ Engines::Container_var objContainer=((SalomeContainer*)_container)->getContainerPtr(0);
+ Engines::PyNode_var pn=objContainer->createPyNode(getName().c_str(),getScript().c_str());
+ //////
+ int pos=0;
+ PyObject* ob;
+ if(!_pyfuncSer)
+ throw Exception("DistributedPythonNode badly loaded");
+ PyGILState_STATE gstate = PyGILState_Ensure();
+
+ DEBTRACE( "---------------DistributedPythonNode::inputs---------------" );
+ PyObject* args = PyTuple_New(getNumberOfInputPorts()) ;
+ list<InputPort *>::iterator iter2;
+ for(iter2 = _setOfInputPort.begin(); iter2 != _setOfInputPort.end(); iter2++)
+ {
+ InputPyPort *p=(InputPyPort *)*iter2;
+ ob=p->getPyObj();
+ Py_INCREF(ob);
+ PyTuple_SetItem(args,pos,ob);
+ pos++;
+ }
+ PyObject *serializationInput=PyObject_CallObject(_pyfuncSer,args);
+ std::string serializationInputC=PyString_AsString(serializationInput);
+ Engines::pickledArgs *serializationInputCorba=new Engines::pickledArgs;
+ int len=serializationInputC.length();
+ serializationInputCorba->length(serializationInputC.length());
+ for(int i=0;i<serializationInputC.length();i++)
+ (*serializationInputCorba)[i]=serializationInputC[i];
+ //serializationInputCorba[serializationInputC.length()]='\0';
+ DEBTRACE( "-----------------DistributedPythonNode starting remote python invocation-----------------" );
+ Engines::pickledArgs *resultCorba;
+ try
+ {
+ resultCorba=pn->execute(getFname().c_str(),*serializationInputCorba);
+ }
+ catch(...)
+ {
+ std::string msg="Exception on remote python invocation";
+ PyGILState_Release(gstate);
+ _errorDetails=msg;
+ throw Exception(msg);
+ }
+ DEBTRACE( "-----------------DistributedPythonNode end of remote python invocation-----------------" );
+ //
+ delete serializationInputCorba;
+ char *resultCorbaC=new char[resultCorba->length()+1];
+ resultCorbaC[resultCorba->length()]='\0';
+ for(int i=0;i<resultCorba->length();i++)
+ resultCorbaC[i]=(*resultCorba)[i];
+ delete resultCorba;
+ args = PyTuple_New(1);
+ PyObject* resultPython=PyString_FromString(resultCorbaC);
+ delete [] resultCorbaC;
+ PyTuple_SetItem(args,0,resultPython);
+ PyObject *finalResult=PyObject_CallObject(_pyfuncUnser,args);
+ DEBTRACE( "-----------------DistributedPythonNode::outputs-----------------" );
+ int nres=1;
+ if(finalResult == Py_None)
+ nres=0;
+ else if(PyTuple_Check(finalResult))
+ nres=PyTuple_Size(finalResult);
+
+ if(getNumberOfOutputPorts() != nres)
+ {
+ std::string msg="Number of output arguments : Mismatch between definition and execution";
+ Py_DECREF(finalResult);
+ PyGILState_Release(gstate);
+ _errorDetails=msg;
+ throw Exception(msg);
+ }
+
+ pos=0;
+ list<OutputPort *>::iterator iter;
+ try
+ {
+ for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
+ {
+ OutputPyPort *p=(OutputPyPort *)*iter;
+ DEBTRACE( "port name: " << p->getName() );
+ DEBTRACE( "port kind: " << p->edGetType()->kind() );
+ DEBTRACE( "port pos : " << pos );
+ if(PyTuple_Check(finalResult))ob=PyTuple_GetItem(finalResult,pos) ;
+ else ob=finalResult;
+ DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
+ p->put(ob);
+ pos++;
+ }
+ }
+ catch(ConversionException& ex)
+ {
+ Py_DECREF(finalResult);
+ PyGILState_Release(gstate);
+ _errorDetails=ex.what();
+ throw;
+ }
+ PyGILState_Release(gstate);
+ }
+ DEBTRACE( "++++++++++++++ End DistributedPythonNode::execute: " << getName() << " ++++++++++++++++++++" );
+}
+
+std::string DistributedPythonNode::getEffectiveKindOfServer() const
+{
+ return "Salome";
+}
+
+std::string DistributedPythonNode::getKind() const
+{
+ //! not a bug : this is to use classical python port translators.
+ return PythonNode::KIND;
+}
+
+ServerNode *DistributedPythonNode::createNode(const std::string& name) const
+{
+ ServerNode *ret=new DistributedPythonNode(name);
+ ret->setContainer(_container);
+ return ret;
+}
+
+void DistributedPythonNode::initMySelf()
+{
+ _implementation = DistributedPythonNode::IMPL_NAME;
+ PyGILState_STATE gstate=PyGILState_Ensure();
+ _context=PyDict_New();
+ PyGILState_Release(gstate);
+}
+
+void DistributedPythonNode::dealException(CORBA::Exception *exc, const char *method, const char *ref)
+{
+ if( exc )
+ {
+ DEBTRACE( "An exception was thrown!" );
+ DEBTRACE( "The raised exception is of Type:" << exc->_name() );
+
+ CORBA::SystemException* sysexc;
+ sysexc=CORBA::SystemException::_downcast(exc);
+ if(sysexc != NULL)
+ {
+ // It's a SystemException
+ DEBTRACE( "minor code: " << sysexc->minor() );
+ DEBTRACE( "completion code: " << sysexc->completed() );
+ std::string text="Execution problem: ";
+ std::string excname=sysexc->_name();
+ if(excname == "BAD_OPERATION")
+ {
+ text=text+"bad operation detected";
+ }
+ else if(excname == "MARSHAL" && sysexc->minor() == omni::MARSHAL_PassEndOfMessage)
+ {
+ text=text+"probably an error in arguments of service '" + method + "' from component '" +ref+ "'";
+ }
+ else if(excname == "COMM_FAILURE" && sysexc->minor() == omni::COMM_FAILURE_UnMarshalResults)
+ {
+ text=text+"probably an error in output arguments of service '" + method + "' from component '" +ref+ "'";
+ }
+ else if(excname == "COMM_FAILURE" && sysexc->minor() == omni::COMM_FAILURE_UnMarshalArguments)
+ {
+ text=text+"probably an error in input arguments of service '" + method + "' from component '" +ref+ "'";
+ }
+ else if(excname == "COMM_FAILURE" && sysexc->minor() == omni::COMM_FAILURE_WaitingForReply)
+ {
+ text=text+"probably an error in input arguments of service '" + method + "' from component '" +ref+ "'";
+ }
+ else
+ {
+ DEBTRACE(sysexc->NP_minorString() );
+ text=text+"System Exception "+ excname;
+ }
+ _errorDetails=text;
+ throw Exception(text);
+ }
+
+ // Not a System Exception
+ CORBA::UnknownUserException* userexc;
+ userexc=CORBA::UnknownUserException::_downcast(exc);
+ if(userexc != NULL)
+ {
+ CORBA::Any anyExcept = userexc->exception();
+
+ const SALOME::SALOME_Exception* salexc;
+ if(anyExcept >>= salexc)
+ {
+ DEBTRACE("SALOME_Exception: "<< salexc->details.sourceFile);
+ DEBTRACE("SALOME_Exception: "<<salexc->details.lineNumber);
+ _errorDetails=salexc->details.text;
+ throw Exception("Execution problem: Salome Exception occurred" + getErrorDetails() );
+ }
+ std::string msg="Execution problem: User Exception occurred";
+ _errorDetails=msg;
+ throw Exception(msg);
+ }
+ std::string msg="Execution problem";
+ _errorDetails=msg;
+ throw Exception(msg);
+ }
+}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef __DISTRIBUTEDPYTHONNODE_HXX__
+#define __DISTRIBUTEDPYTHONNODE_HXX__
+
+#include "ServerNode.hxx"
+
+// rnv: avoid compilation warning on Linux : "_POSIX_C_SOURCE" and "_XOPEN_SOURCE" are redefined
+#ifdef _POSIX_C_SOURCE
+#undef _POSIX_C_SOURCE
+#endif
+
+#ifdef _XOPEN_SOURCE
+#undef _XOPEN_SOURCE
+#endif
+
+#include <Python.h>
+#include <omniORB4/CORBA.h>
+#include "YACSRuntimeSALOMEExport.hxx"
+
+namespace YACS
+{
+ namespace ENGINE
+ {
+ class YACSRUNTIMESALOME_EXPORT DistributedPythonNode : public ServerNode
+ {
+ protected:
+ Node *simpleClone(ComposedNode *father, bool editionOnly) const;
+ public:
+ DistributedPythonNode(const std::string& name);
+ DistributedPythonNode(const DistributedPythonNode& other, ComposedNode *father);
+ ~DistributedPythonNode();
+ void execute();
+ void load();
+ //!this method returns the type of container expected
+ std::string getEffectiveKindOfServer() const;
+ //!this method returns the type of input/output expected
+ std::string getKind() const;
+ ServerNode *createNode(const std::string& name) const;
+ virtual std::string typeName() {return "YACS__ENGINE__DistributedPythonNode";}
+ private:
+ void initMySelf();
+ void dealException(CORBA::Exception *exc, const char *method, const char *ref);
+ public:
+ static const char KIND[];
+ static const char IMPL_NAME[];
+ static const char SALOME_CONTAINER_METHOD_IDL[];
+ protected:
+ PyObject* _context;
+ PyObject* _pyfuncSer;
+ PyObject* _pyfuncUnser;
+ };
+ }
+}
+
+#endif
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm/unix/make_begin.am
SUBDIRS = Test
PythonInitConv.cxx \
PythonNode.cxx \
SalomePythonNode.cxx \
+ DistributedPythonNode.cxx \
SalomePythonComponent.cxx \
SalomeContainer.cxx \
PythonPorts.cxx \
StudyPorts.cxx \
VisitorSaveSalomeSchema.cxx \
PyStdout.cxx \
+ SalomeOptimizerLoop.cxx \
+ PyOptimizerAlg.cxx \
$(__dummy__)
salomeinclude_HEADERS = \
+YACSRuntimeSALOMEExport.hxx \
CalStreamPort.hxx CORBAComponent.hxx CORBACORBAConv.hxx CORBACppConv.hxx \
CORBANeutralConv.hxx CORBANode.hxx CORBAPorts.hxx CORBAPythonConv.hxx \
CORBAXMLConv.hxx CppComponent.hxx CppContainer.hxx CppCORBAConv.hxx \
NeutralPythonConv.hxx NeutralXMLConv.hxx OutNode.hxx PresetNode.hxx \
PresetPorts.hxx PyStdout.hxx PythonCORBAConv.hxx PythonCppConv.hxx \
PythonNeutralConv.hxx PythonNode.hxx PythonPorts.hxx PythonXMLConv.hxx \
-RuntimeSALOME.hxx SalomeComponent.hxx SALOMEconfig.h SalomeContainer.hxx \
+RuntimeSALOME.hxx SalomeComponent.hxx SalomeContainer.hxx \
SALOMEDispatcher.hxx SalomeProc.hxx SalomePythonComponent.hxx SalomePythonNode.hxx \
SessionCataLoader.hxx StudyNodes.hxx StudyPorts.hxx TypeConversions.hxx \
VisitorSaveSalomeSchema.hxx XMLCORBAConv.hxx XMLCppConv.hxx XMLNeutralConv.hxx \
XMLNode.hxx XMLPorts.hxx XMLPythonConv.hxx PythonInitConv.hxx \
-NeutralInitConv.hxx
+NeutralInitConv.hxx SalomeOptimizerLoop.hxx DistributedPythonNode.hxx PyOptimizerAlg.hxx
EXTRA_libYACSRuntimeSALOME_la_SOURCES = \
$(__dummy__)
if SALOME_KERNEL
-libYACSRuntimeSALOME_la_SOURCES += ../../idl/yacsguiSK.cc
-SALOME_LIBS=-L$(KERNEL_ROOT_DIR)/lib$(LIB_LOCATION_SUFFIX)/salome -lSalomeLifeCycleCORBA
+SALOME_LIBS=$(KERNEL_LDFLAGS) -lSalomeLifeCycleCORBA -lSalomeIDLKernel -lSalomeNS -lSalomeContainer -lSALOMEBasics -lSalomeResourcesManager -lOpUtil -lSALOMELocalTrace -lRegistry -lSalomeNotification -lResourcesManager -lSalomeHDFPersist -lSalomeGenericObj
SALOME_INCL_PATH=-I$(KERNEL_ROOT_DIR)/include/salome
endif
if DSC_PORTS
-DSC_LIBS=-L$(KERNEL_ROOT_DIR)/lib$(LIB_LOCATION_SUFFIX)/salome -lSalomeDSCContainer
+DSC_LIBS=$(KERNEL_LDFLAGS) -lSalomeDSCContainer
endif
-# --- build libYACSRuntimeSALOME library before swig libraries (problem with make -j)
-
-BUILT_SOURCES=SALOMERuntimeWRAP.cxx libYACSRuntimeSALOME.la
-
libYACSRuntimeSALOME_la_LIBADD = \
- $(DSC_LIBS) $(SALOME_LIBS) $(OMNIORB_LIBS) \
+ $(DSC_LIBS) $(SALOME_LIBS) $(OMNIORB_LIBS) $(PYTHON_LIBS) $(LIBXML_LIBS) \
+ ../../idl/libSalomeIDLYACS.la \
../engine/libYACSlibEngine.la
AM_CXXFLAGS = \
-I../../idl \
$(LIBXML_INCLUDES)
-############################################################
-
-salomepython_PYTHON = SALOMERuntime.py
-salomepyexec_LTLIBRARIES = _SALOMERuntime.la
-
-_SALOMERuntime_la_SOURCES = \
- SALOMERuntimeWRAP.cxx
-
-MYSWIG_FLAGS = -noexcept -I$(srcdir)/../bases -I$(srcdir)/../engine
-
-SWIGINCLUDES= RuntimeSALOME.hxx SALOMEDispatcher.hxx SalomeProc.hxx PythonNode.hxx PythonPorts.hxx \
- CORBANode.hxx CORBAPorts.hxx TypeConversions.hxx \
- ../engine/pilot.i ../engine/engtypemaps.i
-
-SALOMERuntimeWRAP.cxx: SALOMERuntime.i $(SWIGINCLUDES)
- $(SWIG) $(SWIG_PYTHON_OPT) $(SWIG_PYTHON_INCLUDES) $(MYSWIG_FLAGS) -o $@ $(srcdir)/SALOMERuntime.i
-
-_SALOMERuntime_la_CXXFLAGS = \
- $(THREAD_DEF) \
- $(PYTHON_CPPFLAGS) \
- $(OMNIORB_INCLUDES) \
- $(OMNIORB_CXXFLAGS) \
- -I$(KERNEL_ROOT_DIR)/include/salome \
- -I$(srcdir)/../bases \
- -I$(srcdir)/../engine \
- -I../../idl \
- $(LIBXML_INCLUDES)
-
-_SALOMERuntime_la_LDFLAGS = -module
-
-_SALOMERuntime_la_LIBADD = libYACSRuntimeSALOME.la
-
-EXTRA_DIST = SALOMERuntime.i
-
include $(top_srcdir)/adm/unix/make_end.am
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "RuntimeSALOME.hxx"
#include "NeutralCORBAConv.hxx"
//delete Any that has been allocated by convertNeutralCorba
delete a;
}
+
+
+NeutralCorbaStruct::NeutralCorbaStruct(InputCorbaPort* p)
+ : ProxyPort(p), DataPort(p->getName(), p->getNode(), p->edGetType()), Port(p->getNode())
+{
+}
+
+void NeutralCorbaStruct::put(const void *data) throw(ConversionException)
+{
+ put((YACS::ENGINE::Any *)data);
+}
+
+//!Convert a Neutral::Any struct to CORBA::Any* struct
+/*!
+ * \param data : Neutral::Any object
+ */
+void NeutralCorbaStruct::put(YACS::ENGINE::Any *data) throw(ConversionException)
+{
+ CORBA::Any *a =convertNeutralCorba(edGetType(),data);
+ _port->put(a);
+ //delete Any that has been allocated by convertNeutralCorba
+ delete a;
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __NEUTRALCORBACONV_HXX__
#define __NEUTRALCORBACONV_HXX__
virtual void put(const void *data) throw(ConversionException);
void put(YACS::ENGINE::Any *data) throw(ConversionException);
};
+
+ class NeutralCorbaStruct : public ProxyPort
+ {
+ public:
+ NeutralCorbaStruct(InputCorbaPort* p);
+ virtual void put(const void *data) throw(ConversionException);
+ void put(YACS::ENGINE::Any *data) throw(ConversionException);
+ };
}
}
#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "NeutralCppConv.hxx"
#include "CppPorts.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef NEUTRALCPPCONV_HXX_
#define NEUTRALCPPCONV_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "NeutralInitConv.hxx"
#include "TypeCode.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __NEUTRALINITCONV_HXX__
#define __NEUTRALINITCONV_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "NeutralPythonConv.hxx"
#include "RuntimeSALOME.hxx"
DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
}
+void NeutralPyStruct::put(const void *data) throw(ConversionException)
+{
+ put((YACS::ENGINE::Any *)data);
+}
+//!Convert a Neutral::Any Struct to a PyObject Struct
+/*!
+ * \param data : Neutral::Any object
+ */
+void NeutralPyStruct::put(YACS::ENGINE::Any *data) throw(ConversionException)
+{
+ InterpreterUnlocker loc;
+ PyObject* ob=convertNeutralPyObject(edGetType(),data);
+ DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
+ _port->put(ob);
+ Py_DECREF(ob);
+ DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __NEUTRALPYTHONCONV_HXX__
#define __NEUTRALPYTHONCONV_HXX__
virtual void put(const void *data) throw(ConversionException);
void put(YACS::ENGINE::Any *data) throw(ConversionException);
};
+
+ class NeutralPyStruct : public ProxyPort
+ {
+ public:
+ NeutralPyStruct(InputPyPort* p)
+ : ProxyPort(p), DataPort(p->getName(), p->getNode(), p->edGetType()), Port(p->getNode()) {}
+ virtual void put(const void *data) throw(ConversionException);
+ void put(YACS::ENGINE::Any *data) throw(ConversionException);
+ };
}
}
#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "NeutralXMLConv.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __NEUTRALXMLCONV_HXX__
#define __NEUTRALXMLCONV_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "PresetPorts.hxx"
#include "OutNode.hxx"
#include "Visitor.hxx"
namespace ENGINE
{
+/*! \class YACS::ENGINE::OutNode
+ * \brief Class for data out node
+ *
+ * \ingroup Nodes
+ */
+
const char OutNode::IMPL_NAME[]="XML";
OutNode::OutNode(const std::string& name)
inp->setData(data);
}
-void OutNode::checkBasicConsistency() const throw(Exception)
+void OutNode::checkBasicConsistency() const throw(YACS::Exception)
{
DEBTRACE("OutNode::checkBasicConsistency");
if (! _setOfOutputPort.empty())
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _OUTNODE_HXX_
#define _OUTNODE_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "PresetPorts.hxx"
#include "PresetNode.hxx"
#include "Visitor.hxx"
using namespace YACS::ENGINE;
using namespace std;
+/*! \class YACS::ENGINE::PresetNode
+ * \brief Class for data in node
+ *
+ * \ingroup Nodes
+ */
+
const char PresetNode::IMPL_NAME[]="XML";
PresetNode::PresetNode(const std::string& name)
for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
{
OutputPresetPort *outp = dynamic_cast<OutputPresetPort *>(*iter);
- assert(outp);
+ YASSERT(outp);
string data = outp->getData();
DEBTRACE("data: " << data );
outp->put(data.c_str());
outp->setData(data);
}
-void PresetNode::checkBasicConsistency() const throw(Exception)
+void PresetNode::checkBasicConsistency() const throw(YACS::Exception)
{
DEBTRACE("PresetNode::checkBasicConsistency");
if (! _setOfInputPort.empty())
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _PRESETNODE_HXX_
#define _PRESETNODE_HXX_
+#include "YACSRuntimeSALOMEExport.hxx"
#include "DataNode.hxx"
namespace YACS
{
namespace ENGINE
{
- class PresetNode: public DataNode
+ class YACSRUNTIMESALOME_EXPORT PresetNode: public DataNode
{
protected:
Node *simpleClone(ComposedNode *father, bool editionOnly) const;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "PresetPorts.hxx"
#include "PythonPorts.hxx"
using namespace YACS::ENGINE;
using namespace std;
+/*! \class YACS::ENGINE::OutputPresetPort
+ * \brief Class for PRESET output Ports
+ *
+ * \ingroup Ports
+ *
+ * \see PresetNode
+ */
+
OutputPresetPort::OutputPresetPort(const std::string& name, Node* node, TypeCode* type)
: OutputXmlPort(name, node, type),
DataPort(name, node, type),
OutputPresetPort::OutputPresetPort(const OutputPresetPort& other, Node *newHelder)
: OutputXmlPort(other,newHelder),
DataPort(other,newHelder),
- Port(other,newHelder)
+ Port(other,newHelder),_storeData(other._storeData)
+{
+}
+
+OutputPort* OutputPresetPort::clone(Node *newHelder) const
{
+ return new OutputPresetPort(*this,newHelder);
}
void OutputPresetPort::setData(std::string data)
modified();
}
-void OutputPresetPort::checkBasicConsistency() const throw(Exception)
+void OutputPresetPort::checkBasicConsistency() const throw(YACS::Exception)
{
DEBTRACE("OutputPresetPort::checkBasicConsistency " << _storeData);
if (_storeData.empty())
break;
case Sequence:
case Array:
+ value="<value><array><data>"+_storeData+"</data></array></value>";
+ break;
case Struct:
+ value="<value><struct><data>"+_storeData+"</data></struct></value>";
+ break;
default:
break;
}
return s;
}
+/*! \class YACS::ENGINE::InputPresetPort
+ * \brief Class for PRESET input Ports
+ *
+ * \ingroup Ports
+ *
+ * \see OutNode
+ */
InputPresetPort::InputPresetPort(const std::string& name, Node* node, TypeCode* type)
: InputXmlPort(name, node, type),
InputPresetPort::InputPresetPort(const InputPresetPort& other, Node *newHelder)
: InputXmlPort(other,newHelder),
DataPort(other,newHelder),
- Port(other,newHelder)
+ Port(other,newHelder),_storeData(other._storeData)
+{
+}
+
+InputPort* InputPresetPort::clone(Node *newHelder) const
{
+ return new InputPresetPort(*this,newHelder);
}
void InputPresetPort::setData(std::string data)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _PRESETPORTS_HXX_
#define _PRESETPORTS_HXX_
#include <Python.h>
+
+#include "YACSRuntimeSALOMEExport.hxx"
#include "XMLPorts.hxx"
namespace YACS
{
namespace ENGINE
{
-
-/*! \brief Class for PRESET output Ports
- *
- * \ingroup Ports
- *
- * \see PresetNode
- */
- class OutputPresetPort: public OutputXmlPort
+ class YACSRUNTIMESALOME_EXPORT OutputPresetPort: public OutputXmlPort
{
public:
OutputPresetPort(const std::string& name, Node* node, TypeCode* type);
OutputPresetPort(const OutputPresetPort& other, Node *newHelder);
+ OutputPort *clone(Node *newHelder) const;
void setData(std::string data);
std::string getData();
virtual void checkBasicConsistency() const throw(Exception);
std::string _storeData;
};
-/*! \brief Class for PRESET input Ports
- *
- * \ingroup Ports
- *
- * \see OutNode
- */
- class InputPresetPort: public InputXmlPort
+ class YACSRUNTIMESALOME_EXPORT InputPresetPort: public InputXmlPort
{
public:
InputPresetPort(const std::string& name, Node* node, TypeCode* type);
InputPresetPort(const InputPresetPort& other, Node *newHelder);
+ InputPort *clone(Node *newHelder) const;
void setData(std::string data);
std::string getData();
virtual std::string dump();
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <iostream>
+
+// rnv: avoid compilation warning on Linux : "_POSIX_C_SOURCE" and "_XOPEN_SOURCE" are redefined
+#ifdef _POSIX_C_SOURCE
+#undef _POSIX_C_SOURCE
+#endif
+
+#ifdef _XOPEN_SOURCE
+#undef _XOPEN_SOURCE
+#endif
+#include <Python.h>
+
+#include "PyOptimizerAlg.hxx"
+
+using namespace std;
+using namespace YACS::BASES;
+using namespace YACS::ENGINE;
+
+struct GILState{
+ PyGILState_STATE gstate;
+ GILState(){gstate=PyGILState_Ensure();}
+ ~GILState(){PyGILState_Release(gstate);}
+};
+
+
+PyOptimizerAlgBase::PyOptimizerAlgBase(Pool *pool)
+ : OptimizerAlgBase(pool)
+{
+}
+
+PyOptimizerAlgBase::~PyOptimizerAlgBase()
+{
+}
+
+void PyOptimizerAlgBase::startProxy()
+{
+ GILState gs;
+ OptimizerAlgBase::startProxy();
+}
+
+void PyOptimizerAlgBase::takeDecisionProxy()
+{
+ GILState gs;
+ OptimizerAlgBase::takeDecisionProxy();
+}
+
+void PyOptimizerAlgBase::finishProxy()
+{
+ GILState gs;
+ OptimizerAlgBase::finishProxy();
+}
+
+void PyOptimizerAlgBase::initializeProxy(const Any *input) throw (YACS::Exception)
+{
+ GILState gs;
+ OptimizerAlgBase::initializeProxy(input);
+}
+
+TypeCode * PyOptimizerAlgBase::getTCForInProxy() const
+{
+ GILState gs;
+ return OptimizerAlgBase::getTCForInProxy();
+}
+
+TypeCode * PyOptimizerAlgBase::getTCForOutProxy() const
+{
+ GILState gs;
+ return OptimizerAlgBase::getTCForOutProxy();
+}
+
+TypeCode * PyOptimizerAlgBase::getTCForAlgoInitProxy() const
+{
+ GILState gs;
+ return OptimizerAlgBase::getTCForAlgoInitProxy();
+}
+
+TypeCode * PyOptimizerAlgBase::getTCForAlgoResultProxy() const
+{
+ GILState gs;
+ return OptimizerAlgBase::getTCForAlgoResultProxy();
+}
+
+Any * PyOptimizerAlgBase::getAlgoResultProxy()
+{
+ GILState gs;
+ return OptimizerAlgBase::getAlgoResultProxy();
+}
+
+
+PyOptimizerAlgASync::PyOptimizerAlgASync(Pool *pool)
+ : PyOptimizerAlgBase(pool)
+{
+}
+
+PyOptimizerAlgASync::~PyOptimizerAlgASync()
+{
+ if (getThreadStatus() == AlternateThread::UNEXISTING) return;
+
+ Py_BEGIN_ALLOW_THREADS;
+ try {
+ // Force the thread termination. We must allow Python threads for that because the
+ // thread cleanup includes some Python cleanup.
+ terminateSlaveThread();
+ } catch (const exception & e) {
+ cerr << "Exception happened in PyOptimizerAlgASync destructor: " << e.what() << endl;
+ } catch (...) {
+ cerr << "Unknown exception happened in PyOptimizerAlgASync destructor." << endl;
+ }
+ Py_END_ALLOW_THREADS;
+}
+
+void PyOptimizerAlgASync::startProxy()
+{
+ start();
+}
+
+void PyOptimizerAlgASync::takeDecisionProxy()
+{
+ takeDecision();
+}
+
+void PyOptimizerAlgASync::finishProxy()
+{
+ terminateSlaveThread();
+ PyOptimizerAlgBase::finishProxy();
+}
+
+void PyOptimizerAlgASync::start()
+{
+ AlternateThread::start();
+}
+
+void PyOptimizerAlgASync::takeDecision()
+{
+ signalSlaveAndWait();
+}
+
+void PyOptimizerAlgASync::signalMasterAndWait()
+{
+ Py_BEGIN_ALLOW_THREADS;
+ AlternateThread::signalMasterAndWait();
+ Py_END_ALLOW_THREADS;
+}
+
+void PyOptimizerAlgASync::run()
+{
+ GILState gs;
+ startToTakeDecision();
+}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef __PYOPTIMIZERALG_HXX__
+#define __PYOPTIMIZERALG_HXX__
+
+#include "YACSRuntimeSALOMEExport.hxx"
+#include "OptimizerAlg.hxx"
+
+namespace YACS
+{
+ namespace ENGINE
+ {
+ /*!
+ * \brief Base class factorizing common methods for python algorithms interfaces.
+ */
+ class YACSRUNTIMESALOME_EXPORT PyOptimizerAlgBase : public OptimizerAlgBase
+ {
+ public:
+ virtual ~PyOptimizerAlgBase();
+
+ virtual TypeCode *getTCForInProxy() const;
+ virtual TypeCode *getTCForOutProxy() const;
+ virtual TypeCode *getTCForAlgoInitProxy() const;
+ virtual TypeCode *getTCForAlgoResultProxy() const;
+ virtual void initializeProxy(const Any *input) throw (Exception);
+ virtual void startProxy();
+ virtual void takeDecisionProxy();
+ virtual void finishProxy();
+ virtual Any * getAlgoResultProxy();
+
+ protected:
+ PyOptimizerAlgBase(Pool *pool);
+ };
+
+ typedef PyOptimizerAlgBase PyOptimizerAlgSync;
+
+ /*!
+ * \brief Base class to implement in external dynamic lib or external python module
+ * in case of a non event oriented optimizer using Python code.
+ */
+ class YACSRUNTIMESALOME_EXPORT PyOptimizerAlgASync : public PyOptimizerAlgBase,
+ public YACS::BASES::AlternateThread
+ {
+ public:
+ virtual ~PyOptimizerAlgASync();
+
+ virtual void startProxy();
+ virtual void takeDecisionProxy();
+ virtual void finishProxy();//! Called when optimization has succeed.
+ virtual void signalMasterAndWait();
+
+ protected:
+ PyOptimizerAlgASync(Pool *pool);
+
+ virtual void start();//! Update _pool attribute before performing anything.
+ virtual void takeDecision();//! _pool->getCurrentId gives the \b id at the origin of this call.
+ //! Perform the job of analysing to know what new jobs to do (_pool->pushInSample)
+ //! or in case of convergence _pool->destroyAll
+
+ virtual void run();
+ //! _pool->getCurrentId gives the \b id at the origin of this call.
+ //! Perform the job between 2 'condition->wait()' of analysing to know what new jobs to do
+ //! (_pool->pushInSample) or in case of convergence _pool->destroyAll
+ //! WARNING ! 'condition->wait()' must be called before any analyse of Pool.
+ virtual void startToTakeDecision()=0;
+ };
+ }
+}
+
+#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "PyStdout.hxx"
#include <structmember.h>
+#include <string>
namespace YACS
{
return NULL;
//std::cerr << c ;
- *(self->out)=*(self->out)+c;
+ *(self->out)=*(self->out)+std::string(c);
Py_INCREF(Py_None);
return Py_None;
};
static PyMemberDef PyStdOut_memberlist[] = {
- {"softspace", T_INT, offsetof(PyStdOut, softspace), 0,
- "flag indicating that a space needs to be printed; used by print"},
+ {(char*)"softspace", T_INT, offsetof(PyStdOut, softspace), 0,
+ (char*)"flag indicating that a space needs to be printed; used by print"},
{NULL} /* Sentinel */
};
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _PYSTDOUT_HXX_
#define _PYSTDOUT_HXX_
+#include "YACSRuntimeSALOMEExport.hxx"
+
#include <Python.h>
#include <iostream>
{
namespace ENGINE
{
- PyObject * newPyStdOut( std::string& out );
+ YACSRUNTIMESALOME_EXPORT PyObject * newPyStdOut( std::string& out );
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
//#define REFCNT
//
#ifdef REFCNT
#include "PythonCORBAConv.hxx"
#include "TypeConversions.hxx"
#include "RuntimeSALOME.hxx"
+#include "PythonPorts.hxx"
#include <iostream>
void PyCorbaInt::put(PyObject *data) throw(ConversionException)
{
CORBA::Any *a= convertPyObjectCorba(_port->edGetType(),data);
+ YACS::ENGINE::InterpreterSaveThread _loc;
_port->put(a);
delete a;
}
void PyCorbaBool::put(PyObject *data) throw(ConversionException)
{
CORBA::Any *a= convertPyObjectCorba(_port->edGetType(),data);
+ YACS::ENGINE::InterpreterSaveThread _loc;
_port->put(a);
//delete Any that has been allocated by convertPyObjectCorba
delete a;
void PyCorbaString::put(PyObject *data) throw(ConversionException)
{
CORBA::Any *a= convertPyObjectCorba(_port->edGetType(),data);
+ YACS::ENGINE::InterpreterSaveThread _loc;
_port->put(a);
delete a;
}
void PyCorbaDouble::put(PyObject *data) throw(ConversionException)
{
CORBA::Any *a= convertPyObjectCorba(_port->edGetType(),data);
+ YACS::ENGINE::InterpreterSaveThread _loc;
_port->put(a);
delete a;
}
std::cerr << std::endl;
#endif
CORBA::Any *a= convertPyObjectCorba(_port->edGetType(),data);
+ YACS::ENGINE::InterpreterSaveThread _loc;
_port->put(a);
#ifdef REFCNT
DEBTRACE("refcount CORBA seqTC: " << ((omni::TypeCode_base*)a->pd_tc.in())->pd_ref_count);
std::cerr << std::endl;
#endif
CORBA::Any *a= convertPyObjectCorba(_port->edGetType(),data);
+ YACS::ENGINE::InterpreterSaveThread _loc;
_port->put(a);
delete a;
}
std::cerr << std::endl;
#endif
CORBA::Any *a= convertPyObjectCorba(_port->edGetType(),data);
+ YACS::ENGINE::InterpreterSaveThread _loc;
_port->put(a);
#ifdef REFCNT
DEBTRACE("refcount CORBA structTC: " << ((omni::TypeCode_base*)a->pd_tc.in())->pd_ref_count);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __PYTHONCORBACONV_HXX__
#define __PYTHONCORBACONV_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "PythonCppConv.hxx"
#include "TypeConversions.hxx"
#include "RuntimeSALOME.hxx"
+#include "PythonPorts.hxx"
#include <iostream>
YACS::ENGINE::Any *a;
//Do not need to take the Python GIL as put is called from Python node
a = convertPyObjectCpp(edGetType(), data);
+ YACS::ENGINE::InterpreterSaveThread _loc;
DEBTRACE( "before put refcnt: " << a->getRefCnt() );
_port->put(a);
//_port has called incRef
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __PYTHONCPPCONV_HXX__
#define __PYTHONCPPCONV_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "PythonInitConv.hxx"
#include "Node.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __PYTHONINITCONV_HXX__
#define __PYTHONINITCONV_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "PythonNeutralConv.hxx"
+#include "PythonPorts.hxx"
#include <iostream>
#include <sstream>
YACS::ENGINE::Any *ob;
//Do not need to take the Python GIL as put is called from Python node
ob=convertPyObjectNeutral(edGetType(),data);
+ YACS::ENGINE::InterpreterSaveThread _loc;
DEBTRACE( "before put refcnt: " << ob->getRefCnt() );
_port->put(ob);
//_port has called incRef
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __PYTHONNEUTRALCONV_HXX__
#define __PYTHONNEUTRALCONV_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "RuntimeSALOME.hxx"
#include "PythonNode.hxx"
#include "PythonPorts.hxx"
+#include "TypeCode.hxx"
+#include "Container.hxx"
+#include "SalomeContainer.hxx"
+#include "ConversionException.hxx"
#include "PyStdout.hxx"
#include <iostream>
#include <sstream>
+#include <fstream>
+
+#ifdef WNT
+#include <process.h>
+#define getpid _getpid
+#endif
+
+#if PY_VERSION_HEX < 0x02050000
+typedef int Py_ssize_t;
+#endif
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
_implementation=IMPL_NAME;
PyGILState_STATE gstate=PyGILState_Ensure();
_context=PyDict_New();
+ if( PyDict_SetItemString( _context, "__builtins__", getSALOMERuntime()->getBuiltins() ))
+ {
+ stringstream msg;
+ msg << "Impossible to set builtins" << __FILE__ << ":" << __LINE__;
+ PyGILState_Release(gstate);
+ _errorDetails=msg.str();
+ throw Exception(msg.str());
+ }
PyGILState_Release(gstate);
}
_implementation=IMPL_NAME;
PyGILState_STATE gstate = PyGILState_Ensure();
_context=PyDict_New();
+ if( PyDict_SetItemString( _context, "__builtins__", getSALOMERuntime()->getBuiltins() ))
+ {
+ stringstream msg;
+ msg << "Impossible to set builtins" << __FILE__ << ":" << __LINE__;
+ PyGILState_Release(gstate);
+ _errorDetails=msg.str();
+ throw Exception(msg.str());
+ }
PyGILState_Release(gstate);
}
PyGILState_Release(gstate);
}
+void PythonNode::checkBasicConsistency() const throw(YACS::Exception)
+{
+ DEBTRACE("checkBasicConsistency");
+ InlineNode::checkBasicConsistency();
+
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject* res;
+ res=Py_CompileString(_script.c_str(),getName().c_str(),Py_file_input);
+ if(res == NULL)
+ {
+ std::string error="";
+ PyObject* new_stderr = newPyStdOut(error);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ PyErr_Print();
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ Py_DECREF(new_stderr);
+ PyGILState_Release(gstate);
+ throw Exception(error);
+ }
+ else
+ Py_XDECREF(res);
+ PyGILState_Release(gstate);
+}
+
void PythonNode::load()
{
+ DEBTRACE( "---------------PyNode::load function---------------" );
+ if(_mode=="remote")
+ loadRemote();
+ else
+ loadLocal();
+}
+
+void PythonNode::loadLocal()
+{
+ DEBTRACE( "---------------PyNode::loadLocal function---------------" );
+ // do nothing
+}
+
+void PythonNode::loadRemote()
+{
+ DEBTRACE( "---------------PyNode::loadRemote function---------------" );
+ if(_container)
+ {
+ if(!_container->isAlreadyStarted(0))
+ {
+ try
+ {
+ _container->start(0);
+ }
+ catch(Exception& e)
+ {
+ _errorDetails=e.what();
+ throw e;
+ }
+ }
+ }
+ else
+ {
+ std::string what("PyNode::loadRemote : a load operation requested on \"");
+ what+=_name; what+="\" with no container specified.";
+ _errorDetails=what;
+ throw Exception(what);
+ }
+
+ Engines::Container_var objContainer=((SalomeContainer*)_container)->getContainerPtr(0);
+
+ try
+ {
+ _pynode = objContainer->createPyScriptNode(getName().c_str(),getScript().c_str());
+ }
+ catch( const SALOME::SALOME_Exception& ex )
+ {
+ std::string msg="Exception on remote python node creation ";
+ msg += '\n';
+ msg += ex.details.text.in();
+ _errorDetails=msg;
+ throw Exception(msg);
+ }
+
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ const char picklizeScript[]="import cPickle\n"
+ "def pickleForDistPyth2009(kws):\n"
+ " return cPickle.dumps(((),kws),-1)\n"
+ "\n"
+ "def unPickleForDistPyth2009(st):\n"
+ " args=cPickle.loads(st)\n"
+ " return args\n";
+ PyObject *res=PyRun_String(picklizeScript,Py_file_input,_context,_context);
+ if(res == NULL)
+ {
+ _errorDetails="";
+ PyObject* new_stderr = newPyStdOut(_errorDetails);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ PyErr_Print();
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ Py_DECREF(new_stderr);
+
+ PyGILState_Release(gstate);
+ throw Exception("Error during load");
+ }
+ Py_DECREF(res);
+
+ _pyfuncSer=PyDict_GetItemString(_context,"pickleForDistPyth2009");
+ _pyfuncUnser=PyDict_GetItemString(_context,"unPickleForDistPyth2009");
+ if(_pyfuncSer == NULL)
+ {
+ _errorDetails="";
+ PyObject* new_stderr = newPyStdOut(_errorDetails);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ PyErr_Print();
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ Py_DECREF(new_stderr);
+
+ PyGILState_Release(gstate);
+ throw Exception("Error during load");
+ }
+ if(_pyfuncUnser == NULL)
+ {
+ _errorDetails="";
+ PyObject* new_stderr = newPyStdOut(_errorDetails);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ PyErr_Print();
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ Py_DECREF(new_stderr);
+
+ PyGILState_Release(gstate);
+ throw Exception("Error during load");
+ }
+ DEBTRACE( "---------------End PyNode::loadRemote function---------------" );
+ PyGILState_Release(gstate);
+
}
void PythonNode::execute()
{
- DEBTRACE( "++++++++++++++ PyNode::execute: " << getName() << " ++++++++++++++++++++" );
+ if(_mode=="remote")
+ executeRemote();
+ else
+ executeLocal();
+}
+
+void PythonNode::executeRemote()
+{
+ DEBTRACE( "++++++++++++++ PyNode::executeRemote: " << getName() << " ++++++++++++++++++++" );
+ if(!_pyfuncSer)
+ throw Exception("DistributedPythonNode badly loaded");
PyGILState_STATE gstate = PyGILState_Ensure();
- if( PyDict_SetItemString( _context, "__builtins__", getSALOMERuntime()->getBuiltins() ))
+
+ //===========================================================================
+ // Get inputs in input ports, build a Python dict and pickle it
+ //===========================================================================
+ PyObject* ob;
+ PyObject* args = PyDict_New();
+ std::list<InputPort *>::iterator iter2;
+ int pos=0;
+ for(iter2 = _setOfInputPort.begin(); iter2 != _setOfInputPort.end(); ++iter2)
+ {
+ InputPyPort *p=(InputPyPort *)*iter2;
+ ob=p->getPyObj();
+ PyDict_SetItemString(args,p->getName().c_str(),ob);
+ pos++;
+ }
+#ifdef _DEVDEBUG_
+ PyObject_Print(args,stderr,Py_PRINT_RAW);
+ std::cerr << endl;
+#endif
+ PyObject *serializationInput=PyObject_CallFunctionObjArgs(_pyfuncSer,args,NULL);
+ //The pickled string may contain NULL characters so use PyString_AsStringAndSize
+ char* serializationInputC;
+ Py_ssize_t len;
+ if (PyString_AsStringAndSize(serializationInput, &serializationInputC, &len))
{
- stringstream msg;
- msg << "Impossible to set builtins" << __FILE__ << ":" << __LINE__;
PyGILState_Release(gstate);
- _errorDetails=msg.str();
- throw Exception(msg.str());
+ throw Exception("DistributedPythonNode problem in python pickle");
}
+ PyGILState_Release(gstate);
+
+ Engines::pickledArgs_var serializationInputCorba=new Engines::pickledArgs;
+ serializationInputCorba->length(len);
+ for(int i=0; i < len ; i++)
+ serializationInputCorba[i]=serializationInputC[i];
+
+ //get the list of output argument names
+ std::list<OutputPort *>::iterator iter;
+ Engines::listofstring myseq;
+ myseq.length(getNumberOfOutputPorts());
+ pos=0;
+ for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); ++iter)
+ {
+ OutputPyPort *p=(OutputPyPort *)*iter;
+ myseq[pos]=p->getName().c_str();
+ DEBTRACE( "port name: " << p->getName() );
+ DEBTRACE( "port kind: " << p->edGetType()->kind() );
+ DEBTRACE( "port pos : " << pos );
+ pos++;
+ }
+ //===========================================================================
+ // Execute in remote Python node
+ //===========================================================================
+ DEBTRACE( "-----------------starting remote python invocation-----------------" );
+ Engines::pickledArgs_var resultCorba;
+ try
+ {
+ //pass outargsname and dict serialized
+ resultCorba=_pynode->execute(myseq,serializationInputCorba);
+ }
+ catch( const SALOME::SALOME_Exception& ex )
+ {
+ std::string msg="Exception on remote python invocation";
+ msg += '\n';
+ msg += ex.details.text.in();
+ _errorDetails=msg;
+ throw Exception(msg);
+ }
+ DEBTRACE( "-----------------end of remote python invocation-----------------" );
+ //===========================================================================
+ // Get results, unpickle and put them in output ports
+ //===========================================================================
+ char *resultCorbaC=new char[resultCorba->length()+1];
+ resultCorbaC[resultCorba->length()]='\0';
+ for(int i=0;i<resultCorba->length();i++)
+ resultCorbaC[i]=resultCorba[i];
+
+ gstate = PyGILState_Ensure();
+
+ PyObject* resultPython=PyString_FromStringAndSize(resultCorbaC,resultCorba->length());
+ delete [] resultCorbaC;
+ args = PyTuple_New(1);
+ PyTuple_SetItem(args,0,resultPython);
+ PyObject *finalResult=PyObject_CallObject(_pyfuncUnser,args);
+ Py_DECREF(args);
+
+ if (finalResult == NULL)
+ {
+ std::stringstream msg;
+ msg << "Conversion with pickle of output ports failed !";
+ msg << " : " << __FILE__ << ":" << __LINE__;
+ PyGILState_Release(gstate);
+ _errorDetails=msg.str();
+ throw YACS::ENGINE::ConversionException(msg.str());
+ }
+
+ DEBTRACE( "-----------------PythonNode::outputs-----------------" );
+ int nres=1;
+ if(finalResult == Py_None)
+ nres=0;
+ else if(PyTuple_Check(finalResult))
+ nres=PyTuple_Size(finalResult);
+
+ if(getNumberOfOutputPorts() != nres)
+ {
+ std::string msg="Number of output arguments : Mismatch between definition and execution";
+ Py_DECREF(finalResult);
+ PyGILState_Release(gstate);
+ _errorDetails=msg;
+ throw Exception(msg);
+ }
+
+ pos=0;
+ try
+ {
+ for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); ++iter)
+ {
+ OutputPyPort *p=(OutputPyPort *)*iter;
+ DEBTRACE( "port name: " << p->getName() );
+ DEBTRACE( "port kind: " << p->edGetType()->kind() );
+ DEBTRACE( "port pos : " << pos );
+ if(PyTuple_Check(finalResult))
+ ob=PyTuple_GetItem(finalResult,pos) ;
+ else
+ ob=finalResult;
+ DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
+ p->put(ob);
+ pos++;
+ }
+ Py_DECREF(finalResult);
+ }
+ catch(ConversionException& ex)
+ {
+ Py_DECREF(finalResult);
+ PyGILState_Release(gstate);
+ _errorDetails=ex.what();
+ throw;
+ }
+
+ PyGILState_Release(gstate);
+
+ DEBTRACE( "++++++++++++++ ENDOF PyNode::executeRemote: " << getName() << " ++++++++++++++++++++" );
+}
+
+void PythonNode::executeLocal()
+{
+ DEBTRACE( "++++++++++++++ PyNode::executeLocal: " << getName() << " ++++++++++++++++++++" );
+ PyGILState_STATE gstate = PyGILState_Ensure();
DEBTRACE( "---------------PyNode::inputs---------------" );
list<InputPort *>::iterator iter2;
DEBTRACE( "----------------PyNode::calculation---------------" );
DEBTRACE( _script );
DEBTRACE( "_context refcnt: " << _context->ob_refcnt );
- PyObject *res=PyRun_String(_script.c_str(),Py_file_input,_context,_context);
+
+ std::ostringstream stream;
+ stream << "/tmp/PythonNode_";
+ stream << getpid();
+
+ PyObject* code=Py_CompileString(_script.c_str(), stream.str().c_str(), Py_file_input);
+ if(code == NULL)
+ {
+ _errorDetails="";
+ PyObject* new_stderr = newPyStdOut(_errorDetails);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ PyErr_Print();
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ Py_DECREF(new_stderr);
+ PyGILState_Release(gstate);
+ throw Exception("Error during execution");
+ }
+ PyObject *res = PyEval_EvalCode((PyCodeObject *)code, _context, _context);
+ Py_DECREF(code);
DEBTRACE( "_context refcnt: " << _context->ob_refcnt );
fflush(stdout);
fflush(stderr);
{
_errorDetails="";
PyObject* new_stderr = newPyStdOut(_errorDetails);
- PySys_SetObject("stderr", new_stderr);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ ofstream errorfile(stream.str().c_str());
+ if (errorfile.is_open())
+ {
+ errorfile << _script;
+ errorfile.close();
+ }
PyErr_Print();
- PySys_SetObject("stderr", PySys_GetObject("__stderr__"));
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
Py_DECREF(new_stderr);
PyGILState_Release(gstate);
DEBTRACE( "++++++++++++++ End PyNode::execute: " << getName() << " ++++++++++++++++++++" );
}
+std::string PythonNode::getContainerLog()
+{
+ if(_mode=="local")return "";
+
+ std::string msg;
+ try
+ {
+ Engines::Container_var objContainer=((SalomeContainer*)_container)->getContainerPtr(0);
+ CORBA::String_var logname = objContainer->logfilename();
+ DEBTRACE(logname);
+ msg=logname;
+ std::string::size_type pos = msg.find(":");
+ msg=msg.substr(pos+1);
+ }
+ catch(...)
+ {
+ msg = "Container no longer reachable";
+ }
+ return msg;
+}
+
+void PythonNode::shutdown(int level)
+{
+ DEBTRACE("PythonNode::shutdown " << level);
+ if(_mode=="local")return;
+ if(_container)
+ {
+ if(!CORBA::is_nil(_pynode)) _pynode->UnRegister();
+ _pynode=Engines::PyScriptNode::_nil();
+ _container->shutdown(level);
+ }
+}
+
Node *PythonNode::simpleClone(ComposedNode *father, bool editionOnly) const
{
return new PythonNode(*this,father);
if(_pyfunc)DEBTRACE( "_pyfunc refcnt: " << _pyfunc->ob_refcnt );
Py_DECREF(_context);
PyGILState_Release(gstate);
+ if(!CORBA::is_nil(_pynode))
+ {
+ _pynode->UnRegister();
+ }
+}
+
+void PyFuncNode::checkBasicConsistency() const throw(YACS::Exception)
+{
+ DEBTRACE("checkBasicConsistency");
+ InlineFuncNode::checkBasicConsistency();
+
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject* res;
+ res=Py_CompileString(_script.c_str(),getName().c_str(),Py_file_input);
+ if(res == NULL)
+ {
+ std::string error="";
+ PyObject* new_stderr = newPyStdOut(error);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ PyErr_Print();
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ Py_DECREF(new_stderr);
+ PyGILState_Release(gstate);
+ throw Exception(error);
+ }
+ else
+ Py_XDECREF(res);
+ PyGILState_Release(gstate);
}
void PyFuncNode::load()
+{
+ DEBTRACE( "---------------PyfuncNode::load function---------------" );
+ if(_mode=="remote")
+ loadRemote();
+ else
+ loadLocal();
+}
+
+void PyFuncNode::loadRemote()
+{
+ DEBTRACE( "---------------PyfuncNode::loadRemote function---------------" );
+ if(_container)
+ {
+ if(!_container->isAlreadyStarted(0))
+ {
+ try
+ {
+ _container->start(0);
+ }
+ catch(Exception& e)
+ {
+ _errorDetails=e.what();
+ throw e;
+ }
+ }
+ }
+ else
+ {
+ std::string what("PyFuncNode::loadRemote : a load operation requested on \"");
+ what+=_name; what+="\" with no container specified.";
+ _errorDetails=what;
+ throw Exception(what);
+ }
+
+ Engines::Container_var objContainer=((SalomeContainer*)_container)->getContainerPtr(0);
+ try
+ {
+ _pynode = objContainer->createPyNode(getName().c_str(),getScript().c_str());
+ }
+ catch( const SALOME::SALOME_Exception& ex )
+ {
+ std::string msg="Exception on remote python node creation ";
+ msg += '\n';
+ msg += ex.details.text.in();
+ _errorDetails=msg;
+ throw Exception(msg);
+ }
+
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ const char picklizeScript[]="import cPickle\n"
+ "def pickleForDistPyth2009(*args,**kws):\n"
+ " return cPickle.dumps((args,kws),-1)\n"
+ "\n"
+ "def unPickleForDistPyth2009(st):\n"
+ " args=cPickle.loads(st)\n"
+ " return args\n";
+ PyObject *res=PyRun_String(picklizeScript,Py_file_input,_context,_context);
+ if(res == NULL)
+ {
+ _errorDetails="";
+ PyObject* new_stderr = newPyStdOut(_errorDetails);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ PyErr_Print();
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ Py_DECREF(new_stderr);
+
+ PyGILState_Release(gstate);
+ throw Exception("Error during load");
+ }
+ Py_DECREF(res);
+
+ _pyfuncSer=PyDict_GetItemString(_context,"pickleForDistPyth2009");
+ _pyfuncUnser=PyDict_GetItemString(_context,"unPickleForDistPyth2009");
+ if(_pyfuncSer == NULL)
+ {
+ _errorDetails="";
+ PyObject* new_stderr = newPyStdOut(_errorDetails);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ PyErr_Print();
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ Py_DECREF(new_stderr);
+
+ PyGILState_Release(gstate);
+ throw Exception("Error during load");
+ }
+ if(_pyfuncUnser == NULL)
+ {
+ _errorDetails="";
+ PyObject* new_stderr = newPyStdOut(_errorDetails);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ PyErr_Print();
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ Py_DECREF(new_stderr);
+
+ PyGILState_Release(gstate);
+ throw Exception("Error during load");
+ }
+ DEBTRACE( "---------------End PyfuncNode::loadRemote function---------------" );
+ PyGILState_Release(gstate);
+}
+
+void PyFuncNode::loadLocal()
{
DEBTRACE( "---------------PyFuncNode::load function " << getName() << " ---------------" );
DEBTRACE( _script );
+
#ifdef _DEVDEBUG_
list<OutputPort *>::iterator iter;
for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
DEBTRACE( "port kind: " << p->edGetType()->kind() );
}
#endif
+
PyGILState_STATE gstate = PyGILState_Ensure();
DEBTRACE( "_context refcnt: " << _context->ob_refcnt );
- PyObject *res=PyRun_String(_script.c_str(),Py_file_input,_context,_context);
+
+ std::ostringstream stream;
+ stream << "/tmp/PythonNode_";
+ stream << getpid();
+
+ PyObject* code=Py_CompileString(_script.c_str(), stream.str().c_str(), Py_file_input);
+ if(code == NULL)
+ {
+ _errorDetails="";
+ PyObject* new_stderr = newPyStdOut(_errorDetails);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ PyErr_Print();
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ Py_DECREF(new_stderr);
+ PyGILState_Release(gstate);
+ throw Exception("Error during execution");
+ }
+ PyObject *res = PyEval_EvalCode((PyCodeObject *)code, _context, _context);
+ Py_DECREF(code);
+
DEBTRACE( "_context refcnt: " << _context->ob_refcnt );
if(res == NULL)
{
_errorDetails="";
PyObject* new_stderr = newPyStdOut(_errorDetails);
- PySys_SetObject("stderr", new_stderr);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ ofstream errorfile(stream.str().c_str());
+ if (errorfile.is_open())
+ {
+ errorfile << _script;
+ errorfile.close();
+ }
PyErr_Print();
- PySys_SetObject("stderr", PySys_GetObject("__stderr__"));
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
Py_DECREF(new_stderr);
PyGILState_Release(gstate);
{
_errorDetails="";
PyObject* new_stderr = newPyStdOut(_errorDetails);
- PySys_SetObject("stderr", new_stderr);
+ PySys_SetObject((char*)"stderr", new_stderr);
PyErr_Print();
- PySys_SetObject("stderr", PySys_GetObject("__stderr__"));
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
Py_DECREF(new_stderr);
PyGILState_Release(gstate);
}
void PyFuncNode::execute()
+{
+ if(_mode=="remote")
+ executeRemote();
+ else
+ executeLocal();
+}
+
+void PyFuncNode::executeRemote()
+{
+ DEBTRACE( "++++++++++++++ PyFuncNode::executeRemote: " << getName() << " ++++++++++++++++++++" );
+ if(!_pyfuncSer)
+ throw Exception("DistributedPythonNode badly loaded");
+ PyGILState_STATE gstate = PyGILState_Ensure();
+
+ //===========================================================================
+ // Get inputs in input ports, build a Python tuple and pickle it
+ //===========================================================================
+ PyObject* ob;
+ PyObject* args = PyTuple_New(getNumberOfInputPorts());
+ std::list<InputPort *>::iterator iter2;
+ int pos=0;
+ for(iter2 = _setOfInputPort.begin(); iter2 != _setOfInputPort.end(); ++iter2)
+ {
+ InputPyPort *p=(InputPyPort *)*iter2;
+ ob=p->getPyObj();
+ Py_INCREF(ob);
+ PyTuple_SetItem(args,pos,ob);
+ pos++;
+ }
+#ifdef _DEVDEBUG_
+ PyObject_Print(args,stderr,Py_PRINT_RAW);
+ std::cerr << endl;
+#endif
+ PyObject *serializationInput=PyObject_CallObject(_pyfuncSer,args);
+ //The pickled string may contain NULL characters so use PyString_AsStringAndSize
+ char* serializationInputC;
+ Py_ssize_t len;
+ if (PyString_AsStringAndSize(serializationInput, &serializationInputC, &len))
+ {
+ PyGILState_Release(gstate);
+ throw Exception("DistributedPythonNode problem in python pickle");
+ }
+ PyGILState_Release(gstate);
+
+ Engines::pickledArgs_var serializationInputCorba=new Engines::pickledArgs;
+ serializationInputCorba->length(len);
+ for(int i=0; i < len ; i++)
+ serializationInputCorba[i]=serializationInputC[i];
+
+ //===========================================================================
+ // Execute in remote Python node
+ //===========================================================================
+ DEBTRACE( "-----------------starting remote python invocation-----------------" );
+ Engines::pickledArgs_var resultCorba;
+ try
+ {
+ resultCorba=_pynode->execute(getFname().c_str(),serializationInputCorba);
+ }
+ catch( const SALOME::SALOME_Exception& ex )
+ {
+ std::string msg="Exception on remote python invocation";
+ msg += '\n';
+ msg += ex.details.text.in();
+ _errorDetails=msg;
+ throw Exception(msg);
+ }
+ DEBTRACE( "-----------------end of remote python invocation-----------------" );
+ //===========================================================================
+ // Get results, unpickle and put them in output ports
+ //===========================================================================
+ char *resultCorbaC=new char[resultCorba->length()+1];
+ resultCorbaC[resultCorba->length()]='\0';
+ for(int i=0;i<resultCorba->length();i++)
+ resultCorbaC[i]=resultCorba[i];
+
+ gstate = PyGILState_Ensure();
+
+ PyObject* resultPython=PyString_FromStringAndSize(resultCorbaC,resultCorba->length());
+ delete [] resultCorbaC;
+ args = PyTuple_New(1);
+ PyTuple_SetItem(args,0,resultPython);
+ PyObject *finalResult=PyObject_CallObject(_pyfuncUnser,args);
+ Py_DECREF(args);
+
+ DEBTRACE( "-----------------PythonNode::outputs-----------------" );
+ int nres=1;
+ if(finalResult == Py_None)
+ nres=0;
+ else if(PyTuple_Check(finalResult))
+ nres=PyTuple_Size(finalResult);
+
+ if(getNumberOfOutputPorts() != nres)
+ {
+ std::string msg="Number of output arguments : Mismatch between definition and execution";
+ Py_DECREF(finalResult);
+ PyGILState_Release(gstate);
+ _errorDetails=msg;
+ throw Exception(msg);
+ }
+
+ pos=0;
+ std::list<OutputPort *>::iterator iter;
+ try
+ {
+ for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); ++iter)
+ {
+ OutputPyPort *p=(OutputPyPort *)*iter;
+ DEBTRACE( "port name: " << p->getName() );
+ DEBTRACE( "port kind: " << p->edGetType()->kind() );
+ DEBTRACE( "port pos : " << pos );
+ if(PyTuple_Check(finalResult))
+ ob=PyTuple_GetItem(finalResult,pos) ;
+ else
+ ob=finalResult;
+ DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
+ p->put(ob);
+ pos++;
+ }
+ Py_DECREF(finalResult);
+ }
+ catch(ConversionException& ex)
+ {
+ Py_DECREF(finalResult);
+ PyGILState_Release(gstate);
+ _errorDetails=ex.what();
+ throw;
+ }
+
+ PyGILState_Release(gstate);
+
+ DEBTRACE( "++++++++++++++ ENDOF PyFuncNode::executeRemote: " << getName() << " ++++++++++++++++++++" );
+}
+
+void PyFuncNode::executeLocal()
{
DEBTRACE( "++++++++++++++ PyFuncNode::execute: " << getName() << " ++++++++++++++++++++" );
+
int pos=0;
PyObject* ob;
if(!_pyfunc)throw Exception("PyFuncNode badly loaded");
{
_errorDetails="";
PyObject* new_stderr = newPyStdOut(_errorDetails);
- PySys_SetObject("stderr", new_stderr);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ std::ostringstream stream;
+ stream << "/tmp/PythonNode_";
+ stream << getpid();
+ ofstream errorfile(stream.str().c_str());
+ if (errorfile.is_open())
+ {
+ errorfile << _script;
+ errorfile.close();
+ }
PyErr_Print();
- PySys_SetObject("stderr", PySys_GetObject("__stderr__"));
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
Py_DECREF(new_stderr);
PyGILState_Release(gstate);
}
return n;
}
+
+std::string PyFuncNode::getContainerLog()
+{
+ if(_mode=="local")return "";
+
+ std::string msg;
+ try
+ {
+ Engines::Container_var objContainer=((SalomeContainer*)_container)->getContainerPtr(0);
+ CORBA::String_var logname = objContainer->logfilename();
+ DEBTRACE(logname);
+ msg=logname;
+ std::string::size_type pos = msg.find(":");
+ msg=msg.substr(pos+1);
+ }
+ catch(...)
+ {
+ msg = "Container no longer reachable";
+ }
+ return msg;
+}
+
+void PyFuncNode::shutdown(int level)
+{
+ DEBTRACE("PyFuncNode::shutdown " << level);
+ if(_mode=="local")return;
+ if(_container)
+ {
+ if(!CORBA::is_nil(_pynode)) _pynode->UnRegister();
+ _pynode=Engines::PyNode::_nil();
+ _container->shutdown(level);
+ }
+}
+
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _PYTHONNODE_HXX_
#define _PYTHONNODE_HXX_
+#include "YACSRuntimeSALOMEExport.hxx"
#include "InlineNode.hxx"
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOME_PyNode)
+
#include <Python.h>
namespace YACS
{
namespace ENGINE
{
- class PythonNode : public InlineNode
+ class YACSRUNTIMESALOME_EXPORT PythonNode : public InlineNode
{
protected:
Node *simpleClone(ComposedNode *father, bool editionOnly) const;
PythonNode(const PythonNode& other, ComposedNode *father);
PythonNode(const std::string& name);
virtual ~PythonNode();
+ virtual void checkBasicConsistency() const throw(Exception);
virtual void execute();
virtual void load();
+ virtual void loadRemote();
+ virtual void loadLocal();
+ virtual void executeRemote();
+ virtual void executeLocal();
+ virtual void shutdown(int level);
+ std::string getContainerLog();
PythonNode* cloneNode(const std::string& name);
static const char KIND[];
static const char IMPL_NAME[];
virtual std::string typeName() {return "YACS__ENGINE__PythonNode";}
protected:
PyObject* _context;
+ PyObject* _pyfuncSer;
+ PyObject* _pyfuncUnser;
+ Engines::PyScriptNode_var _pynode;
};
class PyFuncNode : public InlineFuncNode
PyFuncNode(const PyFuncNode& other, ComposedNode *father);
PyFuncNode(const std::string& name);
virtual ~PyFuncNode();
+ virtual void checkBasicConsistency() const throw(Exception);
virtual void execute();
virtual void load();
+ virtual void loadRemote();
+ virtual void loadLocal();
+ virtual void executeRemote();
+ virtual void executeLocal();
+ virtual void shutdown(int level);
+ std::string getContainerLog();
PyFuncNode* cloneNode(const std::string& name);
virtual std::string typeName() {return "YACS__ENGINE__PyFuncNode";}
protected:
PyObject* _context;
PyObject* _pyfunc;
+ PyObject* _pyfuncSer;
+ PyObject* _pyfuncUnser;
+ Engines::PyNode_var _pynode;
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "PythonPorts.hxx"
#include "TypeConversions.hxx"
#include "TypeCode.hxx"
return _data;
}
-void *InputPyPort::get() const throw(Exception)
+void *InputPyPort::get() const throw(YACS::Exception)
{
return (void*) _data;
}
std::string InputPyPort::getAsString()
{
- return convertPyObjectToString(_data);
+ std::string ret;
+ //protect _data against modification or delete in another thread
+ PyObject* data=_data;
+ Py_INCREF(data);
+ ret = convertPyObjectToString(data);
+ Py_XDECREF(data);
+ return ret;
}
bool InputPyPort::isEmpty()
std::string OutputPyPort::getAsString()
{
- return convertPyObjectToString(_data);
+ std::string ret;
+ //protect _data against modification or delete in another thread
+ PyObject* data=_data;
+ Py_INCREF(data);
+ ret = convertPyObjectToString(data);
+ Py_XDECREF(data);
+ return ret;
}
std::string OutputPyPort::dump()
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _PYTHONPORTS_HXX_
#define _PYTHONPORTS_HXX_
#include <Python.h>
+#include "YACSRuntimeSALOMEExport.hxx"
#include "InputPort.hxx"
#include "OutputPort.hxx"
PyGILState_STATE gstate_;
};
+ class InterpreterSaveThread {
+ public:
+ inline InterpreterSaveThread() {
+ tstate_ = PyEval_SaveThread();
+ }
+ inline ~InterpreterSaveThread() {
+ PyEval_RestoreThread(tstate_);
+ }
+ inline void lock() {
+ PyEval_RestoreThread(tstate_);
+ }
+ inline void unlock() {
+ tstate_ = PyEval_SaveThread();
+ }
+ private:
+ PyThreadState* tstate_;
+ };
+
+
typedef PyObject PyObj;
/*! \brief Class for Python Ports
*
* \see PythonNode
*/
- class InputPyPort : public InputPort
+ class YACSRUNTIMESALOME_EXPORT InputPyPort : public InputPort
{
public:
InputPyPort(const std::string& name, Node * node, TypeCode * type);
PyObject* _initData;
};
- class OutputPyPort : public OutputPort
+ class YACSRUNTIMESALOME_EXPORT OutputPyPort : public OutputPort
{
public:
OutputPyPort(const std::string& name, Node * node, TypeCode * type);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "PythonXMLConv.hxx"
#include "Node.hxx"
+#include "PythonPorts.hxx"
#include <iostream>
{
DEBTRACE("PyXml::put" );
std::string sss = convertPyObjectXml(edGetType(),data);
+ YACS::ENGINE::InterpreterSaveThread _loc;
((InputXmlPort*)_port)->put((const char*)sss.c_str());
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __PYTHONXMLCONV_HXX__
#define __PYTHONXMLCONV_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
//#define REFCNT
//
#ifdef REFCNT
#include "TypeCode.hxx"
#include "WhileLoop.hxx"
#include "ForLoop.hxx"
+#include "SalomeOptimizerLoop.hxx"
#include "Bloc.hxx"
#include "InputPort.hxx"
#include "OutputPort.hxx"
#include "OutNode.hxx"
#include "StudyNodes.hxx"
#include "SalomePythonNode.hxx"
+#include "DistributedPythonNode.hxx"
//CORBA proxy ports
#include "CORBACORBAConv.hxx"
RuntimeSALOME* YACS::ENGINE::getSALOMERuntime()
{
- assert(Runtime::_singleton);
+ YASSERT(Runtime::_singleton);
return dynamic_cast< RuntimeSALOME* >(Runtime::_singleton);
}
RuntimeSALOME::RuntimeSALOME()
{
- assert(0);
+ YASSERT(0);
}
void RuntimeSALOME::initBuiltins()
nodeMap["OutNode"]=new OutNode("OutNode");
nodeMap["StudyInNode"]=new StudyInNode("StudyInNode");
nodeMap["StudyOutNode"]=new StudyOutNode("StudyOutNode");
+ composednodeMap["OptimizerLoop"]=createOptimizerLoop("OptimizerLoop","","",true);
+ typeMap["dblevec"]= createSequenceTc("dblevec","dblevec",_tc_double);
+ typeMap["intvec"]= createSequenceTc("intvec","intvec",_tc_int);
+ typeMap["stringvec"]= createSequenceTc("stringvec","stringvec",_tc_string);
+ typeMap["boolvec"]= createSequenceTc("boolvec","boolvec",_tc_bool);
+ typeMap["seqdblevec"]= createSequenceTc("seqdblevec","seqdblevec",typeMap["dblevec"]);
+ typeMap["seqintvec"]= createSequenceTc("seqintvec","seqintvec",typeMap["intvec"]);
+ typeMap["seqstringvec"]= createSequenceTc("seqstringvec","seqstringvec",typeMap["stringvec"]);
+ typeMap["seqboolvec"]= createSequenceTc("seqboolvec","seqboolvec",typeMap["boolvec"]);
+ std::list<TypeCodeObjref *> ltc;
+ typeMap["pyobj"]= createInterfaceTc("python:obj:1.0","pyobj",ltc);
+ ENGINE::TypeCodeStruct *t = createStructTc("","Engines/dataref");
+ t->addMember("ref",_tc_string);
+ typeMap["dataref"]= t;
}
RuntimeSALOME::RuntimeSALOME(long flags)
return new SalomeProc(name);
}
+TypeCode * RuntimeSALOME::createInterfaceTc(const std::string& id, const std::string& name,
+ std::list<TypeCodeObjref *> ltc)
+{
+ std::string myName;
+ if(id == "") myName = "IDL:" + name + ":1.0";
+ else myName = id;
+ return TypeCode::interfaceTc(myName.c_str(),name.c_str(),ltc);
+}
+
+TypeCode * RuntimeSALOME::createSequenceTc(const std::string& id,
+ const std::string& name,
+ TypeCode *content)
+{
+ return TypeCode::sequenceTc(id.c_str(),name.c_str(),content);
+};
+
+TypeCodeStruct * RuntimeSALOME::createStructTc(const std::string& id, const std::string& name)
+{
+ std::string myName;
+ if(id == "") myName = "IDL:" + name + ":1.0";
+ else myName = id;
+ return (TypeCodeStruct *)TypeCode::structTc(myName.c_str(),name.c_str());
+}
+
Bloc* RuntimeSALOME::createBloc(const std::string& name)
{
return new Bloc(name);
return new ForLoop(name);
}
+OptimizerLoop* RuntimeSALOME::createOptimizerLoop(const std::string& name,const std::string& algLib,const std::string& factoryName,
+ bool algInitOnFile, const std::string& kind, Proc * procForTypes)
+{
+ OptimizerLoop * ol = (kind == "base") ? new OptimizerLoop(name,algLib,factoryName,algInitOnFile, true, procForTypes) :
+ new SalomeOptimizerLoop(name,algLib,factoryName,algInitOnFile, true, procForTypes);
+ ol->edGetNbOfBranchesPort()->edInit(1);
+ return ol;
+}
+
DataNode* RuntimeSALOME::createInDataNode(const std::string& kind,const std::string& name)
{
DataNode* node;
node = new PyFuncNode(name);
return node;
}
+ if(kind == DistributedPythonNode::KIND)
+ return new DistributedPythonNode(name);
std::string msg="FuncNode kind ("+kind+") unknown";
throw Exception(msg);
}
}
}
+//! Adapter function for InPropertyPort
+/*!
+ * \param source : InPropertyPort to be adapted
+ * \param impl : new implementation (C++, python, CORBA, XML, Neutral)
+ * \param type : data type provided by the InPropertyPort
+ * \param init : indicates if the adapted InPropertyPort will be used for initialization (value true) or not (value false)
+ *
+ * \return : adapted InputPort
+ */
+InputPort* RuntimeSALOME::adapt(InPropertyPort* source,
+ const std::string& impl,
+ TypeCode * type,bool init) throw (ConversionException)
+{
+ return adaptNeutral((InputPort *)source,impl,type,init);
+}
+
//! Adapt a Neutral input port to a Corba output port
/*!
* \param inport : Neutral input port to adapt to Corba type type
}
//non convertible type
stringstream msg;
- msg << "Cannot connect Neutral InputPort to OutputCorbaPort : " ;
- msg << "(" <<__FILE__ << ":" <<__LINE__<< ")";
+ msg << "Cannot connect Corba output port with type: " << type->id() ;
+ msg << " to Neutral input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
}
//non convertible type
stringstream msg;
- msg << "Cannot connect Neutral InputPort to OutputPyPort : " ;
- msg << "(" <<__FILE__ << ":" <<__LINE__<< ")";
+ msg << "Cannot connect Python output port with type: " << type->id() ;
+ msg << " to Neutral input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
}
//non convertible type
stringstream msg;
- msg << "Cannot connect Neutral InputPort to OutputXmlPort : " ;
- msg << "(" <<__FILE__ << ":" <<__LINE__<< ")";
+ msg << "Cannot connect Xml output port with type: " << type->id() ;
+ msg << " to Neutral input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
}
//non convertible type
stringstream msg;
- msg << "Cannot connect Neutral " << inport->edGetType()->getKindRepr()
- << " InputPort to " << type->getKindRepr() << " OutputCppPort : " ;
- msg << "(" <<__FILE__ << ":" <<__LINE__<< ")";
+ msg << "Cannot connect Cpp output port with type: " << type->id() ;
+ msg << " to Neutral input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
}
//output type is not convertible
stringstream msg;
- msg << "Cannot connect InputXmlPort to Corba output port " ;
- msg << type->id() << " != " << inport->edGetType()->id();
- msg << " ("__FILE__ << ":" << __LINE__ << ")";
+ msg << "Cannot connect Corba output port with type: " << type->id() ;
+ msg << " to Xml input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
}
//non convertible type
stringstream msg;
- msg << "Cannot connect Xml InputPort to OutputPyPort : " ;
- msg << "(" <<__FILE__ << ":" <<__LINE__<< ")";
+ msg << "Cannot connect Python output port with type: " << type->id() ;
+ msg << " to Xml input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
}
//non convertible type
stringstream msg;
- msg << "Cannot connect Xml InputPort to OutputCppPort : " ;
- msg << "(" <<__FILE__ << ":" <<__LINE__<< ")";
+ msg << "Cannot connect Cpp output port with type: " << type->id() ;
+ msg << " to Xml input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
throw ConversionException(msg.str());
}
+//! Adapt a XML input port to a Xml output port
+/*!
+ * \param inport : input port to adapt to Xml type type
+ * \param type : output port type
+ * \param init : if init is true the proxy port will be used in initialization of input port (needs value check)
+ * \return an adaptated input port of type Xmlxxxx
+ */
+InputPort* RuntimeSALOME::adaptXmlToXml(InputXmlPort* inport,
+ TypeCode * type,bool init) throw (ConversionException)
+{
+ if(init)
+ return new ProxyPort(inport);
+
+ if(inport->edGetType()->isAdaptable(type))
+ return new ProxyPort(inport);
+
+ stringstream msg;
+ msg << "Cannot connect Xml output port with type: " << type->id() ;
+ msg << " to Xml input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
+ throw ConversionException(msg.str());
+}
+
//! Adapt an Xml input port to an output port which implementation is given by impl
/*!
* \param source : input port to adapt to implementation impl and type type
}
else if(impl == XmlNode::IMPL_NAME )
{
- if(init)
- return new ProxyPort(source);
- else
- return new ProxyPort(source);
+ return adaptXmlToXml(source,type,init);
}
else if(impl == Runtime::RUNTIME_ENGINE_INTERACTION_IMPL_NAME)
{
}
//outport data can not be converted
stringstream msg;
- msg << "Cannot connect 2 CorbaPort with non convertible types: " ;
- msg << type->id() << " != " << inport->edGetType()->id();
+ msg << "Cannot connect Corba output port with type: " << type->id() ;
+ msg << " to CORBA input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
else
{
stringstream msg;
- msg << "Cannot connect Python output port with type: " << type->id() ;
+ msg << "Cannot connect Python output port with type: " << type->id() ;
msg << " to CORBA input port " << inport->getName() << " with incompatible objref type: " << inport->edGetType()->id();
msg << " (" << __FILE__ << ":" <<__LINE__ << ")";
throw ConversionException(msg.str());
}
// Adaptation not possible
stringstream msg;
- msg << "Cannot connect Python output port with type: " << type->id() ;
+ msg << "Cannot connect Python output port with type: " << type->id() ;
msg << " to CORBA input port " << inport->getName() << " with type: " << inport->edGetType()->id();
- msg << " (" << __FILE__ << ":" <<__LINE__ << ")";
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
}
//output type is not convertible
stringstream msg;
- msg << "Cannot connect InputCorbaPort with OutputXmlPort : " ;
- msg << __FILE__ << ":" <<__LINE__;
+ msg << "Cannot connect Xml output port with type: " << type->id() ;
+ msg << " to Corba input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
}
//output type is not convertible
stringstream msg;
- msg << "Cannot connect InputCorbaPort with OutputCppPort : " ;
- msg << __FILE__ << ":" <<__LINE__;
+ msg << "Cannot connect Cpp output port with type: " << type->id() ;
+ msg << " to Corba input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
throw ConversionException(msg.str());
}
}
+ else if(inport->edGetType()->kind() == Struct)
+ {
+ if(isAdaptableCorbaNeutral(type,inport->edGetType())) return new NeutralCorbaStruct(inport);
+ }
// Adaptation not possible
stringstream msg;
- msg << "Cannot connect InputCorbaPort to Neutral output " ;
- msg << __FILE__ << ":" <<__LINE__;
+ msg << "Cannot connect Neutral output port with type: " << type->id() ;
+ msg << " to Corba input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
}
//output data is not convertible to input type
stringstream msg;
- msg << "Cannot connect Python output port with type: " << type->id() ;
+ msg << "Cannot connect Python output port with type: " << type->id() ;
msg << " to Python input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
}
//output type is not convertible
stringstream msg;
- msg << "Cannot connect InputPythonPort with OutputCppPort : " ;
- msg << __FILE__ << ":" <<__LINE__;
+ msg << "Cannot connect Cpp output port with type: " << type->id() ;
+ msg << " to Python input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
throw ConversionException(msg.str());
}
}
+ else if(inport->edGetType()->kind() == Struct)
+ {
+ if(isAdaptablePyObjectNeutral(type,inport->edGetType())) return new NeutralPyStruct(inport);
+ }
+
// Adaptation not possible
stringstream msg;
- msg << "Cannot connect InputPyPort to Neutral output " ;
- msg << "Output typeid: " << type->id() << " Input typeid: " << inport->edGetType()->id();
- msg << " ("__FILE__ << ":" << __LINE__ << ")";
+ msg << "Cannot connect Neutral output port with type: " << type->id() ;
+ msg << " to Python input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
stringstream msg;
msg << "Cannot connect Corba output port with type: " << type->id() ;
msg << " to Python input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
msg << " ("__FILE__ << ":" << __LINE__ << ")";
+#endif
throw ConversionException(msg.str());
}
}
//non convertible type
stringstream msg;
- msg << "Cannot connect InputPyPort with OutputXmlPort : " ;
- msg << "(" <<__FILE__ << ":" <<__LINE__<< ")";
+ msg << "Cannot connect Xml output port with type: " << type->id() ;
+ msg << " to Python input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
}
//output type is not convertible
stringstream msg;
- msg << "Cannot connect InputCppPort to Corba output port " ;
- msg << type->id() << " != " << inport->edGetType()->id();
- msg << " ("__FILE__ << ":" << __LINE__ << ")";
+ msg << "Cannot connect Corba output port with type: " << type->id() ;
+ msg << " to Cpp input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
}
//output type is not convertible
stringstream msg;
- msg << "Cannot connect InputCppPort with OutputPythonPort : " ;
- msg << __FILE__ << ":" <<__LINE__;
+ msg << "Cannot connect Python output port with type: " << type->id() ;
+ msg << " to Cpp input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
}
//non convertible type
stringstream msg;
- msg << "Cannot connect Cpp InputPort to OutputCppPort : " ;
- msg << "(" <<__FILE__ << ":" <<__LINE__<< ")";
+ msg << "Cannot connect Cpp output port with type: " << type->id() ;
+ msg << " to Cpp input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
}
//non convertible type
stringstream msg;
- msg << "Cannot connect Cpp InputPort to OutputNeutralPort : " ;
- msg << "(" <<__FILE__ << ":" <<__LINE__<< ")";
+ msg << "Cannot connect Neutral output port with type: " << type->id() ;
+ msg << " to Cpp input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
InputPort* RuntimeSALOME::adaptCppToXml(InputCppPort* inport,
TypeCode * type) throw (ConversionException)
{
- DEBTRACE("RuntimeSALOME::adaptCppToXml(InputCppPort* inport" );
- if(isAdaptableCppXml(type,inport->edGetType()))
- {
+ DEBTRACE("RuntimeSALOME::adaptCppToXml(InputCppPort* inport" );
+ if(isAdaptableCppXml(type,inport->edGetType()))
+ {
//convertible type
return new XmlCpp(inport);
- }
- //non convertible type
- stringstream msg;
- msg << "Cannot connect InputCppPort with OutputXmlPort : " ;
- msg << "(" <<__FILE__ << ":" <<__LINE__<< ")";
+ }
+ //non convertible type
+ stringstream msg;
+ msg << "Cannot connect Xml output port with type: " << type->id() ;
+ msg << " to Cpp input port " << inport->getName() << " with type: " << inport->edGetType()->id();
+#ifdef _DEVDEBUG_
+ msg << " ("<<__FILE__ << ":" << __LINE__<<")";
+#endif
throw ConversionException(msg.str());
}
//exception
std::string error;
PyObject* new_stderr = newPyStdOut(error);
- PySys_SetObject("stderr", new_stderr);
+ PySys_SetObject((char *)"stderr", new_stderr);
PyErr_Print();
- PySys_SetObject("stderr", PySys_GetObject("__stderr__"));
+ PySys_SetObject((char *)"stderr", PySys_GetObject((char *)"__stderr__"));
Py_DECREF(new_stderr);
PyGILState_Release(gstate);
throw Exception(error);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _RUNTIMESALOME_HXX_
#define _RUNTIMESALOME_HXX_
+#include "YACSRuntimeSALOMEExport.hxx"
+
+// rnv: avoid compilation warning on Linux : "_POSIX_C_SOURCE" and "_XOPEN_SOURCE" are redefined
+#ifdef _POSIX_C_SOURCE
+#undef _POSIX_C_SOURCE
+#endif
+
+#ifdef _XOPEN_SOURCE
+#undef _XOPEN_SOURCE
+#endif
+
#include <Python.h>
#include <omniORB4/CORBA.h>
#include "Runtime.hxx"
{
class RuntimeSALOME;
- RuntimeSALOME* getSALOMERuntime();
+ YACSRUNTIMESALOME_EXPORT RuntimeSALOME* getSALOMERuntime();
class InputCorbaPort;
class InputPyPort;
class InputXmlPort;
class InputCppPort;
- class RuntimeSALOME: public Runtime
+ class YACSRUNTIMESALOME_EXPORT RuntimeSALOME: public Runtime
{
public:
enum
{
- IsPyExt = 1,
+ IsPyExt = 1,
UsePython = 2,
- UseCorba = 4,
- UseXml = 8,
- UseCpp = 16,
- UseSalome = 32
+ UseCorba = 4,
+ UseXml = 8,
+ UseCpp = 16,
+ UseSalome = 32
} FLAGS;
static void setRuntime(long flags = UsePython+UseCorba+UseXml+UseCpp+UseSalome); // singleton creation
virtual Container *createContainer(const std::string& kind="");
virtual WhileLoop* createWhileLoop(const std::string& name);
virtual ForLoop* createForLoop(const std::string& name);
+ virtual OptimizerLoop* createOptimizerLoop(const std::string& name,const std::string& algLib,
+ const std::string& factoryName,bool algInitOnFile,
+ const std::string& kind="", Proc * procForTypes = NULL);
virtual Bloc* createBloc(const std::string& name);
virtual Proc* createProc(const std::string& name);
+ virtual TypeCode * createInterfaceTc(const std::string& id, const std::string& name,
+ std::list<TypeCodeObjref *> ltc);
+ virtual TypeCode * createSequenceTc(const std::string& id, const std::string& name, TypeCode *content);
+ virtual TypeCodeStruct * createStructTc(const std::string& id, const std::string& name);
+
virtual InputPort* adapt(InputPort* source,
const std::string& impl,
TypeCode * type,bool init=false) throw (ConversionException);
+ virtual InputPort* adapt(InPropertyPort* source,
+ const std::string& impl,
+ TypeCode * type,bool init=false) throw (ConversionException);
+
virtual InputPort* adaptNeutral(InputPort* source,
const std::string& impl,
TypeCode * type,bool init) throw (ConversionException);
virtual InputPort* adaptXmlToNeutral(InputXmlPort* inport,
TypeCode * type) throw (ConversionException);
+ virtual InputPort* adaptXmlToXml(InputXmlPort* inport,
+ TypeCode * type,bool init) throw (ConversionException);
+
virtual InputPort* adaptNeutralToXml(InputPort* inport,
TypeCode * type) throw (ConversionException);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SALOMEDispatcher.hxx"
#include "Node.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __SALOMEDISPATCHER_HXX__
#define __SALOMEDISPATCHER_HXX__
+#include "YACSRuntimeSALOMEExport.hxx"
#include "Dispatcher.hxx"
#include "yacsgui.hh"
#include "Thread.hxx"
{
namespace ENGINE
{
- class SALOMEDispatcher: public Dispatcher
+ class YACSRUNTIMESALOME_EXPORT SALOMEDispatcher: public Dispatcher
{
public:
SALOMEDispatcher();
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// ----------------------------------------------------------------------------
-//
-%define SALOMEDOCSTRING
-"Implementation of nodes for SALOME platform."
-%enddef
-
-%module(docstring=SALOMEDOCSTRING) SALOMERuntime
-
-//work around SWIG bug #1863647
-#define PySwigIterator SALOMERuntime_PySwigIterator
-
-%feature("autodoc", "1");
-
-%include engtypemaps.i
-
-// ----------------------------------------------------------------------------
-
-%{
-#include "RuntimeSALOME.hxx"
-#include "SALOMEDispatcher.hxx"
-#include "SalomeProc.hxx"
-#include "PythonNode.hxx"
-#include "PythonPorts.hxx"
-#include "PresetNode.hxx"
-#include "PresetPorts.hxx"
-#include "CORBANode.hxx"
-#include "CORBAPorts.hxx"
-#include "StudyNodes.hxx"
-#include "StudyPorts.hxx"
-#include "TypeConversions.hxx"
-#include "TypeCode.hxx"
-#include "VisitorSaveSalomeSchema.hxx"
-#include <sstream>
-%}
-
-// ----------------------------------------------------------------------------
-
-%init
-%{
- // init section
-
- PyObject* omnipy = PyImport_ImportModule((char*)"_omnipy");
- if (!omnipy)
- {
- PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy");
- return;
- }
- PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
- api = (omniORBPYAPI*)PyCObject_AsVoidPtr(pyapi);
- Py_DECREF(pyapi);
-%}
-
-// ----------------------------------------------------------------------------
-
-#ifdef SWIGPYTHON
-%typemap(out) YACS_ORB::Observer_ptr
-{
- $result = api->cxxObjRefToPyObjRef($1, 1);
-}
-
-%typemap(in) YACS_ORB::Observer_ptr
-{
- try
- {
- CORBA::Object_ptr obj = api->pyObjRefToCxxObjRef($input,1);
- $1 = YACS_ORB::Observer::_narrow(obj);
- }
- catch (...)
- {
- PyErr_SetString(PyExc_RuntimeError, "not a valid CORBA object ptr");
- return NULL;
- }
-}
-
-%typemap(out) YACS::ENGINE::PyObj * "Py_INCREF($1); $result = $1;";
-
-#endif
-
-// ----------------------------------------------------------------------------
-
-%import "pilot.i"
-
-%rename(getSALOMERuntime) YACS::ENGINE::getSALOMERuntime; // to suppress a 503 warning
-%ignore omniORBpyAPI;
-
-%include "RuntimeSALOME.hxx"
-%include "SALOMEDispatcher.hxx"
-%include "SalomeProc.hxx"
-%include "PythonNode.hxx"
-%include "PythonPorts.hxx"
-%include "XMLPorts.hxx"
-%include "PresetNode.hxx"
-%include "PresetPorts.hxx"
-%include "CORBANode.hxx"
-%include "CORBAPorts.hxx"
-%include "StudyNodes.hxx"
-%include "StudyPorts.hxx"
-
-%extend YACS::ENGINE::OutputPresetPort
-{
- void setDataPy(PyObject *ob)
- {
- std::string sss = convertPyObjectXml(self->edGetType(),ob);
- self->setData(sss);
- }
-}
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#ifndef SALOME_CONFIG_H
-#define SALOME_CONFIG_H
-
-#define DEBUG
-
-#define QUOTE(x) #x
-#define CORBA_CLIENT_HEADER(x) QUOTE(x.hh)
-#define CORBA_SERVER_HEADER(x) QUOTE(x.hh)
-
-#ifndef PCLINUX
- #define PCLINUX
-#endif
-
-
-/* A path to a rcp-like command */
-#define RCP "/usr/bin/rcp"
-
-/* A path to a rm-like command */
-#define RM "/bin/rm"
-
-/* A path to a cp-like command */
-#define CP "/bin/cp"
-
-/* A path to a rsh-like command */
-#define RSH "/usr/bin/rsh"
-
-/* A path to a scp-like command */
-#define SCP "/usr/bin/scp"
-
-/* A path to a sh-like command */
-#define SH "/bin/sh"
-
-/* A path to a ssh-like command */
-#define SSH "/usr/bin/ssh"
-
-#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "RuntimeSALOME.hxx"
#include "SalomeComponent.hxx"
#include "SalomeContainer.hxx"
#include <iostream>
#include <sstream>
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
using namespace YACS::ENGINE;
using namespace std;
{
if(_container)
{
- SalomeContainer *containerC=(SalomeContainer *)_container;
- containerC->lock();//To be sure
- if(!_container->isAlreadyStarted())
- {
- try
- {
- _container->start();
- }
- catch(Exception& e)
- {
- containerC->unLock();
- throw e;
- }
- }
- containerC->unLock();
- containerC->lock();//To be sure
- const char* componentName=_compoName.c_str();
- //char *val2=CORBA::string_dup("");
- // does not work with python components
- // does not make a strict load but a find or load component
- // _objComponent=containerC->_trueCont->load_impl(componentName,val2);
- bool isLoadable = containerC->_trueCont->load_component_Library(componentName);
- if (isLoadable)
- if (containerC->isAPaCOContainer()) {
- std::string compo_paco_name(componentName);
- compo_paco_name = compo_paco_name + "@PARALLEL@";
- char * c_paco_name = CORBA::string_dup(compo_paco_name.c_str());
- _objComponent=containerC->_trueCont->create_component_instance(c_paco_name, 0);
- }
- else
- _objComponent=containerC->_trueCont->create_component_instance(componentName, 0);
-
- if(CORBA::is_nil(_objComponent))
- {
- containerC->unLock();
- std::string text="Error while trying to create a new component: component '"+ _compoName;
- text=text+"' is not installed or it's a wrong name";
- throw Exception(text);
- }
- containerC->unLock();
+ _objComponent=((SalomeContainer*)_container)->loadComponent(this);
return;
}
//throw Exception("SalomeComponent::load : no container specified !!! To be implemented in executor to allocate default a Container in case of presenceOfDefaultContainer.");
}
}
+void SalomeComponent::shutdown(int level)
+{
+ DEBTRACE("SalomeComponent::shutdown " << level);
+ if(_container)
+ _container->shutdown(level);
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SALOMECOMPONENT_HXX_
#define _SALOMECOMPONENT_HXX_
+#include "YACSRuntimeSALOMEExport.hxx"
#include "ComponentInstance.hxx"
#include <omniORB4/CORBA.h>
*
*
*/
- class SalomeComponent : public ComponentInstance
+ class YACSRUNTIMESALOME_EXPORT SalomeComponent : public ComponentInstance
{
public:
SalomeComponent(const std::string& name);
virtual ComponentInstance* clone() const;
virtual std::string getFileRepr() const;
virtual CORBA::Object_ptr getCompoPtr(){return CORBA::Object::_duplicate(_objComponent);}
+ virtual void shutdown(int level);
public:
static const char KIND[];
virtual std::string getKind() const;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
//#define REFCNT
//
#ifdef REFCNT
#include "RuntimeSALOME.hxx"
#include "SalomeContainer.hxx"
#include "SalomeComponent.hxx"
+#include "Proc.hxx"
#include "SALOME_NamingService.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
#include <sstream>
#include <iostream>
+#ifdef WNT
+#include <process.h>
+#define getpid _getpid
+#endif
+
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
using namespace YACS::ENGINE;
using namespace std;
-SalomeContainer::SalomeContainer():_trueCont(Engines::Container::_nil())
+SalomeContainer::SalomeContainer():_trueCont(Engines::Container::_nil()),_type("mono"),_shutdownLevel(999)
{
- /* Init MachinesParameters */
+ /* Init ContainerParameters */
_params.container_name = "";
- _params.hostname = "";
- _params.OS = "";
- _params.mem_mb = 0;
- _params.cpu_clock = 0;
- _params.nb_proc_per_node = 0;
- _params.nb_node = 0;
+ _params.mode= "start";
+ _params.workingdir= "";
+ _params.nb_proc = 0;
_params.isMPI = false;
_params.parallelLib = "";
- _params.nb_component_nodes = 0;
+
+ _params.resource_params.name = "";
+ _params.resource_params.hostname = "";
+ _params.resource_params.OS = "";
+ _params.resource_params.nb_proc = 0;
+ _params.resource_params.mem_mb = 0;
+ _params.resource_params.cpu_clock = 0;
+ _params.resource_params.nb_node = 0;
+ _params.resource_params.nb_proc_per_node = 0;
+ _params.resource_params.policy = "";
+ // By default, componentList and resList length is 0
}
-SalomeContainer::SalomeContainer(const SalomeContainer& other):Container(other),_trueCont(Engines::Container::_nil())
+SalomeContainer::SalomeContainer(const SalomeContainer& other):Container(other),_trueCont(Engines::Container::_nil()),_type(other._type),
+ _shutdownLevel(other._shutdownLevel)
{
_params.container_name = CORBA::string_dup(other._params.container_name);
- _params.hostname = CORBA::string_dup(other._params.hostname);
- _params.OS = CORBA::string_dup(other._params.OS);
- _params.mem_mb = other._params.mem_mb;
- _params.cpu_clock = other._params.cpu_clock;
- _params.nb_proc_per_node = other._params.nb_proc_per_node;
- _params.nb_node = other._params.nb_node;
+ _params.mode= CORBA::string_dup(other._params.mode);
+ _params.workingdir= CORBA::string_dup(other._params.workingdir);
+ _params.nb_proc = other._params.nb_proc;
_params.isMPI = other._params.isMPI;
_params.parallelLib = CORBA::string_dup(other._params.parallelLib);
- _params.nb_component_nodes = other._params.nb_component_nodes;
- _params.workingdir= CORBA::string_dup(other._params.workingdir);
+
+ _params.resource_params.name = CORBA::string_dup(other._params.resource_params.name);
+ _params.resource_params.hostname = CORBA::string_dup(other._params.resource_params.hostname);
+ _params.resource_params.OS = CORBA::string_dup(other._params.resource_params.OS);
+ _params.resource_params.nb_proc = other._params.resource_params.nb_proc;
+ _params.resource_params.mem_mb = other._params.resource_params.mem_mb;
+ _params.resource_params.cpu_clock = other._params.resource_params.cpu_clock;
+ _params.resource_params.nb_node = other._params.resource_params.nb_node;
+ _params.resource_params.nb_proc_per_node = other._params.resource_params.nb_proc_per_node;
+ _params.resource_params.policy = CORBA::string_dup(other._params.resource_params.policy);
+
+ _params.resource_params.componentList.length(other._params.resource_params.componentList.length());
+ for(CORBA::ULong i=0; i < other._params.resource_params.componentList.length(); i++)
+ {
+ _params.resource_params.componentList[i]=CORBA::string_dup(other._params.resource_params.componentList[i]);
+ }
+
+ _params.resource_params.resList.length(other._params.resource_params.resList.length());
+ for(CORBA::ULong i=0; i < other._params.resource_params.resList.length(); i++)
+ {
+ _params.resource_params.resList[i]=CORBA::string_dup(other._params.resource_params.resList[i]);
+ }
}
SalomeContainer::~SalomeContainer()
_mutex.unlock();
}
-bool SalomeContainer::isAlreadyStarted() const
+Container *SalomeContainer::clone() const
{
- if(CORBA::is_nil(_trueCont))
- return false;
+ if(_isAttachedOnCloning)
+ {
+ incrRef();
+ return (Container*) (this);
+ }
else
- return true;
+ return new SalomeContainer(*this);
}
-void SalomeContainer::start() throw (Exception)
+void SalomeContainer::checkCapabilityToDealWith(const ComponentInstance *inst) const throw(YACS::Exception)
{
- CORBA::ORB_ptr orb=getSALOMERuntime()->getOrb();
- SALOME_NamingService ns;
- try
+ if(inst->getKind()!=SalomeComponent::KIND)
+ throw Exception("SalomeContainer::checkCapabilityToDealWith : SalomeContainer is not able to deal with this type of ComponentInstance.");
+}
+
+void SalomeContainer::setProperty(const std::string& name, const std::string& value)
+{
+ DEBTRACE("SalomeContainer::setProperty : " << name << " ; " << value);
+
+ // Container Part
+ if (name == "container_name")
+ _params.container_name = CORBA::string_dup(value.c_str());
+ else if (name == "type")
+ {
+ if (value == "mono")
+ _params.mode = "start";
+ else if (value == "multi")
+ _params.mode = "getorstart";
+ else
+ throw Exception("SalomeContainer::setProperty : type value is not correct (mono or multi): " + value);
+ _type=value;
+ }
+ else if (name == "workingdir")
+ _params.workingdir = CORBA::string_dup(value.c_str());
+ else if (name == "nb_parallel_procs")
+ {
+ std::istringstream iss(value);
+ if (!(iss >> _params.nb_proc))
+ throw Exception("salomecontainer::setproperty : params.nb_proc value not correct : " + value);
+ }
+ else if (name == "isMPI")
+ {
+ if (value == "true")
+ _params.isMPI = true;
+ else if (value == "false")
+ _params.isMPI = false;
+ else
+ throw Exception("SalomeContainer::setProperty : params.isMPI value not correct : " + value);
+ }
+ else if (name == "parallelLib")
+ _params.parallelLib = CORBA::string_dup(value.c_str());
+
+ // Resource part
+ else if (name == "name")
+ _params.resource_params.name = CORBA::string_dup(value.c_str());
+ else if (name == "hostname")
+ _params.resource_params.hostname = CORBA::string_dup(value.c_str());
+ else if (name == "OS")
+ _params.resource_params.OS = CORBA::string_dup(value.c_str());
+ else if (name == "nb_resource_procs")
+ {
+ std::istringstream iss(value);
+ if (!(iss >> _params.resource_params.nb_proc))
+ throw Exception("salomecontainer::setproperty : params.resource_params.nb_proc value not correct : " + value);
+ }
+ else if (name == "mem_mb")
+ {
+ std::istringstream iss(value);
+ if (!(iss >> _params.resource_params.mem_mb))
+ throw Exception("salomecontainer::setproperty : params.resource_params.mem_mb value not correct : " + value);
+ }
+ else if (name == "cpu_clock")
+ {
+ std::istringstream iss(value);
+ if (!(iss >> _params.resource_params.cpu_clock))
+ throw Exception("salomecontainer::setproperty : params.resource_params.cpu_clock value not correct : " + value);
+ }
+ else if (name == "nb_node")
+ {
+ std::istringstream iss(value);
+ if (!(iss >> _params.resource_params.nb_node))
+ throw Exception("salomecontainer::setproperty : params.nb_node value not correct : " + value);
+ }
+ else if (name == "nb_proc_per_node")
+ {
+ std::istringstream iss(value);
+ if (!(iss >> _params.resource_params.nb_proc_per_node))
+ throw Exception("salomecontainer::setproperty : params.nb_proc_per_node value not correct : " + value);
+ }
+ else if (name == "policy")
+ _params.resource_params.policy = CORBA::string_dup(value.c_str());
+ else if (name == "component_list")
+ {
+ std::string clean_value(value);
+
+ // Step 1: remove blanks
+ while(clean_value.find(" ") != std::string::npos)
+ clean_value = clean_value.erase(clean_value.find(" "), 1);
+
+ // Step 2: get values
+ while(!clean_value.empty())
{
- ns.init_orb(orb);
+ std::string result("");
+ std::string::size_type loc = clean_value.find(",", 0);
+ if (loc != std::string::npos)
+ {
+ result = clean_value.substr(0, loc);
+ clean_value = clean_value.erase(0, loc+1);
+ }
+ else
+ {
+ result = clean_value;
+ clean_value.erase();
+ }
+ if (result != "," && result != "")
+ {
+ addToComponentList(result);
+ }
}
- catch(SALOME_Exception& e)
+
+ }
+ else if (name == "resource_list")
+ {
+ std::string clean_value(value);
+
+ // Step 1: remove blanks
+ while(clean_value.find(" ") != std::string::npos)
+ clean_value = clean_value.erase(clean_value.find(" "), 1);
+
+ // Step 2: get values
+ while(!clean_value.empty())
{
- throw Exception("SalomeContainer::start : Unable to contact the SALOME Naming Service");
+ std::string result("");
+ std::string::size_type loc = clean_value.find(",", 0);
+ if (loc != std::string::npos)
+ {
+ result = clean_value.substr(0, loc);
+ clean_value = clean_value.erase(0, loc+1);
+ }
+ else
+ {
+ result = clean_value;
+ clean_value.erase();
+ }
+ if (result != "," && result != "")
+ {
+ addToResourceList(result);
+ }
}
- CORBA::Object_var obj=ns.Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS);
- Engines::ContainerManager_var contManager=Engines::ContainerManager::_narrow(obj);
- std::string str(_params.container_name);
- DEBTRACE("SalomeContainer::start " << str);
- //If a container_name is given try to find an already existing container in naming service
- //If not found start a new container with the given parameters
- if (str != "")
+ }
+ // End
+ Container::setProperty(name, value);
+}
+
+void SalomeContainer::addComponentName(std::string name)
+{
+ _componentNames.push_back(name);
+}
+
+//! Load a component instance in this container
+/*!
+ * \param inst the component instance to load
+ */
+CORBA::Object_ptr SalomeContainer::loadComponent(ComponentInstance *inst)
+{
+ DEBTRACE("SalomeContainer::loadComponent ");
+ lock();//To be sure
+ if(!isAlreadyStarted(inst))
{
- std::string machine(_params.hostname);
- if(machine == "" || machine == "localhost")
- //machine=Kernel_Utils::GetHostname();
- machine=Kernel_Utils::GetHostname();
- std::string ContainerNameInNS=ns.BuildContainerNameForNS(_params,machine.c_str());
- obj=ns.Resolve(ContainerNameInNS.c_str());
- if(!CORBA::is_nil(obj))
+ try
+ {
+ start(inst);
+ }
+ catch(Exception& e)
{
- std::cerr << "Container already exists: " << ContainerNameInNS << std::endl;
- _trueCont=Engines::Container::_narrow(obj);
- return;
+ unLock();
+ throw e;
}
}
+ unLock();
+ lock();//To be sure
+ CORBA::Object_ptr objComponent=CORBA::Object::_nil();
+ std::string compoName=inst->getCompoName();
+ const char* componentName=compoName.c_str();
+ Engines::Container_var container;
+ if(_type=="multi")
+ container=_trueContainers[inst];
+ else
+ container=_trueCont;
- if (str == "")
- {
- //give a almost unique name to the container : Pid_Name_Addr
- std::ostringstream stream;
- stream << getpid();
- stream << "_";
- stream << _name;
- stream << "_";
- stream << (void *)(this);
- DEBTRACE("container_name="<<stream.str());
- _params.container_name=CORBA::string_dup(stream.str().c_str());
- }
- Engines::CompoList compolist;
- compolist.length(_componentNames.size());
- std::vector<std::string>::iterator iter;
- for(CORBA::ULong i=0; i < _componentNames.size();i++)
- {
- compolist[i]=CORBA::string_dup(_componentNames[i].c_str());
- }
+ char* reason;
- try
- {
- // --- GiveContainer is used in batch mode to retreive launched containers,
- // and is equivalent to StartContainer when not in batch.
- std::string policy=getProperty("policy");
- if(policy=="best")
- _trueCont=contManager->GiveContainer(_params,Engines::P_BEST,compolist);
- else if(policy=="first")
- _trueCont=contManager->GiveContainer(_params,Engines::P_FIRST,compolist);
- else
- _trueCont=contManager->GiveContainer(_params,Engines::P_CYCL,compolist);
- }
- catch(CORBA::COMM_FAILURE&)
+ bool isLoadable = container->load_component_Library(componentName, reason);
+ if (isLoadable)
{
- throw Exception("SalomeContainer::start : Unable to launch container in Salome : CORBA Comm failure detected");
- }
- catch(CORBA::Exception&)
- {
- throw Exception("SalomeContainer::start : Unable to launch container in Salome : Unexpected CORBA failure detected");
- }
- if(CORBA::is_nil(_trueCont))
- throw Exception("SalomeContainer::start : Unable to launch container in Salome. Check your CatalogResources.xml file");
+ CORBA::string_free(reason);
+ int studyid=1;
+ Proc* p=getProc();
+ if(p)
+ {
+ std::string value=p->getProperty("DefaultStudyID");
+ if(!value.empty())
+ studyid= atoi(value.c_str());
+ }
+ // prepare component instance properties
+ Engines::FieldsDict_var env = new Engines::FieldsDict;
+ std::map<std::string, std::string> properties = inst->getProperties();
+ if(p)
+ {
+ std::map<std::string,std::string> procMap=p->getProperties();
+ properties.insert(procMap.begin(),procMap.end());
+ }
- CORBA::String_var containerName=_trueCont->name();
- CORBA::String_var hostName=_trueCont->getHostName();
- std::cerr << "SalomeContainer launched : " << containerName << " " << hostName << " " << _trueCont->getPID() << std::endl;
+ std::map<std::string, std::string>::const_iterator itm;
+ env->length(properties.size());
+ int item=0;
+ for(itm = properties.begin(); itm != properties.end(); ++itm, item++)
+ {
+ DEBTRACE("envname="<<itm->first<<" envvalue="<< itm->second);
+ env[item].key= CORBA::string_dup(itm->first.c_str());
+ env[item].value <<= itm->second.c_str();
+ }
-#ifdef REFCNT
- DEBTRACE(_trueCont->_PR_getobj()->pd_refCount );
-#endif
-}
+ objComponent=container->create_component_instance_env(componentName, studyid, env, reason);
+ }
-Container *SalomeContainer::clone() const
-{
- if(_isAttachedOnCloning)
+ if(CORBA::is_nil(objComponent))
{
- incrRef();
- return (Container*) (this);
+ unLock();
+ std::string text="Error while trying to create a new component: component '"+ compoName;
+ text=text+"' is not installed or it's a wrong name";
+ text += '\n';
+ text += reason;
+ CORBA::string_free(reason);
+ throw Exception(text);
}
- else
- return new SalomeContainer(*this);
+ unLock();
+ return objComponent;
}
-std::string SalomeContainer::getPlacementId() const
+//! Get the container placement id for a component instance
+/*!
+ * \param inst the component instance
+ * \return the placement id
+ */
+std::string SalomeContainer::getPlacementId(const ComponentInstance *inst) const
{
- if(isAlreadyStarted())
+
+ if(isAlreadyStarted(inst))
{
+ Engines::Container_var container=_trueCont;
+ if(_type=="multi")
+ {
+ std::map<const ComponentInstance *, Engines::Container_var>::const_iterator found = _trueContainers.find(inst);
+ container=found->second;
+ }
const char *what="/";
- char *corbaStr=_trueCont->name();
+ CORBA::String_var corbaStr=container->name();
string ret(corbaStr);
- CORBA::string_free(corbaStr);
+
//Salome FOREVER ...
std::string::size_type i=ret.find_first_of(what,0);
i=ret.find_first_of(what, i==std::string::npos ? i:i+1);
if(i!=std::string::npos)
- return ret.substr(i+1);
+ return ret.substr(i+1);
return ret;
}
else
return "Not placed yet !!!";
}
-void SalomeContainer::checkCapabilityToDealWith(const ComponentInstance *inst) const throw (Exception)
+//! Get the container full path for a component instance
+/*!
+ * \param inst the component instance
+ * \return the full placement id
+ */
+std::string SalomeContainer::getFullPlacementId(const ComponentInstance *inst) const
{
- if(inst->getKind()!=SalomeComponent::KIND)
- throw Exception("SalomeContainer::checkCapabilityToDealWith : SalomeContainer is not able to deal with this type of ComponentInstance.");
+
+ if(isAlreadyStarted(inst))
+ {
+ Engines::Container_var container=_trueCont;
+ if(_type=="multi")
+ {
+ std::map<const ComponentInstance *, Engines::Container_var>::const_iterator found = _trueContainers.find(inst);
+ container=found->second;
+ }
+ try
+ {
+ CORBA::String_var corbaStr=container->name();
+ string ret(corbaStr);
+ return ret;
+ }
+ catch(...)
+ {
+ return "Unknown_placement";
+ }
+ }
+ else
+ return "Not_placed_yet";
}
-void SalomeContainer::setProperty(const std::string& name, const std::string& value)
+//! Check if the component instance container is already started
+/*!
+ * \param inst the component instance
+ * \return true, if the container is already started, else false
+ */
+bool SalomeContainer::isAlreadyStarted(const ComponentInstance *inst) const
{
- DEBTRACE("SalomeContainer::setProperty : " << name << " ; " << value);
-
- if (name == "container_name")
- _params.container_name = CORBA::string_dup(value.c_str());
- else if (name == "hostname")
- _params.hostname = CORBA::string_dup(value.c_str());
- else if (name == "OS")
- _params.OS = CORBA::string_dup(value.c_str());
- else if (name == "parallelLib")
- _params.parallelLib = CORBA::string_dup(value.c_str());
- else if (name == "workingdir")
- _params.workingdir = CORBA::string_dup(value.c_str());
- else if (name == "isMPI")
+ if(_type=="mono")
{
- if (value == "true")
- _params.isMPI = true;
- else if (value == "false")
- _params.isMPI = false;
- else
- throw Exception("SalomeContainer::SetProperty : params.isMPI value not correct : " + value);
+ if(CORBA::is_nil(_trueCont))
+ return false;
+ else
+ return true;
}
- else if (name == "mem_mb")
+ else
{
- std::istringstream iss(value);
- if (!(iss >> _params.mem_mb))
- throw Exception("salomecontainer::setproperty : params.mem_mb value not correct : " + value);
+ if(_trueContainers.count(inst)==0)
+ return false;
+ else
+ return true;
}
- else if (name == "cpu_clock")
+}
+
+Engines::Container_ptr SalomeContainer::getContainerPtr(const ComponentInstance *inst) const
+{
+ if(_type=="mono")
{
- std::istringstream iss(value);
- if (!(iss >> _params.cpu_clock))
- throw Exception("salomecontainer::setproperty : params.cpu_clock value not correct : " + value);
+ if(CORBA::is_nil(_trueCont))
+ return Engines::Container::_nil();
+ else
+ return Engines::Container::_duplicate(_trueCont);
}
- else if (name == "nb_proc_per_node")
+ else
{
- std::istringstream iss(value);
- if (!(iss >> _params.nb_proc_per_node))
- throw Exception("salomecontainer::setproperty : params.nb_proc_per_node value not correct : " + value);
+ if(_trueContainers.count(inst)==0)
+ return Engines::Container::_nil();
+ else
+ {
+ std::map<const ComponentInstance *,Engines::Container_var>::const_iterator iter=_trueContainers.find(inst);
+ return Engines::Container::_duplicate(iter->second);
+ }
}
- else if (name == "nb_node")
+}
+
+//! Start a salome container (true salome container not yacs one) with given ContainerParameters (_params)
+/*!
+ * \param inst the component instance
+ */
+void SalomeContainer::start(const ComponentInstance *inst) throw(YACS::Exception)
+{
+ CORBA::ORB_ptr orb=getSALOMERuntime()->getOrb();
+ SALOME_NamingService ns;
+ try
+ {
+ ns.init_orb(orb);
+ }
+ catch(SALOME_Exception& e)
{
- std::istringstream iss(value);
- if (!(iss >> _params.nb_node))
- throw Exception("salomecontainer::setproperty : params.nb_node value not correct : " + value);
+ throw Exception("SalomeContainer::start : Unable to contact the SALOME Naming Service");
}
- else if (name == "nb_component_nodes")
+ CORBA::Object_var obj=ns.Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS);
+ Engines::ContainerManager_var contManager=Engines::ContainerManager::_narrow(obj);
+
+ std::string str(_params.container_name);
+ DEBTRACE("SalomeContainer::start " << str <<";"<<_params.resource_params.hostname <<";"<<_type);
+
+ // Finalize parameters with components found in the container
+ std::vector<std::string>::iterator iter;
+ for(CORBA::ULong i=0; i < _componentNames.size();i++)
+ addToComponentList(_componentNames[i]);
+ Engines::ContainerParameters myparams = _params;
+
+ bool namedContainer=false;
+ if(str != "")
+ namedContainer=true;
+
+ //If a container_name is given try to find an already existing container in naming service
+ //If not found start a new container with the given parameters
+ if (_type=="mono" && str != "")
{
- std::istringstream iss(value);
- if (!(iss >> _params.nb_component_nodes))
- throw Exception("salomecontainer::setproperty : params.nb_component_nodes value not correct : " + value);
+ myparams.mode="getorstart";
}
- Container::setProperty(name, value);
+
+ if (str == "")
+ {
+ //give a almost unique name to the container : Pid_Name_Addr
+ std::ostringstream stream;
+ stream << getpid();
+ stream << "_";
+ stream << _name;
+ stream << "_";
+ stream << (void *)(this);
+ DEBTRACE("container_name="<<stream.str());
+ myparams.container_name=CORBA::string_dup(stream.str().c_str());
+ _shutdownLevel=1;
+ }
+
+ _trueCont=Engines::Container::_nil();
+ if(namedContainer && _shutdownLevel==999)
+ {
+ //Make this only the first time start is called (_shutdownLevel==999)
+ //If the container is named, first try to get an existing container
+ //If there is an existing container use it and set the shutdown level to 3
+ //If there is no existing container, try to launch a new one and set the shutdown level to 2
+ myparams.mode="get";
+ try
+ {
+ _trueCont=contManager->GiveContainer(myparams);
+ }
+ catch( const SALOME::SALOME_Exception& ex )
+ {
+ std::string msg="SalomeContainer::start : no existing container : ";
+ msg += '\n';
+ msg += ex.details.text.in();
+ DEBTRACE( msg );
+ }
+ catch(...)
+ {
+ }
+
+ if(!CORBA::is_nil(_trueCont))
+ {
+ _shutdownLevel=3;
+ DEBTRACE( "container found: " << str << " " << _shutdownLevel );
+ }
+ else
+ {
+ _shutdownLevel=2;
+ myparams.mode="start";
+ DEBTRACE( "container not found: " << str << " " << _shutdownLevel);
+ }
+ }
+
+ if(CORBA::is_nil(_trueCont))
+ try
+ {
+ // --- GiveContainer is used in batch mode to retreive launched containers,
+ // and is equivalent to StartContainer when not in batch.
+ _trueCont=contManager->GiveContainer(myparams);
+ }
+ catch( const SALOME::SALOME_Exception& ex )
+ {
+ std::string msg="SalomeContainer::start : Unable to launch container in Salome : ";
+ msg += '\n';
+ msg += ex.details.text.in();
+ throw Exception(msg);
+ }
+ catch(CORBA::COMM_FAILURE&)
+ {
+ throw Exception("SalomeContainer::start : Unable to launch container in Salome : CORBA Comm failure detected");
+ }
+ catch(CORBA::Exception&)
+ {
+ throw Exception("SalomeContainer::start : Unable to launch container in Salome : Unexpected CORBA failure detected");
+ }
+
+ if(CORBA::is_nil(_trueCont))
+ throw Exception("SalomeContainer::start : Unable to launch container in Salome. Check your CatalogResources.xml file");
+
+ _trueContainers[inst]=_trueCont;
+
+ CORBA::String_var containerName=_trueCont->name();
+ CORBA::String_var hostName=_trueCont->getHostName();
+ std::cerr << "SalomeContainer launched : " << containerName << " " << hostName << " " << _trueCont->getPID() << std::endl;
+
+#ifdef REFCNT
+ DEBTRACE(_trueCont->_PR_getobj()->pd_refCount );
+ std::map<const ComponentInstance *, Engines::Container_var >::const_iterator it;
+ for(it = _trueContainers.begin(); it != _trueContainers.end(); ++it)
+ {
+ DEBTRACE(it->second->_PR_getobj()->pd_refCount );
+ }
+#endif
}
-bool SalomeContainer::isAPaCOContainer() const
+void SalomeContainer::shutdown(int level)
{
- bool result = false;
- string parallelLib(_params.parallelLib);
- if (parallelLib != "")
- result = true;
- return result;
+ DEBTRACE("SalomeContainer::shutdown: " << _name << "," << level << "," << _shutdownLevel);
+ if(level < _shutdownLevel)
+ return;
+
+ _shutdownLevel=999;
+ //shutdown the SALOME containers
+ if(_type=="multi")
+ {
+ std::map<const ComponentInstance *, Engines::Container_var >::const_iterator it;
+ for(it = _trueContainers.begin(); it != _trueContainers.end(); ++it)
+ {
+ try
+ {
+ DEBTRACE("shutdown SALOME container: " );
+ CORBA::String_var containerName=it->second->name();
+ DEBTRACE(containerName);
+ it->second->Shutdown();
+ std::cerr << "shutdown SALOME container: " << containerName << std::endl;
+ }
+ catch(CORBA::Exception&)
+ {
+ DEBTRACE("Unexpected CORBA failure detected." );
+ }
+ catch(...)
+ {
+ DEBTRACE("Unknown exception ignored." );
+ }
+ }
+ _trueContainers.clear();
+ }
+ else
+ {
+ try
+ {
+ DEBTRACE("shutdown SALOME container: " );
+ CORBA::String_var containerName=_trueCont->name();
+ DEBTRACE(containerName);
+ _trueCont->Shutdown();
+ std::cerr << "shutdown SALOME container: " << containerName << std::endl;
+ }
+ catch(...)
+ {
+ DEBTRACE("Unknown exception ignored." );
+ }
+ _trueCont=Engines::Container::_nil();
+ }
}
-void SalomeContainer::addComponentName(std::string name)
+void
+SalomeContainer::addToComponentList(const std::string & name)
{
- _componentNames.push_back(name);
+ // Search if name is already in the list
+ for (CORBA::ULong i = 0; i < _params.resource_params.componentList.length(); i++)
+ {
+ std::string component_name = _params.resource_params.componentList[i].in();
+ if (component_name == name)
+ return;
+ }
+
+ // Add name to list
+ CORBA::ULong lgth = _params.resource_params.componentList.length();
+ _params.resource_params.componentList.length(lgth + 1);
+ _params.resource_params.componentList[lgth] = CORBA::string_dup(name.c_str());
+}
+
+void
+SalomeContainer::addToResourceList(const std::string & name)
+{
+ // Search if name is already in the list
+ for (CORBA::ULong i = 0; i < _params.resource_params.resList.length(); i++)
+ {
+ std::string component_name = _params.resource_params.resList[i].in();
+ if (component_name == name)
+ return;
+ }
+
+ // Add name to list
+ CORBA::ULong lgth = _params.resource_params.resList.length();
+ _params.resource_params.resList.length(lgth + 1);
+ _params.resource_params.resList[lgth] = CORBA::string_dup(name.c_str());
+}
+
+std::map<std::string,std::string> SalomeContainer::getResourceProperties(const std::string& name)
+{
+ std::map<std::string,std::string> properties;
+
+ YACS::ENGINE::RuntimeSALOME* runTime = YACS::ENGINE::getSALOMERuntime();
+ CORBA::ORB_ptr orb = runTime->getOrb();
+ if (!orb) return properties;
+ SALOME_NamingService namingService(orb);
+ SALOME_LifeCycleCORBA lcc(&namingService);
+ CORBA::Object_var obj = namingService.Resolve(SALOME_ResourcesManager::_ResourcesManagerNameInNS);
+ if (CORBA::is_nil(obj)) return properties;
+ Engines::ResourcesManager_var resManager = Engines::ResourcesManager::_narrow(obj);
+ if (CORBA::is_nil(resManager)) return properties;
+
+ std::ostringstream value;
+ Engines::ResourceDefinition_var resource_definition = resManager->GetResourceDefinition(name.c_str());
+ properties["hostname"]=resource_definition->hostname.in();
+ properties["OS"]=resource_definition->OS.in();
+ value.str(""); value << resource_definition->mem_mb;
+ properties["mem_mb"]=value.str();
+ value.str(""); value << resource_definition->cpu_clock;
+ properties["cpu_clock"]=value.str();
+ value.str(""); value << resource_definition->nb_node;
+ properties["nb_node"]=value.str();
+ value.str(""); value << resource_definition->nb_proc_per_node;
+ properties["nb_proc_per_node"]=value.str();
+ /*
+ properties["component_list"]="";
+ for(CORBA::ULong i=0; i < resource_definition->componentList.length(); i++)
+ {
+ if(i > 0)
+ properties["component_list"]=properties["component_list"]+",";
+ properties["component_list"]=properties["component_list"]+resource_definition->componentList[i].in();
+ }
+ */
+
+ return properties;
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __SALOMECONTAINER_HXX__
#define __SALOMECONTAINER_HXX__
+#include "YACSRuntimeSALOMEExport.hxx"
#include "Container.hxx"
#include "Mutex.hxx"
#include <string>
{
class SalomeComponent;
- class SalomeContainer : public Container
+ class YACSRUNTIMESALOME_EXPORT SalomeContainer : public Container
{
friend class SalomeComponent;
public:
void lock();
//! For thread safety for concurrent load operation on same Container.
void unLock();
- bool isAlreadyStarted() const;
- void start() throw (Exception);
+ bool isAlreadyStarted(const ComponentInstance *inst) const;
+ Engines::Container_ptr getContainerPtr(const ComponentInstance *inst) const;
+ void start(const ComponentInstance *inst) throw (Exception);
Container *clone() const;
- std::string getPlacementId() const;
+ std::string getPlacementId(const ComponentInstance *inst) const;
+ std::string getFullPlacementId(const ComponentInstance *inst) const;
void checkCapabilityToDealWith(const ComponentInstance *inst) const throw (Exception);
virtual void setProperty(const std::string& name, const std::string& value);
- bool isAPaCOContainer() const;
virtual void addComponentName(std::string name);
+ virtual CORBA::Object_ptr loadComponent(ComponentInstance *inst);
+ virtual void shutdown(int level);
+ // Helper methods
+ void addToComponentList(const std::string & name);
+ void addToResourceList(const std::string & name);
+ virtual std::map<std::string,std::string> getResourceProperties(const std::string& name);
protected:
#ifndef SWIG
virtual ~SalomeContainer();
YACS::BASES::Mutex _mutex;
Engines::Container_var _trueCont;
std::vector<std::string> _componentNames;
+ std::map<const ComponentInstance *,Engines::Container_var> _trueContainers;
+ std::string _type;
+ int _shutdownLevel;
public:
- Engines::MachineParameters _params;
+ Engines::ContainerParameters _params;
};
}
}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "SalomeOptimizerLoop.hxx"
+
+// rnv: avoid compilation warning on Linux : "_POSIX_C_SOURCE" and "_XOPEN_SOURCE" are redefined
+#ifdef _POSIX_C_SOURCE
+#undef _POSIX_C_SOURCE
+#endif
+
+#ifdef _XOPEN_SOURCE
+#undef _XOPEN_SOURCE
+#endif
+#include <Python.h>
+#include "TypeCode.hxx"
+#include "PyStdout.hxx"
+
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
+using namespace YACS::ENGINE;
+using namespace std;
+
+
+/*! \class YACS::ENGINE::SalomeOptimizerLoop
+ * \brief class to build optimization loops
+ *
+ * \ingroup Nodes
+ */
+
+SalomeOptimizerLoop::SalomeOptimizerLoop(const std::string& name, const std::string& algLibWthOutExt,
+ const std::string& symbolNameToOptimizerAlgBaseInstanceFactory,
+ bool algInitOnFile,bool initAlgo, Proc * procForTypes):
+ OptimizerLoop(name,algLibWthOutExt,symbolNameToOptimizerAlgBaseInstanceFactory,algInitOnFile,false)
+{
+ if(initAlgo)
+ {
+ //try
+ // {
+ setAlgorithm(algLibWthOutExt, symbolNameToOptimizerAlgBaseInstanceFactory, true, procForTypes);
+ // }
+ //catch(YACS::Exception& e)
+ // {
+ //ignore it
+ // }
+ }
+}
+
+SalomeOptimizerLoop::SalomeOptimizerLoop(const SalomeOptimizerLoop& other, ComposedNode *father, bool editionOnly):
+ OptimizerLoop(other,father,editionOnly)
+{
+}
+
+SalomeOptimizerLoop::~SalomeOptimizerLoop()
+{
+}
+
+Node *SalomeOptimizerLoop::simpleClone(ComposedNode *father, bool editionOnly) const
+{
+ SalomeOptimizerLoop* sol=new SalomeOptimizerLoop(*this,father,editionOnly);
+ // TODO: Remove this const_cast (find a better design to get the type codes from the original node)
+ Proc * procForTypes = sol->getProc();
+ if (procForTypes == NULL) {
+ const Proc * origProc = getProc();
+ procForTypes = const_cast<Proc *>(origProc);
+ }
+ sol->setAlgorithm(_alglib, _symbol, false, procForTypes);
+ return sol;
+}
+
+//! Load the algorithm object from a Python module or a dynamic library
+/*!
+ * Member _alglib is the library name (shared library WITHOUT extension .so or python
+ * module WITH extension .py). Member _symbol is a symbol name in the library to use as
+ * an algorithm factory.
+ */
+void SalomeOptimizerLoop::loadAlgorithm()
+{
+ YASSERT(_alg == NULL)
+
+ if(_alglib.size() > 3 && _alglib.substr(_alglib.size()-3,3)==".py")
+ {
+ //if alglib extension is .py try to import the corresponding python module
+ PyGILState_STATE gstate=PyGILState_Ensure();
+
+ PyObject* mainmod = PyImport_AddModule("__main__");
+ PyObject* globals = PyModule_GetDict(mainmod);
+
+ std::string pyscript;
+ pyscript="import sys\n"
+ "import SALOMERuntime\n"
+ "filename='";
+ pyscript=pyscript+_alglib+"'\nentry='"+_symbol+"'\n";
+ pyscript=pyscript+"import os\n"
+ "import pilot\n"
+ "rep,mod=os.path.split(os.path.splitext(filename)[0])\n"
+ "if rep != '':\n"
+ " sys.path.insert(0,rep)\n"
+ "algomodule=__import__(mod)\n"
+ "if rep != '':\n"
+ " del sys.path[0]\n"
+ "algoclass= getattr(algomodule,entry)\n"
+ "algo= algoclass()\n"
+ "swigalgo= algo.this\n"
+ "\n";
+
+ PyObject* res=PyRun_String(pyscript.c_str(), Py_file_input, globals, globals );
+
+ if(res == NULL)
+ {
+ //error during import
+ _errorDetails="";
+ PyObject* new_stderr = newPyStdOut(_errorDetails);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ PyErr_Print();
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ Py_DECREF(new_stderr);
+ modified();
+ PyGILState_Release(gstate);
+ throw YACS::Exception(_errorDetails);
+ }
+ else
+ {
+ Py_DECREF(res);
+
+ typedef struct {
+ PyObject_HEAD
+ void *ptr;
+ void *ty;
+ int own;
+ PyObject *next;
+ } SwigPyObject;
+
+ SwigPyObject* pyalgo = (SwigPyObject*)PyDict_GetItemString(globals, "swigalgo");
+ _alg=(OptimizerAlgBase*)pyalgo->ptr;
+ _alg->setPool(&_myPool);
+ _alg->incrRef();
+ }
+ PyGILState_Release(gstate);
+ }
+ else
+ {
+ //else try to load a dynamic library
+ OptimizerLoop::loadAlgorithm();
+ }
+}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _SALOMEOPTIMIZERLOOP_HXX_
+#define _SALOMEOPTIMIZERLOOP_HXX_
+
+#include "YACSRuntimeSALOMEExport.hxx"
+#include "OptimizerLoop.hxx"
+
+namespace YACS
+{
+ namespace ENGINE
+ {
+ class YACSRUNTIMESALOME_EXPORT SalomeOptimizerLoop: public OptimizerLoop
+ {
+ protected:
+ Node *simpleClone(ComposedNode *father, bool editionOnly) const;
+ virtual void loadAlgorithm();
+ public:
+ SalomeOptimizerLoop(const std::string& name, const std::string& algLibWthOutExt,
+ const std::string& symbolNameToOptimizerAlgBaseInstanceFactory,
+ bool algInitOnFile,bool initAlgo=true, Proc * procForTypes = NULL);
+ SalomeOptimizerLoop(const SalomeOptimizerLoop& other, ComposedNode *father, bool editionOnly);
+ ~SalomeOptimizerLoop();
+ virtual std::string typeName() {return "YACS__ENGINE__SalomeOptimizerLoop";}
+ };
+ }
+}
+
+#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
+#include <Python.h>
#include "SalomeProc.hxx"
#include "Runtime.hxx"
#include "TypeCode.hxx"
+#include "Container.hxx"
#include "VisitorSaveSalomeSchema.hxx"
+#include "Basics_Utils.hxx"
#include <iostream>
+#include <cstdlib>
using namespace YACS::ENGINE;
+SalomeProc::SalomeProc(const std::string& name):Proc(name)
+{
+ // create default container with some default properties
+ Container* cont=createContainer("DefaultContainer");
+ cont->setProperty("name",Kernel_Utils::GetHostname());
+ cont->setProperty("container_name","FactoryServer");
+ cont->decrRef();
+}
+
TypeCode * SalomeProc::createInterfaceTc(const std::string& id, const std::string& name,
std::list<TypeCodeObjref *> ltc)
{
vss.closeFileSchema();
}
+//! Get the default study id for the proc
+/*!
+ * \return the study id
+ */
+int SalomeProc::getDefaultStudyId()
+{
+ std::string value=getProperty("DefaultStudyID");
+ if(value.empty())
+ return 1;
+ else
+ return atoi(value.c_str());
+}
+//! Initialise the proc
+void SalomeProc::init(bool start)
+{
+ std::string value=getProperty("DefaultStudyID");
+ if(!value.empty())
+ {
+ //initialise Python module salome with the study id given by value
+ std::string cmd="import salome;salome.salome_init("+value+")";
+ PyGILState_STATE gstate = PyGILState_Ensure(); // acquire the Global Interpreter Lock
+ PyRun_SimpleString(cmd.c_str());
+ PyGILState_Release(gstate); // Release the Global Interpreter Lock
+ }
+ Proc::init(start);
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SALOMEPROC_HXX_
#define _SALOMEPROC_HXX_
+#include "YACSRuntimeSALOMEExport.hxx"
#include "Proc.hxx"
+
#include <string>
#include <iostream>
#include <list>
{
class TypeCode;
- class SalomeProc: public Proc
+ class YACSRUNTIMESALOME_EXPORT SalomeProc: public Proc
{
public:
- SalomeProc(const std::string& name):Proc(name){};
+ SalomeProc(const std::string& name);
virtual ~SalomeProc();
virtual TypeCode * createInterfaceTc(const std::string& id, const std::string& name,
std::list<TypeCodeObjref *> ltc);
virtual TypeCode * createStructTc(const std::string& id, const std::string& name);
virtual std::string typeName() {return "YACS__ENGINE__SalomeProc";}
virtual void saveSchema(std::string xmlSchemaFile);
+ virtual int getDefaultStudyId();
+ virtual void init(bool start=true);
};
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include <Python.h>
#include "SalomePythonComponent.hxx"
#include "SalomeComponent.hxx"
{
if(_container)
{
- _container->start();
+ _container->start(this);
return;
}
//This component has no specified container : use default container policy
if(!_container)
return false;
else
- return _container->isAlreadyStarted();
+ return _container->isAlreadyStarted(this);
}
std::string SalomePythonComponent::getKind() const
if(!_container)
return "localhost/FactoryServer";
else
- return _container->getPlacementId();
+ return _container->getPlacementId(this);
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __SALOMEPYTHONCOMPONENT_HXX__
#define __SALOMEPYTHONCOMPONENT_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "RuntimeSALOME.hxx"
#include "SalomePythonComponent.hxx"
#include "SalomePythonNode.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SALOMEPYTHONNODE_HXX_
#define _SALOMEPYTHONNODE_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "RuntimeSALOME.hxx"
#include "SessionCataLoader.hxx"
#include "ComponentDefinition.hxx"
DEBTRACE ("SessionCataLoader::~SessionCataLoader");
}
-TypeCode * createInterfaceTc(const std::string& id, const std::string& name,
- std::list<TypeCodeObjref *> ltc)
-{
- std::string myName;
- if(id == "") myName = "IDL:" + name + ":1.0";
- else myName = id;
- return TypeCode::interfaceTc(myName.c_str(),name.c_str(),ltc);
-}
-
void SessionCataLoader::loadTypes(Catalog* cata,SALOME_ModuleCatalog::ModuleCatalog_ptr catalog)
{
Runtime* r=getRuntime();
{
const char* content=types_list[i].content;
if ( typeMap.find(content) != typeMap.end() )
- typeMap[name]=TypeCode::sequenceTc(name,name,typeMap[content]);
+ typeMap[name]=r->createSequenceTc(name,name,typeMap[content]);
//else ignored !!
}
else if(types_list[i].kind == SALOME_ModuleCatalog::Array)
ltc.push_back((TypeCodeObjref *)typeMap[b_name]);
//else ignored !!!
}
- typeMap[name]=TypeCode::interfaceTc(id,name,ltc);
+ typeMap[name]=r->createInterfaceTc(id,name,ltc);
}
else if(types_list[i].kind == SALOME_ModuleCatalog::Struc)
{
- TypeCodeStruct* t=(TypeCodeStruct*)TypeCode::structTc("",name);
+ TypeCodeStruct* t=r->createStructTc("",name);
for (int m=0; m< types_list[i].members.length(); m++)
{
const char* m_name=types_list[i].members[m].name;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SESSIONCATALOADER_HXX_
#define _SESSIONCATALOADER_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "RuntimeSALOME.hxx"
#include "StudyNodes.hxx"
#include "StudyPorts.hxx"
#include "Visitor.hxx"
+#include "TypeCode.hxx"
+#include "SalomeProc.hxx"
#include "SALOME_NamingService.hxx"
#include "SALOMEDS.hh"
#include <sstream>
#include <string>
#include <list>
+#include <stdlib.h>
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
}
int studyid=1;
- if (_propertyMap.find("StudyID") != _propertyMap.end())
+ if (getProperty("StudyID") != "")
{
// StudyId is specified
- studyid=atoi(_propertyMap["StudyID"].c_str());
+ studyid=atoi(getProperty("StudyID").c_str());
+ }
+ else
+ {
+ Proc* p=getProc();
+ if(p)
+ {
+ std::string value=p->getProperty("DefaultStudyID");
+ if(!value.empty())
+ studyid= atoi(value.c_str());
+ }
}
+
SALOMEDS::Study_var myStudy =aStudyManager->GetStudyByID(studyid);
if(CORBA::is_nil(myStudy))
{
for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
{
OutputStudyPort *outp = dynamic_cast<OutputStudyPort *>(*iter);
- std::string data = outp->getData();
- DEBTRACE("data: " << data );
- //try an id
- SALOMEDS::SObject_var aSO = myStudy->FindObjectID(data.c_str());
- if(CORBA::is_nil(aSO))
- {
- //try a path
- aSO=myStudy->FindObjectByPath(data.c_str());
- if(CORBA::is_nil(aSO))
- {
- _errorDetails="Execution problem: no id or path: ";
- _errorDetails=_errorDetails+data+" in study";
- throw Exception(_errorDetails);
- }
- }
-
- CORBA::String_var path=myStudy->GetObjectPath(aSO);
- DEBTRACE(path);
- CORBA::String_var id=aSO->GetID();
- DEBTRACE(id);
- //CORBA::Object_var sobj=aSO->GetObject();
- SALOMEDS::GenericAttribute_var aGAttr;
-
- CORBA::String_var value;
- if ( aSO->FindAttribute( aGAttr, "AttributeIOR" ) )
+ try
{
- SALOMEDS::AttributeIOR_var anAttr = SALOMEDS::AttributeIOR::_narrow( aGAttr );
- value=anAttr->Value();
+ outp->getDataFromStudy(myStudy);
}
- else
+ catch(Exception& e)
{
- //Problem !!!
- _errorDetails="Execution problem: no AttributeIOR in study object: ";
- _errorDetails=_errorDetails+data;
- throw Exception(_errorDetails);
+ _errorDetails=e.what();
+ throw;
}
- outp->putIOR((const char*)value);
}
DEBTRACE("+++++++ end StudyInNode::execute +++++++++++" );
}
-void StudyInNode::checkBasicConsistency() const throw(Exception)
+void StudyInNode::checkBasicConsistency() const throw(YACS::Exception)
{
DEBTRACE("StudyInNode::checkBasicConsistency");
if (! _setOfInputPort.empty())
inp->setData(data);
}
+/*
SALOMEDS::SObject_ptr findOrCreateSoWithName(SALOMEDS::Study_ptr study, SALOMEDS::StudyBuilder_ptr builder,
SALOMEDS::SObject_ptr sobj, const std::string& name)
{
}
return result._retn();
}
+*/
void StudyOutNode::execute()
{
}
int studyid=1;
- if (_propertyMap.find("StudyID") != _propertyMap.end())
+ if (getProperty("StudyID") != "")
{
// StudyId is specified
- studyid=atoi(_propertyMap["StudyID"].c_str());
+ studyid=atoi(getProperty("StudyID").c_str());
+ }
+ else
+ {
+ Proc* p=getProc();
+ if(p)
+ {
+ std::string value=p->getProperty("DefaultStudyID");
+ if(!value.empty())
+ studyid= atoi(value.c_str());
+ }
}
SALOMEDS::Study_var myStudy =aStudyManager->GetStudyByID(studyid);
for(iter = _setOfInputPort.begin(); iter != _setOfInputPort.end(); iter++)
{
InputStudyPort *inp = dynamic_cast<InputStudyPort *>(*iter);
- std::string data = inp->getData();
- DEBTRACE("data: " << data );
- //try to find an id
- aSO = myStudy->FindObjectID(data.c_str());
- if(CORBA::is_nil(aSO))
- {
- // the id does not exist. Try to create it by id
- aSO=myStudy->CreateObjectID(data.c_str());
- if(!CORBA::is_nil(aSO))
- {
- aGAttr=aBuilder->FindOrCreateAttribute(aSO,"AttributeName");
- anAttr = SALOMEDS::AttributeName::_narrow( aGAttr );
- anAttr->SetValue(inp->getName().c_str());
- }
- }
- if(CORBA::is_nil(aSO))
- {
- // try a path
- aSO=myStudy->FindObjectByPath(data.c_str());
- }
- if(CORBA::is_nil(aSO))
- {
- //try to create it by path
- std::string name;
- std::string::size_type begin = data.find_first_not_of("/");
- std::string::size_type pos=data.find_first_of("/", begin);
- if (pos != std::string::npos)
- name=data.substr(begin,pos-begin);
- else
- name=data.substr(begin);
- name="/"+name;
- DEBTRACE(name);
- aSO=myStudy->FindObjectByPath(name.c_str());
- if(CORBA::is_nil(aSO))
- {
- DEBTRACE("Create an entry " << name);
- //create a container component
- aSO=aBuilder->NewComponent(name.c_str());
- if(CORBA::is_nil(aSO))
- {
- std::cerr << "Execution problem: can not create component: " + data << std::endl;
- continue;
- }
- aGAttr=aBuilder->FindOrCreateAttribute(aSO,"AttributeIOR");
- iorAttr = SALOMEDS::AttributeIOR::_narrow( aGAttr );
- iorAttr->SetValue(name.c_str());
- }
- begin=data.find_first_not_of("/",pos);
- while (begin != std::string::npos)
- {
- pos = data.find_first_of("/", begin);
- if (pos != std::string::npos)
- name=data.substr(begin,pos-begin);
- else
- name=data.substr(begin);
- aSO=findOrCreateSoWithName(myStudy,aBuilder,aSO,name);
- begin=data.find_first_not_of("/",pos);
- }
- }
- if(CORBA::is_nil(aSO))
- {
- std::cerr << "Execution problem: can not create id or path: " + data + " in study" << std::endl;
- continue;
- }
- std::string value=inp->getIOR();
- DEBTRACE(value);
- aGAttr=aBuilder->FindOrCreateAttribute(aSO,"AttributeIOR");
- iorAttr = SALOMEDS::AttributeIOR::_narrow( aGAttr );
- iorAttr->SetValue(value.c_str());
+ inp->putDataInStudy(myStudy,aBuilder);
}
// save in file if ref is given
DEBTRACE("+++++++ end StudyOutNode::execute +++++++++++" );
}
-void StudyOutNode::checkBasicConsistency() const throw(Exception)
+void StudyOutNode::checkBasicConsistency() const throw(YACS::Exception)
{
DEBTRACE("StudyOutNode::checkBasicConsistency");
if (! _setOfOutputPort.empty())
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _STUDYNODES_HXX_
#define _STUDYNODES_HXX_
+#include "YACSRuntimeSALOMEExport.hxx"
#include "DataNode.hxx"
namespace YACS
{
namespace ENGINE
{
- class StudyInNode: public DataNode
+ class YACSRUNTIMESALOME_EXPORT StudyInNode: public DataNode
{
protected:
Node *simpleClone(ComposedNode *father, bool editionOnly) const;
public:
static const char IMPL_NAME[];
};
- class StudyOutNode: public DataNode
+ class YACSRUNTIMESALOME_EXPORT StudyOutNode: public DataNode
{
protected:
Node *simpleClone(ComposedNode *father, bool editionOnly) const;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "StudyPorts.hxx"
#include "TypeCode.hxx"
+#include "Node.hxx"
+#include "Proc.hxx"
+#include "ComponentInstance.hxx"
+#include "SalomeComponent.hxx"
+#include "RuntimeSALOME.hxx"
+
+#include "SALOMEDS_Attributes.hh"
#include <iostream>
+#include <cstdlib>
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
namespace ENGINE
{
+/*! \class YACS::ENGINE::OutputStudyPort
+ * \brief Class for Study output Ports
+ *
+ * \ingroup Ports
+ *
+ * \see StudyInNode
+ */
+
OutputStudyPort::OutputStudyPort(const std::string& name, Node* node, TypeCode* type)
: OutputXmlPort(name, node, type),
DataPort(name, node, type),
OutputStudyPort::OutputStudyPort(const OutputStudyPort& other, Node *newHelder)
: OutputXmlPort(other,newHelder),
DataPort(other,newHelder),
- Port(other,newHelder)
+ Port(other,newHelder),_storeData(other._storeData)
{
}
+OutputPort* OutputStudyPort::clone(Node *newHelder) const
+{
+ return new OutputStudyPort(*this,newHelder);
+}
+
void OutputStudyPort::setData(const std::string& data)
{
_storeData = data;
return getData();
}
+void OutputStudyPort::getDataFromStudy(SALOMEDS::Study_var myStudy)
+{
+ std::string data = getData();
+ DEBTRACE("data: " << data );
+ //try an id
+ SALOMEDS::SObject_var aSO = myStudy->FindObjectID(data.c_str());
+ if(CORBA::is_nil(aSO))
+ {
+ //try a path
+ aSO=myStudy->FindObjectByPath(data.c_str());
+ if(CORBA::is_nil(aSO))
+ {
+ std::stringstream msg;
+ msg << "Execution problem: no id or path: " << data << " in study " << myStudy->StudyId();
+ throw Exception(msg.str());
+ }
+ }
+
+ CORBA::String_var path=myStudy->GetObjectPath(aSO);
+ DEBTRACE(path);
+ CORBA::String_var id=aSO->GetID();
+ DEBTRACE(id);
+ //CORBA::Object_var sobj=aSO->GetObject();
+
+ SALOMEDS::GenericAttribute_var aGAttr;
+ CORBA::String_var value;
+
+ if(edGetType()->kind()==Objref)
+ {
+ if ( aSO->FindAttribute( aGAttr, "AttributeIOR" ) )
+ {
+ SALOMEDS::AttributeIOR_var anAttr = SALOMEDS::AttributeIOR::_narrow( aGAttr );
+ value=anAttr->Value();
+ putIOR((const char*)value);
+ }
+ else
+ {
+ //Problem !!!
+ std::string error="Execution problem: no AttributeIOR in study object: ";
+ error=error+data;
+ throw Exception(error);
+ }
+ }
+ else if(edGetType()->kind()==Double )
+ {
+ if ( aSO->FindAttribute( aGAttr, "AttributeReal" ) )
+ {
+ SALOMEDS::AttributeReal_var anAttr = SALOMEDS::AttributeReal::_narrow( aGAttr );
+ CORBA::Double d=anAttr->Value();
+ std::stringstream msg;
+ msg << "<value><double>" << d << "</double></value>";
+ put(msg.str().c_str());
+ }
+ else
+ {
+ std::string error="Execution problem: no AttributeReal in study object: ";
+ throw Exception(error+data);
+ }
+ }
+ else if(edGetType()->kind()== Int)
+ {
+ if ( aSO->FindAttribute( aGAttr, "AttributeInteger" ) )
+ {
+ SALOMEDS::AttributeInteger_var anAttr = SALOMEDS::AttributeInteger::_narrow( aGAttr );
+ CORBA::Long l=anAttr->Value();
+ std::stringstream msg;
+ msg << "<value><int>" << l << "</int></value>";
+ put(msg.str().c_str());
+ }
+ else
+ {
+ std::string error="Execution problem: no AttributeInteger in study object: ";
+ throw Exception(error+data);
+ }
+ }
+ else
+ {
+ if ( aSO->FindAttribute( aGAttr, "AttributeComment" ) )
+ {
+ SALOMEDS::AttributeComment_var anAttr = SALOMEDS::AttributeComment::_narrow( aGAttr );
+ value=anAttr->Value();
+ DEBTRACE(value);
+ putIOR((const char*)value);
+ }
+ else
+ {
+ std::string error="Execution problem: no AttributeComment in study object: ";
+ throw Exception(error+data);
+ }
+ }
+}
+
+
+
+
+SALOMEDS::SObject_ptr findOrCreateSoWithName(SALOMEDS::Study_ptr study, SALOMEDS::StudyBuilder_ptr builder,
+ SALOMEDS::SObject_ptr sobj, const std::string& name)
+{
+ SALOMEDS::ChildIterator_var anIterator= study->NewChildIterator(sobj);
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeName_var namAttr ;
+ SALOMEDS::SObject_var result=SALOMEDS::SObject::_nil();
+
+ for (; anIterator->More(); anIterator->Next())
+ {
+ SALOMEDS::SObject_var anObj=anIterator->Value();
+ if(anObj->FindAttribute(anAttr, "AttributeName"))
+ {
+ namAttr = SALOMEDS::AttributeName::_narrow( anAttr );
+ CORBA::String_var value=namAttr->Value();
+ if(name == (const char*)value)
+ {
+ result=anObj;
+ break;
+ }
+ }
+ }
+ if(CORBA::is_nil(result))
+ {
+ //create it
+ result = builder->NewObject( sobj );
+ anAttr=builder->FindOrCreateAttribute(result,"AttributeName");
+ namAttr = SALOMEDS::AttributeName::_narrow( anAttr );
+ namAttr->SetValue(name.c_str());
+ }
+ return result._retn();
+}
+
+/*! \class YACS::ENGINE::InputStudyPort
+ * \brief Class for Study input Ports
+ *
+ * \ingroup Ports
+ *
+ * \see StudyOutNode
+ */
InputStudyPort::InputStudyPort(const std::string& name, Node* node, TypeCode* type)
: InputXmlPort(name, node, type),
InputStudyPort::InputStudyPort(const InputStudyPort& other, Node *newHelder)
: InputXmlPort(other,newHelder),
DataPort(other,newHelder),
- Port(other,newHelder)
+ Port(other,newHelder),_storeData(other._storeData)
{
}
+InputPort* InputStudyPort::clone(Node *newHelder) const
+{
+ return new InputStudyPort(*this,newHelder);
+}
+
void InputStudyPort::setData(const std::string& data)
{
_storeData = data;
return getData();
}
+void InputStudyPort::putDataInStudy(SALOMEDS::Study_var myStudy,SALOMEDS::StudyBuilder_var aBuilder)
+{
+ SALOMEDS::GenericAttribute_var aGAttr;
+ SALOMEDS::SObject_var aSO ;
+ SALOMEDS::AttributeName_var anAttr ;
+ SALOMEDS::AttributeIOR_var iorAttr ;
+ SALOMEDS::SComponent_var aFather;
+
+ std::string data = getData();
+ DEBTRACE("data: " << data );
+ //try to find an existing id (i:j:k...)
+ aSO = myStudy->FindObjectID(data.c_str());
+ if(CORBA::is_nil(aSO))
+ {
+ // the id does not exist. Try to create it by id
+ aSO=myStudy->CreateObjectID(data.c_str());
+ if(!CORBA::is_nil(aSO))
+ {
+ aGAttr=aBuilder->FindOrCreateAttribute(aSO,"AttributeName");
+ anAttr = SALOMEDS::AttributeName::_narrow( aGAttr );
+ anAttr->SetValue(getName().c_str());
+ }
+ }
+
+ if(CORBA::is_nil(aSO))
+ {
+ //try to publish the object with a given path
+ std::string name; // the component instance name
+ std::string objname; // the object name (eventually with "/")
+ std::string::size_type begin = data.find_first_not_of("/");
+ std::string::size_type pos=data.find_first_of("/", begin);
+ if (pos != std::string::npos)
+ {
+ name=data.substr(begin,pos-begin);
+ objname=data.substr(pos+1);
+ }
+ else
+ {
+ name=data.substr(begin);
+ objname="";
+ }
+ std::string pname="/"+name;
+ DEBTRACE(pname);
+ DEBTRACE(objname);
+
+ Proc* proc=getNode()->getProc();
+ if(proc->componentInstanceMap.count(name)!=0)
+ {
+ // There is a component instance with this name. Is it a Salome component or not ?
+ ComponentInstance* compo=proc->componentInstanceMap[name];
+ if(SalomeComponent* scompo=dynamic_cast<SalomeComponent*>(compo))
+ {
+ //It's a Salome component, make it the right way : component name, component instance reference, ...
+ CORBA::Object_var compovar= scompo->getCompoPtr();
+ SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(compovar);
+ if ( !CORBA::is_nil( aDriver ) )
+ {
+ //It's a Salome component that implements the Driver interface. Use it to publish in study
+ CORBA::ORB_ptr orb;
+ CORBA::Object_var anObject;
+ try
+ {
+ orb = getSALOMERuntime()->getOrb();
+ anObject=orb->string_to_object(getIOR().c_str());
+ }
+ catch ( ... )
+ {
+ std::cerr << "Execution problem: can not get the object to publish" << std::endl;
+ return;
+ }
+ if ( aDriver->CanPublishInStudy( anObject ) )
+ {
+ //It's fine use the driver to publish
+ SALOMEDS::SObject_var aTmpSO; // initialized to nil
+ try
+ {
+ aTmpSO = aDriver->PublishInStudy(myStudy, aTmpSO, anObject,objname.c_str() );
+ return;
+ }
+ catch ( ... )
+ {
+ std::cerr << "Execution problem: error in PublishInStudy" << std::endl;
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ // Does component entry exist ?
+ aSO=myStudy->FindObjectByPath(pname.c_str());
+ if(CORBA::is_nil(aSO))
+ {
+ // We have not been able to publish the object with Salome Driver, make it the light way
+ aFather=aBuilder->NewComponent(name.c_str());
+ if(CORBA::is_nil(aFather))
+ {
+ std::cerr << "Execution problem: can not create component: " + name << std::endl;
+ return;
+ }
+ aGAttr=aBuilder->FindOrCreateAttribute(aFather,"AttributeName");
+ anAttr = SALOMEDS::AttributeName::_narrow( aGAttr );
+ anAttr->SetValue(name.c_str());
+ aSO=myStudy->FindObjectByPath(pname.c_str());
+ }
+
+ begin=data.find_first_not_of("/",pos);
+ while (begin != std::string::npos)
+ {
+ pos = data.find_first_of("/", begin);
+ if (pos != std::string::npos)
+ name=data.substr(begin,pos-begin);
+ else
+ name=data.substr(begin);
+ aSO=findOrCreateSoWithName(myStudy,aBuilder,aSO,name);
+ begin=data.find_first_not_of("/",pos);
+ }
+ }
+
+ if(CORBA::is_nil(aSO))
+ {
+ std::cerr << "Execution problem: can not create id or path: " + data + " in study" << std::endl;
+ return;
+ }
+
+ std::string value;
+ SALOMEDS::AttributeComment_var commentAttr ;
+ SALOMEDS::AttributeReal_var realAttr ;
+ SALOMEDS::AttributeInteger_var intAttr ;
+ SALOMEDS::AttributeString_var stringAttr ;
+ double d;
+ long v;
+ switch(edGetType()->kind())
+ {
+ case Objref:
+ value=getIOR();
+ DEBTRACE(value);
+ aGAttr=aBuilder->FindOrCreateAttribute(aSO,"AttributeIOR");
+ iorAttr = SALOMEDS::AttributeIOR::_narrow( aGAttr );
+ iorAttr->SetValue(value.c_str());
+ break;
+ case Double:
+ value=splitXML(dump());
+ DEBTRACE(value);
+ aGAttr=aBuilder->FindOrCreateAttribute(aSO,"AttributeReal");
+ realAttr = SALOMEDS::AttributeReal::_narrow( aGAttr );
+ d=atof(value.c_str());
+ realAttr->SetValue(d);
+ break;
+ case Int:
+ value=splitXML(dump());
+ DEBTRACE(value);
+ aGAttr=aBuilder->FindOrCreateAttribute(aSO,"AttributeInteger");
+ intAttr = SALOMEDS::AttributeInteger::_narrow( aGAttr );
+ v=atol(value.c_str());
+ intAttr->SetValue(v);
+ break;
+ case String:
+ case Bool:
+ value=splitXML(dump());
+ DEBTRACE(value);
+ aGAttr=aBuilder->FindOrCreateAttribute(aSO,"AttributeComment");
+ commentAttr = SALOMEDS::AttributeComment::_narrow( aGAttr );
+ commentAttr->SetValue(value.c_str());
+ break;
+ default:
+ value=dump();
+ DEBTRACE(value);
+ aGAttr=aBuilder->FindOrCreateAttribute(aSO,"AttributeComment");
+ commentAttr = SALOMEDS::AttributeComment::_narrow( aGAttr );
+ commentAttr->SetValue(value.c_str());
+ }
}
-}
+
+} //end namespace ENGINE
+} //end namespace YACS
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _STUDYPORTS_HXX_
#define _STUDYPORTS_HXX_
+#include "YACSRuntimeSALOMEExport.hxx"
#include "XMLPorts.hxx"
+#include "SALOMEDS.hh"
namespace YACS
{
namespace ENGINE
{
-/*! \brief Class for Study output Ports
- *
- * \ingroup Ports
- *
- * \see StudyInNode
- */
- class OutputStudyPort: public OutputXmlPort
+ class YACSRUNTIMESALOME_EXPORT OutputStudyPort: public OutputXmlPort
{
public:
OutputStudyPort(const std::string& name, Node* node, TypeCode* type);
OutputStudyPort(const OutputStudyPort& other, Node *newHelder);
+ OutputPort *clone(Node *newHelder) const;
void setData(const std::string& data);
std::string getData();
virtual void putIOR(const std::string& ior);
virtual std::string getPyObj();
virtual std::string getAsString();
virtual std::string typeName() {return "YACS__ENGINE__OutputStudyPort";}
+ virtual void getDataFromStudy(SALOMEDS::Study_var myStudy);
protected:
std::string _storeData;
};
-/*! \brief Class for Study input Ports
- *
- * \ingroup Ports
- *
- * \see StudyOutNode
- */
- class InputStudyPort: public InputXmlPort
+ class YACSRUNTIMESALOME_EXPORT InputStudyPort: public InputXmlPort
{
public:
InputStudyPort(const std::string& name, Node* node, TypeCode* type);
InputStudyPort(const InputStudyPort& other, Node *newHelder);
+ InputPort *clone(Node *newHelder) const;
void setData(const std::string& data);
std::string getData();
virtual std::string getIOR();
virtual std::string getPyObj();
virtual std::string getAsString();
virtual std::string typeName() {return "YACS__ENGINE__InputStudyPort";}
+ virtual void putDataInStudy(SALOMEDS::Study_var myStudy,SALOMEDS::StudyBuilder_var aBuilder);
protected:
std::string _storeData;
};
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm/unix/make_begin.am
check_SCRIPTS = runtimeTest.sh
-check_PROGRAMS = TestRuntime echoSrv echo_clt
+if CPPUNIT_IS_OK
+check_PROGRAMS = TestRuntime
+else
+check_PROGRAMS =
+endif
+check_PROGRAMS += runtimeTestEchoSrv echo_clt
+
lib_LTLIBRARIES = libTestComponentLocal.la
IDL_FILES = echo.idl
EXTRA_DIST = $(IDL_FILES) standaloneTest.sh runtimeTest.hxx runtimeTest.sh TestComponent.hxx xmlrun_orig.sh
+if CPPUNIT_IS_OK
TESTS = runtimeTest.sh
-TESTS_ENVIRONMENT=$(SHELL) -x
+endif
+TESTS_ENVIRONMENT=LD_LIBRARY_PATH=@KERNEL_ROOT_DIR@/lib/salome:$$LD_LIBRARY_PATH $(SHELL) -x
+
+SALOME_INCL_PATH=-I$(KERNEL_ROOT_DIR)/include/salome
TestRuntime_SOURCES = \
TestRuntime.cxx \
$(PYTHON_CPPFLAGS) \
$(OMNIORB_INCLUDES) \
$(OMNIORB_CXXFLAGS) \
+ $(SALOME_INCL_PATH) \
-I.. \
-I$(srcdir)/.. \
-I$(srcdir)/../../bases \
-DLOCATION="\"@prefix@\"" -DYACS_PTHREAD
xmlrun.sh:${srcdir}/xmlrun_orig.sh
- cp $(srcdir)/xmlrun_orig.sh xmlrun.sh
+ cp -f $(srcdir)/xmlrun_orig.sh xmlrun.sh
echoDynSK.cc echoSK.cc echo.hh:echo.idl
$(OMNIORB_IDL) $(OMNIORB_IDLCXXFLAGS) -bcxx -Wba $<
-echoSrv_SOURCES = echoSrv.cxx
-nodist_echoSrv_SOURCES = $(IDL_SOURCES)
+runtimeTestEchoSrv_SOURCES = echoSrv.cxx
+nodist_runtimeTestEchoSrv_SOURCES = $(IDL_SOURCES)
-echoSrv_CXXFLAGS = \
+runtimeTestEchoSrv_CXXFLAGS = \
+ -I. \
-I$(srcdir)/../../bases \
$(OMNIORB_INCLUDES) \
$(OMNIORB_CXXFLAGS)
-echoSrv_LDFLAGS = \
+runtimeTestEchoSrv_LDFLAGS = \
$(OMNIORB_LIBS)
echo_clt_SOURCES = echo_clt.cxx
nodist_echo_clt_SOURCES = $(IDL_SOURCES)
echo_clt_CXXFLAGS = \
+ -I. \
-I$(srcdir)/../../bases \
$(OMNIORB_INCLUDES) \
-I$(OMNIORB_ROOT)/include/omniORB4/internal \
libTestComponentLocal_la_LDFLAGS = -module
+libTestComponentLocal_la_LIBADD = \
+ ../../engine/libYACSlibEngine.la
+
clean-local:
- rm -rf echo_idl.py* echoSK.cc echoDynSK.cc echo.hh eo eo__POA yacs* omnilog lib omniorb.cfg traceExec_* xmlrun.sh
+ rm -rf echo_idl.py* echoSK.cc echoDynSK.cc echo.hh eo eo__POA yacs* omnilog lib omniorb.cfg traceExec_* xmlrun.sh UnitTestsResult
include $(top_srcdir)/adm/unix/make_end.am
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Any.hxx"
#include <iostream>
#include <cstring>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef TESTCOMPONENT_HXX_
#define TESTCOMPONENT_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#define UNIT_TEST_HEADER " --- TEST src/runtime"
#include "runtimeTest.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifdef USE_CPPUNIT
#undef USE_CPPUNIT
#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __ECHO_IDL__
#define __ECHO_IDL__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include <time.h>
#include <echo.hh>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
//#define REFCNT
//
#ifdef REFCNT
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// --- include from engine first, to avoid redifinition warning _POSIX_C_SOURCE
//
#include "TypeConversions.hxx"
{
DEBTRACE(" --- recursive blocs, check constituants" );
- // --- Bloc_2 with Bloc_1 and Bloc_2
+ // --- Bloc_2 with Bloc_0, Bloc_1 and Node_3
{
ostringstream ss;
ss << "Bloc_" << _ibloc++;
PyObject *ob=((OutputPyPort*)_nodeMap["Node_11"]->getOutputPort("c"))->get();
DEBTRACE("ob refcnt: " << ob->ob_refcnt);
- PyObject_Print(ob,stdout,Py_PRINT_RAW);
+ std::cerr << "Output port Node_11.c: ";
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject_Print(ob,stderr,Py_PRINT_RAW);
+ PyGILState_Release(gstate);
+ std::cerr << std::endl;
// DEBTRACE("a: " << &a);
// DEBTRACE("a.value(): " << a.value());
}
DEBTRACE("Put a " << type[jtype] << " double (" << d0 << ") in " << s);
- pwrap->put(v);
+ if (jtype == 2)
+ {
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ pwrap->put(v);
+ PyGILState_Release(gstate);
+ }
+ else
+ pwrap->put(v);
cerr << endl;
switch (itype)
u->decrRef();
v->decrRef();
- w->decrRef();
delete node;
node = _myRuntime->createCompoNode("Cpp", "test");
CppComponent * C = new CppComponent("TestComponent");
node->setComponent(C);
+ C->decrRef();
node->setMethod("f");
in = node->edAddInputPort("in", _tc_double);
u->decrRef();
v->decrRef();
- w->decrRef();
delete node;
CppComponent *C = new CppComponent("TestComponent");
((CppNode *) n1)->setComponent(C);
+ C->decrRef();
((CppNode *) n1)->setMethod("f");
in1 = n1->edAddInputPort("i", _tc_double);
out1 = n1->edAddOutputPort("o", _tc_double);
if (endTests) return;
endTests = true;
+
+ delete _blocMap["Bloc_3"];
+ delete _blocMap["Bloc_2"];
+ delete _nodeMap["Node_4"];
+ delete _nodeMap["Node_5"];
+ delete _nodeMap["Node_6"];
+ delete _nodeMap["Node_7"];
+ delete _nodeMap["Node_8"];
+ delete _nodeMap["Node_9"];
+
_tc_seqC->decrRef();
_tc_C->decrRef();
list<TypeCodeObjref *>::iterator i;
_tc_seqlong->decrRef();
_tc_string->decrRef();
+ _myRuntime->fini();
delete _myRuntime;
}
+
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _RUNTIMETEST_HXX_
#define _RUNTIMETEST_HXX_
CPPUNIT_TEST(convertPorts );
CPPUNIT_TEST(executeCppNode );
CPPUNIT_TEST(createGraphWithCppNodes );
+ CPPUNIT_TEST(classTeardown );
CPPUNIT_TEST_SUITE_END();
public:
#!/bin/sh
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
BASEREP=`pwd`
OMNIORB_CONFIG=${BASEREP}/omniorb.cfg
OMNINAMES_LOGDIR=${BASEREP}/omnilog
#wait enough time to let omniNames start
sleep 2
-./echoSrv &
+./runtimeTestEchoSrv &
pidecho=$!
echo $pidecho
cp .libs/libTestComponentLocal.so lib/salome
export TESTCOMPONENT_ROOT_DIR=`pwd`
-#wait enough time to let echoSrv start and register
+#wait enough time to let runtimeTestEchoSrv start and register
sleep 2
./TestRuntime
#!/bin/sh
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
killall -9 omniNames echoSrv
BASEREP=`pwd`
pidomni=$!
echo $pidomni
-./echoSrv &
+./runtimeTestEchoSrv &
pidecho=$!
echo $pidecho
#!/usr/bin/env python
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
import xmlrpclib,sys
data="""
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
//#define REFCNT
//
#ifdef REFCNT
#include <iostream>
#include <sstream>
+#ifdef WNT
+#include <fcntl.h>
+#define _S_IREAD 256
+#define _S_IWRITE 128
+int mkstemp(char *tmpl)
+{
+ int ret=-1;
+ mktemp(tmpl); ret=open(tmpl,O_RDWR|O_BINARY|O_CREAT|O_EXCL|_O_SHORT_LIVED, _S_IREAD|_S_IWRITE);
+ return ret;
+}
+#endif
+
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
CORBA::TypeCode_ptr getCorbaTCObjref(const TypeCode *t)
{
- DEBTRACE( t->name() << " " << t->shortName());
+ DEBTRACE( t->name() << " " << t->shortName() << " " << t->id());
CORBA::TypeCode_ptr tc;
if(strncmp(t->id(),"python",6)==0 )
tc= CORBA::TypeCode::_duplicate(Engines::_tc_fileBlock);
{
// It's a native Python object pickle it
PyObject* mod=PyImport_ImportModule("cPickle");
- PyObject *pickled=PyObject_CallMethod(mod,"dumps","Oi",o,protocol);
+ PyObject *pickled=PyObject_CallMethod(mod,(char *)"dumps",(char *)"Oi",o,protocol);
DEBTRACE(PyObject_REPR(pickled) );
Py_DECREF(mod);
if(pickled==NULL)
PyErr_Print();
throw YACS::ENGINE::ConversionException("Problem in convertToYacsObjref<PYTHONImpl: no simplejson module");
}
- PyObject *pickled=PyObject_CallMethod(mod,"dumps","O",o);
+ PyObject *pickled=PyObject_CallMethod(mod,(char *)"dumps",(char *)"O",o);
Py_DECREF(mod);
if(pickled==NULL)
{
}
else
{
- // It's a CORBA Object convert it to an IOR string
- PyObject *pystring=PyObject_CallMethod(getSALOMERuntime()->getPyOrb(),"object_to_string","O",o);
+ // It should be a CORBA Object convert it to an IOR string
+ PyObject *pystring=PyObject_CallMethod(getSALOMERuntime()->getPyOrb(),(char *)"object_to_string",(char *)"O",o);
if(pystring==NULL)
{
PyErr_Print();
{
static inline PyObject* convert(const TypeCode *t,std::string& o)
{
+ if(o=="")
+ {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
if(t->isA(Runtime::_tc_file))
{
//It's an objref file. Convert it specially
{
//It's a python pickled object, unpickled it
PyObject* mod=PyImport_ImportModule("cPickle");
- PyObject *ob=PyObject_CallMethod(mod,"loads","s#",o.c_str(),o.length());
+ PyObject *ob=PyObject_CallMethod(mod,(char *)"loads",(char *)"s#",o.c_str(),o.length());
DEBTRACE(PyObject_REPR(ob));
Py_DECREF(mod);
if(ob==NULL)
PyErr_Print();
throw YACS::ENGINE::ConversionException("Problem in convertToYacsObjref<PYTHONImpl: no simplejson module");
}
- PyObject *ob=PyObject_CallMethod(mod,"loads","s",o.c_str());
+ PyObject *ob=PyObject_CallMethod(mod,(char *)"loads",(char *)"s",o.c_str());
Py_DECREF(mod);
if(ob==NULL)
{
throw ConversionException("Can't get reference to object");
}
+ if(obref->_non_existent())
+ {
+ throw ConversionException("non_existent object");
+ }
+
if( CORBA::is_nil(obref) )
{
DEBTRACE( "Can't get reference to object (or it was nil)." );
//ob is a CORBA::Object. Try to convert it to more specific type SALOME/GenericObj
if(obref->_is_a("IDL:SALOME/GenericObj:1.0"))
{
- PyObject *result = PyObject_CallMethod(getSALOMERuntime()->get_omnipy(), "narrow", "Osi",ob,"IDL:SALOME/GenericObj:1.0",1);
+ PyObject *result = PyObject_CallMethod(getSALOMERuntime()->get_omnipy(), (char *)"narrow", (char *)"Osi",ob,"IDL:SALOME/GenericObj:1.0",1);
if(result==NULL)
PyErr_Clear();//Exception during narrow. Keep ob
else if(result==Py_None)
}
}
};
+ template <ImplType IMPLOUT, class TOUT>
+ struct convertToYacsStruct<NEUTRALImpl,YACS::ENGINE::Any*,void*,IMPLOUT,TOUT>
+ {
+ static inline void convert(const TypeCode *t,YACS::ENGINE::Any* o,void*,std::map<std::string,TOUT>& m)
+ {
+ StructAny * sdata = dynamic_cast<StructAny *>(o);
+ YASSERT(sdata != NULL);
+ const TypeCodeStruct * tst = dynamic_cast<const TypeCodeStruct *>(t);
+ YASSERT(tst != NULL);
+ for (int i=0 ; i<tst->memberCount() ; i++)
+ {
+ string name = tst->memberName(i);
+ TOUT ro=YacsConvertor<NEUTRALImpl,YACS::ENGINE::Any*,void*,IMPLOUT,TOUT>(tst->memberType(i),(*sdata)[name.c_str()],0);
+ m[name]=ro;
+ }
+ }
+ };
/* End of ToYacs Convertor for NEUTRALImpl */
//! FromYacs Convertor for NEUTRALImpl
{
static inline YACS::ENGINE::Any* convert(const TypeCode *t,std::string& o)
{
+ //Check if objref is a GenericObj and register it if it is the case (workaround for bad management of GenericObj)
+ if(o=="" || (t->isA(Runtime::_tc_file)) || (strncmp(t->id(),"python",6)==0) || (strncmp(t->id(),"json",4)==0))
+ return YACS::ENGINE::AtomAny::New(o);
+
+ //Objref CORBA. prefix=IOR,corbaname,corbaloc
+ CORBA::Object_var obref;
+ try
+ {
+ obref = getSALOMERuntime()->getOrb()->string_to_object(o.c_str());
+ }
+ catch(CORBA::Exception& ex)
+ {
+ throw ConversionException("Can't get reference to object");
+ }
+ if(obref->_non_existent())
+ throw ConversionException("non_existent object");
+ if( CORBA::is_nil(obref) )
+ throw ConversionException("Can't get reference to object");
+ if(!obref->_is_a(t->id()))
+ {
+ stringstream msg;
+ msg << "Problem in conversion: an objref " << t->id() << " is expected " << endl;
+ msg << "An objref of type " << obref->_PD_repoId << " is given " << endl;
+ msg << " (" << __FILE__ << ":" << __LINE__ << ")";
+ throw YACS::ENGINE::ConversionException(msg.str());
+ }
+
+ SALOME::GenericObj_var gobj=SALOME::GenericObj::_narrow(obref);
+ if(!CORBA::is_nil(gobj))
+ {
+ DEBTRACE("It's a SALOME::GenericObj register it");
+ gobj->Register();
+ }
+ else
+ DEBTRACE("It's a CORBA::Object but not a SALOME::GenericObj");
+
return YACS::ENGINE::AtomAny::New(o);
}
};
return any;
}
};
+
+ template <>
+ struct convertFromYacsStruct<NEUTRALImpl,YACS::ENGINE::Any*>
+ {
+ static inline YACS::ENGINE::Any* convert(const TypeCode *t,std::map<std::string,YACS::ENGINE::Any*>& m)
+ {
+ StructAny * any = StructAny::New((TypeCodeStruct *)t);
+ std::map<std::string,YACS::ENGINE::Any*>::const_iterator it;
+ for (it=m.begin() ; it!=m.end() ; it++)
+ {
+ any->setEltAtRank(it->first.c_str(), it->second);
+ it->second->decrRef();
+ }
+ return any;
+ }
+ };
/* End of FromYacs Convertor for NEUTRALImpl */
//! ToYacs Convertor for CORBAImpl
PyGILState_STATE gstate = PyGILState_Ensure();
PyObject* mod=PyImport_ImportModule("cPickle");
- PyObject *ob=PyObject_CallMethod(mod,"loads","s#",s,buffer->length());
- PyObject *pickled=PyObject_CallMethod(mod,"dumps","Oi",ob,protocol);
+ PyObject *ob=PyObject_CallMethod(mod,(char *)"loads",(char *)"s#",s,buffer->length());
+ PyObject *pickled=PyObject_CallMethod(mod,(char *)"dumps",(char *)"Oi",ob,protocol);
DEBTRACE(PyObject_REPR(pickled));
std::string mystr=PyString_AsString(pickled);
Py_DECREF(mod);
{
DynamicAny::DynAny_var temp=ds->current_component();
CORBA::Any* a=*iter;
+ //It seems that from_any does not support inherited objref: convert to CORBA::Object and insert reference
if(isObjref)
{
CORBA::Object_var zzobj ;
int nMember=tst->memberCount();
DEBTRACE("nMember="<<nMember);
- CORBA::StructMemberSeq mseq;
- mseq.length(nMember);
- for(int i=0;i<nMember;i++)
- {
- const char * name=tst->memberName(i);
- if(m.count(name) !=0)
- {
- mseq[i].type=m[name]->type();
- }
- }
- CORBA::TypeCode_var tc= orb->create_struct_tc("","",mseq);
+ CORBA::TypeCode_var tc=getCorbaTC(t);
DynamicAny::DynAny_var dynany=getSALOMERuntime()->getDynFactory()->create_dyn_any_from_type_code(tc);
DynamicAny::DynStruct_var ds = DynamicAny::DynStruct::_narrow(dynany);
DEBTRACE("Member name="<<name);
//do not test member presence : test has been done in ToYacs convertor
CORBA::Any* a=m[name];
- temp->from_any(*a);
+ //It seems that from_any does not support inherited objref: convert to CORBA::Object and insert reference
+ CORBA::TypeCode_var atc = tc->member_type(i);
+ if(atc->kind()==CORBA::tk_objref)
+ {
+ //special treatment for objref
+ CORBA::Object_var zzobj ;
+ *a >>= CORBA::Any::to_object(zzobj) ;
+ temp->insert_reference(zzobj);
+ }
+ else
+ {
+ temp->from_any(*a);
+ }
//delete intermediate any
delete a;
ds->next();
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _TYPECONVERSIONS_HXX_
#define _TYPECONVERSIONS_HXX_
+#include "YACSRuntimeSALOMEExport.hxx"
+
#include <Python.h>
#include <omniORB4/CORBA.h>
#include <libxml/parser.h>
std::string convertCorbaXml(const TypeCode * t,CORBA::Any* ob);
CORBA::Any *convertPyObjectCorba(const TypeCode *t,PyObject *ob);
- std::string convertPyObjectXml(const TypeCode * t,PyObject* ob);
+ YACSRUNTIMESALOME_EXPORT std::string convertPyObjectXml(const TypeCode * t,PyObject* ob);
YACS::ENGINE::Any *convertPyObjectNeutral(const TypeCode *t,PyObject* ob);
PyObject* convertPyObjectPyObject(const TypeCode *t,PyObject *ob);
std::string convertPyObjectToString(PyObject* ob);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "PresetPorts.hxx"
#include "VisitorSaveSalomeSchema.hxx"
#include "DataNode.hxx"
_out << indent(depth) << "<parameter name=\"" << (*it)->getName() << "\" type=\""
<< (*it)->edGetType()->name() << "\">" << endl;
OutputPresetPort *outp = dynamic_cast<OutputPresetPort*>(*it);
- assert(outp);
+ YASSERT(outp);
_out << indent(depth+1) << outp->getData();
_out << indent(depth) << "</parameter>" << endl;
}
_out << indent(depth) << "<parameter name=\"" << (*it)->getName() << "\" type=\""
<< (*it)->edGetType()->name() << "\" ref=\"";
OutputStudyPort *outp = dynamic_cast<OutputStudyPort*>(*it);
- assert(outp);
+ YASSERT(outp);
_out << outp->getData() << "\"/>" << endl;
}
}
_out << indent(depth) << "<parameter name=\"" << (*it)->getName() << "\" type=\""
<< (*it)->edGetType()->name() << "\" ref=\"";
InputStudyPort *inp = dynamic_cast<InputStudyPort*>(*it);
- assert(inp);
+ YASSERT(inp);
_out << inp->getData() << "\"/>" << endl;
}
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __VISITORSAVESALOMESCHEMA_HXX__
#define __VISITORSAVESALOMESCHEMA_HXX__
+#include "YACSRuntimeSALOMEExport.hxx"
#include "VisitorSaveSchema.hxx"
namespace YACS
{
namespace ENGINE
{
- class VisitorSaveSalomeSchema: public VisitorSaveSchema
+ class YACSRUNTIMESALOME_EXPORT VisitorSaveSalomeSchema: public VisitorSaveSchema
{
public:
VisitorSaveSalomeSchema(ComposedNode *root);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "XMLCORBAConv.hxx"
#include "CORBAXMLConv.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __XMLCORBACONV_HXX__
#define __XMLCORBACONV_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "XMLCppConv.hxx"
xmlNodePtr cur;
Any *ob=NULL;
{
- doc = xmlParseMemory(data, strlen(data));
- if (doc == NULL )
- {
- stringstream msg;
- msg << "Problem in conversion: XML Document not parsed successfully ";
- msg << " (" << __FILE__ << ":" << __LINE__ << ")";
- throw ConversionException(msg.str());
- }
- cur = xmlDocGetRootElement(doc);
- if (cur == NULL)
- {
- xmlFreeDoc(doc);
- stringstream msg;
- msg << "Problem in conversion: empty XML Document";
- msg << " (" << __FILE__ << ":" << __LINE__ << ")";
- throw ConversionException(msg.str());
- }
- while (cur != NULL)
- {
- if ((!xmlStrcmp(cur->name, (const xmlChar *)"value")))
- {
- ob=convertXmlCpp(edGetType(),doc,cur);
- break;
- }
- cur = cur->next;
- }
- xmlFreeDoc(doc);
+ doc = xmlParseMemory(data, strlen(data));
+ if (doc == NULL )
+ {
+ stringstream msg;
+ msg << "Problem in conversion: XML Document not parsed successfully ";
+ msg << " (" << __FILE__ << ":" << __LINE__ << ")";
+ throw ConversionException(msg.str());
+ }
+ cur = xmlDocGetRootElement(doc);
+ if (cur == NULL)
+ {
+ xmlFreeDoc(doc);
+ stringstream msg;
+ msg << "Problem in conversion: empty XML Document";
+ msg << " (" << __FILE__ << ":" << __LINE__ << ")";
+ throw ConversionException(msg.str());
+ }
+ while (cur != NULL)
+ {
+ if ((!xmlStrcmp(cur->name, (const xmlChar *)"value")))
+ {
+ ob=convertXmlCpp(edGetType(),doc,cur);
+ break;
+ }
+ cur = cur->next;
+ }
+ xmlFreeDoc(doc);
if(ob==NULL)
{
stringstream msg;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef XMLCPPCONV_HXX_
#define XMLCPPCONV_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "TypeConversions.hxx"
#include "XMLNeutralConv.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __XMLNEUTRALCONV_HXX__
#define __XMLNEUTRALCONV_HXX__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "XMLNode.hxx"
#include "XMLPorts.hxx"
#include "Mutex.hxx"
+#include "TypeCode.hxx"
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <sys/types.h>
#include <sys/stat.h>
+#ifdef WNT
+#include <windows.h>
+#include <io.h>
+#define chmod _chmod
+#endif
+
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
char dir[]="yacsXXXXXX";
// add a lock around mkdtemp (seems not thread safe)
MUTEX.lock();
+#ifdef WNT
+ char mdir [512+1];
+ GetTempPath(MAX_PATH+1, mdir);
+ CreateDirectory(mdir, NULL);
+#else
char* mdir=mkdtemp(dir);
+#endif
MUTEX.unlock();
if(mdir==NULL)
{
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _XMLNODE_HXX_
#define _XMLNODE_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "XMLPorts.hxx"
#include <iostream>
return _data.c_str();
}
-void *InputXmlPort::get() const throw(Exception)
+void *InputXmlPort::get() const throw(YACS::Exception)
{
return (void *) _data.c_str();
}
{
}
-OutputXmlPort::OutputXmlPort(const OutputXmlPort& other, Node *newHelder):OutputPort(other,newHelder),DataPort(other,newHelder),Port(other,newHelder)
+OutputXmlPort::OutputXmlPort(const OutputXmlPort& other, Node *newHelder):OutputPort(other,newHelder),DataPort(other,newHelder),
+ Port(other,newHelder),_data(other._data)
{
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _XMLPORTS_HXX_
#define _XMLPORTS_HXX_
+#include "YACSRuntimeSALOMEExport.hxx"
#include "InputPort.hxx"
#include "OutputPort.hxx"
*
* \see XmlNode
*/
- class InputXmlPort : public InputPort
+ class YACSRUNTIMESALOME_EXPORT InputXmlPort : public InputPort
{
public:
InputXmlPort(const std::string& name, Node* node, TypeCode * type);
*
* \see XmlNode
*/
- class OutputXmlPort : public OutputPort
+ class YACSRUNTIMESALOME_EXPORT OutputXmlPort : public OutputPort
{
public:
OutputXmlPort(const std::string& name, Node* node, TypeCode * type);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "XMLPythonConv.hxx"
#include "TypeConversions.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __XMLPYTHONCONV_HXX__
#define __XMLPYTHONCONV_HXX__
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _YACSRUNTIMESALOMEEXPORT_HXX_
+#define _YACSRUNTIMESALOMEEXPORT_HXX_
+
+#ifdef WNT
+# if defined YACSRuntimeSALOME_EXPORTS
+# define YACSRUNTIMESALOME_EXPORT __declspec( dllexport )
+# else
+# define YACSRUNTIMESALOME_EXPORT __declspec( dllimport )
+# endif
+#else
+# define YACSRUNTIMESALOME_EXPORT
+#endif
+
+#endif
--- /dev/null
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+include $(top_srcdir)/adm/unix/make_begin.am
+
+salomepython_PYTHON = SALOMERuntime.py
+salomepyexec_LTLIBRARIES = _SALOMERuntime.la
+
+BUILT_SOURCES = \
+ SALOMERuntimeWRAP.cxx
+
+_SALOMERuntime_la_SOURCES = \
+ $(BUILT_SOURCES)
+
+MYSWIG_FLAGS = -noexcept -DYACS_PTHREAD -I$(srcdir)/../bases -I$(srcdir)/../engine -I$(srcdir)/../runtime \
+ -I$(srcdir)/../engine_swig -I../engine_swig
+
+if DOXYGEN_IS_OK
+MYSWIG_FLAGS += -DDOXYGEN_IS_OK
+endif
+
+RUNTIMEINCLUDES= RuntimeSALOME.hxx SALOMEDispatcher.hxx SalomeProc.hxx PythonNode.hxx PythonPorts.hxx \
+ CORBANode.hxx CORBAPorts.hxx TypeConversions.hxx SalomeOptimizerLoop.hxx
+
+SWIGINCLUDES = $(RUNTIMEINCLUDES:%=$(top_srcdir)/src/runtime/%)
+
+SALOMERuntimeWRAP.cxx: SALOMERuntime.i $(SWIGINCLUDES) docruntime.i ../engine_swig/pilot.i ../engine_swig/engtypemaps.i
+ $(SWIG) $(SWIG_PYTHON_OPT) $(SWIG_PYTHON_INCLUDES) $(MYSWIG_FLAGS) -o $@ $(srcdir)/SALOMERuntime.i
+
+SALOMERuntime.py : SALOMERuntimeWRAP.cxx
+
+_SALOMERuntime_la_CXXFLAGS = \
+ $(THREAD_DEF) \
+ $(PYTHON_CPPFLAGS) \
+ $(OMNIORB_INCLUDES) \
+ $(OMNIORB_CXXFLAGS) \
+ -I$(KERNEL_ROOT_DIR)/include/salome \
+ -I$(srcdir)/../bases \
+ -I$(srcdir)/../engine \
+ -I$(srcdir)/../runtime \
+ -I../../idl \
+ $(LIBXML_INCLUDES)
+
+_SALOMERuntime_la_LDFLAGS = -module
+
+_SALOMERuntime_la_LIBADD = ../runtime/libYACSRuntimeSALOME.la
+
+docruntime.i:$(SWIGINCLUDES)
+ DOXSRCDIR=$(top_srcdir)/src/runtime doxygen $(top_srcdir)/Misc/Doxyfile
+ $(PYTHON) $(top_srcdir)/Misc/doxy2swig.py -n xml/index.xml docruntime.i
+
+EXTRA_DIST = SALOMERuntime.i
+
+clean-local:
+ rm -f SALOMERuntime.py* SALOMERuntimeWRAP.cxx docruntime.i SALOMERuntimeWRAP.h
+ rm -rf xml
+
+include $(top_srcdir)/adm/unix/make_end.am
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// ----------------------------------------------------------------------------
+//
+%define SALOMEDOCSTRING
+"Implementation of nodes for SALOME platform."
+%enddef
+
+%module(directors="1",docstring=SALOMEDOCSTRING) SALOMERuntime
+
+//work around SWIG bug #1863647
+#if SWIG_VERSION >= 0x010336
+#define SwigPyIterator SALOMERuntime_PySwigIterator
+#else
+#define PySwigIterator SALOMERuntime_PySwigIterator
+#endif
+
+%feature("autodoc", "1");
+
+%include engtypemaps.i
+
+#ifdef DOXYGEN_IS_OK
+%include docruntime.i
+#endif
+
+// ----------------------------------------------------------------------------
+
+%{
+#include "SalomeContainer.hxx"
+#include "RuntimeSALOME.hxx"
+#include "SALOMEDispatcher.hxx"
+#include "SalomeProc.hxx"
+#include "PythonNode.hxx"
+#include "PythonPorts.hxx"
+#include "PresetNode.hxx"
+#include "PresetPorts.hxx"
+#include "CORBANode.hxx"
+#include "CORBAPorts.hxx"
+#include "StudyNodes.hxx"
+#include "StudyPorts.hxx"
+#include "TypeConversions.hxx"
+#include "TypeCode.hxx"
+#include "VisitorSaveSalomeSchema.hxx"
+#include "SalomeOptimizerLoop.hxx"
+#include "DistributedPythonNode.hxx"
+#include "PyOptimizerAlg.hxx"
+#include "PyStdout.hxx"
+#include <sstream>
+%}
+
+// ----------------------------------------------------------------------------
+
+%init
+%{
+ // init section
+
+ PyObject* omnipy = PyImport_ImportModule((char*)"_omnipy");
+ if (!omnipy)
+ {
+ PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy");
+ return;
+ }
+ PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
+ api = (omniORBPYAPI*)PyCObject_AsVoidPtr(pyapi);
+ Py_DECREF(pyapi);
+%}
+
+// ----------------------------------------------------------------------------
+
+#ifdef SWIGPYTHON
+%typemap(out) YACS_ORB::Observer_ptr
+{
+ $result = api->cxxObjRefToPyObjRef($1, 1);
+}
+
+%typemap(in) YACS_ORB::Observer_ptr
+{
+ try
+ {
+ CORBA::Object_ptr obj = api->pyObjRefToCxxObjRef($input,1);
+ $1 = YACS_ORB::Observer::_narrow(obj);
+ }
+ catch (...)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "not a valid CORBA object ptr");
+ return NULL;
+ }
+}
+
+%typemap(out) YACS::ENGINE::PyObj * "Py_INCREF($1); $result = $1;";
+
+#endif
+
+// ----------------------------------------------------------------------------
+
+%import "pilot.i"
+
+%rename(getSALOMERuntime) YACS::ENGINE::getSALOMERuntime; // to suppress a 503 warning
+%ignore omniORBpyAPI;
+
+%include <YACSRuntimeSALOMEExport.hxx>
+%include "SalomeContainer.hxx"
+%include "RuntimeSALOME.hxx"
+%include "SALOMEDispatcher.hxx"
+%include "SalomeProc.hxx"
+%include "PythonNode.hxx"
+%include "PythonPorts.hxx"
+%include "XMLPorts.hxx"
+%include "PresetNode.hxx"
+%include "PresetPorts.hxx"
+%include "CORBANode.hxx"
+%include "CORBAPorts.hxx"
+%include "StudyNodes.hxx"
+%include "StudyPorts.hxx"
+%include "SalomeOptimizerLoop.hxx"
+%include "DistributedPythonNode.hxx"
+
+%extend YACS::ENGINE::OutputPresetPort
+{
+ void setDataPy(PyObject *ob)
+ {
+ std::string sss = convertPyObjectXml(self->edGetType(),ob);
+ self->setData(sss);
+ }
+}
+
+
+// Define the methods that can (default) or cannot (nodirector) be overloaded in Python
+%feature("director") YACS::ENGINE::PyOptimizerAlgBase;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgBase::getTCForInProxy;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgBase::getTCForOutProxy;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgBase::initializeProxy;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgBase::startProxy;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgBase::takeDecisionProxy;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgBase::finishProxy;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgBase::hasError;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgBase::getError;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgBase::setError;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgBase::getTCForAlgoInitProxy;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgBase::getTCForAlgoResultProxy;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgBase::getAlgoResultProxy;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgBase::setProc;
+
+%feature("director") YACS::ENGINE::PyOptimizerAlgASync;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgASync::getTCForInProxy;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgASync::getTCForOutProxy;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgASync::initializeProxy;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgASync::startProxy;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgASync::takeDecisionProxy;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgASync::finishProxy;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgASync::hasError;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgASync::getError;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgASync::setError;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgASync::signalMasterAndWait;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgASync::signalSlaveAndWait;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgASync::start;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgASync::takeDecision;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgASync::run;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgASync::getTCForAlgoInitProxy;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgASync::getTCForAlgoResultProxy;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgASync::getAlgoResultProxy;
+%feature("nodirector") YACS::ENGINE::PyOptimizerAlgASync::setProc;
+
+%feature("director:except") {
+ if ($error != NULL) {
+ std::string errorMessage;
+ PyObject* new_stderr = YACS::ENGINE::newPyStdOut(errorMessage);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ PyErr_Print();
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ Py_DECREF(new_stderr);
+ throw YACS::Exception(errorMessage);
+ }
+}
+
+// Warning: as PyOptimizerAlgSync is only a typedef in PyOptimizerAlg.hxx, we have to
+// directly rename PyOptimizerAlgBase in OptimizerAlgSync. If someday PyOptimizerAlgSync
+// becomes a real derived class, this will have to be changed.
+%rename(OptimizerAlgSync) YACS::ENGINE::PyOptimizerAlgBase;
+%rename(OptimizerAlgASync) YACS::ENGINE::PyOptimizerAlgASync;
+%include "PyOptimizerAlg.hxx"
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm/unix/make_begin.am
# header files
salomeinclude_HEADERS = \
+ YACSExport.hxx \
Yacsgui.hxx
# Libraries targets
lib_LTLIBRARIES = libYACS.la
dist_libYACS_la_SOURCES = \
- Yacsgui.cxx \
- Yacsgui_DataModel.cxx
+ Yacsgui.cxx \
+ Yacsgui_DataModel.hxx \
+ Yacsgui_Resource.cxx \
+ Yacsgui_Resource.hxx \
+ Yacsgui_DataModel.cxx
# MOC pre-processing
MOC_FILES = \
- Yacsgui_moc.cxx
+ Yacsgui_moc.cxx
nodist_libYACS_la_SOURCES = $(MOC_FILES)
libYACS_la_CXXFLAGS = \
$(THREAD_DEF) \
$(PYTHON_CPPFLAGS) \
+ $(OMNIORB_CXXFLAGS) \
$(OMNIORB_INCLUDES) \
$(LIBXML_INCLUDES) \
$(BOOST_CPPFLAGS) \
-I$(srcdir)/../hmi \
-I$(srcdir)/../salomewrap \
-I$(srcdir)/../genericgui \
+ -I../genericgui \
+ -I../../idl \
$(qt4_cppflags) \
$(qsci4_cppflags) \
@GRAPHVIZ_CPPFLAGS@
libYACS_la_LIBADD = \
../genericgui/libGenericGui.la \
+ -lEvent \
$(qt4_libs) $(qsci4_libs) \
- -lSalomeApp
+ -lSalomeApp -lSalomeSession
# resources files
-LIBICONS = \
- SalomeApp.xml \
- YACSCatalog.xml \
- ModuleYacs.png \
- ExecYACS.png
+ICONS = \
+ resources/YACSSchemaCatalog.xml \
+ resources/YACSCatalog.xml \
+ resources/ModuleYacs.png \
+ resources/ExecYACS.png
-QMFILES =
+# resources files
+nodist_salomeres_DATA = \
+ YACS_msg_en.qm \
+ YACS_msg_fr.qm \
+ resources/SalomeApp.xml
-# \
-# YACS_msg_en.qm \
-# YACS_msg_fr.qm \
-# YACS_icons.qm
+QMFILES = \
+ resources/YACS_msg_en.ts \
+ resources/YACS_msg_fr.ts
dist_salomeres_DATA = $(QMFILES) ${ICONS}
-ICONS = $(LIBICONS:%=resources/%)
-
ui_%.h: %.ui
$(QT_UIC) $< -o $@
rm -f *_moc.cxx *_qrc.cxx
-clean-local: clean-local-qt
\ No newline at end of file
+clean-local: clean-local-qt
+ rm -f YACS_msg_en.qm YACS_msg_fr.qm
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _YACSEXPORT_HXX_
+#define _YACSEXPORT_HXX_
+
+#ifdef WNT
+# if defined YACS_EXPORTS
+# define YACS_EXPORT __declspec( dllexport )
+# else
+# define YACS_EXPORT __declspec( dllimport )
+# endif
+#else
+# define YACS_EXPORT
+#endif
+
+#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
+#include <Python.h>
+#include "YACSExport.hxx"
#include "Yacsgui.hxx"
#include "Yacsgui_DataModel.hxx"
+#include "Yacsgui_Resource.hxx"
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_ViewManager.h>
#include <SUIT_ViewWindow.h>
#include <SalomeApp_Application.h>
+#include <SalomeApp_Engine_i.hxx>
#include <QxScene_ViewManager.h>
#include <QxScene_ViewModel.h>
#include <QxScene_ViewWindow.h>
#include <cassert>
#include "GenericGui.hxx"
+#include "CatalogWidget.hxx"
+#include "Resource.hxx"
+#include "QtGuiContext.hxx"
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
using namespace std;
using namespace YACS::HMI;
+int Yacsgui::_oldStudyId = -1;
+
Yacsgui::Yacsgui() :
- SalomeWrap_Module( "YACS" ) // default name
+ SalomeWrap_Module( "YACS" ), // default name
+ LightApp_Module( "YACS" )
{
+ DEBTRACE("Yacsgui::Yacsgui");
_wrapper = 0;
_genericGui = 0;
_selectFromTree = false;
+ _studyContextMap.clear();
+}
+
+Yacsgui::~Yacsgui()
+{
+ if ( getApp() )
+ disconnect( getApp(), SIGNAL(studyClosed()), this, SLOT (onCleanOnExit()));
+ delete _wrapper;
+ delete _genericGui;
}
void Yacsgui::initialize( CAM_Application* app )
{
DEBTRACE("Yacsgui::initialize");
+ _currentSVW = 0;
SalomeApp_Module::initialize( app );
QWidget* aParent = application()->desktop();
DEBTRACE(app << " " << application() << " " << application()->desktop() << " " << aParent);
SUIT_ResourceMgr* aResourceMgr = app->resourceMgr();
+ setResource(aResourceMgr);
+
_wrapper = new SuitWrapper(this);
_genericGui = new GenericGui(_wrapper, app->desktop());
connect( getApp(),
SIGNAL(studyClosed()),
- _genericGui,
+ this,
SLOT (onCleanOnExit()));
}
_genericGui->createActions();
_genericGui->createMenus();
_genericGui->createTools();
+ this->studyActivated();
if (createSComponent()) updateObjBrowser();
+
+ // Load SALOME module catalogs
+ QStringList appModules;
+ app->modules(appModules,false);
+ for ( QStringList::const_iterator it = appModules.begin(); it != appModules.end(); ++it )
+ {
+ QString aModule=*it;
+ QString modName = app->moduleName( aModule ); // module name
+ if ( modName.isEmpty() ) modName = aModule;
+ QString rootDir = QString( "%1_ROOT_DIR" ).arg( modName ); // module root dir variable
+ QString modDir = getenv( rootDir.toLatin1().constData() ); // module root dir
+ if ( !modDir.isEmpty() )
+ {
+ QStringList cataLst = QStringList() << modDir << "share" << "salome" << "resources" << modName.toLower() << modName+"SchemaCatalog.xml";
+ QString cataFile = cataLst.join( QDir::separator() ); // YACS module catalog
+ if ( QFile::exists( cataFile ) )
+ _genericGui->getCatalogWidget()->addCatalogFromFile(cataFile.toStdString());
+ }
+ }
}
void Yacsgui::viewManagers( QStringList& list ) const
DEBTRACE("Yacsgui::activateModule");
bool bOk = SalomeApp_Module::activateModule( theStudy );
+ QMainWindow* parent = application()->desktop();
+ if(Resource::dockWidgetPriority)
+ {
+ parent->setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
+ parent->setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
+ parent->setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
+ parent->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
+ }
setMenuShown( true );
setToolShown( true );
_genericGui->showDockWidgets(true);
+ // import Python module that manages YACS plugins (need to be here because SalomePyQt API uses active module)
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject* pluginsmanager=PyImport_ImportModule((char*)"salome_pluginsmanager");
+ if(pluginsmanager==NULL)
+ PyErr_Print();
+ else
+ {
+ PyObject* result=PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"yacs","YACS",tr("YACS_PLUGINS").toStdString().c_str());
+ if(result==NULL)
+ PyErr_Print();
+ Py_XDECREF(result);
+ }
+ PyGILState_Release(gstate);
+ // end of YACS plugins loading
+
+ if (_currentSVW)
+ onWindowActivated(_currentSVW);
+
return bOk;
}
{
DEBTRACE("Yacsgui::deactivateModule");
+ QMainWindow* parent = application()->desktop();
+ parent->setCorner(Qt::TopLeftCorner, Qt::TopDockWidgetArea);
+ parent->setCorner(Qt::BottomLeftCorner, Qt::BottomDockWidgetArea);
+ parent->setCorner(Qt::TopRightCorner, Qt::TopDockWidgetArea);
+ parent->setCorner(Qt::BottomRightCorner, Qt::BottomDockWidgetArea);
+
setMenuShown( false );
setToolShown( false );
_genericGui->showDockWidgets(false);
-
- SUIT_ViewManager *svm = getApp()->getViewManager(QxScene_Viewer::Type(), true);
- assert(svm);
- SUIT_ViewWindow* svw = svm->getActiveView();
- QxScene_ViewWindow *aView = 0;
- if (svw) aView = dynamic_cast<QxScene_ViewWindow*>(svw);
- DEBTRACE("aView " << aView);
-
+ QtGuiContext *context = QtGuiContext::getQtCurrent();
+ _studyContextMap[theStudy->id()] = context;
+ DEBTRACE("_studyContextMap[theStudy] " << theStudy << " " << context);
return SalomeApp_Module::deactivateModule( theStudy );
}
QString Yacsgui::engineIOR() const
{
DEBTRACE("Yacsgui::engineIOR");
- return getApp()->defaultEngineIOR();
+ QString anEngineIOR = SalomeApp_Engine_i::EngineIORForComponent( "YACS", true ).c_str();
+ return anEngineIOR;
}
void Yacsgui::onDblClick(const QModelIndex& index)
if (!_genericGui) return;
if (!viewWindow) return;
DEBTRACE("--- " << viewWindow << " " << item->entry().toStdString());
+ if (getApp()->activeModule()->moduleName().compare("YACS") != 0)
+ getApp()->activateModule("YACS");
_selectFromTree = true;
viewWindow->setFocus();
{
DEBTRACE("Yacsgui::onWindowActivated");
QxScene_ViewWindow* viewWindow = dynamic_cast<QxScene_ViewWindow*>(svw);
- if (!viewWindow) return;
+ _currentSVW = svw;
+ if (!viewWindow)
+ {
+ _currentSVW = 0; // switch to another module
+ return;
+ }
DEBTRACE("viewWindow " << viewWindow);
- DEBTRACE("activeModule()->moduleName() " << getApp()->activeModule()->moduleName().toStdString());
- if (getApp()->activeModule()->moduleName().compare("YACS") != 0)
- getApp()->activateModule("YACS");
-
- assert(_genericGui);
+ DEBTRACE("activeModule()->moduleName() " << (getApp()->activeModule() ? getApp()->activeModule()->moduleName().toStdString() : "") );
+ if (!getApp()->activeModule() || getApp()->activeModule()->moduleName() != "YACS")
+ if ( !getApp()->activateModule("YACS") ) return;
+
+ disconnect(viewWindow, SIGNAL( tryClose( bool&, QxScene_ViewWindow* ) ),
+ this, SLOT(onTryClose( bool&, QxScene_ViewWindow* )) );
+ disconnect(viewWindow->getViewManager(), SIGNAL( deleteView( SUIT_ViewWindow* ) ),
+ this, SLOT(onWindowClosed( SUIT_ViewWindow* )) );
+ connect(viewWindow, SIGNAL( tryClose( bool&, QxScene_ViewWindow* ) ),
+ this, SLOT(onTryClose( bool&, QxScene_ViewWindow* )) );
+ connect(viewWindow->getViewManager(), SIGNAL( deleteView( SUIT_ViewWindow* ) ),
+ this, SLOT(onWindowClosed( SUIT_ViewWindow* )) );
+
+ YASSERT(_genericGui);
_genericGui->switchContext(viewWindow);
-
+ _studyContextMap[getApp()->activeStudy()->id()] = QtGuiContext::getQtCurrent();
+
if (_selectFromTree) return;
SalomeWrap_DataModel *model = dynamic_cast<SalomeWrap_DataModel*>(dataModel());
if (!model) return;
void Yacsgui::onWindowClosed( SUIT_ViewWindow* svw)
{
DEBTRACE("Yacsgui::onWindowClosed");
+ if ( svw && svw == _currentSVW )
+ _currentSVW = 0;
+}
+
+void Yacsgui::onTryClose(bool &isClosed, QxScene_ViewWindow* window)
+{
+ DEBTRACE("Yacsgui::onTryClose");
+ YASSERT(_genericGui);
+ isClosed = _genericGui->closeContext(window);
}
CAM_DataModel* Yacsgui::createDataModel()
anAttr = aBuilder->FindOrCreateAttribute(aComponent, "AttributePixMap");
_PTR(AttributePixMap) aPixmap(anAttr);
- aPixmap->SetPixMap("share/salome/resources/yacs/ModuleYacs.png");
+ aPixmap->SetPixMap("ModuleYacs.png");
- aBuilder->DefineComponentInstance(aComponent, getApp()->defaultEngineIOR().toStdString());
+ aBuilder->DefineComponentInstance(aComponent, engineIOR().toLatin1().constData());
return true;
}
return false;
}
+void Yacsgui::setResource(SUIT_ResourceMgr* r)
+{
+ DEBTRACE("Yacsgui::setResource");
+ _myresource = new Yacsgui_Resource(r);
+ _myresource->preferencesChanged();
+}
+
+void Yacsgui::createPreferences()
+{
+ DEBTRACE("Yacsgui::createPreferences");
+ _myresource->createPreferences(this);
+}
+
+void Yacsgui::preferencesChanged( const QString& sect, const QString& name )
+{
+ DEBTRACE("Yacsgui::preferencesChanged");
+ _myresource->preferencesChanged(sect, name);
+ if(name=="userCatalog")
+ {
+ _genericGui->getCatalogWidget()->addCatalogFromFile(Resource::userCatalog.toStdString());
+ }
+}
+
+void Yacsgui::studyActivated()
+{
+ int newStudyId = getApp()->activeStudy()->id();
+ DEBTRACE("Yacsgui::studyActivated " << _oldStudyId << " " << newStudyId);
+
+ if (_oldStudyId != -1)
+ {
+ _studyContextMap[_oldStudyId] = QtGuiContext::getQtCurrent();
+ if (_studyContextMap.count(newStudyId))
+ {
+ DEBTRACE("switch to valid context " << QtGuiContext::getQtCurrent() << " " << _studyContextMap[newStudyId]);
+ QtGuiContext::setQtCurrent(_studyContextMap[newStudyId]);
+ }
+ else
+ {
+ DEBTRACE("no switch to null context");
+ }
+ }
+ _oldStudyId = newStudyId;
+}
+
+void Yacsgui::loadSchema(const std::string& filename,bool edit, bool arrangeLocalNodes)
+{
+ _genericGui->loadSchema(filename,edit,arrangeLocalNodes);
+}
+
+void Yacsgui::onCleanOnExit()
+{
+ if ( _genericGui )
+ _genericGui->onCleanOnExit();
+ _currentSVW = 0;
+}
+
// --- Export the module
extern "C"
{
- CAM_Module* createModule()
+ YACS_EXPORT CAM_Module* createModule()
{
return new Yacsgui();
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _YACSGUI_HXX_
#define _YACSGUI_HXX_
#include "SalomeWrap_Module.hxx"
+#include "Yacsgui_Resource.hxx"
#include <SALOMEconfig.h>
#include <QModelIndex>
+#include <map>
namespace YACS
{
{
class GenericGui;
class SuitWrapper;
+ class QtGuiContext;
}
}
{
Q_OBJECT
+ friend class Yacsgui_Resource;
+
public:
Yacsgui();
+ virtual ~Yacsgui();
void initialize( CAM_Application* app);
void windows( QMap<int, int>& theMap) const;
virtual QString engineIOR() const;
virtual void viewManagers( QStringList& list) const;
-
+ virtual void setResource(SUIT_ResourceMgr* r);
+ virtual void createPreferences();
+ virtual void preferencesChanged( const QString& sect, const QString& name );
+ virtual void loadSchema(const std::string& filename,bool edit=true, bool arrangeLocalNodes=false);
+ virtual void studyActivated();
+
public slots:
bool deactivateModule( SUIT_Study* theStudy);
bool activateModule( SUIT_Study* theStudy);
void onDblClick(const QModelIndex& index);
-
+ void onCleanOnExit();
+
protected slots:
void onWindowActivated( SUIT_ViewWindow* svw);
void onWindowClosed( SUIT_ViewWindow* svw);
+ void onTryClose(bool &isClosed, QxScene_ViewWindow* window);
protected:
virtual CAM_DataModel* createDataModel();
YACS::HMI::SuitWrapper* _wrapper;
YACS::HMI::GenericGui* _genericGui;
bool _selectFromTree;
+ Yacsgui_Resource* _myresource;
+ SUIT_ViewWindow* _currentSVW;
+ std::map<int, YACS::HMI::QtGuiContext*> _studyContextMap;
+ static int _oldStudyId;
};
#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Yacsgui_DataModel.hxx"
//#define _DEVDEBUG_
bool Yacsgui_DataModel::open(const QString& fileName, CAM_Study* study, QStringList listOfFiles)
{
DEBTRACE("Yacsgui_DataModel::open");
- SalomeWrap_DataModel::open(fileName, study, listOfFiles);
+ return SalomeWrap_DataModel::open(fileName, study, listOfFiles);
}
bool Yacsgui_DataModel::save(QStringList& listOfFiles)
{
DEBTRACE("Yacsgui_DataModel::save");
- SalomeWrap_DataModel::save(listOfFiles);
+ return SalomeWrap_DataModel::save(listOfFiles);
}
bool Yacsgui_DataModel::saveAs(const QString& fileName, CAM_Study* study, QStringList& listOfFiles)
{
DEBTRACE("Yacsgui_DataModel::saveAs");
- SalomeWrap_DataModel::saveAs(fileName, study, listOfFiles);
+ return SalomeWrap_DataModel::saveAs(fileName, study, listOfFiles);
}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _YACSGUI_DATAMODEL_HXX_
#define _YACSGUI_DATAMODEL_HXX_
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "Yacsgui_Resource.hxx"
+#include "Resource.hxx"
+#include "Yacsgui.hxx"
+#include <SUIT_ResourceMgr.h>
+
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
+#define RESOURCE_YACS "YACS"
+
+using namespace YACS::HMI;
+
+Yacsgui_Resource::Yacsgui_Resource(SUIT_ResourceMgr* r)
+{
+ DEBTRACE("Yacsgui_Resource::Yacsgui_Resource");
+ _resource = r;
+}
+
+// Get resources
+// -------------
+
+int Yacsgui_Resource::integerValue(const QString& name, const int def) const {
+ return _resource->integerValue(RESOURCE_YACS, name, def);
+}
+
+double Yacsgui_Resource::doubleValue(const QString& name, const double def) const {
+ return _resource->doubleValue(RESOURCE_YACS, name, def);
+}
+
+bool Yacsgui_Resource::booleanValue(const QString& name, const bool def) const {
+ return _resource->booleanValue(RESOURCE_YACS, name, def);
+}
+
+QFont Yacsgui_Resource::fontValue(const QString& name, const QFont def) const {
+ return _resource->fontValue(RESOURCE_YACS, name, def);
+}
+
+QColor Yacsgui_Resource::colorValue(const QString& name, const QColor def) const {
+ return _resource->colorValue(RESOURCE_YACS, name, def);
+}
+
+QColor Yacsgui_Resource::colorValue(const QString& name, const Qt::GlobalColor c) const {
+ QColor col(c);
+ return colorValue(name, col);
+}
+
+QColor Yacsgui_Resource::colorValue(const QString& name, const int h, const int s, const int v) const {
+ QColor col;
+ col.setHsv(h, s, v);
+ return colorValue(name, col);
+}
+
+QString Yacsgui_Resource::stringValue(const QString& name, const QString def) const {
+ return _resource->stringValue(RESOURCE_YACS, name, def);
+}
+
+// Set resources
+// -------------
+
+void Yacsgui_Resource::setValue( const QString& name, const int val ) {
+ _resource->setValue(RESOURCE_YACS, name, val);
+}
+
+void Yacsgui_Resource::setValue( const QString& name, const double val ) {
+ _resource->setValue(RESOURCE_YACS, name, val);
+}
+
+void Yacsgui_Resource::setValue( const QString& name, const bool val ) {
+ _resource->setValue(RESOURCE_YACS, name, val);
+}
+
+void Yacsgui_Resource::setValue( const QString& name, const QFont val ) {
+ _resource->setValue(RESOURCE_YACS, name, val);
+}
+
+void Yacsgui_Resource::setValue( const QString& name, const QColor val ) {
+ _resource->setValue(RESOURCE_YACS, name, val);
+}
+
+void Yacsgui_Resource::setValue( const QString& name, const QString val ) {
+ _resource->setValue(RESOURCE_YACS, name, val);
+}
+
+// Create preferences
+// ------------------
+
+void Yacsgui_Resource::createPreferences(Yacsgui* swm)
+{
+ DEBTRACE("createPreferences");
+ // --- General tab ---
+ int genTab = swm->addPreference( Yacsgui::tr( "PREF_TAB_GENERAL" ) );
+
+ int presentationGroup = swm->addPreference( "Presentation", genTab );
+ swm->setPreferenceProperty(presentationGroup , "columns", 2);
+
+ swm->addPreference( "Auto Compute Links", presentationGroup, LightApp_Preferences::Bool, RESOURCE_YACS, "autoComputeLinks" );
+ swm->addPreference( "Simplify Links", presentationGroup, LightApp_Preferences::Bool, RESOURCE_YACS, "simplifyLink" );
+ swm->addPreference( "Better Separation for Links", presentationGroup, LightApp_Preferences::Bool, RESOURCE_YACS, "addRowCols" );
+ swm->addPreference( "Ensure Node Visible When Moved", presentationGroup, LightApp_Preferences::Bool, RESOURCE_YACS, "ensureVisibleWhenMoved" );
+ swm->addPreference( "Tabified Panels Up", presentationGroup, LightApp_Preferences::Bool, RESOURCE_YACS, "tabPanelsUp" );
+ int priority = swm->addPreference( "DockWidget priority", presentationGroup, LightApp_Preferences::Selector, RESOURCE_YACS, "dockWidgetPriority" );
+
+ QStringList priorityList;
+ priorityList.append( "Horizontal" );
+ priorityList.append( "Vertical" );
+
+ QList<QVariant> indexesList;
+ indexesList.append(0);
+ indexesList.append(1);
+
+ swm->setPreferenceProperty( priority, "strings", priorityList );
+ swm->setPreferenceProperty( priority, "indexes", indexesList );
+
+ int pythonGroup = swm->addPreference( "Python", genTab );
+
+ swm->addPreference( "Python Script Font", pythonGroup, LightApp_Preferences::Font, RESOURCE_YACS, "font" );
+ swm->addPreference( "Python External Editor", pythonGroup, LightApp_Preferences::String, RESOURCE_YACS, "pythonExternalEditor" );
+
+ int catalogGroup = swm->addPreference( "Catalogs", genTab );
+
+ swm->addPreference( "User catalog", catalogGroup, LightApp_Preferences::File, RESOURCE_YACS, "userCatalog" );
+
+ int componentGroup = swm->addPreference( Yacsgui::tr( "PREF_GROUP_COMPONENT" ), genTab );
+
+ swm->addPreference( Yacsgui::tr( _COMPONENT_INSTANCE_NEW ), componentGroup, LightApp_Preferences::Bool, RESOURCE_YACS, _COMPONENT_INSTANCE_NEW );
+
+ // Link colors tab
+ int linkTab = swm->addPreference( Yacsgui::tr( "Link colors" ) );
+
+ int idGroup = swm->addPreference( Yacsgui::tr( "PREF_GROUP_GENERAL" ), linkTab );
+ swm->setPreferenceProperty( idGroup, "columns", 1 );
+
+ swm->addPreference( Yacsgui::tr( "Link draw color" ), idGroup, LightApp_Preferences::Color, RESOURCE_YACS, "link_draw_color" );
+ swm->addPreference( Yacsgui::tr( "Link select color" ), idGroup, LightApp_Preferences::Color, RESOURCE_YACS, "link_select_color" );
+ swm->addPreference( Yacsgui::tr( "Stream link draw color" ), idGroup, LightApp_Preferences::Color, RESOURCE_YACS, "stream_link_draw_color" );
+ swm->addPreference( Yacsgui::tr( "Stream link select color" ), idGroup, LightApp_Preferences::Color, RESOURCE_YACS, "stream_link_select_color" );
+ swm->addPreference( Yacsgui::tr( "Control link draw color" ), idGroup, LightApp_Preferences::Color, RESOURCE_YACS, "control_link_draw_color" );
+ swm->addPreference( Yacsgui::tr( "Control link select color" ), idGroup, LightApp_Preferences::Color, RESOURCE_YACS, "control_link_select_color" );
+ swm->addPreference( Yacsgui::tr( "Emphasis link color" ), idGroup, LightApp_Preferences::Color, RESOURCE_YACS, "emphasizeBrushColor" );
+
+ swm->addPreference( Yacsgui::tr( "link pen darkness" ), idGroup, LightApp_Preferences::Integer, RESOURCE_YACS, "link_pen_darkness" );
+ swm->addPreference( Yacsgui::tr( "link thickness" ), idGroup, LightApp_Preferences::Double, RESOURCE_YACS, "link_thickness" );
+ swm->addPreference( Yacsgui::tr( "link separation weight" ), idGroup, LightApp_Preferences::Integer, RESOURCE_YACS, "link_separation_weight" );
+
+ // --- node colors tab ---
+ int nodeTab = swm->addPreference( Yacsgui::tr( "PREF_TAB_NODE" ) );
+
+ int nodeSubtab = swm->addPreference( Yacsgui::tr( "PREF_GROUP_SCENE" ), nodeTab );
+ swm->setPreferenceProperty(nodeSubtab , "columns", 2);
+
+ swm->addPreference( Yacsgui::tr( "Pen" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _Scene_pen );
+ swm->addPreference( Yacsgui::tr( "Brush" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _Scene_brush );
+ swm->addPreference( Yacsgui::tr( "High pen" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _Scene_hiPen );
+ swm->addPreference( Yacsgui::tr( "High brush" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _Scene_hiBrush );
+
+ nodeSubtab = swm->addPreference( Yacsgui::tr( "PREF_GROUP_BLOC" ), nodeTab );
+ swm->setPreferenceProperty(nodeSubtab , "columns", 2);
+
+ swm->addPreference( Yacsgui::tr( "Pen" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _ComposedNode_pen );
+ swm->addPreference( Yacsgui::tr( "Brush" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _ComposedNode_brush );
+ swm->addPreference( Yacsgui::tr( "High pen" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _ComposedNode_hiPen );
+ swm->addPreference( Yacsgui::tr( "High brush" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _ComposedNode_hiBrush );
+
+ nodeSubtab = swm->addPreference( Yacsgui::tr( "PREF_GROUP_NODE" ), nodeTab );
+ swm->setPreferenceProperty(nodeSubtab , "columns", 2);
+
+ swm->addPreference( Yacsgui::tr( "Pen" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _ElementaryNode_pen );
+ swm->addPreference( Yacsgui::tr( "Brush" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _ElementaryNode_brush );
+ swm->addPreference( Yacsgui::tr( "High pen" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _ElementaryNode_hiPen );
+ swm->addPreference( Yacsgui::tr( "High brush" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _ElementaryNode_hiBrush );
+
+ nodeSubtab = swm->addPreference( Yacsgui::tr( "PREF_GROUP_HEADER" ), nodeTab );
+ swm->setPreferenceProperty(nodeSubtab , "columns", 2);
+
+ swm->addPreference( Yacsgui::tr( "Pen" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _Header_pen );
+ swm->addPreference( Yacsgui::tr( "Brush" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _Header_brush );
+ swm->addPreference( Yacsgui::tr( "High pen" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _Header_hiPen );
+ swm->addPreference( Yacsgui::tr( "High brush" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _Header_hiBrush );
+
+ nodeSubtab = swm->addPreference( Yacsgui::tr( "PREF_GROUP_CONTROL" ), nodeTab );
+ swm->setPreferenceProperty(nodeSubtab , "columns", 2);
+
+ swm->addPreference( Yacsgui::tr( "Pen" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _CtrlPort_pen );
+ swm->addPreference( Yacsgui::tr( "Brush" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _CtrlPort_brush );
+ swm->addPreference( Yacsgui::tr( "High pen" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _CtrlPort_hiPen );
+ swm->addPreference( Yacsgui::tr( "High brush" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _CtrlPort_hiBrush );
+
+ nodeSubtab = swm->addPreference( Yacsgui::tr( "PREF_GROUP_PORT" ), nodeTab );
+ swm->setPreferenceProperty(nodeSubtab , "columns", 2);
+
+ swm->addPreference( Yacsgui::tr( "Pen" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _DataPort_pen );
+ swm->addPreference( Yacsgui::tr( "Brush" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _DataPort_brush );
+ swm->addPreference( Yacsgui::tr( "High pen" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _DataPort_hiPen );
+ swm->addPreference( Yacsgui::tr( "High brush" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _DataPort_hiBrush );
+
+ nodeSubtab = swm->addPreference( "Datastream port", nodeTab );
+ swm->setPreferenceProperty(nodeSubtab , "columns", 2);
+
+ swm->addPreference( Yacsgui::tr( "Pen" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _DataStreamPort_pen );
+ swm->addPreference( Yacsgui::tr( "Brush" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _DataStreamPort_brush );
+ swm->addPreference( Yacsgui::tr( "High pen" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _DataStreamPort_hiPen );
+ swm->addPreference( Yacsgui::tr( "High brush" ), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, _DataStreamPort_hiBrush );
+
+ nodeSubtab = swm->addPreference( Yacsgui::tr( "PREF_GROUP_DRAG" ), nodeTab );
+ swm->setPreferenceProperty(nodeSubtab, "columns", 1);
+
+ swm->addPreference( Yacsgui::tr( "On dragging"), nodeSubtab, LightApp_Preferences::Color, RESOURCE_YACS, __dragOver );
+
+ // --- Color of state of nodes tab ---
+ int stateTab = swm->addPreference( Yacsgui::tr( "PREF_TAB_STATE" ) );
+
+ int editGroup = swm->addPreference( Yacsgui::tr( "PREF_GROUP_EDIT" ), stateTab );
+ swm->setPreferenceProperty( editGroup, "columns", 1 );
+
+ swm->addPreference( Yacsgui::tr( _editedNodeBrushColor ), editGroup, LightApp_Preferences::Color, RESOURCE_YACS, _editedNodeBrushColor );
+ swm->addPreference( Yacsgui::tr( _normalNodeBrushColor ), editGroup, LightApp_Preferences::Color, RESOURCE_YACS, _normalNodeBrushColor );
+ swm->addPreference( Yacsgui::tr( _runNodeBrushColor ), editGroup, LightApp_Preferences::Color, RESOURCE_YACS, _runNodeBrushColor );
+ swm->addPreference( Yacsgui::tr( _validNodeColor ), editGroup, LightApp_Preferences::Color, RESOURCE_YACS, _validNodeColor );
+ swm->addPreference( Yacsgui::tr( _invalidNodeColor ), editGroup, LightApp_Preferences::Color, RESOURCE_YACS, _invalidNodeColor );
+
+ int runGroup = swm->addPreference( Yacsgui::tr( "PREF_GROUP_RUN" ), stateTab );
+ swm->setPreferenceProperty( runGroup, "columns", 2 );
+
+ swm->addPreference( Yacsgui::tr( _NOTYETINITIALIZED ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _NOTYETINITIALIZED );
+ swm->addPreference( Yacsgui::tr( _INITIALISED ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _INITIALISED );
+ swm->addPreference( Yacsgui::tr( _RUNNING ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _RUNNING );
+ swm->addPreference( Yacsgui::tr( _WAITINGTASKS ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _WAITINGTASKS );
+ swm->addPreference( Yacsgui::tr( _PAUSED ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _PAUSED );
+ swm->addPreference( Yacsgui::tr( _FINISHED ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _FINISHED );
+ swm->addPreference( Yacsgui::tr( _STOPPED ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _STOPPED );
+ swm->addPreference( Yacsgui::tr( _UNKNOWN ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _UNKNOWN );
+
+ swm->addPreference( Yacsgui::tr( _UNDEFINED ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _UNDEFINED );
+ swm->addPreference( Yacsgui::tr( _INVALID ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _INVALID );
+ swm->addPreference( Yacsgui::tr( _READY ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _READY );
+ swm->addPreference( Yacsgui::tr( _TOLOAD ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _TOLOAD );
+ swm->addPreference( Yacsgui::tr( _LOADED ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _LOADED );
+ swm->addPreference( Yacsgui::tr( _TOACTIVATE ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _TOACTIVATE );
+ swm->addPreference( Yacsgui::tr( _ACTIVATED ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _ACTIVATED );
+ swm->addPreference( Yacsgui::tr( _DESACTIVATED ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _DESACTIVATED );
+ swm->addPreference( Yacsgui::tr( _DONE ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _DONE );
+ swm->addPreference( Yacsgui::tr( _SUSPENDED ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _SUSPENDED );
+ swm->addPreference( Yacsgui::tr( _LOADFAILED ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _LOADFAILED );
+ swm->addPreference( Yacsgui::tr( _EXECFAILED ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _EXECFAILED );
+ swm->addPreference( Yacsgui::tr( _PAUSE ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _PAUSE );
+ swm->addPreference( Yacsgui::tr( _INTERNALERR ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _INTERNALERR );
+ swm->addPreference( Yacsgui::tr( _DISABLED ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _DISABLED );
+ swm->addPreference( Yacsgui::tr( _FAILED ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _FAILED );
+ swm->addPreference( Yacsgui::tr( _ERROR ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _ERROR );
+ swm->addPreference( Yacsgui::tr( _DEFAULT ), runGroup, LightApp_Preferences::Color, RESOURCE_YACS, _DEFAULT );
+}
+
+void Yacsgui_Resource::preferencesChanged()
+{
+ DEBTRACE("preferencesChanged");
+
+ // Notice: it is here for updating the view, etc.
+
+ // General resource
+ Resource::COMPONENT_INSTANCE_NEW = booleanValue(_COMPONENT_INSTANCE_NEW, COMPONENTINSTANCENEW);
+ Resource::pythonfont = fontValue( "font" ,PYTHONFONT);
+ Resource::pythonExternalEditor = stringValue( "pythonExternalEditor" ,PYTHONEXTERNALEDITOR);
+ Resource::userCatalog = stringValue( "userCatalog" ,USERCATALOG);
+ Resource::autoComputeLinks = booleanValue("autoComputeLinks", AUTOCOMPUTELINKS);
+ Resource::simplifyLink = booleanValue("simplifyLink", SIMPLIFYLINK);
+ Resource::addRowCols = booleanValue("addRowCols", ADDROWCOLS);
+ Resource::ensureVisibleWhenMoved = booleanValue("ensureVisibleWhenMoved", ENSUREVISIBLEWHENMOVED);
+ Resource::tabPanelsUp = booleanValue("tabPanelsUp", TABPANELSUP);
+ Resource::dockWidgetPriority = integerValue( "dockWidgetPriority" , DOCKWIDGETPRIORITY);
+
+ // Color of state of nodes
+ Resource::editedNodeBrushColor = colorValue(_editedNodeBrushColor, EDITEDNODEBRUSHCOLOR);
+ Resource::normalNodeBrushColor = colorValue(_normalNodeBrushColor, NORMALNODEBRUSHCOLOR);
+ Resource::runNodeBrushColor = colorValue(_runNodeBrushColor , RUNNODEBRUSHCOLOR);
+ Resource::validNodeColor = colorValue(_validNodeColor , VALIDNODECOLOR);
+ Resource::invalidNodeColor = colorValue(_invalidNodeColor , INVALIDNODECOLOR);
+
+ Resource::NOTYETINITIALIZED = colorValue(_NOTYETINITIALIZED , NOTYETINITIALIZED_);
+ Resource::INITIALISED = colorValue(_INITIALISED , INITIALISED_);
+ Resource::RUNNING = colorValue(_RUNNING , RUNNING_ );
+ Resource::WAITINGTASKS = colorValue(_WAITINGTASKS , WAITINGTASKS_);
+ Resource::PAUSED = colorValue(_PAUSED , PAUSED_ );
+ Resource::FINISHED = colorValue(_FINISHED , FINISHED_ );
+ Resource::STOPPED = colorValue(_STOPPED , STOPPED_ );
+ Resource::UNKNOWN = colorValue(_UNKNOWN , UNKNOWN_ );
+
+ Resource::UNDEFINED = colorValue(_UNDEFINED , UNDEFINED_ );
+ Resource::INVALID = colorValue(_INVALID , INVALID_ );
+ Resource::READY = colorValue(_READY , READY_ );
+ Resource::TOLOAD = colorValue(_TOLOAD , TOLOAD_ );
+ Resource::LOADED = colorValue(_LOADED , LOADED_ );
+ Resource::TOACTIVATE = colorValue(_TOACTIVATE , TOACTIVATE_ );
+ Resource::ACTIVATED = colorValue(_ACTIVATED , ACTIVATED_ );
+ Resource::DESACTIVATED = colorValue(_DESACTIVATED , DESACTIVATED_);
+ Resource::DONE = colorValue(_DONE , DONE_ );
+ Resource::SUSPENDED = colorValue(_SUSPENDED , SUSPENDED_ );
+ Resource::LOADFAILED = colorValue(_LOADFAILED , LOADFAILED_ );
+ Resource::EXECFAILED = colorValue(_EXECFAILED , EXECFAILED_ );
+ Resource::PAUSE = colorValue(_PAUSE , PAUSE_ );
+ Resource::INTERNALERR = colorValue(_INTERNALERR , INTERNALERR_ );
+ Resource::DISABLED = colorValue(_DISABLED , DISABLED_ );
+ Resource::FAILED = colorValue(_FAILED , FAILED_ );
+ Resource::ERROR = colorValue(_ERROR , ERROR_ );
+ Resource::DEFAULT = colorValue(_DEFAULT , DEFAULT_ );
+
+ // Color of links
+ Resource::link_draw_color = colorValue("link_draw_color" , LINKDRAW_COLOR );
+ Resource::stream_link_draw_color = colorValue("stream_link_draw_color" , STREAMLINKDRAW_COLOR );
+ Resource::link_select_color = colorValue("link_select_color" , LINK_SELECT_COLOR );
+ Resource::stream_link_select_color = colorValue("stream_link_select_color" , STREAMLINK_SELECT_COLOR);
+ Resource::control_link_draw_color = colorValue("control_link_draw_color" , CTRLLINKDRAW_COLOR );
+ Resource::control_link_select_color = colorValue("control_link_select_color", CTRLLINK_SELECT_COLOR );
+ Resource::emphasizeBrushColor = colorValue("emphasizeBrushColor" , EMPHASIZEBRUSHCOLOR );
+
+ Resource::link_pen_darkness = integerValue("link_pen_darkness", LINK_PEN_DARKNESS );
+ Resource::link_separation_weight = integerValue("link_separation_weight", LINK_SEPARATION_WEIGHT );
+ Resource::link_thickness = doubleValue("link_thickness", LINK_THICKNESS );
+
+ // Color of nodes
+ Resource::Scene_pen = colorValue(_Scene_pen, Scene_pen_ );
+ Resource::Scene_hiPen = colorValue(_Scene_hiPen, Scene_hiPen_ );
+ Resource::Scene_brush = colorValue(_Scene_brush, Scene_brush_ );
+ Resource::Scene_hiBrush = colorValue(_Scene_hiBrush, Scene_hiBrush_ );
+ Resource::ComposedNode_brush = colorValue(_ComposedNode_brush, ComposedNode_brush_ );
+ Resource::ComposedNode_hiBrush = colorValue(_ComposedNode_hiBrush, ComposedNode_hiBrush_ );
+ Resource::ComposedNode_pen = colorValue(_ComposedNode_pen, ComposedNode_pen_ );
+ Resource::ComposedNode_hiPen = colorValue(_ComposedNode_hiPen, ComposedNode_hiPen_ );
+ Resource::ElementaryNode_brush = colorValue(_ElementaryNode_brush, ElementaryNode_brush_ );
+ Resource::ElementaryNode_hiBrush = colorValue(_ElementaryNode_hiBrush, ElementaryNode_hiBrush_);
+ Resource::ElementaryNode_pen = colorValue(_ElementaryNode_pen, ElementaryNode_pen_ );
+ Resource::ElementaryNode_hiPen = colorValue(_ElementaryNode_hiPen, ElementaryNode_hiPen_ );
+ Resource::Header_brush = colorValue(_Header_brush, Header_brush_ );
+ Resource::Header_hiBrush = colorValue(_Header_hiBrush, Header_hiBrush_ );
+ Resource::Header_pen = colorValue(_Header_pen, Header_pen_ );
+ Resource::Header_hiPen = colorValue(_Header_hiPen, Header_hiPen_ );
+ Resource::CtrlPort_brush = colorValue(_CtrlPort_brush, CtrlPort_brush_ );
+ Resource::CtrlPort_hiBrush = colorValue(_CtrlPort_hiBrush, CtrlPort_hiBrush_ );
+ Resource::CtrlPort_pen = colorValue(_CtrlPort_pen, CtrlPort_pen_ );
+ Resource::CtrlPort_hiPen = colorValue(_CtrlPort_hiPen, CtrlPort_hiPen_ );
+ Resource::DataPort_brush = colorValue(_DataPort_brush, DataPort_brush_ );
+ Resource::DataPort_hiBrush = colorValue(_DataPort_hiBrush, DataPort_hiBrush_ );
+ Resource::DataPort_pen = colorValue(_DataPort_pen, DataPort_pen_ );
+ Resource::DataPort_hiPen = colorValue(_DataPort_hiPen, DataPort_hiPen_ );
+ Resource::DataStreamPort_brush = colorValue(_DataStreamPort_brush, DataStreamPort_brush_ );
+ Resource::DataStreamPort_hiBrush = colorValue(_DataStreamPort_hiBrush, DataStreamPort_hiBrush_);
+ Resource::DataStreamPort_pen = colorValue(_DataStreamPort_pen, DataStreamPort_pen_ );
+ Resource::DataStreamPort_hiPen = colorValue(_DataStreamPort_hiPen, DataStreamPort_hiPen_ );
+
+ Resource::dragOver = colorValue(__dragOver, dragOver_ );
+}
+
+void Yacsgui_Resource::preferencesChanged( const QString& sect, const QString& name )
+{
+ if( sect==RESOURCE_YACS )
+ {
+ preferencesChanged();
+ }
+}
+
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _SALOMEGUI_RESOURCE_HXX_
+#define _SALOMEGUI_RESOURCE_HXX_
+
+#include <QtGui>
+
+class Yacsgui;
+class SUIT_ResourceMgr;
+
+
+class Yacsgui_Resource
+{
+ public:
+ Yacsgui_Resource(SUIT_ResourceMgr* r);
+ virtual void createPreferences(Yacsgui* swm);
+ virtual void preferencesChanged( const QString& sect, const QString& name );
+ virtual void preferencesChanged();
+
+ protected:
+ int integerValue( const QString& name, const int def = 0 ) const;
+ double doubleValue ( const QString& name, const double def = 0 ) const;
+ bool booleanValue( const QString& name, const bool def = false ) const;
+ QFont fontValue ( const QString& name, const QFont def = QFont() ) const;
+ QColor colorValue ( const QString& name, const QColor def = QColor() ) const;
+ QColor colorValue ( const QString& name, const Qt::GlobalColor c ) const;
+ QColor colorValue ( const QString& name, const int h, const int s, const int v) const;
+ QString stringValue ( const QString& name, const QString def = QString() ) const;
+
+ void setValue( const QString& name, const int val );
+ void setValue( const QString& name, const double val );
+ void setValue( const QString& name, const bool val );
+ void setValue( const QString& name, const QFont val );
+ void setValue( const QString& name, const QColor val );
+ void setValue( const QString& name, const QString val );
+
+ protected:
+ SUIT_ResourceMgr* _resource;
+
+};
+
+#endif
+
+++ /dev/null
-<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-
- 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-
--->
-<document>
- <section name="YACS">
- <!-- Major module parameters -->
- <parameter name="name" value="YACS"/>
- <parameter name="icon" value="ModuleYacs.png"/>
- </section>
- <section name="resources">
- <!-- Module resources -->
- <parameter name="YACSPrs" value="${YACS_ROOT_DIR}/share/salome/resources/yacs"/>
- <parameter name="YACS" value="${YACS_ROOT_DIR}/share/salome/resources/yacs"/>
- </section>
- <section name="YACSGui" >
- <!-- Module preferences -->
- <parameter name="link_draw_color" value="0, 0, 127" />
- <parameter name="stream_link_draw_color" value="222, 0, 0" />
- <parameter name="link_hilight_color" value="222, 222, 222" />
- <parameter name="link_select_color" value="255, 0, 255" />
- </section>
-</document>
--- /dev/null
+<!--
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+
+ 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+-->
+<document>
+ <section name="YACS">
+ <!-- Major module parameters -->
+ <parameter name="name" value="YACS"/>
+ <parameter name="icon" value="ModuleYacs.png"/>
+ <parameter name="version" value="@VERSION@"/>
+ </section>
+ <section name="resources">
+ <!-- Module resources -->
+ <parameter name="YACSPrs" value="%YACS_ROOT_DIR%/share/salome/resources/yacs"/>
+ <parameter name="YACS" value="%YACS_ROOT_DIR%/share/salome/resources/yacs"/>
+ </section>
+ <section name="yacs_help">
+ <parameter name="sub_menu" value="%1 module"/>
+ <parameter name="User's Guide" value="%YACS_ROOT_DIR%/share/doc/salome/gui/YACS/index.html"/>
+ </section>
+ <section name="YACS" >
+ <!-- Module preferences -->
+ <parameter name="font" value="Courier,9" />
+ <parameter name="COMPONENT_INSTANCE_NEW" value="true" />
+ <parameter name="userCatalog" value="YACSUserCatalog.xml" />
+ <parameter name="autoComputeLinks" value="true" />
+ <parameter name="simplifyLink" value="false" />
+ <parameter name="addRowCols" value="false" />
+ <parameter name="ensureVisibleWhenMoved" value="true" />
+ <parameter name="tabPanelsUp" value="true" />
+ <parameter name="documentation" value="yacs_help"/>
+
+ <parameter name="editedNodeBrushColor" value="255, 255, 190" />
+ <parameter name="normalNodeBrushColor" value="230, 235, 255" />
+ <parameter name="runNodeBrushColor" value="205, 218, 255" />
+ <parameter name="validNodeColor" value="128, 255, 128" />
+ <parameter name="invalidNodeColor" value="255, 128, 128" />
+
+ <parameter name="NOTYETINITIALIZED" value="255, 243, 205" />
+ <parameter name="INITIALISED" value="230, 255, 205" />
+ <parameter name="RUNNING" value="205, 255, 218" />
+ <parameter name="WAITINGTASKS" value="205, 255, 255" />
+ <parameter name="PAUSED" value="205, 218, 255" />
+ <parameter name="FINISHED" value="230, 205, 255" />
+ <parameter name="STOPPED" value="255, 205, 243" />
+ <parameter name="UNKNOWN" value="255, 205, 205" />
+
+ <parameter name="UNDEFINED" value="#c0c0c0" />
+ <parameter name="INVALID" value="255, 0, 0" />
+ <parameter name="READY" value="#a0a0a4" />
+ <parameter name="TOLOAD" value="#808000" />
+ <parameter name="LOADED" value="#800080" />
+ <parameter name="TOACTIVATE" value="#008080" />
+ <parameter name="ACTIVATED" value="#000080" />
+ <parameter name="DESACTIVATED" value="#a0a0a4" />
+ <parameter name="DONE" value="#008000" />
+ <parameter name="SUSPENDED" value="#a0a0a4" />
+ <parameter name="LOADFAILED" value="255, 0, 170" />
+ <parameter name="EXECFAILED" value="255, 85, 0" />
+ <parameter name="PAUSE" value="0, 255, 255" />
+ <parameter name="INTERNALERR" value="255, 0, 85" />
+ <parameter name="DISABLED" value="255, 170, 0" />
+ <parameter name="FAILED" value="255, 85, 0" />
+ <parameter name="ERROR" value="255, 0, 0" />
+ <parameter name="DEFAULT" value="#c0c0c0" />
+
+ <parameter name="link_draw_color" value=" 0, 0, 192" />
+ <parameter name="link_select_color" value="192, 192, 255" />
+ <parameter name="stream_link_draw_color" value="192, 192, 0" />
+ <parameter name="stream_link_select_color" value="255, 255, 192" />
+ <parameter name="control_link_draw_color" value="192, 0, 192" />
+ <parameter name="control_link_select_color" value="255, 192, 255" />
+ <parameter name="emphasizeBrushColor" value=" 0, 255, 0" />
+ <parameter name="link_pen_darkness" value="150" />
+ <parameter name="link_thickness" value="1" />
+ <parameter name="link_separation_weight" value="10" />
+
+ <parameter name="Scene_pen" value=" 0, 0, 128" />
+ <parameter name="Scene_hiPen" value=" 0, 0, 190" />
+ <parameter name="Scene_brush" value="128, 128, 128" />
+ <parameter name="Scene_hiBrush" value="190, 190, 190" />
+ <parameter name="ComposedNode_brush" value="213, 213, 213" />
+ <parameter name="ComposedNode_hiBrush" value="225, 225, 225" />
+ <parameter name="ComposedNode_pen" value="120, 120, 120" />
+ <parameter name="ComposedNode_hiPen" value=" 60, 60, 60" />
+ <parameter name="ElementaryNode_brush" value="189, 230, 185" />
+ <parameter name="ElementaryNode_hiBrush" value="209, 255, 205" />
+ <parameter name="ElementaryNode_pen" value=" 15, 180, 0" />
+ <parameter name="ElementaryNode_hiPen" value=" 11, 128, 0" />
+ <parameter name="Header_brush" value="215, 220, 238" />
+ <parameter name="Header_hiBrush" value="161, 178, 238" />
+ <parameter name="Header_pen" value="120, 120, 120" />
+ <parameter name="Header_hiPen" value=" 60, 60, 60" />
+ <parameter name="CtrlPort_brush" value="205, 210, 227" />
+ <parameter name="CtrlPort_hiBrush" value="161, 176, 227" />
+ <parameter name="CtrlPort_pen" value="120, 120, 120" />
+ <parameter name="CtrlPort_hiPen" value=" 60, 60, 60" />
+ <parameter name="DataPort_brush" value="158, 227, 151" />
+ <parameter name="DataPort_hiBrush" value="127, 227, 116" />
+ <parameter name="DataPort_pen" value=" 15, 180, 0" />
+ <parameter name="DataPort_hiPen" value=" 11, 128, 0" />
+ <parameter name="DataStreamPort_brush" value="158, 227, 151" />
+ <parameter name="DataStreamPort_hiBrush" value="127, 227, 116" />
+ <parameter name="DataStreamPort_pen" value=" 15, 180, 0" />
+ <parameter name="DataStreamPort_hiPen" value=" 11, 128, 0" />
+
+ <parameter name="dragOver" value="255, 0, 0" />
+
+ <parameter name="CtrlPort_Width" value="85" />
+ <parameter name="CtrlPort_Height" value="25" />
+ <parameter name="DataPort_Width" value="100" />
+ <parameter name="DataPort_Height" value="25" />
+ </section>
+</document>
<?xml version='1.0' encoding='us-ascii' ?>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
--- /dev/null
+<?xml version='1.0'?>
+<proc>
+ <property name="DefaultStudyID" value="1"/>
+ <objref name="GEOM_Shape" id="IDL:GEOM/GEOM_Object:1.0"/>
+ <type name="bool" kind="bool"/>
+ <sequence name="boolvec" content="bool"/>
+ <type name="double" kind="double"/>
+ <sequence name="dblevec" content="double"/>
+ <objref name="file" id="file"/>
+ <type name="int" kind="int"/>
+ <sequence name="intvec" content="int"/>
+ <objref name="pyobj" id="python:obj:1.0"/>
+ <type name="string" kind="string"/>
+ <sequence name="stringvec" content="string"/>
+ <container name="DefaultContainer">
+ <property name="container_name" value="FactoryServer"/>
+ <property name="hostname" value="localhost"/>
+ </container>
+ <inline name="PyScript0">
+ <script><code><![CDATA[import geompy
+n=1
+box = geompy.MakeBoxDXDYDZ(10,10,10)
+id_cyl_Int = geompy.addToStudy(box,"Box_%d" % n)]]></code></script>
+ <outport name="box" type="GEOM_Shape"/>
+ </inline>
+ <presentation name="PyScript0" x="9" y="80.5" width="227.5" height="110"/>
+ <presentation name="__ROOT__" x="0" y="0" width="246" height="199.5"/>
+</proc>
-msgid "ICON_GET_BANNER"
-msgstr "ExecHELLO.png"
-
-<!DOCTYPE TS><TS>
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="en_US">
<context>
<name>@default</name>
<message>
-# Copyright (C) 2005 CEA/DEN, EDF R&D
-#
-# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-# This is a Qt message file in .po format. Each msgid starts with
-# a scope. This scope should *NOT* be translated - eg. translating
-# from French to English, "Foo::Bar" would be translated to "Pub",
-# not "Foo::Pub".
-msgid ""
-msgstr ""
-"Project-Id-Version: PROJECT VERSION\n"
-"POT-Creation-Date: 2003-11-19 03:10:19 PM CET\n"
-"PO-Revision-Date: YYYY-MM-DD\n"
-"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
-"Content-Type: text/plain; charset=iso-8859-1\n"
-
-#: HELLOGUI.cxx:76
-msgid "HELLOGUI::BUT_OK"
-msgstr "OK"
-
-#: HELLOGUI.cxx:76
-msgid "HELLOGUI::INF_HELLO_BANNER"
-msgstr "HELLO Information"
-
-#: HELLOGUI.cxx:76
-msgid "HELLOGUI::INF_HELLO_MENU"
-msgstr "This is just a test"
-
-#: HELLOGUI.cxx:57
-msgid "HELLOGUI::QUE_HELLO_LABEL"
-msgstr "Name Import"
-
-#: HELLOGUI.cxx:57
-msgid "HELLOGUI::QUE_HELLO_NAME"
-msgstr "Please, Enter your name"
-
-msgid "TLT_MY_NEW_ITEM"
-msgstr "My menu item"
-
-msgid "MEN_MY_NEW_ITEM"
-msgstr "My menu item"
-
-msgid "STS_MY_NEW_ITEM"
-msgstr "Call my menu item"
-
-msgid "TLT_GET_BANNER"
-msgstr "Get HELLO banner"
-
-msgid "MEN_GET_BANNER"
-msgstr "Get banner"
-
-msgid "STS_GET_BANNER"
-msgstr "Get HELLO banner"
-
-msgid "MEN_FILE"
-msgstr "&File"
-
-msgid "MEN_FILE_HELLO"
-msgstr "Hello"
-
-msgid "MEN_HELLO"
-msgstr "HELLO"
-
-msgid "TOOL_HELLO"
-msgstr "HELLO"
-
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="en_US">
+<context>
+ <name>Yacsgui</name>
+ <message>
+ <source>PREF_TAB_GENERAL</source>
+ <translation>General</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_COMPONENT</source>
+ <translation>Component</translation>
+ </message>
+ <message>
+ <source>PREF_TAB_STATE</source>
+ <translation>Node states</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_EDIT</source>
+ <translation>Edit states</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_RUN</source>
+ <translation>Run states</translation>
+ </message>
+ <message>
+ <source>PREF_TAB_NODE</source>
+ <translation>Nodes</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_SCENE</source>
+ <translation>Scene</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_BLOC</source>
+ <translation>Block</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_NODE</source>
+ <translation>Node</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_HEADER</source>
+ <translation>Header</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_CONTROL</source>
+ <translation>Control port</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_PORT</source>
+ <translation>Dataflow Port</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_DRAG</source>
+ <translation>Dragging</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_GENERAL</source>
+ <translation>General</translation>
+ </message>
+ <message>
+ <source>COMPONENT_INSTANCE_NEW</source>
+ <translation>Create a component instance for each new service node</translation>
+ </message>
+ <message>
+ <source>ERROR</source>
+ <translation>ERROR</translation>
+ </message>
+ <message>
+ <source>YACS_PLUGINS</source>
+ <translation>Plugins</translation>
+ </message>
+</context>
+</TS>
-# Copyright (C) 2005 CEA/DEN, EDF R&D
-#
-# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-# This is a Qt message file in .po format. Each msgid starts with
-# a scope. This scope should *NOT* be translated - eg. translating
-# from French to English, "Foo::Bar" would be translated to "Pub",
-# not "Foo::Pub".
-msgid ""
-msgstr ""
-"Project-Id-Version: PROJECT VERSION\n"
-"POT-Creation-Date: 2003-11-19 03:10:25 PM CET\n"
-"PO-Revision-Date: YYYY-MM-DD\n"
-"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
-"Content-Type: text/plain; charset=iso-8859-1\n"
-
-#: HELLOGUI.cxx:76
-msgid "HELLOGUI::BUT_OK"
-msgstr "OK"
-
-#: HELLOGUI.cxx:76
-msgid "HELLOGUI::INF_HELLO_BANNER"
-msgstr "Information HELLO"
-
-#: HELLOGUI.cxx:76
-msgid "HELLOGUI::INF_HELLO_MENU"
-msgstr "Ceci est un simple test"
-
-#: HELLOGUI.cxx:57
-msgid "HELLOGUI::QUE_HELLO_LABEL"
-msgstr "Import Prénom"
-
-#: HELLOGUI.cxx:57
-msgid "HELLOGUI::QUE_HELLO_NAME"
-msgstr "Entrez votre prénom, s'il vous plait"
-
-msgid "TLT_MY_NEW_ITEM"
-msgstr "My menu item"
-
-msgid "MEN_MY_NEW_ITEM"
-msgstr "My menu item"
-
-msgid "STS_MY_NEW_ITEM"
-msgstr "Call my menu item"
-
-msgid "TLT_GET_BANNER"
-msgstr "Get HELLO banner"
-
-msgid "MEN_GET_BANNER"
-msgstr "Get banner"
-
-msgid "STS_GET_BANNER"
-msgstr "Get HELLO banner"
-
-msgid "MEN_FILE"
-msgstr "&File"
-
-msgid "MEN_FILE_HELLO"
-msgstr "Hello"
-
-msgid "MEN_HELLO"
-msgstr "HELLO"
-
-msgid "TOOL_HELLO"
-msgstr "HELLO"
-
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>@default</name>
+ <message>
+ <source>Choose Batch Job for watch</source>
+ <translation>Choisir le job batch à surveiller</translation>
+ </message>
+ <message>
+ <source>Select one Batch Job to watch</source>
+ <translation>Sélectionner le job batch à surveiller</translation>
+ </message>
+ <message>
+ <source>PREF_TAB_GENERAL</source>
+ <translation>Général</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_COMPONENT</source>
+ <translation>Composant</translation>
+ </message>
+ <message>
+ <source>PREF_TAB_STATE</source>
+ <translation>États des Noeuds</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_EDIT</source>
+ <translation>Édition</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_RUN</source>
+ <translation>Exécution</translation>
+ </message>
+ <message>
+ <source>PREF_TAB_NODE</source>
+ <translation>Noeuds</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_SCENE</source>
+ <translation>Scène</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_BLOC</source>
+ <translation>Bloc</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_NODE</source>
+ <translation>Noeud</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_HEADER</source>
+ <translation>Entête</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_CONTROL</source>
+ <translation>Port de Contrôle</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_PORT</source>
+ <translation>Port Dataflow</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_DRAG</source>
+ <translation>Glisser</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_GENERAL</source>
+ <translation>Général</translation>
+ </message>
+ <message>
+ <source>COMPONENT_INSTANCE_NEW</source>
+ <translation>Créer une instance du composant pour chaque nouveau noeud de service</translation>
+ </message>
+ <message>
+ <source>Link colors</source>
+ <translation>Couleurs des liens</translation>
+ </message>
+ <message>
+ <source>Link draw color</source>
+ <translation>Couleur de création des liens</translation>
+ </message>
+ <message>
+ <source>Link select color</source>
+ <translation>Couleur de sélection des liens</translation>
+ </message>
+ <message>
+ <source>Stream link draw color</source>
+ <translation>Couleur de création des liens flux</translation>
+ </message>
+ <message>
+ <source>Stream link select color</source>
+ <translation>Couleur de sélection des liens flux</translation>
+ </message>
+ <message>
+ <source>Control link draw color</source>
+ <translation>Couleur de création des liens de contrôle</translation>
+ </message>
+ <message>
+ <source>Control link select color</source>
+ <translation>Couleur de sélection des liens de contrôle</translation>
+ </message>
+ <message>
+ <source>Emphasis link color</source>
+ <translation>Couleur des liens accentués</translation>
+ </message>
+ <message>
+ <source>link pen darkness</source>
+ <translation>foncé du lien stylo</translation>
+ </message>
+ <message>
+ <source>Pen</source>
+ <translation>Stylo</translation>
+ </message>
+ <message>
+ <source>Brush</source>
+ <translation>Pinceau</translation>
+ </message>
+ <message>
+ <source>High pen</source>
+ <translation>Stylo haut</translation>
+ </message>
+ <message>
+ <source>High brush</source>
+ <translation>Pinceau haut</translation>
+ </message>
+ <message>
+ <source>On dragging</source>
+ <translation>Au cours de glissage</translation>
+ </message>
+ <message>
+ <source>ERROR</source>
+ <translation>ERROR</translation>
+ </message>
+ <message>
+ <source>YACS_PLUGINS</source>
+ <translation>Extensions</translation>
+ </message>
+</context>
+<context>
+ <name>YACS::HMI::ComposedNodeMenu</name>
+ <message>
+ <source>Create Node</source>
+ <translation>Créer un noeud</translation>
+ </message>
+</context>
+<context>
+ <name>YACS::HMI::GenericGui</name>
+ <message>
+ <source>Create a new YACS Schema</source>
+ <translation>Créer un nouveau schéma YACS</translation>
+ </message>
+ <message>
+ <source>New Schema</source>
+ <translation>Nouvel schéma</translation>
+ </message>
+ <message>
+ <source>Import a YACS Schema for edition</source>
+ <translation>Importer un schéma YACS pour l'édition</translation>
+ </message>
+ <message>
+ <source>Import Schema</source>
+ <translation>Importer un schéma</translation>
+ </message>
+ <message>
+ <source>Import a SUPERV Schema for edition</source>
+ <translation>Importer un schéma SUPERV pour l'édition</translation>
+ </message>
+ <message>
+ <source>Import SUPERV Schema</source>
+ <translation>Importer un schéma SUPERV</translation>
+ </message>
+ <message>
+ <source>Save the current YACS Schema</source>
+ <translation>Enregistrer le schéma YACS actuel</translation>
+ </message>
+ <message>
+ <source>Save Schema</source>
+ <translation>Enregistrer le schéma</translation>
+ </message>
+ <message>
+ <source>Save the current YACS Schema As...</source>
+ <translation>Enregistrer le schéma YACS actuel sous...</translation>
+ </message>
+ <message>
+ <source>Save Schema As</source>
+ <translation>Enregistrer le schéma sous...</translation>
+ </message>
+ <message>
+ <source>Import a Schema as a Catalog</source>
+ <translation>Importer un schéma en tant que catalogue</translation>
+ </message>
+ <message>
+ <source>Import Catalog</source>
+ <translation>Importer un catalogue</translation>
+ </message>
+ <message>
+ <source>Prepare the current edited schema for run</source>
+ <translation>Préparer le schéma édité actuellement à l'exécution</translation>
+ </message>
+ <message>
+ <source>Run Current Schema</source>
+ <translation>Lancer le schéma actuel</translation>
+ </message>
+ <message>
+ <source>Load a previous run state for this schema, prepare to run</source>
+ <translation>Ouvrir l'état d'exécution précédent de ce schéma, préparer au lancement</translation>
+ </message>
+ <message>
+ <source>Load Run State</source>
+ <translation>Ouvrir l'état d'exécution</translation>
+ </message>
+ <message>
+ <source>Load a schema for run</source>
+ <translation>Ouvrir un schéma à lancer</translation>
+ </message>
+ <message>
+ <source>Load Schema to run</source>
+ <translation>Ouvrir un schéma à exécuter</translation>
+ </message>
+ <message>
+ <source>Load Batch Schema for edition</source>
+ <translation>Ouvrir un schéma batch à l'édition</translation>
+ </message>
+ <message>
+ <source>Load Batch Schema</source>
+ <translation>Ouvrir un schéma batch</translation>
+ </message>
+ <message>
+ <source>Start or Resume Schema execution</source>
+ <translation>Commencer ou Rependre l'exécution du schéma</translation>
+ </message>
+ <message>
+ <source>Start/Resume execution</source>
+ <translation>Commencer/reprendre l'exécution</translation>
+ </message>
+ <message>
+ <source>Abort the current execution</source>
+ <translation>Terminer l'exécution du schéma actuel</translation>
+ </message>
+ <message>
+ <source>Abort execution</source>
+ <translation>Terminer l'exécution du schéma</translation>
+ </message>
+ <message>
+ <source>Suspend the current execution</source>
+ <translation>Suspendre l'exécution actuelle</translation>
+ </message>
+ <message>
+ <source>Suspend execution</source>
+ <translation>Suspendre l'exécution</translation>
+ </message>
+ <message>
+ <source>Reset the current execution</source>
+ <translation>Recommencer l'exécution actuelle</translation>
+ </message>
+ <message>
+ <source>Reset execution</source>
+ <translation>Recommencer l'exécution</translation>
+ </message>
+ <message>
+ <source>Save the current run state</source>
+ <translation>Sauvegarder l'état actuel d'exécution</translation>
+ </message>
+ <message>
+ <source>Save State</source>
+ <translation>Sauvegarder l'Etat</translation>
+ </message>
+ <message>
+ <source>Edit again the current schema in a new context</source>
+ <translation>Editer de nouveau le schéma courant au nouveau contexte</translation>
+ </message>
+ <message>
+ <source>Edit Again</source>
+ <translation>Editer de nouveau</translation>
+ </message>
+ <message>
+ <source>get YACS container log</source>
+ <translation>obtenir le journal du conteneur YACS</translation>
+ </message>
+ <message>
+ <source>YACS Container Log</source>
+ <translation>Journal du conteneur YACS</translation>
+ </message>
+ <message>
+ <source>get Node Error Report</source>
+ <translation>obtenir un rapport d'erreurs du noeud</translation>
+ </message>
+ <message>
+ <source>Node Error Report</source>
+ <translation>Rapport des erreurs sur les noeuds</translation>
+ </message>
+ <message>
+ <source>get Node Error Details</source>
+ <translation>obtenir les détails d'erreurs du noeud</translation>
+ </message>
+ <message>
+ <source>Node Error Details</source>
+ <translation>Détails des erreurs sur les noeuds</translation>
+ </message>
+ <message>
+ <source>get Node Container Log</source>
+ <translation>obtenir le journal du conteneur du noeud </translation>
+ </message>
+ <message>
+ <source>Node Container Log</source>
+ <translation>Journal du conteneur des noeuds</translation>
+ </message>
+ <message>
+ <source>Edit Data Types</source>
+ <translation>Editer les types de données</translation>
+ </message>
+ <message>
+ <source>Create Data Types</source>
+ <translation>Créer les types de données</translation>
+ </message>
+ <message>
+ <source>Import Data Types, use drag and drop from catalog</source>
+ <translation>Importer les types de données, utiliser glisser déposer à partir du catalogue</translation>
+ </message>
+ <message>
+ <source>Import Data Types</source>
+ <translation>Importer les types de données</translation>
+ </message>
+ <message>
+ <source>Create a New Container</source>
+ <translation>Créer un nouveau conteneur</translation>
+ </message>
+ <message>
+ <source>Create Container</source>
+ <translation>Créer un conteneur</translation>
+ </message>
+ <message>
+ <source>Select a Component Instance</source>
+ <translation>Choisir l'instance du composant</translation>
+ </message>
+ <message>
+ <source>Create a New SALOME Component Instance</source>
+ <translation>Créer une nouvelle instance de Composant Salomé</translation>
+ </message>
+ <message>
+ <source>new Component Instance</source>
+ <translation>nouvelle instance de composant</translation>
+ </message>
+ <message>
+ <source>Create a New SALOME Python Component</source>
+ <translation>Créer un nouveau composant python Salomé</translation>
+ </message>
+ <message>
+ <source>SALOME Python Component</source>
+ <translation>Composant Python Salomé</translation>
+ </message>
+ <message>
+ <source>Create a New CORBA Component</source>
+ <translation>Créer un nouveau composant CORBA</translation>
+ </message>
+ <message>
+ <source>CORBA Component</source>
+ <translation>Composant CORBA</translation>
+ </message>
+ <message>
+ <source>Create a New SALOME Service Node</source>
+ <translation>Créer un nouveau noeud de service Salomé</translation>
+ </message>
+ <message>
+ <source>SALOME Service Node</source>
+ <translation>Noeud de Service Salomé</translation>
+ </message>
+ <message>
+ <source>Create a New Inline Service Node</source>
+ <translation>Créer un nouveau noeud inline de service</translation>
+ </message>
+ <message>
+ <source>Inline Service Node</source>
+ <translation>Noeud de service inline</translation>
+ </message>
+ <message>
+ <source>Create a New CORBA Service Node</source>
+ <translation>Créer un nouveau noeud de service CORBA</translation>
+ </message>
+ <message>
+ <source>CORBA Node</source>
+ <translation>Noeud CORBA</translation>
+ </message>
+ <message>
+ <source>Create a New Node referencing a Node</source>
+ <translation>Créer un nouveau noeud avec référence d'un noeud</translation>
+ </message>
+ <message>
+ <source>Ref on Node</source>
+ <translation>Référence à un Noeud</translation>
+ </message>
+ <message>
+ <source>Create a New C++ Node</source>
+ <translation>Créer un nouveau Noeud C++</translation>
+ </message>
+ <message>
+ <source>Cpp Node</source>
+ <translation>Noeud Cpp</translation>
+ </message>
+ <message>
+ <source>Create a New Input data Node</source>
+ <translation>Créer un nouveau noeud de données d'entrée</translation>
+ </message>
+ <message>
+ <source>Input Data Node</source>
+ <translation>Noeud de données d'entrée</translation>
+ </message>
+ <message>
+ <source>Create a New Output data Node</source>
+ <translation>Créer un nouveau noeud de sortie de données</translation>
+ </message>
+ <message>
+ <source>Output Data Node</source>
+ <translation>Noeud de Données de Sortie</translation>
+ </message>
+ <message>
+ <source>Create a New Input Study Node</source>
+ <translation>Créer un nouveau noeud d'entrée d'étude</translation>
+ </message>
+ <message>
+ <source>Input Study Node</source>
+ <translation>Noeud de l'étude d'entrée</translation>
+ </message>
+ <message>
+ <source>Create a New Output Study Node</source>
+ <translation>Créer un nouveau noeud de sortie d'étude</translation>
+ </message>
+ <message>
+ <source>Output Study Node</source>
+ <translation>Noeud de sortie d'étude</translation>
+ </message>
+ <message>
+ <source>Create a New Inline Python Script Node</source>
+ <translation>Créer un nouveau noeud inline du script Python</translation>
+ </message>
+ <message>
+ <source>Inline Script Node</source>
+ <translation>Noeud de script inline</translation>
+ </message>
+ <message>
+ <source>Create a New Inline Python Function Node</source>
+ <translation>Créer un nouveau noeud inline de la fonction Python</translation>
+ </message>
+ <message>
+ <source>Inline Function Node</source>
+ <translation>Noeud de Fonction Inline</translation>
+ </message>
+ <message>
+ <source>Create a New Bloc Node</source>
+ <translation>Créer un nouveau Noeud Bloc</translation>
+ </message>
+ <message>
+ <source>bloc Node</source>
+ <translation>Noeud bloc</translation>
+ </message>
+ <message>
+ <source>Create a New For Loop Node</source>
+ <translation>Créer un noeud boucle for</translation>
+ </message>
+ <message>
+ <source>For Loop Node</source>
+ <translation>Noeud boucle for</translation>
+ </message>
+ <message>
+ <source>Create a New For Each Loop Node</source>
+ <translation>Créer un noeud boucle For Each</translation>
+ </message>
+ <message>
+ <source>For Each Loop Node</source>
+ <translation>Noeud boucle For Each</translation>
+ </message>
+ <message>
+ <source>Create a New While Loop Node</source>
+ <translation>Créer un noeud boucle tant que</translation>
+ </message>
+ <message>
+ <source>While Loop Node</source>
+ <translation>Noeud boucle tant que</translation>
+ </message>
+ <message>
+ <source>Create a New Switch Node</source>
+ <translation>Créer un noeud Switch</translation>
+ </message>
+ <message>
+ <source>Switch Node</source>
+ <translation>Noeud Switch</translation>
+ </message>
+ <message>
+ <source>Create a New Optimizer Loop Node</source>
+ <translation>Créer un noeud boucle d'optimisation</translation>
+ </message>
+ <message>
+ <source>Optimizer Loop</source>
+ <translation>Boucle d'optimisation</translation>
+ </message>
+ <message>
+ <source>Create a New Optimizer Loop</source>
+ <translation>Créer une boucle d'optimisation</translation>
+ </message>
+ <message>
+ <source>Create a New Node from Catalog, use drag and drop from catalog</source>
+ <translation>Créer un noeud à partir du catalogue, utiliser glisser déposer</translation>
+ </message>
+ <message>
+ <source>Node from Catalog</source>
+ <translation>Noeud à partir du Catalogue</translation>
+ </message>
+ <message>
+ <source>Delete a Schema Item</source>
+ <translation>Supprimer un élément du schéma</translation>
+ </message>
+ <message>
+ <source>Delete Item</source>
+ <translation>Supprimer un élément</translation>
+ </message>
+ <message>
+ <source>Cut a Schema Item</source>
+ <translation>Couper un élément du schéma</translation>
+ </message>
+ <message>
+ <source>Cut Item</source>
+ <translation>Couper un élément</translation>
+ </message>
+ <message>
+ <source>Copy a Schema Item</source>
+ <translation>Copier un élément du schéma</translation>
+ </message>
+ <message>
+ <source>Copy Item</source>
+ <translation>Copier un élément</translation>
+ </message>
+ <message>
+ <source>Paste a Schema Item</source>
+ <translation>Coller un élément du schéma</translation>
+ </message>
+ <message>
+ <source>Paste Item</source>
+ <translation>Coller un élément</translation>
+ </message>
+ <message>
+ <source>Put node in block</source>
+ <translation>Poser le noeud au bloc</translation>
+ </message>
+ <message>
+ <source>arrange nodes on that bloc level, without recursion</source>
+ <translation>ranger les noeuds au niveau de ce bloc, sans récursion </translation>
+ </message>
+ <message>
+ <source>arrange local nodes</source>
+ <translation>ranger les noeuds locaux</translation>
+ </message>
+ <message>
+ <source>arrange nodes on that bloc level, with recursion</source>
+ <translation>ranger les noeuds au niveau de ce bloc, avec récursion </translation>
+ </message>
+ <message>
+ <source>arrange nodes recursion</source>
+ <translation>ranger les noeuds avec récursion</translation>
+ </message>
+ <message>
+ <source>compute orthogonal links</source>
+ <translation>calculer les liens orthogonaux</translation>
+ </message>
+ <message>
+ <source>compute links</source>
+ <translation>calculer les liens</translation>
+ </message>
+ <message>
+ <source>zoom 2D view to selected bloc</source>
+ <translation>Centrer la scène 2D au bloc choisi</translation>
+ </message>
+ <message>
+ <source>zoom to bloc</source>
+ <translation>centrer la vue au bloc</translation>
+ </message>
+ <message>
+ <source>zoom 2D view to the selected composed node</source>
+ <translation>Centrer la scène 2D au noeud composé choisi</translation>
+ </message>
+ <message>
+ <source>center 2D view on selected node</source>
+ <translation>centrer la scène 2D sur le noeud choisi</translation>
+ </message>
+ <message>
+ <source>center on node</source>
+ <translation>centrer sur le noeud</translation>
+ </message>
+ <message>
+ <source>shrink or expand the selected node</source>
+ <translation>contracter ou étendre le noeud choisi</translation>
+ </message>
+ <message>
+ <source>shrink/expand</source>
+ <translation>contracter/étendre</translation>
+ </message>
+ <message>
+ <source>draw straight or orthogonal links</source>
+ <translation>Créer les liens droits ou orthogonaux</translation>
+ </message>
+ <message>
+ <source>straight/orthogonal</source>
+ <translation>droit/orthogonal</translation>
+ </message>
+ <message>
+ <source>compute othogonal links automatically when nodes move</source>
+ <translation>calculer les liens orthogonaux automatiquement après le déplacement d'un noeud</translation>
+ </message>
+ <message>
+ <source>automatic link</source>
+ <translation>lien automatique</translation>
+ </message>
+ <message>
+ <source>simplify links by removing unnecessary direction changes</source>
+ <translation>simplifier les liens par la suppression des changements de direction redondants</translation>
+ </message>
+ <message>
+ <source>simplify links</source>
+ <translation>simplifier les liens</translation>
+ </message>
+ <message>
+ <source>force orthogonal links by adding an edge on simples links</source>
+ <translation>imposer les liens orthogonaux en ajoutant une arête sur des liens simples</translation>
+ </message>
+ <message>
+ <source>force ortho links</source>
+ <translation>imposer les liens orthogonaux</translation>
+ </message>
+ <message>
+ <source>allow more path for the links, for a better separation</source>
+ <translation>permettre plus de chemins pour les liens pour améliorer la séparation</translation>
+ </message>
+ <message>
+ <source>separate links</source>
+ <translation>séparer les liens</translation>
+ </message>
+ <message>
+ <source>select reference</source>
+ <translation>choisir une référence</translation>
+ </message>
+ <message>
+ <source>active whatsThis Mode to get help on widgets</source>
+ <translation>Activer le mode qu'est-ce-que-c'est pour obtenir de l'aide</translation>
+ </message>
+ <message>
+ <source>whatsThis Mode</source>
+ <translation>Mode qu'est-ce-que-c'est</translation>
+ </message>
+ <message>
+ <source>set execution mode without stop</source>
+ <translation>activer le mode d'exécution sans arrêt</translation>
+ </message>
+ <message>
+ <source>mode without stop</source>
+ <translation>mode sans arrêt</translation>
+ </message>
+ <message>
+ <source>set execution mode with stop on breakpoints</source>
+ <translation>Activer le mode d'exécution avec les points d'arrêt</translation>
+ </message>
+ <message>
+ <source>mode breakpoints</source>
+ <translation>mode avec les points d'arrêt</translation>
+ </message>
+ <message>
+ <source>set execution mode step by step</source>
+ <translation>Activer le mode d'exécution pas à pas</translation>
+ </message>
+ <message>
+ <source>mode step by step</source>
+ <translation>mode pas à pas</translation>
+ </message>
+ <message>
+ <source>Force stop on first error during execution</source>
+ <translation>Imposer l'arrêt au premier erreur au cours d'exécution</translation>
+ </message>
+ <message>
+ <source>stop on error</source>
+ <translation>arrêter après une erreur</translation>
+ </message>
+ <message>
+ <source>toggle 2D scene item visibility</source>
+ <translation>Rendre visible un élément de scène 2D</translation>
+ </message>
+ <message>
+ <source>visible/hidden</source>
+ <translation>visible/caché</translation>
+ </message>
+ <message>
+ <source>Show all the links</source>
+ <translation>montrer tous les liens</translation>
+ </message>
+ <message>
+ <source>show all links</source>
+ <translation>montrer tous les liens</translation>
+ </message>
+ <message>
+ <source>Hide all the links</source>
+ <translation>Cacher tous les liens</translation>
+ </message>
+ <message>
+ <source>hide all links</source>
+ <translation>cacher tous les liens</translation>
+ </message>
+ <message>
+ <source>Show only links from/to this port</source>
+ <translation>montrer exclusivement les liens de/à ce port</translation>
+ </message>
+ <message>
+ <source>show only links</source>
+ <translation>montrer exclusivement les liens</translation>
+ </message>
+ <message>
+ <source>Show links from/to this port</source>
+ <translation>montrer les liens de/à ce port</translation>
+ </message>
+ <message>
+ <source>show links</source>
+ <translation>montrer les liens</translation>
+ </message>
+ <message>
+ <source>Hide links from/to this port</source>
+ <translation>Cacher les liens de/à ce port</translation>
+ </message>
+ <message>
+ <source>hide links</source>
+ <translation>cacher les liens</translation>
+ </message>
+ <message>
+ <source>Show only control links from/to this node</source>
+ <translation>montrer exclusivement les liens de contrôle de/à ce noeud</translation>
+ </message>
+ <message>
+ <source>show only Control links</source>
+ <translation>montrer exclusivement les liens de contrôle</translation>
+ </message>
+ <message>
+ <source>Show control links from/to this node</source>
+ <translation>montrer les liens de contrôle de/à ce noeud</translation>
+ </message>
+ <message>
+ <source>show control links</source>
+ <translation>montrer les liens de contrôle</translation>
+ </message>
+ <message>
+ <source>Hide control links from/to this node</source>
+ <translation>cacher les liens de contrôle de/à ce noeud</translation>
+ </message>
+ <message>
+ <source>hide control links</source>
+ <translation>cacher tous les liens de contrôle</translation>
+ </message>
+ <message>
+ <source>Show only this link</source>
+ <translation>montrer exclusivement ce lien</translation>
+ </message>
+ <message>
+ <source>show only</source>
+ <translation>montrer exclusivement</translation>
+ </message>
+ <message>
+ <source>Show this link</source>
+ <translation>montrer ce lien</translation>
+ </message>
+ <message>
+ <source>show</source>
+ <translation>montrer</translation>
+ </message>
+ <message>
+ <source>Hide this link</source>
+ <translation>Cacher ce lien</translation>
+ </message>
+ <message>
+ <source>hide</source>
+ <translation>cacher</translation>
+ </message>
+ <message>
+ <source>emphasis on links from/to this port</source>
+ <translation>accentuer les liens de/à ce port</translation>
+ </message>
+ <message>
+ <source>emphasize links</source>
+ <translation>accentuer les liens</translation>
+ </message>
+ <message>
+ <source>emphasis on control links from/to this node</source>
+ <translation>accentuer les liens de contrôle de/à ce noeud</translation>
+ </message>
+ <message>
+ <source>emphasize control links</source>
+ <translation>accentuer les liens de contrôle</translation>
+ </message>
+ <message>
+ <source>emphasis on this link</source>
+ <translation>accentuer ce lien</translation>
+ </message>
+ <message>
+ <source>emphasize</source>
+ <translation>accentuer</translation>
+ </message>
+ <message>
+ <source>remove all emphasis</source>
+ <translation>Supprimer toutes les accentuations</translation>
+ </message>
+ <message>
+ <source>undo last action</source>
+ <translation>défaire la dernière action</translation>
+ </message>
+ <message>
+ <source>undo</source>
+ <translation>Défaire</translation>
+ </message>
+ <message>
+ <source>redo last action</source>
+ <translation>refaire la dernière action</translation>
+ </message>
+ <message>
+ <source>redo</source>
+ <translation>Refaire</translation>
+ </message>
+ <message>
+ <source>show undo commands</source>
+ <translation>montrer défaire les commandes</translation>
+ </message>
+ <message>
+ <source>show undo</source>
+ <translation>montrer défaire</translation>
+ </message>
+ <message>
+ <source>show redo commands</source>
+ <translation>montrer refaire les commandes</translation>
+ </message>
+ <message>
+ <source>show redo</source>
+ <translation>montrer refaire</translation>
+ </message>
+ <message>
+ <source>File</source>
+ <translation>Fichier</translation>
+ </message>
+ <message>
+ <source>YACS Toolbar</source>
+ <translation>Barre d'outils YACS</translation>
+ </message>
+ <message>
+ <source>XML-Files (*.xml);;All Files (*)</source>
+ <translation>Fichiers XML (*.xml);;Tous les fichiers (*)</translation>
+ </message>
+</context>
+<context>
+ <name>YACS::HMI::MenusBase</name>
+ <message>
+ <source>Elapse Time Statistics</source>
+ <translation>Statistique du temps écoulé</translation>
+ </message>
+</context>
+<context>
+ <name>YACS::HMI::ProcMenu</name>
+ <message>
+ <source>Create Node</source>
+ <translation>Créer un noeud</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+include $(top_srcdir)/adm/unix/make_begin.am
+
+
+SWIGSRC=libYACS_Swig.i
+MYSWIG_FLAGS =
+
+if DOXYGEN_IS_OK
+MYSWIG_FLAGS += -DDOXYGEN_IS_OK
+endif
+
+salomepython_PYTHON = libYACS_Swig.py
+salomepyexec_LTLIBRARIES = _libYACS_Swig.la
+
+libYACS_Swig.py: libYACS_SwigWRAP.cxx
+BUILT_SOURCES = libYACS_SwigWRAP.cxx
+_libYACS_Swig_la_SOURCES = $(SWIGSRC) YACSGUI_Swig.cxx
+nodist__libYACS_Swig_la_SOURCES = $(BUILT_SOURCES)
+
+_libYACS_Swig_la_CPPFLAGS = -I$(KERNEL_ROOT_DIR)/include/salome \
+ -I$(GUI_ROOT_DIR)/include/salome \
+ -I$(srcdir) \
+ -I$(srcdir)/../salomegui \
+ -I$(srcdir)/../salomewrap \
+ $(qt4_cppflags) $(THREAD_DEF) $(PYTHON_CPPFLAGS) $(OMNIORB_CXXFLAGS) $(OMNIORB_INCLUDES) $(BOOST_CPPFLAGS)
+
+
+
+_libYACS_Swig_la_LDFLAGS = -module
+_libYACS_Swig_la_LIBADD = ../salomegui/libYACS.la $(PYTHON_LIBS)
+
+libYACS_SwigWRAP.cxx : $(SWIGSRC) YACSGUI_Swig.hxx doc.i
+ $(SWIG) $(SWIG_PYTHON_OPT) $(SWIG_PYTHON_INCLUDES) $(MYSWIG_FLAGS) -o $@ $<
+
+doc.i:YACSGUI_Swig.hxx YACSGUI_Swig.cxx
+ DOXSRCDIR=$(srcdir) doxygen $(top_srcdir)/Misc/Doxyfile
+ $(PYTHON) $(top_srcdir)/Misc/doxy2swig.py -n xml/index.xml doc.i
+
+EXTRA_DIST = YACSGUI_Swig.hxx
+
+CLEANFILES = libYACS_SwigWRAP.cxx libYACS_Swig.py doc.i
+
+clean-local:
+ rm -f libYACS_Swig.py*
+ rm -rf xml
+
+include $(top_srcdir)/adm/unix/make_end.am
+
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "YACSGUI_Swig.hxx"
+#include <iostream>
+
+#include "SUIT_Desktop.h"
+#include "SUIT_Session.h"
+
+#include "SalomeApp_Application.h"
+#include "SalomeApp_Study.h"
+
+#include "SALOME_Event.h"
+#include "Yacsgui.hxx"
+
+/*! \class YACS_Swig
+ * \brief Interface to YACS GUI
+ *
+ * The YACS_Swig serves as an interface to the YACS GUI to activate it
+ * or to load a schema.
+ * It is wrapped with SWIG so it can be used from python to drive YACS GUI.
+ */
+
+YACS_Swig::YACS_Swig()
+{
+}
+
+YACS_Swig::~YACS_Swig()
+{
+}
+
+//! Activate a module
+/*!
+ * \param module the module name (default "YACS")
+ */
+void YACS_Swig::activate(const std::string& module)
+{
+ class TEvent: public SALOME_Event
+ {
+ YACS_Swig* _obj;
+ std::string _module;
+ public:
+ TEvent(YACS_Swig* obj,const std::string& module) {_obj=obj;_module=module;};
+ virtual void Execute() {
+ _obj->real_activate(_module);
+ };
+ };
+ ProcessVoidEvent(new TEvent(this,module));
+}
+
+void YACS_Swig::real_activate(const std::string& module)
+{
+ SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
+ if (!app) return;
+ SalomeApp_Study* ActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
+ if (!ActiveStudy) return;
+ app->activateModule(QString::fromStdString(module));
+}
+
+//! Load a schema in edit mode or in run mode
+/*!
+ * \param filename the schema file to load
+ * \param edit the loading mode. true for edition (default), false for run
+ */
+void YACS_Swig::loadSchema(const std::string& filename,bool edit, bool arrangeLocalNodes)
+{
+ class TEvent: public SALOME_Event
+ {
+ YACS_Swig* _obj;
+ std::string fn;
+ bool ed;
+ bool ar;
+ public:
+ TEvent(YACS_Swig* obj,const std::string& filename,bool edit,bool arrangeLocalNodes) {
+ _obj=obj;
+ fn=filename;
+ ed=edit;
+ ar=arrangeLocalNodes;
+ };
+ virtual void Execute() {
+ _obj->real_loadSchema(fn,ed,ar);
+ };
+ };
+ ProcessVoidEvent(new TEvent(this,filename,edit,arrangeLocalNodes));
+}
+
+void YACS_Swig::real_loadSchema(const std::string& filename,bool edit, bool arrangeLocalNodes)
+{
+ SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
+ if (!app) return;
+ app->activateModule( "YACS" );
+ CAM_Module* module = app->module("YACS");
+ Yacsgui* appMod = dynamic_cast<Yacsgui*>(module);
+ if (appMod)
+ appMod->loadSchema(filename,edit,arrangeLocalNodes);
+}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef YACSGUI_SWIG_HXX
+#define YACSGUI_SWIG_HXX
+
+#include <string>
+
+class YACS_Swig
+{
+public:
+ YACS_Swig();
+ virtual ~YACS_Swig();
+ virtual void activate(const std::string& module="YACS");
+ virtual void real_activate(const std::string& module);
+ virtual void loadSchema(const std::string& filename,bool edit=true, bool arrangeLocalNodes=false);
+ virtual void real_loadSchema(const std::string& filename,bool edit, bool arrangeLocalNodes);
+};
+
+#endif // YACSGUI_SWIG_HXX
+
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+%define DOCSTRING
+"Module that defines the YACS_Swig class to interact with the YACS GUI
+
+To get a YACS_Swig object use ImportComponentGUI function from salome module :
+ >>> yg=salome.ImportComponentGUI('YACS')"
+%enddef
+
+%module(docstring=DOCSTRING) libYACS_Swig
+
+%{
+#include "YACSGUI_Swig.hxx"
+
+class PyAllowThreadsGuard {
+ public:
+ PyAllowThreadsGuard() { _save = PyEval_SaveThread(); }
+ ~PyAllowThreadsGuard() { PyEval_RestoreThread(_save); }
+ private:
+ PyThreadState *_save;
+};
+
+%}
+
+%include std_string.i
+
+%ignore real_activate;
+%ignore real_loadSchema;
+
+/*
+ managing C++ exception in the Python API
+*/
+%exception
+{
+ PyAllowThreadsGuard guard;
+ $action
+}
+
+#ifdef DOXYGEN_IS_OK
+%include doc.i
+#endif
+%include "YACSGUI_Swig.hxx"
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm/unix/make_begin.am
-dist_salomescript_SCRIPTS =salomeloader.sh
+dist_salomescript_SCRIPTS = salomeloader.sh salomeloader.bat
salomepython_PYTHON = salomeloader.py ElementTree.py ElementPath.py graph.py
+check-local:testSalomeLoader.py
+ python testSalomeLoader.py
+
+EXTRA_DIST = samples
+
+dist-hook:
+ rm -rf `find $(distdir) -name CVS`
+
+install-data-local:
+ $(INSTALL) -d $(DESTDIR)$(prefix)/share/salome/yacssupervsamples
+ cp -rf $(srcdir)/samples/*.xml $(DESTDIR)$(prefix)/share/salome/yacssupervsamples
+
+uninstall-local:
+ rm -rf $(DESTDIR)$(prefix)/share/salome/yacssupervsamples
+
+distclean-local:
+ rm -rf tata.xml
+
include $(top_srcdir)/adm/unix/make_end.am
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-#
-# 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.
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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.
+# 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.
#
-# 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
+# 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.
#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# 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
#
-# -*- coding: iso-8859-1 -*-
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
"""
This module contains graph utilities
"""
import os
-from sets import Set
+#from sets import Set
+Set=set
def invert(G):
"""Construit le graphe inverse de G en inversant les liens de voisinage"""
def reachable(G,n):
"""Construit le set de noeuds atteignables depuis le noeud n
- Le noeud n n'est pas dans le set retourné sauf en cas de boucles
- Ce cas n'est pas traité ici (limitation)
+ Le noeud n n'est pas dans le set retourne sauf en cas de boucles
+ Ce cas n'est pas traite ici (limitation)
"""
s=G[n]
for v in G[n]:
--- /dev/null
+@REM Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+@REM
+@REM This library is free software; you can redistribute it and/or
+@REM modify it under the terms of the GNU Lesser General Public
+@REM License as published by the Free Software Foundation; either
+@REM version 2.1 of the License.
+@REM
+@REM This library is distributed in the hope that it will be useful,
+@REM but WITHOUT ANY WARRANTY; without even the implied warranty of
+@REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+@REM Lesser General Public License for more details.
+@REM
+@REM You should have received a copy of the GNU Lesser General Public
+@REM License along with this library; if not, write to the Free Software
+@REM Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+@REM
+@REM See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+@REM
+
+%PYTHONBIN% -c "import salomeloader;salomeloader.main()" %*
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-#
-# 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.
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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.
+# 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.
#
-# 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
+# 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.
#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# 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
#
-# -*- coding: iso-8859-1 -*-
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
"""This module is used to parse a supervision graph Salome (XML) and convert it into
YACS calculation schema
except ImportError:
import ElementTree
-from sets import Set
+#from sets import Set
+Set=set
import graph
import pilot
import SALOMERuntime
class UnknownKind(Exception):pass
+#global variables
debug=0
typeMap={}
objref=None
+_containers={}
+currentProc=None
def typeName(name):
"""Replace :: in type name by /"""
'3':"CALCIUM_real",
}
-currentProc=None
class SalomeLoader:
"""This class parses a Salome graph (version 3.2.x) and converts it into YACS schema.
The load method calls the loadxml method and creates a YACS object of class Proc
"""
-
def loadxml(self,filename):
"""
Parse a XML file from Salome SUPERV and return a list of SalomeProc objects.
def load(self,filename):
"""Parse a SUPERV XML file (method loadxml) and return a YACS Proc object.
"""
- global currentProc
+ global typeMap,_containers,objref,currentProc
+ typeMap.clear()
+ objref=None
+ _containers.clear()
+ currentProc=None
+
procs=self.loadxml(filename)
#Split the master proc from the possible macros.
proc=procs.pop(0)
def getName(self):
return self.mach+"/"+self.name
-_containers={}
def getContainer(name):
if not name:
name="localhost/FactoryServer"
#!/usr/bin/env python
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
import salomeloader
salomeloader.main()
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!DOCTYPE SuperGraph>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<PyFunc><![CDATA[ else : ]]></PyFunc>
<PyFunc><![CDATA[ index = max ]]></PyFunc>
<PyFunc><![CDATA[ print "---- Init ",index,min,max,aVisu,aView,myResult,x1 ]]></PyFunc>
+ <PyFunc><![CDATA[ aView.Register() ]]></PyFunc>
+ <PyFunc><![CDATA[ myResult.Register() ]]></PyFunc>
<PyFunc><![CDATA[ return index,min,max,aVisu,aView,myResult,x1 ]]></PyFunc> </PyFunction>
<PyFunction>
<FuncName>More</FuncName>
<PyFunc><![CDATA[ else : ]]></PyFunc>
<PyFunc><![CDATA[ DoLoop = 0 ]]></PyFunc>
<PyFunc><![CDATA[ print "---- More",index,min,max,aVisu,aView,myResult,x1 ]]></PyFunc>
+ <PyFunc><![CDATA[ aView.Register() ]]></PyFunc>
+ <PyFunc><![CDATA[ myResult.Register() ]]></PyFunc>
<PyFunc><![CDATA[ return DoLoop,index,min,max,aVisu,aView,myResult,x1 ]]></PyFunc> </PyFunction>
<PyFunction>
<FuncName>Next</FuncName>
<PyFunc><![CDATA[ index = index + 1 ]]></PyFunc>
<PyFunc><![CDATA[ x1=x1+1.0 ]]></PyFunc>
<PyFunc><![CDATA[ print "---- Next",index,min,max,aVisu,aView,myResult,x1 ]]></PyFunc>
+ <PyFunc><![CDATA[ aView.Register() ]]></PyFunc>
+ <PyFunc><![CDATA[ myResult.Register() ]]></PyFunc>
<PyFunc><![CDATA[ return index,min,max,aVisu,aView,myResult,x1 ]]></PyFunc> </PyFunction> </PyFunction-list>
<creation-date>8/4/2005 - 14:3:47</creation-date>
<lastmodification-date>8/4/2005 - 14:3:47</lastmodification-date>
<PyFunc><![CDATA[ print "----- Display 6" ]]></PyFunc>
<PyFunc><![CDATA[ theResult=aResult ]]></PyFunc>
<PyFunc><![CDATA[ #time.sleep(2) ]]></PyFunc>
+ <PyFunc><![CDATA[ theResult.Register() ]]></PyFunc>
<PyFunc><![CDATA[ return theResult ]]></PyFunc>
</PyFunction> </PyFunction-list>
<creation-date>8/4/2005 - 14:3:47</creation-date>
--- /dev/null
+#!/usr/bin/env python
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import sys
+import os
+
+# --- top_builddir is used in make check
+# --- top_srcdir is used in make distcheck
+
+sys.path.insert(0,"@srcdir@")
+sys.path.insert(0,"@top_builddir@/src/engine_swig")
+sys.path.insert(0,"@top_builddir@/src/runtime_swig")
+sys.path.insert(0,"@top_builddir@/src/engine_swig/.libs")
+sys.path.insert(0,"@top_builddir@/src/runtime_swig/.libs")
+sys.path.insert(0,"@top_srcdir@/src/engine_swig")
+sys.path.insert(0,"@top_srcdir@/src/runtime_swig")
+
+import unittest
+import pilot
+import SALOMERuntime
+import salomeloader
+
+class TestSalomeLoader(unittest.TestCase):
+ def setUp(self):
+ SALOMERuntime.RuntimeSALOME_setRuntime()
+ self.loader=salomeloader.SalomeLoader()
+
+ def test1(self):
+ """test GeomGraph.xml"""
+ p= self.loader.load(os.path.join("@srcdir@","samples","GeomGraph.xml"))
+ p.saveSchema("tata.xml")
+
+ def test2(self):
+ """test GeomGraphGates_py.xml"""
+ p= self.loader.load(os.path.join("@srcdir@","samples","GeomGraphGates_py.xml"))
+ p.saveSchema("tata.xml")
+
+ def test3(self):
+ """test GeomGraphGates.xml"""
+ p= self.loader.load(os.path.join("@srcdir@","samples","GeomGraphGates.xml"))
+ p.saveSchema("tata.xml")
+
+ def test4(self):
+ """test GeomGraph_py.xml"""
+ p= self.loader.load(os.path.join("@srcdir@","samples","GeomGraph_py.xml"))
+ p.saveSchema("tata.xml")
+
+ def test5(self):
+ """test Graph_couronne.xml"""
+ p= self.loader.load(os.path.join("@srcdir@","samples","Graph_couronne.xml"))
+ p.saveSchema("tata.xml")
+
+ def test6(self):
+ """test testvisu20.xml"""
+ p= self.loader.load(os.path.join("@srcdir@","samples","testvisu20.xml"))
+ p.saveSchema("tata.xml")
+
+U = os.getenv('USER')
+f=open("/tmp/" + U + "/UnitTestsResult", 'a')
+f.write(" --- TEST src/salomeloader: testSalomeLoader.py\n")
+suite = unittest.makeSuite(TestSalomeLoader)
+result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
+f.close()
+sys.exit(not result.wasSuccessful())
+
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm/unix/make_begin.am
# Libraries targets
lib_LTLIBRARIES = libSalomeWrap.la
dist_libSalomeWrap_la_SOURCES = \
+ SalomeWrapExport.hxx \
+ SalomeWrap_Module.hxx \
SalomeWrap_Module.cxx \
+ SalomeWrap_DataModel.hxx \
SalomeWrap_DataModel.cxx \
+ SuitWrapper.hxx \
SuitWrapper.cxx \
+ WrapGraphicsView.hxx \
WrapGraphicsView.cxx
# MOC pre-processing
MOC_FILES = \
- SalomeWrap_Module_moc.cxx
+ SalomeWrap_Module_moc.cxx \
+ WrapGraphicsView_moc.cxx
nodist_libSalomeWrap_la_SOURCES = $(MOC_FILES)
libSalomeWrap_la_CXXFLAGS = \
$(THREAD_DEF) \
$(PYTHON_CPPFLAGS) \
- $(OMNIORB_INCLUDES) \
+ $(OMNIORB_CXXFLAGS) $(OMNIORB_INCLUDES) \
$(BOOST_CPPFLAGS) \
-I$(KERNEL_ROOT_DIR)/include/salome \
-I$(GUI_ROOT_DIR)/include/salome \
-I$(srcdir)/../bases \
- -I$(srcdir)/../engine \
- -I$(srcdir)/../runtime \
- -I$(srcdir)/../yacsloader \
- -I$(srcdir)/../hmi \
- -I$(srcdir)/../genericgui \
$(qt4_cppflags)
-# $(THREAD_DEF) \
-# $(PYTHON_CPPFLAGS) \
-# $(OMNIORB_INCLUDES) \
-# $(LIBXML_INCLUDES) \
-# $(BOOST_CPPFLAGS) \
-# -I$(KERNEL_ROOT_DIR)/include/salome \
-# -I$(GUI_ROOT_DIR)/include/salome \
-# $(qt4_cppflags) \
-# $(qsci4_cppflags) \
-# @GRAPHVIZ_CPPFLAGS@
-
libSalomeWrap_la_LDFLAGS = \
+ $(KERNEL_LDFLAGS) \
-L$(GUI_ROOT_DIR)/lib/salome \
$(qt4_ldflags)
-# @GRAPHVIZ_LDFLAGS@ \
-# -L$(GUI_ROOT_DIR)/lib/salome -L$(KERNEL_ROOT_DIR)/lib/salome \
-# $(qt4_ldflags)
-
libSalomeWrap_la_LIBADD = \
- $(qt4_libs) \
- -lSalomeApp
+ $(qt4_libs) $(QT_LIBS) $(OMNIORB_LIBS) \
+ ../engine/libYACSlibEngine.la \
+ -lSalomeIDLKernel \
+ -lCAM -lsuit -lLightApp -lqtx -lQxScene -lObjBrowser -lSalomeApp
# resources files
rm -f *_moc.cxx *_qrc.cxx
-clean-local: clean-local-qt
\ No newline at end of file
+clean-local: clean-local-qt
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _SALOMEWRAPEXPORT_HXX_
+#define _SALOMEWRAPEXPORT_HXX_
+
+#ifdef WNT
+# if defined SalomeWrap_EXPORTS
+# define SALOMEWRAP_EXPORT __declspec( dllexport )
+# else
+# define SALOMEWRAP_EXPORT __declspec( dllimport )
+# endif
+#else
+# define SALOMEWRAP_EXPORT
+#endif
+
+#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SalomeWrap_DataModel.hxx"
-#include "guiContext.hxx"
#include <SalomeApp_DataObject.h>
#include <SalomeApp_Study.h>
#include "YacsTrace.hxx"
using namespace std;
-using namespace YACS::HMI;
SalomeWrap_DataModel::SalomeWrap_DataModel(CAM_Module* theModule)
: SalomeApp_DataModel(theModule)
QxScene_ViewWindow *swv = dynamic_cast<QxScene_ViewWindow*>(viewWindow);
if (!swv) return;
- swv->getViewManager()->setTitle(schemaName);
+ QString tabName = QFileInfo(schemaName).baseName();
+ swv->getViewManager()->setTitle(tabName);
}
bool SalomeWrap_DataModel::renameSchema(const QString& oldName,
if (mod) mod->updateObjBrowser();
QxScene_ViewWindow *swv = dynamic_cast<QxScene_ViewWindow*>(viewWindow);
- if (swv) swv->getViewManager()->setTitle(newName);
+ QString tabName = QFileInfo(newName).baseName();
+ if (swv) swv->getViewManager()->setTitle(tabName);
+ return true;
+}
+
+bool SalomeWrap_DataModel::deleteSchema(QWidget* viewWindow)
+{
+ DEBTRACE("SalomeWrap_DataModel::deleteSchema");
+ SalomeApp_ModuleObject* aRoot = dynamic_cast<SalomeApp_ModuleObject*>(root());
+ if (!aRoot) return false;
+ if (!_viewEntryMap.count(viewWindow)) return false;
+
+ _PTR(SComponent) aSComp(aRoot->object());
+ _PTR(Study) aStudy = getStudy()->studyDS();
+
+ string id = _viewEntryMap[viewWindow];
+ _PTR(SObject) aSObj = aStudy->FindObjectID(id);
+
+ _PTR(StudyBuilder) aBuilder(aStudy->NewBuilder());
+ aBuilder->RemoveObject(aSObj);
+
+ SalomeApp_Module *mod = dynamic_cast<SalomeApp_Module*>(module());
+ if (mod) mod->updateObjBrowser();
return true;
}
QxScene_ViewWindow *swv = dynamic_cast<QxScene_ViewWindow*>(viewWindow);
if (!swv) return;
- swv->getViewManager()->setTitle(runName);
+
+ int count = 0;
+ if (_runCountMap.count(schemaName.toStdString()))
+ count = ++_runCountMap[schemaName.toStdString()];
+ else
+ _runCountMap[schemaName.toStdString()] = count;
+
+ QString tabName = QFileInfo(schemaName).baseName() +QString("_run%1").arg(count);
+ swv->getViewManager()->setTitle(tabName);
+
+ QPixmap pixmap;
+ pixmap.load("icons:run_active.png");
+ swv->getViewManager()->setIcon(pixmap);
}
void SalomeWrap_DataModel::setSelected(QWidget* viewWindow)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SALOMEWRAP_DATAMODEL_HXX_
#define _SALOMEWRAP_DATAMODEL_HXX_
+#include "SalomeWrapExport.hxx"
+
#include <SalomeApp_DataModel.h>
#include <QWidget>
#include <map>
#include <string>
-class SalomeWrap_DataModel: public SalomeApp_DataModel
+class SALOMEWRAP_EXPORT SalomeWrap_DataModel: public SalomeApp_DataModel
{
public:
SalomeWrap_DataModel(CAM_Module* theModule);
virtual bool renameSchema(const QString& oldName,
const QString& newName,
QWidget* viewWindow);
+ virtual bool deleteSchema(QWidget* viewWindow);
virtual void createNewRun(const QString& schemaName,
const QString& runName,
QWidget* refWindow,
protected:
std::map<QWidget*, std::string> _viewEntryMap;
std::map<std::string, QWidget*> _entryViewMap;
-
+ std::map<std::string, int> _runCountMap;
};
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "SalomeWrap_Module.hxx"
#include "SalomeWrap_DataModel.hxx"
#include <CAM_DataModel.h>
#include <SUIT_Study.h>
+#include <SUIT_DataBrowser.h>
+#include <QtxTreeView.h>
+#include <SUIT_DataObject.h>
+
#include <cassert>
//#define _DEVDEBUG_
using namespace std;
SalomeWrap_Module::SalomeWrap_Module(const char* name) :
- SalomeApp_Module( name )
+ SalomeApp_Module( name ),
+ LightApp_Module( name )
{
_mapOfViewWindow.clear();
}
svw = svm->createViewWindow();
if (svw) aView = dynamic_cast<QxScene_ViewWindow*>(svw);
}
- assert(aView);
+ YASSERT(aView);
aView->setScene(scene);
_mapOfViewWindow[scene] = aView;
return aView;
return getApp()->activeStudy()->id();
}
+QDockWidget* SalomeWrap_Module::objectBrowser() {
+ QWidget* wid = getApp()->objectBrowser()->treeView();
+
+ if ( !wid ) {
+ return 0;
+ };
+
+ QDockWidget* dock = 0;
+ QWidget* w = wid->parentWidget();
+ while ( w && !dock ) {
+ dock = ::qobject_cast<QDockWidget*>( w );
+ w = w->parentWidget();
+ };
+
+ return dock;
+}
+
+
QAction* SalomeWrap_Module::wCreateAction(const int id,
const QString& toolTip,
const QIcon& icon,
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SALOMEWRAP_MODULE_HXX_
#define _SALOMEWRAP_MODULE_HXX_
+#include "SalomeWrapExport.hxx"
+
#include <SalomeApp_Module.h>
#include <SALOMEconfig.h>
#include <QGraphicsScene>
#include <QGraphicsView>
+#include <QDockWidget>
#include <map>
class SalomeWrap_DataModel;
-class SalomeWrap_Module: public SalomeApp_Module
+class SALOMEWRAP_EXPORT SalomeWrap_Module: public SalomeApp_Module
{
Q_OBJECT
int activeStudyId();
+ QDockWidget* objectBrowser();
+
QAction* wCreateAction(const int id,
const QString& toolTip,
const QIcon& icon,
virtual CAM_DataModel* createDataModel();
std::map<QGraphicsScene*, QxScene_ViewWindow*> _mapOfViewWindow;
+
};
#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
/*!
* only one declaration in src/genericgui,
* implementations in salomewrap and standalonegui
#include "SalomeWrap_DataModel.hxx"
#include <SalomeApp_Module.h>
+#include <SalomeApp_Application.h>
+#include "SUIT_Session.h"
+#include "SUIT_ResourceMgr.h"
+
#include <QxScene_ViewManager.h>
#include <QxScene_ViewModel.h>
#include <QxScene_ViewWindow.h>
QWidget* SuitWrapper::getNewWindow(QGraphicsScene *scene)
{
- SalomeWrap_Module* module = static_cast<SalomeWrap_Module*>(_wrapped);
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
return module->getNewWindow(scene);
}
*/
int SuitWrapper::AssociateViewToWindow(QGraphicsView* gView, QWidget* viewWindow)
{
- SalomeWrap_Module* module = static_cast<SalomeWrap_Module*>(_wrapped);
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
QxScene_ViewWindow *svw = dynamic_cast<QxScene_ViewWindow*>(viewWindow);
- assert(svw);
+ YASSERT(svw);
int studyId = module->AssociateViewToWindow(gView, svw);
WrapGraphicsView* wgv = dynamic_cast<WrapGraphicsView*>(gView);
- assert(wgv);
+ YASSERT(wgv);
QObject::disconnect(svw->toolMgr()->action(QxScene_ViewWindow::FitAllId),
SIGNAL(triggered(bool)),
svw, SLOT(onViewFitAll()));
int SuitWrapper::activeStudyId()
{
- SalomeWrap_Module* module = static_cast<SalomeWrap_Module*>(_wrapped);
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
return module->activeStudyId();
}
+QDockWidget* SuitWrapper::objectBrowser()
+{
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
+ return module->objectBrowser();
+}
+
QAction* SuitWrapper::createAction(const int id,
const QString& toolTip,
const QIcon& icon,
QObject* receiver,
const char* member)
{
- SalomeWrap_Module* module = static_cast<SalomeWrap_Module*>(_wrapped);
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
return module->wCreateAction(id, toolTip, icon, menu, status, shortCut,
parent, checkable, receiver, member);
}
const int groupId,
const int index)
{
- SalomeWrap_Module* module = static_cast<SalomeWrap_Module*>(_wrapped);
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
return module->wCreateMenu(subMenu, parentMenuId, menuId, groupId, index);
}
const int groupId,
const int index)
{
- SalomeWrap_Module* module = static_cast<SalomeWrap_Module*>(_wrapped);
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
return module->wCreateMenu(subMenu, parentMenu, menuId, groupId, index);
}
const int groupId,
const int index)
{
- SalomeWrap_Module* module = static_cast<SalomeWrap_Module*>(_wrapped);
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
return module->wCreateMenu(actionId, menuId, groupId, index);
}
const int groupId,
const int index)
{
- SalomeWrap_Module* module = static_cast<SalomeWrap_Module*>(_wrapped);
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
return module->wCreateMenu(actionId, menu, groupId, index);
}
const int groupId,
const int index)
{
- SalomeWrap_Module* module = static_cast<SalomeWrap_Module*>(_wrapped);
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
return module->wCreateMenu(action, menuId, actionId, groupId, index);
}
const int groupId,
const int index)
{
- SalomeWrap_Module* module = static_cast<SalomeWrap_Module*>(_wrapped);
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
return module->wCreateMenu(action, menu, actionId, groupId, index);
}
int SuitWrapper::createTool(const QString& name)
{
- SalomeWrap_Module* module = static_cast<SalomeWrap_Module*>(_wrapped);
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
return module->wCreateTool(name);
}
const int toolbarId,
const int index)
{
- SalomeWrap_Module* module = static_cast<SalomeWrap_Module*>(_wrapped);
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
return module->wCreateTool(actionId, toolbarId, index);
}
const QString& toolbar,
const int index)
{
- SalomeWrap_Module* module = static_cast<SalomeWrap_Module*>(_wrapped);
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
return module->wCreateTool(actionId, toolbar, index);
}
const int actionId,
const int index)
{
- SalomeWrap_Module* module = static_cast<SalomeWrap_Module*>(_wrapped);
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
return module->wCreateTool(action, toolbarId, actionId, index);
}
const int actionId,
const int index)
{
- SalomeWrap_Module* module = static_cast<SalomeWrap_Module*>(_wrapped);
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
return module->wCreateTool(action, toolbar, actionId, index);
}
void SuitWrapper::setMenuShown(QAction* act, bool show)
{
- SalomeWrap_Module* module = static_cast<SalomeWrap_Module*>(_wrapped);
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
module->setMenuShown(act, show);
}
void SuitWrapper::setToolShown(QAction* act, bool show)
{
- SalomeWrap_Module* module = static_cast<SalomeWrap_Module*>(_wrapped);
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
module->setToolShown(act, show);
}
void SuitWrapper::createNewSchema(const QString& schemaName,
QWidget* viewWindow)
{
- SalomeWrap_Module* module = static_cast<SalomeWrap_Module*>(_wrapped);
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
module->getDataModel()->createNewSchema(schemaName, viewWindow);
}
const QString& newName,
QWidget* viewWindow)
{
- SalomeWrap_Module* module = static_cast<SalomeWrap_Module*>(_wrapped);
- module->getDataModel()->renameSchema(oldName, newName, viewWindow);
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
+ return module->getDataModel()->renameSchema(oldName, newName, viewWindow);
+}
+
+bool SuitWrapper::deleteSchema(QWidget* viewWindow)
+{
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
+ return module->getDataModel()->deleteSchema(viewWindow);
}
void SuitWrapper::createNewRun(const QString& schemaName,
QWidget* refWindow,
QWidget* viewWindow)
{
- SalomeWrap_Module* module = static_cast<SalomeWrap_Module*>(_wrapped);
+ SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
module->getDataModel()->createNewRun(schemaName, runName, refWindow, viewWindow);
}
+
+QStringList SuitWrapper::getQuickDirList()
+{
+ QStringList dirList;
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ if ( resMgr )
+ dirList = resMgr->stringValue( "FileDlg", "QuickDirList" ).split( ';', QString::SkipEmptyParts );
+ return dirList;
+}
+
+void SuitWrapper::onHelpContextModule( const QString& theComponentName, const QString& theFileName, const QString& theContext )
+{
+ LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() );
+ if(app)
+ app->onHelpContextModule( theComponentName, theFileName, theContext );
+}
+
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _SUITWRAPPER_HXX_
+#define _SUITWRAPPER_HXX_
+
+#include "SalomeWrapExport.hxx"
+
+#include <QAction>
+#include <QString>
+#include <QIcon>
+#include <QObject>
+#include <QWidget>
+#include <QDockWidget>
+#include <QGraphicsScene>
+
+namespace YACS
+{
+ namespace HMI
+ {
+ //! viewer QGraphicsScene: deriver SUIT_ViewModel comme QxGraph_Viewer
+ // deriver idem SUIT_ViewManager et SUIT_ViewWindows
+
+ //! wrapping for SalomeApp_Module
+
+ class SALOMEWRAP_EXPORT SuitWrapper
+ {
+
+ public:
+ SuitWrapper(QObject* wrapped);
+ virtual ~SuitWrapper();
+
+ QWidget* getNewWindow(QGraphicsScene *scene);
+ int AssociateViewToWindow(QGraphicsView* gView, QWidget* viewWindow);
+ int activeStudyId();
+ QDockWidget* objectBrowser();
+
+ QAction* createAction(const int id,
+ const QString& toolTip,
+ const QIcon& icon,
+ const QString& menu,
+ const QString& status,
+ const int shortCut,
+ QObject* parent =0,
+ bool checkable = false,
+ QObject* receiver =0,
+ const char* member =0);
+
+ int createMenu(const QString& subMenu,
+ const int parentMenuId,
+ const int menuId = -1,
+ const int groupId = -1,
+ const int index = -1);
+
+ int createMenu(const QString& subMenu,
+ const QString& parentMenu,
+ const int menuId = -1,
+ const int groupId = -1,
+ const int index = -1);
+
+ int createMenu(const int actionId,
+ const int menuId,
+ const int groupId = -1,
+ const int index = -1);
+
+ int createMenu(const int actionId,
+ const QString& menu,
+ const int groupId = -1,
+ const int index = -1);
+
+ int createMenu(QAction* action,
+ const int menuId,
+ const int actionId = -1,
+ const int groupId = -1,
+ const int index = -1);
+
+ int createMenu(QAction* action,
+ const QString& menu,
+ const int actionId = -1,
+ const int groupId = -1,
+ const int index = -1);
+
+ int createTool(const QString& name);
+
+ int createTool(const int actionId,
+ const int toolbarId,
+ const int index = -1);
+
+ int createTool(const int actionId,
+ const QString& toolbar,
+ const int index = -1);
+
+ int createTool(QAction* action,
+ const int toolbarId,
+ const int actionId = -1,
+ const int index = -1);
+
+ int createTool(QAction* action,
+ const QString& toolbar,
+ const int actionId = -1,
+ const int index = -1);
+
+ static QAction* separator();
+
+ void setMenuShown(QAction* act, bool show);
+ void setToolShown(QAction* act, bool show);
+
+ void createNewSchema(const QString& schemaName,
+ QWidget* viewWindow);
+ bool renameSchema(const QString& oldName,
+ const QString& newName,
+ QWidget* viewWindow);
+ bool deleteSchema(QWidget* viewWindow);
+ void createNewRun(const QString& schemaName,
+ const QString& runName,
+ QWidget* refWindow,
+ QWidget* viewWindow);
+ QStringList getQuickDirList();
+ virtual void onHelpContextModule( const QString&, const QString&, const QString& = QString() );
+
+ protected:
+ QObject* _wrapped; // SalomeApp_module or Standalone Application
+
+ };
+ }
+}
+#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
/*!
* only one declaration in src/genericgui,
* implementations in salomewrap and standalonegui
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _WRAPGRAPHICSVIEW_HXX_
+#define _WRAPGRAPHICSVIEW_HXX_
+
+#include "SalomeWrapExport.hxx"
+
+#include <QGraphicsView>
+#include <QContextMenuEvent>
+
+namespace YACS
+{
+ namespace HMI
+ {
+ class SALOMEWRAP_EXPORT WrapGraphicsView: public QGraphicsView
+ {
+ Q_OBJECT
+
+ public:
+ WrapGraphicsView(QWidget *parent = 0);
+ virtual ~WrapGraphicsView();
+
+ public slots:
+ virtual void onViewFitAll();
+ virtual void onViewFitArea();
+ virtual void onViewZoom();
+ virtual void onViewPan();
+ virtual void onViewGlobalPan();
+ virtual void onViewReset();
+ };
+ }
+}
+#endif
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
SUBDIRS=src
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
SUBDIRS = src
#install-exec-hook:
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl @synopsis AC_PROG_SWIG([major.minor.micro])
dnl This macro searches for a SWIG installation on your system. If found you
dnl should) SWIG via $(SWIG). You can use the optional first argument to check
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl @synopsis AC_PYTHON_DEVEL()
dnl Checks for Python and tries to get the include path to 'Python.h'.
dnl It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS) output variable.
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
# Check availability of Salome's KERNEL binary distribution
#
# Author : Jerome Roy (CEA, 2003)
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
# Check availability of Med binary distribution
#
# Author : Nicolas REJNERI (OPEN CASCADE, 2003)
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([CHECK_HDF5],[
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CPP])dnl
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([CHECK_MED2],[
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CPP])dnl
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
#@synonpsis CHECK_PTHREADS
dnl check for pthreads system interfaces.
dnl set CFLAGS_PTHREADS, CXXFLAGS_PTHREADS and LIBS_PTHREADS to
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
## ------------------------
## Python file handling
## From Andrew Dalke
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([CHECK_SWIG],[
AC_REQUIRE([CHECK_PYTHON])dnl
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl modify CFLAGS, CXXFLAGS and LIBS for compiling pthread-based programs.
dnl@author (C) Ruslan Shevchenko <Ruslan@Shevchenko.Kiev.UA>, 1998, 2000
dnl@id $Id$
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl define macros :
dnl AC_ENABLE_PRODUCTION AC_DISABLE_PRODUCTION
dnl AC_ENABLE_DEBUG AC_DISABLE_DEBUG
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
python_cmd = env \
SELF_ROOT_DIR=$(prefix) \
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
SUFFIXES =
#! /bin/bash
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
#
DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
#! /bin/sh
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
run() {
local logfile=$ORIG_DIR/build_configure.log
printf "%-50s" "$1 ... "
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
AC_INIT(salome, 0.1)
AC_CONFIG_SRCDIR(src)
AM_INIT_AUTOMAKE
#! /bin/sh
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
#
# Usage : rfind dir suffix ...
#!/bin/sh
-
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
cd ${CONF_DIR}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Cpp_Template_.hxx"
#include "MEDMEM_Field.hxx"
#include "MEDMEM_Mesh.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _Cpp_Template__HXX_
#define _Cpp_Template__HXX_
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# Common begin part
#
include $(top_srcdir)/adm/unix/make_begin.am
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "Cpp_Template_.hxx"
#include "MEDMEM_Field.hxx"
#include <stdlib.h>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
%module Cpp_Template_SWIG
%{
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# Common begin part
#
include $(top_srcdir)/adm/unix/make_begin.am
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
from os import getenv
if getenv("SALOMEPATH"):
import salome
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# data_DATA =
# datadir =
#
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
SUBDIRS = Cpp_Template__CXX Cpp_Template__SWIG Cpp_Template__TEST
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
SUBDIRS = Cpp_Template_
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl @synopsis AC_C_DEPEND_FLAG
dnl define C_DEPEND_FLAG
dnl define CXX_DEPEND_FLAG
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl @synopsis AC_CXX_OPTION(-option,variable where we add option if ok,action if ok; action if not ok)
dnl Check options for C++ compiler
dnl @author Bernard Secher - 15/01/2004
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
# Check if component environment is either defined or not
#
# Author : Jean-Yves PRADILLON (OPEN CASCADE, 2005)
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
#------------------------------------------------------------
# Check availability of Salome binary distribution
#
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
# Check availability of Salome's KERNEL binary distribution
#
# Author : Jerome Roy (CEA, 2003)
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
# Check availability of Med binary distribution
#
# Author : Anthony GEAY (CEA, 2005)
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2007-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([CHECK_MED2],[
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CPP])dnl
AC_REQUIRE([CHECK_HDF5])dnl
+AC_REQUIRE([MED_CHECK_SIZEOF_MEDINT])
AC_CHECKING(for MED2)
AC_SUBST(MED2_INCLUDES)
AC_SUBST(MED2_LIBS)
AC_SUBST(MED2_MT_LIBS)
+AC_SUBST(MED_CPPFLAGS)
MED2_INCLUDES=""
MED2_LIBS=""
MED2_MT_LIBS=""
+MED_CPPFLAGS="$DEFINED_F77INT64"
med2_ok=no
LOCAL_INCLUDES="$HDF5_INCLUDES"
-LOCAL_LIBS="-lmed $HDF5_LIBS"
+LOCAL_LIBS="-lmed -lmedimportcxx $HDF5_LIBS"
if test -z $MED2HOME
then
dnl check med2 header
+f77int="F77INT32"
+case $host_os in
+ irix5.* | irix6.* | osf4.* | osf5.* | linux* )
+
+ linux64="true"
+# porting on intel processor 64 bits
+ expr "$host_os" : 'linux' >/dev/null && ( test ! x"$host_cpu" = x"x86_64" && test ! x"$host_cpu" = x"ia64" ) && linux64="false"
+ if test ! x"$linux64" = "xfalse" ; then
+ echo "$as_me:$LINENO: checking for 64bits integers size in F77/F90" >&5
+echo $ECHO_N "checking for 64bits integers size in F77/F90... $ECHO_C" >&6
+ # Check whether --enable-int64 or --disable-int64 was given.
+if test "${enable_int64+set}" = set; then
+ enableval="$enable_int64"
+
+fi;
+ case "X-$enable_int64" in
+ X-no)
+ echo "$as_me:$LINENO: result: \"disabled\"" >&5
+echo "${ECHO_T}\"disabled\"" >&6
+ SUFFIXES="_32"
+ ;;
+ *)
+ echo "$as_me:$LINENO: result: \"enabled\"" >&5
+echo "${ECHO_T}\"enabled\"" >&6
+ SUFFIXES=""
+ f77int="F77INT64"
+ ;;
+ esac
+ fi
+ ;;
+ *)
+ ;;
+esac
+
+case $host_os in
+ linux*)
+ test x"$linux64" = x"true" && \
+ MACHINE="PCLINUX64${SUFFIXES}" || \
+ MACHINE=PCLINUX
+ ;;
+ hpux*)
+ MACHINE=HP9000
+ ;;
+ aix4.*)
+ MACHINE=RS6000
+ host_os_novers=aix4.x
+ ;;
+ irix5.*)
+ MACHINE="IRIX64${SUFFIXES}"
+ host_os_novers=irix5.x
+ ;;
+ irix6.*)
+ MACHINE="IRIX64${SUFFIXES}"
+ host_os_novers=irix6.x
+ ;;
+ osf4.*)
+ MACHINE="OSF1${SUFFIXES}"
+ host_os_novers=osf4.x
+ ;;
+ osf5.*)
+ MACHINE="OSF1${SUFFIXES}"
+ host_os_novers=osf5.x
+ ;;
+ solaris2.*)
+ MACHINE=SUN4SOL2
+ host_os_novers=solaris2.x
+ ;;
+ uxpv*)
+ MACHINE=VPP5000
+ ;;
+ *)
+ MACHINE=
+ host_os_novers=$host_os
+ ;;
+esac
+
CPPFLAGS_old="$CPPFLAGS"
dnl we must test system : linux = -DPCLINUX
dnl we must test system : Alpha-OSF = -DOSF1
case $host_os in
linux*)
- CPPFLAGS="$CPPFLAGS -DPCLINUX $LOCAL_INCLUDES"
+ CPPFLAGS="$CPPFLAGS -D$MACHINE $LOCAL_INCLUDES"
+dnl CPPFLAGS="$CPPFLAGS -DPCLINUX $LOCAL_INCLUDES"
;;
osf*)
CPPFLAGS="$CPPFLAGS -DOSF1 $LOCAL_INCLUDES"
LIBS_old="$LIBS"
LIBS="$LIBS $LOCAL_LIBS"
AC_CHECK_LIB(med,MEDouvrir,med2_ok=yes,med2_ok=no)
- LIBS="$LIBS_old"
+ if test "x$med2_ok" = "xyes"
+ then
+ AC_CHECK_LIB(medimportcxx,HAVE_MEDimport,med2_ok=yes,med2_ok=no)
+ fi
+ LIBS="$LIBS_old"
+
fi
if test "x$med2_ok" = "xyes"
then
case $host_os in
linux*)
- MED2_INCLUDES="-DPCLINUX $LOCAL_INCLUDES"
+ MED2_INCLUDES="-D$MACHINE $LOCAL_INCLUDES"
+dnl MED2_INCLUDES="-DPCLINUX $LOCAL_INCLUDES"
;;
osf*)
MED2_INCLUDES="-DOSF1 $LOCAL_INCLUDES"
MED2_MT_LIBS="$LOCAL_LIBS"
fi
+
AC_MSG_RESULT(for med2: $med2_ok)
])dnl
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([CHECK_HDF5],[
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CPP])dnl
+++ /dev/null
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-dnl
-AC_DEFUN([CHECK_MED2],[
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_CPP])dnl
-AC_REQUIRE([CHECK_HDF5])dnl
-AC_REQUIRE([AC_DEPEND_FLAG])dnl
-
-AC_CHECKING(for MED2)
-
-AC_ARG_WITH(med2,
- [ --with-med2=DIR root directory path to med2 installation ],
- [MED2HOME="$withval"
- AC_MSG_RESULT("select $withval as path to med2")
- ])
-
-AC_SUBST(MED2_INCLUDES)
-AC_SUBST(MED2_LIBS)
-AC_SUBST(MED2_MT_LIBS)
-
-MED2_INCLUDES=""
-MED2_LIBS=""
-MED2_MT_LIBS=""
-
-LOCAL_INCLUDES=""
-LOCAL_LIBS=""
-
-med2_ok=no
-
-dnl check, if there is MED library
-if test -z $MED2HOME
-then
- AC_MSG_WARN(undefined MED2HOME variable which specify med2 installation directory)
- AC_PATH_PROG(MDUMP, mdump)
- if test "xMDUMP" != "x" ; then
- MED2HOME=$MDUMP
- MED2HOME=`echo ${MED2HOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
- MED2HOME=`echo ${MED2HOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
- fi
-fi
-if test ! -z $MED2HOME
-then
- LOCAL_INCLUDES="$HDF5_INCLUDES -I$MED2HOME/include"
- if test "x$MED2HOME" = "x/usr"
- then
- LOCAL_LIBS="-lmed $HDF5_LIBS"
- else
- LOCAL_LIBS="-L$MED2HOME/lib -lmed $HDF5_LIBS"
- fi
-fi
-
-dnl check med2 header
-CPPFLAGS_old="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS -D$MACHINE $LOCAL_INCLUDES"
-AC_CHECK_HEADER(med.h,med2_ok=yes ,med2_ok=no)
-CPPFLAGS="$CPPFLAGS_old"
-
-dnl check med2 library
-if test "x$med2_ok" = "xyes"
-then
- LIBS_old="$LIBS"
- LIBS="$LIBS $LOCAL_LIBS"
- AC_CHECK_LIB(med,MEDouvrir,med2_ok=yes,med2_ok=no)
- LIBS="$LIBS_old"
-fi
-
-if test "x$med2_ok" = "xyes"
-then
- MED2_INCLUDES="-D$MACHINE $LOCAL_INCLUDES"
- MED2_LIBS="$LOCAL_LIBS"
- MED2_MT_LIBS="$LOCAL_LIBS"
-fi
-
-AC_MSG_RESULT(for med2: $med2_ok)
-
-])dnl
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([CHECK_OMNIORB],[
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CXX])dnl
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
#@synonpsis CHECK_PTHREADS
dnl check for pthreads system interfaces.
dnl set CFLAGS_PTHREADS, CXXFLAGS_PTHREADS and LIBS_PTHREADS to
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl modify CFLAGS, CXXFLAGS and LIBS for compiling pthread-based programs.
dnl@author (C) Ruslan Shevchenko <Ruslan@Shevchenko.Kiev.UA>, 1998, 2000
dnl@id $Id$
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl @synopsis AC_PYTHON_DEVEL()
dnl Checks for Python and tries to get the include path to 'Python.h'.
dnl It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS) output variable.
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# common directories to put headerfiles
#
inc_builddir=$(top_builddir)/include/salome
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
#=======================================================================
# Begin specific part to omniorb
# (include from file adm/unix/make_omniorb generated by
#!/bin/sh
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
export KERNEL_ROOT_DIR=@KERNEL_ROOT_DIR@
#!/usr/bin/env python
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
usage="""USAGE: runSalome.py [options]
[command line options] :
#!/bin/bash
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# Tool for updating list of .in file for the SALOME project
# and regenerating configure script
# Author : Marc Tajchman - CEA
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# PLEASE DO NOT MODIFY configure.in FILE
# ALL CHANGES WILL BE DISCARDED BY THE NEXT
# build_configure COMMAND
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __HXX2SALOME_GENERIC_CLASS_NAME_GEN_hxx2salome__
#define __HXX2SALOME_GENERIC_CLASS_NAME_GEN_hxx2salome__
{
/*! \brief Interface of the %HXX2SALOME_GENERIC_CLASS_NAME component
*/
- interface HXX2SALOME_GENERIC_CLASS_NAME_Gen : Engines::Component, SALOME::MultiCommClass
+ interface HXX2SALOME_GENERIC_CLASS_NAME_Gen : Engines::EngineComponent, SALOME::MultiCommClass
{
HXX2SALOME_IDL_CODE
};
};
#endif
-
<?xml version='1.0' encoding='us-ascii'?>
<!DOCTYPE application PUBLIC "" "desktop.dtd">
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<?xml version='1.0' encoding='us-ascii'?>
<!DOCTYPE application PUBLIC "" "desktop.dtd">
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
mport salome
import HXX2SALOME_GENERIC_CLASS_NAME_ORB
myHXX2SALOME_GENERIC_CLASS_NAME = salome.lcc.FindOrLoadComponent("FactoryServer", "HXX2SALOME_GENERIC_CLASS_NAME")
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "HXX2SALOME_GENERIC_CLASS_NAME_i.hxx"
// HXX2SALOME_CPP_INCLUDE
using namespace std;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __HXX2SALOME_GENERIC_CLASS_NAME_HXX_hxx2salome__
#define __HXX2SALOME_GENERIC_CLASS_NAME_HXX_hxx2salome__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "HXX2SALOME_GENERIC_CLASS_NAMEGUI.h"
#include <SUIT_MessageBox.h>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// HXX2SALOME_GENERIC_CLASS_NAMEGUI : HXX2SALOME_GENERIC_CLASS_NAME component GUI implemetation
//
#ifndef _HXX2SALOME_GENERIC_CLASS_NAMEGUI_H_
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
# would be translated to "Pub", not "Foo::Pub".
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. translating
# from French to English, "Foo::Bar" would be translated to "Pub",
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. translating
# from French to English, "Foo::Bar" would be translated to "Pub",
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm_local/unix/make_common_starter.am
if SALOME_KERNEL
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
SUBDIRS = unix
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm_local/unix/make_common_starter.am
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef SALOME_CONFIG_H
#define SALOME_CONFIG_H
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl Synopsis : AC_CC_WARNINGS([ANSI])
dnl Version : 1.1 (2000/12/31)
dnl Author : Ville Laurikari <vl@iki.fi>
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl @synopsis AC_C_DEPEND_FLAG
dnl define C_DEPEND_FLAG
dnl define CXX_DEPEND_FLAG
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl @synopsis AC_CXX_HAVE_SSTREAM
dnl If the C++ library has a working stringstream, define HAVE_SSTREAM.
dnl @author Ben Stanley
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl @synopsis AC_CXX_NAMESPACES
dnl If the compiler can prevent names clashes using namespaces, define
dnl HAVE_NAMESPACES.
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl @synopsis AC_CXX_OPTION(-option,variable where we add option if ok,action if ok; action if not ok)
dnl Check options for C++ compiler
dnl @author Bernard Secher - 15/01/2004
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl @synopsis AC_CXX_TEMPLATE_OPTIONS
dnl Check template options for C++ compiler
dnl
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl @synopsis AC_CXX_USE_STD_IOSTREAM
dnl If the C++ library use std iostream
dnl
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl @synopsis AC_CXX_WARNINGS
dnl Check warning flags for C++ compiler to control warning messages
dnl
AC_CXX_OPTION(-Wno-deprecated,CXXFLAGS)
AC_CXX_OPTION(-Wparentheses,CXXFLAGS)
AC_CXX_OPTION(-Wreturn-type,CXXFLAGS)
- AC_CXX_OPTION(-Wmissing-declarations,CXXFLAGS)
AC_CXX_OPTION(-Wunused,CXXFLAGS)
])
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl @synopsis AC_LINKER_OPTIONS
dnl Check warning flags for C++ compiler to control warning messages
dnl
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
# Check if component environment is either defined or not
#
# Author : Jean-Yves PRADILLON (OPEN CASCADE, 2005)
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
#------------------------------------------------------------
# Check availability of Salome binary distribution
#
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
# Check availability of Salome's KERNEL binary distribution
#
# Author : Jerome Roy (CEA, 2003)
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
# Check availability of Med binary distribution
#
# Author : Anthony GEAY (CEA, 2005)
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2007-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([CHECK_MED2],[
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CPP])dnl
AC_REQUIRE([CHECK_HDF5])dnl
+AC_REQUIRE([MED_CHECK_SIZEOF_MEDINT])
AC_CHECKING(for MED2)
AC_SUBST(MED2_INCLUDES)
AC_SUBST(MED2_LIBS)
AC_SUBST(MED2_MT_LIBS)
+AC_SUBST(MED_CPPFLAGS)
MED2_INCLUDES=""
MED2_LIBS=""
MED2_MT_LIBS=""
+MED_CPPFLAGS="$DEFINED_F77INT64"
med2_ok=no
LOCAL_INCLUDES="$HDF5_INCLUDES"
-LOCAL_LIBS="-lmed $HDF5_LIBS"
+LOCAL_LIBS="-lmed -lmedimportcxx $HDF5_LIBS"
if test -z $MED2HOME
then
dnl check med2 header
+f77int="F77INT32"
+case $host_os in
+ irix5.* | irix6.* | osf4.* | osf5.* | linux* )
+
+ linux64="true"
+# porting on intel processor 64 bits
+ expr "$host_os" : 'linux' >/dev/null && ( test ! x"$host_cpu" = x"x86_64" && test ! x"$host_cpu" = x"ia64" ) && linux64="false"
+ if test ! x"$linux64" = "xfalse" ; then
+ echo "$as_me:$LINENO: checking for 64bits integers size in F77/F90" >&5
+echo $ECHO_N "checking for 64bits integers size in F77/F90... $ECHO_C" >&6
+ # Check whether --enable-int64 or --disable-int64 was given.
+if test "${enable_int64+set}" = set; then
+ enableval="$enable_int64"
+
+fi;
+ case "X-$enable_int64" in
+ X-no)
+ echo "$as_me:$LINENO: result: \"disabled\"" >&5
+echo "${ECHO_T}\"disabled\"" >&6
+ SUFFIXES="_32"
+ ;;
+ *)
+ echo "$as_me:$LINENO: result: \"enabled\"" >&5
+echo "${ECHO_T}\"enabled\"" >&6
+ SUFFIXES=""
+ f77int="F77INT64"
+ ;;
+ esac
+ fi
+ ;;
+ *)
+ ;;
+esac
+
+case $host_os in
+ linux*)
+ test x"$linux64" = x"true" && \
+ MACHINE="PCLINUX64${SUFFIXES}" || \
+ MACHINE=PCLINUX
+ ;;
+ hpux*)
+ MACHINE=HP9000
+ ;;
+ aix4.*)
+ MACHINE=RS6000
+ host_os_novers=aix4.x
+ ;;
+ irix5.*)
+ MACHINE="IRIX64${SUFFIXES}"
+ host_os_novers=irix5.x
+ ;;
+ irix6.*)
+ MACHINE="IRIX64${SUFFIXES}"
+ host_os_novers=irix6.x
+ ;;
+ osf4.*)
+ MACHINE="OSF1${SUFFIXES}"
+ host_os_novers=osf4.x
+ ;;
+ osf5.*)
+ MACHINE="OSF1${SUFFIXES}"
+ host_os_novers=osf5.x
+ ;;
+ solaris2.*)
+ MACHINE=SUN4SOL2
+ host_os_novers=solaris2.x
+ ;;
+ uxpv*)
+ MACHINE=VPP5000
+ ;;
+ *)
+ MACHINE=
+ host_os_novers=$host_os
+ ;;
+esac
+
CPPFLAGS_old="$CPPFLAGS"
dnl we must test system : linux = -DPCLINUX
dnl we must test system : Alpha-OSF = -DOSF1
case $host_os in
linux*)
- CPPFLAGS="$CPPFLAGS -DPCLINUX $LOCAL_INCLUDES"
+ CPPFLAGS="$CPPFLAGS -D$MACHINE $LOCAL_INCLUDES"
+dnl CPPFLAGS="$CPPFLAGS -DPCLINUX $LOCAL_INCLUDES"
;;
osf*)
CPPFLAGS="$CPPFLAGS -DOSF1 $LOCAL_INCLUDES"
LIBS_old="$LIBS"
LIBS="$LIBS $LOCAL_LIBS"
AC_CHECK_LIB(med,MEDouvrir,med2_ok=yes,med2_ok=no)
- LIBS="$LIBS_old"
+ if test "x$med2_ok" = "xyes"
+ then
+ AC_CHECK_LIB(medimportcxx,HAVE_MEDimport,med2_ok=yes,med2_ok=no)
+ fi
+ LIBS="$LIBS_old"
+
fi
if test "x$med2_ok" = "xyes"
then
case $host_os in
linux*)
- MED2_INCLUDES="-DPCLINUX $LOCAL_INCLUDES"
+ MED2_INCLUDES="-D$MACHINE $LOCAL_INCLUDES"
+dnl MED2_INCLUDES="-DPCLINUX $LOCAL_INCLUDES"
;;
osf*)
MED2_INCLUDES="-DOSF1 $LOCAL_INCLUDES"
MED2_MT_LIBS="$LOCAL_LIBS"
fi
+
AC_MSG_RESULT(for med2: $med2_ok)
])dnl
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([CHECK_BOOST],[
AC_CHECKING(for BOOST Library)
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([CHECK_CAS],[
AC_REQUIRE([AC_PROG_CXX])dnl
AC_REQUIRE([AC_PROG_CXXCPP])dnl
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([CHECK_CORBA],[
if test x"$DEFAULT_ORB" = x"omniORB"
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([CHECK_HDF5],[
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CPP])dnl
+++ /dev/null
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-dnl
-AC_DEFUN([CHECK_MED2],[
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_CPP])dnl
-AC_REQUIRE([CHECK_HDF5])dnl
-AC_REQUIRE([AC_DEPEND_FLAG])dnl
-
-AC_CHECKING(for MED2)
-
-AC_ARG_WITH(med2,
- [ --with-med2=DIR root directory path to med2 installation ],
- [MED2HOME="$withval"
- AC_MSG_RESULT("select $withval as path to med2")
- ])
-
-AC_SUBST(MED2_INCLUDES)
-AC_SUBST(MED2_LIBS)
-AC_SUBST(MED2_MT_LIBS)
-
-MED2_INCLUDES=""
-MED2_LIBS=""
-MED2_MT_LIBS=""
-
-LOCAL_INCLUDES=""
-LOCAL_LIBS=""
-
-med2_ok=no
-
-dnl check, if there is MED library
-if test -z $MED2HOME
-then
- AC_MSG_WARN(undefined MED2HOME variable which specify med2 installation directory)
- AC_PATH_PROG(MDUMP, mdump)
- if test "xMDUMP" != "x" ; then
- MED2HOME=$MDUMP
- MED2HOME=`echo ${MED2HOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
- MED2HOME=`echo ${MED2HOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
- fi
-fi
-if test ! -z $MED2HOME
-then
- LOCAL_INCLUDES="$HDF5_INCLUDES -I$MED2HOME/include"
- if test "x$MED2HOME" = "x/usr"
- then
- LOCAL_LIBS="-lmed $HDF5_LIBS"
- else
- LOCAL_LIBS="-L$MED2HOME/lib -lmed $HDF5_LIBS"
- fi
-fi
-
-dnl check med2 header
-CPPFLAGS_old="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS -D$MACHINE $LOCAL_INCLUDES"
-AC_CHECK_HEADER(med.h,med2_ok=yes ,med2_ok=no)
-CPPFLAGS="$CPPFLAGS_old"
-
-dnl check med2 library
-if test "x$med2_ok" = "xyes"
-then
- LIBS_old="$LIBS"
- LIBS="$LIBS $LOCAL_LIBS"
- AC_CHECK_LIB(med,MEDouvrir,med2_ok=yes,med2_ok=no)
- LIBS="$LIBS_old"
-fi
-
-if test "x$med2_ok" = "xyes"
-then
- MED2_INCLUDES="-D$MACHINE $LOCAL_INCLUDES"
- MED2_LIBS="$LOCAL_LIBS"
- MED2_MT_LIBS="$LOCAL_LIBS"
-fi
-
-AC_MSG_RESULT(for med2: $med2_ok)
-
-])dnl
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
# Check availability of Qt's msg2qm tool binary distribution
#
# Author : Jerome Roy (CEA, 2003)
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([CHECK_OMNIORB],[
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CXX])dnl
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([CHECK_OPENGL],[
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CPP])dnl
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
#@synonpsis CHECK_PTHREADS
dnl check for pthreads system interfaces.
dnl set CFLAGS_PTHREADS, CXXFLAGS_PTHREADS and LIBS_PTHREADS to
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
## ------------------------
## Python file handling
## From Andrew Dalke
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
AC_DEFUN([CHECK_QT],[
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CXX])dnl
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl modify CFLAGS, CXXFLAGS and LIBS for compiling pthread-based programs.
dnl@author (C) Ruslan Shevchenko <Ruslan@Shevchenko.Kiev.UA>, 1998, 2000
dnl@id $Id$
-dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+dnl Copyright (C) 2006-2012 CEA/DEN, EDF R&D
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
+
dnl define macros :
dnl AC_ENABLE_PRODUCTION AC_DISABLE_PRODUCTION
dnl AC_ENABLE_DEBUG AC_DISABLE_DEBUG
AC_CXX_OPTION(-Wno-deprecated,CXXFLAGS)
AC_CXX_OPTION(-Wparentheses,CXXFLAGS)
AC_CXX_OPTION(-Wreturn-type,CXXFLAGS)
-AC_CXX_OPTION(-Wmissing-declarations,CXXFLAGS)
AC_CXX_OPTION(-fmessage-length=0,CXXFLAGS)
AC_CXX_OPTION(-Wunused,CXXFLAGS)
AC_CXX_OPTION(-pipe,CXXFLAGS)
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
EXTRA_DIST = $(wildcard $(srcdir)/*.hxx) $(wildcard $(srcdir)/*.h)
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# ============================================================
# This file defines the common definitions used in several
# Makefile. This file must be included, if needed, by the file
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
SUFFIXES =
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
#!/bin/sh
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
export KERNEL_ROOT_DIR=@KERNEL_ROOT_DIR@
#!/usr/bin/env python
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
usage="""USAGE: runSalome.py [options]
[command line options] :
#! /bin/sh
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# --
#
PROJECT="HXX2SALOME_GENERIC_CLASS_NAMEComponent"
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
AM_INIT_AUTOMAKE
AC_CANONICAL_HOST
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm_local/unix/make_common_starter.am
SUBDIRS =
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __HXX2SALOME_GENERIC_CLASS_NAME_GEN_hxx2salome__
#define __HXX2SALOME_GENERIC_CLASS_NAME_GEN_hxx2salome__
{
/*! \brief Interface of the %HXX2SALOME_GENERIC_CLASS_NAME component
*/
- interface HXX2SALOME_GENERIC_CLASS_NAME_Gen : Engines::Component, SALOME::MultiCommClass
+ interface HXX2SALOME_GENERIC_CLASS_NAME_Gen : Engines::EngineComponent, SALOME::MultiCommClass
{
// HXX2SALOME_IDL_CODE
};
};
#endif
-
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm_local/unix/make_common_starter.am
<?xml version='1.0' encoding='us-ascii'?>
<!DOCTYPE application PUBLIC "" "desktop.dtd">
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<?xml version='1.0' encoding='us-ascii'?>
<!DOCTYPE application PUBLIC "" "desktop.dtd">
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm_local/unix/make_common_starter.am
#
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
#! /bin/sh
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# Author : Erwan ADAM (CEA)
# --
#!/bin/sh
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "HXX2SALOME_GENERIC_CLASS_NAMEGUI.h"
#include <SUIT_MessageBox.h>
// Gets a reference to the module's engine
HXX2SALOME_GENERIC_CLASS_NAME_ORB::HXX2SALOME_GENERIC_CLASS_NAME_Gen_ptr HXX2SALOME_GENERIC_CLASS_NAMEGUI::InitHXX2SALOME_GENERIC_CLASS_NAMEGen( SalomeApp_Application* app )
{
- Engines::Component_var comp = app->lcc()->FindOrLoad_Component( "FactoryServer",COMPONENT_NAME );
+ Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( "FactoryServer",COMPONENT_NAME );
HXX2SALOME_GENERIC_CLASS_NAME_ORB::HXX2SALOME_GENERIC_CLASS_NAME_Gen_ptr clr = HXX2SALOME_GENERIC_CLASS_NAME_ORB::HXX2SALOME_GENERIC_CLASS_NAME_Gen::_narrow(comp);
ASSERT(!CORBA::is_nil(clr));
return clr;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// HXX2SALOME_GENERIC_CLASS_NAMEGUI : HXX2SALOME_GENERIC_CLASS_NAME component GUI implemetation
//
#ifndef _HXX2SALOME_GENERIC_CLASS_NAMEGUI_H_
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
# would be translated to "Pub", not "Foo::Pub".
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. translating
# from French to English, "Foo::Bar" would be translated to "Pub",
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. translating
# from French to English, "Foo::Bar" would be translated to "Pub",
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm_local/unix/make_common_starter.am
USE_MED=0
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
mport salome
import HXX2SALOME_GENERIC_CLASS_NAME_ORB
myHXX2SALOME_GENERIC_CLASS_NAME = salome.lcc.FindOrLoadComponent("FactoryServer", "HXX2SALOME_GENERIC_CLASS_NAME")
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "HXX2SALOME_GENERIC_CLASS_NAME_i.hxx"
// HXX2SALOME_CPP_INCLUDE
using namespace std;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __HXX2SALOME_GENERIC_CLASS_NAME_HXX_hxx2salome__
#define __HXX2SALOME_GENERIC_CLASS_NAME_HXX_hxx2salome__
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm_local/unix/make_common_starter.am
USE_MED=0
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm_local/unix/make_common_starter.am
if SALOME_KERNEL
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
bindir=${prefix}/bin/HXX2SALOME_Test
ENV_SH=$(DESTDIR)${bindir}/env_HXX2SALOME.sh
#! /bin/bash
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
export BASE=PREFIX/tests
export COMP_NAME=HXX2SALOME_GENERIC_CLASS_NAME
export COMP_BASE=${BASE}/${COMP_NAME}
#! /bin/bash
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
BE_QUIET=0
# salome2 environment file (.bash or .sh) - can also be specified with -e option
ENVIRON_FILE=
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
check_arguments()
{
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
generate_corba_module_source()
{
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
generate_cpp_module_source()
{
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# This awk program suppresses inline functions - but it doen't work if there is no inline function... Not used yet.
BEGIN { RS="\f"}
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# This awk program deletes C like comments '*/ ... /*'
+
{
if (t = index($0, "/*")) {
if (t > 1)
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# This awk program extract public functions of the class definition present in hxx interface
BEGIN { public=0 }
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# suppress blanks between type and indirection or reference operators (* and &)
{ gsub(/[ \t]+&/,"\\& ")
gsub(/[ \t]+\*/,"* ")
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# This awk program contains the type mapping tables - and the treatments
# for code generation
#
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# This awk program checks the arguments and return value compatibility
#
BEGIN {
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# This awk program contains the type mapping tables - and the treatments
# for code generation
#
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
# This awk program generates the catalog for C++ components
#
BEGIN {
#! /bin/bash
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
usage()
#! /bin/bash
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# print the help message ====================================
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "LoadState.hxx"
#include "Proc.hxx"
#include "Node.hxx"
else
node = _p->getChildByName(nodeName);
- assert(_nodeStateValue.find(nodeState) != _nodeStateValue.end());
+ YASSERT(_nodeStateValue.find(nodeState) != _nodeStateValue.end());
YACS::ENGINE::StateLoader(node, _nodeStateValue[nodeState]);
if (nodeType == "forLoop")
void attrParser::onEnd (const XML_Char* name)
{
// cerr << "end attrParser " << name << " " << _stackParser.size() << endl;
- assert(_father);
+ YASSERT(_father);
_father->setAttribute((char*)name, _attrValue);
stateParser::onEnd(name);
}
DEBTRACE("portParser::init()");
_state = XMLINPORT;
_father = father;
- assert( dynamic_cast<nodeParser*> (father));
+ YASSERT( dynamic_cast<nodeParser*> (father));
_stackState.push(_state);
if (p) getAttributes(p);
}
if (nodeType == "elementaryNode")
{
ElementaryNode* eNode = dynamic_cast<ElementaryNode*>(node);
- assert(eNode);
+ YASSERT(eNode);
InputPort *port = eNode->getInputPort(_mapAttrib["name"]);
if(_data != "")
port->edInit("XML",_data.c_str());
string elem = (char *) name;
//if (elem == "value" || elem == "data" || elem == "array")
stateParser::onEnd(name);
- //else assert(0); //DEBTRACE("valueParser::onEnd " << elem);
+ //else YASSERT(0); //DEBTRACE("valueParser::onEnd " << elem);
}
// ----------------------------------------------------------------------------
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __LOADSTATE_HXX_
#define __LOADSTATE_HXX_
+#include "YACSloaderExport.hxx"
#include "xmlParserBase.hxx"
#include "define.hxx"
* \param p: the Proc
* \param xmlStateFile: the file name
*/
- void loadState(YACS::ENGINE::Proc *p,const std::string& xmlStateFile);
+ YACSLOADER_EXPORT void loadState(YACS::ENGINE::Proc *p,const std::string& xmlStateFile);
/*! \brief class for parse an xml file, use a dedicated parser, to load a
* saved state of a SALOME execution.
*/
- class stateLoader: public xmlReader
+ class YACSLOADER_EXPORT stateLoader: public xmlReader
{
public:
stateLoader(xmlParserBase* parser,
* defined in the xml file
*/
- class stateParser: public xmlParserBase
+ class YACSLOADER_EXPORT stateParser: public xmlParserBase
{
public:
static XMLReadState _state;
static std::map<std::string, YACS::StatesForNode> _nodeStates;
};
- class graphParser: public stateParser
+ class YACSLOADER_EXPORT graphParser: public stateParser
{
public:
virtual void init(const xmlChar** p, xmlParserBase* father=0);
};
- class nodeParser: public stateParser
+ class YACSLOADER_EXPORT nodeParser: public stateParser
{
public:
virtual void init(const xmlChar** p, xmlParserBase* father=0);
std::string _nodeState;
};
- class attrParser: public stateParser
+ class YACSLOADER_EXPORT attrParser: public stateParser
{
public:
virtual void init(const xmlChar** p, xmlParserBase* father=0);
};
- class portParser: public stateParser
+ class YACSLOADER_EXPORT portParser: public stateParser
{
public:
virtual void init(const xmlChar** p, xmlParserBase* father=0);
virtual void addData(std::string value);
};
- class valueParser: public stateParser
+ class YACSLOADER_EXPORT valueParser: public stateParser
{
public:
virtual void init(const xmlChar** p, xmlParserBase* father=0);
virtual void addData(std::string value);
};
- class arrayParser: public stateParser
+ class YACSLOADER_EXPORT arrayParser: public stateParser
{
public:
virtual void init(const xmlChar** p, xmlParserBase* father=0);
virtual void addData(std::string value);
};
- class dataParser: public stateParser
+ class YACSLOADER_EXPORT dataParser: public stateParser
{
public:
virtual void init(const xmlChar** p, xmlParserBase* father=0);
std::list<std::string> _dataList;
};
- class simpleTypeParser: public stateParser
+ class YACSLOADER_EXPORT simpleTypeParser: public stateParser
{
public:
virtual void init(const xmlChar** p, xmlParserBase* father=0);
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm/unix/make_begin.am
+if CPPUNIT_IS_OK
SUBDIRS = Test
+endif
bin_PROGRAMS=driver debugger resume
propertyParsers.cxx containerParsers.cxx xmlrpcParsers.cxx \
rootParser.cxx codeParsers.cxx \
LoadState.cxx xmlParserBase.cxx ProcCataLoader.cxx \
+ componentinstanceParsers.cxx \
$(__dummy__)
salomeinclude_HEADERS = \
+YACSloaderExport.hxx \
blocParsers.hxx codeParsers.hxx containerParsers.hxx dataParsers.hxx factory.hxx \
linkParsers.hxx LoadState.hxx loopParsers.hxx nodeParsers.hxx outputParsers.hxx \
parserBase.hxx parsers.hxx portParsers.hxx presetParsers.hxx ProcCataLoader.hxx \
-procParsers.hxx propertyParsers.hxx rootParser.hxx switchParsers.hxx \
-typeParsers.hxx xmlParserBase.hxx xmlrpcParsers.hxx
+procParsers.hxx propertyParsers.hxx rootParser.hxx switchParsers.hxx inlineParsers.hxx \
+componentinstanceParsers.hxx remoteParsers.hxx serverParsers.hxx serviceParsers.hxx \
+typeParsers.hxx xmlParserBase.hxx xmlrpcParsers.hxx sinlineParsers.hxx
EXTRA_libYACSloader_la_SOURCES = \
$(__dummy__)
libYACSloader_la_LIBADD = ../engine/libYACSlibEngine.la
-libYACSloader_la_LDFLAGS = $(EXPAT_LIBS)
+libYACSloader_la_LDFLAGS = $(OMNIORB_LIBS) $(EXPAT_LIBS)
AM_CXXFLAGS = \
$(THREAD_DEF) \
-I$(srcdir)/../engine
if SALOME_KERNEL
-SALOME_LIBS=-L$(KERNEL_ROOT_DIR)/lib/salome -lSalomeLifeCycleCORBA
+SALOME_LIBS=$(KERNEL_LDFLAGS) -lSalomeLifeCycleCORBA -lSalomeIDLKernel -lSalomeNS -lOpUtil \
+ -lSalomeDSCContainer -lSalomeContainer -lSALOMEBasics -lSalomeResourcesManager \
+ -lSALOMELocalTrace -lRegistry -lSalomeNotification -lResourcesManager \
+ -lSalomeHDFPersist
SALOME_INCL_PATH=-I$(KERNEL_ROOT_DIR)/include/salome
endif
$(SALOME_INCL_PATH) \
$(OMNIORB_INCLUDES) \
$(OMNIORB_CXXFLAGS) \
+ $(EXPAT_INCLUDES) \
-I$(srcdir)/../bases \
-I$(srcdir)/../engine \
-I$(srcdir)/../runtime
$(PYTHON_LDFLAGS) \
$(PYTHON_EXTRA_LIBS)
-driver_LDFLAGS = $(PYTHON_EXTRA_LDFLAGS) -pthread $(EXPAT_LIBS) $(LIBXML_LIBS)
+driver_LDFLAGS = $(PYTHON_EXTRA_LDFLAGS) -pthread $(LIBXML_LIBS) $(EXPAT_LIBS)
resume_SOURCES = resume.cxx
$(PYTHON_CPPFLAGS) \
$(OMNIORB_INCLUDES) \
$(OMNIORB_CXXFLAGS) \
+ $(EXPAT_INCLUDES) \
-I$(srcdir)/../bases \
-I$(srcdir)/../engine \
-I$(srcdir)/../runtime
$(PYTHON_LDFLAGS) \
$(PYTHON_EXTRA_LIBS)
-resume_LDFLAGS = $(PYTHON_EXTRA_LDFLAGS) -pthread $(EXPAT_LIBS) $(LIBXML_LIBS)
+resume_LDFLAGS = $(PYTHON_EXTRA_LDFLAGS) -pthread $(LIBXML_LIBS) $(EXPAT_LIBS)
debugger_SOURCES = debugger.cxx
$(PYTHON_CPPFLAGS) \
$(OMNIORB_INCLUDES) \
$(OMNIORB_CXXFLAGS) \
+ $(EXPAT_INCLUDES) \
-I$(srcdir)/../bases \
-I$(srcdir)/../engine \
-I$(srcdir)/../runtime
$(PYTHON_LDFLAGS) \
$(PYTHON_EXTRA_LIBS)
-debugger_LDFLAGS = $(PYTHON_EXTRA_LDFLAGS) -pthread $(EXPAT_LIBS) $(LIBXML_LIBS)
-
-
-SWIG_PYTHON_INCLUDES = -noexcept -I$(srcdir)/../bases -I$(srcdir)/../engine
-# --- build libYACSloader library before swig libraries (problem with make -j)
-BUILT_SOURCES = loaderWRAP.cxx libYACSloader.la
-
-SWIGINCLUDES=parsers.hxx LoadState.hxx xmlParserBase.hxx ProcCataLoader.hxx ../engine/engtypemaps.i ../engine/pilot.i
-
-loaderWRAP.cxx loaderWRAP.h: loader.i $(SWIGINCLUDES)
- $(SWIG) $(SWIG_PYTHON_OPT) $(SWIG_PYTHON_INCLUDES) $(MYSWIG_FLAGS) -o loaderWRAP.cxx $(srcdir)/loader.i
-
-salomepython_PYTHON = loader.py
-salomepyexec_LTLIBRARIES = _loader.la
-
-_loader_la_SOURCES = \
- loaderWRAP.cxx
-
-_loader_la_CXXFLAGS = \
- $(THREAD_DEF) \
- $(PYTHON_CPPFLAGS) \
- $(OMNIORB_INCLUDES) \
- $(OMNIORB_CXXFLAGS) \
- -I$(srcdir)/../bases \
- -I$(srcdir)/../engine
-
-_loader_la_LDFLAGS = -module
-
-_loader_la_LIBADD = libYACSloader.la $(OMNIORB_LIBS)
+debugger_LDFLAGS = $(PYTHON_EXTRA_LDFLAGS) -pthread $(LIBXML_LIBS) $(EXPAT_LIBS)
-EXTRA_DIST = loader.i samples
+EXTRA_DIST = samples schema.xsd
dist-hook:
rm -rf `find $(distdir) -name CVS`
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "ProcCataLoader.hxx"
#include "parsers.hxx"
#include "Proc.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _PROCCATALOADER_HXX_
#define _PROCCATALOADER_HXX_
+++ /dev/null
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
-<title>Work in progress</title>
-<style type="text/css">
-
-/*
-:Author: David Goodger
-:Contact: goodger@users.sourceforge.net
-:Date: $Date$
-:Revision: $Revision$
-:Copyright: This stylesheet has been placed in the public domain.
-
-Default cascading style sheet for the HTML output of Docutils.
-
-See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
-customize this style sheet.
-*/
-
-/* used to remove borders from tables and images */
-.borderless, table.borderless td, table.borderless th {
- border: 0 }
-
-table.borderless td, table.borderless th {
- /* Override padding for "table.docutils td" with "! important".
- The right padding separates the table cells. */
- padding: 0 0.5em 0 0 ! important }
-
-.first {
- /* Override more specific margin styles with "! important". */
- margin-top: 0 ! important }
-
-.last, .with-subtitle {
- margin-bottom: 0 ! important }
-
-.hidden {
- display: none }
-
-a.toc-backref {
- text-decoration: none ;
- color: black }
-
-blockquote.epigraph {
- margin: 2em 5em ; }
-
-dl.docutils dd {
- margin-bottom: 0.5em }
-
-/* Uncomment (and remove this text!) to get bold-faced definition list terms
-dl.docutils dt {
- font-weight: bold }
-*/
-
-div.abstract {
- margin: 2em 5em }
-
-div.abstract p.topic-title {
- font-weight: bold ;
- text-align: center }
-
-div.admonition, div.attention, div.caution, div.danger, div.error,
-div.hint, div.important, div.note, div.tip, div.warning {
- margin: 2em ;
- border: medium outset ;
- padding: 1em }
-
-div.admonition p.admonition-title, div.hint p.admonition-title,
-div.important p.admonition-title, div.note p.admonition-title,
-div.tip p.admonition-title {
- font-weight: bold ;
- font-family: sans-serif }
-
-div.attention p.admonition-title, div.caution p.admonition-title,
-div.danger p.admonition-title, div.error p.admonition-title,
-div.warning p.admonition-title {
- color: red ;
- font-weight: bold ;
- font-family: sans-serif }
-
-/* Uncomment (and remove this text!) to get reduced vertical space in
- compound paragraphs.
-div.compound .compound-first, div.compound .compound-middle {
- margin-bottom: 0.5em }
-
-div.compound .compound-last, div.compound .compound-middle {
- margin-top: 0.5em }
-*/
-
-div.dedication {
- margin: 2em 5em ;
- text-align: center ;
- font-style: italic }
-
-div.dedication p.topic-title {
- font-weight: bold ;
- font-style: normal }
-
-div.figure {
- margin-left: 2em ;
- margin-right: 2em }
-
-div.footer, div.header {
- clear: both;
- font-size: smaller }
-
-div.line-block {
- display: block ;
- margin-top: 1em ;
- margin-bottom: 1em }
-
-div.line-block div.line-block {
- margin-top: 0 ;
- margin-bottom: 0 ;
- margin-left: 1.5em }
-
-div.sidebar {
- margin-left: 1em ;
- border: medium outset ;
- padding: 1em ;
- background-color: #ffffee ;
- width: 40% ;
- float: right ;
- clear: right }
-
-div.sidebar p.rubric {
- font-family: sans-serif ;
- font-size: medium }
-
-div.system-messages {
- margin: 5em }
-
-div.system-messages h1 {
- color: red }
-
-div.system-message {
- border: medium outset ;
- padding: 1em }
-
-div.system-message p.system-message-title {
- color: red ;
- font-weight: bold }
-
-div.topic {
- margin: 2em }
-
-h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
-h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
- margin-top: 0.4em }
-
-h1.title {
- text-align: center }
-
-h2.subtitle {
- text-align: center }
-
-hr.docutils {
- width: 75% }
-
-img.align-left {
- clear: left }
-
-img.align-right {
- clear: right }
-
-ol.simple, ul.simple {
- margin-bottom: 1em }
-
-ol.arabic {
- list-style: decimal }
-
-ol.loweralpha {
- list-style: lower-alpha }
-
-ol.upperalpha {
- list-style: upper-alpha }
-
-ol.lowerroman {
- list-style: lower-roman }
-
-ol.upperroman {
- list-style: upper-roman }
-
-p.attribution {
- text-align: right ;
- margin-left: 50% }
-
-p.caption {
- font-style: italic }
-
-p.credits {
- font-style: italic ;
- font-size: smaller }
-
-p.label {
- white-space: nowrap }
-
-p.rubric {
- font-weight: bold ;
- font-size: larger ;
- color: maroon ;
- text-align: center }
-
-p.sidebar-title {
- font-family: sans-serif ;
- font-weight: bold ;
- font-size: larger }
-
-p.sidebar-subtitle {
- font-family: sans-serif ;
- font-weight: bold }
-
-p.topic-title {
- font-weight: bold }
-
-pre.address {
- margin-bottom: 0 ;
- margin-top: 0 ;
- font-family: serif ;
- font-size: 100% }
-
-pre.literal-block, pre.doctest-block {
- margin-left: 2em ;
- margin-right: 2em ;
- background-color: #eeeeee }
-
-span.classifier {
- font-family: sans-serif ;
- font-style: oblique }
-
-span.classifier-delimiter {
- font-family: sans-serif ;
- font-weight: bold }
-
-span.interpreted {
- font-family: sans-serif }
-
-span.option {
- white-space: nowrap }
-
-span.pre {
- white-space: pre }
-
-span.problematic {
- color: red }
-
-span.section-subtitle {
- /* font-size relative to parent (h1..h6 element) */
- font-size: 80% }
-
-table.citation {
- border-left: solid 1px gray;
- margin-left: 1px }
-
-table.docinfo {
- margin: 2em 4em }
-
-table.docutils {
- margin-top: 0.5em ;
- margin-bottom: 0.5em }
-
-table.footnote {
- border-left: solid 1px black;
- margin-left: 1px }
-
-table.docutils td, table.docutils th,
-table.docinfo td, table.docinfo th {
- padding-left: 0.5em ;
- padding-right: 0.5em ;
- vertical-align: top }
-
-table.docutils th.field-name, table.docinfo th.docinfo-name {
- font-weight: bold ;
- text-align: left ;
- white-space: nowrap ;
- padding-left: 0 }
-
-h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
-h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
- font-size: 100% }
-
-tt.docutils {
- background-color: #eeeeee }
-
-ul.auto-toc {
- list-style-type: none }
-
-</style>
-</head>
-<body>
-<div class="document" id="work-in-progress">
-<h1 class="title">Work in progress</h1>
-<div class="contents topic">
-<p class="topic-title first"><a id="contents" name="contents">Contents</a></p>
-<ul class="simple">
-<li><a class="reference" href="#what-is-done" id="id1" name="id1">What is done ?</a></li>
-<li><a class="reference" href="#to-do" id="id2" name="id2">To do</a><ul>
-<li><a class="reference" href="#output-a-trace-pr" id="id3" name="id3">Output a trace (PR)</a></li>
-<li><a class="reference" href="#make-another-runtime-mt" id="id4" name="id4">Make another runtime (MT)</a></li>
-<li><a class="reference" href="#save-load-pr" id="id5" name="id5">Save/load (PR)</a></li>
-<li><a class="reference" href="#partial-execution" id="id6" name="id6">Partial execution</a></li>
-<li><a class="reference" href="#deployment-resource-management" id="id7" name="id7">Deployment, resource management</a></li>
-<li><a class="reference" href="#add-other-data-types" id="id8" name="id8">Add other data types</a></li>
-<li><a class="reference" href="#managing-several-schema" id="id9" name="id9">Managing several schema</a></li>
-<li><a class="reference" href="#better-management-of-outputs-in-elementarynode" id="id10" name="id10">Better management of outputs in ElementaryNode</a></li>
-<li><a class="reference" href="#errors-when-reading-the-xml-file" id="id11" name="id11">Errors when reading the XML file</a></li>
-<li><a class="reference" href="#errors-when-executing" id="id12" name="id12">Errors when executing</a></li>
-<li><a class="reference" href="#add-macro-nodes" id="id13" name="id13">Add macro nodes</a></li>
-<li><a class="reference" href="#discover-base-types-from-runtime-gui-and-parser" id="id14" name="id14">Discover base types from runtime (GUI and parser)</a></li>
-</ul>
-</li>
-</ul>
-</div>
-<div class="section">
-<h1><a class="toc-backref" href="#id1" id="what-is-done" name="what-is-done">What is done ?</a></h1>
-<ul class="simple">
-<li>XML parser with expat. No more xsd : problem with license</li>
-<li>support several elementary nodes : CompoNode,
-RefNode, FuncNode, ScriptNode</li>
-<li>support all composite nodes : Bloc, While, ForLoop, ForEachLoop, Switch</li>
-<li>support control links, data links and datastream links (DSC and Calcium datastream)</li>
-<li>support initialization from data in XML-RPC syntax</li>
-<li>support execution in threaded Executor : manage Python GIL</li>
-<li>the Runtime SALOME is connected to the SALOME LifeCycle to implement
-CompoNode. It's not yet possible to choose a computer or to express
-a resource constraint.</li>
-<li>dump of the schema state in graphviz form (.dot file)</li>
-<li>execution error management : an ElementaryNode signals an error by throwing
-an exception. This exception is catched by the executor which notifies the
-ElementaryNode and makes propagate the error to all depending nodes and to
-the father. All depending nodes and the father are put in FAILED state. The
-ElementaryNode is put in ERROR state.</li>
-<li>Python interface : main C++ API wrapped with SWIG to be able to create schema from Python
-and to control execution</li>
-<li>a Salome loader in pyqt directory (salomeloader.py)</li>
-</ul>
-</div>
-<div class="section">
-<h1><a class="toc-backref" href="#id2" id="to-do" name="to-do">To do</a></h1>
-<div class="section">
-<h2><a class="toc-backref" href="#id3" id="output-a-trace-pr" name="output-a-trace-pr">Output a trace (PR)</a></h2>
-<p>It would be fine to have an execution trace (event sequence)
-to be able to analyze the execution afterwards.</p>
-</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id4" id="make-another-runtime-mt" name="make-another-runtime-mt">Make another runtime (MT)</a></h2>
-<p>To check the design</p>
-</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id5" id="save-load-pr" name="save-load-pr">Save/load (PR)</a></h2>
-<p>Be able to dump the schema state in a XML file.
-Then to reload the state and restart from this state.</p>
-<p>Two levels : with CORBA objects and without</p>
-</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id6" id="partial-execution" name="partial-execution">Partial execution</a></h2>
-<p>Execute some selected nodes (directly or with backtrack)</p>
-</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id7" id="deployment-resource-management" name="deployment-resource-management">Deployment, resource management</a></h2>
-<p>Not easy</p>
-</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id8" id="add-other-data-types" name="add-other-data-types">Add other data types</a></h2>
-<p>struct, enum</p>
-</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id9" id="managing-several-schema" name="managing-several-schema">Managing several schema</a></h2>
-<p>One executor for all schemas or one executor by schema ?</p>
-</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id10" id="better-management-of-outputs-in-elementarynode" name="better-management-of-outputs-in-elementarynode">Better management of outputs in ElementaryNode</a></h2>
-<p>Execution in threads : all outputs are mixed</p>
-</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id11" id="errors-when-reading-the-xml-file" name="errors-when-reading-the-xml-file">Errors when reading the XML file</a></h2>
-<ul class="simple">
-<li>Stop at first error (Exception)</li>
-<li>Collect all errors</li>
-<li>Check the overall validity</li>
-</ul>
-</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id12" id="errors-when-executing" name="errors-when-executing">Errors when executing</a></h2>
-<ul class="simple">
-<li>Stop as soon as possible when encountering an error</li>
-<li>Or execute most calculations possible</li>
-</ul>
-<p>Need an execution option to specify that</p>
-<p>To be able to restart an execution on another computer</p>
-</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id13" id="add-macro-nodes" name="add-macro-nodes">Add macro nodes</a></h2>
-<p>Define macronodes
-Be able to reference them several times</p>
-</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id14" id="discover-base-types-from-runtime-gui-and-parser" name="discover-base-types-from-runtime-gui-and-parser">Discover base types from runtime (GUI and parser)</a></h2>
-<p>Runtime would have a service to give all known types (map name:type)</p>
-</div>
-</div>
-</div>
-</body>
-</html>
+++ /dev/null
-
-===========================
-Work in progress
-===========================
-
-.. contents::
-
-What is done ?
-==============================
-- XML parser with expat. No more xsd : problem with license
-- support several elementary nodes : CompoNode,
- RefNode, FuncNode, ScriptNode
-- support all composite nodes : Bloc, While, ForLoop, ForEachLoop, Switch
-- support control links, data links and datastream links (DSC and Calcium datastream)
-- support initialization from data in XML-RPC syntax
-- support execution in threaded Executor : manage Python GIL
-- the Runtime SALOME is connected to the SALOME LifeCycle to implement
- CompoNode. It's not yet possible to choose a computer or to express
- a resource constraint.
-- dump of the schema state in graphviz form (.dot file)
-- execution error management : an ElementaryNode signals an error by throwing
- an exception. This exception is catched by the executor which notifies the
- ElementaryNode and makes propagate the error to all depending nodes and to
- the father. All depending nodes and the father are put in FAILED state. The
- ElementaryNode is put in ERROR state.
-- Python interface : main C++ API wrapped with SWIG to be able to create schema from Python
- and to control execution
-- a Salome loader in pyqt directory (salomeloader.py)
-
-To do
-===============================
-
-Output a trace (PR)
---------------------------------------
-It would be fine to have an execution trace (event sequence)
-to be able to analyze the execution afterwards.
-
-Make another runtime (MT)
----------------------------
-To check the design
-
-Save/load (PR)
---------------------
-Be able to dump the schema state in a XML file.
-Then to reload the state and restart from this state.
-
-Two levels : with CORBA objects and without
-
-Partial execution
------------------------
-Execute some selected nodes (directly or with backtrack)
-
-Deployment, resource management
--------------------------------------
-Not easy
-
-Add other data types
------------------------------------
-struct, enum
-
-Managing several schema
-------------------------------------------------------
-One executor for all schemas or one executor by schema ?
-
-Better management of outputs in ElementaryNode
--------------------------------------------------
-Execution in threads : all outputs are mixed
-
-Errors when reading the XML file
-----------------------------------------------------
-- Stop at first error (Exception)
-- Collect all errors
-- Check the overall validity
-
-Errors when executing
----------------------------------------
-- Stop as soon as possible when encountering an error
-- Or execute most calculations possible
-
-Need an execution option to specify that
-
-To be able to restart an execution on another computer
-
-Add macro nodes
-----------------------------
-Define macronodes
-Be able to reference them several times
-
-Discover base types from runtime (GUI and parser)
---------------------------------------------------------------
-Runtime would have a service to give all known types (map name:type)
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm/unix/make_begin.am
check_PROGRAMS = TestYacsLoader echoSrv
check_SCRIPTS = \
YacsLoaderTest.sh \
YacsLoaderInSessionTest.sh \
- YacsLoaderInSessionTest2.sh \
display.sh \
- waitContainers.py \
- testExec.py
+ waitContainers.py
bin_SCRIPTS = display.sh
TestYacsLoader_CXXFLAGS = \
$(THREAD_DEF) \
$(CPPUNIT_INCLUDES) \
+ $(EXPAT_INCLUDES) \
$(PYTHON_CPPFLAGS) \
- $(OMNIORB_INCLUDES) \
- $(OMNIORB_CCXFLAGS) \
+ $(OMNIORB_INCLUDES) \
+ $(OMNIORB_CXXFLAGS) \
-I$(srcdir)/.. \
-I$(srcdir)/../../bases \
-I$(srcdir)/../../bases/Test \
-I$(srcdir)/../../engine \
$(LIBXML_INCLUDES)
+check_LTLIBRARIES = libTestOptLoop.la
+libTestOptLoop_la_SOURCES = OptimizerAlgSyncExample.cxx OptimizerAlgASyncExample.cxx
+libTestOptLoop_la_CXXFLAGS = \
+ -I$(srcdir)/../../bases \
+ -I$(srcdir)/../../engine \
+ $(THREAD_DEF)
+libTestOptLoop_la_LDFLAGS = -rpath /nowhere # trick to force libtool to create a shared lib
+libTestOptLoop_la_LIBADD = ../../engine/libYACSlibEngine.la
+
+check_SCRIPTS += algosyncexample.py algoasyncexample.py
+
IDL_FILES = echo.idl
IDL_SOURCES = echoSK.cc
BUILT_SOURCES = $(IDL_SOURCES) echo_idl.py xmlrun.sh
EXTRA_DIST = $(IDL_FILES) \
-echoclt.py genPascal.py genTriangle.py testEdit.py testExec.py \
-testLoader.py testResume.py testSave.py testRefcount.py \
-waitContainers.py xmlrun_orig.sh YacsLoaderTest.hxx
+echoclt.py genPascal.py genTriangle.py \
+waitContainers.py xmlrun_orig.sh YacsLoaderTest.hxx \
+algosyncexample.py algoasyncexample.py
xmlrun.sh:xmlrun_orig.sh
- cp $(srcdir)/xmlrun_orig.sh xmlrun.sh
+ cp -f $(srcdir)/xmlrun_orig.sh xmlrun.sh
echoSrv_SOURCES = echoSrv.cxx
nodist_echoSrv_SOURCES = $(IDL_SOURCES)
echoSrv_CXXFLAGS = \
+ -I. \
-I$(srcdir)/../../bases \
$(OMNIORB_INCLUDES) \
$(OMNIORB_CXXFLAGS)
echoSrv_LDFLAGS = \
- $(OMNIORB_LIBS)
+ $(OMNIORB_LIBS) $(PTHREAD_LIBS)
AM_CXXFLAGS = $(THREAD_DEF)
clean-local:
rm -rf yacs* schema1_* schema2_* dump1_* dump2_* eo eo__POA dump*.xml CatalogResources.xml traceExec_*
- rm -f samples toto titi log1 xmlrun.sh echo_idl.py echo.hh echoSK.cc g.data
- if test -f "./bin/salome/appli_clean.sh"; then ./bin/salome/appli_clean.sh ; fi
+ rm -f samples toto titi log1 xmlrun.sh echo_idl.py* echo.hh echoSK.cc g.data
+ if test -f "./bin/salome/appli_clean.sh"; then ./bin/salome/appli_clean.sh -f ; fi
check-local:
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "OptimizerAlg.hxx"
+
+using namespace YACS::ENGINE;
+
+extern "C"
+{
+ OptimizerAlgBase * createOptimizerAlgASyncExample(Pool * pool);
+}
+
+class OptimizerAlgASyncExample : public OptimizerAlgASync
+ {
+ private:
+ TypeCode * _tcIn;
+ TypeCode * _tcOut;
+ public:
+ OptimizerAlgASyncExample(Pool * pool);
+ virtual ~OptimizerAlgASyncExample();
+ TypeCode * getTCForIn() const;
+ TypeCode * getTCForOut() const;
+ void startToTakeDecision();
+ };
+
+OptimizerAlgASyncExample::OptimizerAlgASyncExample(Pool * pool) : OptimizerAlgASync(pool),
+ _tcIn(0), _tcOut(0)
+{
+ _tcIn = new TypeCode(Double);
+ _tcOut = new TypeCode(Int);
+}
+
+OptimizerAlgASyncExample::~OptimizerAlgASyncExample()
+{
+ _tcIn->decrRef();
+ _tcOut->decrRef();
+}
+
+//! Return the typecode of the expected input type
+TypeCode *OptimizerAlgASyncExample::getTCForIn() const
+{
+ return _tcIn;
+}
+
+//! Return the typecode of the expected output type
+TypeCode *OptimizerAlgASyncExample::getTCForOut() const
+{
+ return _tcOut;
+}
+
+//! This method is called only once to launch the algorithm.
+/*!
+ * It must first fill the pool with samples to evaluate and call signalMasterAndWait()
+ * to block until a sample has been evaluated. When returning from this method, it MUST
+ * check for an eventual termination request (with the method isTerminationRequested()).
+ * If the termination is requested, the method must perform any necessary cleanup and
+ * return as soon as possible. Otherwise it can either add new samples to evaluate in
+ * the pool, do nothing (wait for more samples), or empty the pool and return to finish
+ * the evaluation.
+ */
+void OptimizerAlgASyncExample::startToTakeDecision()
+{
+ double val = 1.2;
+ for (int i=0 ; i<5 ; i++) {
+ // push a sample in the input of the slave node
+ _pool->pushInSample(i, AtomAny::New(val));
+ // wait until next sample is ready
+ signalMasterAndWait();
+ // check error notification
+ if (isTerminationRequested()) {
+ _pool->destroyAll();
+ return;
+ }
+
+ // get a sample from the output of the slave node
+ Any * v = _pool->getCurrentOutSample();
+ val += v->getIntValue();
+ }
+
+ // in the end destroy the pool content
+ _pool->destroyAll();
+}
+
+//! Factory method to create the algorithm.
+OptimizerAlgBase * createOptimizerAlgASyncExample(Pool * pool)
+{
+ return new OptimizerAlgASyncExample(pool);
+}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <cmath>
+#include <iostream>
+
+#include "OptimizerAlg.hxx"
+
+using namespace YACS::ENGINE;
+
+extern "C"
+{
+ OptimizerAlgBase * createOptimizerAlgSyncExample(Pool * pool);
+}
+
+class OptimizerAlgSyncExample : public OptimizerAlgSync
+ {
+ private:
+ int _idTest;
+ TypeCode *_tcIn;
+ TypeCode *_tcOut;
+ public:
+ OptimizerAlgSyncExample(Pool *pool);
+ virtual ~OptimizerAlgSyncExample();
+ TypeCode *getTCForIn() const;
+ TypeCode *getTCForOut() const;
+ void start();
+ void takeDecision();
+ void initialize(const Any *input) throw(YACS::Exception);
+ void finish();
+ };
+
+OptimizerAlgSyncExample::OptimizerAlgSyncExample(Pool *pool) : OptimizerAlgSync(pool),
+ _tcIn(0), _tcOut(0),
+ _idTest(0)
+{
+ _tcIn=new TypeCode(Double);
+ _tcOut=new TypeCode(Int);
+}
+
+OptimizerAlgSyncExample::~OptimizerAlgSyncExample()
+{
+ std::cout << "Destroying OptimizerAlgSyncExample" << std::endl;
+ _tcIn->decrRef();
+ _tcOut->decrRef();
+ std::cout << "Destroyed OptimizerAlgSyncExample" << std::endl;
+}
+
+//! Return the typecode of the expected input type
+TypeCode * OptimizerAlgSyncExample::getTCForIn() const
+{
+ return _tcIn;
+}
+
+//! Return the typecode of the expected output type
+TypeCode * OptimizerAlgSyncExample::getTCForOut() const
+{
+ return _tcOut;
+}
+
+//! Start to fill the pool with samples to evaluate
+void OptimizerAlgSyncExample::start()
+{
+ _idTest=0;
+ Any *val=AtomAny::New(1.2);
+ _pool->pushInSample(4,val);
+ val=AtomAny::New(3.4);
+ _pool->pushInSample(9,val);
+}
+
+//! This method is called each time a sample has been evaluated.
+/*!
+ * It can either add new samples to evaluate in the pool, do nothing (wait for more
+ * samples), or empty the pool to finish the evaluation.
+ */
+void OptimizerAlgSyncExample::takeDecision()
+{
+ if(_idTest==1)
+ {
+ Any *val=AtomAny::New(5.6);
+ _pool->pushInSample(16,val);
+ val=AtomAny::New(7.8);
+ _pool->pushInSample(25,val);
+ val=AtomAny::New(9. );
+ _pool->pushInSample(36,val);
+ val=AtomAny::New(12.3);
+ _pool->pushInSample(49,val);
+ }
+ else if(_idTest==4)
+ {
+ Any *val=AtomAny::New(45.6);
+ _pool->pushInSample(64,val);
+ val=AtomAny::New(78.9);
+ _pool->pushInSample(81,val);
+ }
+ else
+ {
+ Any *tmp= _pool->getCurrentInSample();
+ if(fabs(tmp->getDoubleValue()-45.6)<1.e-12)
+ _pool->destroyAll();
+ }
+ _idTest++;
+}
+
+//! Optional method to initialize the algorithm.
+/*!
+ * For now, the parameter input is always NULL. It might be used in the future to
+ * initialize an algorithm with custom data.
+ */
+void OptimizerAlgSyncExample::initialize(const Any *input) throw (YACS::Exception)
+{
+}
+
+/*!
+ * Optional method called when the algorithm has finished, successfully or not, to
+ * perform any necessary clean up.
+ */
+void OptimizerAlgSyncExample::finish()
+{
+}
+
+//! Factory method to create the algorithm.
+OptimizerAlgBase * createOptimizerAlgSyncExample(Pool *pool)
+{
+ return new OptimizerAlgSyncExample(pool);
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#define UNIT_TEST_HEADER " --- TEST src/yacsloader"
#include "YacsLoaderTest.hxx"
#!/bin/bash
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# --- script to execute in SALOME environment (use runSession)
pidecho=$!
echo $pidecho > "/tmp/YACSTEST_PidEcho"
+# Environment variables needed for the optimizer loop tests
+export LD_LIBRARY_PATH=@builddir@/.libs:$LD_LIBRARY_PATH
+export PYTHONPATH=@top_builddir@/src/engine_swig:@top_builddir@/src/engine_swig/.libs:$PYTHONPATH
+export PYTHONPATH=@top_builddir@/src/runtime_swig:@top_builddir@/src/runtime_swig/.libs:$PYTHONPATH
+export PYTHONPATH=@srcdir@:$PYTHONPATH
+
# --- launch unit tests
export ROOT_SAMPLES=@ROOT_SRCDIR@/src/yacsloader/samples
+++ /dev/null
-#!/bin/bash
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-#
-# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-# --- script to execute in SALOME environment (use runSession)
-
-# --- launch unit tests
-
-export ROOT_SAMPLES=@ROOT_SRCDIR@/src/yacsloader/samples
-
-export PYTHONPATH=..:../.libs:@top_srcdir@/src/yacsloader:${PYTHONPATH}
-export PYTHONPATH=../../runtime:../../runtime/.libs:@top_srcdir@/src/runtime:${PYTHONPATH}
-export PYTHONPATH=../../engine:../../engine/.libs:@top_srcdir@/src/engine:${PYTHONPATH}
-
-python @srcdir@/testExec.py
-ret0=$?
-if [ $ret0 -gt 0 ]; then
- echo "exec status testExec : " $ret0
- exit $ret0
-fi
-
-python @srcdir@/testResume.py
-ret1=$?
-if [ $ret1 -gt 0 ]; then
- echo "exec status testResume : " $ret1
- exit $ret1
-fi
-
-python @srcdir@/testLoader.py
-ret2=$?
-if [ $ret2 -gt 0 ]; then
- echo "exec status testLoader : " $ret2
- exit $ret2
-fi
-
-python @srcdir@/testEdit.py
-ret3=$?
-if [ $ret3 -gt 0 ]; then
- echo "exec status testEdit : " $ret3
- exit $ret3
-fi
-
-python @srcdir@/testSave.py
-ret4=$?
-if [ $ret4 -gt 0 ]; then
- echo "exec status testSave : " $ret4
- exit $ret4
-fi
-
-python @srcdir@/testRefcount.py
-ret5=$?
-if [ $ret5 -gt 0 ]; then
- echo "exec status testRefcount : " $ret5
- exit $ret5
-fi
-
-let ret=$ret0+$ret1+$ret2+$ret3+$ret4+$ret5
-
-# --- return unit tests status
-
-exit $ret
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "yacsconfig.h"
#include "RuntimeSALOME.hxx"
#include "PythonPorts.hxx"
#include <iostream>
#include <fstream>
+#include <stdlib.h>
+#ifdef WNT
+#include <io.h>
+#define F_OK 0
+#define access _access
+#else
+#include <unistd.h>
+#endif
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
if (p)
{
CORBA::Double dval = 0;
- char *text = "";
+ char *text = (char*)"";
CPPUNIT_ASSERT(p->nodeMap["c0.c1.n1"]);
*((OutputCorbaPort*)p->nodeMap["c0.c1.n1"]->getOutputPort("p1"))->getAny() >>= dval;
PyObject *data = ((OutputPyPort*)p->nodeMap["node32"]->getOutputPort("p1"))->get();
#ifdef SALOME_KERNEL
if (p)
{
- CORBA::Double dval = 0;
- const char *text = "";
- *((OutputCorbaPort*)p->nodeMap["node1"]->getOutputPort("p1"))->getAny() >>= text;
- CPPUNIT_ASSERT_EQUAL(string("Hello coucou!"), string(text) );
- text = "";
- *((OutputCorbaPort*)p->nodeMap["node2"]->getOutputPort("p1"))->getAny() >>= text;
- CPPUNIT_ASSERT_EQUAL(string("Hello Hello coucou!!"), string(text) );
+ if(getenv("PYHELLO_ROOT_DIR"))
+ {
+ std::string hellodir(getenv("PYHELLO_ROOT_DIR"));
+ hellodir=hellodir+"/share/salome/resources/pyhello";
+ if(access(hellodir.c_str(),F_OK) == 0)
+ {
+ CORBA::Double dval = 0;
+ const char *text = "";
+ *((OutputCorbaPort*)p->nodeMap["node1"]->getOutputPort("p1"))->getAny() >>= text;
+ CPPUNIT_ASSERT_EQUAL(string("Hello coucou!"), string(text) );
+ text = "";
+ *((OutputCorbaPort*)p->nodeMap["node2"]->getOutputPort("p1"))->getAny() >>= text;
+ CPPUNIT_ASSERT_EQUAL(string("Hello Hello coucou!!"), string(text) );
+ }
+ }
delete p;
}
#endif
#ifdef SALOME_KERNEL
if (p)
{
- CORBA::Double dval = 0;
- const char *text = "";
- *((OutputCorbaPort*)p->nodeMap["node1"]->getOutputPort("p1"))->getAny() >>= text;
- CPPUNIT_ASSERT_EQUAL(string("Hello coucou!"), string(text) );
- text = "";
- *((OutputCorbaPort*)p->nodeMap["node2"]->getOutputPort("p1"))->getAny() >>= text;
- CPPUNIT_ASSERT_EQUAL(string("Hello Hello coucou!!"), string(text) );
- text = "";
- *((OutputCorbaPort*)p->nodeMap["node3"]->getOutputPort("p1"))->getAny() >>= text;
- CPPUNIT_ASSERT_EQUAL( string("Hello Hello coucou!!"), string(text));
+ if(getenv("PYHELLO_ROOT_DIR"))
+ {
+ std::string hellodir(getenv("PYHELLO_ROOT_DIR"));
+ hellodir=hellodir+"/share/salome/resources/pyhello";
+ if(access(hellodir.c_str(),F_OK) == 0)
+ {
+ CORBA::Double dval = 0;
+ const char *text = "";
+ *((OutputCorbaPort*)p->nodeMap["node1"]->getOutputPort("p1"))->getAny() >>= text;
+ CPPUNIT_ASSERT_EQUAL(string("Hello coucou!"), string(text) );
+ text = "";
+ *((OutputCorbaPort*)p->nodeMap["node2"]->getOutputPort("p1"))->getAny() >>= text;
+ CPPUNIT_ASSERT_EQUAL(string("Hello Hello coucou!!"), string(text) );
+ text = "";
+ *((OutputCorbaPort*)p->nodeMap["node3"]->getOutputPort("p1"))->getAny() >>= text;
+ CPPUNIT_ASSERT_EQUAL( string("Hello Hello coucou!!"), string(text));
+ }
+ }
delete p;
}
#endif
*((OutputCorbaPort*)p->nodeMap["node63"]->getOutputPort("p1"))->getAny() >>= dval;
CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
}
- delete p;
+ try
+ {
+ delete p;
+ }
+ catch (YACS::Exception& e)
+ {
+ DEBTRACE("YACS exception caught: ");
+ DEBTRACE(e.what());
+ }
+ catch (const std::ios_base::failure&)
+ {
+ DEBTRACE("io failure");
+ }
+ catch(CORBA::SystemException& ex)
+ {
+ DEBTRACE("Caught a CORBA::SystemException.");
+ CORBA::Any tmp;
+ tmp <<= ex;
+ CORBA::TypeCode_var tc = tmp.type();
+ const char *p = tc->name();
+ if ( *p != '\0' )
+ {
+ DEBTRACE(p);
+ }
+ else
+ {
+ DEBTRACE(tc->id());
+ }
+ }
+ catch(omniORB::fatalException& fe)
+ {
+ DEBTRACE("Caught omniORB::fatalException:" );
+ DEBTRACE(" file: " << fe.file());
+ DEBTRACE(" line: " << fe.line());
+ DEBTRACE(" mesg: " << fe.errmsg());
+ }
+ catch(...)
+ {
+ DEBTRACE("unknown exception");
+ }
}
}
CPPUNIT_ASSERT(p != 0);
if (p)
{
-// PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-// char *text = PyString_AsString(data);;
-// CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
delete p;
}
}
CPPUNIT_ASSERT(p != 0);
if (p)
{
-// PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-// char *text = PyString_AsString(data);;
-// CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
delete p;
}
}
CPPUNIT_ASSERT(p != 0);
if (p)
{
-// PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-// char *text = PyString_AsString(data);;
-// CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
delete p;
}
}
CPPUNIT_ASSERT(p != 0);
if (p)
{
-// PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-// char *text = PyString_AsString(data);;
-// CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
delete p;
}
}
CPPUNIT_ASSERT(p != 0);
if (p)
{
-// PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-// char *text = PyString_AsString(data);;
-// CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
delete p;
}
}
CPPUNIT_ASSERT(p != 0);
if (p)
{
-// PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-// char *text = PyString_AsString(data);;
-// CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
delete p;
}
}
CPPUNIT_ASSERT(p != 0);
if (p)
{
-// PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-// char *text = PyString_AsString(data);;
-// CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
delete p;
}
}
CPPUNIT_ASSERT(p != 0);
if (p)
{
-// PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-// char *text = PyString_AsString(data);;
-// CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
delete p;
}
}
CPPUNIT_ASSERT(p != 0);
if (p)
{
-// PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-// char *text = PyString_AsString(data);;
-// CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
delete p;
}
}
CPPUNIT_ASSERT(p != 0);
if (p)
{
-// PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-// char *text = PyString_AsString(data);;
-// CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
delete p;
}
}
CPPUNIT_ASSERT(p != 0);
if (p)
{
-// PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-// char *text = PyString_AsString(data);;
-// CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
delete p;
}
}
CPPUNIT_ASSERT(p != 0);
if (p)
{
-// PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-// char *text = PyString_AsString(data);;
-// CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
delete p;
}
}
CPPUNIT_ASSERT(p != 0);
if (p)
{
-// PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-// char *text = PyString_AsString(data);;
-// CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
delete p;
}
}
CPPUNIT_ASSERT(p != 0);
if (p)
{
-// PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-// char *text = PyString_AsString(data);;
-// CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
delete p;
}
}
CPPUNIT_ASSERT(p != 0);
if (p)
{
-// PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-// char *text = PyString_AsString(data);;
-// CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
delete p;
}
ret = driverTest(p, "samples/while2.xml");
CPPUNIT_ASSERT(p != 0);
if (p)
{
-// PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-// char *text = PyString_AsString(data);;
-// CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
delete p;
}
}
ret = driverTest(p, "samples/refcnt1.xml");
CPPUNIT_ASSERT(ret == 0);
data = ((OutputPyPort*)p->nodeMap["b1.b.node1"]->getOutputPort("p1"))->get();
- CPPUNIT_ASSERT_EQUAL(13, data->ob_refcnt);
+ CPPUNIT_ASSERT(data->ob_refcnt==13);
ret = driverTest(p, "samples/refcnt2.xml");
CPPUNIT_ASSERT(ret == 0);
data = ((OutputPyPort*)p->nodeMap["b1.b.node1"]->getOutputPort("p1"))->get();
- CPPUNIT_ASSERT_EQUAL(19, data->ob_refcnt);
+ CPPUNIT_ASSERT(data->ob_refcnt==19);
}
void YacsLoaderTest::foreachs()
ret = driverTest(p, "samples/foreach6.xml");
CPPUNIT_ASSERT(ret == 0);
CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
+ ret = driverTest(p, "samples/foreach7.xml"); //needs GEOM_Superv component
+ CPPUNIT_ASSERT(ret == 0);
+ CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
}
void YacsLoaderTest::sinlines()
CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
delete p;
}
+
+void YacsLoaderTest::optimizers()
+{
+ Proc *p = 0;
+ int ret;
+ ret = driverTest(p, "samples/optimizer1.xml");
+ CPPUNIT_ASSERT(ret == 0);
+ CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
+ delete p;
+
+ ret = driverTest(p, "samples/optimizer2.xml");
+ CPPUNIT_ASSERT(ret == 0);
+ CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
+ delete p;
+
+ ret = driverTest(p, "samples/optimizer_sync_cpp.xml");
+ CPPUNIT_ASSERT(ret == 0);
+ CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
+ delete p;
+
+ ret = driverTest(p, "samples/optimizer_async_cpp.xml");
+ CPPUNIT_ASSERT(ret == 0);
+ CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
+ delete p;
+
+ ret = driverTest(p, "samples/optimizer_sync_py.xml");
+ CPPUNIT_ASSERT(ret == 0);
+ CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
+ delete p;
+
+ ret = driverTest(p, "samples/optimizer_async_py.xml");
+ CPPUNIT_ASSERT(ret == 0);
+ CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
+ delete p;
+}
+
+void YacsLoaderTest::pyremotes()
+{
+ Proc *p = 0;
+ int ret;
+ ret = driverTest(p, "samples/pyremote1.xml");
+ CPPUNIT_ASSERT(ret == 0);
+ CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
+ ret = driverTest(p, "samples/pyremote2.xml");
+ CPPUNIT_ASSERT(ret == 0);
+ CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
+ ret = driverTest(p, "samples/pyremote3.xml");
+ CPPUNIT_ASSERT(ret == 0);
+ CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
+ ret = driverTest(p, "samples/pyremote4.xml");
+ CPPUNIT_ASSERT(ret == 0);
+ CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
+}
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _YACSLOADERTEST_HXX_
#define _YACSLOADERTEST_HXX_
CPPUNIT_TEST(blocs);
CPPUNIT_TEST(refcnt);
CPPUNIT_TEST(foreachs);
- CPPUNIT_TEST(sinlines);
+ //CPPUNIT_TEST(sinlines);
CPPUNIT_TEST(bools);
CPPUNIT_TEST(integers);
CPPUNIT_TEST(doubles);
CPPUNIT_TEST(structs);
CPPUNIT_TEST(cpps);
CPPUNIT_TEST(datanodes);
+ CPPUNIT_TEST(optimizers);
+ CPPUNIT_TEST(pyremotes);
CPPUNIT_TEST_SUITE_END();
public:
void structs();
void cpps();
void datanodes();
+ void optimizers();
+ void pyremotes();
protected:
#!/bin/bash
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
if test -f @KERNEL_ROOT_DIR@/bin/salome/appli_gen.py ; then
chmod +x @builddir@/YacsLoaderInSessionTest.sh
./runSession @builddir@/YacsLoaderInSessionTest.sh
- ret1=$?
-
- # ---------------------------------------------------------------------------
- # --- second set of tests: Python scripts
-
- chmod +x @builddir@/YacsLoaderInSessionTest2.sh
- ./runSession @builddir@/YacsLoaderInSessionTest2.sh
- ret2=$?
+ ret=$?
# ---------------------------------------------------------------------------
kill -9 `cat "/tmp/YACSTEST_PidEcho"`
./runSession killSalome.py
- echo "exec status YacsLoaderInSessionTest.sh " $ret1
- echo "exec status YacsLoaderInSessionTest2.sh " $ret2
- let ret=$ret1+$ret2
+ echo "exec status YacsLoaderInSessionTest.sh " $ret
# --- delete all the SALOME Application environment
- ./bin/salome/appli_clean.sh
+ ./bin/salome/appli_clean.sh -f
else
--- /dev/null
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import SALOMERuntime
+
+class myalgoasync(SALOMERuntime.OptimizerAlgASync):
+ def __init__(self):
+ SALOMERuntime.OptimizerAlgASync.__init__(self, None)
+ r=SALOMERuntime.getSALOMERuntime()
+ self.tin=r.getTypeCode("double")
+ self.tout=r.getTypeCode("int")
+
+ def setPool(self,pool):
+ """Must be implemented to set the pool"""
+ self.pool=pool
+
+ def getTCForIn(self):
+ """returns typecode of type expected as Input"""
+ return self.tin
+
+ def getTCForOut(self):
+ """returns typecode of type expected as Output"""
+ return self.tout
+
+ def startToTakeDecision(self):
+ """This method is called only once to launch the algorithm. It must first fill the
+ pool with samples to evaluate and call self.signalMasterAndWait() to block until a
+ sample has been evaluated. When returning from this method, it MUST check for an
+ eventual termination request (with the method self.isTerminationRequested()). If
+ the termination is requested, the method must perform any necessary cleanup and
+ return as soon as possible. Otherwise it can either add new samples to evaluate in
+ the pool, do nothing (wait for more samples), or empty the pool and return to
+ finish the evaluation.
+ """
+ val=1.2
+ for iter in xrange(5):
+ #push a sample in the input of the slave node
+ self.pool.pushInSample(iter,val)
+ #wait until next sample is ready
+ self.signalMasterAndWait()
+ #check error notification
+ if self.isTerminationRequested():
+ self.pool.destroyAll()
+ return
+
+ #get a sample from the output of the slave node
+ currentId=self.pool.getCurrentId()
+ v=self.pool.getCurrentOutSample()
+ val=val+v.getIntValue()
+
+ #in the end destroy the pool content
+ self.pool.destroyAll()
--- /dev/null
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import SALOMERuntime
+
+class myalgosync(SALOMERuntime.OptimizerAlgSync):
+ def __init__(self):
+ SALOMERuntime.OptimizerAlgSync.__init__(self, None)
+ r=SALOMERuntime.getSALOMERuntime()
+ self.tin=r.getTypeCode("double")
+ self.tout=r.getTypeCode("int")
+
+ def setPool(self,pool):
+ """Must be implemented to set the pool"""
+ self.pool=pool
+
+ def getTCForIn(self):
+ """returns typecode of type expected as Input"""
+ return self.tin
+
+ def getTCForOut(self):
+ """returns typecode of type expected as Output"""
+ return self.tout
+
+ def initialize(self,input):
+ """Optional method called on initialization. Do nothing here"""
+
+ def start(self):
+ """Start to fill the pool with samples to evaluate."""
+ self.iter=0
+ self.pool.pushInSample(4,1.2)
+ self.pool.pushInSample(9,3.4)
+
+ def takeDecision(self):
+ """ This method is called each time a sample has been evaluated. It can either add
+ new samples to evaluate in the pool, do nothing (wait for more samples), or empty
+ the pool to finish the evaluation.
+ """
+ currentId=self.pool.getCurrentId()
+
+ if self.iter==1:
+ self.pool.pushInSample(16,5.6)
+ self.pool.pushInSample(25,7.8)
+ self.pool.pushInSample(36,9.)
+ self.pool.pushInSample(49,12.3)
+ elif self.iter==4:
+ self.pool.pushInSample(64,45.6)
+ self.pool.pushInSample(81,78.9)
+ else:
+ val=self.pool.getCurrentInSample()
+ if abs(val.getDoubleValue()-45.6) < 1.e-12:
+ self.pool.destroyAll()
+ self.iter=self.iter+1
+
+ def finish(self):
+ """Optional method called when the algorithm has finished, successfully or not, to
+ perform any necessary clean up. Do nothing here"""
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<module name="GEOM" path="@SALOME_ROOT_DIR@/GEOM@SALOME_VERSION@"/>
<module name="MED" path="@SALOME_ROOT_DIR@/MED@SALOME_VERSION@"/>
<module name="SMESH" path="@SALOME_ROOT_DIR@/SMESH@SALOME_VERSION@"/>
- <module name="SUPERV" path="@SALOME_ROOT_DIR@/SUPERV@SALOME_VERSION@"/>
<module name="VISU" path="@SALOME_ROOT_DIR@/VISU@SALOME_VERSION@"/>
<module name="HELLO" path="@SALOME_ROOT_DIR@/HELLO1@SALOME_VERSION@"/>
<module name="PYHELLO" path="@SALOME_ROOT_DIR@/PYHELLO1@SALOME_VERSION@"/>
- <module name="NETGENPLUGIN" gui="no" path="@SALOME_ROOT_DIR@/NETGENPLUGIN@SALOME_VERSION@"/>
- <module name="COMPONENT" gui="no" path="@SALOME_ROOT_DIR@/COMPONENT@SALOME_VERSION@"/>
- <module name="PYCALCULATOR" gui="no" path="@SALOME_ROOT_DIR@/PYCALCULATOR@SALOME_VERSION@"/>
- <module name="LIGHT" path="@SALOME_ROOT_DIR@/LIGHT@SALOME_VERSION@"/>
</modules>
<samples path="@SALOME_ROOT_DIR@/SAMPLES@SALOME_VERSION@"/>
</application>
#!/bin/sh
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
sleep 2
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __ECHO_IDL__
#define __ECHO_IDL__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include <time.h>
#include <pthread.h>
+#ifdef WNT
+#include <windows.h>
+#define sleep _sleep
+#else
#include <unistd.h>
+#endif
#include <echo.hh>
#!/usr/bin/env python
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
import sys
# Import the CORBA module
#!/usr/bin/env python
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
def triangle(n):
"""generate a YACS graph for computation of the Pascal triangle
#!/usr/bin/env python
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
debut="""
<proc>
<!-- types -->
+++ /dev/null
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-#
-# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-import sys
-import pilot
-import SALOMERuntime
-import loader
-import unittest
-
-class TestEdit(unittest.TestCase):
-
- def setUp(self):
- SALOMERuntime.RuntimeSALOME_setRuntime()
- self.r = pilot.getRuntime()
- self.l = loader.YACSLoader()
- self.e = pilot.ExecutorSwig()
- pass
-
- def test1_edit(self):
- p = self.r.createProc("pr")
- print p.typeMap
- t=p.getTypeCode("double")
- print t.kind()
- t=p.typeMap["double"]
-
- td=p.createType("double","double")
- ti=p.createType("int","int")
- tc1=p.createInterfaceTc("","Obj",[])
- print tc1.name(),tc1.id()
- tc2=p.createInterfaceTc("","Obj2",[tc1])
- print tc2.name(),tc2.id()
- tc3=p.createSequenceTc("","seqdbl",td)
- print tc3.name(),tc3.id(),tc3.contentType()
- tc4=p.createSequenceTc("","seqObj2",tc2)
- tc5=p.createSequenceTc("","seqint",ti)
- print tc4.name(),tc4.id()
- print tc4.isA(tc1),0
- print tc2.isA(tc1),1
- print tc1.isA(tc2),0
- print td.isA(ti),0
- print td.isAdaptable(ti),1
- print ti.isAdaptable(td),0
- print tc5.isAdaptable(tc3),0
- print tc3.isAdaptable(tc5),1
-
- n=self.r.createScriptNode("","node1")
- n.setScript("print 'coucou1'")
- n.edAddInputPort("p1",ti)
- n.edAddOutputPort("p1",ti)
- p.edAddChild(n)
- inport=n.getInputPort("p1");
- retex=None
- try:
- inport.edInitXML("<value><intt>5</int></value>")
- except ValueError, ex:
- print "Value Error: ", ex
- retex=ex
- except pilot.Exception,ex:
- print "YACS exception:",ex.what()
- retex=ex.what()
- self.assert_(retex is not None, "exception not raised, or wrong type")
- inport.edInitXML("<value><int>5</int></value>")
-
- # --- create script node node2
- n2=self.r.createScriptNode("","node2")
- n2.setScript("print 'coucou2'")
- n2.edAddInputPort("p1",ti)
- p.edAddChild(n2)
- # --- end of node
-
- # --- control link between nodes n and n2
- p.edAddCFLink(n,n2)
- # --- end control link
-
- # --- datalink between ports p1 of nodes n1 and n2
- p.edAddLink(n.getOutputPort("p1"),n2.getInputPort("p1"))
- # --- end datalink
-
- n=self.r.createFuncNode("","node3")
- n.setScript("""
- def f():
- print 'coucou3'
- """)
- n.setFname("f")
- p.edAddChild(n)
-
- n4=self.r.createRefNode("","node4")
- n4.setRef("corbaname:rir:#test.my_context/Echo.Object")
- n4.setMethod("echoDouble")
- n4.edAddInputDataStreamPort("pin",ti)
- n4.edAddOutputDataStreamPort("pout",ti)
- p.edAddChild(n4)
-
- n5=self.r.createRefNode("","node5")
- n5.setRef("corbaname:rir:#test.my_context/Echo.Object")
- n5.setMethod("echoDouble")
- n5.edAddInputDataStreamPort("pin",ti)
- n5.edAddOutputDataStreamPort("pout",ti)
- p.edAddChild(n5)
-
- p.edAddLink(n4.getOutputDataStreamPort("pout"),n5.getInputDataStreamPort("pin"))
-
- #n=self.r.createCompoNode("","node5")
- #n.setRef("PYHELLO")
- #n.setMethod("makeBanner")
- #p.edAddChild(n)
-
- # --- create a bloc with one node
- b=self.r.createBloc("b1")
- p.edAddChild(b)
-
- n=self.r.createScriptNode("","b1.node2")
- n.setScript("print 'coucou2'")
- b.edAddChild(n)
- # --- end bloc
-
- # --- create a for loop with one node
- lo=self.r.createForLoop("l1")
- p.edAddChild(lo)
- ip=lo.edGetNbOfTimesInputPort()
- ip.edInitInt(3)
-
- n=self.r.createScriptNode("","l1.node2")
- n.setScript("print 'coucou2'")
- lo.edSetNode(n)
- # --- end loop
-
- # --- control link between bloc b1 and loop l1
- p.edAddCFLink(b,lo)
- # --- end control link
-
- # --- create a while loop with one node
- wh=self.r.createWhileLoop("w1")
- p.edAddChild(wh)
- n=self.r.createFuncNode("","w1.node3")
- n.setScript("""
-def f():
- print 'coucou3'
- return 0
-""")
- n.setFname("f")
- n.edAddOutputPort("p1",ti)
- wh.edSetNode(n)
- cport=wh.edGetConditionPort()
- cport.edInitBool(True)
- # --- end loop
- p.edAddLink(n.getOutputPort("p1"),wh.getInputPort("condition")) #or cport
-
- # --- create a switch
- sw=self.r.createSwitch("sw1")
- p.edAddChild(sw)
- n=self.r.createFuncNode("","sw1.node3")
- n.setScript("""
-def f():
- print 'case1'
- return 0
-""")
- n.setFname("f")
- n.edAddOutputPort("p1",ti)
- sw.edSetNode(1,n)
- n=self.r.createFuncNode("","sw1.node4")
- n.setScript("""
-def f():
- print 'default'
- return 0
-""")
- n.setFname("f")
- n.edAddOutputPort("p1",ti)
- sw.edSetDefaultNode(n)
- sw.edGetConditionPort().edInitInt(1)
- # --- end switch
-
- try:
- self.e.RunW(p,0)
- except pilot.Exception,ex:
- print ex.what()
- self.fail(ex)
-
- #self.e.displayDot(p)
-
-
-import os
-U = os.getenv('USER')
-f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-f.write(" --- TEST src/yacsloader: testEdit.py\n")
-suite = unittest.makeSuite(TestEdit)
-unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-f.close()
+++ /dev/null
-#!/usr/bin/env python
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-#
-# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-import time
-import unittest
-import threading
-
-import SALOMERuntime
-import loader
-import pilot
-
-class TestExec(unittest.TestCase):
-
- def setUp(self):
- SALOMERuntime.RuntimeSALOME_setRuntime(1)
- self.l = loader.YACSLoader()
- self.e = pilot.ExecutorSwig()
- self.p = self.l.load("samples/aschema.xml")
- pass
-
- def test1_StepByStep(self):
- # --- execution step by step
-
- print "================= Start of STEPBYSTEP ==================="
- self.e.setExecMode(1) # YACS::STEPBYSTEP
-
- run1 = threading.Thread(None, self.e.RunPy, "stepbystep", (self.p,0))
- run1.start()
- time.sleep(0.1) # let the thread be initialised
- #e.displayDot(self.p)
-
- tocont = True
- while tocont:
- self.e.waitPause()
- #e.displayDot(p)
- bp = self.e.getTasksToLoad()
- print "nexts possible steps = ", bp
- if len(bp) > 0:
- tte= bp[-1:] # only one node at each step, the last one in the list
- r = self.e.setStepsToExecute(tte)
- self.e.resumeCurrentBreakPoint()
- tocont = self.e.isNotFinished()
- else:
- tocont = False
- pass
- print "toContinue = ", tocont
- pass
-
- self.e.resumeCurrentBreakPoint()
- run1.join()
- self.assertEqual(106, self.p.getChildByName('node48').getEffectiveState())
- self.assertEqual(999, self.p.getChildByName('node13').getEffectiveState())
- self.assertEqual(888, self.p.getChildByName('node14').getEffectiveState())
- self.assertEqual(777, self.p.getChildByName('c1').getEffectiveState())
- self.assertEqual(777, self.p.getChildByName('c1.c1.n2').getEffectiveState())
- self.assertEqual(106, self.p.getChildByName('c0.c1.n1').getEffectiveState())
- self.assertEqual(999, self.p.getChildByName('c0.n2').getEffectiveState())
- self.assertEqual(888, self.p.getChildByName('node62').getEffectiveState())
- print "================= End of STEPBYSTEP ====================="
- pass
-
- def test2_StopToBreakpoint(self):
- # --- start execution, set a breakpoint before node48, then continue
- time.sleep(1)
- print "================= Start of BREAKPOINT ==================="
- brp=['node48']
- self.e.setListOfBreakPoints(brp)
- self.e.setExecMode(2) # YACS::STOPBEFORENODES
- self.run2 = threading.Thread(None, self.e.RunPy, "breakpoint", (self.p,0))
- self.run2.start()
- time.sleep(0.1)
- self.e.waitPause()
- #self.e.displayDot(p)
- print "================= reach BREAKPOINT ======================"
- # --- resume from breakpoint
- print "=========== BREAKPOINT, start RESUME ===================="
- time.sleep(1)
- self.e.setExecMode(0) # YACS::CONTINUE
- self.e.resumeCurrentBreakPoint()
- time.sleep(0.1)
- self.e.waitPause()
- #self.e.displayDot(p)
- self.run2.join()
- self.assertEqual(106, self.p.getChildByName('node48').getEffectiveState())
- self.assertEqual(999, self.p.getChildByName('node13').getEffectiveState())
- self.assertEqual(888, self.p.getChildByName('node14').getEffectiveState())
- self.assertEqual(777, self.p.getChildByName('c1').getEffectiveState())
- self.assertEqual(777, self.p.getChildByName('c1.c1.n2').getEffectiveState())
- self.assertEqual(106, self.p.getChildByName('c0.c1.n1').getEffectiveState())
- self.assertEqual(999, self.p.getChildByName('c0.n2').getEffectiveState())
- self.assertEqual(888, self.p.getChildByName('node62').getEffectiveState())
- print "================= End of RESUME ========================="
- pass
-
- def test3_RunWithoutBreakpoints(self):
- # --- start execution, run without breakpoints
- time.sleep(1)
-
- print "================= Start of CONTINUE ====================="
- self.e.setExecMode(0) # YACS::CONTINUE
- run3 = threading.Thread(None, self.e.RunPy, "continue", (self.p,0))
- run3.start()
- time.sleep(0.1)
- self.e.waitPause()
- #self.e.displayDot(p)
- run3.join()
- self.assertEqual(106, self.p.getChildByName('node48').getEffectiveState())
- self.assertEqual(999, self.p.getChildByName('node13').getEffectiveState())
- self.assertEqual(888, self.p.getChildByName('node14').getEffectiveState())
- self.assertEqual(777, self.p.getChildByName('c1').getEffectiveState())
- self.assertEqual(777, self.p.getChildByName('c1.c1.n2').getEffectiveState())
- self.assertEqual(106, self.p.getChildByName('c0.c1.n1').getEffectiveState())
- self.assertEqual(999, self.p.getChildByName('c0.n2').getEffectiveState())
- self.assertEqual(888, self.p.getChildByName('node62').getEffectiveState())
- print "================= End of CONTINUE ======================="
- pass
-
- def test4_StopOnError(self):
- # --- stop execution on first error and save state
- time.sleep(1)
-
- print "================= Start of STOPONERROR =================="
- self.e.setStopOnError()
- run4 = threading.Thread(None, self.e.RunPy, "continue", (self.p,0))
- run4.start()
- time.sleep(0.1)
- self.e.waitPause()
- self.e.saveState("dumpErrorASchema.xml")
- self.e.stopExecution()
- run4.join()
- #self.e.displayDot(self.p)
- s13 = self.p.getChildByName('node13').getEffectiveState()
- s43 = self.p.getChildByName('node43').getEffectiveState()
- self.assert_((s13==999) or (s43==999))
- print "================= End of STOPONERROR ====================="
- pass
-
- def test5_PartialExec(self):
- # --- stop execution after breakpoint
- time.sleep(1)
-
- print "================= Start of PARTIALEXEC ==================="
- brp=['node35']
- self.e.setListOfBreakPoints(brp)
- self.e.setExecMode(2) # YACS::STOPBEFORENODES
- #self.e.displayDot(self.p)
- run5 = threading.Thread(None, self.e.RunPy, "breakpoint", (self.p,0))
- run5.start()
- time.sleep(0.1)
- self.e.waitPause()
- #self.e.displayDot(self.p)
- self.e.saveState('dumpPartialASchema.xml')
- #self.e.displayDot(self.p)
- self.e.stopExecution()
- run5.join()
- #self.e.displayDot(self.p)
- self.assertEqual(106, self.p.getChildByName('node34').getEffectiveState())
- self.assertEqual(101, self.p.getChildByName('node35').getEffectiveState())
- print "================= reach BREAKPOINT PARTIAL EXEC =========="
- pass
-
- pass
-
-import os
-U = os.getenv('USER')
-f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-f.write(" --- TEST src/yacsloader: testExec.py\n")
-suite = unittest.makeSuite(TestExec)
-unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-f.close()
+++ /dev/null
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-#
-# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-import pilot
-import SALOMERuntime
-import loader
-import unittest
-
-class TestLoader(unittest.TestCase):
-
- def setUp(self):
- SALOMERuntime.RuntimeSALOME_setRuntime()
- self.r = pilot.getRuntime()
- self.l = loader.YACSLoader()
- self.e = pilot.ExecutorSwig()
- pass
-
- def tearDown(self):
- del self.r
- del self.l
- del self.e
-
- def test1_FileNotExist(self):
- # --- File does not exist
- retex=None
- try:
- p = self.l.load("nonexisting")
- except IOError, ex:
- print "IO Error: ", ex
- retex=ex
- #except pilot.invalid_argument,ex:
- # print "invalid_argument:",ex.what()
- # retex=ex.what()
- self.assert_(retex is not None, "exception not raised, or wrong type")
- pass
-
- def test2_parseError(self):
- # --- File exists but parse error
- retex=None
- try:
- p = self.l.load("samples/bid.xml")
- except ValueError,ex:
- print "Caught ValueError Exception:",ex
- retex = ex
- expected="LogRecord: parser:ERROR:from node node5 does not exist in control link: node5->b2 context: b1. (samples/bid.xml:53)\n"
- self.assert_(p.getLogger("parser").getStr() == expected, "error not found: "+p.getLogger("parser").getStr())
- pass
-
- def test3_normal(self):
- # --- File exists and no parsing problem
- try:
- p = self.l.load("samples/aschema.xml")
- print p.getLogger("parser").getStr()
- print p
- print p.getName()
- for k in p.typeMap: print k
- for k in p.nodeMap: print k
- for k in p.inlineMap: print k
- for k in p.serviceMap: print k
- print self.e.getTasksToLoad()
- self.e.RunW(p,0)
- self.assertEqual(106, p.getChildByName('node48').getEffectiveState())
- except pilot.Exception,ex:
- print "YACS exception:",ex
- self.fail(ex)
- pass
- pass
-
-import os
-U = os.getenv('USER')
-f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-f.write(" --- TEST src/yacsloader: testLoader.py\n")
-suite = unittest.makeSuite(TestLoader)
-unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-f.close()
+++ /dev/null
-
-import unittest
-import pilot
-import SALOMERuntime
-
-class TestContainerRef(unittest.TestCase):
- def setUp(self):
- SALOMERuntime.RuntimeSALOME_setRuntime()
- self.r=SALOMERuntime.getSALOMERuntime()
- self.p=self.r.createProc("pr")
-
- def test0(self):
- """test delete following creation from class"""
- co=self.r.createContainer()
- self.assertEqual(co.getRefCnt(), 1)
- self.assert_(co.thisown)
- del co
-
- def test1(self):
- """test delete following creation from createContainer and delitem from containerMap"""
- co=self.p.createContainer("c2")
- del self.p.containerMap["c2"]
- self.assert_(co.thisown)
- self.assertEqual(co.getRefCnt(), 1)
- del co
-
- def test2(self):
- """test delete following creation from createContainer and
- manipulations on containerMap
- """
- co=self.p.createContainer("c2")
- self.p.containerMap["c2"]=co
- del self.p.containerMap["c2"]
- self.assert_(co.thisown)
- self.assertEqual(co.getRefCnt(), 1)
- del co
-
- def test3(self):
- """test existence on getitem followed by delitem"""
- self.p.createContainer("c9")
- co=self.p.containerMap["c9"]
- self.assertEqual(co.getRefCnt(), 2)
- del self.p.containerMap["c9"]
- self.assertEqual(co.getName(), "c9")
- self.assertEqual(co.getRefCnt(), 1)
- self.assert_(co.thisown)
- del co
-
- def test4(self):
- """test delete from containerMap following creation from createContainer"""
- co=self.p.createContainer("c10")
- del self.p.containerMap["c10"]
- self.assertEqual(co.getName(), "c10")
- self.assertEqual(co.getRefCnt(), 1)
- self.assert_(co.thisown)
- del co
-
- def test5(self):
- """test existence container following delete proc"""
- co=self.p.createContainer("c10")
- del self.p
- self.assertEqual(co.getName(), "c10")
- self.assertEqual(co.getRefCnt(), 1)
- self.assert_(co.thisown)
- del co
-
- def test6(self):
- """test ownership of container on getitem from containerMap"""
- co=self.p.createContainer("c8")
- self.assertEqual(co.getRefCnt(), 2)
- self.assert_(co.thisown)
- del co
- self.assertEqual(self.p.containerMap["c8"].getRefCnt(), 2) # +1 for getitem
- co=self.p.containerMap["c8"]
- self.assertEqual(co.getRefCnt(), 2)
- self.assert_(co.thisown)
- del co
- self.assertEqual(self.p.containerMap["c8"].getRefCnt(), 2) # +1 for getitem
- del self.p.containerMap["c8"]
-
- def test7(self):
- """test getitem following creation from class"""
- co=self.r.createContainer()
- self.assertEqual(co.getRefCnt(), 1)
- self.p.containerMap["c8"]=co
- self.assertEqual(co.getRefCnt(), 2)
- d=self.p.containerMap["c8"]
- self.assertEqual(d.getRefCnt(), 3)
- del self.p.containerMap["c8"]
- self.assertEqual(d.getRefCnt(), 2)
- self.assertEqual(co.getRefCnt(), 2)
- del co
- self.assertEqual(d.getRefCnt(), 1)
-
- def test8(self):
- """test setitem following creation from class"""
- co=self.r.createContainer()
- self.p.containerMap["c8"]=co
- d=self.p.containerMap["c8"]
- self.p.containerMap["c9"]=d
- self.assertEqual(d.getRefCnt(), 4)
-
- def test9(self):
- """test method values"""
- self.p.createContainer("c8")
- for co in self.p.containerMap.values():
- self.assert_(co.thisown)
- self.assertEqual(co.getRefCnt(), 2)
-
- def test10(self):
- """test method items"""
- self.p.createContainer("c8")
- for k,co in self.p.containerMap.items():
- self.assert_(co.thisown)
- self.assertEqual(co.getRefCnt(), 2)
-
- def test11(self):
- """test method clear"""
- co=self.p.createContainer("c8")
- self.p.containerMap.clear()
- self.assert_(co.thisown)
- self.assertEqual(co.getRefCnt(), 1)
-
- def test12(self):
- """test method update"""
- co=self.p.createContainer("c8")
- d={"c1":co}
- self.p.containerMap.update(d)
- self.assert_(co.thisown)
- self.assertEqual(co.getRefCnt(), 3)
-
-class TestTypeCodeRef(unittest.TestCase):
- def setUp(self):
- self.r=SALOMERuntime.getSALOMERuntime()
- self.p=self.r.createProc("pr")
-
- def test0(self):
- """test delete following creation from createSequenceTc"""
- tc=pilot.TypeCode(pilot.Double)
- self.assertEqual(tc.getRefCnt(), 1)
- self.assert_(tc.thisown)
-
- def test1(self):
- """test delete following creation from createInterfaceTc and delitem from typeMap"""
- tc=self.p.createInterfaceTc("","obj",[])
- del self.p.typeMap["obj"]
- self.assert_(tc.thisown)
- self.assertEqual(tc.getRefCnt(), 1)
-
- def test2(self):
- """test delete following creation from createInterfaceTc and
- manipulations on typeMap
- """
- tc=self.p.createInterfaceTc("","obj",[])
- self.p.typeMap["obj"]=tc
- del self.p.typeMap["obj"]
- self.assert_(tc.thisown)
- self.assertEqual(tc.getRefCnt(), 1)
-
- def test3(self):
- """test existence on getitem followed by delitem"""
- self.p.createInterfaceTc("","obj",[])
- tc=self.p.typeMap["obj"]
- self.assertEqual(tc.getRefCnt(), 2)
- del self.p.typeMap["obj"]
- self.assertEqual(tc.getRefCnt(), 1)
- self.assert_(tc.thisown)
-
- def test4(self):
- """test delete from typeMap following creation from createInterfaceTc"""
- tc=self.p.createInterfaceTc("","obj",[])
- del self.p.typeMap["obj"]
- self.assertEqual(tc.getRefCnt(), 1)
- self.assert_(tc.thisown)
-
- def test5(self):
- """test existence TypeCode following delete proc"""
- tc=self.p.createInterfaceTc("","obj",[])
- del self.p
- self.assertEqual(tc.getRefCnt(), 1)
- self.assert_(tc.thisown)
-
- def test6(self):
- """test ownership of TypeCode on getitem from typeMap"""
- tc=self.p.createInterfaceTc("","obj",[])
- self.assertEqual(tc.getRefCnt(), 2)
- self.assert_(tc.thisown)
- del tc
- self.assertEqual(self.p.typeMap["obj"].getRefCnt(), 2) # +1 for getitem
- tc=self.p.typeMap["obj"]
- self.assertEqual(tc.getRefCnt(), 2)
- self.assert_(tc.thisown)
- del tc
- self.assertEqual(self.p.typeMap["obj"].getRefCnt(), 2) # +1 for getitem
- del self.p.typeMap["obj"]
-
- def test7(self):
- """test getitem following creation from class"""
- tc=pilot.TypeCode.interfaceTc("obj","obj")
- self.assertEqual(tc.getRefCnt(), 1)
- self.p.typeMap["obj"]=tc
- self.assertEqual(tc.getRefCnt(), 2)
- d=self.p.typeMap["obj"]
- self.assertEqual(d.getRefCnt(), 3)
- del self.p.typeMap["obj"]
- self.assertEqual(d.getRefCnt(), 2)
- self.assertEqual(tc.getRefCnt(), 2)
- del tc
- self.assertEqual(d.getRefCnt(), 1)
-
- def test8(self):
- """test setitem following creation from class"""
- tc=pilot.TypeCodeObjref("obj","obj")
- self.p.typeMap["obj"]=tc
- d=self.p.typeMap["obj"]
- self.p.typeMap["t9"]=d
- self.assertEqual(d.getRefCnt(), 4)
-
- def test9(self):
- """test method values"""
- self.p.createInterfaceTc("","obj",[])
- for tc in self.p.typeMap.values():
- if tc.name()!="obj":continue
- self.assert_(tc.thisown)
- self.assertEqual(tc.getRefCnt(), 2)
-
- def test10(self):
- """test method items"""
- self.p.createInterfaceTc("","obj",[])
- for k,tc in self.p.typeMap.items():
- if tc.name()!="obj":continue
- self.assert_(tc.thisown)
- self.assertEqual(tc.getRefCnt(), 2)
-
- def test11(self):
- """test method clear"""
- tc=self.p.createInterfaceTc("","obj",[])
- self.p.typeMap.clear()
- self.assert_(tc.thisown)
- self.assertEqual(tc.getRefCnt(), 1)
-
- def test12(self):
- """test method update"""
- tc=self.p.createInterfaceTc("","obj",[])
- d={"c1":tc}
- self.p.typeMap.update(d)
- self.assert_(tc.thisown)
- self.assertEqual(tc.getRefCnt(), 3)
-
-import os
-U = os.getenv('USER')
-f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-f.write(" --- TEST src/yacsloader: testRefcount.py\n")
-suite1 = unittest.makeSuite(TestContainerRef)
-suite2 = unittest.makeSuite(TestTypeCodeRef)
-suite = unittest.TestSuite((suite1, suite2))
-unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-f.close()
-
+++ /dev/null
-#!/usr/bin/env python
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-#
-# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-import time
-import unittest
-import threading
-
-import SALOMERuntime
-import loader
-import pilot
-
-class TestResume(unittest.TestCase):
-
- def setUp(self):
- SALOMERuntime.RuntimeSALOME_setRuntime(1)
- self.l = loader.YACSLoader()
- self.e = pilot.ExecutorSwig()
- self.p = self.l.load("samples/bloc2.xml")
- pass
-
- def test1_PartialExec(self):
- # --- stop execution after breakpoint
- time.sleep(1)
-
- print "================= Start of PARTIALEXEC ==================="
- brp=['b1.b2.node1']
- self.e.setListOfBreakPoints(brp)
- self.e.setExecMode(2) # YACS::STOPBEFORENODES
- #self.e.displayDot(self.p)
- run1 = threading.Thread(None, self.e.RunPy, "breakpoint", (self.p,0))
- run1.start()
- time.sleep(0.1)
- self.e.waitPause()
- #self.e.displayDot(self.p)
- self.e.saveState('dumpPartialBloc2.xml')
- #self.e.displayDot(self.p)
- self.e.stopExecution()
- #self.e.displayDot(self.p)
- self.assertEqual(101, self.p.getChildByName('b1.b2.node1').getEffectiveState())
- self.assertEqual(106, self.p.getChildByName('b1.node1').getEffectiveState())
- print "================= reach BREAKPOINT PARTIAL EXEC =========="
- pass
-
- def test2_ExecFromLoadState(self):
- # --- reload state from previous partial execution then exec
- time.sleep(1)
-
- print "================= Start of EXECLOADEDSTATE ==============="
- sp = loader.stateParser()
- sl = loader.stateLoader(sp,self.p)
- sl.parse('dumpPartialBloc2.xml')
- #self.e.displayDot(self.p)
- self.e.setExecMode(0) # YACS::CONTINUE
- run2 = threading.Thread(None, self.e.RunPy, "loadState", (self.p,0,1,1))
- run2.start()
- time.sleep(0.1)
- self.e.waitPause()
- #self.e.displayDot(self.p)
- run2.join()
- self.assertEqual(106, self.p.getChildByName('node1').getEffectiveState())
- self.assertEqual(106, self.p.getChildByName('node2').getEffectiveState())
- self.assertEqual(106, self.p.getChildByName('b1.node1').getEffectiveState())
- self.assertEqual(106, self.p.getChildByName('b1.node2').getEffectiveState())
- self.assertEqual(106, self.p.getChildByName('b1.b2.node1').getEffectiveState())
- self.assertEqual(106, self.p.getChildByName('b1.b2.node2').getEffectiveState())
- self.assertEqual(106, self.p.getChildByName('b1.b2.loop1.node1').getEffectiveState())
- print "================= End of EXECLOADEDSTATE ================="
-
- pass
-
-import os
-U = os.getenv('USER')
-f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-f.write(" --- TEST src/yacsloader: testResume.py\n")
-suite = unittest.makeSuite(TestResume)
-unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-f.close()
+++ /dev/null
-#!/usr/bin/env python
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-#
-# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-import time
-import unittest
-import threading
-
-import SALOMERuntime
-import loader
-import pilot
-
-class TestSave(unittest.TestCase):
-
- def setUp(self):
- SALOMERuntime.RuntimeSALOME_setRuntime(1)
- pass
-
- def test0_saveAndExec(self):
- """Execute twice the scheme. Each time the final state is dumped
- and the scheme is written. The second exeuction is done with the
- saved scheme file. Final state dumps and scheme files produced must
- be identical for the 2 executions. Nodes are not always written in
- the same order, so the comparison is done after sort of lines...
- """
- schemaList = []
- schemaList += ["aschema","bschema","cschema","dschema","eschema","fschema"]
- schemaList += ["bloc1","bloc2","bloc3","bloc4"]
- schemaList += ["foreach1","foreach2","foreach4","foreach5"]
- schemaList += ["foreach_LongCorba","foreach_LongPython"]
- schemaList += ["forloop1","forloop2","forloop3","forloop4","forloop5","forloop6","forloop7"]
- schemaList += ["forwhile1"]
- schemaList += ["legendre7"]
- schemaList += ["switch1","switch2","switch3","switch4","switch5","switch6","switch7","switch8","switch9"]
- schemaList += ["while1","while2","while3"]
- r = pilot.getRuntime()
- l = loader.YACSLoader()
- e = pilot.ExecutorSwig()
- for schema in schemaList:
- fileOrig = "samples/" + schema + ".xml"
- saveSchema1 = "schema1_" + schema
- dumpSchema1 = "dump1_" + schema
- saveSchema2 = "schema2_" + schema
- dumpSchema2 = "dump2_" + schema
- try:
- p = l.load(fileOrig)
- s = pilot.SchemaSave(p)
- s.save(saveSchema1)
- e.RunW(p,0)
- e.saveState(dumpSchema1)
- p = l.load(saveSchema1)
- s = pilot.SchemaSave(p)
- s.save(saveSchema2)
- e.RunW(p,0)
- e.saveState(dumpSchema2)
- except ValueError, ex:
- print "Value Error: ", ex
- pb = "problem on " + fileOrig + " : ValueError"
- self.fail(pb)
- except pilot.Exception,ex:
- print ex.what()
- pb = "problem on " + fileOrig + " : " + ex.what()
- self.fail(pb)
- except:
- pb = "unknown problem on " + fileOrig
- self.fail(pb)
- s1=open(saveSchema1,'r')
- s2=open(saveSchema2,'r')
- d1=open(dumpSchema1,'r')
- d2=open(dumpSchema2,'r')
- ls1 = s1.readlines().sort()
- ls2 = s2.readlines().sort()
- ld1 = d1.readlines().sort()
- ld2 = d2.readlines().sort()
- pb1 = "file schemes produced by successive executions are not identical: " + fileOrig
- pb2 = "final dump states produced by successive executions are not identical: " + fileOrig
- self.assertEqual(ls1,ls2,pb1)
- self.assertEqual(ld1,ld2,pb2)
- pass
-
-
-import os
-U = os.getenv('USER')
-f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-f.write(" --- TEST src/yacsloader: testSave.py\n")
-suite = unittest.makeSuite(TestSave)
-unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-f.close()
#!/usr/bin/env python
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
import os
import orbmodule
+import salome_utils
clt = orbmodule.client()
-FactoryContainer = "/Containers/" + os.environ["NSHOST"] + "/FactoryServer"
+FactoryContainer = "/Containers/" + salome_utils.getShortHostName() + "/FactoryServer"
clt.waitNS(FactoryContainer)
#!/usr/bin/env python
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
import xmlrpclib,sys
#example
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _YACSLOADEREXPORT_HXX_
+#define _YACSLOADEREXPORT_HXX_
+
+#ifdef WNT
+# if defined YACSloader_EXPORTS
+# define YACSLOADER_EXPORT __declspec( dllexport )
+# else
+# define YACSLOADER_EXPORT __declspec( dllimport )
+# endif
+#else
+# define YACSLOADER_EXPORT
+#endif
+
+#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _BLOCPARSER_HXX_
#define _BLOCPARSER_HXX_
#include "linkParsers.hxx"
#include "xmlrpcParsers.hxx"
#include "nodeParsers.hxx"
+#include "inlineParsers.hxx"
+#include "remoteParsers.hxx"
+#include "serverParsers.hxx"
+#include "sinlineParsers.hxx"
+#include "serviceParsers.hxx"
#include "Proc.hxx"
#include "Runtime.hxx"
#include "ForLoop.hxx"
#include "ForEachLoop.hxx"
+#include "OptimizerLoop.hxx"
#include "WhileLoop.hxx"
#include "Switch.hxx"
#include "Bloc.hxx"
_orders["property"]=0;
_orders["inline"]=2;
_orders["service"]=2;
+ _orders["server"]=2;
+ _orders["remote"]=2;
_orders["sinline"]=2;
_orders["node"]=2;
_orders["datanode"]=2;
_orders["outnode"]=2;
_orders["forloop"]=2;
_orders["foreach"]=2;
+ _orders["optimizer"]=2;
_orders["while"]=2;
_orders["switch"]=2;
_orders["bloc"]=2;
currentProc->nodeMap[fullname]=n;
currentProc->serviceMap[fullname]=n;
}
+ virtual void remote (YACS::ENGINE::InlineNode* const& n)
+ {
+ DEBTRACE( "bloc_remote_set: " << n->getName() )
+ _bloc->edAddChild(n);
+ std::string fullname = currentProc->names.back()+n->getName();
+ currentProc->nodeMap[fullname]=n;
+ currentProc->inlineMap[fullname]=n;
+ }
+ virtual void server (YACS::ENGINE::ServerNode* const& n)
+ {
+ DEBTRACE( "bloc_server_set: " << n->getName() )
+ _bloc->edAddChild(n);
+ std::string fullname = currentProc->names.back()+n->getName();
+ currentProc->nodeMap[fullname]=n;
+ currentProc->inlineMap[fullname]=n;
+ }
virtual void node (YACS::ENGINE::InlineNode* const& n)
{
DEBTRACE( "bloc_node_set: " << n->getName() )
std::string fullname = currentProc->names.back()+b->getName();
currentProc->nodeMap[fullname]=b;
}
+ virtual void optimizer (YACS::ENGINE::OptimizerLoop* const& b)
+ {
+ DEBTRACE( "bloc_optimizer_set: " << b->getName() );
+ _bloc->edAddChild(b);
+ std::string fullname = currentProc->names.back()+b->getName();
+ currentProc->nodeMap[fullname]=b;
+ //fullname += ".splitter";
+ //currentProc->nodeMap[fullname]=b->getChildByShortName("splitter");
+ }
virtual void foreach (YACS::ENGINE::ForEachLoop* const& b)
{
DEBTRACE( "bloc_foreach_set: " << b->getName() )
else if(element == "inline")pp=&inlinetypeParser<>::inlineParser;
else if(element == "sinline")pp=&sinlinetypeParser<>::sinlineParser;
else if(element == "service")pp=&servicetypeParser<>::serviceParser;
+ else if(element == "server")pp=&servertypeParser<>::serverParser;
+ else if(element == "remote")pp=&remotetypeParser<>::remoteParser;
else if(element == "node")pp=&nodetypeParser<>::nodeParser;
else if(element == "datanode")pp=&presettypeParser<>::presetParser;
else if(element == "outnode")pp=&outnodetypeParser<>::outnodeParser;
else if(element == "bloc")pp=&bloctypeParser<>::blocParser;
else if(element == "forloop")pp=&forlooptypeParser<>::forloopParser;
else if(element == "foreach")pp=&foreachlooptypeParser<>::foreachloopParser;
+ else if(element == "optimizer")pp=&optimizerlooptypeParser<>::optimizerloopParser;
else if(element == "while")pp=&whilelooptypeParser<>::whileloopParser;
else if(element == "switch")pp=&switchtypeParser::switchParser;
else if(element == "inline")inline_(((inlinetypeParser<>*)child)->post());
else if(element == "sinline")sinline(((sinlinetypeParser<>*)child)->post());
else if(element == "service")service(((servicetypeParser<>*)child)->post());
+ else if(element == "server")server(((servertypeParser<>*)child)->post());
+ else if(element == "remote")remote(((remotetypeParser<>*)child)->post());
else if(element == "node")node(((nodetypeParser<>*)child)->post());
else if(element == "datanode")preset(((presettypeParser<>*)child)->post());
else if(element == "outnode")outnode(((outnodetypeParser<>*)child)->post());
else if(element == "bloc")bloc(((bloctypeParser<>*)child)->post());
else if(element == "forloop")forloop(((forlooptypeParser<>*)child)->post());
+ else if(element == "optimizer")optimizer(((optimizerlooptypeParser<>*)child)->post());
else if(element == "foreach")foreach(((foreachlooptypeParser<>*)child)->post());
else if(element == "while")while_(((whilelooptypeParser<>*)child)->post());
else if(element == "switch")switch_(((switchtypeParser*)child)->post());
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "codeParsers.hxx"
namespace YACS
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _CODEPARSERS_HXX_
#define _CODEPARSERS_HXX_
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "componentinstanceParsers.hxx"
+#include "containerParsers.hxx"
+#include "dataParsers.hxx"
+#include "propertyParsers.hxx"
+
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
+namespace YACS
+{
+ componentinstancetypeParser componentinstancetypeParser::componentinstanceParser;
+
+ void componentinstancetypeParser::buildAttr(const XML_Char** attr)
+ {
+ required("name",attr);
+ for (int i = 0; attr[i]; i += 2)
+ {
+ if(std::string(attr[i]) == "name")name(attr[i+1]);
+ if(std::string(attr[i]) == "kind")kind(attr[i+1]);
+ }
+ }
+ void componentinstancetypeParser::onStart(const XML_Char* el, const XML_Char** attr)
+ {
+ std::string element(el);
+ parser* pp=&parser::main_parser;
+ this->maxcount("component",1,element);
+ this->maxcount("load",1,element);
+ if(element == "property")pp=&propertytypeParser::propertyParser;
+ else if(element == "component")pp=&stringtypeParser::stringParser;
+ else if(element == "load")pp=&loadtypeParser::loadParser;
+ SetUserDataAndPush(pp);
+ pp->init();
+ pp->pre();
+ pp->buildAttr(attr);
+ }
+ void componentinstancetypeParser::onEnd(const char *el,parser* child)
+ {
+ std::string element(el);
+ if(element == "property")property(((propertytypeParser*)child)->post());
+ else if(element == "component") component(((stringtypeParser*)child)->post());
+ else if(element == "load") load(((loadtypeParser*)child)->post());
+ }
+
+ void componentinstancetypeParser::pre ()
+ {
+ _componentinstance._props.clear();
+ }
+
+ void componentinstancetypeParser::name(const std::string& name)
+ { _componentinstance._name=name; }
+
+ void componentinstancetypeParser::kind(const std::string& kind)
+ { _componentinstance._kind=kind; }
+
+ void componentinstancetypeParser::property (const myprop& prop)
+ {
+ DEBTRACE("property_set: "<<prop._name<<" "<<prop._value);
+ _componentinstance._props[prop._name]=prop._value;
+ }
+
+ void componentinstancetypeParser::component (const std::string& name)
+ {
+ DEBTRACE( "component_set: " << name )
+ _componentinstance._component=name;
+ }
+
+ void componentinstancetypeParser::load (const loadon& l)
+ {
+ DEBTRACE( "load: " )
+ _componentinstance._container=l._container;
+ }
+
+ mycomponentinstance componentinstancetypeParser::post()
+ {
+ this->mincount("component",1);
+ return _componentinstance;
+ }
+}
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _COMPONENTINSTANCEPARSER_HXX_
+#define _COMPONENTINSTANCEPARSER_HXX_
+
+#include "parserBase.hxx"
+#include "factory.hxx"
+
+namespace YACS
+{
+
+/*! \brief Class for componentinstance parser
+ *
+ * Class used to parse ComponentInstance description
+ *
+ * XML schema is
+ \verbatim
+ <xsd:complexType name="ComponentInstanceType">
+ <xsd:sequence>
+ <xsd:element name="component" type="xsd:string"/>
+ <xsd:element name="property" type="PropertyType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="kind" type="xsd:string"/>
+ </xsd:complexType>
+ \endverbatim
+ */
+struct componentinstancetypeParser: parser
+{
+ static componentinstancetypeParser componentinstanceParser;
+ virtual void buildAttr(const XML_Char** attr);
+ virtual void onStart(const XML_Char* el, const XML_Char** attr);
+ virtual void onEnd(const char *el,parser* child);
+ virtual void pre ();
+ virtual void name(const std::string& name);
+ virtual void kind(const std::string& kind);
+ virtual void component (const std::string& name);
+ virtual void property (const myprop& prop);
+ virtual void load (const loadon& l);
+ mycomponentinstance post();
+ mycomponentinstance _componentinstance;
+ std::string _container;
+};
+
+}
+
+#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "containerParsers.hxx"
#include "propertyParsers.hxx"
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
namespace YACS
{
containertypeParser containertypeParser::containerParser;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _CONTAINERPARSER_HXX_
#define _CONTAINERPARSER_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "dataParsers.hxx"
#include "Cstr2d.hxx"
#include <sstream>
double doubletypeParser::post()
{
+ if(_content=="")return 0;
return Cstr2d(_content.c_str());
// std::istringstream s(_content.c_str());
// double a;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _DATAPARSERS_HXX_
#define _DATAPARSERS_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "RuntimeSALOME.hxx"
#include "Proc.hxx"
#include "Exception.hxx"
Executor *myExec = (Executor *)argT[0];
Proc *myProc = (Proc *)argT[1];
myExec->RunB(myProc, 2);
+ return 0;
}
int
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "yacsconfig.h"
#include "RuntimeSALOME.hxx"
#include "Proc.hxx"
#ifdef SALOME_KERNEL
#include "SALOME_NamingService.hxx"
#include "SALOME_ModuleCatalog.hh"
+#include "Basics_Utils.hxx"
#endif
#include <iostream>
#include <fstream>
+#include <signal.h>
+
+#ifdef WNT
+#else
#include <argp.h>
+#endif
using YACS::YACSLoader;
using namespace YACS::ENGINE;
static char doc[] ="driver -- a SALOME YACS graph executor";
static char args_doc[] = "graph.xml";
+#ifdef WNT
+#else
static struct argp_option options[] =
{
- {"display", 'd', "level", 0, "Display dot files: 0=never to 3=very often"},
+ {"display", 'd', "level", 0, "Display dot files: 0=never to 3=very often (default 0)"},
{"verbose", 'v', 0, 0, "Produce verbose output" },
{"stop-on-error", 's', 0, 0, "Stop on first error" },
{"dump-on-error", 'e', "file", OPTION_ARG_OPTIONAL, "Stop on first error and dump state"},
{"dump-final", 'f', "file", OPTION_ARG_OPTIONAL, "dump final state"},
+ {"dump", 'g', "nbsec", OPTION_ARG_OPTIONAL, "dump state"},
{"load-state", 'l', "file", 0, "Load State from a previous partial execution"},
{"save-xml-schema", 'x', "file", OPTION_ARG_OPTIONAL, "dump xml schema"},
+ {"shutdown", 't', "level", 0, "Shutdown the schema: 0=no shutdown to 3=full shutdown (default 1)"},
+ {"reset", 'r', "level", 0, "Reset the schema before execution: 0=nothing, 1=reset error nodes to ready state (default 0)"},
+ {"kill-port", 'k', "port", 0, "Kill Salome application running on the specified port if the driver process is killed (with SIGINT or SIGTERM)"},
{ 0 }
};
+#endif
struct arguments
{
int stop;
char *dumpErrorFile;
char *finalDump;
+ int dump;
char *xmlSchema;
char *loadState;
+ int shutdown;
+ int reset;
+ int killPort;
};
+typedef struct {
+ int nbsec;
+ string dumpFile;
+ string lockFile;
+} thread_st;
+
+#ifdef WNT
+static int
+#else
static error_t
+#endif
parse_opt (int key, char *arg, struct argp_state *state)
{
+#ifdef WNT
+#else
// Get the input argument from argp_parse, which we
// know is a pointer to our arguments structure.
struct arguments *myArgs = (arguments*)state->input;
case 'd':
myArgs->display = atoi(arg);
break;
+ case 't':
+ myArgs->shutdown = atoi(arg);
+ break;
+ case 'r':
+ myArgs->reset = atoi(arg);
+ break;
case 'v':
myArgs->verbose = 1;
break;
if (arg)
myArgs->dumpErrorFile = arg;
else
- myArgs->dumpErrorFile = "dumpErrorState.xml";
+ myArgs->dumpErrorFile = (char *)"dumpErrorState.xml";
break;
case 'f':
if (arg)
myArgs->finalDump = arg;
else
- myArgs->finalDump = "finalDumpState.xml";
+ myArgs->finalDump = (char *)"finalDumpState.xml";
+ break;
+ case 'g':
+ if (arg)
+ myArgs->dump = atoi(arg);
+ else
+ myArgs->dump = 60;
break;
case 'l':
myArgs->loadState = arg;
if (arg)
myArgs->xmlSchema = arg;
else
- myArgs->xmlSchema = "saveSchema.xml";
+ myArgs->xmlSchema = (char *)"saveSchema.xml";
break;
+ case 'k':
+ myArgs->killPort = atoi(arg);
+ break;
case ARGP_KEY_ARG:
if (state->arg_num >=1) // Too many arguments.
default:
return ARGP_ERR_UNKNOWN;
}
+#endif
return 0;
}
// Our argp parser.
+#ifdef WNT
+#else
static struct argp argp = { options, parse_opt, args_doc, doc };
+#endif
void timer(std::string msg)
{
+#ifdef WNT
+#else
struct timeval tv;
gettimeofday(&tv,NULL);
long t=tv.tv_sec*1000+tv.tv_usec/1000;
static long t0=t;
gettimeofday(&tv,NULL);
std::cerr << msg << tv.tv_sec*1000+tv.tv_usec/1000-t0 << " ms" << std::endl;
+#endif
}
-main (int argc, char* argv[])
+Proc* p=0;
+static struct arguments myArgs;
+
+void Handler(int theSigId)
+{
+ if(p)
+ {
+ p->cleanNodes();
+ //if requested save state
+ bool isFinalDump = (strlen(myArgs.finalDump) != 0);
+ if (isFinalDump)
+ {
+ YACS::ENGINE::VisitorSaveState vst(p);
+ vst.openFileDump(myArgs.finalDump);
+ p->accept(&vst);
+ vst.closeFileDump();
+ }
+ //if requested shutdown schema
+ if(myArgs.shutdown < 999)
+ {
+ p->shutdown(myArgs.shutdown);
+ }
+ }
+ if (myArgs.killPort)
+ {
+ ostringstream command;
+ command << "killSalomeWithPort.py " << myArgs.killPort;
+ int status = system(command.str().c_str());
+ if (status == 0)
+ cerr << "Salome application on port " << myArgs.killPort << " is killed" << endl;
+ else
+ cerr << "Error: Can't kill Salome application on port " << myArgs.killPort << endl;
+ }
+ _exit(1);
+}
+
+void * dumpState(void *arg)
+{
+ thread_st *st = (thread_st*)arg;
+ YACS::StatesForNode state = p->getEffectiveState();
+ while((state != YACS::DONE) && (state != YACS::LOADFAILED) && (state != YACS::EXECFAILED) && (state != YACS::INTERNALERR) && (state != YACS::DISABLED) && (state != YACS::FAILED) && (state != YACS::ERROR)){
+#ifdef WIN32
+ Sleep(st->nbsec);
+#else
+ sleep(st->nbsec);
+#endif
+ string cmd = "touch " + st->lockFile;
+ system(cmd.c_str());
+ YACS::ENGINE::VisitorSaveState vst(p);
+ vst.openFileDump(st->dumpFile);
+ p->accept(&vst);
+ vst.closeFileDump();
+ cmd = "rm -f " + st->lockFile;
+ system(cmd.c_str());
+ state = p->getEffectiveState();
+ }
+ delete st;
+ return NULL;
+}
+
+#ifndef WIN32
+typedef void (*sighandler_t)(int);
+sighandler_t setsig(int sig, sighandler_t handler)
+{
+ struct sigaction context, ocontext;
+ context.sa_handler = handler;
+ sigemptyset(&context.sa_mask);
+ context.sa_flags = 0;
+ if (sigaction(sig, &context, &ocontext) == -1)
+ return SIG_ERR;
+ return ocontext.sa_handler;
+}
+#endif
+
+
+int main (int argc, char* argv[])
{
- struct arguments myArgs;
// Default values.
myArgs.display = 0;
myArgs.verbose = 0;
myArgs.stop = 0;
- myArgs.dumpErrorFile= "";
- myArgs.finalDump = "";
- myArgs.loadState = "";
- myArgs.xmlSchema = "";
+ myArgs.dumpErrorFile= (char *)"";
+ myArgs.finalDump = (char *)"";
+ myArgs.dump = 0;
+ myArgs.loadState = (char *)"";
+ myArgs.xmlSchema = (char *)"";
+ myArgs.shutdown = 1;
+ myArgs.reset = 0;
+ myArgs.killPort = 0;
// Parse our arguments; every option seen by parse_opt will be reflected in arguments.
+#ifdef WNT
+#else
argp_parse (&argp, argc, argv, 0, 0, &myArgs);
- cerr << "graph = " << myArgs.args[0]
- << " options: display=" << myArgs.display
- << " verbose="<<myArgs.verbose
- << " stop-on-error=" << myArgs.stop;
+ std::cerr << "graph = " << myArgs.args[0];
+ std::cerr << " options: display=" << myArgs.display;
+ std::cerr << " verbose="<<myArgs.verbose;
+ std::cerr << " stop-on-error=" << myArgs.stop;
+ std::cerr << " shutdown=" << myArgs.shutdown;
+ std::cerr << " reset=" << myArgs.reset;
+ if (myArgs.killPort)
+ std::cerr << " kill-port=" << myArgs.killPort;
if (myArgs.stop)
- cerr << " dumpErrorFile=" << myArgs.dumpErrorFile << endl;
+ std::cerr << " dumpErrorFile=" << myArgs.dumpErrorFile << std::endl;
else
- cerr << endl;
+ std::cerr << std::endl;
+#endif
+
+#ifndef WNT
+ setsig(SIGINT,&Handler);
+ setsig(SIGTERM,&Handler);
+#endif
timer("Starting ");
RuntimeSALOME::setRuntime();
try
{
timer("Elapsed time before load: ");
- Proc* p=loader.load(myArgs.args[0]);
+ p=loader.load(myArgs.args[0]);
if(p==0)
{
std::cerr << "The imported file is probably not a YACS schema file" << std::endl;
//Don't execute if there are errors
if(logger->hasErrors())
{
+ if(!p->isValid())
+ {
+ std::string report=p->getErrorReport();
+ std::cerr << "The schema is not valid and can not be executed" << std::endl;
+ std::cerr << report << std::endl;
+ }
delete p;
Runtime* r=YACS::ENGINE::getRuntime();
Dispatcher* disp=Dispatcher::getDispatcher();
stateParser* rootParser = new stateParser();
stateLoader myStateLoader(rootParser, p);
myStateLoader.parse(myArgs.loadState);
+ if(myArgs.reset>0)
+ {
+ p->resetState(myArgs.reset);
+ p->exUpdateState();
+ }
}
if (myArgs.stop)
else
executor.setStopOnError(false, myArgs.dumpErrorFile);
- std::ofstream f("toto");
- p->writeDot(f);
- f.close();
+ if(myArgs.display>0)
+ {
+ std::ofstream f("toto");
+ p->writeDot(f);
+ f.close();
+ }
+
+ bool isDump = (myArgs.dump != 0);
+ pthread_t th;
+ if (isDump)
+ {
+ thread_st *st = new thread_st;
+ st->nbsec = myArgs.dump;
+ st->dumpFile = string("dumpState_") + myArgs.args[0];
+ string rootFile = st->dumpFile.substr(0,st->dumpFile.find("."));
+ st->lockFile = rootFile + ".lock";
+ pthread_create(&th,NULL,&dumpState,(void*)st);
+ }
cerr << "+++++++++++++++++++ start calculation +++++++++++++++++++" << endl;
executor.RunW(p,myArgs.display, fromScratch);
cerr << "+++++++++++++++++++ end calculation +++++++++++++++++++" << endl;
- cerr << "Proc state : " << p->getEffectiveState() << endl;
+ cerr << "Proc state : " << Node::getStateName(p->getEffectiveState()) << endl;
timer("Elapsed time after execution: ");
+ // Return 0 if SCHEMA OK
+ // Return 1 for YACS ERROR (EXCEPTION NOT CATCHED)
+ // Return 2 for YACS SCHEMA ERROR/FAILED
+ int return_value = 0;
+
if(p->getEffectiveState() != YACS::DONE)
{
std::string report=p->getErrorReport();
std::cerr << "Execution has ended in error" << std::endl;
std::cerr << report << std::endl;
+ return_value = 2;
}
- std::ofstream g("titi");
- p->writeDot(g);
- g.close();
+ if(myArgs.display>0)
+ {
+ std::ofstream g("titi");
+ p->writeDot(g);
+ g.close();
+ }
+
+ if (isDump)
+ {
+ pthread_join(th,NULL);
+ }
bool isFinalDump = (strlen(myArgs.finalDump) != 0);
if (isFinalDump)
p->accept(&vst);
vst.closeFileDump();
}
+ if(myArgs.shutdown < 999)
+ {
+ p->shutdown(myArgs.shutdown);
+ }
delete p;
Runtime* r=YACS::ENGINE::getRuntime();
Dispatcher* disp=Dispatcher::getDispatcher();
r->fini();
delete r;
delete disp;
- return 0;
+ return return_value;
}
catch (YACS::Exception& e)
{
}
catch(CORBA::SystemException& ex)
{
- cerr << "Caught a CORBA::SystemException." ;
+ cerr << "Caught a CORBA::SystemException.:" << __FILE__ << ":" << __LINE__ << ":" ;
CORBA::Any tmp;
tmp <<= ex;
CORBA::TypeCode_var tc = tmp.type();
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include <iostream>
#include "factory.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _FACTORY_HXX_
#define _FACTORY_HXX_
std::string _container;
};
+struct mycomponentinstance
+{
+ std::string _name;
+ std::string _kind;
+ std::string _component;
+ std::string _container;
+ std::map<std::string,std::string> _props;
+};
+
#endif
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _INLINEPARSERS_HXX_
+#define _INLINEPARSERS_HXX_
+
+#include "parserBase.hxx"
+#include "containerParsers.hxx"
+#include "dataParsers.hxx"
+#include "portParsers.hxx"
+#include "codeParsers.hxx"
+#include "propertyParsers.hxx"
+
+#include "Proc.hxx"
+#include "TypeCode.hxx"
+#include "InlineNode.hxx"
+#include "Exception.hxx"
+#include "Runtime.hxx"
+#include "Container.hxx"
+#include "ComponentInstance.hxx"
+#include "OutputDataStreamPort.hxx"
+#include "InputDataStreamPort.hxx"
+#include "ComponentInstance.hxx"
+#include "factory.hxx"
+
+extern YACS::ENGINE::Proc* currentProc;
+extern YACS::ENGINE::Runtime* theRuntime;
+
+namespace YACS
+{
+
+static std::string t1[]={"script","function",""};
+
+template <class T=YACS::ENGINE::InlineNode*>
+struct inlinetypeParser:public nodetypeParser<T>
+{
+ static inlinetypeParser<T> inlineParser;
+
+ virtual void onStart(const XML_Char* el, const XML_Char** attr);
+ virtual void onEnd(const char *el,parser* child)
+ {
+ DEBTRACE( "inlinetypeParser::onEnd: " << el )
+ std::string element(el);
+ if(element == "kind")kind(((stringtypeParser*)child)->post());
+ else if(element == "script")script(((codetypeParser*)child)->post());
+ else if(element == "function")function(((functypeParser*)child)->post());
+ else if(element == "property")this->property(((propertytypeParser*)child)->post());
+ else if(element == "inport") inport(((inporttypeParser<myinport>*)child)->post());
+ else if(element == "outport") outport(((outporttypeParser<myoutport>*)child)->post());
+ }
+ virtual void buildAttr(const XML_Char** attr)
+ {
+ this->required("name",attr);
+ for (int i = 0; attr[i]; i += 2)
+ {
+ if(std::string(attr[i]) == "name")this->name(attr[i+1]);
+ if(std::string(attr[i]) == "state")this->state(attr[i+1]);
+ }
+ }
+ virtual void pre ()
+ {
+ this->_node=0;
+ _kind="";
+ this->_state="";
+ this->_container="";
+ }
+ virtual void kind (const std::string& name)
+ {
+ DEBTRACE( "inline_kind " << name )
+ _kind=name;
+ }
+
+ virtual void script (const myfunc& f){}
+ virtual void function (const myfunc& f) {}
+
+ virtual void inport (const myinport& p)
+ {
+ DEBTRACE( "inline_inport: " << p._name <<":"<<p._type)
+ if(this->_node==0)
+ throw YACS::Exception("Node must be completely defined before defining its ports");
+
+ if(currentProc->typeMap.count(p._type)==0)
+ {
+ //Check if the typecode is defined in the runtime
+ YACS::ENGINE::TypeCode* t=theRuntime->getTypeCode(p._type);
+ if(t==0)
+ {
+ std::string msg="Unknown InPort Type: ";
+ msg=msg+p._type+" for node: "+this->_node->getName()+" port name: "+p._name;
+ throw YACS::Exception(msg);
+ }
+ else
+ {
+ currentProc->typeMap[p._type]=t;
+ t->incrRef();
+ }
+ }
+ this->_node->edAddInputPort(p._name,currentProc->typeMap[p._type]);
+ }
+ virtual void outport (const myoutport& p)
+ {
+ DEBTRACE( "inline_outport: " << p._name <<":"<<p._type)
+ if(this->_node==0)
+ throw YACS::Exception("Node must be completely defined before defining its ports");
+
+ if(currentProc->typeMap.count(p._type)==0)
+ {
+ YACS::ENGINE::TypeCode* t=theRuntime->getTypeCode(p._type);
+ if(t==0)
+ {
+ std::string msg="Unknown OutPort Type: ";
+ msg=msg+p._type+" for node: "+this->_node->getName()+" port name: "+p._name;
+ throw YACS::Exception(msg);
+ }
+ else
+ {
+ currentProc->typeMap[p._type]=t;
+ t->incrRef();
+ }
+ }
+ this->_node->edAddOutputPort(p._name,currentProc->typeMap[p._type]);
+ }
+ virtual T post()
+ {
+ DEBTRACE( "inline_post " << this->_node->getName() )
+ if(this->_state == "disabled")this->_node->exDisabledState();
+ /*
+ std::list<OutputPort *>::iterator iter;
+ std::list<OutputPort *> s=_node->getSetOfOutputPort();
+ for(iter=s.begin();iter!=s.end();iter++)
+ {
+ std::cerr << "port name: " << (*iter)->getName() << std::endl;
+ std::cerr << "port kind: " << (*iter)->edGetType()->kind() << std::endl;
+ }
+ */
+ return this->_node;
+ }
+ std::string _kind;
+};
+
+template <class T> inlinetypeParser<T> inlinetypeParser<T>::inlineParser;
+
+template <>
+void inlinetypeParser<YACS::ENGINE::InlineNode*>::script (const myfunc& f)
+{
+ DEBTRACE( "inline_script: " << f._code )
+ _node=theRuntime->createScriptNode(_kind,_name);
+ _node->setScript(f._code);
+}
+
+template <>
+void inlinetypeParser<YACS::ENGINE::InlineNode*>::function (const myfunc& f)
+{
+ DEBTRACE( "inline_function: " << f._code )
+ YACS::ENGINE::InlineFuncNode *fnode;
+ fnode=theRuntime->createFuncNode(_kind,_name);
+ fnode->setScript(f._code);
+ fnode->setFname(f._name);
+ _node=fnode;
+}
+
+template <class T>
+void inlinetypeParser<T>::onStart(const XML_Char* el, const XML_Char** attr)
+
+ {
+ DEBTRACE( "inlinetypeParser::onStart: " << el )
+ std::string element(el);
+ parser* pp=&parser::main_parser;
+ this->maxcount("kind",1,element);
+ this->maxcount("script",1,element);
+ this->maxcount("function",1,element);
+ this->maxchoice(t1,1,element);
+ if(element == "kind")pp=&stringtypeParser::stringParser;
+ else if(element == "script")pp=&codetypeParser::codeParser;
+ else if(element == "function")pp=&functypeParser::funcParser;
+ else if(element == "property")pp=&propertytypeParser::propertyParser;
+ else if(element == "inport")pp=&inporttypeParser<>::inportParser;
+ else if(element == "outport")pp=&outporttypeParser<>::outportParser;
+ this->SetUserDataAndPush(pp);
+ pp->init();
+ pp->pre();
+ pp->buildAttr(attr);
+ }
+
+} // end of namespace YACS
+
+#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _LINKPARSERS_HXX_
#define _LINKPARSERS_HXX_
+++ /dev/null
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// ----------------------------------------------------------------------------
-//
-%define LOADERDOCSTRING
-"Module to load an calculation schema from a XML file."
-%enddef
-
-%module(docstring=LOADERDOCSTRING) loader
-
-//work around SWIG bug #1863647
-#define PySwigIterator loader_PySwigIterator
-
-%feature("autodoc", "1");
-
-%include "engtypemaps.i"
-
-// ----------------------------------------------------------------------------
-
-%{
-#include "parsers.hxx"
-#include "LoadState.hxx"
-#include "TypeCode.hxx"
-%}
-
-%types(YACS::ENGINE::Node *);
-%types(YACS::ENGINE::InputPort *,YACS::ENGINE::OutputPort *,YACS::ENGINE::InputDataStreamPort *,YACS::ENGINE::OutputDataStreamPort *);
-%types(YACS::ENGINE::InGate *,YACS::ENGINE::OutGate *,YACS::ENGINE::InPort *,YACS::ENGINE::OutPort *,YACS::ENGINE::Port *);
-
-%import "pilot.i"
-
-/*
- * Ownership section
- */
-//Take ownership : it is not the default (constructor) as it is a factory
-%newobject YACS::YACSLoader::load;
-/*
- * End of Ownership section
- */
-
-%include "parsers.hxx"
-%import "xmlParserBase.hxx"
-%include "LoadState.hxx"
-
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _LOOPPARSER_HXX_
#define _LOOPPARSER_HXX_
#include "WhileLoop.hxx"
#include "Switch.hxx"
#include "ForEachLoop.hxx"
+#include "OptimizerLoop.hxx"
#include <vector>
#include <string>
template <class T=ENGINE::Loop*>
struct looptypeParser:parser
{
- void onStart(const XML_Char* el, const XML_Char** attr);
- void onEnd(const char *el,parser* child);
+ virtual void onStart(const XML_Char* el, const XML_Char** attr);
+ virtual void onEnd(const char *el,parser* child);
virtual void buildAttr(const XML_Char** attr);
virtual void pre ();
virtual void name (const std::string& name);
virtual void inline_ (ENGINE::InlineNode* const& n);
virtual void sinline (ENGINE::ServiceInlineNode* const& n);
virtual void service (ENGINE::ServiceNode* const& n);
+ virtual void server (ENGINE::ServerNode* const& n);
+ virtual void remote (ENGINE::InlineNode* const& n);
virtual void node (ENGINE::InlineNode* const& n);
virtual void forloop (ENGINE::ForLoop* const& b);
virtual void foreach (ENGINE::ForEachLoop* const& b);
+ virtual void optimizer (ENGINE::OptimizerLoop* const& b);
virtual void while_ (ENGINE::WhileLoop* const& b);
virtual void switch_ (ENGINE::Switch* const& b);
virtual void bloc (ENGINE::Bloc* const& b);
// A loop can contain forloop, whileloop or foreachloop
// We must respect the order : definition of loop, then while, for, .. and then onStart, onEnd for loop !!!
//
- static std::string t3[]={"inline","sinline","service","node","forloop","foreach","while","switch","bloc",""};
+ static std::string t3[]={"inline","sinline","service","server", "remote", "node","forloop","foreach","optimizer","while","switch","bloc",""};
template <class T>
void looptypeParser<T>::buildAttr(const XML_Char** attr)
currentProc->serviceMap[fullname]=n;
}
template <class T>
+void looptypeParser<T>::server (ENGINE::ServerNode* const& n)
+ {
+ DEBTRACE( "loop_server" << n->getName() )
+ _cnode->edSetNode(n);
+ std::string fullname=currentProc->names.back()+ n->getName();
+ currentProc->nodeMap[fullname]=n;
+ currentProc->inlineMap[fullname]=n;
+ }
+
+template <class T>
+void looptypeParser<T>::remote (YACS::ENGINE::InlineNode* const& n)
+ {
+ DEBTRACE( "loop_remote: " << n->getName() )
+ _cnode->edSetNode(n);
+ std::string fullname = currentProc->names.back()+n->getName();
+ currentProc->nodeMap[fullname]=n;
+ currentProc->inlineMap[fullname]=n;
+ }
+
+template <class T>
void looptypeParser<T>::node (ENGINE::InlineNode* const& n)
{
DEBTRACE( "loop_node" << n->getName() )
currentProc->nodeMap[fullname]=b->getChildByShortName("splitter");
}
template <class T>
+void looptypeParser<T>::optimizer (ENGINE::OptimizerLoop* const& b)
+ {
+ DEBTRACE( "loop_optimizer: " << b->getName() );
+ _cnode->edSetNode(b);
+ std::string fullname = currentProc->names.back()+b->getName();
+ currentProc->nodeMap[fullname]=b;
+ //fullname += ".splitter";
+ //currentProc->nodeMap[fullname]=b->getChildByShortName("splitter");
+ }
+template <class T>
void looptypeParser<T>::while_ (ENGINE::WhileLoop* const& b)
{
DEBTRACE( "loop_while: " << b->getName() )
}
+namespace YACS
+{
+// pseudo composed node, used to store the init or finalize node of a DynParaLoop
+class PseudoComposedNode
+{
+public:
+ void edSetNode(ENGINE::Node * node) { _node = node; }
+ ENGINE::Node * getNode() { return _node; }
+
+ // Those two methods should never be called
+ bool edAddLink(ENGINE::OutPort *start, ENGINE::InPort *end) throw(Exception) { YASSERT(false); }
+ bool edAddDFLink(ENGINE::OutPort *start, ENGINE::InPort *end) throw(Exception) { YASSERT(false); }
+
+protected:
+ ENGINE::Node * _node;
+};
+
+// pseudo composed node parser specialization for DynParaLoop init and finalize nodes
+template <class T=PseudoComposedNode*>
+struct pseudocomposednodetypeParser:looptypeParser<T>
+{
+ static pseudocomposednodetypeParser<T> pseudocomposednodeParser;
+
+ virtual void buildAttr(const XML_Char** attr)
+ {
+ this->_cnode = new PseudoComposedNode();
+ this->_cnodes.push_back(this->_cnode);
+ }
+
+ virtual T post()
+ {
+ DEBTRACE("pseudocomposednode_post" << this->_cnode->getNode()->getName())
+ T b = this->_cnode;
+ this->_cnodes.pop_back();
+ if(this->_cnodes.size() == 0)
+ this->_cnode = 0;
+ else
+ this->_cnode = this->_cnodes.back();
+ return b;
+ }
+
+ virtual void datalink(const mylink & l)
+ {
+ throw YACS::Exception("Unexpected datalink element in DynParaLoop init or finalize node");
+ }
+
+};
+
+template <class T> pseudocomposednodetypeParser<T> pseudocomposednodetypeParser<T>::pseudocomposednodeParser;
+
+}
+
+namespace YACS
+{
+// dynparaloop specialization
+
+template <class T=ENGINE::DynParaLoop*>
+struct dynparalooptypeParser:looptypeParser<T>
+{
+ virtual void onStart(const XML_Char* el, const XML_Char** attr)
+ {
+ DEBTRACE( "dynparalooptypeParser::onStart: " << el )
+ std::string element(el);
+ this->maxcount("initnode",1,element);
+ this->maxcount("finalizenode",1,element);
+ if (element == "initnode" || element == "finalizenode")
+ {
+ parser* pp = &pseudocomposednodetypeParser<>::pseudocomposednodeParser;
+ this->SetUserDataAndPush(pp);
+ pp->init();
+ pp->pre();
+ pp->buildAttr(attr);
+ }
+ else
+ {
+ this->looptypeParser<T>::onStart(el, attr);
+ }
+ }
+
+ virtual void onEnd(const char *el, parser* child)
+ {
+ DEBTRACE( "dynparalooptypeParser::onEnd: " << el )
+ std::string element(el);
+ if (element == "initnode") initnode(((pseudocomposednodetypeParser<>*)child)->post());
+ else if (element == "finalizenode") finalizenode(((pseudocomposednodetypeParser<>*)child)->post());
+ else this->looptypeParser<T>::onEnd(el, child);
+ }
+
+ virtual void initnode(PseudoComposedNode * const& n)
+ {
+ DEBTRACE( "dynparaloop_initnode: " << n->getNode()->getName() )
+ this->_cnode->edSetInitNode(n->getNode());
+ delete n;
+ }
+
+ virtual void finalizenode(PseudoComposedNode * const& n)
+ {
+ DEBTRACE( "dynparaloop_finalizenode: " << n->getNode()->getName() )
+ this->_cnode->edSetFinalizeNode(n->getNode());
+ delete n;
+ }
+};
+
+}
+
namespace YACS
{
// Foreach loop specialization
template <class T=ENGINE::ForEachLoop*>
-struct foreachlooptypeParser:looptypeParser<T>
+struct foreachlooptypeParser:dynparalooptypeParser<T>
{
static foreachlooptypeParser<T> foreachloopParser;
}
+namespace YACS
+{
+ // optimizer loop specialization
+
+template <class T=ENGINE::OptimizerLoop*>
+struct optimizerlooptypeParser:dynparalooptypeParser<T>
+{
+ static optimizerlooptypeParser<T> optimizerloopParser;
+
+ virtual void buildAttr(const XML_Char** attr)
+ {
+ this->required("name",attr);
+ this->required("lib",attr);
+ this->required("entry",attr);
+ for (int i = 0; attr[i]; i += 2)
+ {
+ if(std::string(attr[i]) == "name")name(attr[i+1]);
+ if(std::string(attr[i]) == "state")this->state(attr[i+1]);
+ if(std::string(attr[i]) == "nbranch")nbranch(atoi(attr[i+1]));
+ if(std::string(attr[i]) == "lib")lib(attr[i+1]);
+ if(std::string(attr[i]) == "entry")entry(attr[i+1]);
+ if(std::string(attr[i]) == "kind")kind(attr[i+1]);
+ }
+ postAttr();
+ }
+ virtual void pre ()
+ {
+ _nbranch=0;
+ this->looptypeParser<T>::pre();
+ }
+ virtual void name (const std::string& name)
+ {
+ DEBTRACE("optimizer_name: " << name)
+ _name=name;
+ _fullname=currentProc->names.back()+name;
+ }
+ virtual void lib (const std::string& name)
+ {
+ _lib=name;
+ }
+ virtual void entry (const std::string& name)
+ {
+ _entry=name;
+ }
+ virtual void nbranch (const int& n)
+ {
+ DEBTRACE("optimizer_nbranch: " << n )
+ _nbranch=n;
+ }
+ virtual void kind (const std::string& name)
+ {
+ _kind=name;
+ }
+ virtual void postAttr()
+ {
+ this->_cnode=theRuntime->createOptimizerLoop(_name,_lib,_entry,true,_kind, currentProc);
+ //set number of branches
+ if(_nbranch > 0)this->_cnode->edGetNbOfBranchesPort()->edInit(_nbranch);
+ this->_cnodes.push_back(this->_cnode);
+ currentProc->names.push_back(_fullname + '.');
+ }
+ virtual T post()
+ {
+ DEBTRACE("optimizer_post" << this->_cnode->getName())
+ T b=this->_cnode;
+ this->_cnodes.pop_back();
+ currentProc->names.pop_back();
+ if(this->_cnodes.size() == 0)
+ this->_cnode=0;
+ else
+ this->_cnode=this->_cnodes.back();
+ return b;
+ }
+
+ int _nbranch;
+ std::string _fullname;
+ std::string _name;
+ std::string _entry;
+ std::string _kind;
+ std::string _lib;
+
+};
+
+template <class T> optimizerlooptypeParser<T> optimizerlooptypeParser<T>::optimizerloopParser;
+
+}
+
#include "blocParsers.hxx"
#include "switchParsers.hxx"
this->maxcount("inline",1,element);
this->maxcount("sinline",1,element);
this->maxcount("service",1,element);
+ this->maxcount("server",1,element);
+ this->maxcount("remote",1,element);
this->maxcount("node",1,element);
this->maxcount("forloop",1,element);
this->maxcount("foreach",1,element);
+ this->maxcount("optimizer",1,element);
this->maxcount("while",1,element);
this->maxcount("switch",1,element);
this->maxcount("bloc",1,element);
else if(element == "inline")pp=&inlinetypeParser<>::inlineParser;
else if(element == "sinline")pp=&sinlinetypeParser<>::sinlineParser;
else if(element == "service")pp=&servicetypeParser<>::serviceParser;
+ else if(element == "server")pp=&servertypeParser<>::serverParser;
+ else if(element == "remote")pp=&remotetypeParser<>::remoteParser;
else if(element == "node")pp=&nodetypeParser<>::nodeParser;
else if(element == "forloop")pp=&forlooptypeParser<>::forloopParser;
else if(element == "foreach")pp=&foreachlooptypeParser<>::foreachloopParser;
+ else if(element == "optimizer")pp=&optimizerlooptypeParser<>::optimizerloopParser;
else if(element == "while")pp=&whilelooptypeParser<>::whileloopParser;
else if(element == "switch")pp=&switchtypeParser::switchParser;
else if(element == "bloc")pp=&bloctypeParser<>::blocParser;
else if(element == "inline")inline_(((inlinetypeParser<>*)child)->post());
else if(element == "sinline")sinline(((sinlinetypeParser<>*)child)->post());
else if(element == "service")service(((servicetypeParser<>*)child)->post());
+ else if(element == "server")server(((servertypeParser<>*)child)->post());
+ else if(element == "remote")remote(((remotetypeParser<>*)child)->post());
else if(element == "node")node(((nodetypeParser<>*)child)->post());
else if(element == "forloop")forloop(((forlooptypeParser<>*)child)->post());
else if(element == "foreach")foreach(((foreachlooptypeParser<>*)child)->post());
+ else if(element == "optimizer")optimizer(((optimizerlooptypeParser<>*)child)->post());
else if(element == "while")while_(((whilelooptypeParser<>*)child)->post());
else if(element == "switch")switch_(((switchtypeParser*)child)->post());
else if(element == "bloc")bloc(((bloctypeParser<>*)child)->post());
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _NODEPARSERS_HXX_
#define _NODEPARSERS_HXX_
#include "Proc.hxx"
#include "TypeCode.hxx"
#include "InlineNode.hxx"
-#include "ServiceNode.hxx"
-#include "ServiceInlineNode.hxx"
#include "Exception.hxx"
#include "Runtime.hxx"
+#include "Container.hxx"
+#include "ComponentInstance.hxx"
#include "OutputDataStreamPort.hxx"
#include "InputDataStreamPort.hxx"
#include "ComponentInstance.hxx"
return _node;
}
-static std::string t1[]={"script","function",""};
-
-template <class T=YACS::ENGINE::InlineNode*>
-struct inlinetypeParser:public nodetypeParser<T>
-{
- static inlinetypeParser<T> inlineParser;
-
- virtual void onStart(const XML_Char* el, const XML_Char** attr);
- virtual void onEnd(const char *el,parser* child)
- {
- DEBTRACE( "inlinetypeParser::onEnd: " << el )
- std::string element(el);
- if(element == "kind")kind(((stringtypeParser*)child)->post());
- else if(element == "script")script(((codetypeParser*)child)->post());
- else if(element == "function")function(((functypeParser*)child)->post());
- else if(element == "property")this->property(((propertytypeParser*)child)->post());
- else if(element == "inport") inport(((inporttypeParser<myinport>*)child)->post());
- else if(element == "outport") outport(((outporttypeParser<myoutport>*)child)->post());
- }
- virtual void buildAttr(const XML_Char** attr)
- {
- this->required("name",attr);
- for (int i = 0; attr[i]; i += 2)
- {
- if(std::string(attr[i]) == "name")this->name(attr[i+1]);
- if(std::string(attr[i]) == "state")this->state(attr[i+1]);
- }
- }
- virtual void pre ()
- {
- this->_node=0;
- _kind="";
- this->_state="";
- this->_container="";
- }
- virtual void kind (const std::string& name)
- {
- DEBTRACE( "inline_kind " << name )
- _kind=name;
- }
-
- virtual void script (const myfunc& f){}
- virtual void function (const myfunc& f) {}
-
- virtual void inport (const myinport& p)
- {
- DEBTRACE( "inline_inport: " << p._name <<":"<<p._type)
- if(this->_node==0)
- throw YACS::Exception("Node must be completely defined before defining its ports");
-
- if(currentProc->typeMap.count(p._type)==0)
- {
- //Check if the typecode is defined in the runtime
- YACS::ENGINE::TypeCode* t=theRuntime->getTypeCode(p._type);
- if(t==0)
- {
- std::string msg="Unknown InPort Type: ";
- msg=msg+p._type+" for node: "+this->_node->getName()+" port name: "+p._name;
- throw YACS::Exception(msg);
- }
- else
- {
- currentProc->typeMap[p._type]=t;
- t->incrRef();
- }
- }
- this->_node->edAddInputPort(p._name,currentProc->typeMap[p._type]);
- }
- virtual void outport (const myoutport& p)
- {
- DEBTRACE( "inline_outport: " << p._name <<":"<<p._type)
- if(this->_node==0)
- throw YACS::Exception("Node must be completely defined before defining its ports");
-
- if(currentProc->typeMap.count(p._type)==0)
- {
- YACS::ENGINE::TypeCode* t=theRuntime->getTypeCode(p._type);
- if(t==0)
- {
- std::string msg="Unknown OutPort Type: ";
- msg=msg+p._type+" for node: "+this->_node->getName()+" port name: "+p._name;
- throw YACS::Exception(msg);
- }
- else
- {
- currentProc->typeMap[p._type]=t;
- t->incrRef();
- }
- }
- this->_node->edAddOutputPort(p._name,currentProc->typeMap[p._type]);
- }
- virtual T post()
- {
- DEBTRACE( "inline_post " << this->_node->getName() )
- if(this->_state == "disabled")this->_node->exDisabledState();
- /*
- std::list<OutputPort *>::iterator iter;
- std::list<OutputPort *> s=_node->getSetOfOutputPort();
- for(iter=s.begin();iter!=s.end();iter++)
- {
- std::cerr << "port name: " << (*iter)->getName() << std::endl;
- std::cerr << "port kind: " << (*iter)->edGetType()->kind() << std::endl;
- }
- */
- return this->_node;
- }
- std::string _kind;
-};
-
-template <class T> inlinetypeParser<T> inlinetypeParser<T>::inlineParser;
-
-template <>
-void inlinetypeParser<YACS::ENGINE::InlineNode*>::script (const myfunc& f)
-{
- DEBTRACE( "inline_script: " << f._code )
- _node=theRuntime->createScriptNode(_kind,_name);
- _node->setScript(f._code);
-}
-
-template <>
-void inlinetypeParser<YACS::ENGINE::InlineNode*>::function (const myfunc& f)
-{
- DEBTRACE( "inline_function: " << f._code )
- YACS::ENGINE::InlineFuncNode *fnode;
- fnode=theRuntime->createFuncNode(_kind,_name);
- fnode->setScript(f._code);
- fnode->setFname(f._name);
- _node=fnode;
-}
-
-/*! \brief Class for parsing ServiceInlineNode description
- *
- *
- */
-template <class T=YACS::ENGINE::ServiceInlineNode*>
-struct sinlinetypeParser:public inlinetypeParser<T>
-{
- static sinlinetypeParser<T> sinlineParser;
-
- virtual void onStart(const XML_Char* el, const XML_Char** attr);
- virtual void onEnd(const char *el,parser* child)
- {
- DEBTRACE( "sinlinetypeParser::onEnd: " << el )
- std::string element(el);
- if(element == "kind")this->kind(((stringtypeParser*)child)->post());
- else if(element == "function")this->function(((functypeParser*)child)->post());
- else if(element == "load") load(((loadtypeParser*)child)->post());
- else if(element == "property")this->property(((propertytypeParser*)child)->post());
- else if(element == "inport") this->inport(((inporttypeParser<myinport>*)child)->post());
- else if(element == "outport") this->outport(((outporttypeParser<myoutport>*)child)->post());
- }
- //virtual void service (const myfunc& f) {}
- virtual void load (const loadon& l)
- {
- DEBTRACE( "sinline_load: " )
- this->_container=l._container;
- }
- virtual T post()
- {
- DEBTRACE( "sinline_post " << this->_node->getName() );
- if(this->_state == "disabled")this->_node->exDisabledState();
-
- if(currentProc->containerMap.count(this->_container) != 0)
- {
- this->_node->getComponent()->setContainer(currentProc->containerMap[this->_container]);
- }
- else if(this->_container == "")
- {
- if(currentProc->containerMap.count("DefaultContainer") != 0)
- {
- //a default container is defined : use it
- this->_node->getComponent()->setContainer(currentProc->containerMap["DefaultContainer"]);
- }
- }
- else
- {
- std::cerr << "WARNING: Unknown container " << this->_container << " ignored" << std::endl;
- }
-
- return this->_node;
- }
-};
-template <class T> sinlinetypeParser<T> sinlinetypeParser<T>::sinlineParser;
-
-// sinline ????
-template <>
-void inlinetypeParser<YACS::ENGINE::ServiceInlineNode*>::function (const myfunc& f)
-{
- DEBTRACE( "sinline_function: " << f._code )
- YACS::ENGINE::ServiceInlineNode *fnode;
- fnode=theRuntime->createSInlineNode(_kind,_name);
- fnode->setScript(f._code);
- fnode->setMethod(f._name);
- fnode->setComponent(theRuntime->createComponentInstance("PyCompo","SalomePy"));
- //fnode->setRef("PyCompo");
- _node=fnode;
-}
-
-static std::string t2[]={"ref","node","component",""};
-
-template <class T=YACS::ENGINE::ServiceNode*>
-struct servicetypeParser:public inlinetypeParser<T>
-{
- static servicetypeParser<T> serviceParser;
-
- virtual void onStart(const XML_Char* el, const XML_Char** attr);
- virtual void onEnd(const char *el,parser* child)
- {
- DEBTRACE( "servicetypeParser::onEnd: " << el )
- std::string element(el);
- if(element == "kind")this->kind(((stringtypeParser*)child)->post());
- else if(element == "ref") ref(((stringtypeParser*)child)->post());
- else if(element == "component") component(((stringtypeParser*)child)->post());
- else if(element == "node") node(((stringtypeParser*)child)->post());
- else if(element == "method") method(((stringtypeParser*)child)->post());
- else if(element == "load") load(((loadtypeParser*)child)->post());
- else if(element == "property")this->property(((propertytypeParser*)child)->post());
- else if(element == "inport") this->inport(((inporttypeParser<myinport>*)child)->post());
- else if(element == "outport") this->outport(((outporttypeParser<myoutport>*)child)->post());
- else if(element == "instream") instream(((inporttypeParser<myinport>*)child)->post());
- else if(element == "outstream") outstream(((outporttypeParser<myoutport>*)child)->post());
- }
- virtual void ref (const std::string& name)
- {
- DEBTRACE( "service_ref: " << name )
- this->_node=theRuntime->createRefNode(this->_kind,this->_name);
- this->_node->setRef(name);
- }
- virtual void component (const std::string& name)
- {
- DEBTRACE( "service_component: " << name )
- this->_node=theRuntime->createCompoNode(this->_kind,this->_name);
- this->_node->setRef(name);
- }
- virtual void node (const std::string& name)
- {
- DEBTRACE( "service_node: " << name )
- std::string fullname = currentProc->names.back()+name;
- if(currentProc->serviceMap.count(name) != 0)
- {
- //ServiceNode with absolute name found
- YACS::ENGINE::ServiceNode* n=currentProc->serviceMap[name];
- this->_node =n->createNode(this->_name);
- }
- else if(currentProc->serviceMap.count(fullname) != 0)
- {
- //ServiceNode with relative name found
- //TODO: must be a short name (possible only in the same context)
- YACS::ENGINE::ServiceNode* n=currentProc->serviceMap[fullname];
- this->_node =n->createNode(this->_name);
- }
- else
- {
- throw YACS::Exception("Unknown ServiceNode");
- }
- }
-
- virtual void method (const std::string& name)
- {
- DEBTRACE( "service_method: " << name )
- if(this->_node==0)
- throw YACS::Exception("ServiceNode must be completely defined before defining its method");
- if(name == "")
- {
- this->logError("a service name must be a non empty string");
- return;
- }
- this->_node->setMethod(name);
- }
-
- virtual void load (const loadon& l)
- {
- DEBTRACE( "service_load: " );
- this->_container=l._container;
- }
-
- virtual void instream (const myinport& p)
- {
- DEBTRACE( "service_instream" )
- DEBTRACE( p._type )
- DEBTRACE( p._name )
- if(this->_node==0)
- throw YACS::Exception("ServiceNode must be completely defined before defining its ports");
-
- if(currentProc->typeMap.count(p._type)==0)
- {
- YACS::ENGINE::TypeCode* t=theRuntime->getTypeCode(p._type);
- if(t==0)
- {
- std::string msg="Unknown InStreamPort Type: ";
- msg=msg+p._type+" for node: "+this->_node->getName()+" port name: "+p._name;
- throw YACS::Exception(msg);
- }
- else
- {
- currentProc->typeMap[p._type]=t;
- t->incrRef();
- }
- }
- YACS::ENGINE::InputDataStreamPort* port;
- port=this->_node->edAddInputDataStreamPort(p._name,currentProc->typeMap[p._type]);
- // Set all properties for this port
- std::map<std::string, std::string>::const_iterator pt;
- for(pt=p._props.begin();pt!=p._props.end();pt++)
- port->setProperty((*pt).first,(*pt).second);
- }
- virtual void outstream (const myoutport& p)
- {
- DEBTRACE( "service_outstream" )
- DEBTRACE( p._type )
- DEBTRACE( p._name )
- if(this->_node==0)
- throw YACS::Exception("ServiceNode must be completely defined before defining its ports");
-
- if(currentProc->typeMap.count(p._type)==0)
- {
- YACS::ENGINE::TypeCode* t=theRuntime->getTypeCode(p._type);
- if(t==0)
- {
- std::string msg="Unknown OutStreamPort Type: ";
- msg=msg+p._type+" for node: "+this->_node->getName()+" port name: "+p._name;
- throw YACS::Exception(msg);
- }
- else
- {
- currentProc->typeMap[p._type]=t;
- t->incrRef();
- }
- }
- YACS::ENGINE::OutputDataStreamPort* port;
- port=this->_node->edAddOutputDataStreamPort(p._name,currentProc->typeMap[p._type]);
- // Set all properties for this port
- std::map<std::string, std::string>::const_iterator pt;
- for(pt=p._props.begin();pt!=p._props.end();pt++)
- port->setProperty((*pt).first,(*pt).second);
- }
- virtual T post()
- {
- DEBTRACE( "service_post " << this->_node->getName() )
- this->mincount("method",1);
- if(this->_state == "disabled")this->_node->exDisabledState();
-
- if(currentProc->containerMap.count(this->_container) != 0)
- {
- this->_node->getComponent()->setContainer(currentProc->containerMap[this->_container]);
- }
- else if(this->_container == "")
- {
- if(currentProc->containerMap.count("DefaultContainer") != 0)
- {
- //a default container is defined : use it
- this->_node->getComponent()->setContainer(currentProc->containerMap["DefaultContainer"]);
- }
- }
- else
- {
- std::cerr << "WARNING: Unknown container " << this->_container << " ignored" << std::endl;
- }
- return this->_node;
- }
-};
-
-template <class T> servicetypeParser<T> servicetypeParser<T>::serviceParser;
-
-}
-
-
-namespace YACS
-{
-template <class T>
-void inlinetypeParser<T>::onStart(const XML_Char* el, const XML_Char** attr)
-
- {
- DEBTRACE( "inlinetypeParser::onStart: " << el )
- std::string element(el);
- parser* pp=&parser::main_parser;
- this->maxcount("kind",1,element);
- this->maxcount("script",1,element);
- this->maxcount("function",1,element);
- this->maxchoice(t1,1,element);
- if(element == "kind")pp=&stringtypeParser::stringParser;
- else if(element == "script")pp=&codetypeParser::codeParser;
- else if(element == "function")pp=&functypeParser::funcParser;
- else if(element == "property")pp=&propertytypeParser::propertyParser;
- else if(element == "inport")pp=&inporttypeParser<>::inportParser;
- else if(element == "outport")pp=&outporttypeParser<>::outportParser;
- this->SetUserDataAndPush(pp);
- pp->init();
- pp->pre();
- pp->buildAttr(attr);
- }
-
-template <class T>
-void sinlinetypeParser<T>::onStart(const XML_Char* el, const XML_Char** attr)
- {
- DEBTRACE( "sinlinetypeParser::onStart: " << el )
- std::string element(el);
- parser* pp=&parser::main_parser;
- this->maxcount("kind",1,element);
- this->maxcount("function",1,element);
- this->maxcount("load",1,element);
- if(element == "kind")pp=&stringtypeParser::stringParser;
- else if(element == "function")pp=&functypeParser::funcParser;
- else if(element == "load")pp=&loadtypeParser::loadParser;
- else if(element == "property")pp=&propertytypeParser::propertyParser;
- else if(element == "inport")pp=&inporttypeParser<>::inportParser;
- else if(element == "outport")pp=&outporttypeParser<>::outportParser;
- this->SetUserDataAndPush(pp);
- pp->init();
- pp->pre();
- pp->buildAttr(attr);
- }
-
-template <class T>
-void servicetypeParser<T>::onStart(const XML_Char* el, const XML_Char** attr)
- {
- DEBTRACE( "servicetypeParser::onStart: " << el )
- std::string element(el);
- parser* pp=&parser::main_parser;
- this->maxcount("kind",1,element);
- this->maxcount("ref",1,element);
- this->maxcount("node",1,element);
- this->maxcount("component",1,element);
- this->maxcount("method",1,element);
- this->maxcount("load",1,element);
- this->maxchoice(t2,1,element);
- if(element == "kind")pp=&stringtypeParser::stringParser;
- else if(element == "ref")pp=&stringtypeParser::stringParser;
- else if(element == "component")pp=&stringtypeParser::stringParser;
- else if(element == "node")pp=&stringtypeParser::stringParser;
- else if(element == "method")pp=&stringtypeParser::stringParser;
- else if(element == "load")pp=&loadtypeParser::loadParser;
- else if(element == "property")pp=&propertytypeParser::propertyParser;
- else if(element == "inport")pp=&inporttypeParser<>::inportParser;
- else if(element == "outport")pp=&outporttypeParser<>::outportParser;
- else if(element == "instream")pp=&inporttypeParser<>::inportParser;
- else if(element == "outstream")pp=&outporttypeParser<>::outportParser;
- this->SetUserDataAndPush(pp);
- pp->init();
- pp->pre();
- pp->buildAttr(attr);
- }
-
-
-
-
-}
+} // end of namespace YACS
#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _OUTPUTPARSERS_HXX_
#define _OUTPUTPARSERS_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "parserBase.hxx"
#include "Exception.hxx"
#include "Proc.hxx"
if(_orders[el] < _orderState)
{
std::string msg="unexpected "+el+" element (wrong order)";
- throw YACS::Exception::Exception(msg);
+ throw YACS::Exception(msg);
}
else if(_orders[el] > _orderState)
{
std::stringstream msg;
msg <<"unexpected "+name+" element (count="<<(*_counts)[name];
msg <<" > maxOccurs=" << max << ")";
- throw YACS::Exception::Exception(msg.str());
+ throw YACS::Exception(msg.str());
}
}
std::stringstream msg;
msg<<"expected "+name+" element (count="<<(*_counts)[name];
msg << " < minOccurs=" << min << ")";
- throw YACS::Exception::Exception(msg.str());
+ throw YACS::Exception(msg.str());
}
}
{
std::stringstream msg;
msg<<"unexpected "+el+" element (choice count="<<ncount<<" > maxOccurs=" << max << ")";
- throw YACS::Exception::Exception(msg.str());
+ throw YACS::Exception(msg.str());
}
}
++i;
}
msg << "(choice count="<<ncount<<" < minOccurs=" << min << ")";
- throw YACS::Exception::Exception(msg.str());
+ throw YACS::Exception(msg.str());
}
}
{
if(name == std::string(attr[i]))return;
}
- throw YACS::Exception::Exception("Attribute: "+name+" is required");
+ throw YACS::Exception("Attribute: "+name+" is required");
}
void parser::buildAttr(const XML_Char** attr)
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _PARSERBASE_HXX_
#define _PARSERBASE_HXX_
+#include "YACSloaderExport.hxx"
+
#include <expat.h>
#include <stack>
#include <map>
namespace YACS
{
-struct parser
+struct YACSLOADER_EXPORT parser
{
static parser main_parser;
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "parsers.hxx"
#include <expat.h>
#include <iostream>
#include <stdexcept>
+#include <cstdio>
#include "Runtime.hxx"
#include "Proc.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _PARSERS_HXX_
#define _PARSERS_HXX_
+#include "YACSloaderExport.hxx"
+
#include <map>
#include <parserBase.hxx>
class Proc;
}
- class YACSLoader
+ class YACSLOADER_EXPORT YACSLoader
{
public:
YACSLoader();
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _PORTPARSERS_HXX_
#define _PORTPARSERS_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _PRESETPARSERS_HXX_
#define _PRESETPARSERS_HXX_
virtual void pre ()
{
DEBTRACE("presetdatatypeParser::pre");
- _ref="";
+ _ref="undef";
_param.clear();
}
virtual void value (const std::string& value)
{
DEBTRACE("presetdatatypeParser::post");
//a parameter can have a ref attribute OR one value element
- if(_ref == "")
+ if(_ref == "undef")
mincount("value",1);
else
_param.setProperty("value",_ref);
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _PROCPARSER_HXX_
#define _PROCPARSER_HXX_
#include "blocParsers.hxx"
#include "typeParsers.hxx"
#include "containerParsers.hxx"
+#include "componentinstanceParsers.hxx"
#include "nodeParsers.hxx"
#include "Proc.hxx"
for (int i = 0; attr[i]; i += 2)
{
if(std::string(attr[i]) == "state")this->state(attr[i+1]);
+ if(std::string(attr[i]) == "name")name(attr[i+1]);
}
}
virtual void pre ()
this->_bloc=currentProc;
currentProc->names.push_back("");
}
+
+ virtual void name (const std::string& name)
+ {
+ currentProc->setName(name);
+ }
+
virtual void type (const mytype& t)
{
DEBTRACE( "type_set" );
DEBTRACE( "struct_set" );
t->decrRef();
}
+
+ virtual void componentinstance (const mycomponentinstance& t)
+ {
+ DEBTRACE( "componentinstance: " << t._name );
+ YACS::ENGINE::ComponentInstance* inst=currentProc->createComponentInstance(t._component,t._name,t._kind);
+
+ // Set all properties for this component instance
+ std::map<std::string, std::string>::const_iterator pt;
+ for(pt=t._props.begin();pt!=t._props.end();pt++)
+ inst->setProperty((*pt).first,(*pt).second);
+
+ //associate a container to the component instance
+ if(currentProc->containerMap.count(t._container) != 0)
+ {
+ inst->setContainer(currentProc->containerMap[t._container]);
+ }
+ else if(t._container == "")
+ {
+ if(currentProc->containerMap.count("DefaultContainer") != 0)
+ {
+ //a default container is defined : use it if supported
+ try
+ {
+ currentProc->containerMap["DefaultContainer"]->checkCapabilityToDealWith(inst);
+ inst->setContainer(currentProc->containerMap["DefaultContainer"]);
+ }
+ catch(YACS::Exception){}
+ }
+ }
+ else
+ {
+ std::cerr << "WARNING: Unknown container " << t._container << " ignored" << std::endl;
+ }
+
+ inst->decrRef();
+ }
+
virtual void container (const mycontainer& t)
{
DEBTRACE( "container_set: " << t._name )
DEBTRACE( "machine name: " << (*iter)._name )
}
- if(currentProc->containerMap.count(t._name) == 0)
+ if(currentProc->containerMap.count(t._name) != 0 && t._name != "DefaultContainer")
+ {
+ std::cerr << "Warning: container " << t._name << " already defined. It will be ignored" << std::endl;
+ }
+ else
{
- YACS::ENGINE::Container* cont=theRuntime->createContainer();
- cont->setName(t._name);
+ YACS::ENGINE::Container* cont=currentProc->createContainer(t._name);
// Set all properties for this container
std::map<std::string, std::string>::const_iterator pt;
for(pt=t._props.begin();pt!=t._props.end();pt++)
cont->setProperty((*pt).first,(*pt).second);
- currentProc->containerMap[t._name]=cont;
- }
- else
- {
- std::cerr << "Warning: container " << t._name << " already defined. It will be ignored" << std::endl;
+ cont->decrRef();
}
}
else if(element == "objref")pp=&objtypeParser::objParser;
else if(element == "struct")pp=&structtypeParser::structParser;
else if(element == "container")pp=&containertypeParser::containerParser;
+ else if(element == "componentinstance")pp=&componentinstancetypeParser::componentinstanceParser;
else if(element == "inline")pp=&inlinetypeParser<>::inlineParser;
else if(element == "sinline")pp=&sinlinetypeParser<>::sinlineParser;
else if(element == "service")pp=&servicetypeParser<>::serviceParser;
+ else if(element == "server")pp=&servertypeParser<>::serverParser;
+ else if(element == "remote")pp=&remotetypeParser<>::remoteParser;
else if(element == "node")pp=&nodetypeParser<>::nodeParser;
else if(element == "datanode")pp=&presettypeParser<>::presetParser;
else if(element == "outnode")pp=&outnodetypeParser<>::outnodeParser;
else if(element == "bloc")pp=&bloctypeParser<>::blocParser;
else if(element == "forloop")pp=&forlooptypeParser<>::forloopParser;
else if(element == "foreach")pp=&foreachlooptypeParser<>::foreachloopParser;
+ else if(element == "optimizer")pp=&optimizerlooptypeParser<>::optimizerloopParser;
else if(element == "while")pp=&whilelooptypeParser<>::whileloopParser;
else if(element == "switch")pp=&switchtypeParser::switchParser;
}
else
{
- std::cerr << "There is no parser for this element type. It will be ignored!" << std::endl;
+ std::cerr << "There is no parser for this element type. It will be ignored! " << element << std::endl;
}
}
}
else if(element == "objref")objref(((objtypeParser*)child)->post());
else if(element == "struct")struct_(((structtypeParser*)child)->post());
else if(element == "container")container(((containertypeParser*)child)->post());
+ else if(element == "componentinstance")componentinstance(((componentinstancetypeParser*)child)->post());
else if(element == "inline")this->inline_(((inlinetypeParser<>*)child)->post());
else if(element == "sinline")this->sinline(((sinlinetypeParser<>*)child)->post());
else if(element == "service")this->service(((servicetypeParser<>*)child)->post());
+ else if(element == "server")this->server(((servertypeParser<>*)child)->post());
+ else if(element == "remote")this->remote(((remotetypeParser<>*)child)->post());
else if(element == "node")this->node(((nodetypeParser<>*)child)->post());
else if(element == "datanode")this->preset(((presettypeParser<>*)child)->post());
else if(element == "outnode")this->outnode(((outnodetypeParser<>*)child)->post());
else if(element == "bloc")this->bloc(((bloctypeParser<>*)child)->post());
else if(element == "forloop")this->forloop(((forlooptypeParser<>*)child)->post());
else if(element == "foreach")this->foreach(((foreachlooptypeParser<>*)child)->post());
+ else if(element == "optimizer")this->optimizer(((optimizerlooptypeParser<>*)child)->post());
else if(element == "while")this->while_(((whilelooptypeParser<>*)child)->post());
else if(element == "switch")this->switch_(((switchtypeParser*)child)->post());
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "propertyParsers.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _PROPERTYPARSER_HXX_
#define _PROPERTYPARSER_HXX_
#include "parserBase.hxx"
#include "factory.hxx"
-//#define _DEVDEBUG_
-#include "YacsTrace.hxx"
-
namespace YACS
{
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _REMOTEPARSERS_HXX_
+#define _REMOTEPARSERS_HXX_
+
+#include "inlineParsers.hxx"
+
+extern YACS::ENGINE::Proc* currentProc;
+extern YACS::ENGINE::Runtime* theRuntime;
+
+namespace YACS
+{
+
+template <class T=YACS::ENGINE::InlineNode*>
+struct remotetypeParser:public inlinetypeParser<T>
+{
+ static remotetypeParser<T> remoteParser;
+
+ virtual void onStart(const XML_Char* el, const XML_Char** attr);
+ virtual void onEnd(const char *el,parser* child)
+ {
+ DEBTRACE( "remotetypeParser::onEnd: " << el )
+ std::string element(el);
+ if(element == "kind")this->kind(((stringtypeParser*)child)->post()); // inherited
+ else if(element == "function")this->function(((functypeParser*)child)->post());
+ else if(element == "script")this->script(((codetypeParser*)child)->post());
+ else if(element == "load") this->load(((loadtypeParser*)child)->post());
+ else if(element == "property")this->property(((propertytypeParser*)child)->post());
+ else if(element == "inport") this->inport(((inporttypeParser<myinport>*)child)->post());
+ else if(element == "outport") this->outport(((outporttypeParser<myoutport>*)child)->post());
+ }
+
+ virtual void load (const loadon& l)
+ {
+ DEBTRACE( "remotenode_load: " << l._container);
+ this->_container=l._container;
+ }
+
+ void function (const myfunc& f)
+ {
+ DEBTRACE( "remote_function: " << f._code )
+ YACS::ENGINE::InlineFuncNode *fnode;
+ fnode=theRuntime->createFuncNode(this->_kind,this->_name);
+ fnode->setScript(f._code);
+ fnode->setFname(f._name);
+ fnode->setExecutionMode("remote");
+ this->_node=fnode;
+ }
+
+ void script (const myfunc& f)
+ {
+ DEBTRACE( "remote_script: " << f._code )
+ YACS::ENGINE::InlineNode *node;
+ node=theRuntime->createScriptNode(this->_kind,this->_name);
+ node->setScript(f._code);
+ node->setExecutionMode("remote");
+ this->_node=node;
+ }
+
+ virtual T post()
+ {
+ DEBTRACE( "remote_post " << this->_node->getName() )
+ if(this->_state == "disabled")this->_node->exDisabledState();
+
+ //set the container
+ if(currentProc->containerMap.count(this->_container) != 0)
+ {
+ // a container with name (this->_container) exists. Use it
+ this->_node->setContainer(currentProc->containerMap[this->_container]);
+ }
+ else if(this->_container == "" && currentProc->containerMap.count("DefaultContainer") != 0)
+ {
+ // a container with name (this->_container) does not exist
+ //a default container is defined : use it
+ this->_node->setContainer(currentProc->containerMap["DefaultContainer"]);
+ }
+ else
+ std::cerr << "WARNING: Unknown container and no DefaultContainer " << this->_container << " will be ignored" << std::endl;
+
+ return this->_node;
+ }
+
+};
+
+template <class T>
+void remotetypeParser<T>::onStart(const XML_Char* el, const XML_Char** attr)
+{
+ DEBTRACE( "remotetypeParser::onStart: " << el )
+ std::string element(el);
+ parser* pp=&parser::main_parser;
+ this->maxcount("kind",1,element);
+ this->maxcount("function",1,element);
+ this->maxcount("script",1,element);
+ this->maxcount("load",1,element);
+ this->maxchoice(t1,1,element);
+
+ if(element == "kind")pp=&stringtypeParser::stringParser;
+ else if(element == "load")pp=&loadtypeParser::loadParser;
+ else if(element == "function")pp=&functypeParser::funcParser;
+ else if(element == "script")pp=&codetypeParser::codeParser;
+ else if(element == "property")pp=&propertytypeParser::propertyParser;
+ else if(element == "inport")pp=&inporttypeParser<>::inportParser;
+ else if(element == "outport")pp=&outporttypeParser<>::outportParser;
+
+ this->SetUserDataAndPush(pp);
+ pp->init();
+ pp->pre();
+ pp->buildAttr(attr);
+}
+
+template <class T> remotetypeParser<T> remotetypeParser<T>::remoteParser; // instanciate static class attribute
+
+} // end of namespace YACS
+
+#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "RuntimeSALOME.hxx"
#include "Proc.hxx"
#include "Exception.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include "rootParser.hxx"
+#include "rootParser.hxx"
+
+// Uncomment the following line to activate devdebug traces for ALL parsers defined in hxx files
+//#define _DEVDEBUG_
+#include "YacsTrace.hxx"
+
#include "procParsers.hxx"
namespace YACS
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _ROOTPARSER_HXX_
#define _ROOTPARSER_HXX_
-<?xml version='1.0'?>
+<?xml version='1.0' encoding='iso-8859-1' ?>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-->
-<proc>
- <type name="Bool" kind="bool"/>
- <type name="Double" kind="double"/>
- <type name="Int" kind="int"/>
- <type name="String" kind="string"/>
+<proc name="proc">
+ <property name="DefaultStudyID" value="1"/>
+ <type name="bool" kind="bool"/>
+ <type name="double" kind="double"/>
+ <type name="string" kind="string"/>
+ <struct name="Engines/dataref">
+ <member name="ref" type="string"/>
+ </struct>
+ <type name="int" kind="int"/>
+ <sequence name="boolvec" content="bool"/>
+ <sequence name="dblevec" content="double"/>
<objref name="file" id="file"/>
+ <sequence name="intvec" content="int"/>
+ <objref name="pyobj" id="python:obj:1.0"/>
+ <sequence name="stringvec" content="string"/>
+ <container name="DefaultContainer">
+ <property name="container_name" value="FactoryServer"/>
+ <property name="name" value="localhost"/>
+ </container>
<inline name="PyScript0">
<script><code><![CDATA[b=2.5*a
]]></code></script>
- <inport name="a" type="Double"/>
- <outport name="b" type="Double"/>
+ <inport name="a" type="double"/>
+ <outport name="b" type="double"/>
</inline>
<datanode name="PresetNode0">
- <parameter name="a" type="Double">
- <value><double>-2.45</double></value> </parameter>
+ <parameter name="a" type="double">
+ <value><double>-2.45</double></value>
+ </parameter>
</datanode>
<outnode name="OutNode0" ref="toto.xml">
- <parameter name="a" type="Double"/>
+ <parameter name="a" type="double"/>
</outnode>
<control> <fromnode>PyScript0</fromnode> <tonode>OutNode0</tonode> </control>
<control> <fromnode>PresetNode0</fromnode> <tonode>PyScript0</tonode> </control>
<tonode>PyScript0</tonode><toport>a</toport>
<value><double>0</double></value>
</parameter>
- <canvas width="1476" height="950" left="0" top="0" xscale="1" yscale="1"/>
- <presentation name="PresetNode0" x="47" y="154" z="2" width="266" height="128"/>
- <presentation name="PyScript0" x="395" y="154" z="2" width="266" height="128"/>
- <presentation name="OutNode0" x="743" y="154" z="2" width="266" height="128"/>
- <prslink fromnode="PresetNode0" fromport="a" tonode="PyScript0" toport="a">
- </prslink>
- <prslink fromnode="PyScript0" fromport="b" tonode="OutNode0" toport="a">
- </prslink>
+ <presentation name="OutNode0" x="747" y="153" width="158" height="63" expanded="1" expx="747" expy="153" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="PresetNode0" x="47" y="154" width="158" height="63" expanded="1" expx="0" expy="0" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="PyScript0" x="395" y="154" width="158" height="63" expanded="1" expx="0" expy="0" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="__ROOT__" x="0" y="0" width="909" height="221" expanded="1" expx="0" expy="0" expWidth="909" expHeight="221" shownState="0"/>
</proc>
<?xml version='1.0'?>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<tonode>SalomeNode1</tonode><toport>theStudyID</toport>
<value><int>1</int></value>
</parameter>
- <canvas width="2913" height="1343" left="139" top="0" xscale="0.665121" yscale="0.665121"/>
- <presentation name="StudyInNode0" x="47" y="196" z="2" width="266" height="150"/>
- <presentation name="PyScript0" x="395" y="66" z="2" width="266" height="150"/>
- <presentation name="StudyOutNode0" x="1089" y="207" z="2" width="266" height="128"/>
- <presentation name="SalomeNode0" x="743" y="174" z="2" width="266" height="194"/>
- <presentation name="SalomeNode1" x="396" y="314" z="2" width="266" height="172"/>
- <prslink fromnode="StudyInNode0" fromport="a" tonode="PyScript0" toport="a">
- <point x="379" y="151"/>
- <point x="379" y="281"/>
- <point x="327" y="281"/>
- </prslink>
- <prslink fromnode="StudyInNode0" fromport="b" tonode="PyScript0" toport="b">
- <point x="379" y="173"/>
- <point x="360" y="173"/>
- <point x="360" y="303"/>
- <point x="327" y="303"/>
- </prslink>
- <prslink fromnode="StudyInNode0" fromport="Gate" tonode="PyScript0" toport="Gate">
- <point x="389" y="201"/>
- <point x="355" y="201"/>
- <point x="355" y="331"/>
- <point x="318" y="331"/>
- </prslink>
- <prslink fromnode="StudyInNode0" fromport="Gate" tonode="SalomeNode1" toport="Gate">
- <point x="390" y="471"/>
- <point x="390" y="331"/>
- <point x="318" y="331"/>
- </prslink>
- <prslink fromnode="PyScript0" fromport="x" tonode="SalomeNode0" toport="theShape1">
- <point x="727" y="303"/>
- <point x="708" y="303"/>
- <point x="708" y="151"/>
- <point x="675" y="151"/>
- </prslink>
- <prslink fromnode="PyScript0" fromport="y" tonode="SalomeNode0" toport="theShape2">
- <point x="727" y="325"/>
- <point x="675" y="325"/>
- <point x="675" y="173"/>
- </prslink>
- <prslink fromnode="SalomeNode0" fromport="return" tonode="StudyOutNode0" toport="a">
- <point x="1073" y="292"/>
- <point x="1023" y="292"/>
- <point x="1023" y="303"/>
- </prslink>
- <prslink fromnode="SalomeNode0" fromport="Gate" tonode="StudyOutNode0" toport="Gate">
- <point x="1083" y="320"/>
- <point x="1050" y="320"/>
- <point x="1050" y="353"/>
- <point x="1014" y="353"/>
- </prslink>
- <prslink fromnode="SalomeNode1" fromport="Gate" tonode="SalomeNode0" toport="Gate">
- <point x="737" y="353"/>
- <point x="704" y="353"/>
- <point x="704" y="471"/>
- <point x="667" y="471"/>
- </prslink>
</proc>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<proc>
<!-- types -->
- <objref name="CALCIUM_integer"/>
- <objref name="CALCIUM_real"/>
<container name="A">
</container>
<container name="B">
<instream name="puissa" type="CALCIUM_real"/>
<instream name="text" type="CALCIUM_real"/>
<instream name="rext" type="CALCIUM_real"/>
+ <instream name="topo" type="CALCIUM_integer"/>
<outstream name="tparoi" type="CALCIUM_real"/>
<outstream name="rparoi" type="CALCIUM_real"/>
<outstream name="temperature" type="CALCIUM_real"/>
<inport name="dt" type="double"/>
<instream name="temperature" type="CALCIUM_real"/>
<outstream name="puissance" type="CALCIUM_real"/>
+ <outstream name="topo" type="CALCIUM_integer"/>
</service>
<service name="int1" >
<node>a.int4</node>
<method>trun</method>
<load container="F"/>
<instream name="tparoit" type="CALCIUM_real"/>
+ <instream name="topo" type="CALCIUM_integer"/>
<outstream name="tpart" type="CALCIUM_real"/>
+ <outstream name="stopo" type="CALCIUM_integer"/>
</service>
<stream>
<fromnode>canal</fromnode> <fromport>rfluide</fromport>
<tonode>crayon</tonode> <toport>puissa</toport>
<property name="StorageLevel" value="10"/>
</stream>
+
+ <stream>
+ <fromnode>comb</fromnode> <fromport>topo</fromport>
+ <tonode>int3</tonode> <toport>topo</toport>
+ </stream>
+ <stream>
+ <fromnode>int3</fromnode> <fromport>stopo</fromport>
+ <tonode>crayon</tonode> <toport>topo</toport>
+ </stream>
</bloc>
<!-- control -->
--- /dev/null
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<!--
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+
+ 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+-->
+<proc name="proc">
+ <property name="DefaultStudyID" value="1"/>
+ <objref name="CALCIUM_integer" id="IDL:CALCIUM_integer:1.0"/>
+ <type name="string" kind="string"/>
+ <struct name="Engines/dataref">
+ <member name="ref" type="string"/>
+ </struct>
+ <type name="bool" kind="bool"/>
+ <sequence name="boolvec" content="bool"/>
+ <type name="double" kind="double"/>
+ <sequence name="dblevec" content="double"/>
+ <objref name="file" id="file"/>
+ <type name="int" kind="int"/>
+ <sequence name="intvec" content="int"/>
+ <objref name="pyobj" id="python:obj:1.0"/>
+ <sequence name="stringvec" content="string"/>
+ <container name="DefaultContainer">
+ <property name="container_name" value="FactoryServer"/>
+ <property name="name" value="localhost"/>
+ </container>
+ <inline name="node0">
+ <script><code><![CDATA[n=20]]></code></script>
+ <outport name="n" type="int"/>
+ </inline>
+ <forloop name="ForLoop0" nsteps="3">
+ <bloc name="Bloc1">
+ <service name="node1">
+ <component>DSCCODC</component>
+ <load container="DefaultContainer"/>
+ <method>prun</method>
+ <inport name="niter" type="int"/>
+ <instream name="ETP_EN" type="CALCIUM_integer">
+ <property name="DateCalSchem" value="TI_SCHEM"/>
+ <property name="DependencyType" value="TIME_DEPENDENCY"/>
+ </instream>
+ <outstream name="STP_EN" type="CALCIUM_integer">
+ <property name="DateCalSchem" value="TI_SCHEM"/>
+ <property name="DependencyType" value="TIME_DEPENDENCY"/>
+ </outstream>
+ </service>
+ <service name="node2">
+ <component>DSCCODD</component>
+ <load container="DefaultContainer"/>
+ <method>prun</method>
+ <inport name="niter" type="int"/>
+ <instream name="ETP_EN" type="CALCIUM_integer">
+ <property name="DateCalSchem" value="TI_SCHEM"/>
+ <property name="DependencyType" value="TIME_DEPENDENCY"/>
+ </instream>
+ <outstream name="STP_EN" type="CALCIUM_integer">
+ <property name="DateCalSchem" value="TI_SCHEM"/>
+ <property name="DependencyType" value="TIME_DEPENDENCY"/>
+ </outstream>
+ </service>
+ <stream>
+ <fromnode>node1</fromnode> <fromport>STP_EN</fromport>
+ <tonode>node2</tonode> <toport>ETP_EN</toport>
+ <property name="DateCalSchem" value="TI_SCHEM"/>
+ </stream>
+ <stream>
+ <fromnode>node2</fromnode> <fromport>STP_EN</fromport>
+ <tonode>node1</tonode> <toport>ETP_EN</toport>
+ <property name="DateCalSchem" value="TI_SCHEM"/>
+ </stream>
+ </bloc>
+ </forloop>
+ <control> <fromnode>node0</fromnode> <tonode>ForLoop0</tonode> </control>
+ <datalink control="false">
+ <fromnode>node0</fromnode> <fromport>n</fromport>
+ <tonode>ForLoop0.Bloc1.node1</tonode> <toport>niter</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>node0</fromnode> <fromport>n</fromport>
+ <tonode>ForLoop0.Bloc1.node2</tonode> <toport>niter</toport>
+ </datalink>
+ <parameter>
+ <tonode>ForLoop0</tonode><toport>nsteps</toport>
+ <value><int>3</int></value>
+ </parameter>
+ <presentation name="ForLoop0" x="195.875" y="33.375" width="439.75" height="194.75" expanded="1" expx="195.875" expy="33.375" expWidth="439.75" expHeight="194.75" shownState="0"/>
+ <presentation name="ForLoop0.Bloc1" x="6" y="61" width="429.75" height="129.75" expanded="1" expx="6" expy="61" expWidth="429.75" expHeight="129.75" shownState="0"/>
+ <presentation name="node0" x="4" y="47.25" width="158" height="63" expanded="1" expx="4" expy="47.25" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="ForLoop0.Bloc1.node1" x="33" y="35.75" width="158" height="90" expanded="1" expx="33" expy="35.75" expWidth="158" expHeight="90" shownState="0"/>
+ <presentation name="ForLoop0.Bloc1.node2" x="267.75" y="34" width="158" height="90" expanded="1" expx="267.75" expy="34" expWidth="158" expHeight="90" shownState="0"/>
+ <presentation name="__ROOT__" x="0" y="0" width="639.625" height="232.125" expanded="1" expx="0" expy="0" expWidth="639.625" expHeight="232.125" shownState="0"/>
+</proc>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
</inline>
<service name="node1" >
- <component>HELLO</component>
+ <component>PYHELLO</component>
<method>makeBanner</method>
<load container="B"/>
<inport name="p1" type="double"/>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
</inline>
<service name="node1" >
- <component>HELLO</component>
+ <component>PYHELLO</component>
<method>makeBanner</method>
<load container="B"/>
<inport name="p1" type="string"/>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
</inline>
<service name="node1" >
- <component>HELLO</component>
+ <component>PYHELLO</component>
<method>makeBanner</method>
<load container="B"/>
<inport name="p1" type="string"/>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
--- /dev/null
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<!--
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+
+ 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+-->
+<proc name="newSchema_1">
+ <property name="DefaultStudyID" value="1"/>
+ <type name="string" kind="string"/>
+ <struct name="Engines/dataref">
+ <member name="ref" type="string"/>
+ </struct>
+ <objref name="GEOM_Object" id="IDL:GEOM/GEOM_Object:1.0"/>
+ <type name="bool" kind="bool"/>
+ <sequence name="boolvec" content="bool"/>
+ <type name="double" kind="double"/>
+ <sequence name="dblevec" content="double"/>
+ <objref name="file" id="file"/>
+ <type name="int" kind="int"/>
+ <sequence name="intvec" content="int"/>
+ <objref name="pyobj" id="python:obj:1.0"/>
+ <sequence name="seqpyobj" content="pyobj"/>
+ <sequence name="stringvec" content="string"/>
+ <container name="DefaultContainer">
+ <property name="container_name" value="FactoryServer"/>
+ <property name="name" value="localhost"/>
+ </container>
+ <container name="container0">
+ </container>
+ <container name="container8">
+ </container>
+ <foreach name="ForEachLoop_pyobj0" type="pyobj">
+ <bloc name="Bloc1">
+ <remote name="PyFunction4">
+ <function name="fromPyObj2String">
+ <code><![CDATA[def fromPyObj2String(aRun,):
+ aMedFile = aRun[0]
+ aMeshName = aRun[1]
+ return aMedFile,aMeshName
+]]></code>
+ </function>
+ <load container="container8"/>
+ <inport name="aRun" type="pyobj"/>
+ <outport name="aMedFile" type="string"/>
+ <outport name="aMeshName" type="string"/>
+ </remote>
+ <service name="MakeBoxDXDYDZ1">
+ <component>GEOM_Superv</component>
+ <load container="container8"/>
+ <method>MakeBoxDXDYDZ</method>
+ <inport name="theDX" type="double"/>
+ <inport name="theDY" type="double"/>
+ <inport name="theDZ" type="double"/>
+ <outport name="return" type="GEOM_Object"/>
+ </service>
+ <control> <fromnode>PyFunction4</fromnode> <tonode>MakeBoxDXDYDZ1</tonode> </control>
+ </bloc>
+ </foreach>
+ <inline name="PyScript1">
+ <script><code><![CDATA[import os
+numberOfRun = 5
+runs = []
+dir1 = "/home/crouzet/SUPPORT/NADIR"
+dir2 = "/TestFAKECOMPO/"
+medFile = dir1+dir2+"AlcyoneFields.med"
+meshName="LE DOMAINE"
+for run in range(numberOfRun):
+ runs.append([])
+ runs[run].append(medFile)
+ runs[run].append(meshName)
+ pass
+print "There is(are) ",numberOfRun," runs of Fake Compo on process ",os.getpid()
+]]></code></script>
+ <outport name="numberOfRun" type="int"/>
+ <outport name="runs" type="seqpyobj"/>
+ </inline>
+ <control> <fromnode>PyScript1</fromnode> <tonode>ForEachLoop_pyobj0</tonode> </control>
+ <datalink control="false">
+ <fromnode>ForEachLoop_pyobj0</fromnode> <fromport>evalSamples</fromport>
+ <tonode>ForEachLoop_pyobj0.Bloc1.PyFunction4</tonode> <toport>aRun</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>PyScript1</fromnode> <fromport>numberOfRun</fromport>
+ <tonode>ForEachLoop_pyobj0</tonode> <toport>nbBranches</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>PyScript1</fromnode> <fromport>runs</fromport>
+ <tonode>ForEachLoop_pyobj0</tonode> <toport>SmplsCollection</toport>
+ </datalink>
+ <parameter>
+ <tonode>ForEachLoop_pyobj0.Bloc1.MakeBoxDXDYDZ1</tonode><toport>theDX</toport>
+ <value><double>10</double></value>
+ </parameter>
+ <parameter>
+ <tonode>ForEachLoop_pyobj0.Bloc1.MakeBoxDXDYDZ1</tonode><toport>theDY</toport>
+ <value><double>10</double></value>
+ </parameter>
+ <parameter>
+ <tonode>ForEachLoop_pyobj0.Bloc1.MakeBoxDXDYDZ1</tonode><toport>theDZ</toport>
+ <value><double>10</double></value>
+ </parameter>
+ <presentation name="ForEachLoop_pyobj0" x="283.5" y="74.5" width="457.5" height="281.5" expanded="1" expx="283.5" expy="74.5" expWidth="457.5" expHeight="281.5" shownState="0"/>
+ <presentation name="ForEachLoop_pyobj0.Bloc1" x="41.5" y="124.5" width="412" height="153" expanded="1" expx="41.5" expy="124.5" expWidth="412" expHeight="153" shownState="0"/>
+ <presentation name="PyScript1" x="40" y="75" width="158" height="90" expanded="1" expx="40" expy="75" expWidth="158" expHeight="90" shownState="0"/>
+ <presentation name="ForEachLoop_pyobj0.Bloc1.PyFunction4" x="10" y="35" width="158" height="90" expanded="1" expx="10" expy="35" expWidth="158" expHeight="90" shownState="0"/>
+ <presentation name="ForEachLoop_pyobj0.Bloc1.MakeBoxDXDYDZ1" x="250" y="32" width="158" height="117" expanded="1" expx="250" expy="32" expWidth="158" expHeight="117" shownState="0"/>
+ <presentation name="__ROOT__" x="0" y="0" width="745" height="360" expanded="1" expx="0" expy="0" expWidth="745" expHeight="360" shownState="0"/>
+</proc>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
--- /dev/null
+<!--
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+
+ 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+-->
+<proc>
+ <!-- an optimizer with 3 branches with an inline python node -->
+ <!--types -->
+
+ <!--nodes -->
+ <optimizer name="b1" nbranch="4" lib="../../engine/Test/.libs/libPluginOptEvTest1" entry="PluginOptEvTest1Factory" >
+ <inline name="node2" >
+ <script >
+ <code>p1= p1+10.</code>
+ <code>print "node2:",p1</code>
+ <code>#a=p1/0</code>
+ <code>p1=5</code>
+ </script>
+ <inport name="p1" type="double"/>
+ <outport name="p1" type="int"/>
+ </inline>
+ </optimizer>
+
+ <!--control -->
+
+ <!--datalink -->
+ <datalink>
+ <fromnode>b1</fromnode><fromport>evalSamples</fromport>
+ <tonode>b1.node2</tonode> <toport>p1</toport>
+ </datalink>
+ <datalink control="false" >
+ <fromnode>b1.node2</fromnode><fromport>p1</fromport>
+ <tonode>b1</tonode> <toport>evalResults</toport>
+ </datalink>
+
+ <!--parameters -->
+ <parameter>
+ <tonode>b1</tonode> <toport>algoInit</toport>
+ <value><string>coucou</string></value>
+ </parameter>
+
+
+</proc>
--- /dev/null
+<!--
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+
+ 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+-->
+<proc>
+ <!-- an optimizer with 3 branches with an inline python node -->
+ <!--types -->
+
+ <!--nodes -->
+ <optimizer name="b1" nbranch="4" lib="../../engine/Test/.libs/libPluginOptEvTest1" entry="PluginOptEvTest1Factory" >
+ <bloc name="b" >
+ <inline name="node2" >
+ <script >
+ <code>p1= p1+10.</code>
+ <code>print "node2:",p1</code>
+ <code>#a=p1/0</code>
+ <code>p1=5</code>
+ </script>
+ <inport name="p1" type="double"/>
+ <outport name="p1" type="int"/>
+ </inline>
+ </bloc>
+ </optimizer>
+
+ <!--control -->
+
+ <!--datalink -->
+ <datalink>
+ <fromnode>b1</fromnode><fromport>evalSamples</fromport>
+ <tonode>b1.b.node2</tonode> <toport>p1</toport>
+ </datalink>
+ <datalink control="false" >
+ <fromnode>b1.b.node2</fromnode><fromport>p1</fromport>
+ <tonode>b1</tonode> <toport>evalResults</toport>
+ </datalink>
+
+ <!--parameters -->
+ <parameter>
+ <tonode>b1</tonode> <toport>algoInit</toport>
+ <value><string>coucou</string></value>
+ </parameter>
+
+
+</proc>
--- /dev/null
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<!--
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+
+ 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+-->
+<proc name="newSchema_1">
+ <property name="DefaultStudyID" value="1"/>
+ <type name="string" kind="string"/>
+ <struct name="Engines/dataref">
+ <member name="ref" type="string"/>
+ </struct>
+ <type name="bool" kind="bool"/>
+ <sequence name="boolvec" content="bool"/>
+ <type name="double" kind="double"/>
+ <sequence name="dblevec" content="double"/>
+ <objref name="file" id="file"/>
+ <type name="int" kind="int"/>
+ <sequence name="intvec" content="int"/>
+ <objref name="pyobj" id="python:obj:1.0"/>
+ <sequence name="stringvec" content="string"/>
+ <container name="DefaultContainer">
+ <property name="container_name" value="FactoryServer"/>
+ <property name="name" value="localhost"/>
+ </container>
+ <optimizer name="OptimizerLoop0" nbranch="4" lib="libTestOptLoop" entry="createOptimizerAlgASyncExample">
+ <inline name="PyFunction1">
+ <function name="myfunc">
+ <code><![CDATA[def myfunc(inValue):
+ outValue = int(3*inValue+5)
+ print "Received", inValue, ", returning", outValue
+ return outValue
+]]></code>
+ </function>
+ <inport name="inValue" type="double"/>
+ <outport name="outValue" type="int"/>
+ </inline>
+ </optimizer>
+ <datalink control="false">
+ <fromnode>OptimizerLoop0</fromnode> <fromport>evalSamples</fromport>
+ <tonode>OptimizerLoop0.PyFunction1</tonode> <toport>inValue</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>OptimizerLoop0.PyFunction1</fromnode> <fromport>outValue</fromport>
+ <tonode>OptimizerLoop0</tonode> <toport>evalResults</toport>
+ </datalink>
+ <parameter>
+ <tonode>OptimizerLoop0</tonode><toport>nbBranches</toport>
+ <value><int>4</int></value>
+ </parameter>
+ <presentation name="OptimizerLoop0" x="6" y="34" width="168" height="178.5" expanded="1" expx="6" expy="34" expWidth="168" expHeight="178.5" shownState="0"/>
+ <presentation name="OptimizerLoop0.PyFunction1" x="6" y="111.5" width="158" height="63" expanded="1" expx="6" expy="111.5" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="__ROOT__" x="0" y="0" width="178" height="216.5" expanded="1" expx="0" expy="0" expWidth="178" expHeight="216.5" shownState="0"/>
+</proc>
--- /dev/null
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<!--
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+
+ 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+-->
+<proc name="newSchema_1">
+ <property name="DefaultStudyID" value="1"/>
+ <type name="string" kind="string"/>
+ <struct name="Engines/dataref">
+ <member name="ref" type="string"/>
+ </struct>
+ <type name="bool" kind="bool"/>
+ <sequence name="boolvec" content="bool"/>
+ <type name="double" kind="double"/>
+ <sequence name="dblevec" content="double"/>
+ <objref name="file" id="file"/>
+ <type name="int" kind="int"/>
+ <sequence name="intvec" content="int"/>
+ <objref name="pyobj" id="python:obj:1.0"/>
+ <sequence name="stringvec" content="string"/>
+ <container name="DefaultContainer">
+ <property name="container_name" value="FactoryServer"/>
+ <property name="name" value="localhost"/>
+ </container>
+ <optimizer name="OptimizerLoop0" nbranch="4" lib="algoasyncexample.py" entry="myalgoasync">
+ <inline name="PyFunction0">
+ <function name="myfunc">
+ <code><![CDATA[def myfunc(inputValue):
+ outputValue = int(inputValue*3+5)
+ print "Received", inputValue, ", returning", outputValue
+ return outputValue
+]]></code>
+ </function>
+ <inport name="inputValue" type="double"/>
+ <outport name="outputValue" type="int"/>
+ </inline>
+ </optimizer>
+ <datalink control="false">
+ <fromnode>OptimizerLoop0</fromnode> <fromport>evalSamples</fromport>
+ <tonode>OptimizerLoop0.PyFunction0</tonode> <toport>inputValue</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>OptimizerLoop0.PyFunction0</fromnode> <fromport>outputValue</fromport>
+ <tonode>OptimizerLoop0</tonode> <toport>evalResults</toport>
+ </datalink>
+ <parameter>
+ <tonode>OptimizerLoop0</tonode><toport>nbBranches</toport>
+ <value><int>4</int></value>
+ </parameter>
+ <presentation name="OptimizerLoop0" x="6" y="34" width="167" height="191" expanded="1" expx="6" expy="34" expWidth="167" expHeight="191" shownState="0"/>
+ <presentation name="OptimizerLoop0.PyFunction0" x="5" y="124" width="158" height="63" expanded="1" expx="5" expy="124" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="__ROOT__" x="0" y="0" width="177" height="229" expanded="1" expx="0" expy="0" expWidth="177" expHeight="229" shownState="0"/>
+</proc>
--- /dev/null
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<!--
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+
+ 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+-->
+<proc name="newSchema_1">
+ <property name="DefaultStudyID" value="1"/>
+ <type name="string" kind="string"/>
+ <struct name="Engines/dataref">
+ <member name="ref" type="string"/>
+ </struct>
+ <type name="bool" kind="bool"/>
+ <sequence name="boolvec" content="bool"/>
+ <type name="double" kind="double"/>
+ <sequence name="dblevec" content="double"/>
+ <objref name="file" id="file"/>
+ <type name="int" kind="int"/>
+ <sequence name="intvec" content="int"/>
+ <objref name="pyobj" id="python:obj:1.0"/>
+ <sequence name="stringvec" content="string"/>
+ <container name="DefaultContainer">
+ <property name="container_name" value="FactoryServer"/>
+ <property name="name" value="localhost"/>
+ </container>
+ <optimizer name="OptimizerLoop0" nbranch="4" lib="libTestOptLoop" entry="createOptimizerAlgSyncExample">
+ <inline name="PyFunction1">
+ <function name="myfunc">
+ <code><![CDATA[def myfunc(inValue):
+ outValue = int(3*inValue+5)
+ print "Received", inValue, ", returning", outValue
+ return outValue
+]]></code>
+ </function>
+ <inport name="inValue" type="double"/>
+ <outport name="outValue" type="int"/>
+ </inline>
+ </optimizer>
+ <datalink control="false">
+ <fromnode>OptimizerLoop0</fromnode> <fromport>evalSamples</fromport>
+ <tonode>OptimizerLoop0.PyFunction1</tonode> <toport>inValue</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>OptimizerLoop0.PyFunction1</fromnode> <fromport>outValue</fromport>
+ <tonode>OptimizerLoop0</tonode> <toport>evalResults</toport>
+ </datalink>
+ <parameter>
+ <tonode>OptimizerLoop0</tonode><toport>nbBranches</toport>
+ <value><int>4</int></value>
+ </parameter>
+ <presentation name="OptimizerLoop0" x="6" y="34" width="169" height="187.5" expanded="1" expx="6" expy="34" expWidth="169" expHeight="187.5" shownState="0"/>
+ <presentation name="OptimizerLoop0.PyFunction1" x="7" y="120.5" width="158" height="63" expanded="1" expx="7" expy="120.5" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="__ROOT__" x="0" y="0" width="179" height="225.5" expanded="1" expx="0" expy="0" expWidth="179" expHeight="225.5" shownState="0"/>
+</proc>
--- /dev/null
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<!--
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+
+ 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+-->
+<proc name="newSchema_1">
+ <property name="DefaultStudyID" value="1"/>
+ <type name="string" kind="string"/>
+ <struct name="Engines/dataref">
+ <member name="ref" type="string"/>
+ </struct>
+ <type name="bool" kind="bool"/>
+ <sequence name="boolvec" content="bool"/>
+ <type name="double" kind="double"/>
+ <sequence name="dblevec" content="double"/>
+ <objref name="file" id="file"/>
+ <type name="int" kind="int"/>
+ <sequence name="intvec" content="int"/>
+ <objref name="pyobj" id="python:obj:1.0"/>
+ <sequence name="stringvec" content="string"/>
+ <container name="DefaultContainer">
+ <property name="container_name" value="FactoryServer"/>
+ <property name="name" value="localhost"/>
+ </container>
+ <optimizer name="OptimizerLoop0" nbranch="4" lib="algosyncexample.py" entry="myalgosync">
+ <inline name="PyFunction0">
+ <function name="myfunc">
+ <code><![CDATA[def myfunc(inputValue):
+ outputValue = int(inputValue*3+5)
+ print "Received", inputValue, ", returning", outputValue
+ return outputValue
+]]></code>
+ </function>
+ <inport name="inputValue" type="double"/>
+ <outport name="outputValue" type="int"/>
+ </inline>
+ </optimizer>
+ <datalink control="false">
+ <fromnode>OptimizerLoop0</fromnode> <fromport>evalSamples</fromport>
+ <tonode>OptimizerLoop0.PyFunction0</tonode> <toport>inputValue</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>OptimizerLoop0.PyFunction0</fromnode> <fromport>outputValue</fromport>
+ <tonode>OptimizerLoop0</tonode> <toport>evalResults</toport>
+ </datalink>
+ <parameter>
+ <tonode>OptimizerLoop0</tonode><toport>nbBranches</toport>
+ <value><int>4</int></value>
+ </parameter>
+ <presentation name="OptimizerLoop0.PyFunction0" x="6" y="111.5" width="158" height="63" expanded="1" expx="6" expy="111.5" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="OptimizerLoop0" x="6" y="34" width="168" height="178.5" expanded="1" expx="6" expy="34" expWidth="168" expHeight="178.5" shownState="0"/>
+ <presentation name="__ROOT__" x="0" y="0" width="178" height="216.5" expanded="1" expx="0" expy="0" expWidth="178" expHeight="216.5" shownState="0"/>
+</proc>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
--- /dev/null
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<!--
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+
+ 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+-->
+<proc name="TestDistPython2">
+ <property name="DefaultStudyID" value="1"/>
+ <type name="string" kind="string"/>
+ <struct name="Engines/dataref">
+ <member name="ref" type="string"/>
+ </struct>
+ <type name="bool" kind="bool"/>
+ <sequence name="boolvec" content="bool"/>
+ <type name="double" kind="double"/>
+ <sequence name="dblevec" content="double"/>
+ <objref name="file" id="file"/>
+ <type name="int" kind="int"/>
+ <sequence name="intvec" content="int"/>
+ <objref name="pyobj" id="python:obj:1.0"/>
+ <sequence name="stringvec" content="string"/>
+ <container name="DefaultContainer">
+ <property name="container_name" value="FactoryServer"/>
+ <property name="name" value="claui2c6"/>
+ </container>
+ <container name="cont1">
+ </container>
+ <remote name="Node6">
+ <function name="ff2">
+ <code><![CDATA[
+def ff2(x,a):
+ print "coucou, x=",x
+ print "coucou, a=",a
+ print my_container
+ return x+" OK ca marche"+str(a),2*a+4.7
+]]></code>
+ </function>
+ <load container="cont1"/>
+ <inport name="x" type="string"/>
+ <inport name="a" type="double"/>
+ <outport name="y" type="string"/>
+ <outport name="z" type="double"/>
+ </remote>
+ <inline name="node2">
+ <script><code><![CDATA[
+print "dans node2 p1=",p1
+print "dans node2 p2=",p2
+]]></code></script>
+ <inport name="p1" type="string"/>
+ <inport name="p2" type="double"/>
+ </inline>
+ <control> <fromnode>Node6</fromnode> <tonode>node2</tonode> </control>
+ <datalink control="false">
+ <fromnode>Node6</fromnode> <fromport>y</fromport>
+ <tonode>node2</tonode> <toport>p1</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>Node6</fromnode> <fromport>z</fromport>
+ <tonode>node2</tonode> <toport>p2</toport>
+ </datalink>
+ <parameter>
+ <tonode>Node6</tonode><toport>x</toport>
+ <value><string>ab</string></value>
+ </parameter>
+ <parameter>
+ <tonode>Node6</tonode><toport>a</toport>
+ <value><double>3.14</double></value>
+ </parameter>
+ <presentation name="Node6" x="6" y="34" width="158" height="90" expanded="1" expx="6" expy="34" expWidth="158" expHeight="90" shownState="0"/>
+ <presentation name="node2" x="6" y="125" width="158" height="90" expanded="1" expx="6" expy="125" expWidth="158" expHeight="90" shownState="0"/>
+ <presentation name="__ROOT__" x="0" y="0" width="168" height="219" expanded="1" expx="0" expy="0" expWidth="168" expHeight="219" shownState="0"/>
+</proc>
--- /dev/null
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<!--
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+
+ 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+-->
+<proc name="newSchema_1">
+ <property name="DefaultStudyID" value="1"/>
+ <type name="string" kind="string"/>
+ <struct name="Engines/dataref">
+ <member name="ref" type="string"/>
+ </struct>
+ <type name="bool" kind="bool"/>
+ <sequence name="boolvec" content="bool"/>
+ <type name="double" kind="double"/>
+ <sequence name="dblevec" content="double"/>
+ <objref name="file" id="file"/>
+ <type name="int" kind="int"/>
+ <sequence name="intvec" content="int"/>
+ <objref name="pyobj" id="python:obj:1.0"/>
+ <sequence name="stringvec" content="string"/>
+ <container name="DefaultContainer">
+ <property name="container_name" value="FactoryServer"/>
+ <property name="name" value="localhost"/>
+ </container>
+ <container name="container0">
+ </container>
+ <container name="container1">
+ </container>
+ <remote name="PyFunction3">
+ <function name="f">
+ <code><![CDATA[import time
+
+def f():
+ print my_container
+ for n in xrange(15):
+ print time.time()
+ time.sleep(1)
+
+]]></code>
+ </function>
+ <load container="container0"/>
+ </remote>
+ <remote name="PyFunction4">
+ <function name="f">
+ <code><![CDATA[import time
+def f():
+ print my_container
+ for n in xrange(15):
+ print time.time()
+ time.sleep(1)
+]]></code>
+ </function>
+ <load container="container1"/>
+ </remote>
+ <presentation name="PyFunction3" x="6" y="34" width="158" height="36" expanded="1" expx="6" expy="34" expWidth="158" expHeight="36" shownState="0"/>
+ <presentation name="PyFunction4" x="6" y="72" width="158" height="36" expanded="1" expx="6" expy="72" expWidth="158" expHeight="36" shownState="0"/>
+ <presentation name="__ROOT__" x="0" y="0" width="168" height="112" expanded="1" expx="0" expy="0" expWidth="168" expHeight="112" shownState="0"/>
+</proc>
--- /dev/null
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<!--
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+
+ 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+-->
+<proc name="newSchema_1">
+ <property name="DefaultStudyID" value="1"/>
+ <type name="string" kind="string"/>
+ <struct name="Engines/dataref">
+ <member name="ref" type="string"/>
+ </struct>
+ <type name="bool" kind="bool"/>
+ <sequence name="boolvec" content="bool"/>
+ <type name="double" kind="double"/>
+ <sequence name="dblevec" content="double"/>
+ <objref name="file" id="file"/>
+ <type name="int" kind="int"/>
+ <sequence name="intvec" content="int"/>
+ <objref name="pyobj" id="python:obj:1.0"/>
+ <sequence name="seqint" content="int"/>
+ <sequence name="stringvec" content="string"/>
+ <container name="DefaultContainer">
+ <property name="container_name" value="FactoryServer"/>
+ <property name="name" value="localhost"/>
+ </container>
+ <container name="container0">
+ </container>
+ <foreach name="ForEachLoop_int1" nbranch="2" type="int">
+ <remote name="PyFunction3">
+ <function name="f">
+ <code><![CDATA[import time
+
+def f(i5):
+ print my_container
+ print "nouvelle branche avec ", i5
+ for n in xrange(15):
+ print time.time()
+ time.sleep(1)
+
+]]></code>
+ </function>
+ <load container="container0"/>
+ <inport name="i5" type="int"/>
+ </remote>
+ </foreach>
+ <inline name="PyScript2">
+ <script><code><![CDATA[o4 = [1, 2]
+]]></code></script>
+ <outport name="o4" type="seqint"/>
+ </inline>
+ <control> <fromnode>PyScript2</fromnode> <tonode>ForEachLoop_int1</tonode> </control>
+ <datalink control="false">
+ <fromnode>ForEachLoop_int1</fromnode> <fromport>evalSamples</fromport>
+ <tonode>ForEachLoop_int1.PyFunction3</tonode> <toport>i5</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>PyScript2</fromnode> <fromport>o4</fromport>
+ <tonode>ForEachLoop_int1</tonode> <toport>SmplsCollection</toport>
+ </datalink>
+ <parameter>
+ <tonode>ForEachLoop_int1</tonode><toport>nbBranches</toport>
+ <value><int>2</int></value>
+ </parameter>
+ <presentation name="ForEachLoop_int1" x="260.5" y="144.5" width="200.5" height="183" expanded="1" expx="260.5" expy="144.5" expWidth="200.5" expHeight="183" shownState="0"/>
+ <presentation name="ForEachLoop_int1.PyFunction3" x="38.5" y="116" width="158" height="63" expanded="1" expx="38.5" expy="116" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="PyScript2" x="41" y="71" width="158" height="63" expanded="1" expx="41" expy="71" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="__ROOT__" x="0" y="0" width="465" height="331.5" expanded="1" expx="0" expy="0" expWidth="465" expHeight="331.5" shownState="0"/>
+</proc>
--- /dev/null
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<!--
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+
+ 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+-->
+<proc name="TestDistPython2">
+ <property name="DefaultStudyID" value="1"/>
+ <type name="string" kind="string"/>
+ <struct name="Engines/dataref">
+ <member name="ref" type="string"/>
+ </struct>
+ <type name="bool" kind="bool"/>
+ <sequence name="boolvec" content="bool"/>
+ <type name="double" kind="double"/>
+ <sequence name="dblevec" content="double"/>
+ <objref name="file" id="file"/>
+ <type name="int" kind="int"/>
+ <sequence name="intvec" content="int"/>
+ <objref name="pyobj" id="python:obj:1.0"/>
+ <sequence name="stringvec" content="string"/>
+ <container name="DefaultContainer">
+ <property name="container_name" value="FactoryServer"/>
+ <property name="name" value="claui2c6"/>
+ </container>
+ <container name="cont1">
+ </container>
+ <remote name="Node6">
+ <script>
+ <code><![CDATA[
+print "coucou, x=",x
+print "coucou, a=",a
+print "my_container=",my_container
+y= x+" OK ca marche"+str(a)
+z=2*a+4.7
+print y,z
+]]></code>
+ </script>
+ <load container="cont1"/>
+ <inport name="x" type="string"/>
+ <inport name="a" type="double"/>
+ <outport name="y" type="string"/>
+ <outport name="z" type="double"/>
+ </remote>
+ <inline name="node2">
+ <script><code><![CDATA[
+print "dans node2 p1=",p1
+print "dans node2 p2=",p2
+]]></code></script>
+ <inport name="p1" type="string"/>
+ <inport name="p2" type="double"/>
+ </inline>
+ <control> <fromnode>Node6</fromnode> <tonode>node2</tonode> </control>
+ <datalink control="false">
+ <fromnode>Node6</fromnode> <fromport>y</fromport>
+ <tonode>node2</tonode> <toport>p1</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>Node6</fromnode> <fromport>z</fromport>
+ <tonode>node2</tonode> <toport>p2</toport>
+ </datalink>
+ <parameter>
+ <tonode>Node6</tonode><toport>x</toport>
+ <value><string>ab</string></value>
+ </parameter>
+ <parameter>
+ <tonode>Node6</tonode><toport>a</toport>
+ <value><double>3.14</double></value>
+ </parameter>
+ <presentation name="Node6" x="6" y="34" width="158" height="90" expanded="1" expx="6" expy="34" expWidth="158" expHeight="90" shownState="0"/>
+ <presentation name="node2" x="6" y="125" width="158" height="90" expanded="1" expx="6" expy="125" expWidth="158" expHeight="90" shownState="0"/>
+ <presentation name="__ROOT__" x="0" y="0" width="168" height="219" expanded="1" expx="0" expy="0" expWidth="168" expHeight="219" shownState="0"/>
+</proc>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<?xml version='1.0'?>
+<!--
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+
+ 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+-->
<proc>
<type name="bool" kind="bool"/>
<sequence name="boolvec" content="bool"/>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<code> param['hostname']=machine</code>
<code> param['container_name']=container</code>
<code> compo=salome.lcc.LoadComponent(param, "HELLO")</code>
- <code> print compo.makeBanner(p1)</code>
+ <code> print compo.hello(salome.myStudy, p1)</code>
<code> print p1</code>
</function>
<load container="A"/>
<code> param['hostname']=machine</code>
<code> param['container_name']=container</code>
<code> compo=salome.lcc.LoadComponent(param, "HELLO")</code>
- <code> print compo.makeBanner(p1)</code>
+ <code> print compo.hello(salome.myStudy, p1)</code>
<code> print p1</code>
</function>
<inport name="p1" type="string"/>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<code> param['hostname']=machine</code>
<code> param['container_name']=container</code>
<code> compo=salome.lcc.LoadComponent(param, "HELLO")</code>
- <code> print compo.makeBanner(p1)</code>
+ <code> print compo.hello(salome.myStudy, p1)</code>
<code> print p1</code>
</function>
<load container="A"/>
<code> param['hostname']=machine</code>
<code> param['container_name']=container</code>
<code> compo=salome.lcc.LoadComponent(param, "HELLO")</code>
- <code> print compo.makeBanner(p1)</code>
+ <code> print compo.hello(salome.myStudy, p1)</code>
<code> print p1</code>
</function>
<inport name="p1" type="string"/>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!-- types -->
<objref name="BASIC_short"/>
<!-- inline -->
+ <inline name="node0" >
+ <script>
+ <code>n=20</code>
+ </script>
+ <outport name="n" type="int"/>
+ </inline>
<!-- service -->
-
<service name="node1" >
- <component>COMPONENT_B</component>
- <method>S2</method>
- <outstream name="S2_data_uses_port" type="BASIC_short"/>
+ <component>DSCCODA</component>
+ <method>trun</method>
+ <inport name="niter" type="int"/>
+ <instream name="trun_in_port" type="BASIC_short"/>
+ <outstream name="trun_out_port" type="BASIC_short"/>
</service>
-
<service name="node2" >
- <component>COMPONENT_C</component>
- <method>S3</method>
- <instream name="S3_data_provides_port" type="BASIC_short"/>
+ <component>DSCCODB</component>
+ <method>trun</method>
+ <inport name="niter" type="int"/>
+ <instream name="trun_in_port" type="BASIC_short"/>
+ <outstream name="trun_out_port" type="BASIC_short"/>
</service>
<!--control -->
<!--datalinks -->
-
+ <datalink>
+ <fromnode>node0</fromnode><fromport>n</fromport>
+ <tonode>node1</tonode> <toport>niter</toport>
+ </datalink>
+ <datalink>
+ <fromnode>node0</fromnode><fromport>n</fromport>
+ <tonode>node2</tonode> <toport>niter</toport>
+ </datalink>
<!--parameters -->
<!--stream -->
<stream>
- <fromnode>node1</fromnode> <fromport>S2_data_uses_port</fromport>
- <tonode>node2</tonode> <toport>S3_data_provides_port</toport>
+ <fromnode>node1</fromnode> <fromport>trun_out_port</fromport>
+ <tonode>node2</tonode> <toport>trun_in_port</toport>
</stream>
+ <stream>
+ <fromnode>node2</fromnode> <fromport>trun_out_port</fromport>
+ <tonode>node1</tonode> <toport>trun_in_port</toport>
+ </stream>
+
</proc>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
--- /dev/null
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<!--
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+
+ 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+-->
+<proc name="proc">
+ <property name="DefaultStudyID" value="1"/>
+ <type name="string" kind="string"/>
+ <struct name="Engines/dataref">
+ <member name="ref" type="string"/>
+ </struct>
+ <type name="bool" kind="bool"/>
+ <sequence name="boolvec" content="bool"/>
+ <type name="double" kind="double"/>
+ <sequence name="dblevec" content="double"/>
+ <objref name="file" id="file"/>
+ <type name="int" kind="int"/>
+ <sequence name="intvec" content="int"/>
+ <objref name="pyobj" id="python:obj:1.0"/>
+ <sequence name="stringvec" content="string"/>
+ <container name="DefaultContainer">
+ <property name="container_name" value="FactoryServer"/>
+ <property name="name" value="localhost"/>
+ </container>
+ <inline name="n">
+ <script><code><![CDATA[select=3]]></code></script>
+ <outport name="select" type="int"/>
+ </inline>
+ <inline name="n2">
+ <script><code><![CDATA[print p1]]></code></script>
+ <inport name="p1" type="double"/>
+ <outport name="p1" type="double"/>
+ </inline>
+ <switch name="b1">
+ <default>
+ <inline name="n2">
+ <script><code><![CDATA[print p1]]></code></script>
+ <inport name="p1" type="double"/>
+ <outport name="p1" type="double"/>
+ </inline>
+ </default>
+ <case id="1">
+ <inline name="n2">
+ <script><code><![CDATA[print p1]]></code></script>
+ <inport name="p1" type="double"/>
+ <outport name="p1" type="double"/>
+ </inline>
+ </case>
+ <case id="3">
+ <switch name="b" select="1">
+ <default>
+ <inline name="n2">
+ <script><code><![CDATA[p1=20.
+condition=p1 < 40. ]]></code></script>
+ <outport name="p1" type="double"/>
+ <outport name="condition" type="bool"/>
+ </inline>
+ </default>
+ <case id="1">
+ <inline name="n2">
+ <script><code><![CDATA[print p1
+p1=p1+20
+condition=p1 < 40. ]]></code></script>
+ <inport name="p1" type="double"/>
+ <outport name="p1" type="double"/>
+ <outport name="condition" type="bool"/>
+ </inline>
+ </case>
+ </switch>
+ </case>
+ </switch>
+ <control> <fromnode>n</fromnode> <tonode>b1</tonode> </control>
+ <control> <fromnode>b1</fromnode> <tonode>n2</tonode> </control>
+ <datalink control="false">
+ <fromnode>n</fromnode> <fromport>select</fromport>
+ <tonode>b1</tonode> <toport>select</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>b1.p3_b.default_n2</fromnode> <fromport>p1</fromport>
+ <tonode>n2</tonode> <toport>p1</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>b1.p3_b.p1_n2</fromnode> <fromport>p1</fromport>
+ <tonode>n2</tonode> <toport>p1</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>b1.default_n2</fromnode> <fromport>p1</fromport>
+ <tonode>n2</tonode> <toport>p1</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>b1.p1_n2</fromnode> <fromport>p1</fromport>
+ <tonode>n2</tonode> <toport>p1</toport>
+ </datalink>
+ <parameter>
+ <tonode>b1.default_n2</tonode><toport>p1</toport>
+ <value><double>67</double></value>
+ </parameter>
+ <parameter>
+ <tonode>b1.p1_n2</tonode><toport>p1</toport>
+ <value><double>23</double></value>
+ </parameter>
+ <parameter>
+ <tonode>b1.p3_b.p1_n2</tonode><toport>p1</toport>
+ <value><double>54</double></value>
+ </parameter>
+ <parameter>
+ <tonode>b1.p3_b</tonode><toport>select</toport>
+ <value><int>1</int></value>
+ </parameter>
+ <presentation name="b1" x="397" y="69" width="189" height="454" expanded="1" expx="397" expy="69" expWidth="189" expHeight="454" shownState="0"/>
+ <presentation name="b1.default_n2" x="6" y="57.5" width="158" height="63" expanded="1" expx="6" expy="57.5" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="b1.p1_n2" x="6" y="121.5" width="158" height="63" expanded="1" expx="6" expy="121.5" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="b1.p3_b.default_n2" x="6" y="57.5" width="158" height="90" expanded="1" expx="6" expy="57.5" expWidth="158" expHeight="90" shownState="0"/>
+ <presentation name="b1.p3_b.p1_n2" x="6" y="148" width="158" height="90" expanded="1" expx="6" expy="148" expWidth="158" expHeight="90" shownState="0"/>
+ <presentation name="n2" x="760" y="181" width="158" height="63" expanded="1" expx="760" expy="181" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="b1.p3_b" x="17" y="208" width="168" height="242" expanded="1" expx="17" expy="208" expWidth="168" expHeight="242" shownState="0"/>
+ <presentation name="n" x="6" y="40.5" width="158" height="63" expanded="1" expx="6" expy="40.5" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="__ROOT__" x="0" y="0" width="922" height="527" expanded="1" expx="0" expy="0" expWidth="922" expHeight="527" shownState="0"/>
+</proc>
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _SERVERPARSERS_HXX_
+#define _SERVERPARSERS_HXX_
+
+#include "ServerNode.hxx"
+
+extern YACS::ENGINE::Proc* currentProc;
+extern YACS::ENGINE::Runtime* theRuntime;
+
+namespace YACS
+{
+
+static std::string t22[]={"ref","node","component","componentinstance",""};
+
+template <class T=YACS::ENGINE::ServerNode*>
+struct servertypeParser:public inlinetypeParser<T>
+{
+ static servertypeParser<T> serverParser;
+
+ virtual void onStart(const XML_Char* el, const XML_Char** attr);
+ virtual void onEnd(const char *el,parser* child)
+ {
+ DEBTRACE( "servertypeParser::onEnd: " << el )
+ std::string element(el);
+ if(element == "kind")this->kind(((stringtypeParser*)child)->post());
+ else if(element == "loadcontainer") loadcontainer(((stringtypeParser*)child)->post());
+ //else if(element == "loadcontainerinstance") containerinstance(((stringtypeParser*)child)->post());
+ else if(element == "script") script(((codetypeParser*)child)->post());
+ else if(element == "node") node(((stringtypeParser*)child)->post());
+ else if(element == "method") method(((stringtypeParser*)child)->post());
+ else if(element == "load") load(((loadtypeParser*)child)->post());
+ else if(element == "property")this->property(((propertytypeParser*)child)->post());
+ else if(element == "inport") this->inport(((inporttypeParser<myinport>*)child)->post());
+ else if(element == "outport") this->outport(((outporttypeParser<myoutport>*)child)->post());
+ else if(element == "instream") instream(((inporttypeParser<myinport>*)child)->post());
+ else if(element == "outstream") outstream(((outporttypeParser<myoutport>*)child)->post());
+ }
+
+ /*virtual void containerinstance (const std::string& name)
+ {
+ DEBTRACE( "componentinstance: " << name )
+ if(currentProc->componentInstanceMap.count(name) == 0)
+ throw YACS::Exception("Unknown ComponentInstance: "+name);
+ this->_node=theRuntime->createCompoNode(this->_kind,this->_name);
+ YACS::ENGINE::ComponentInstance* inst=currentProc->componentInstanceMap[name];
+ this->_node->setComponent(inst);
+ }*/
+
+ virtual void loadcontainer (const std::string& name)
+ {
+ DEBTRACE( "server_loadcontainer: " << name )
+ this->_node=(YACS::ENGINE::ServerNode*)theRuntime->createFuncNode("DistPython",this->_name);
+ YACS::ENGINE::Container *cont=currentProc->createContainer(this->_node->getEffectiveKindOfServer());
+ cont->setName(name);
+ this->_node->setContainer(cont);
+ cont->decrRef();
+ }
+ virtual void script (const myfunc& f)
+ {
+ DEBTRACE( "server_script: " << f._code )
+ this->_node->setScript(f._code);
+ }
+ virtual void node (const std::string& name)
+ {
+ DEBTRACE( "server_node: " << name )
+ std::string fullname = currentProc->names.back()+name;
+ if(currentProc->inlineMap.count(name) != 0)
+ {
+ //ServerNode with absolute name found
+ YACS::ENGINE::ServerNode* n=(YACS::ENGINE::ServerNode*)currentProc->inlineMap[name];
+ this->_node =n->createNode(this->_name);
+ }
+ else if(currentProc->inlineMap.count(fullname) != 0)
+ {
+ //ServerNode with relative name found
+ //TODO: must be a short name (possible only in the same context)
+ YACS::ENGINE::ServerNode* n=(YACS::ENGINE::ServerNode*)currentProc->inlineMap[fullname];
+ this->_node =n->createNode(this->_name);
+ }
+ else
+ {
+ throw YACS::Exception("Unknown ServerNode");
+ }
+ }
+
+ virtual void method (const std::string& name)
+ {
+ DEBTRACE( "server_method: " << name )
+ if(this->_node==0)
+ throw YACS::Exception("ServerNode must be completely defined before defining its method");
+ if(name == "")
+ {
+ this->logError("a server name must be a non empty string");
+ return;
+ }
+ this->_node->setFname(name);
+ }
+
+ virtual void load (const loadon& l)
+ {
+ DEBTRACE( "server_load: " << l._container);
+ this->_container=l._container;
+ }
+
+ virtual void instream (const myinport& p)
+ {
+ DEBTRACE( "server_instream" )
+ DEBTRACE( p._type )
+ DEBTRACE( p._name )
+ if(this->_node==0)
+ throw YACS::Exception("ServerNode must be completely defined before defining its ports");
+
+ if(currentProc->typeMap.count(p._type)==0)
+ {
+ YACS::ENGINE::TypeCode* t=theRuntime->getTypeCode(p._type);
+ if(t==0)
+ {
+ std::string msg="Unknown InStreamPort Type: ";
+ msg=msg+p._type+" for node: "+this->_node->getName()+" port name: "+p._name;
+ throw YACS::Exception(msg);
+ }
+ else
+ {
+ currentProc->typeMap[p._type]=t;
+ t->incrRef();
+ }
+ }
+ YACS::ENGINE::InputDataStreamPort* port;
+ port=this->_node->edAddInputDataStreamPort(p._name,currentProc->typeMap[p._type]);
+ // Set all properties for this port
+ std::map<std::string, std::string>::const_iterator pt;
+ for(pt=p._props.begin();pt!=p._props.end();pt++)
+ port->setProperty((*pt).first,(*pt).second);
+ }
+ virtual void outstream (const myoutport& p)
+ {
+ DEBTRACE( "server_outstream" )
+ DEBTRACE( p._type )
+ DEBTRACE( p._name )
+ if(this->_node==0)
+ throw YACS::Exception("ServerNode must be completely defined before defining its ports");
+
+ if(currentProc->typeMap.count(p._type)==0)
+ {
+ YACS::ENGINE::TypeCode* t=theRuntime->getTypeCode(p._type);
+ if(t==0)
+ {
+ std::string msg="Unknown OutStreamPort Type: ";
+ msg=msg+p._type+" for node: "+this->_node->getName()+" port name: "+p._name;
+ throw YACS::Exception(msg);
+ }
+ else
+ {
+ currentProc->typeMap[p._type]=t;
+ t->incrRef();
+ }
+ }
+ YACS::ENGINE::OutputDataStreamPort* port;
+ port=this->_node->edAddOutputDataStreamPort(p._name,currentProc->typeMap[p._type]);
+ // Set all properties for this port
+ std::map<std::string, std::string>::const_iterator pt;
+ for(pt=p._props.begin();pt!=p._props.end();pt++)
+ port->setProperty((*pt).first,(*pt).second);
+ }
+ virtual T post()
+ {
+ DEBTRACE( "server_post " << this->_node->getName() )
+ this->mincount("method",1);
+ if(this->_state == "disabled")this->_node->exDisabledState();
+
+ // If the server node has no component instance don't go further return the node
+ if(!this->_node->getComponent())
+ return this->_node;
+
+ // when container is not defined by <load container="xxx"/> but indirectly by <node>xxx</node>
+ // this->_container is not set, and there is no need to setContainer
+ // so stop here and return the node
+ if(this->_node->getComponent()->getContainer())
+ return this->_node;
+
+ //If the component instance is anonymous set the container
+ // with the load directive or with the DefaultContainer
+ if(this->_node->getComponent()->isAnonymous())
+ {
+ if(currentProc->containerMap.count(this->_container) != 0)
+ this->_node->getComponent()->setContainer(currentProc->containerMap[this->_container]);
+ else if(this->_container == "" && currentProc->containerMap.count("DefaultContainer") != 0)
+ {
+ //a default container is defined : use it if supported
+ try
+ {
+ currentProc->containerMap["DefaultContainer"]->checkCapabilityToDealWith(this->_node->getComponent());
+ this->_node->getComponent()->setContainer(currentProc->containerMap["DefaultContainer"]);
+ }
+ catch(YACS::Exception)
+ {}
+ }
+ else
+ std::cerr << "WARNING: Unknown container " << this->_container << " ignored" << std::endl;
+ }
+ return this->_node;
+ }
+};
+
+template <class T> servertypeParser<T> servertypeParser<T>::serverParser;
+
+
+template <class T>
+void servertypeParser<T>::onStart(const XML_Char* el, const XML_Char** attr)
+ {
+ DEBTRACE( "servertypeParser::onStart: " << el )
+ std::string element(el);
+ parser* pp=&parser::main_parser;
+ this->maxcount("kind",1,element);
+ this->maxcount("ref",1,element);
+ this->maxcount("node",1,element);
+ this->maxcount("component",1,element);
+ this->maxcount("componentinstance",1,element);
+ this->maxcount("loadcontainer",1,element);
+ this->maxcount("script",1,element);
+ this->maxcount("method",1,element);
+ this->maxcount("load",1,element);
+ this->maxchoice(t22,1,element);
+ if(element == "kind")pp=&stringtypeParser::stringParser;
+ else if(element == "ref")pp=&stringtypeParser::stringParser;
+ else if(element == "component")pp=&stringtypeParser::stringParser;
+ else if(element == "componentinstance")pp=&stringtypeParser::stringParser;
+ else if(element == "loadcontainer")pp=&stringtypeParser::stringParser;
+ else if(element == "script")pp=&codetypeParser::codeParser;
+ else if(element == "node")pp=&stringtypeParser::stringParser;
+ else if(element == "method")pp=&stringtypeParser::stringParser;
+ else if(element == "load")pp=&loadtypeParser::loadParser;
+ else if(element == "property")pp=&propertytypeParser::propertyParser;
+ else if(element == "inport")pp=&inporttypeParser<>::inportParser;
+ else if(element == "outport")pp=&outporttypeParser<>::outportParser;
+ else if(element == "instream")pp=&inporttypeParser<>::inportParser;
+ else if(element == "outstream")pp=&outporttypeParser<>::outportParser;
+ this->SetUserDataAndPush(pp);
+ pp->init();
+ pp->pre();
+ pp->buildAttr(attr);
+ }
+
+} // end of namespace YACS
+
+#endif
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _SERVICEPARSERS_HXX_
+#define _SERVICEPARSERS_HXX_
+
+#include "parserBase.hxx"
+#include "containerParsers.hxx"
+#include "dataParsers.hxx"
+#include "portParsers.hxx"
+#include "codeParsers.hxx"
+#include "propertyParsers.hxx"
+
+#include "Proc.hxx"
+#include "TypeCode.hxx"
+#include "InlineNode.hxx"
+#include "ServiceNode.hxx"
+#include "Exception.hxx"
+#include "Runtime.hxx"
+#include "Container.hxx"
+#include "ComponentInstance.hxx"
+#include "OutputDataStreamPort.hxx"
+#include "InputDataStreamPort.hxx"
+#include "ComponentInstance.hxx"
+#include "factory.hxx"
+
+extern YACS::ENGINE::Proc* currentProc;
+extern YACS::ENGINE::Runtime* theRuntime;
+
+namespace YACS
+{
+
+static std::string t2[]={"ref","node","component","componentinstance",""};
+
+template <class T=YACS::ENGINE::ServiceNode*>
+struct servicetypeParser:public inlinetypeParser<T>
+{
+ static servicetypeParser<T> serviceParser;
+
+ virtual void onStart(const XML_Char* el, const XML_Char** attr);
+ virtual void onEnd(const char *el,parser* child)
+ {
+ DEBTRACE( "servicetypeParser::onEnd: " << el )
+ std::string element(el);
+ if(element == "kind")this->kind(((stringtypeParser*)child)->post());
+ else if(element == "ref") ref(((stringtypeParser*)child)->post());
+ else if(element == "component") component(((stringtypeParser*)child)->post());
+ else if(element == "componentinstance") componentinstance(((stringtypeParser*)child)->post());
+ else if(element == "node") node(((stringtypeParser*)child)->post());
+ else if(element == "method") method(((stringtypeParser*)child)->post());
+ else if(element == "load") load(((loadtypeParser*)child)->post());
+ else if(element == "property")this->property(((propertytypeParser*)child)->post());
+ else if(element == "inport") this->inport(((inporttypeParser<myinport>*)child)->post());
+ else if(element == "outport") this->outport(((outporttypeParser<myoutport>*)child)->post());
+ else if(element == "instream") instream(((inporttypeParser<myinport>*)child)->post());
+ else if(element == "outstream") outstream(((outporttypeParser<myoutport>*)child)->post());
+ }
+ virtual void ref (const std::string& name)
+ {
+ DEBTRACE( "service_ref: " << name )
+ this->_node=theRuntime->createRefNode(this->_kind,this->_name);
+ this->_node->setRef(name);
+ }
+
+ virtual void componentinstance (const std::string& name)
+ {
+ DEBTRACE( "componentinstance: " << name )
+ if(currentProc->componentInstanceMap.count(name) == 0)
+ throw YACS::Exception("Unknown ComponentInstance: "+name);
+ this->_node=theRuntime->createCompoNode(this->_kind,this->_name);
+ YACS::ENGINE::ComponentInstance* inst=currentProc->componentInstanceMap[name];
+ this->_node->setComponent(inst);
+ }
+
+ virtual void component (const std::string& name)
+ {
+ DEBTRACE( "service_component: " << name )
+ this->_node=theRuntime->createCompoNode(this->_kind,this->_name);
+ YACS::ENGINE::ComponentInstance* inst=currentProc->createComponentInstance(name,"",this->_node->getKind());
+ this->_node->setComponent(inst);
+ inst->decrRef();
+ }
+ virtual void node (const std::string& name)
+ {
+ DEBTRACE( "service_node: " << name )
+ std::string fullname = currentProc->names.back()+name;
+ if(currentProc->serviceMap.count(name) != 0)
+ {
+ //ServiceNode with absolute name found
+ YACS::ENGINE::ServiceNode* n=currentProc->serviceMap[name];
+ this->_node =n->createNode(this->_name);
+ }
+ else if(currentProc->serviceMap.count(fullname) != 0)
+ {
+ //ServiceNode with relative name found
+ //TODO: must be a short name (possible only in the same context)
+ YACS::ENGINE::ServiceNode* n=currentProc->serviceMap[fullname];
+ this->_node =n->createNode(this->_name);
+ }
+ else
+ {
+ throw YACS::Exception("Unknown ServiceNode");
+ }
+ }
+
+ virtual void method (const std::string& name)
+ {
+ DEBTRACE( "service_method: " << name )
+ if(this->_node==0)
+ throw YACS::Exception("ServiceNode must be completely defined before defining its method");
+ if(name == "")
+ {
+ this->logError("a service name must be a non empty string");
+ return;
+ }
+ this->_node->setMethod(name);
+ }
+
+ virtual void load (const loadon& l)
+ {
+ DEBTRACE( "service_load: " << l._container);
+ this->_container=l._container;
+ }
+
+ virtual void instream (const myinport& p)
+ {
+ DEBTRACE( "service_instream" )
+ DEBTRACE( p._type )
+ DEBTRACE( p._name )
+ if(this->_node==0)
+ throw YACS::Exception("ServiceNode must be completely defined before defining its ports");
+
+ if(currentProc->typeMap.count(p._type)==0)
+ {
+ YACS::ENGINE::TypeCode* t=theRuntime->getTypeCode(p._type);
+ if(t==0)
+ {
+ std::string msg="Unknown InStreamPort Type: ";
+ msg=msg+p._type+" for node: "+this->_node->getName()+" port name: "+p._name;
+ throw YACS::Exception(msg);
+ }
+ else
+ {
+ currentProc->typeMap[p._type]=t;
+ t->incrRef();
+ }
+ }
+ YACS::ENGINE::InputDataStreamPort* port;
+ port=this->_node->edAddInputDataStreamPort(p._name,currentProc->typeMap[p._type]);
+ // Set all properties for this port
+ std::map<std::string, std::string>::const_iterator pt;
+ for(pt=p._props.begin();pt!=p._props.end();pt++)
+ port->setProperty((*pt).first,(*pt).second);
+ }
+ virtual void outstream (const myoutport& p)
+ {
+ DEBTRACE( "service_outstream" )
+ DEBTRACE( p._type )
+ DEBTRACE( p._name )
+ if(this->_node==0)
+ throw YACS::Exception("ServiceNode must be completely defined before defining its ports");
+
+ if(currentProc->typeMap.count(p._type)==0)
+ {
+ YACS::ENGINE::TypeCode* t=theRuntime->getTypeCode(p._type);
+ if(t==0)
+ {
+ std::string msg="Unknown OutStreamPort Type: ";
+ msg=msg+p._type+" for node: "+this->_node->getName()+" port name: "+p._name;
+ throw YACS::Exception(msg);
+ }
+ else
+ {
+ currentProc->typeMap[p._type]=t;
+ t->incrRef();
+ }
+ }
+ YACS::ENGINE::OutputDataStreamPort* port;
+ port=this->_node->edAddOutputDataStreamPort(p._name,currentProc->typeMap[p._type]);
+ // Set all properties for this port
+ std::map<std::string, std::string>::const_iterator pt;
+ for(pt=p._props.begin();pt!=p._props.end();pt++)
+ port->setProperty((*pt).first,(*pt).second);
+ }
+ virtual T post()
+ {
+ DEBTRACE( "service_post " << this->_node->getName() )
+ this->mincount("method",1);
+ if(this->_state == "disabled")this->_node->exDisabledState();
+
+ // If the service node has no component instance don't go further return the node
+ if(!this->_node->getComponent())
+ return this->_node;
+
+ // when container is not defined by <load container="xxx"/> but indirectly by <node>xxx</node>
+ // this->_container is not set, and there is no need to setContainer
+ // so stop here and return the node
+ if(this->_node->getComponent()->getContainer())
+ return this->_node;
+
+ //If the component instance is anonymous set the container
+ // with the load directive or with the DefaultContainer
+ if(this->_node->getComponent()->isAnonymous())
+ {
+ if(currentProc->containerMap.count(this->_container) != 0)
+ this->_node->getComponent()->setContainer(currentProc->containerMap[this->_container]);
+ else if(this->_container == "" && currentProc->containerMap.count("DefaultContainer") != 0)
+ {
+ //a default container is defined : use it if supported
+ try
+ {
+ currentProc->containerMap["DefaultContainer"]->checkCapabilityToDealWith(this->_node->getComponent());
+ this->_node->getComponent()->setContainer(currentProc->containerMap["DefaultContainer"]);
+ }
+ catch(YACS::Exception)
+ {}
+ }
+ else
+ std::cerr << "WARNING: Unknown container " << this->_container << " ignored" << std::endl;
+ }
+ return this->_node;
+ }
+};
+
+template <class T> servicetypeParser<T> servicetypeParser<T>::serviceParser;
+
+template <class T>
+void servicetypeParser<T>::onStart(const XML_Char* el, const XML_Char** attr)
+ {
+ DEBTRACE( "servicetypeParser::onStart: " << el )
+ std::string element(el);
+ parser* pp=&parser::main_parser;
+ this->maxcount("kind",1,element);
+ this->maxcount("ref",1,element);
+ this->maxcount("node",1,element);
+ this->maxcount("component",1,element);
+ this->maxcount("componentinstance",1,element);
+ this->maxcount("method",1,element);
+ this->maxcount("load",1,element);
+ this->maxchoice(t2,1,element);
+ if(element == "kind")pp=&stringtypeParser::stringParser;
+ else if(element == "ref")pp=&stringtypeParser::stringParser;
+ else if(element == "component")pp=&stringtypeParser::stringParser;
+ else if(element == "componentinstance")pp=&stringtypeParser::stringParser;
+ else if(element == "node")pp=&stringtypeParser::stringParser;
+ else if(element == "method")pp=&stringtypeParser::stringParser;
+ else if(element == "load")pp=&loadtypeParser::loadParser;
+ else if(element == "property")pp=&propertytypeParser::propertyParser;
+ else if(element == "inport")pp=&inporttypeParser<>::inportParser;
+ else if(element == "outport")pp=&outporttypeParser<>::outportParser;
+ else if(element == "instream")pp=&inporttypeParser<>::inportParser;
+ else if(element == "outstream")pp=&outporttypeParser<>::outportParser;
+ this->SetUserDataAndPush(pp);
+ pp->init();
+ pp->pre();
+ pp->buildAttr(attr);
+ }
+
+} // end of namespace YACS
+
+#endif
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _SINLINEPARSERS_HXX_
+#define _SINLINEPARSERS_HXX_
+
+#include "Proc.hxx"
+#include "ServiceInlineNode.hxx"
+#include "Runtime.hxx"
+
+extern YACS::ENGINE::Proc* currentProc;
+extern YACS::ENGINE::Runtime* theRuntime;
+
+namespace YACS
+{
+
+/*! \brief Class for parsing ServiceInlineNode description
+ *
+ *
+ */
+template <class T=YACS::ENGINE::ServiceInlineNode*>
+struct sinlinetypeParser:public inlinetypeParser<T>
+{
+ static sinlinetypeParser<T> sinlineParser;
+
+ virtual void onStart(const XML_Char* el, const XML_Char** attr);
+ virtual void onEnd(const char *el,parser* child)
+ {
+ DEBTRACE( "sinlinetypeParser::onEnd: " << el )
+ std::string element(el);
+ if(element == "kind")this->kind(((stringtypeParser*)child)->post());
+ else if(element == "function")this->function(((functypeParser*)child)->post());
+ else if(element == "load") load(((loadtypeParser*)child)->post());
+ else if(element == "property")this->property(((propertytypeParser*)child)->post());
+ else if(element == "inport") this->inport(((inporttypeParser<myinport>*)child)->post());
+ else if(element == "outport") this->outport(((outporttypeParser<myoutport>*)child)->post());
+ }
+ //virtual void service (const myfunc& f) {}
+ virtual void load (const loadon& l)
+ {
+ DEBTRACE( "sinline_load: " )
+ this->_container=l._container;
+ }
+ virtual T post()
+ {
+ DEBTRACE( "sinline_post " << this->_node->getName() );
+ if(this->_state == "disabled")this->_node->exDisabledState();
+
+ if(!this->_node->getComponent())
+ throw YACS::Exception("A service inline node must have a component instance");
+
+ // If the component instance has already a container don't go further
+ if(this->_node->getComponent()->getContainer())
+ return this->_node;
+
+ // Only for anonymous component instance set a container
+ if(this->_node->getComponent()->isAnonymous())
+ {
+ if(currentProc->containerMap.count(this->_container) != 0)
+ this->_node->getComponent()->setContainer(currentProc->containerMap[this->_container]);
+ else if(this->_container == "" && currentProc->containerMap.count("DefaultContainer") != 0)
+ {
+ //a default container is defined : use it if supported
+ try
+ {
+ currentProc->containerMap["DefaultContainer"]->checkCapabilityToDealWith(this->_node->getComponent());
+ this->_node->getComponent()->setContainer(currentProc->containerMap["DefaultContainer"]);
+ }
+ catch(YACS::Exception){}
+ }
+ else
+ std::cerr << "WARNING: Unknown container " << this->_container << " ignored" << std::endl;
+ }
+
+ return this->_node;
+ }
+};
+template <class T> sinlinetypeParser<T> sinlinetypeParser<T>::sinlineParser;
+
+// sinline ????
+template <>
+void inlinetypeParser<YACS::ENGINE::ServiceInlineNode*>::function (const myfunc& f)
+{
+ DEBTRACE( "sinline_function: " << f._code )
+ YACS::ENGINE::ServiceInlineNode *fnode;
+ fnode=theRuntime->createSInlineNode(_kind,_name);
+ fnode->setScript(f._code);
+ fnode->setMethod(f._name);
+ // TODO: update with currentProc->createComponentInstance() method
+ fnode->setComponent(theRuntime->createComponentInstance("PyCompo","SalomePy"));
+ _node=fnode;
+}
+
+template <class T>
+void sinlinetypeParser<T>::onStart(const XML_Char* el, const XML_Char** attr)
+ {
+ DEBTRACE( "sinlinetypeParser::onStart: " << el )
+ std::string element(el);
+ parser* pp=&parser::main_parser;
+ this->maxcount("kind",1,element);
+ this->maxcount("function",1,element);
+ this->maxcount("load",1,element);
+ if(element == "kind")pp=&stringtypeParser::stringParser;
+ else if(element == "function")pp=&functypeParser::funcParser;
+ else if(element == "load")pp=&loadtypeParser::loadParser;
+ else if(element == "property")pp=&propertytypeParser::propertyParser;
+ else if(element == "inport")pp=&inporttypeParser<>::inportParser;
+ else if(element == "outport")pp=&outporttypeParser<>::outportParser;
+ this->SetUserDataAndPush(pp);
+ pp->init();
+ pp->pre();
+ pp->buildAttr(attr);
+ }
+
+} // end of namespace YACS
+
+#endif
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _SWITCHPARSERS_HXX_
#define _SWITCHPARSERS_HXX_
virtual void inline_ (ENGINE::InlineNode* const& n);
virtual void sinline (ENGINE::ServiceInlineNode* const& n);
virtual void service (ENGINE::ServiceNode* const& n);
+ virtual void server (ENGINE::ServerNode* const& n);
+ virtual void remote (ENGINE::InlineNode* const& n);
virtual void node (ENGINE::InlineNode* const& n);
virtual void forloop (ENGINE::ForLoop* const& n);
virtual void foreach (ENGINE::ForEachLoop* const& n);
+ virtual void optimizer (ENGINE::OptimizerLoop* const& n);
virtual void while_ (ENGINE::WhileLoop* const& n);
virtual void switch_ (ENGINE::Switch* const& n);
virtual void bloc (ENGINE::Bloc* const& n);
namespace YACS
{
- static std::string switch_t3[]={"inline","sinline","service","node","forloop","foreach","while","switch","bloc",""};
+ static std::string switch_t3[]={"inline","sinline","service","server", "remote", "node","forloop","foreach","optimizer","while","switch","bloc",""};
void casetypeParser::buildAttr(const XML_Char** attr)
{
currentProc->nodeMap[fullname]=n;
currentProc->serviceMap[fullname]=n;
}
+ void casetypeParser::server (ENGINE::ServerNode* const& n)
+ {
+ _cnode=n;
+ std::string fullname=currentProc->names.back()+ n->getName();
+ currentProc->nodeMap[fullname]=n;
+ currentProc->inlineMap[fullname]=n;
+ }
+ void casetypeParser::remote (ENGINE::InlineNode* const& n)
+ {
+ _cnode=n;
+ std::string fullname=currentProc->names.back()+ n->getName();
+ currentProc->nodeMap[fullname]=n;
+ currentProc->inlineMap[fullname]=n;
+ }
void casetypeParser::node (ENGINE::InlineNode* const& n)
{
_cnode=n;
fullname += ".splitter";
currentProc->nodeMap[fullname]=n->getChildByShortName("splitter");
}
+ void casetypeParser::optimizer (ENGINE::OptimizerLoop* const& n)
+ {
+ _cnode=n;
+ std::string fullname=currentProc->names.back()+ n->getName();
+ currentProc->nodeMap[fullname]=n;
+ //fullname += ".splitter";
+ //currentProc->nodeMap[fullname]=n->getChildByShortName("splitter");
+ }
void casetypeParser::while_ (ENGINE::WhileLoop* const& n)
{
_cnode=n;
this->maxcount("inline",1,element);
this->maxcount("sinline",1,element);
this->maxcount("service",1,element);
+ this->maxcount("server",1,element);
+ this->maxcount("remote",1,element);
this->maxcount("node",1,element);
this->maxcount("forloop",1,element);
this->maxcount("foreach",1,element);
+ this->maxcount("optimizer",1,element);
this->maxcount("while",1,element);
this->maxcount("switch",1,element);
this->maxcount("bloc",1,element);
else if(element == "inline")pp=&inlinetypeParser<>::inlineParser;
else if(element == "sinline")pp=&sinlinetypeParser<>::sinlineParser;
else if(element == "service")pp=&servicetypeParser<>::serviceParser;
+ else if(element == "server")pp=&servertypeParser<>::serverParser;
+ else if(element == "remote")pp=&remotetypeParser<>::remoteParser;
else if(element == "node")pp=&nodetypeParser<>::nodeParser;
else if(element == "forloop")pp=&forlooptypeParser<>::forloopParser;
else if(element == "foreach")pp=&foreachlooptypeParser<>::foreachloopParser;
+ else if(element == "optimizer")pp=&optimizerlooptypeParser<>::optimizerloopParser;
else if(element == "while")pp=&whilelooptypeParser<>::whileloopParser;
else if(element == "switch")pp=&switchtypeParser::switchParser;
else if(element == "bloc")pp=&bloctypeParser<>::blocParser;
else if(element == "inline")inline_(((inlinetypeParser<>*)child)->post());
else if(element == "sinline")sinline(((sinlinetypeParser<>*)child)->post());
else if(element == "service")service(((servicetypeParser<>*)child)->post());
+ else if(element == "server")server(((servertypeParser<>*)child)->post());
+ else if(element == "remote")remote(((remotetypeParser<>*)child)->post());
else if(element == "node")node(((nodetypeParser<>*)child)->post());
else if(element == "forloop")forloop(((forlooptypeParser<>*)child)->post());
else if(element == "foreach")foreach(((foreachlooptypeParser<>*)child)->post());
+ else if(element == "optimizer")optimizer(((optimizerlooptypeParser<>*)child)->post());
else if(element == "while")while_(((whilelooptypeParser<>*)child)->post());
else if(element == "switch")switch_(((switchtypeParser*)child)->post());
else if(element == "bloc")bloc(((bloctypeParser<>*)child)->post());
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "typeParsers.hxx"
#include "dataParsers.hxx"
#include "Exception.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _TYPEPARSERS_HXX_
#define _TYPEPARSERS_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "xmlParserBase.hxx"
#include "Exception.hxx"
#include <stdexcept>
#include <iostream>
#include <cstdarg>
+#include <cstdio>
#include <cassert>
//#define _DEVDEBUG_
xmlParserBase *currentParser = static_cast<xmlParserBase *> (userData);
}
-/*! callback called on start of an xml element: <name>
+/*! callback called on start of an xml element: \verbatim <name> \endverbatim
*/
void XMLCALL xmlParserBase::start_element (void* userData,
}
-/*! callback called on end of an xml element: </name>
+/*! callback called on end of an xml element: \verbatim </name> \endverbatim
*/
void XMLCALL xmlParserBase::end_element (void* userData,
}
-/*! callback called for significant characters inside tags: <tag>content</tag>
+/*! callback called for significant characters inside tags: \verbatim <tag>content</tag> \endverbatim
* or outside tags, like space or new line.
- * with expat get also the CDATA tags: <tag>![CDATA[content]]></tag>
+ * with expat get also the CDATA tags: \verbatim <tag>![CDATA[content]]></tag> \endverbatim
*/
void XMLCALL xmlParserBase::characters (void* userData,
va_end(args);
}
-/*! callback called for CDATA inside tags: <tag>![CDATA[content]]></tag>
+/*! callback called for CDATA inside tags: \verbatim <tag>![CDATA[content]]></tag> \endverbatim
* used only by libxml2
*/
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __XMLPARSERBASE_HXX_
#define __XMLPARSERBASE_HXX_
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "xmlrpcParsers.hxx"
#include "dataParsers.hxx"
#include <sstream>
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef _XMLRPCPARSERS_HXX_
#define _XMLRPCPARSERS_HXX_
--- /dev/null
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+include $(top_srcdir)/adm/unix/make_begin.am
+
+if CPPUNIT_IS_OK
+SUBDIRS = Test
+endif
+
+SWIG_PYTHON_INCLUDES = -noexcept -DYACS_PTHREAD -I$(srcdir)/../bases -I$(srcdir)/../engine_swig -I$(srcdir)/../engine \
+ -I$(srcdir)/../yacsloader -I../engine_swig
+
+BUILT_SOURCES = loaderWRAP.cxx
+
+MYSWIG_FLAGS =
+
+if DOXYGEN_IS_OK
+MYSWIG_FLAGS += -DDOXYGEN_IS_OK
+endif
+
+LOADERINCLUDES=parsers.hxx LoadState.hxx xmlParserBase.hxx ProcCataLoader.hxx
+
+SWIGINCLUDES = $(LOADERINCLUDES:%=$(top_srcdir)/src/yacsloader/%)
+
+loaderWRAP.cxx loaderWRAP.h: loader.i $(SWIGINCLUDES) docyacsloader.i ../engine_swig/pilot.i ../engine_swig/engtypemaps.i
+ $(SWIG) $(SWIG_PYTHON_OPT) $(SWIG_PYTHON_INCLUDES) $(MYSWIG_FLAGS) -o loaderWRAP.cxx $(srcdir)/loader.i
+
+loader.py : loaderWRAP.cxx
+
+salomepython_PYTHON = loader.py
+salomepyexec_LTLIBRARIES = _loader.la
+
+_loader_la_SOURCES = \
+ loaderWRAP.cxx
+
+_loader_la_CXXFLAGS = \
+ $(THREAD_DEF) \
+ $(PYTHON_CPPFLAGS) \
+ $(OMNIORB_INCLUDES) \
+ $(OMNIORB_CXXFLAGS) \
+ $(EXPAT_INCLUDES) \
+ -I$(srcdir)/../bases \
+ -I$(srcdir)/../engine \
+ -I$(srcdir)/../yacsloader
+
+_loader_la_LDFLAGS = -module
+
+_loader_la_LIBADD = ../yacsloader/libYACSloader.la $(OMNIORB_LIBS) $(PYTHON_LIBS)
+
+docyacsloader.i:$(SWIGINCLUDES)
+ DOXSRCDIR=$(top_srcdir)/src/yacsloader doxygen $(top_srcdir)/Misc/Doxyfile
+ $(PYTHON) $(top_srcdir)/Misc/doxy2swig.py -n xml/index.xml docyacsloader.i
+
+EXTRA_DIST = loader.i
+
+clean-local:
+ rm -f loader.py* loaderWRAP.cxx docyacsloader.i loaderWRAP.h
+ rm -rf xml
+
+include $(top_srcdir)/adm/unix/make_end.am
--- /dev/null
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+include $(top_srcdir)/adm/unix/make_begin.am
+
+check_SCRIPTS = \
+ YacsLoaderTest.sh \
+ YacsLoaderInSessionTest.sh
+
+TESTS = YacsLoaderTest.sh
+TESTS_ENVIRONMENT=$(SHELL) -x
+
+clean-local:
+ rm -rf yacs* schema1_* schema2_* dump1_* dump2_* eo eo__POA dump*.xml CatalogResources.xml traceExec_*
+ rm -f samples toto titi log1 xmlrun.sh echo_idl.py echo.hh echoSK.cc g.data
+ if test -f "./bin/salome/appli_clean.sh"; then ./bin/salome/appli_clean.sh -f ; fi
+
+
+check-local:
+ cat /tmp/${USER}/UnitTestsResult
+
+EXTRA_DIST = testEdit.py testExec.py testLoader.py testRefcount.py testResume.py testSave.py
+
+include $(top_srcdir)/adm/unix/make_end.am
--- /dev/null
+#!/bin/bash
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+# --- script to execute in SALOME environment (use runSession)
+
+# --- launch CORBA server echoSrv for tests (reuse the yacsloader/Test one)
+
+../../yacsloader/Test/echoSrv &
+pidecho=$!
+echo $pidecho > "/tmp/YACSTEST_PidEcho"
+
+python @top_srcdir@/src/yacsloader/Test/waitContainers.py
+
+# --- launch unit tests
+
+export ROOT_SAMPLES=@ROOT_SRCDIR@/src/yacsloader/samples
+export TESTCOMPONENT_ROOT_DIR=@top_builddir@/src/runtime/Test
+
+export PYTHONPATH=..:../.libs:@top_srcdir@/src/yacsloader_swig:${PYTHONPATH}
+export PYTHONPATH=../../runtime_swig:../../runtime_swig/.libs:@top_srcdir@/src/runtime_swig:${PYTHONPATH}
+export PYTHONPATH=../../engine_swig:../../engine_swig/.libs:@top_srcdir@/src/engine_swig:${PYTHONPATH}
+export PYTHONPATH=../../yacsloader/Test:${PYTHONPATH}
+
+python @srcdir@/testExec.py
+ret0=$?
+if [ $ret0 -gt 0 ]; then
+ echo "exec status testExec : " $ret0
+ exit $ret0
+fi
+
+python @srcdir@/testResume.py
+ret1=$?
+if [ $ret1 -gt 0 ]; then
+ echo "exec status testResume : " $ret1
+ exit $ret1
+fi
+
+python @srcdir@/testLoader.py
+ret2=$?
+if [ $ret2 -gt 0 ]; then
+ echo "exec status testLoader : " $ret2
+ exit $ret2
+fi
+
+python @srcdir@/testEdit.py
+ret3=$?
+if [ $ret3 -gt 0 ]; then
+ echo "exec status testEdit : " $ret3
+ exit $ret3
+fi
+
+python @srcdir@/testSave.py
+ret4=$?
+if [ $ret4 -gt 0 ]; then
+ echo "exec status testSave : " $ret4
+ exit $ret4
+fi
+
+python @srcdir@/testRefcount.py
+ret5=$?
+if [ $ret5 -gt 0 ]; then
+ echo "exec status testRefcount : " $ret5
+ exit $ret5
+fi
+
+let ret=$ret0+$ret1+$ret2+$ret3+$ret4+$ret5
+
+# --- return unit tests status
+
+exit $ret
--- /dev/null
+#!/bin/bash
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+if test -f @KERNEL_ROOT_DIR@/bin/salome/appli_gen.py ; then
+
+ # --- create a SALOME Application environment
+
+ @KERNEL_ROOT_DIR@/bin/salome/appli_gen.py
+ sed -i s/\"yes\"/\"no\"/ SalomeApp.xml
+ sed -i s/\,study\,cppContainer\,registry\,moduleCatalog// SalomeApp.xml
+ sed -i s/pyContainer/pyContainer\,study\,cppContainer\,registry\,moduleCatalog/ SalomeApp.xml
+
+cat > CatalogResources.xml << EOF
+<!DOCTYPE ResourcesCatalog>
+<resources>
+ <machine hostname="localhost" />
+</resources>
+EOF
+
+ # ---------------------------------------------------------------------------
+ # --- first set of test in C++
+
+ # --- launch in background a SALOME session (servers)
+
+ ln -fs @top_srcdir@/src/yacsloader/samples .
+ ./runAppli > log1 2>&1
+
+ # --- wait a little to let the background process define
+ # the CORBA naming service port and host
+
+ sleep 5
+
+ # --- execute the test script in SALOME session environment
+
+ chmod +x @builddir@/YacsLoaderInSessionTest.sh
+ ./runSession @builddir@/YacsLoaderInSessionTest.sh
+ ret=$?
+
+ # ---------------------------------------------------------------------------
+
+ kill -9 `cat "/tmp/YACSTEST_PidEcho"`
+ ./runSession killSalome.py
+
+ echo "exec status YacsLoaderInSessionTest.sh " $ret
+
+ # --- delete all the SALOME Application environment
+
+ ./bin/salome/appli_clean.sh -f
+
+else
+
+ ln -fs @top_srcdir@/src/yacsloader/samples .
+ chmod +x @builddir@/YacsLoaderInSessionTest.sh
+ @builddir@/YacsLoaderInSessionTest.sh
+ ret=$?
+ echo "exec status YacsLoaderInSessionTest.sh " $ret
+
+fi
+
+if [ $ret -ne 0 ]
+then cat /tmp/${USER}/UnitTestsResult
+else echo "Results are in /tmp/${USER}/UnitTestsResult"
+fi
+
+exit $ret
--- /dev/null
+<!--
+ Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+
+ 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+-->
+<application>
+<prerequisites path="@SALOME_ROOT_DIR@/profile@SALOME_VERSION@.sh"/>
+<modules>
+ <!-- variable name <MODULE>_ROOT_DIR is built with <MODULE> == name attribute value -->
+ <!-- <MODULE>_ROOT_DIR values is set with path attribute value -->
+ <!-- attribute gui (defaults = yes) indicates if the module has a gui interface -->
+ <module name="KERNEL" gui="no" path="@SALOME_ROOT_DIR@/KERNEL@SALOME_VERSION@"/>
+ <module name="GUI" gui="no" path="@SALOME_ROOT_DIR@/GUI@SALOME_VERSION@"/>
+ <module name="GEOM" path="@SALOME_ROOT_DIR@/GEOM@SALOME_VERSION@"/>
+ <module name="MED" path="@SALOME_ROOT_DIR@/MED@SALOME_VERSION@"/>
+ <module name="SMESH" path="@SALOME_ROOT_DIR@/SMESH@SALOME_VERSION@"/>
+ <module name="VISU" path="@SALOME_ROOT_DIR@/VISU@SALOME_VERSION@"/>
+ <module name="HELLO" path="@SALOME_ROOT_DIR@/HELLO1@SALOME_VERSION@"/>
+ <module name="PYHELLO" path="@SALOME_ROOT_DIR@/PYHELLO1@SALOME_VERSION@"/>
+</modules>
+<samples path="@SALOME_ROOT_DIR@/SAMPLES@SALOME_VERSION@"/>
+</application>
+
--- /dev/null
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import sys
+import pilot
+import SALOMERuntime
+import loader
+import unittest
+
+class TestEdit(unittest.TestCase):
+
+ def setUp(self):
+ SALOMERuntime.RuntimeSALOME_setRuntime()
+ self.r = pilot.getRuntime()
+ self.l = loader.YACSLoader()
+ self.e = pilot.ExecutorSwig()
+ pass
+
+ def test1_edit(self):
+ p = self.r.createProc("pr")
+ print p.typeMap
+ t=p.getTypeCode("double")
+ print t.kind()
+ t=p.typeMap["double"]
+
+ td=p.createType("double","double")
+ ti=p.createType("int","int")
+ tc1=p.createInterfaceTc("","Obj",[])
+ print tc1.name(),tc1.id()
+ tc2=p.createInterfaceTc("","Obj2",[tc1])
+ print tc2.name(),tc2.id()
+ tc3=p.createSequenceTc("","seqdbl",td)
+ print tc3.name(),tc3.id(),tc3.contentType()
+ tc4=p.createSequenceTc("","seqObj2",tc2)
+ tc5=p.createSequenceTc("","seqint",ti)
+ print tc4.name(),tc4.id()
+ print tc4.isA(tc1),0
+ print tc2.isA(tc1),1
+ print tc1.isA(tc2),0
+ print td.isA(ti),0
+ print td.isAdaptable(ti),1
+ print ti.isAdaptable(td),0
+ print tc5.isAdaptable(tc3),0
+ print tc3.isAdaptable(tc5),1
+
+ n=self.r.createScriptNode("","node1")
+ n.setScript("print 'coucou1'")
+ n.edAddInputPort("p1",ti)
+ n.edAddOutputPort("p1",ti)
+ p.edAddChild(n)
+ inport=n.getInputPort("p1");
+ retex=None
+ try:
+ inport.edInitXML("<value><intt>5</int></value>")
+ except ValueError, ex:
+ print "Value Error: ", ex
+ retex=ex
+ except pilot.Exception,ex:
+ print "YACS exception:",ex.what()
+ retex=ex.what()
+ self.assert_(retex is not None, "exception not raised, or wrong type")
+ inport.edInitXML("<value><int>5</int></value>")
+
+ # --- create script node node2
+ n2=self.r.createScriptNode("","node2")
+ n2.setScript("print 'coucou2'")
+ n2.edAddInputPort("p1",ti)
+ p.edAddChild(n2)
+ # --- end of node
+
+ # --- control link between nodes n and n2
+ p.edAddCFLink(n,n2)
+ # --- end control link
+
+ # --- datalink between ports p1 of nodes n1 and n2
+ p.edAddLink(n.getOutputPort("p1"),n2.getInputPort("p1"))
+ # --- end datalink
+
+ n=self.r.createFuncNode("","node3")
+ n.setScript("""
+ def f():
+ print 'coucou3'
+ """)
+ n.setFname("f")
+ p.edAddChild(n)
+
+ n4=self.r.createRefNode("","node4")
+ n4.setRef("corbaname:rir:#test.my_context/Echo.Object")
+ n4.setMethod("echoDouble")
+ n4.edAddInputDataStreamPort("pin",ti)
+ n4.edAddOutputDataStreamPort("pout",ti)
+ p.edAddChild(n4)
+
+ n5=self.r.createRefNode("","node5")
+ n5.setRef("corbaname:rir:#test.my_context/Echo.Object")
+ n5.setMethod("echoDouble")
+ n5.edAddInputDataStreamPort("pin",ti)
+ n5.edAddOutputDataStreamPort("pout",ti)
+ p.edAddChild(n5)
+
+ p.edAddLink(n4.getOutputDataStreamPort("pout"),n5.getInputDataStreamPort("pin"))
+
+ #n=self.r.createCompoNode("","node5")
+ #n.setRef("PYHELLO")
+ #n.setMethod("makeBanner")
+ #p.edAddChild(n)
+
+ # --- create a bloc with one node
+ b=self.r.createBloc("b1")
+ p.edAddChild(b)
+
+ n=self.r.createScriptNode("","b1.node2")
+ n.setScript("print 'coucou2'")
+ b.edAddChild(n)
+ # --- end bloc
+
+ # --- create a for loop with one node
+ lo=self.r.createForLoop("l1")
+ p.edAddChild(lo)
+ ip=lo.edGetNbOfTimesInputPort()
+ ip.edInitInt(3)
+
+ n=self.r.createScriptNode("","l1.node2")
+ n.setScript("print 'coucou2'")
+ lo.edSetNode(n)
+ # --- end loop
+
+ # --- control link between bloc b1 and loop l1
+ p.edAddCFLink(b,lo)
+ # --- end control link
+
+ # --- create a while loop with one node
+ wh=self.r.createWhileLoop("w1")
+ p.edAddChild(wh)
+ n=self.r.createFuncNode("","w1.node3")
+ n.setScript("""
+def f():
+ print 'coucou3'
+ return 0
+""")
+ n.setFname("f")
+ n.edAddOutputPort("p1",ti)
+ wh.edSetNode(n)
+ cport=wh.edGetConditionPort()
+ cport.edInitBool(True)
+ # --- end loop
+ p.edAddLink(n.getOutputPort("p1"),wh.getInputPort("condition")) #or cport
+
+ # --- create a switch
+ sw=self.r.createSwitch("sw1")
+ p.edAddChild(sw)
+ n=self.r.createFuncNode("","sw1.node3")
+ n.setScript("""
+def f():
+ print 'case1'
+ return 0
+""")
+ n.setFname("f")
+ n.edAddOutputPort("p1",ti)
+ sw.edSetNode(1,n)
+ n=self.r.createFuncNode("","sw1.node4")
+ n.setScript("""
+def f():
+ print 'default'
+ return 0
+""")
+ n.setFname("f")
+ n.edAddOutputPort("p1",ti)
+ sw.edSetDefaultNode(n)
+ sw.edGetConditionPort().edInitInt(1)
+ # --- end switch
+
+ try:
+ self.e.RunW(p,0)
+ except pilot.Exception,ex:
+ print ex.what()
+ self.fail(ex)
+
+ #self.e.displayDot(p)
+
+
+import os
+U = os.getenv('USER')
+f=open("/tmp/" + U + "/UnitTestsResult", 'a')
+f.write(" --- TEST src/yacsloader: testEdit.py\n")
+suite = unittest.makeSuite(TestEdit)
+result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
+f.close()
+sys.exit(not result.wasSuccessful())
--- /dev/null
+#!/usr/bin/env python
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import time
+import unittest
+import threading
+
+import SALOMERuntime
+import loader
+import pilot
+
+class TestExec(unittest.TestCase):
+
+ def setUp(self):
+ SALOMERuntime.RuntimeSALOME_setRuntime(1)
+ self.l = loader.YACSLoader()
+ self.e = pilot.ExecutorSwig()
+ self.p = self.l.load("samples/aschema.xml")
+ pass
+
+ def test1_StepByStep(self):
+ # --- execution step by step
+
+ print "================= Start of STEPBYSTEP ==================="
+ self.e.setExecMode(1) # YACS::STEPBYSTEP
+
+ run1 = threading.Thread(None, self.e.RunPy, "stepbystep", (self.p,0))
+ run1.start()
+ time.sleep(0.1) # let the thread be initialised
+ #e.displayDot(self.p)
+
+ tocont = True
+ while tocont:
+ self.e.waitPause()
+ #e.displayDot(p)
+ bp = self.e.getTasksToLoad()
+ print "nexts possible steps = ", bp
+ if len(bp) > 0:
+ tte= bp[-1:] # only one node at each step, the last one in the list
+ r = self.e.setStepsToExecute(tte)
+ self.e.resumeCurrentBreakPoint()
+ tocont = self.e.isNotFinished()
+ else:
+ tocont = False
+ pass
+ print "toContinue = ", tocont
+ pass
+
+ self.e.resumeCurrentBreakPoint()
+ run1.join()
+ self.assertEqual(106, self.p.getChildByName('node48').getEffectiveState())
+ self.assertEqual(999, self.p.getChildByName('node13').getEffectiveState())
+ self.assertEqual(888, self.p.getChildByName('node14').getEffectiveState())
+ self.assertEqual(777, self.p.getChildByName('c1').getEffectiveState())
+ self.assertEqual(777, self.p.getChildByName('c1.c1.n2').getEffectiveState())
+ self.assertEqual(106, self.p.getChildByName('c0.c1.n1').getEffectiveState())
+ self.assertEqual(999, self.p.getChildByName('c0.n2').getEffectiveState())
+ self.assertEqual(888, self.p.getChildByName('node62').getEffectiveState())
+ print "================= End of STEPBYSTEP ====================="
+ pass
+
+ def test2_StopToBreakpoint(self):
+ # --- start execution, set a breakpoint before node48, then continue
+ time.sleep(1)
+ print "================= Start of BREAKPOINT ==================="
+ brp=['node48']
+ self.e.setListOfBreakPoints(brp)
+ self.e.setExecMode(2) # YACS::STOPBEFORENODES
+ self.run2 = threading.Thread(None, self.e.RunPy, "breakpoint", (self.p,0))
+ self.run2.start()
+ time.sleep(0.1)
+ self.e.waitPause()
+ #self.e.displayDot(p)
+ print "================= reach BREAKPOINT ======================"
+ # --- resume from breakpoint
+ print "=========== BREAKPOINT, start RESUME ===================="
+ time.sleep(1)
+ self.e.setExecMode(0) # YACS::CONTINUE
+ self.e.resumeCurrentBreakPoint()
+ time.sleep(0.1)
+ self.e.waitPause()
+ #self.e.displayDot(p)
+ self.run2.join()
+ self.assertEqual(106, self.p.getChildByName('node48').getEffectiveState())
+ self.assertEqual(999, self.p.getChildByName('node13').getEffectiveState())
+ self.assertEqual(888, self.p.getChildByName('node14').getEffectiveState())
+ self.assertEqual(777, self.p.getChildByName('c1').getEffectiveState())
+ self.assertEqual(777, self.p.getChildByName('c1.c1.n2').getEffectiveState())
+ self.assertEqual(106, self.p.getChildByName('c0.c1.n1').getEffectiveState())
+ self.assertEqual(999, self.p.getChildByName('c0.n2').getEffectiveState())
+ self.assertEqual(888, self.p.getChildByName('node62').getEffectiveState())
+ print "================= End of RESUME ========================="
+ pass
+
+ def test3_RunWithoutBreakpoints(self):
+ # --- start execution, run without breakpoints
+ time.sleep(1)
+
+ print "================= Start of CONTINUE ====================="
+ self.e.setExecMode(0) # YACS::CONTINUE
+ run3 = threading.Thread(None, self.e.RunPy, "continue", (self.p,0))
+ run3.start()
+ time.sleep(0.1)
+ self.e.waitPause()
+ #self.e.displayDot(p)
+ run3.join()
+ self.assertEqual(106, self.p.getChildByName('node48').getEffectiveState())
+ self.assertEqual(999, self.p.getChildByName('node13').getEffectiveState())
+ self.assertEqual(888, self.p.getChildByName('node14').getEffectiveState())
+ self.assertEqual(777, self.p.getChildByName('c1').getEffectiveState())
+ self.assertEqual(777, self.p.getChildByName('c1.c1.n2').getEffectiveState())
+ self.assertEqual(106, self.p.getChildByName('c0.c1.n1').getEffectiveState())
+ self.assertEqual(999, self.p.getChildByName('c0.n2').getEffectiveState())
+ self.assertEqual(888, self.p.getChildByName('node62').getEffectiveState())
+ print "================= End of CONTINUE ======================="
+ pass
+
+ def test4_StopOnError(self):
+ # --- stop execution on first error and save state
+ time.sleep(1)
+
+ print "================= Start of STOPONERROR =================="
+ self.e.setStopOnError()
+ run4 = threading.Thread(None, self.e.RunPy, "continue", (self.p,0))
+ run4.start()
+ time.sleep(0.1)
+ self.e.waitPause()
+ self.e.saveState("dumpErrorASchema.xml")
+ self.e.stopExecution()
+ run4.join()
+ #self.e.displayDot(self.p)
+ s13 = self.p.getChildByName('node13').getEffectiveState()
+ s43 = self.p.getChildByName('node43').getEffectiveState()
+ self.assert_((s13==999) or (s43==999))
+ print "================= End of STOPONERROR ====================="
+ pass
+
+ def test5_PartialExec(self):
+ # --- stop execution after breakpoint
+ time.sleep(1)
+
+ print "================= Start of PARTIALEXEC ==================="
+ brp=['node35']
+ self.e.setListOfBreakPoints(brp)
+ self.e.setExecMode(2) # YACS::STOPBEFORENODES
+ #self.e.displayDot(self.p)
+ run5 = threading.Thread(None, self.e.RunPy, "breakpoint", (self.p,0))
+ run5.start()
+ time.sleep(0.1)
+ self.e.waitPause()
+ #self.e.displayDot(self.p)
+ self.e.saveState('dumpPartialASchema.xml')
+ #self.e.displayDot(self.p)
+ self.e.stopExecution()
+ run5.join()
+ #self.e.displayDot(self.p)
+ self.assertEqual(106, self.p.getChildByName('node34').getEffectiveState())
+ self.assertEqual(101, self.p.getChildByName('node35').getEffectiveState())
+ print "================= reach BREAKPOINT PARTIAL EXEC =========="
+ pass
+
+ pass
+
+import os
+U = os.getenv('USER')
+f=open("/tmp/" + U + "/UnitTestsResult", 'a')
+f.write(" --- TEST src/yacsloader: testExec.py\n")
+suite = unittest.makeSuite(TestExec)
+result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
+f.close()
+sys.exit(not result.wasSuccessful())
--- /dev/null
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import pilot
+import SALOMERuntime
+import loader
+import unittest
+
+class TestLoader(unittest.TestCase):
+
+ def setUp(self):
+ SALOMERuntime.RuntimeSALOME_setRuntime()
+ self.r = pilot.getRuntime()
+ self.l = loader.YACSLoader()
+ self.e = pilot.ExecutorSwig()
+ pass
+
+ def tearDown(self):
+ del self.r
+ del self.l
+ del self.e
+
+ def test1_FileNotExist(self):
+ # --- File does not exist
+ retex=None
+ try:
+ p = self.l.load("nonexisting")
+ except IOError, ex:
+ print "IO Error: ", ex
+ retex=ex
+ #except pilot.invalid_argument,ex:
+ # print "invalid_argument:",ex.what()
+ # retex=ex.what()
+ self.assert_(retex is not None, "exception not raised, or wrong type")
+ pass
+
+ def test2_parseError(self):
+ # --- File exists but parse error
+ retex=None
+ try:
+ p = self.l.load("samples/bid.xml")
+ except ValueError,ex:
+ print "Caught ValueError Exception:",ex
+ retex = ex
+ expected="LogRecord: parser:ERROR:from node node5 does not exist in control link: node5->b2 context: b1. (samples/bid.xml:53)\n"
+ self.assert_(p.getLogger("parser").getStr() == expected, "error not found: "+p.getLogger("parser").getStr())
+ pass
+
+ def test3_normal(self):
+ # --- File exists and no parsing problem
+ try:
+ p = self.l.load("samples/aschema.xml")
+ print p.getLogger("parser").getStr()
+ print p
+ print p.getName()
+ for k in p.typeMap: print k
+ for k in p.nodeMap: print k
+ for k in p.inlineMap: print k
+ for k in p.serviceMap: print k
+ print self.e.getTasksToLoad()
+ self.e.RunW(p,0)
+ self.assertEqual(106, p.getChildByName('node48').getEffectiveState())
+ except pilot.Exception,ex:
+ print "YACS exception:",ex
+ self.fail(ex)
+ pass
+ pass
+
+import os
+U = os.getenv('USER')
+f=open("/tmp/" + U + "/UnitTestsResult", 'a')
+f.write(" --- TEST src/yacsloader: testLoader.py\n")
+suite = unittest.makeSuite(TestLoader)
+result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
+f.close()
+sys.exit(not result.wasSuccessful())
--- /dev/null
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import unittest
+import pilot
+import SALOMERuntime
+
+class TestContainerRef(unittest.TestCase):
+ def setUp(self):
+ SALOMERuntime.RuntimeSALOME_setRuntime()
+ self.r=SALOMERuntime.getSALOMERuntime()
+ self.p=self.r.createProc("pr")
+
+ def test0(self):
+ """test delete following creation from class"""
+ co=self.r.createContainer()
+ self.assertEqual(co.getRefCnt(), 1)
+ self.assert_(co.thisown)
+ del co
+
+ def test1(self):
+ """test delete following creation from createContainer and delitem from containerMap"""
+ co=self.p.createContainer("c2")
+ del self.p.containerMap["c2"]
+ self.assert_(co.thisown)
+ self.assertEqual(co.getRefCnt(), 1)
+ del co
+
+ def test2(self):
+ """test delete following creation from createContainer and
+ manipulations on containerMap
+ """
+ co=self.p.createContainer("c2")
+ self.p.containerMap["c2"]=co
+ del self.p.containerMap["c2"]
+ self.assert_(co.thisown)
+ self.assertEqual(co.getRefCnt(), 1)
+ del co
+
+ def test3(self):
+ """test existence on getitem followed by delitem"""
+ self.p.createContainer("c9")
+ co=self.p.containerMap["c9"]
+ self.assertEqual(co.getRefCnt(), 2)
+ del self.p.containerMap["c9"]
+ self.assertEqual(co.getName(), "c9")
+ self.assertEqual(co.getRefCnt(), 1)
+ self.assert_(co.thisown)
+ del co
+
+ def test4(self):
+ """test delete from containerMap following creation from createContainer"""
+ co=self.p.createContainer("c10")
+ del self.p.containerMap["c10"]
+ self.assertEqual(co.getName(), "c10")
+ self.assertEqual(co.getRefCnt(), 1)
+ self.assert_(co.thisown)
+ del co
+
+ def test5(self):
+ """test existence container following delete proc"""
+ co=self.p.createContainer("c10")
+ del self.p
+ self.assertEqual(co.getName(), "c10")
+ self.assertEqual(co.getRefCnt(), 1)
+ self.assert_(co.thisown)
+ del co
+
+ def test6(self):
+ """test ownership of container on getitem from containerMap"""
+ co=self.p.createContainer("c8")
+ self.assertEqual(co.getRefCnt(), 2)
+ self.assert_(co.thisown)
+ del co
+ self.assertEqual(self.p.containerMap["c8"].getRefCnt(), 2) # +1 for getitem
+ co=self.p.containerMap["c8"]
+ self.assertEqual(co.getRefCnt(), 2)
+ self.assert_(co.thisown)
+ del co
+ self.assertEqual(self.p.containerMap["c8"].getRefCnt(), 2) # +1 for getitem
+ del self.p.containerMap["c8"]
+
+ def test7(self):
+ """test getitem following creation from class"""
+ co=self.r.createContainer()
+ self.assertEqual(co.getRefCnt(), 1)
+ self.p.containerMap["c8"]=co
+ self.assertEqual(co.getRefCnt(), 2)
+ d=self.p.containerMap["c8"]
+ self.assertEqual(d.getRefCnt(), 3)
+ del self.p.containerMap["c8"]
+ self.assertEqual(d.getRefCnt(), 2)
+ self.assertEqual(co.getRefCnt(), 2)
+ del co
+ self.assertEqual(d.getRefCnt(), 1)
+
+ def test8(self):
+ """test setitem following creation from class"""
+ co=self.r.createContainer()
+ self.p.containerMap["c8"]=co
+ d=self.p.containerMap["c8"]
+ self.p.containerMap["c9"]=d
+ self.assertEqual(d.getRefCnt(), 4)
+
+ def test9(self):
+ """test method values"""
+ self.p.createContainer("c8")
+ for co in self.p.containerMap.values():
+ self.assert_(co.thisown)
+ self.assertEqual(co.getRefCnt(), 2)
+
+ def test10(self):
+ """test method items"""
+ self.p.createContainer("c8")
+ for k,co in self.p.containerMap.items():
+ self.assert_(co.thisown)
+ self.assertEqual(co.getRefCnt(), 2)
+
+ def test11(self):
+ """test method clear"""
+ co=self.p.createContainer("c8")
+ self.p.containerMap.clear()
+ self.assert_(co.thisown)
+ self.assertEqual(co.getRefCnt(), 1)
+
+ def test12(self):
+ """test method update"""
+ co=self.p.createContainer("c8")
+ d={"c1":co}
+ self.p.containerMap.update(d)
+ self.assert_(co.thisown)
+ self.assertEqual(co.getRefCnt(), 3)
+
+class TestTypeCodeRef(unittest.TestCase):
+ def setUp(self):
+ self.r=SALOMERuntime.getSALOMERuntime()
+ self.p=self.r.createProc("pr")
+
+ def test0(self):
+ """test delete following creation from createSequenceTc"""
+ tc=pilot.TypeCode(pilot.Double)
+ self.assertEqual(tc.getRefCnt(), 1)
+ self.assert_(tc.thisown)
+
+ def test1(self):
+ """test delete following creation from createInterfaceTc and delitem from typeMap"""
+ tc=self.p.createInterfaceTc("","obj",[])
+ del self.p.typeMap["obj"]
+ self.assert_(tc.thisown)
+ self.assertEqual(tc.getRefCnt(), 1)
+
+ def test2(self):
+ """test delete following creation from createInterfaceTc and
+ manipulations on typeMap
+ """
+ tc=self.p.createInterfaceTc("","obj",[])
+ self.p.typeMap["obj"]=tc
+ del self.p.typeMap["obj"]
+ self.assert_(tc.thisown)
+ self.assertEqual(tc.getRefCnt(), 1)
+
+ def test3(self):
+ """test existence on getitem followed by delitem"""
+ self.p.createInterfaceTc("","obj",[])
+ tc=self.p.typeMap["obj"]
+ self.assertEqual(tc.getRefCnt(), 2)
+ del self.p.typeMap["obj"]
+ self.assertEqual(tc.getRefCnt(), 1)
+ self.assert_(tc.thisown)
+
+ def test4(self):
+ """test delete from typeMap following creation from createInterfaceTc"""
+ tc=self.p.createInterfaceTc("","obj",[])
+ del self.p.typeMap["obj"]
+ self.assertEqual(tc.getRefCnt(), 1)
+ self.assert_(tc.thisown)
+
+ def test5(self):
+ """test existence TypeCode following delete proc"""
+ tc=self.p.createInterfaceTc("","obj",[])
+ del self.p
+ self.assertEqual(tc.getRefCnt(), 1)
+ self.assert_(tc.thisown)
+
+ def test6(self):
+ """test ownership of TypeCode on getitem from typeMap"""
+ tc=self.p.createInterfaceTc("","obj",[])
+ self.assertEqual(tc.getRefCnt(), 2)
+ self.assert_(tc.thisown)
+ del tc
+ self.assertEqual(self.p.typeMap["obj"].getRefCnt(), 2) # +1 for getitem
+ tc=self.p.typeMap["obj"]
+ self.assertEqual(tc.getRefCnt(), 2)
+ self.assert_(tc.thisown)
+ del tc
+ self.assertEqual(self.p.typeMap["obj"].getRefCnt(), 2) # +1 for getitem
+ del self.p.typeMap["obj"]
+
+ def test7(self):
+ """test getitem following creation from class"""
+ tc=pilot.TypeCode.interfaceTc("obj","obj")
+ self.assertEqual(tc.getRefCnt(), 1)
+ self.p.typeMap["obj"]=tc
+ self.assertEqual(tc.getRefCnt(), 2)
+ d=self.p.typeMap["obj"]
+ self.assertEqual(d.getRefCnt(), 3)
+ del self.p.typeMap["obj"]
+ self.assertEqual(d.getRefCnt(), 2)
+ self.assertEqual(tc.getRefCnt(), 2)
+ del tc
+ self.assertEqual(d.getRefCnt(), 1)
+
+ def test8(self):
+ """test setitem following creation from class"""
+ tc=pilot.TypeCodeObjref("obj","obj")
+ self.p.typeMap["obj"]=tc
+ d=self.p.typeMap["obj"]
+ self.p.typeMap["t9"]=d
+ self.assertEqual(d.getRefCnt(), 4)
+
+ def test9(self):
+ """test method values"""
+ self.p.createInterfaceTc("","obj",[])
+ for tc in self.p.typeMap.values():
+ if tc.name()!="obj":continue
+ self.assert_(tc.thisown)
+ self.assertEqual(tc.getRefCnt(), 2)
+
+ def test10(self):
+ """test method items"""
+ self.p.createInterfaceTc("","obj",[])
+ for k,tc in self.p.typeMap.items():
+ if tc.name()!="obj":continue
+ self.assert_(tc.thisown)
+ self.assertEqual(tc.getRefCnt(), 2)
+
+ def test11(self):
+ """test method clear"""
+ tc=self.p.createInterfaceTc("","obj",[])
+ self.p.typeMap.clear()
+ self.assert_(tc.thisown)
+ self.assertEqual(tc.getRefCnt(), 1)
+
+ def test12(self):
+ """test method update"""
+ tc=self.p.createInterfaceTc("","obj",[])
+ d={"c1":tc}
+ self.p.typeMap.update(d)
+ self.assert_(tc.thisown)
+ self.assertEqual(tc.getRefCnt(), 3)
+
+import os
+U = os.getenv('USER')
+f=open("/tmp/" + U + "/UnitTestsResult", 'a')
+f.write(" --- TEST src/yacsloader: testRefcount.py\n")
+suite1 = unittest.makeSuite(TestContainerRef)
+suite2 = unittest.makeSuite(TestTypeCodeRef)
+suite = unittest.TestSuite((suite1, suite2))
+result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
+f.close()
+sys.exit(not result.wasSuccessful())
--- /dev/null
+#!/usr/bin/env python
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import time
+import unittest
+import threading
+
+import SALOMERuntime
+import loader
+import pilot
+
+class TestResume(unittest.TestCase):
+
+ def setUp(self):
+ SALOMERuntime.RuntimeSALOME_setRuntime(1)
+ self.l = loader.YACSLoader()
+ self.e = pilot.ExecutorSwig()
+ self.p = self.l.load("samples/bloc2.xml")
+ pass
+
+ def test1_PartialExec(self):
+ # --- stop execution after breakpoint
+ time.sleep(1)
+
+ print "================= Start of PARTIALEXEC ==================="
+ brp=['b1.b2.node1']
+ self.e.setListOfBreakPoints(brp)
+ self.e.setExecMode(2) # YACS::STOPBEFORENODES
+ #self.e.displayDot(self.p)
+ run1 = threading.Thread(None, self.e.RunPy, "breakpoint", (self.p,0))
+ run1.start()
+ time.sleep(0.1)
+ self.e.waitPause()
+ #self.e.displayDot(self.p)
+ self.e.saveState('dumpPartialBloc2.xml')
+ #self.e.displayDot(self.p)
+ self.e.stopExecution()
+ #self.e.displayDot(self.p)
+ self.assertEqual(101, self.p.getChildByName('b1.b2.node1').getEffectiveState())
+ self.assertEqual(106, self.p.getChildByName('b1.node1').getEffectiveState())
+ print "================= reach BREAKPOINT PARTIAL EXEC =========="
+ pass
+
+ def test2_ExecFromLoadState(self):
+ # --- reload state from previous partial execution then exec
+ time.sleep(1)
+
+ print "================= Start of EXECLOADEDSTATE ==============="
+ sp = loader.stateParser()
+ sl = loader.stateLoader(sp,self.p)
+ sl.parse('dumpPartialBloc2.xml')
+ #self.e.displayDot(self.p)
+ self.e.setExecMode(0) # YACS::CONTINUE
+ run2 = threading.Thread(None, self.e.RunPy, "loadState", (self.p,0,1,1))
+ run2.start()
+ time.sleep(0.1)
+ self.e.waitPause()
+ #self.e.displayDot(self.p)
+ run2.join()
+ self.assertEqual(106, self.p.getChildByName('node1').getEffectiveState())
+ self.assertEqual(106, self.p.getChildByName('node2').getEffectiveState())
+ self.assertEqual(106, self.p.getChildByName('b1.node1').getEffectiveState())
+ self.assertEqual(106, self.p.getChildByName('b1.node2').getEffectiveState())
+ self.assertEqual(106, self.p.getChildByName('b1.b2.node1').getEffectiveState())
+ self.assertEqual(106, self.p.getChildByName('b1.b2.node2').getEffectiveState())
+ self.assertEqual(106, self.p.getChildByName('b1.b2.loop1.node1').getEffectiveState())
+ print "================= End of EXECLOADEDSTATE ================="
+
+ pass
+
+import os
+U = os.getenv('USER')
+f=open("/tmp/" + U + "/UnitTestsResult", 'a')
+f.write(" --- TEST src/yacsloader: testResume.py\n")
+suite = unittest.makeSuite(TestResume)
+result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
+f.close()
+sys.exit(not result.wasSuccessful())
--- /dev/null
+#!/usr/bin/env python
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import time
+import unittest
+import threading
+
+import SALOMERuntime
+import loader
+import pilot
+
+class TestSave(unittest.TestCase):
+
+ def setUp(self):
+ SALOMERuntime.RuntimeSALOME_setRuntime(1)
+ pass
+
+ def test0_saveAndExec(self):
+ """Execute twice the scheme. Each time the final state is dumped
+ and the scheme is written. The second exeuction is done with the
+ saved scheme file. Final state dumps and scheme files produced must
+ be identical for the 2 executions. Nodes are not always written in
+ the same order, so the comparison is done after sort of lines...
+ """
+ schemaList = []
+ schemaList += ["aschema","bschema","cschema","dschema","eschema","fschema"]
+ schemaList += ["bloc1","bloc2","bloc3","bloc4"]
+ schemaList += ["foreach1","foreach2","foreach4","foreach5"]
+ schemaList += ["foreach_LongCorba","foreach_LongPython"]
+ schemaList += ["forloop1","forloop2","forloop3","forloop4","forloop5","forloop6","forloop7"]
+ schemaList += ["forwhile1"]
+ schemaList += ["legendre7"]
+ schemaList += ["switch1","switch2","switch3","switch4","switch5","switch6","switch7","switch8","switch9"]
+ schemaList += ["while1","while2","while3"]
+ r = pilot.getRuntime()
+ l = loader.YACSLoader()
+ e = pilot.ExecutorSwig()
+ for schema in schemaList:
+ fileOrig = "samples/" + schema + ".xml"
+ saveSchema1 = "schema1_" + schema
+ dumpSchema1 = "dump1_" + schema
+ saveSchema2 = "schema2_" + schema
+ dumpSchema2 = "dump2_" + schema
+ try:
+ p = l.load(fileOrig)
+ s = pilot.SchemaSave(p)
+ s.save(saveSchema1)
+ e.RunW(p,0)
+ e.saveState(dumpSchema1)
+ p = l.load(saveSchema1)
+ s = pilot.SchemaSave(p)
+ s.save(saveSchema2)
+ e.RunW(p,0)
+ e.saveState(dumpSchema2)
+ except ValueError, ex:
+ print "Value Error: ", ex
+ pb = "problem on " + fileOrig + " : ValueError"
+ self.fail(pb)
+ except pilot.Exception,ex:
+ print ex.what()
+ pb = "problem on " + fileOrig + " : " + ex.what()
+ self.fail(pb)
+ except:
+ pb = "unknown problem on " + fileOrig
+ self.fail(pb)
+ s1=open(saveSchema1,'r')
+ s2=open(saveSchema2,'r')
+ d1=open(dumpSchema1,'r')
+ d2=open(dumpSchema2,'r')
+ ls1 = s1.readlines().sort()
+ ls2 = s2.readlines().sort()
+ ld1 = d1.readlines().sort()
+ ld2 = d2.readlines().sort()
+ pb1 = "file schemes produced by successive executions are not identical: " + fileOrig
+ pb2 = "final dump states produced by successive executions are not identical: " + fileOrig
+ self.assertEqual(ls1,ls2,pb1)
+ self.assertEqual(ld1,ld2,pb2)
+ pass
+
+
+import os
+U = os.getenv('USER')
+f=open("/tmp/" + U + "/UnitTestsResult", 'a')
+f.write(" --- TEST src/yacsloader: testSave.py\n")
+suite = unittest.makeSuite(TestSave)
+result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
+f.close()
+sys.exit(not result.wasSuccessful())
--- /dev/null
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// ----------------------------------------------------------------------------
+//
+%define LOADERDOCSTRING
+"Module to load an calculation schema from a XML file."
+%enddef
+
+%module(docstring=LOADERDOCSTRING) loader
+
+//work around SWIG bug #1863647
+#if SWIG_VERSION >= 0x010336
+#define SwigPyIterator loader_PySwigIterator
+#else
+#define PySwigIterator loader_PySwigIterator
+#endif
+
+%feature("autodoc", "1");
+
+#ifdef DOXYGEN_IS_OK
+%include docyacsloader.i
+#endif
+
+%include "engtypemaps.i"
+
+// ----------------------------------------------------------------------------
+
+%{
+#include "parsers.hxx"
+#include "LoadState.hxx"
+#include "TypeCode.hxx"
+%}
+
+%types(YACS::ENGINE::Node *);
+%types(YACS::ENGINE::InputPort *,YACS::ENGINE::OutputPort *,YACS::ENGINE::InputDataStreamPort *,YACS::ENGINE::OutputDataStreamPort *);
+%types(YACS::ENGINE::InGate *,YACS::ENGINE::OutGate *,YACS::ENGINE::InPort *,YACS::ENGINE::OutPort *,YACS::ENGINE::Port *);
+
+%import "pilot.i"
+
+/*
+ * Ownership section
+ */
+//Take ownership : it is not the default (constructor) as it is a factory
+%newobject YACS::YACSLoader::load;
+/*
+ * End of Ownership section
+ */
+
+%include "YACSloaderExport.hxx"
+%include "parsers.hxx"
+%import "xmlParserBase.hxx"
+%include "LoadState.hxx"
+
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
import time
import salome
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
include $(top_srcdir)/adm/unix/make_begin.am
-# Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+# Copyright (C) 2006-2012 CEA/DEN, EDF R&D
#
-# 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 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.
+# 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
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
import sys
import YACS_ORB__POA
import YACS_ORB
import threading
import tempfile
+import os
import SALOMERuntime
import loader
self.e.setExecMode(1) # YACS::STEPBYSTEP
self.run1 = None
self.p = self.l.load(xmlFile)
+ self.xmlFile=xmlFile
pass
def getNodeState(self,numid):
return self.p.getXMLState(numid)
def getInPortValue(self, nodeNumid, portName):
+ try:
return self.p.getInPortValue(nodeNumid, portName)
+ except:
+ traceback.print_exc()
+ return ""
+
+ def setInPortValue(self, nodeName, portName, value):
+ try:
+ return self.p.setInPortValue(nodeName, portName, value)
+ except:
+ traceback.print_exc()
+ return ""
def getOutPortValue(self, nodeNumid, portName):
+ try:
return self.p.getOutPortValue(nodeNumid, portName)
+ except:
+ traceback.print_exc()
+ return ""
def getErrorDetails(self, nodeNumid):
return self.p.getNodeErrorDetails(nodeNumid)
def getContainerLog(self, nodeNumid):
return self.p.getNodeContainerLog(nodeNumid)
+ def shutdownProc(self, level):
+ return self.p.shutdown(level)
+
def getExecutorState(self):
return self.e.getExecutorState()
def getNames(self):
return self.p.getIds()
+ def runProc(self,debug, isPyThread, fromscratch):
+ print "**************************Begin schema execution %s**************************" % self.xmlFile
+ self.e.RunPy(self.p,debug, isPyThread, fromscratch)
+ print "**************************End schema execution %s****************************" % self.xmlFile
+
def Run(self):
- execState = self.e.getExecutorState()
- if execState >= 305:
- # --- not clean, value from define.hxx (YACS::FINISHED)
+ if self.run1 is not None:
+ execState = self.e.getExecutorState()
+ if execState >= pilot.FINISHED:
self.run1.join()
self.run1 = None
- pass
+
if self.run1 is None:
- self.run1 = threading.Thread(None, self.e.RunPy, "CORBAExec", (self.p,0,1,1))
+ self.run1 = threading.Thread(None, self.runProc, "CORBAExec", (0,1,1))
self.run1.start()
- pass
- pass
def RunFromState(self, xmlFile):
- execState = self.e.getExecutorState()
- if execState >= 305:
- # --- not clean, value from define.hxx (YACS::FINISHED)
+ """Start an execution from the state given by the file xmlFile
+ If xmlFile == "", start execution from the current state
+ """
+ if self.run1 is not None:
+ execState = self.e.getExecutorState()
+ if execState >= pilot.FINISHED:
self.run1.join()
self.run1 = None
- pass
- try:
+
+ if xmlFile:
+ try:
self.p.init()
self.p.exUpdateState();
sp = loader.stateParser()
sl = loader.stateLoader(sp,self.p)
sl.parse(xmlFile)
- except IOError, ex:
+ except IOError, ex:
print "IO Error: ", ex
- return None
- except ValueError,ex:
+ return
+ except ValueError,ex:
print "Caught ValueError Exception:",ex
- return None
- except pilot.Exception,ex:
+ return
+ except pilot.Exception,ex:
print ex.what()
- return None
- except:
+ return
+ except:
print "Unknown exception!"
- return None
+ return
+
if self.run1 is None:
- self.run1 = threading.Thread(None, self.e.RunPy, "CORBAExec", (self.p,0,1,0))
+ self.run1 = threading.Thread(None, self.runProc, "CORBAExec", (0,1,0))
self.run1.start()
+
+ def RestartFromState(self, xmlFile):
+ """Reset the procedure state to ready state for all nodes in error
+ if xmlFile exists first try to load the state from this file.
+ then start execution
+ """
+ if self.run1 is not None:
+ execState = self.e.getExecutorState()
+ if execState >= pilot.FINISHED:
+ self.run1.join()
+ self.run1 = None
+ else:
+ return
+
+ try:
+ if os.path.exists(xmlFile):
+ self.p.init()
+ sp = loader.stateParser()
+ sl = loader.stateLoader(sp,self.p)
+ sl.parse(xmlFile)
+
+ self.p.resetState(1)
+ self.p.exUpdateState();
+ except:
pass
- pass
-
+
+ if self.run1 is None:
+ self.run1 = threading.Thread(None, self.runProc, "CORBAExec", (0,1,0))
+ self.run1.start()
+
def addObserver(self, obs, numid, event):
disp = SALOMERuntime.SALOMEDispatcher_getSALOMEDispatcher()
disp.addObserver(obs, numid, event)
with omniidl and also the class SALOME_ComponentPy_i which defines general
SALOME component behaviour.
"""
- def __init__ ( self, orb, poa, contID, containerName, instanceName,
+ def __init__ ( self, orb, poa, contID, containerName, instanceName,
interfaceName ):
print "YACS.__init__: ", containerName, ';', instanceName
SALOME_ComponentPy.SALOME_ComponentPy_i.__init__(self, orb, poa, contID,
# --- store a naming service interface instance in _naming_service atribute
self._naming_service = SALOME_ComponentPy.SALOME_NamingServicePy_i( self._orb )
-
SALOMERuntime.RuntimeSALOME_setRuntime(1)
SALOMERuntime.SALOMEDispatcher_setSALOMEDispatcher()
- pass
+ r=pilot.getRuntime()
+
+ try:
+ #try to load SALOME module catalogs
+ modul_catalog = self._naming_service.Resolve("/Kernel/ModulCatalog")
+ ior= orb.object_to_string(modul_catalog)
+ cata=r.loadCatalog("session",ior)
+ r.addCatalog(cata)
+ except :
+ pass
def LoadProc(self,xmlFile):
"""
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#ifndef __YACS_IDL__
#define __YACS_IDL__
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include <Python.h>
#include <yacs.hh>
#include "RuntimeSALOME.hxx"
-// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012 CEA/DEN, EDF R&D
//
-// 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include <Python.h>
#include <yacs.hh>
#include "RuntimeSALOME.hxx"