From: nri Date: Tue, 25 Nov 2003 17:04:55 +0000 (+0000) Subject: import component of SupervisionTest X-Git-Tag: V0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Ftags%2FV0;p=samples%2Fcomponent.git import component of SupervisionTest --- 008cd4e3b12166340aa8143903ee8f931b3f844d diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..5c580fd --- /dev/null +++ b/Makefile.in @@ -0,0 +1,91 @@ +# -* Makefile *- +# +# Author : C. Caremoli +# Date : 10/10/2003 +# $Header$ +# + +# source path +top_srcdir=@top_srcdir@ +top_builddir=. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/bin:@top_srcdir@/resources:./bin:@top_srcdir@/idl + +@COMMENCE@ + +SUBDIRS = idl src + +RESOURCES_FILES = \ + COMPONENTCatalog.xml + +BIN_SCRIPT= VERSION + +# copy header files in common directory +ifeq ($(HAVE_SSTREAM),yes) + include_list=include/salome/SALOMEconfig.h +else + include_list=include/salome/SALOMEconfig.h include/salome/sstream +endif + +inc: idl $(include_list) + +include/salome/SALOMEconfig.h: salome_adm/unix/SALOMEconfig.ref + -$(RM) $@ + $(LN_S) ../../$< $@ + +# test if SALOMEconfig.h has changed (contents) +salome_adm/unix/SALOMEconfig.ref: salome_adm/unix/SALOMEconfig.h + @if ! [ -a $@ ]; then \ + cp -p $< $@; \ + fi; \ + if ! cmp $< $@; then \ + cp -p $< $@; \ + fi; \ + +include/salome/sstream: salome_adm/unix/sstream + -$(RM) $@ + $(LN_S) ../../$< $@ + +depend: depend_idl + +depend_idl: + (cd idl ; $(MAKE) $@) || exit 1 + +# doc is already build : if you want to had documents, go manually to doc and run 'make doc' +#doc: +# (cd doc && $(MAKE) $@) || exit 1 + +install-end: +# finish libtool install +# @$(LT) --mode=finish $(libdir) + +install-include: $(include_list) + $(INSTALL) -d $(includedir) + @for f in X $(include_list); do \ + if test $$f != X; then \ + ($(INSTALL_DATA) $$f $(includedir)/. || exit 1); \ + fi; \ + done + +# install script in $(bindir) : +install-bin: $(BIN_SCRIPT) + $(INSTALL) -d $(bindir) + $(INSTALL_PROGRAM) $^ $(bindir) + +uninstall: uninstall-idl + +uninstall-idl: + $(RM) $(idldir)/*.idl + +distclean: distclean-other + +distclean-other: + -$(RM) salome_adm/unix/*~ salome_adm/unix/*% salome_adm/unix/*.bak salome_adm/unix/*.new salome_adm/unix/*.old + -$(RM) salome_adm/unix/make_* + -$(RM) salome_adm/unix/depend salome_adm/unix/SALOMEconfig.h + -$(RM) config.cache config.log config.status + +@MODULE@ + +install: install-bin install-include install-end + diff --git a/adm_local/unix/config_files/README b/adm_local/unix/config_files/README new file mode 100644 index 0000000..feb997b --- /dev/null +++ b/adm_local/unix/config_files/README @@ -0,0 +1,3 @@ +This file is only here for CVS: +CVS does not always create empty directory, and adm_local/unix/config_file +is needed by build_configure. diff --git a/adm_local/unix/make_commence.in b/adm_local/unix/make_commence.in new file mode 100644 index 0000000..06be0f8 --- /dev/null +++ b/adm_local/unix/make_commence.in @@ -0,0 +1,264 @@ +# common directories to put headerfiles +inc_builddir=$(top_builddir)/include/salome + +@SET_MAKE@ +SHELL=/bin/sh + +# header missing + +HAVE_SSTREAM=@HAVE_SSTREAM@ + + +LIBS=@LIBS@ +LIBSFORBIN=@LIBS@ +LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib/salome -Xlinker -rpath-link -Xlinker -L$(top_builddir)/lib/salome +LDFLAGSFORBIN=@LDFLAGS@ -L$(top_builddir)/lib/salome -Xlinker -rpath-link -Xlinker -L$(KERNEL_ROOT_DIR)/lib/salome +# add libstdc++ to link c++ library with libtool ! +LDFLAGS+= -lstdc++ +LDFLAGSFORBIN+= -lstdc++ + +CP=@CP@ + +# CPP + +CPP=@CPP@ +CXXCPP=@CXXCPP@ +CPPFLAGS=@CPPFLAGS@ -I$(inc_builddir) -I$(srcdir) -I. + +# C + +CC = @CC@ +CFLAGS = @CFLAGS@ +C_DEPEND_FLAG = @C_DEPEND_FLAG@ + +# C++ + +CXX = @CXX@ +CXXFLAGS = @CXXFLAGS@ +CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@ + +# JAVA + +JAVA_INCLUDES = @JAVA_INCLUDES@ +JAVA_LIBS = @JAVA_LIBS@ +JAVA_LDPATH = @JAVA_LDPATH@ + +# PYTHON + +PYTHON = @PYTHON@ +PYTHONHOME = @PYTHONHOME@ +PYTHON_INCLUDES = @PYTHON_INCLUDES@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +# Changes from the SalomePro V1.2c +#PYTHON_SITE = @PYTHON_SITE@ +#PYTHON_SITE_INSTALL = @PYTHON_SITE_INSTALL@ +PYTHON_SITE = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages +PYTHON_SITE_INSTALL = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome + +# QT + +QT_ROOT = @QT_ROOT@ +QT_INCLUDES = @QT_INCLUDES@ +QT_MT_INCLUDES = @QT_INCLUDES@ -DQT_THREAD_SUPPORT +QT_LIBS = @QT_LIBS@ +QT_MT_LIBS = @QT_MT_LIBS@ + +MOC = @MOC@ +UIC = @UIC@ + + +#QWT + +QWT_INCLUDES=@QWT_INCLUDES@ +QWT_LIBS=@QWT_LIBS@ + +# SIP +SIP = @SIP@ +SIP_INCLUDES = @SIP_INCLUDES@ +SIP_LIBS = @SIP_LIBS@ + +# PYQT +PYQT_SIPS = @PYQT_SIPS@ +PYQT_LIBS = @PYQT_LIBS@ + +# openGL +OGL_INCLUDES=@OGL_INCLUDES@ +OGL_LIBS=@OGL_LIBS@ + +# VTK +VTK_INCLUDES=@VTK_INCLUDES@ +VTK_LIBS=@VTK_LIBS@ + +# HDF5 + +HDF5_INCLUDES=@HDF5_INCLUDES@ +HDF5_LIBS=@HDF5_LIBS@ +HDF5_MT_LIBS=@HDF5_MT_LIBS@ + +# MED2 + +MED2_INCLUDES=@MED2_INCLUDES@ +MED2_LIBS=@MED2_LIBS@ +MED2_MT_LIBS=@MED2_MT_LIBS@ + +# OpenCasCade + +OCC_INCLUDES=@CAS_CPPFLAGS@ +OCC_CXXFLAGS=@CAS_CXXFLAGS@ + +#OCC_KERNEL_LIBS=@CAS_KERNEL@ +#OCC_OCAF_LIBS=@CAS_OCAF@ +#OCC_VIEWER_LIBS=@CAS_VIEWER@ +#OCC_MODELER_LIBS=@CAS_MODELER@ +#OCC_DATAEXCHANGE_LIBS=@CAS_DATAEXCHANGE@ +#OCC_LIBS=@CAS_LDFLAGS@ +CAS_KERNEL=@CAS_KERNEL@ +CAS_OCAF=@CAS_OCAF@ +CAS_VIEWER=@CAS_VIEWER@ +CAS_MODELER=@CAS_MODELER@ +CAS_DATAEXCHANGE=@CAS_DATAEXCHANGE@ +CAS_LDPATH=@CAS_LDPATH@ + +# MPICH + +MPICH_INCLUDES=@MPICH_INCLUDES@ +MPICH_LIBS=@MPICH_LIBS@ + +# Swig C++ Python + +SWIG = @SWIG@ +SWIG_FLAGS = @SWIG_FLAGS@ -I$(inc_builddir) -I$(srcdir) -I. + +# OMNIORB + +OMNIORB_ROOT = @OMNIORB_ROOT@ +OMNIORB_INCLUDES = @OMNIORB_INCLUDES@ +OMNIORB_LIBS = @OMNIORB_LIBS@ +OMNIORB_CXXFLAGS = @OMNIORB_CXXFLAGS@ + +OMNIORB_IDL = @OMNIORB_IDL@ +OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@ +OMNIORB_IDLPYFLAGS = @OMNIORB_IDLPYFLAGS@ -I$(top_srcdir)/idl -I$(top_builddir)/idl -I$(KERNEL_ROOT_DIR)/idl/salome + +OMNIORB_IDL_CLN_H = @OMNIORB_IDL_CLN_H@ +OMNIORB_IDL_CLN_CXX = @OMNIORB_IDL_CLN_CXX@ +OMNIORB_IDL_CLN_OBJ = @OMNIORB_IDL_CLN_OBJ@ + +OMNIORB_IDL_SRV_H = @OMNIORB_IDL_SRV_H@ +OMNIORB_IDL_SRV_CXX = @OMNIORB_IDL_SRV_CXX@ +OMNIORB_IDL_SRV_OBJ = @OMNIORB_IDL_SRV_OBJ@ + +# Default ORB + +CORBA_ROOT = @CORBA_ROOT@ +CORBA_INCLUDES = @CORBA_INCLUDES@ +CORBA_LIBS = @CORBA_LIBS@ +CORBA_CXXFLAGS = @CORBA_CXXFLAGS@ + +IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(top_srcdir)/idl -I$(top_builddir)/idl -I$(KERNEL_ROOT_DIR)/idl/salome +IDLPYFLAGS = @IDLPYFLAGS@ + +IDL = @IDL@ + +IDL_CLN_H = @IDL_CLN_H@ +IDL_CLN_CXX = @IDL_CLN_CXX@ +IDL_CLN_OBJ = @IDL_CLN_OBJ@ + +IDL_SRV_H = @IDL_SRV_H@ +IDL_SRV_CXX = @IDL_SRV_CXX@ +IDL_SRV_OBJ = @IDL_SRV_OBJ@ + +CPPFLAGS+= $(CORBA_INCLUDES) +CXXFLAGS+= $(CORBA_CXXFLAGS) + +# add corba libs when link salome application ! +#LDFLAGS+= $(CORBA_LIBS) +LIBS+=$(CORBA_LIBS) + +DOXYGEN = @DOXYGEN@ + +## Shared libraries +LT_STATIC_EXEC=@LT_STATIC_EXEC@ +DYNAMIC_DIRS=@DYNAMIC_DIRS@ +LT_LIB=libtool +LT=$(top_builddir)/libtool +LT_COMPILE=$(LT) --mode=compile $(CC) +LT_LINK_LIB=$(LT_LIB) --mode=link $(CC) -rpath $(libdir) +LT_LINK_EXE=$(LT) --mode=link $(CC) $(LT_STATIC_EXEC) -dlopen self -rpath $(bindir) $(DYNAMIC_DIRS) +LT_RUN=$(LT) --mode=execute +LT_INSTALL_PROG=$(LT) --mode=install $(INSTALL_PROGRAM) +LT_INSTALL_LIB=$(LT) --mode=install $(INSTALL_DATA) +LT_UNINSTALL=$(LT) --mode=uninstall $(RM) + +INSTALL=@INSTALL@ +INSTALL_PROGRAM=@INSTALL_PROGRAM@ +INSTALL_DATA=@INSTALL_DATA@ + +# create a symbolic link (or a copie ?) +LN_S=@LN_S@ + +## Installation points +prefix=@prefix@ +exec_prefix=@exec_prefix@ +bindir=@bindir@/salome +libdir=@libdir@/salome +# warning : if user give this path in configure we could have salome/salome :-( +includedir=@includedir@/salome +datadir=@datadir@/salome +idldir=$(prefix)/idl/salome +sharedpydir=@libdir@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules +incmakedir=${prefix}/salome_adm/unix + +docdir=$(datadir)/doc + +# +# begin of package rules +# + +.PHONY: all lib bin inc resources tests install uninstall dep depend depend_idl cleandep mostlyclean clean distclean + +.SUFFIXES: .cxx .cc .c .f .o .lo .idl .py .i .ui .po .qm + +all: + $(MAKE) inc + $(MAKE) depend_idl + $(MAKE) depend + $(MAKE) lib + $(MAKE) bin + $(MAKE) resources + +# +# add target to build administrative files +# + +Makefile: $(top_builddir)/config.status $(srcdir)/Makefile.in + cd $(top_builddir) ; ./config.status + +$(top_builddir)/config.status: $(top_srcdir)/configure + cd $(top_builddir) ; ./config.status --recheck + +# VPATH contain $(srcdir), so make configure is good in top_srcdir and we must add target configure otherwise :-) +ifneq ($(top_srcdir),$(srcdir)) +configure: $(top_srcdir)/configure +endif + +$(top_srcdir)/configure: $(top_srcdir)/configure.in $(top_srcdir)/aclocal.m4 + cd $(top_srcdir) ; autoconf + +$(top_srcdir)/configure.in: $(top_srcdir)/configure.in.base + cd $(top_srcdir) && ./build_configure + + +ACLOCAL_SRC = \ +ac_cxx_bool.m4 check_corba.m4 check_vtk.m4 \ +ac_cxx_depend_flag.m4 check_hdf5.m4 enable_pthreads.m4 \ +ac_cxx_mutable.m4 check_mico.m4 libtool.m4 \ +ac_cxx_namespaces.m4 check_omniorb.m4 pyembed.m4 \ +ac_cxx_partial_specialization.m4 check_opengl.m4 python.m4 \ +ac_cxx_typename.m4 check_pthreads.m4 check_cas.m4 \ +ac_cc_warnings.m4 check_qt.m4 check_med2.m4 \ +check_swig.m4 + +$(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%) + cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files diff --git a/adm_local/unix/make_conclude.in b/adm_local/unix/make_conclude.in new file mode 100644 index 0000000..5b49c54 --- /dev/null +++ b/adm_local/unix/make_conclude.in @@ -0,0 +1,346 @@ +#======================================================================= +# This section of this makefile comes from the file +# 'adm/unix/make_conclude' which was generated with config.status +# from file adm/unix/make_conclude.in +#======================================================================= +# -* Makefile *- +# +# Authors : Patrick GOLDBRONN (CEA) - Marc Tajchman (CEA) +# Date : 6/07/2001 +# $Header$ +# + +# ORB Specifics rules +@CORBA@ + +# transform idl reference in appropriate obj file +LIB_CLIENT_SRC = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX)) +LIB_SERVER_SRC = $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_CXX)) +LIB_MOC_SRC = $(LIB_MOC:%.h=%_moc.cxx) +LIB_SRC+=$(LIB_MOC_SRC) +LIB_SWIG_SRC = $(SWIG_DEF:%.i=%_wrap.cxx) +LIB_DEP= $(LIB_SRC) $(LIB_CLIENT_SRC) $(LIB_SERVER_SRC) $(LIB_SWIG_SRC) + +LIB_CLIENT_OBJ = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ)) +LIB_SERVER_OBJ = $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_OBJ)) + + +# transform c file in appropriate libtool obj file (.c, .cc and .cxx) +LIB_OBJ_C = $(patsubst %.c, %.lo, $(filter %.c, $(LIB_SRC))) +LIB_OBJ_CC = $(patsubst %.cc, %.lo, $(filter %.cc, $(LIB_SRC))) +LIB_OBJ_CXX = $(patsubst %.cxx, %.lo, $(filter %.cxx, $(LIB_SRC))) +LIB_SWIG_OBJ = $(LIB_SWIG_SRC:%.cxx=%.lo) +LIB_OBJ_F = $(patsubst %.f, %.lo, $(filter %.f, $(LIB_SRC))) + +# all libtool obj file in library +LIB_OBJ = $(LIB_OBJ_CXX) $(LIB_OBJ_CC) $(LIB_OBJ_C) $(LIB_CLIENT_OBJ:%.o=%.lo) $(LIB_SERVER_OBJ:%.o=%.lo) $(LIB_SWIG_OBJ) $(LIB_OBJ_F) + +# LIB_BUILD = $(LIB:%.la=$(top_builddir)/lib/salome/%.la) +LIB_BUILD = $(patsubst %.la, $(top_builddir)/lib/salome/%.la, $(filter %.la, $(LIB))) +LIB_BUILD_A = $(patsubst %.a, $(top_builddir)/lib/salome/%.a, $(filter %.a, $(LIB))) + +ifneq ($(findstring cmodule.la,$(filter %.la, $(LIB))),) +LIB_SWIG = $(patsubst %cmodule.la,%.so, $(filter %.la, $(LIB))) +else +LIB_SWIG = +endif + +lib: $(LIB_BUILD) $(LIB_CLIENT_PY) +# we don't build static library ! + +$(LIB_BUILD): $(top_builddir)/lib/salome/%.la: %.la + -$(RM) $@ + -$(RM) $(patsubst %.la, %.so, $@) + -$(RM) $(patsubst %.la, %.a, $@) + ln -sf $(CURDIR)/$< $@ || true + ln -sf $(patsubst %.la, %.so, $(CURDIR)/.libs/$<) \ + $(patsubst %.la, %.so, $@) || true + ln -sf $(patsubst %.la, %.so, $(CURDIR)/.libs/$<).0 \ + $(patsubst %.la, %.so, $@).0 || true + + if ! test -z $(LIB_SWIG) ; then \ + ln -sf $(patsubst %.la,%.so, $(CURDIR)/.libs/$<) $(top_builddir)/lib/salome/_$(LIB_SWIG) || true;\ + fi; + +$(LIB_BUILD_A): $(top_builddir)/lib/salome/%.a: %.a + -$(RM) $@ + ln -sf $(CURDIR)/$< $@ || true + +$(LIB): $(LIB_OBJ) + @$(LT) --mode=link $(CXX) -rpath $(libdir) -o $@ $(CXXFLAGS) $(LIB_OBJ) $(LDFLAGS) $(LIBS) + +# transform idl reference in appropriate obj file +BIN_CLIENT_SRC = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX)) +BIN_SERVER_SRC = $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_CXX)) +BIN_MOC_SRC = $(BIN_MOC:%.h=%_moc.cxx) +BIN_SRC+=$(BIN_MOC_SRC) +BIN_DEP=$(BIN:%=%.cxx) $(BIN_SRC) $(BIN_CLIENT_SRC) $(BIN_SERVER_SRC) + +BIN_CLIENT_OBJ = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ)) +BIN_SERVER_OBJ = $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_OBJ)) +# transform c file in appropriate libtool obj file (.c) +BIN_OBJ_C = $(patsubst %.c, %.o, $(filter %.c, $(BIN_SRC))) +# transform c++ file in appropriate libtool obj file (.cc and .cxx) +BIN_OBJ_CC = $(patsubst %.cc, %.o, $(filter %.cc, $(BIN_SRC))) +BIN_OBJ_CXX = $(patsubst %.cxx, %.o, $(filter %.cxx, $(BIN_SRC))) +# all obj file in bin target +BIN_OBJ = $(BIN_OBJ_CC) $(BIN_OBJ_CXX) $(BIN_OBJ_C) $(BIN_CLIENT_OBJ) $(BIN_SERVER_OBJ) + +bin: $(BIN:%=$(top_builddir)/bin/salome/%) $(BIN) $(LIB) pyscripts sharedpyscripts + +BIN_LIB=$(LIB:lib%.la=-l%) + +$(BIN:%=$(top_builddir)/bin/salome/%) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%): $(top_builddir)/bin/salome/%: % + -$(RM) $@ + ln -sf $(CURDIR)/$< $@ + +$(BIN) $(TEST_PROGS): %: %.lo $(BIN_OBJ) + $(CXX) $(CXXFLAGS) -o $@ $^ $(BIN_LIB) $(LDFLAGSFORBIN) $(LIBSFORBIN) + +# copy python scripts in $(top_builddir)/bin/salome +# +DEST_PYSCRIPTS = $(EXPORT_PYSCRIPTS:%=$(top_builddir)/bin/salome/%) +pyscripts: $(DEST_PYSCRIPTS) +$(DEST_PYSCRIPTS): $(top_builddir)/bin/salome/%: % + cp -f $< $@ + +# copy pyqt files in $(PYTHON_SHARED_SITE) +# +PYTHON_SHARED_SITE=$(top_builddir)/lib/python$(PYTHON_VERSION)/site-packages/salome/shared_modules + +$(PYTHON_SHARED_SITE): + $(INSTALL) -d $@ + +DEST_SHAREDPYSCRIPTS = $(EXPORT_SHAREDPYSCRIPTS:%=$(PYTHON_SHARED_SITE)/%) +sharedpyscripts: $(PYTHON_SHARED_SITE) $(DEST_SHAREDPYSCRIPTS) +$(DEST_SHAREDPYSCRIPTS): $(PYTHON_SHARED_SITE)/%: % + cp -f $< $@ + +check: test + +tests: test + +test: $(LIB) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%) + + +# copy header file in $(inc_builddir) +# +DEST_HEADERS = $(EXPORT_HEADERS:%=$(inc_builddir)/%) +inc: $(DEST_HEADERS) +$(DEST_HEADERS): $(inc_builddir)/%: % + cp -f $< $@ + +# build resources file (icons and messages) : .qm file from .po file +resources: $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/%.qm) + +# Make installation directories if they don't exist. +$(libdir) $(includedir) $(bindir) $(datadir) $(idldir) $(sharedpydir): + $(INSTALL) -d $@ && chmod 755 $@ + +# Install the library, the public header files, and programs. +install: $(LIB) $(BIN) $(TEST_PROGS) $(libdir) $(includedir) $(bindir) $(datadir) $(idldir) install-python install-sharedpyqt install-qm + @for f in X $(LIB); do \ + if test $$f != X; then \ + ($(LT_INSTALL_LIB) $$f $(libdir)/. || exit 1); \ + fi; \ + done + @if ! test -z $(LIB_SWIG) ; then \ + (cd $(libdir); ln -sf $(patsubst %.so, %cmodule.so, $(LIB_SWIG)) _$(LIB_SWIG) || true); \ + fi; + @for f in X $(BIN); do \ + if test $$f != X; then \ + ($(LT_INSTALL_PROG) $$f $(bindir)/. || exit 1); \ + fi; \ + done +# Install tests programmes in bindir + @for f in X $(TEST_PROGS); do \ + if test $$f != X; then \ + ($(LT_INSTALL_PROG) $$f $(bindir)/. || exit 1); \ + fi; \ + done +# Install exported includes in includedir + @for f in X $(EXPORT_HEADERS:%=$(srcdir)/%); do \ + if test $$f != X; then \ + (cp -p $$f $(includedir) || exit 1); \ + fi; \ + done + +# Install python script in $(bindir) +install-python: $(bindir) $(EXPORT_PYSCRIPTS:%=install-%) + +$(EXPORT_PYSCRIPTS:%=install-%): install-%: % + $(INSTALL_PROGRAM) $< $(bindir)/. + +#install-python: $(bindir) $(EXPORT_PYSCRIPTS) +# @for f in X $(EXPORT_PYSCRIPTS); do \ +# if test $$f != X; then \ +# ($(INSTALL_PROGRAM) $$f $(bindir)/. || exit 1); \ +# fi; \ +# done + +# Install pyqt script in $(install-sharedpyqt) +install-sharedpyqt: $(sharedpydir) $(EXPORT_SHAREDPYSCRIPTS:%=install-%) + +$(EXPORT_SHAREDPYSCRIPTS:%=install-%): install-%: % + $(INSTALL_PROGRAM) $< $(sharedpydir)/. + + +# generic rule to install .qm files : +install-qm: resources + $(INSTALL) -d $(datadir)/resources + @for f in X $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/%.qm); do \ + if test $$f != X; then \ + ($(INSTALL_DATA) $$f $(datadir)/resources/. || exit 1); \ + fi; \ + done + +# Removes those things that `make install' (would have) installed. +uninstall: + @if test "X$(LIB)" != X; then \ + for f in $(LIB); do \ + $(LT_UNINSTALL) $(libdir)/$$f; \ + done; \ + fi + @if test "X$(BIN)" != X; then \ + for f in $(BIN); do \ + $(LT_UNINSTALL) $(bindir)/$$f; \ + done; \ + fi + @for f in X $(TEST_PROGS); do \ + if test $$f != X; then \ + $(LT_UNINSTALL) $(bindir)/$$f; \ + fi; \ + done +# Uninstall exported includes in includedir + @for f in X $(EXPORT_HEADERS); do \ + if test $$f != X; then \ + $(LT_UNINSTALL) $(includedir)/$$f; \ + fi; \ + done +# Uninstall python script in $(bindir) + @for f in X $(EXPORT_PYSCRIPTS); do \ + if test $$f != X; then \ + $(LT_UNINSTALL) $(bindir)/$$f ; \ + fi; \ + done + +# Uninstall pyqt script in $(sharedpydir) + @for f in X $(EXPORT_SHAREDPYSCRIPTS); do \ + if test $$f != X; then \ + $(LT_UNINSTALL) $(sharedpydir)/$$f ; \ + fi; \ + done + +# Uninstall qm files + @for f in X $(PO_FILES:%.po=%.qm); do \ + if test $$f != X; then \ + $(LT_UNINSTALL) $(datadir)/resources/$$f ; \ + fi; \ + done + +# remove all dependencies files +# +cleandep: + -$(RM) .dep* + +# Removes temporary files without removing the final target files. That is, +# remove things like object files but not libraries or executables. +# +mostlyclean: cleandep + -$(RM) $(LIB_OBJ) $(LIB_OBJ:.lo=.o) + -$(RM) $(BIN_OBJ) $(BIN:%=%.o) + -$(RM) $(TEST_OBJ) $(TEST_OBJ:.lo=.o) + -$(RM) $(PROG_OBJ) $(PROG_OBJ:.lo=.o) $(MOSTLYCLEAN) + +# Like `mostlyclean' except it also removes the final targets: things like +# libraries and executables. This target doesn't remove any file that +# is part of the SALOME distribution. +# +clean: mostlyclean + -$(RM) $(LIB) $(TEST_PROGS) $(BIN) $(CLEAN) + -$(RM) TAGS *~ *# core *.core + -$(RM) -r .libs + -$(RM) $(top_builddir)/lib/salome/$(LIB) + -$(RM) $(patsubst %,$(top_builddir)/bin/salome/%, $(BIN)) + -$(RM) $(patsubst %.la, %.so, $(top_builddir)/lib/salome/$(LIB)) + -$(RM) $(patsubst %.la, %.a, $(top_builddir)/lib/salome/$(LIB)) +# remove idl generated files (sources) + -$(RM) $(LIB_CLIENT_SRC) $(LIB_SERVER_SRC) $(BIN_CLIENT_SRC) $(BIN_SERVER_SRC) +# remove idl generated files (headers) + -$(RM) $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_H)) $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_H)) + -$(RM) $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_H)) $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_H)) + -$(RM) $(LIB_MOC_SRC) $(BIN_MOC_SRC) + -$(RM) $(LIB_SWIG_SRC) + +# Like `clean' except it also removes files that were created by running +# configure. If you've unpacked the source and built without creating +# any other files, then `make distclean' will leave only the files that were +# in the distribution. +# +distclean: clean + #remove qm file ! + -$(RM) $(PO_FILES:%.po=%.qm) $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/%.qm) + #remove include files + -$(RM) $(DEST_HEADERS) + -$(RM) $(DISTCLEAN) *.bak *.old *.new .dep* + @if test -f $(srcdir)/Makefile.in; then \ + (@SETX@; $(RM) Makefile); \ + fi + + +#implicits rules +.cc.o: + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< + +.cc.lo: + $(LT) --mode=compile $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< + +.cxx.o: + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< + +.cxx.lo: + $(LT) --mode=compile $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< + +.c.o: + $(CC) $(CFLAGS) $(CPPFLAGS) -c $< + +.c.lo: + $(LT_COMPILE) $(CFLAGS) $(CPPFLAGS) -c $< + +.f.o: + $(FC) $(FFLAGS) -c $< -o $@ + +.f.lo: + $(LT) --mode=compile $(FC) $(FFLAGS) -c $< + +.ui.h: + $(UIC) -o $@ $< + +.ui.cxx: + $(UIC) -o $@ -i $*.h $< + +#pattern rules +%_moc.cxx : %.h + $(MOC) $< -o $@ + +%_wrap.cxx : %.i + $(SWIG) $(SWIG_FLAGS) -o $@ $< + +$(top_builddir)/share/salome/resources/%.qm: %.po + if test -e ${KERNEL_ROOT_DIR}/bin/salome/msg2qm ; then \ + ${KERNEL_ROOT_DIR}/bin/salome/msg2qm $< $@ ; \ + else \ + $(top_builddir)/bin/salome/msg2qm $< $@ ; \ + fi + +#------------------------------------------------------------------------------ +# The following section of this makefile contains dependencies between the +# source files and the header files. If GNU make and GCC are being used then +# the dependencies are in the form of rules that cause the information to +# be kept updated automatically. Otherwise the dependencies are listed +# explicitly and come from the `.distdep' files in the various directories. +# These files are part of the distribution and are generated automatically on +# GNU/GCC systems. +#------------------------------------------------------------------------------ + +@DEPEND@ diff --git a/adm_local/unix/make_omniorb.in b/adm_local/unix/make_omniorb.in new file mode 100644 index 0000000..84679a9 --- /dev/null +++ b/adm_local/unix/make_omniorb.in @@ -0,0 +1,53 @@ +#======================================================================= +# Begin specific part to omniorb +# (include from file adm/unix/make_omniorb generated by +# adm/unix/make_omniorb.in) +#======================================================================= +# -* Makefile *- +# +# Author : Patrick GOLDBRONN (CEA) +# Date : 29/06/2001 +# $Header$ +# + +# Client and server object are the same with omniorb +# There are one header file and one source file generate + +#IDLOBJ=$(IDLSRC:%.idl=%$(IDL_CLN_OBJ)) + +# dependancies between idl and it's generated files +%$(OMNIORB_IDL_CLN_CXX) %$(OMNIORB_IDL_CLN_H): ${KERNEL_ROOT_DIR}/idl/salome/%.idl + $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< + +%$(OMNIORB_IDL_CLN_CXX) %$(OMNIORB_IDL_CLN_H): ${top_srcdir}/idl/%.idl + $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< + +# dependncies between idl files +depend_idl: .depidl + +# we use cpp to generate dependencies between idl files. +# we change cpp output to keep only idl file and transform it to get a suitable rule +.depidl: $(IDL_FILES) + @touch $@ + @for dep in $? dummy; do \ + if [ $$dep != "dummy" ]; then \ + echo Building dependencies for $$dep; \ + basedep=`basename $$dep .idl`; \ + header="$$basedep"$(IDL_CLN_H); \ + sed '\%^'"$$header"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@; \ + $(CPP) $(C_DEPEND_FLAG) -I$(srcdir) $$dep 2>/dev/null | \ + sed `echo "s%$$basedep\\.idl%$$header:%g"` | \ + sed 's% $(srcdir)/% %g' | \ + sed 's% $(top_srcdir)/% %g' | \ + sed 's% $(top_builddir)/% %g' | \ + sed 's%^.*:\.o: *%%' | sed 's%^ *\\ *%%'| sed 's%^ *\(.*\):%\1:%' | \ + sed 's/\.idl/$(IDL_CLN_H)/' >>$@; \ + echo '' >>$@; \ + fi; \ + done ; + +-include .depidl + +#======================================================================= +# End specific part to omniorb +#======================================================================= diff --git a/bin/VERSION b/bin/VERSION new file mode 100755 index 0000000..23a578f --- /dev/null +++ b/bin/VERSION @@ -0,0 +1,2 @@ +SALOME 2 EXEMPLE MODULE C++ : HELLO +This module works with KERNEL 1.2.1 diff --git a/build_configure b/build_configure new file mode 100755 index 0000000..41d838a --- /dev/null +++ b/build_configure @@ -0,0 +1,210 @@ +#!/bin/bash + +# +# Tool for updating list of .in file for the SALOME project +# and regenerating configure script +# +# Author : Marc Tajchman - CEA +# Date : 10/10/2002 +# $Header$ +# + +ORIG_DIR=`pwd` +CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"` + +######################################################################## +# Test if the KERNEL_ROOT_DIR is set correctly + +if test ! -d "${KERNEL_ROOT_DIR}"; then + echo "failed : KERNEL_ROOT_DIR variable is not correct !" + exit +fi + +# Test if the KERNEL_SRC is set correctly + +#if test ! -d "${KERNEL_SRC}"; then +# echo "failed : KERNEL_SRC variable is not correct !" +# exit +#fi +######################################################################## +# find_in - utility function +# +# usage : +# find_in directory filename +# +# Finds files following the *.in pattern, recursively in the +# directory (first argument). +# Results are appended into the file (second argument) +# +# Difference from the standard unix find is that files are tested +# before directories +# + +find_in() +{ + local i + local f=$2 + +# if the first argument is not a directory, returns + + if [ ! -d "$1" ] ; then + return + fi + +# dont look in the CVS directories + + case $1 in + */CVS) return ;; + *) ;; + esac + +# for each regular file contained in the directory +# test if it's a .in file + + for i in "$1"/* + do + if [ -f "$i" ] ; then + case $i in + *.in) echo " "$i" \\" >> $f;; + *) ;; + esac + fi + done + +# for each subdirectory of the first argument, proceeds recursively + + for i in "$1"/* + do + if [ -d "$i" ] ; then + find_in "$i" "$f" + fi + done +} + + +####################################################################### +# Generate list of .in files (Makefile.in, config.h.in, etc) +# appending it in file configure.in + +cd ${CONF_DIR} +ABS_CONF_DIR=`pwd` + +# +# Common part of the configure.in file +# +chmod u+w configure.in.base +if ! \cp -f configure.in.base configure.in_tmp1 +then + echo + echo "error : can't create files in" ${CONF_DIR} + echo "aborting ..." + chmod u-w configure.in.base + exit +fi +chmod u-w configure.in.base + +if [ -e "${CONF_DIR}/salome_adm" ] ; then + \rm -f ${CONF_DIR}/salome_adm +fi + +# make a link allowing AC_OUTPUT to find the salome_adm/.../*.in files +echo "" >> configure.in_tmp1 +echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1 + +echo "" >> configure.in_tmp1 +echo "AC_OUTPUT([ \\" >> configure.in_tmp1 + +# +# List of .in files in the adm/unix directory +# These files MUST be on top of AC_OUTPUT list so we +# put them "manually" +# + +echo " ./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/F77config.h \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/sstream \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/depend \\" >> configure.in_tmp1 +echo " ./adm_local/unix/make_omniorb \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1 +echo " ./adm_local/unix/make_commence \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/make_conclude \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1 + +\rm -f configure.in_tmp2 configure.in_tmp3 +touch configure.in_tmp2 +find_in . configure.in_tmp2 +sed '/^.salome_adm/d' configure.in_tmp2 > configure.in_tmp3 +sed '/configure.in/d' configure.in_tmp3 > configure.in_tmp2 +sed 's/.in / /' configure.in_tmp2 >> configure.in_tmp1 + +echo "])" >> configure.in_tmp1 + +# delete the link created for AC_OUTPUT +echo "" >> configure.in_tmp1 +#echo 'rm -f ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1 +\mv configure.in_tmp1 configure.in_new +\rm -f configure.in_tmp2 configure.in_tmp3 + + +######################################################################## +# Create new (or replace old) configure.in file +# Print a message if the file is write protected +# + +echo +if test ! -f configure.in +then + echo -n "Creating new file 'configure.in' ... " + if \mv configure.in_new configure.in >& /dev/null + then + echo "done" + else + echo "error, check your file permissions" + fi +else + echo -n "Updating 'configure.in' file ... " + if ! \cp configure.in configure.in_old >& /dev/null + then + echo + echo + echo "Can't backup previous configure.in" + echo -n "Continue (you will not be able to revert) - (Y/N) ? " + read R + case "x$R" in + xn*) exit;; + xN*) exit;; + esac + echo + echo -n " " + fi + if \cp configure.in_new configure.in >& /dev/null + then + echo "done" + else + echo + echo "error, can't update previous configure.in" + fi +fi + +######################################################################## +# Use autoconf to rebuild the configure script +# + +if test -f configure +then + echo -n "Updating 'configure' script ... " +else + echo -n "Creating 'configure' script ... " +fi + +aclocal --acdir=adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files +if autoconf +then + echo "done" +else + echo "failed (check file permissions and/or user quotas ...)" +fi + +cd ${ORIG_DIR} + +echo diff --git a/configure.in.base b/configure.in.base new file mode 100644 index 0000000..064d002 --- /dev/null +++ b/configure.in.base @@ -0,0 +1,366 @@ +# +# PLEASE DO NOT MODIFY configure.in FILE +# +# ALL CHANGES WILL BE DISCARDED BY THE NEXT +# build_configure COMMAND +# +# CHANGES MUST BE MADE IN configure.in.base FILE +# +# +# Author : Marc Tajchman (CEA) +# Date : 28/06/2001 +# Modified by : Patrick GOLDBRONN (CEA) +# Modified by : Marc Tajchman (CEA) +# +# Created from configure.in.base +# + +AC_INIT(src) +AC_CONFIG_AUX_DIR(${KERNEL_ROOT_DIR}/salome_adm/unix/config_files) +AC_CANONICAL_HOST + +PACKAGE=salome +AC_SUBST(PACKAGE) + +VERSION=0.0.1 +AC_SUBST(VERSION) + +dnl +dnl Initialize source and build root directories +dnl + +ROOT_BUILDDIR=`pwd` +ROOT_SRCDIR=`echo $0 | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"` +cd $ROOT_SRCDIR +ROOT_SRCDIR=`pwd` +cd $ROOT_BUILDDIR + +AC_SUBST(ROOT_SRCDIR) +AC_SUBST(ROOT_BUILDDIR) + +echo +echo Source root directory : $ROOT_SRCDIR +echo Build root directory : $ROOT_BUILDDIR +echo +echo + +if test -z "$AR"; then + AC_CHECK_PROGS(AR,ar xar,:,$PATH) +fi +AC_SUBST(AR) + +dnl Export the AR macro so that it will be placed in the libtool file +dnl correctly. +export AR + +echo +echo --------------------------------------------- +echo testing make +echo --------------------------------------------- +echo + +AC_PROG_MAKE_SET +AC_PROG_INSTALL +dnl +dnl libtool macro check for CC, LD, NM, LN_S, RANLIB, STRIP + pour les librairies dynamiques ! + +AC_ENABLE_DEBUG(yes) +AC_DISABLE_PRODUCTION + +echo --------------------------------------------- +echo testing libtool +echo --------------------------------------------- + +dnl first, we set static to no! +dnl if we want it, use --enable-static +AC_ENABLE_STATIC(no) + +AC_LIBTOOL_DLOPEN +AC_PROG_LIBTOOL + +dnl Fix up the INSTALL macro if it s a relative path. We want the +dnl full-path to the binary instead. +case "$INSTALL" in + *install-sh*) + INSTALL='\${KERNEL_ROOT_DIR}'/salome_adm/unix/config_files/install-sh + ;; +esac + +echo +echo --------------------------------------------- +echo testing C/C++ +echo --------------------------------------------- +echo + +cc_ok=no +dnl inutil car libtool +dnl AC_PROG_CC +AC_PROG_CXX +AC_DEPEND_FLAG +# AC_CC_WARNINGS([ansi]) +cc_ok=yes + +dnl Library libdl : +AC_CHECK_LIB(dl,dlopen) + +dnl add library libm : +AC_CHECK_LIB(m,ceil) + +dnl +dnl Well we use sstream which is not in gcc pre-2.95.3 +dnl We must test if it exists. If not, add it in include ! +dnl + +AC_CXX_HAVE_SSTREAM + +dnl +dnl --------------------------------------------- +dnl testing MPICH +dnl --------------------------------------------- +dnl + +CHECK_MPICH + +echo +echo --------------------------------------------- +echo testing LEX \& YACC +echo --------------------------------------------- +echo + +lex_yacc_ok=no +AC_PROG_YACC +AC_PROG_LEX +lex_yacc_ok=yes + +echo +echo --------------------------------------------- +echo testing python +echo --------------------------------------------- +echo + +CHECK_PYTHON + +dnl echo +dnl echo --------------------------------------------- +dnl echo testing java +dnl echo --------------------------------------------- +dnl echo + +dnl CHECK_JAVA + +echo +echo --------------------------------------------- +echo testing swig +echo --------------------------------------------- +echo + +CHECK_SWIG + +echo +echo --------------------------------------------- +echo testing threads +echo --------------------------------------------- +echo + +ENABLE_PTHREADS + +echo +echo --------------------------------------------- +echo testing omniORB +echo --------------------------------------------- +echo + +CHECK_OMNIORB + +dnl echo +dnl echo --------------------------------------------- +dnl echo testing mico +dnl echo --------------------------------------------- +dnl echo + +dnl CHECK_MICO + +echo +echo --------------------------------------------- +echo default ORB : omniORB +echo --------------------------------------------- +echo + +DEFAULT_ORB=omniORB +CHECK_CORBA + +AC_SUBST_FILE(CORBA) +corba=make_$ORB +CORBA=adm_local/unix/$corba + +echo +echo --------------------------------------------- +echo testing openGL +echo --------------------------------------------- +echo + +CHECK_OPENGL + +echo +echo --------------------------------------------- +echo testing QT +echo --------------------------------------------- +echo + +CHECK_QT + +echo +echo --------------------------------------------- +echo testing VTK +echo --------------------------------------------- +echo + +CHECK_VTK + +echo +echo --------------------------------------------- +echo testing HDF5 +echo --------------------------------------------- +echo + +CHECK_HDF5 + +echo +echo --------------------------------------------- +echo testing MED2 +echo --------------------------------------------- +echo + +CHECK_MED2 + +echo +echo --------------------------------------------- +echo Testing OpenCascade +echo --------------------------------------------- +echo + +CHECK_CAS + +echo +echo --------------------------------------------- +echo Testing html generators +echo --------------------------------------------- +echo + +CHECK_HTML_GENERATORS + +echo +echo --------------------------------------------- +echo Testing Kernel +echo --------------------------------------------- +echo + +CHECK_KERNEL + +echo +echo --------------------------------------------- +echo Summary +echo --------------------------------------------- +echo + +echo Configure +variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok" + +for var in $variables +do + printf " %10s : " `echo \$var | sed -e "s,_ok,,"` + eval echo \$$var +done + +echo +echo "Default ORB : $DEFAULT_ORB" +echo + +dnl generals files which could be included in every makefile + +AC_SUBST_FILE(COMMENCE) COMMENCE=adm_local/unix/make_commence +AC_SUBST_FILE(CONCLUDE) CONCLUDE=adm_local/unix/make_conclude +AC_SUBST_FILE(MODULE) MODULE=salome_adm/unix/make_module + +dnl les dependences +AC_SUBST_FILE(DEPEND) DEPEND=salome_adm/unix/depend + +dnl We don t need to say when we re entering directories if we re using +dnl GNU make becuase make does it for us. +if test "X$GMAKE" = "Xyes"; then + AC_SUBST(SETX) SETX=":" +else + AC_SUBST(SETX) SETX="set -x" +fi + +# make other build directories +for rep in salome_adm adm_local doc bin/salome include/salome lib/salome share/salome/resources share/salome/doc idl +do +# if test ! -d $rep ; then +# eval mkdir $rep +# fi + $INSTALL -d $rep +done + +echo +echo --------------------------------------------- +echo copying resource files, shell scripts, and +echo xml files +echo --------------------------------------------- +echo + + +dnl copy resources directories + +#for i in `find $ROOT_SRCDIR -name 'resources' -print` +#do +# local_res=`echo $i | sed -e "s,$ROOT_SRCDIR,.,"` +# local_res_dir=`echo $local_res | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"` +# mkdir -p $local_res_dir +# cd $local_res_dir +# ln -fs $i +# echo $local_res +# cd $ROOT_BUILDDIR +#done + +dnl copy shells and utilities contained in the bin directory +dnl excluding .in files (treated in AC-OUTPUT below) and CVS +dnl directory + +cd bin +for i in $ROOT_SRCDIR/bin/* +do + local_bin=`echo $i | sed -e "s,$ROOT_SRCDIR,.,"` + case "$local_bin" in + *.in | *~) ;; + ./bin/CVS) ;; + *) ln -fs $i; echo $local_bin ;; + esac +done +cd $ROOT_BUILDDIR + +AC_SUBST_FILE(ENVSCRIPT) ENVSCRIPT=salome_adm/unix/envScript + +dnl copy xml files to the build tree (lib directory) +dnl pourquoi ???? + +#cd lib +#for i in `find $ROOT_SRCDIR -name "*.xml" -print` +#do +# ln -fs $i +# echo `echo $i | sed -e "s,$ROOT_SRCDIR,.,"` +#done +#cd $ROOT_BUILDDIR + + +echo +echo --------------------------------------------- +echo generating Makefiles and configure files +echo --------------------------------------------- +echo + +AC_OUTPUT_COMMANDS([ \ + chmod +x ./bin/* \ +]) + +## do not delete this line diff --git a/idl/AddComponent.idl b/idl/AddComponent.idl new file mode 100644 index 0000000..08b8ab3 --- /dev/null +++ b/idl/AddComponent.idl @@ -0,0 +1,51 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : AddComponent.idl +// Author : +// $Header$ + +#ifndef _ADDCOMPONENT_IDL +#define _ADDCOMPONENT_IDL + +#include "SALOME_Component.idl" + +module SuperVisionTest { + + interface Adder ; + + interface AddComponent : Engines::Component { + Adder Addition() ; + double Add( in double x , in double y , out double z ) ; + double LastResult() ; + }; + + interface Adder : Engines::Component { + double Add( in double x , in double y , out double z ) ; + double AddAndCompare( in double x , in double y , in Adder anOtherAdder, + out double z ) ; + void SetLastResult( in double z ) ; + void LastResult( out double z ) ; + }; + +} ; + +#endif diff --git a/idl/DivComponent.idl b/idl/DivComponent.idl new file mode 100644 index 0000000..c7a83d7 --- /dev/null +++ b/idl/DivComponent.idl @@ -0,0 +1,39 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : DivComponent.idl +// Author : +// $Header$ + +#ifndef _DIVCOMPONENT_IDL +#define _DIVCOMPONENT_IDL + +#include "SALOME_Component.idl" + +module SuperVisionTest { + + interface DivComponent : Engines::Component { + void Div( in double x , in double y , out double z ) ; + }; +}; + + +#endif diff --git a/idl/FactorialComponent.idl b/idl/FactorialComponent.idl new file mode 100644 index 0000000..6ac4439 --- /dev/null +++ b/idl/FactorialComponent.idl @@ -0,0 +1,34 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : FactorialComponent.idl +// Author : +// $Header$ + +#include "SALOME_Component.idl" + +module SuperVisionTest { + + interface FactorialComponent : Engines::Component { + long eval(in long n); + }; + +}; diff --git a/idl/Makefile.in b/idl/Makefile.in new file mode 100644 index 0000000..2804cd3 --- /dev/null +++ b/idl/Makefile.in @@ -0,0 +1,71 @@ +# +# generate dependencies for idl file : +# + +# source path +top_srcdir=@top_srcdir@ +top_builddir=.. +srcdir=@srcdir@ +VPATH=.:$(srcdir):${KERNEL_ROOT_DIR}/idl/salome + +@COMMENCE@ + +IDL_FILES = \ + AddComponent.idl \ + MulComponent.idl \ + SyrControlComponent.idl \ + DivComponent.idl \ + SubComponent.idl \ + FactorialComponent.idl \ + SyrComponent.idl + +PY_CLIENT_IDL = $(IDL_FILES) + +# we copy all idl file in $(top_builddir)/idl +inc: $(IDL_FILES:%=$(top_builddir)/idl/%) + +$(IDL_FILES:%=$(top_builddir)/idl/%):$(top_builddir)/idl/%:% +# $(CP) $< $@ + cp -f $< $@ + + +lib: pyidl + +PYTHON_BUILD_SITE=$(top_builddir)/lib/python$(PYTHON_VERSION)/site-packages/@PACKAGE@ + +pyidl: $(PYTHON_BUILD_SITE) $(IDL_FILES:%.idl=$(PYTHON_BUILD_SITE)/%_idl.py) + +$(PYTHON_BUILD_SITE): + $(INSTALL) -d $@ + +$(PYTHON_BUILD_SITE)/%_idl.py: %.idl + $(OMNIORB_IDL) $(OMNIORB_IDLPYFLAGS) -C$(PYTHON_BUILD_SITE) $< + + +# install python client (generated from idl file +install: install-pyidl install-idl + +# create directory $(idldir) and copy idl files into it +install-idl: $(IDL_FILES) + $(INSTALL) -d $(idldir) + $(INSTALL_DATA) $^ $(idldir) + + +install-pyidl: $(IDL_FILES) + $(INSTALL) -d $(PYTHON_SITE_INSTALL) + @for file in $^ dummy; do \ + if [ $$file != "dummy" ]; then \ + $(OMNIORB_IDL) $(OMNIORB_IDLPYFLAGS) -C$(PYTHON_SITE_INSTALL) $$file ; \ + fi ; \ + done ; + +#@ CONCLUDE @ + +cleandep: + -$(RM) .dep* + +distclean: + -$(RM) *.py + -$(RM) $(IDL_FILES:%=$(top_builddir)/idl/%) + -$(RM) Makefile + diff --git a/idl/MulComponent.idl b/idl/MulComponent.idl new file mode 100644 index 0000000..eda62ce --- /dev/null +++ b/idl/MulComponent.idl @@ -0,0 +1,39 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : MulComponent.idl +// Author : +// $Header$ + +#ifndef _MULCOMPONENT_IDL +#define _MULCOMPONENT_IDL + +#include "SALOME_Component.idl" + +module SuperVisionTest { + + interface MulComponent : Engines::Component { + void Mul( in double x , in double y , out double z ) ; + } ; +}; + + +#endif diff --git a/idl/SubComponent.idl b/idl/SubComponent.idl new file mode 100644 index 0000000..6f2295e --- /dev/null +++ b/idl/SubComponent.idl @@ -0,0 +1,39 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SubComponent.idl +// Author : +// $Header$ + +#ifndef _SUBCOMPONENT_IDL +#define _SUBCOMPONENT_IDL + +#include "SALOME_Component.idl" + +module SuperVisionTest { + + interface SubComponent : Engines::Component { + void Sub( in double x , in double y , out double z ) ; + } ; +}; + + +#endif diff --git a/idl/SyrComponent.idl b/idl/SyrComponent.idl new file mode 100755 index 0000000..aaa3335 --- /dev/null +++ b/idl/SyrComponent.idl @@ -0,0 +1,77 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SyrComponent.idl +// Author : +// $Header$ + +#ifndef _SYRCOMPONENT_IDL +#define _SYRCOMPONENT_IDL + +#include "SALOME_Component.idl" + +module SuperVisionTest { + + typedef sequence SeqOfSyr ; + + interface ListOfSyr ; + + interface Syr ; + + interface SyrComponent : Engines::Component { + + long C_ISEVEN( in long anInteger ) ; + long C_ISONE( in long anOddInteger ) ; + long C_M3( in long anOddInteger ) ; + long C_M3P1( in long anOddInteger ) ; + long C_DIV2( in long anEvenInteger ) ; + long C_INCR( in long aCount ) ; + long C_MIN( in long aMinVal , in long anInteger ) ; + long C_MAX( in long aMaxVal , in long anInteger ) ; + ListOfSyr C_LISTOFSYR() ; + ListOfSyr C_AVERAGE( in ListOfSyr aListOfSyr , in long anInteger , + in long aCount , out double anAverage ) ; + + Syr Init( in long anOddInteger ) ; + + }; + + interface ListOfSyr : Engines::Component { + SuperVisionTest::SeqOfSyr GetSeqOfSyr() ; + void SetSeqOfSyr( in SuperVisionTest::SeqOfSyr aSeqOfSyr ) ; + }; + + interface Syr : SyrComponent { + + long Initial() ; + long Current() ; + long IsEven() ; + long IsOne() ; + long Count() ; + void M3p1() ; + void Div2() ; + void Incr() ; + + }; + +} ; + +#endif diff --git a/idl/SyrControlComponent.idl b/idl/SyrControlComponent.idl new file mode 100644 index 0000000..cca1589 --- /dev/null +++ b/idl/SyrControlComponent.idl @@ -0,0 +1,39 @@ +// Copyright (C) 2003 CEA/DEN, EDF R&D +// +// +// +// File : SyrControlComponent.idl +// Author : Jean Rahuel +// $Header: + +#ifndef _SYRCONTROLCOMPONENT_IDL +#define _SYRCONTROLCOMPONENT_IDL + +#include "SALOME_Component.idl" + +module SuperVisionTest { + + interface SyrControlComponent : Engines::Component { + + void L_OneEven( in long ValOne , in long ValEven , + out long Finished , out long Incr , + out long Even , out long Odd ) ; + + void C_NotOneIsEven( out long ValOne , out long ValEven ) ; + + void LOOPN( in long InLoop , in long NN , in long KK , + in long min , in long max , + out long OutLoop , out long N , out long K ) ; + + void WHILENOTONE( in long N , out long OutLoop ) ; + + void IFNOTEVEN( in long N , out long Odd , out long Even ) ; + + void LOOPi( in long InLoop , in long ii , out long OutLoop , out long i ) ; + + void WHILEEVEN( in long N , out long OutLoop ) ; + + }; + +}; +#endif diff --git a/resources/COMPONENTCatalog.xml b/resources/COMPONENTCatalog.xml new file mode 100644 index 0000000..390ab78 --- /dev/null +++ b/resources/COMPONENTCatalog.xml @@ -0,0 +1,1076 @@ + + + + + + + + + + + + + + + AddComponent + AddComponent + SuperVisionTest + MTJ + 1.0 + Test SuperVision SALOME/src/SALOME_SWIG/supervisionexample[1].py + 0 + + + AddComponent + + ... + + + + + Addition + MTJ + 1.0 + Floating add + 1 + + + + + + SuperVisionTest::Adder + Adder + Adder object + + + + + + Add + MTJ + 1.0 + Floating add + 1 + + + + double + x + First number + + + double + y + Second number + + + + + double + FuncValue + Substract result + + + double + z + Addition result + + + + + Sigma + JR + 1.0 + Sigma + 0 + + + + long + n + + + + + + long + f + result n(n+1)/2 + + + + + Adder + + ... + + + + + Add + MTJ + 1.0 + Floating add + 1 + + + + SuperVisionTest::Adder + Adder + Adder Object + + + double + x + First number + + + double + y + Second number + + + + + double + FuncValue + Substract result + + + double + z + Addition result + + + + + + AddAndCompare + MTJ + 1.0 + Floating add + 1 + + + + SuperVisionTest::Adder + Adder + Adder Object + + + double + x + First number + + + double + y + Second number + + + SuperVisionTest::Adder + anOtherAdder + Adder Object + + + + + double + FuncValue + Substract result + + + double + z + Addition result + + + + + + SetLastResult + MTJ + 1.0 + set the last result field + 1 + + + + SuperVisionTest::Adder + Adder + Adder Object + + + double + z + number + + + + + + + + LastResult + MTJ + 1.0 + get the last result field + 1 + + + + SuperVisionTest::Adder + Adder + Adder Object + + + + + double + z + number + + + + + + + + + + SubComponent + SubComponent + SuperVisionTest + MTJ + 1.0 + Test SuperVision SALOME/src/SALOME_SWIG/supervisionexample[1].py + 0 + + + SubComponent + - ... + + + + + Sub + MTJ + 1.0 + Floating substract + 1 + + + + double + x + First number + + + double + y + Second number + + + + + double + z + Substraction result + + + + + + + + + + MulComponent + MulComponent + SuperVisionTest + MTJ + 1.0 + Test SuperVision SALOME/src/SALOME_SWIG/supervisionexample[1].py + 0 + + + MulComponent + * ... + + + + + Mul + MTJ + 1.0 + Float multiply + 1 + + + + double + x + First number + + + double + y + Second number + + + + + double + z + Multiplication result + + + + + + + + + + DivComponent + DivComponent + SuperVisionTest + MTJ + 1.0 + Test SuperVision SALOME/src/SALOME_SWIG/supervisionexample[1].py + 0 + + + DivComponent + / ... + + + + + Div + MTJ + 1.0 + Floating divide + 1 + + + + double + x + First number + + + double + y + Second number + + + + + double + z + Division result + + + + + + + + + SyrComponent + SyrComponent + SuperVisionTest + JR + + SuperVisionTest + 1 + + + + SyrComponent + + + + C_ISEVEN + + + + 0 + + + long + anInteger + + + + + + long + BoolEven + + + + + + C_ISONE + + + + 0 + + + long + anInteger + + + + + + long + BoolOne + + + + + + C_M3 + + + + 0 + + + long + anOddInteger + + + + + + long + anInteger + + + + + + C_M3P1 + + + + 0 + + + long + anOddInteger + + + + + + long + anEvenInteger + + + + + + C_DIV2 + + + + 0 + + + long + anEvenInteger + + + + + + long + anInteger + + + + + + C_INCR + + + + 0 + + + long + aCount + + + + + + long + aNewCount + + + + + + C_MIN + + + + 0 + + + long + aMinVal + + + + long + anInteger + + + + + + long + aNewMinVal + + + + + + C_MAX + + + + 0 + + + long + aMaxVal + + + + long + anInteger + + + + + + long + aNewMaxVal + + + + + + C_LISTOFSYR + + + + 0 + + + + + ListOfSyr + aListOfSyr + + + + + + C_AVERAGE + + + + 0 + + + ListOfSyr + aListOfSyr + + + + long + anInteger + + + + long + aCount + + + + + + ListOfSyr + aNewListOfSyr + + + + double + anAverage + + + + + + Init + + + + 0 + + + long + anOddInteger + + + + + + Syr + aSyracuse + + + + + + Syr + + + + Count + + + + 0 + + + Syr + aSyracuse + + + + + + long + aCount + + + + + + Current + + + + 0 + + + Syr + aSyracuse + + + + + + long + aCurrent + + + + + + IsEven + + + + 0 + + + Syr + aSyracuse + + + + + + long + BoolEven + + + + + + IsOne + + + + 0 + + + Syr + aSyracuse + + + + + + long + BoolOne + + + + + + M3p1 + + + + 0 + + + Syr + aSyracuse + + + + + + + + Div2 + + + + 0 + + + Syr + aSyracuse + + + + + + + + Incr + + + + 0 + + + Syr + aSyracuse + + + + + + + + + + + + + FactorialComponent + FactorialComponent + SuperVisionTest + Malvagi, Tajchman + 1.0 + Factorial + 0 + + + FactorialComponent + No comment + + + + + eval + MT-FM + 1.0 + Factorial + 1 + + + + long + n + + + + + + long + f + result + + + + + sigma + JR + 1.0 + Sigma + 0 + + + + long + n + + + + + + long + f + result + + + + + + + + + SyrControlComponent + SyrControlComponent + SuperVisionTest + JR + + SuperVisionTest + 1 + + + + SyrControlComponent + + + + L_OneEven + + + + 0 + + + long + ValOne + + + + long + ValEven + + + + + + long + Finished + + + + long + Incr + + + + long + Even + + + + long + Odd + + + + + + C_NotOneIsEven + + + + 0 + + + + long + ValOne + + + + long + ValEven + + + + + + LOOPN + + + + 0 + + + long + InLoop + + + + long + NN + + + + long + KK + + + + long + min + + + + long + max + + + + + + long + OutLoop + + + + long + N + + + + long + K + + + + + + WHILENOTONE + + + + 0 + + + long + N + + + + + + long + OutLoop + + + + + + IFNOTEVEN + + + + 0 + + + long + N + + + + + + long + Odd + + + + long + Even + + + + + + LOOPi + + + + 0 + + + long + InLoop + + + + long + ii + + + + + + long + OutLoop + + + + long + i + + + + + + WHILEEVEN + + + + 0 + + + long + N + + + + + + long + OutLoop + + + + + + + + + diff --git a/src/AddComponent/AddComponent_CheckOfUndefined.cxx b/src/AddComponent/AddComponent_CheckOfUndefined.cxx new file mode 100644 index 0000000..cdda5b5 --- /dev/null +++ b/src/AddComponent/AddComponent_CheckOfUndefined.cxx @@ -0,0 +1,37 @@ +// SuperVisionTest AddComponent : example of component that adds two numbers +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : AddComponent_CheckOfUndefined.cxx +// Module : SuperVisionTest + +using namespace std; +#include +#include +#include + +#include "AddComponent_Impl.hxx" + +int main(int argc, char **argv) { + return 0; +} + diff --git a/src/AddComponent/AddComponent_Impl.cxx b/src/AddComponent/AddComponent_Impl.cxx new file mode 100644 index 0000000..491e79b --- /dev/null +++ b/src/AddComponent/AddComponent_Impl.cxx @@ -0,0 +1,227 @@ +// SuperVisionTest AddComponent : example of component that adds two numbers +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : AddComponent_Impl.cxx +// Author : Jean Rahuel, CEA +// Module : SuperVisionTest + +using namespace std; +#include +#include +#include +#include +#include + +//#include "utilities.h" + +#include "AddComponent_Impl.hxx" +#include "Adder_Impl.hxx" + +AddComponent_Impl::AddComponent_Impl( 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,true) { + MESSAGE("AddComponent_Impl::AddComponent_Impl this " << hex << this << dec + << "activate object instanceName(" + << instanceName << ") interfaceName(" << interfaceName << ")" ) + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + LastAddition = 0 ; +} + +AddComponent_Impl::AddComponent_Impl() { + LastAddition = 0 ; +} + +AddComponent_Impl::~AddComponent_Impl() { +} + +SuperVisionTest::Adder_ptr AddComponent_Impl::Addition() { + beginService( "AddComponent_Impl::Addition" ); + sendMessage(NOTIF_STEP, "AddComponent_Impl creates Adder_Impl"); + Adder_Impl * myAdder ; + myAdder = new Adder_Impl( _orb , _poa, _contId, + instanceName() , interfaceName() , + graphName() , nodeName() ) ; + SuperVisionTest::Adder_var iobject ; + PortableServer::ObjectId * id = myAdder->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = SuperVisionTest::Adder::_narrow(obj) ; + endService( "AddComponent_Impl::Addition" ); + return SuperVisionTest::Adder::_duplicate(iobject) ; +} + +double AddComponent_Impl::Add( double x , double y , double & z ) { + beginService( " AddComponent_Impl::Add" ); + z = x + y ; + int S; + + sendMessage(NOTIF_STEP, "AddComponent_Impl::Add is Computing"); + S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); + sleep(S); + MESSAGE( "AddComponent_Impl::Add( " << x << " , " << y << " , " << z + << " ) returns " << (x - y) << " after " << S << " seconds" ) + LastAddition = z ; + endService( " AddComponent_Impl::Add" ); + return (x - y) ; +} + +long AddComponent_Impl::Sigma( long n ) { + long sigma = 0 ; + int i , j ; + beginService( " AddComponent_Impl::Sigma" ); + for ( j = 0 ; j < 1000000 ; j++ ) { + sigma = 0 ; + for ( i = 1 ; i <= n ; i++ ) { + sigma = sigma + i ; + } + } + endService( " AddComponent_Impl::Sigma" ); + return sigma ; +} + +double AddComponent_Impl::LastResult() { + beginService( " AddComponent_Impl::LastResult" ); + sendMessage(NOTIF_STEP, "AddComponent_Impl::LastResult is Computing"); + int S; + S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); + sleep(S); + endService( " AddComponent_Impl::LastResult" ); + return LastAddition ; +} + +extern "C" +{ + PortableServer::ObjectId * AddComponentEngine_factory + (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) + { + MESSAGE("AddComponentEngine_factory AddComponentEngine (" + << instanceName << "," << interfaceName << "," << getpid() << ")"); + AddComponent_Impl * myAddComponent + = new AddComponent_Impl(orb, poa, contId, instanceName, interfaceName); + return myAddComponent->getId() ; + } +} + +Adder_Impl::Adder_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char * instanceName , + const char * interfaceName , + const char * graphName , + const char * nodeName ) : + Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,true) { + Names( graphName , nodeName ) ; + MESSAGE("Adder_Impl::Adder_Impl activate object instanceName(" + << instanceName << ") interfaceName(" << interfaceName << ") --> " + << hex << (void *) this << dec ) + beginService( "Adder_Impl::Adder_Impl" ); + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + LastAddition = 0 ; + sendMessage(NOTIF_STEP, "Adder_Impl is Created"); + endService( "Adder_Impl::Adder_Impl" ); +} + +Adder_Impl::Adder_Impl() { + LastAddition = 0 ; +} + +Adder_Impl::~Adder_Impl() { + beginService( "Adder_Impl::~Adder_Impl" ); + endService( "Adder_Impl::~Adder_Impl" ); +} + +double Adder_Impl::Add( double x , double y , double & z ) { + beginService( " Adder_Impl::Add" ); + z = x + y ; + int S; + + sendMessage(NOTIF_STEP, "Adder_Impl::Add is Computing"); + S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); + sleep(S); + MESSAGE( "Adder_Impl::Add( " << x << " , " << y << " , " << z + << " ) returns " << -(x - y) << " after " << S << " seconds" ) + LastAddition = z ; + endService( " Adder_Impl::Add" ); + return -(x - y) ; +} + +double Adder_Impl::AddAndCompare( const double x , const double y , + const SuperVisionTest::Adder_ptr anOtherAdder , + double & z ) { + beginService( " Adder_Impl::AddAndCompare" ); + z = x + y ; + int S; + + sendMessage(NOTIF_STEP, "Adder_Impl::AddAndCompare is Computing"); + S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); + sleep(S); + MESSAGE( "Adder_Impl::AddAndCompare( " << x << " , " << y << " , " << z + << " ) returns " << -(x - y) << " after " << S << " seconds" ) + LastAddition = z ; + double ValFunc ; + sendMessage(NOTIF_TRACE, "Adder_Impl::AddAndCompare will call anOtherAdder->LastValue()"); + double RetVal ; + anOtherAdder->LastResult( RetVal ) ; + if ( RetVal > 0 ) { + ValFunc = (x - y) ; + } + else { + ValFunc = -(x - y) ; + } + sendMessage(NOTIF_TRACE, "Adder_Impl::AddAndCompare has called anOtherAdder->LastValue()"); + sendMessage(NOTIF_STEP, "Adder_Impl::AddAndCompare is Finished"); + endService( " Adder_Impl::AddAndCompare" ); + return ValFunc ; +} + +void Adder_Impl::SetLastResult( double z ) { + beginService( " Adder_Impl::SetLastResult" ); + sendMessage(NOTIF_STEP, "Adder_Impl::SetLastResult is Computing"); + int S; + S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); + sleep(S); + LastAddition = z ; + endService( " Adder_Impl::SetLastResult" ); + return ; +} + +void Adder_Impl::LastResult( double & z ) { + beginService( " Adder_Impl::LastResult" ); + sendMessage(NOTIF_STEP, "Adder_Impl::LastResult is Computing"); + int S; + S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); + sleep(S); + z = LastAddition ; + endService( " Adder_Impl::LastResult" ); + return ; +} + + diff --git a/src/AddComponent/AddComponent_Impl.hxx b/src/AddComponent/AddComponent_Impl.hxx new file mode 100644 index 0000000..b2c5305 --- /dev/null +++ b/src/AddComponent/AddComponent_Impl.hxx @@ -0,0 +1,72 @@ +// SuperVisionTest AddComponent : example of component that adds two numbers +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : AddComponent_Impl.hxx +// Author : Jean Rahuel, CEA +// Module : SuperVisionTest +// $Header: + +#ifndef _ADDINTERFACE_IMPL_HXX_ +#define _ADDINTERFACE_IMPL_HXX_ + +//#include +#include +#include CORBA_SERVER_HEADER(AddComponent) +#include CORBA_SERVER_HEADER(SALOME_Component) +#include "SALOME_Component_i.hxx" + +class AddComponent_Impl : public POA_SuperVisionTest::AddComponent , + public Engines_Component_i { +public: + AddComponent_Impl() ; + AddComponent_Impl( CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName); + + virtual ~AddComponent_Impl(); + + virtual SuperVisionTest::Adder_ptr Addition() ; + + virtual double Add( double x , double y , double & z ) ; + + virtual long Sigma( long n ) ; + + virtual double LastResult() ; + +private: + + double LastAddition ; + +}; + +extern "C" + PortableServer::ObjectId * AddComponentEngine_factory + ( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName ) ; + +#endif diff --git a/src/AddComponent/Adder_Impl.hxx b/src/AddComponent/Adder_Impl.hxx new file mode 100644 index 0000000..078414e --- /dev/null +++ b/src/AddComponent/Adder_Impl.hxx @@ -0,0 +1,68 @@ +// SuperVisionTest AddComponent : example of component that adds two numbers +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : Adder_Impl.hxx +// Author : Jean Rahuel, CEA +// Module : SuperVisionTest +// $Header: + +#ifndef _ADDER_IMPL_HXX_ +#define _ADDER_IMPL_HXX_ + +#include +#include +#include CORBA_SERVER_HEADER(AddComponent) +#include CORBA_SERVER_HEADER(SALOME_Component) +#include "SALOME_Component_i.hxx" + +class Adder_Impl : public POA_SuperVisionTest::Adder , + public Engines_Component_i { +public: + Adder_Impl() ; + Adder_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + const char * graphName , + const char * nodeName ); + + virtual ~Adder_Impl(); + + virtual double Add( double x , double y , double & z ) ; + + virtual double AddAndCompare( const double x , const double y , + const SuperVisionTest::Adder_ptr anOtherAdder , + double & z ) ; + + virtual void SetLastResult( double z ) ; + + virtual void LastResult( double & z ) ; + +private: + + double LastAddition ; + +}; + +#endif diff --git a/src/AddComponent/Makefile.in b/src/AddComponent/Makefile.in new file mode 100755 index 0000000..9938441 --- /dev/null +++ b/src/AddComponent/Makefile.in @@ -0,0 +1,61 @@ +# SuperVisionTest AddComponent : example of component that adds two numbers +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# +# +# File : Makefile.in +# Author : , CEA +# Module : SuperVisionTest +# $Header$ + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +EXPORT_HEADERS = \ + AddComponent_Impl.hxx \ + Adder_Impl.hxx + +# Libraries targets +LIB = libAddComponentEngine.la +LIB_SRC = \ + AddComponent_Impl.cxx + +LIB_SERVER_IDL = SALOME_Component.idl \ + AddComponent.idl + +# Executables targets +BIN = AddComponent_CheckOfUndefined +BIN_SRC = +BIN_SERVER_IDL = + +CPPFLAGS+= $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ $(PYTHON_INCLUDES) -ftemplate-depth-42 -Wall -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS+= -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeContainer -lSalomeNS -lOpUtil -lRegistry -lSalomeNotification -lSalomeLoggerServer + +LDFLAGSFORBIN+= -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeContainer -lSalomeNS -lOpUtil -lRegistry -lSalomeNotification -lSalomeLoggerServer + +@CONCLUDE@ + diff --git a/src/DivComponent/DivComponent.cxx b/src/DivComponent/DivComponent.cxx new file mode 100644 index 0000000..4a4522f --- /dev/null +++ b/src/DivComponent/DivComponent.cxx @@ -0,0 +1,91 @@ +// SuperVisionTest DivComponent : example of component that devides two numbers +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : DivComponentEngine.cxx +// Author : MARC TAJCHMAN, CEA +// Module : SuperVisionTest + +using namespace std; +#include +#include +#include +#include +#include + +//#include "utilities.h" +#include "DivComponent.hxx" + +DivComponentEngine::DivComponentEngine( 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,true) +{ +// MESSAGE("DivComponentEngine::DivComponentEngine activate object instanceName(" +// << instanceName << ") interfaceName(" << interfaceName << ")" ) + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + _nexec = 0 ; +} + +DivComponentEngine::DivComponentEngine() +{ +} + +DivComponentEngine::~DivComponentEngine() +{ +} + +void DivComponentEngine::Div( double x , double y , double & z ) { + beginService( " DivComponentEngine::Div" ); + z = x / y ; + int S; + + sendMessage(NOTIF_STEP, "Div is Computing"); + S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); + sleep(S); + sendMessage(NOTIF_TRACE, "Div is Much More Difficult Operation"); + MESSAGE("DivComponentEngine::Div( " << x << " , " << y << " , " << z + << " ) after " << S << " seconds" ) + endService( " DivComponentEngine::Div" ); +} + +extern "C" +{ + PortableServer::ObjectId * DivComponentEngine_factory + (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) + { + MESSAGE("DivComponentEngine_factory DivComponentEngine (" + << instanceName << "," << interfaceName << ")"); + DivComponentEngine * myDivComponent + = new DivComponentEngine(orb, poa, contId, instanceName, interfaceName); + return myDivComponent->getId() ; + } +} + + diff --git a/src/DivComponent/DivComponent.hxx b/src/DivComponent/DivComponent.hxx new file mode 100644 index 0000000..4b3ba95 --- /dev/null +++ b/src/DivComponent/DivComponent.hxx @@ -0,0 +1,66 @@ +// SuperVisionTest DivComponent : example of component that devides two numbers +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : DivComponentEngine.hxx +// Author : MARC TAJCHMAN, CEA +// Module : SuperVisionTest +// $Header$ + +#ifndef _DIVCOMPONENTENGINE_HXX_ +#define _DIVCOMPONENTENGINE_HXX_ + +//#include +#include +#include CORBA_SERVER_HEADER(DivComponent) +#include CORBA_SERVER_HEADER(SALOME_Component) +#include "SALOME_Component_i.hxx" + +class DivComponentEngine : public POA_SuperVisionTest::DivComponent , + public Engines_Component_i { +public: + DivComponentEngine() ; + DivComponentEngine( CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName); + + virtual ~DivComponentEngine(); + + void Div( double x , double y , double & z ) ; + +private: + + int _nexec ; + +}; + +extern "C" + PortableServer::ObjectId * DivComponentEngine_factory + ( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName ) ; + +#endif diff --git a/src/DivComponent/Makefile.in b/src/DivComponent/Makefile.in new file mode 100755 index 0000000..179ac1c --- /dev/null +++ b/src/DivComponent/Makefile.in @@ -0,0 +1,60 @@ +# SuperVisionTest DivComponent : example of component that devides two numbers +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# +# +# File : Makefile.in +# Author : , CEA +# Module : SuperVisionTest +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +EXPORT_HEADERS = \ + DivComponent.hxx + +# Libraries targets +LIB = libDivComponentEngine.la +LIB_SRC = \ + DivComponent.cxx + +LIB_SERVER_IDL = SALOME_Component.idl \ + DivComponent.idl + +# Executables targets +BIN = +BIN_SRC = +BIN_SERVER_IDL = + +CPPFLAGS+= $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +#CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ $(PYTHON_INCLUDES) -ftemplate-depth-42 -Wno-deprecated +CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ $(PYTHON_INCLUDES) -ftemplate-depth-42 -Wall -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS+= -lSalomeContainer -lSalomeNS -lOpUtil -lRegistry -lSalomeNotification -L${KERNEL_ROOT_DIR}/lib/salome + + +@CONCLUDE@ + diff --git a/src/FactorialComponent/FactorialComponent.py b/src/FactorialComponent/FactorialComponent.py new file mode 100644 index 0000000..74ab0db --- /dev/null +++ b/src/FactorialComponent/FactorialComponent.py @@ -0,0 +1,79 @@ +#! /usr/bin/env python +# +# SuperVisionTest FactorialComponent : example of component that calculates factorial +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# +# +# File : FactorialComponent.py +# Author : +# Module : SuperVisionTest +# $Header$ + +import sys +from omniORB import CORBA, PortableServer +import CosNaming +import Engines, Engines__POA +import SuperVisionTest, SuperVisionTest__POA +from SALOME_ComponentPy import * + +from FactorialComponent_idl import * + +class FactorialComponent( SuperVisionTest__POA.FactorialComponent, SALOME_ComponentPy_i): + + def eval(self, val): + self.beginService( 'FactorialComponent eval' ) + print "eval :",val + if (val < 0): + raise ArgumentError("factorial must be positive, not " + `val`) + if (val < 2): + print "eval return",val + self.sendMessage( NOTIF_STEP , "Done" ) + self.endService( 'FactorialComponent eval' ) + return val + else: + val1 = self.eval(val-1) + self.sendMessage( NOTIF_TRACE , "One More Time" ) + print "eval return",val," * ",val1 + return val * val1 + + def sigma(self, val): + self.beginService( 'FactorialComponent sigma' ) + print "sigma :",val + if (val < 0): + raise ArgumentError("sigma must be positive, not " + `val`) + i = 0 + while i < 10000 : + n = 1 + s = 0 + while n <= val : + s = s + n + n = n + 1 + i = i + 1 + print "sigma returns",s + self.endService( 'FactorialComponent sigma' ) + return s + + def __init__(self, orb, poa, this, containerName, instanceName, interfaceName): + SALOME_ComponentPy_i.__init__(self, orb, poa, this, containerName, + instanceName, interfaceName, 0) + print "FactorialComponent::__init__" + diff --git a/src/FactorialComponent/Makefile.in b/src/FactorialComponent/Makefile.in new file mode 100644 index 0000000..e76d7dc --- /dev/null +++ b/src/FactorialComponent/Makefile.in @@ -0,0 +1,51 @@ +# SuperVisionTest FactorialComponent : example of component that calculates factorial +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# +# +# File : Makefile.in +# Author : Fausto MALVAGI - Marc TAJCHMAN +# Module : SuperVisionTest +# $Header$ + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + +@COMMENCE@ + +EXPORT_PYSCRIPTS = FactorialComponent.py + +# Libraries targets + +LIB = +LIB_SRC = +LIB_CLIENT_IDL = + +# Executables targets +BIN = +BIN_SRC = + +LDFLAGS+= + + +@CONCLUDE@ diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100755 index 0000000..ba8d9f4 --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,37 @@ +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# +# +# File : Makefile.in +# Author : Patrick GOLDBRONN (CEA) +# Module : SuperVisionTest +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ + + +@COMMENCE@ + +SUBDIRS = AddComponent DivComponent FactorialComponent MulComponent SubComponent SyrComponent SyrControlComponent + +@MODULE@ diff --git a/src/MulComponent/Makefile.in b/src/MulComponent/Makefile.in new file mode 100755 index 0000000..3f65435 --- /dev/null +++ b/src/MulComponent/Makefile.in @@ -0,0 +1,60 @@ +# SuperVisionTest MulComponent : example of component that multiplies two numbers +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# +# +# File : Makefile.in +# Author : , CEA +# Module : SuperVisionTest +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +EXPORT_HEADERS = \ + MulComponent.hxx + +# Libraries targets +LIB = libMulComponentEngine.la +LIB_SRC = \ + MulComponent.cxx + +LIB_SERVER_IDL = SALOME_Component.idl \ + MulComponent.idl + +# Executables targets +BIN = +BIN_SRC = +BIN_SERVER_IDL = + +CPPFLAGS+= $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +#CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ $(PYTHON_INCLUDES) -ftemplate-depth-42 -Wno-deprecated +CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ $(PYTHON_INCLUDES) -ftemplate-depth-42 -Wall -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS+= -lSalomeContainer -lSalomeNS -lOpUtil -lRegistry -lSalomeNotification -L${KERNEL_ROOT_DIR}/lib/salome + + +@CONCLUDE@ + diff --git a/src/MulComponent/MulComponent.cxx b/src/MulComponent/MulComponent.cxx new file mode 100644 index 0000000..1b4c41f --- /dev/null +++ b/src/MulComponent/MulComponent.cxx @@ -0,0 +1,90 @@ +// SuperVisionTest MulComponent : example of component that multiplies two numbers +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : MulComponentEngine.cxx +// Author : MARC TAJCHMAN, CEA +// Module : SuperVisionTest + +using namespace std; +#include +#include +#include +#include +#include + +//#include "utilities.h" +#include "MulComponent.hxx" + +MulComponentEngine::MulComponentEngine( 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,true) +{ +// MESSAGE("MulComponentEngine::MulComponentEngine activate object instanceName(" +// << instanceName << ") interfaceName(" << interfaceName << ")" ) + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + _nexec = 0 ; +} + +MulComponentEngine::MulComponentEngine() +{ +} + +MulComponentEngine::~MulComponentEngine() +{ +} + +void MulComponentEngine::Mul( double x , double y , double & z ) { + beginService( " MulComponentEngine::Mul" ); + z = x * y ; + int S; + + sendMessage(NOTIF_STEP, "Mul is Computing"); + S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); + sleep(S); + MESSAGE( "MulComponentEngine::Mul( " << x << " , " << y << " , " << z + << " ) after " << S << " seconds" ) + endService( " MulComponentEngine::Mul" ); +} + +extern "C" +{ + PortableServer::ObjectId * MulComponentEngine_factory + (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) + { + MESSAGE("MulComponentEngine_factory MulComponentEngine (" + << instanceName << "," << interfaceName << ")"); + MulComponentEngine * myMulComponent + = new MulComponentEngine(orb, poa, contId, instanceName, interfaceName); + return myMulComponent->getId() ; + } +} + + diff --git a/src/MulComponent/MulComponent.hxx b/src/MulComponent/MulComponent.hxx new file mode 100644 index 0000000..92506e2 --- /dev/null +++ b/src/MulComponent/MulComponent.hxx @@ -0,0 +1,66 @@ +// SuperVisionTest MulComponent : example of component that multiplies two numbers +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : MulComponentEngine.hxx +// Author : MARC TAJCHMAN, CEA +// Module : SuperVisionTest +// $Header$ + +#ifndef _MULCOMPONENTENGINE_HXX_ +#define _MULCOMPONENTENGINE_HXX_ + +//#include +#include +#include CORBA_SERVER_HEADER(MulComponent) +#include CORBA_SERVER_HEADER(SALOME_Component) +#include "SALOME_Component_i.hxx" + +class MulComponentEngine : public POA_SuperVisionTest::MulComponent , + public Engines_Component_i { +public: + MulComponentEngine() ; + MulComponentEngine( CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName); + + virtual ~MulComponentEngine(); + + void Mul( double x , double y , double & z ) ; + +private: + + int _nexec ; + +}; + +extern "C" + PortableServer::ObjectId * MulComponentEngine_factory + ( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName ) ; + +#endif diff --git a/src/SubComponent/Makefile.in b/src/SubComponent/Makefile.in new file mode 100755 index 0000000..93cbd88 --- /dev/null +++ b/src/SubComponent/Makefile.in @@ -0,0 +1,60 @@ +# SuperVisionTest SubComponent : example of component that sunstracts one number from another +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# +# +# File : Makefile.in +# Author : , CEA +# Module : SuperVisionTest +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +EXPORT_HEADERS = \ + SubComponent.hxx + +# Libraries targets +LIB = libSubComponentEngine.la +LIB_SRC = \ + SubComponent.cxx + +LIB_SERVER_IDL = SALOME_Component.idl \ + SubComponent.idl + +# Executables targets +BIN = +BIN_SRC = +BIN_SERVER_IDL = + +CPPFLAGS+= $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +#CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ $(PYTHON_INCLUDES) -ftemplate-depth-42 -Wno-deprecated +CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ $(PYTHON_INCLUDES) -ftemplate-depth-42 -Wall -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS+= -lSalomeContainer -lSalomeNS -lOpUtil -lRegistry -lSalomeNotification -L${KERNEL_ROOT_DIR}/lib/salome + + +@CONCLUDE@ + diff --git a/src/SubComponent/SubComponent.cxx b/src/SubComponent/SubComponent.cxx new file mode 100644 index 0000000..76ed6e1 --- /dev/null +++ b/src/SubComponent/SubComponent.cxx @@ -0,0 +1,90 @@ +// SuperVisionTest SubComponent : example of component that sunstracts one number from another +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SubComponentEngine.cxx +// Author : MARC TAJCHMAN, CEA +// Module : SuperVisionTest + +using namespace std; +#include +#include +#include +#include +#include + +//#include "utilities.h" +#include "SubComponent.hxx" + +SubComponentEngine::SubComponentEngine( 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,true) +{ +// MESSAGE("SubComponentEngine::SubComponentEngine activate object instanceName(" +// << instanceName << ") interfaceName(" << interfaceName << ")" ) + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + _nexec = 0 ; +} + +SubComponentEngine::SubComponentEngine() +{ +} + +SubComponentEngine::~SubComponentEngine() +{ +} + +void SubComponentEngine::Sub( double x , double y , double & z ) { + beginService( " SubComponentEngine::Sub" ); + z = x - y ; + int S; + + sendMessage(NOTIF_STEP, "Sub is Computing"); + S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); + sleep(S); + MESSAGE( "SubComponentEngine::Sub( " << x << " , " << y << " , " << z + << " ) after " << S << " seconds" ) + endService( " SubComponentEngine::Sub" ); +} + +extern "C" +{ + PortableServer::ObjectId * SubComponentEngine_factory + (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) + { + MESSAGE("SubComponentEngine_factory SubComponentEngine (" + << instanceName << "," << interfaceName << ")"); + SubComponentEngine * mySubComponent + = new SubComponentEngine(orb, poa, contId, instanceName, interfaceName); + return mySubComponent->getId() ; + } +} + + diff --git a/src/SubComponent/SubComponent.hxx b/src/SubComponent/SubComponent.hxx new file mode 100644 index 0000000..97dedcb --- /dev/null +++ b/src/SubComponent/SubComponent.hxx @@ -0,0 +1,66 @@ +// SuperVisionTest SubComponent : example of component that sunstracts one number from another +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SubComponentEngine.hxx +// Author : MARC TAJCHMAN, CEA +// Module : SuperVisionTest +// $Header$ + +#ifndef _SUBCOMPONENTENGINE_HXX_ +#define _SUBCOMPONENTENGINE_HXX_ + +//#include +#include +#include CORBA_SERVER_HEADER(SubComponent) +#include CORBA_SERVER_HEADER(SALOME_Component) +#include "SALOME_Component_i.hxx" + +class SubComponentEngine : public POA_SuperVisionTest::SubComponent , + public Engines_Component_i { +public: + SubComponentEngine() ; + SubComponentEngine( CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName); + + virtual ~SubComponentEngine(); + + void Sub( double x , double y , double & z ) ; + +private: + + int _nexec ; + +}; + +extern "C" + PortableServer::ObjectId * SubComponentEngine_factory + ( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName ) ; + +#endif diff --git a/src/SyrComponent/Makefile.in b/src/SyrComponent/Makefile.in new file mode 100755 index 0000000..9a9d84c --- /dev/null +++ b/src/SyrComponent/Makefile.in @@ -0,0 +1,61 @@ +# SuperVisionTest SyrComponent : example of component performing some mathinatical operations +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# +# +# File : Makefile.in +# Author : , CEA +# Module : SuperVisionTest +# $Header$ + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +EXPORT_HEADERS = \ + SyrComponent_Impl.hxx + +# Libraries targets +LIB = libSyrComponentEngine.la +LIB_SRC = \ + SyrComponent_Impl.cxx + +LIB_SERVER_IDL = SALOME_Component.idl \ + SyrComponent.idl + +# Executables targets +BIN = SyrComponent_CheckOfUndefined +BIN_SRC = +BIN_SERVER_IDL = + +CPPFLAGS+= $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +#CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ $(PYTHON_INCLUDES) -ftemplate-depth-42 -Wno-deprecated +CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ $(PYTHON_INCLUDES) -ftemplate-depth-42 -Wall -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS+= -lSalomeContainer -lSalomeNS -lOpUtil -lRegistry -lSalomeNotification -lSalomeLoggerServer -L${KERNEL_ROOT_DIR}/lib/salome + +LDFLAGSFORBIN+= -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeContainer -lSalomeNS -lOpUtil -lRegistry -lSalomeNotification -lSalomeLoggerServer + +@CONCLUDE@ + diff --git a/src/SyrComponent/SyrComponent_CheckOfUndefined.cxx b/src/SyrComponent/SyrComponent_CheckOfUndefined.cxx new file mode 100755 index 0000000..7142a33 --- /dev/null +++ b/src/SyrComponent/SyrComponent_CheckOfUndefined.cxx @@ -0,0 +1,1121 @@ +// SuperVisionTest SyrComponent : example of component performing some mathinatical operations +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SyrComponent_CheckOfUndefined.cxx +// Module : SuperVisionTest + +using namespace std; +#include +#include +#include +#include +#include +#include +#include + +// ------------------------------------------------------------------ +// NextPrime : Compute the first prime number greater or equal than an integer +// ------------------------------------------------------------------ + +#define VALUESNBR 4 + +long NextPrime (const long me ) +{ + + struct svalue {int signiaib ; + int nbr ;} ; + + struct svalue values[VALUESNBR] ; + long ia ; + long maxia ; + long ib[4] ; + int n[4] ; +// int signiaib[4] = { -1 , +1 , +1 , -1 } ; + int signiaib[4]; + signiaib[0] = -1; + signiaib[1] = 1; + signiaib[2] = 1; + signiaib[3] = -1; + long remain ; + + int nbvalues ; + int loop ; + int nindd ; + long minn ; + long maxvn ; + long premret = 0 ; + + if (me < 0 || me > +#ifdef DECOSF1 + 127149130704178201 +#else + 2147483647 +#endif + ){ +// Standard_RangeError:: +// Raise("Try to apply NextPrime method with negative, null or too large value."); + return 0 ; + } + + if ( me <= 7 ) { + if ( me <= 1 ) + return 1 ; + else if ( me <= 2 ) + return 2 ; + else if ( me <= 3 ) + return 3 ; + else if ( me <= 5 ) + return 5 ; + else if ( me <= 7 ) + return 7 ; + } + + minn = ( me - 1 ) / 6 ; // n minimum + while ( 6*minn+1 < me ) { + minn += 1 ; + } + + maxia = long( sqrt( (double)me ) / 6 + 1 ) ; + + maxvn = minn + VALUESNBR ; + + nbvalues = 0 ; + for ( nindd = 0 ; nindd < VALUESNBR ; nindd++ ) { + if ( 6*(nindd+minn)-1 < me ) { + values[nindd].nbr = 1 ; + values[nindd].signiaib = -1 ; + nbvalues += 1 ; + } + else { + values[nindd].nbr = 0 ; + values[nindd].signiaib = 0 ; + } + } + + for ( ia = 1 ; ia <= maxia ; ia++ ) { + if ( nbvalues == VALUESNBR*2 ) { + break ; + } + remain = -VALUESNBR ; + ib[0] = ( minn + ia - remain ) / (6*ia - 1) ; + n[0] = int ( 6*ia*ib[0] - ia - ib[0] - minn ) ; + ib[1] = ( minn - ia - remain ) / (6*ia - 1) ; + n[1] = int ( 6*ia*ib[1] + ia - ib[1] - minn ) ; + ib[2] = ( minn + ia - remain ) / (6*ia + 1) ; + n[2] = int ( 6*ia*ib[2] - ia + ib[2] - minn ) ; + ib[3] = ( minn - ia - remain ) / (6*ia + 1) ; + n[3] = int ( 6*ia*ib[3] + ia + ib[3] - minn ) ; + for ( loop = 0 ; loop < 4 ; loop++ ) { + if ( n[loop] >= 0 && n[loop] < VALUESNBR ) { + if ( ( values[n[loop]].nbr == 0 ) || + ( values[n[loop]].signiaib == signiaib[loop] ) ) { + values[n[loop]].signiaib = -signiaib[loop] ; + values[n[loop]].nbr += 1 ; + if ( values[n[loop]].nbr <= 2 ) + nbvalues += 1 ; + } + } + } + } + for ( nindd = 0 ; nindd < VALUESNBR ; nindd++ ) { + if ( values[nindd].nbr == 0 ) { + if ( me <= 6*(nindd+minn)-1 ) { + premret = 6*(nindd+minn)-1 ; + break ; + } + else if ( me <= 6*(nindd+minn)+1 ) { + premret = 6*(nindd+minn)+1 ; + break ; + } + } + else if ( values[nindd].nbr == 1 ) { + if ( values[nindd].signiaib > 0 ) { + if ( me <= 6*(nindd+minn)-1 ) { + premret = 6*(nindd+minn)-1 ; + break ; + } + } + else { + if ( me <= 6*(nindd+minn)+1 ) { + premret = 6*(nindd+minn)+1 ; + break ; + } + } + } + } + + if ( premret != 0 ) { + return premret ; + } + + return NextPrime ( 6*(maxvn-1)+2) ; + +} + +static char * base( int b , long n ) { + static char c[40] ; + char ccc[2] ; + int i = 39 ; + c[39] = '\0' ; + c[38] = '0' ; + if ( n ) { + while ( n ) { + i-- ; + sprintf( ccc ,"%d" , ( n % b ) ) ; + c[i] = ccc[0] ; + n = n / b ; + } + } + else + i = 38 ; + return &c[i] ; +} + +static char * B2( long n ) { + return base( 2 , n ) ; +} + +static char * B3( long n ) { + return base( 3 , n ) ; +} + +static char * B4( long n ) { + return base( 4 , n ) ; +} + +static char * B5( long n ) { + return base( 5 , n ) ; +} + +static char * B7( long n ) { + return base( 7 , n ) ; +} + +static char * B8( long n ) { + return base( 8 , n ) ; +} + +static long S( long f , long n ) { + int i ; + long res = 0 ; + for ( i = 0 ; i <= n ; i++ ) { + res += 1 << (f*i) ; + } + return res ; +} + +static long S2( long n ) { + return S( 2 , n ) ; +} + +static long S6( long n ) { + return S( 6 , n ) ; +} + +static long rP( long odd ) { + if ( (( odd - 1 ) % 6 ) == 0 ) + return 1 ; + if ( (( odd - 3 ) % 6 ) == 0 ) + return 3 ; + if ( (( odd - 5 ) % 6 ) == 0 ) + return 5 ; + return 0 ; +} +static long nP( long odd ) { + return ( odd / 6 ) ; +} + +static long rQ( long N ) { + if ( ( N & 7 ) == 5 ) { + return 5 ; + } + return ( N & 3 ) ; +} +static long nQ( long N ) { + if ( ( N & 3 ) == 3 ) { + return ( N / 4 ) ; + } + else { + return ( N / 8 ) ; + } +} + +static long rT( long N ) { + return ( nP( N ) % 3 ) ; +} +static long nT( long N ) { + return ( nP( N ) / 3 ) ; +} + +static char * fact( int n ) { + static char chn[132] ; + if ( n == 0 ) { + strcpy( chn , "0" ) ; + } + else if ( n == 1 ) { + strcpy( chn , "1" ) ; + } + else { + int pow2 = 0 ; + int pow3 = 0 ; + while ( (n & 1 ) == 0 ) { + pow2 += 1 ; + n = (n >> 1 ) ; + } + while ( ( n % 3 ) == 0 ) { + pow3 += 1 ; + n = n / 3 ; + } + int pos = 0 ; + if ( pow2 ) { + if ( pow2 == 1 ) { + sprintf( &chn[pos] , "%d" , 2 ) ; + } + else { + sprintf( &chn[pos] , "2**%d" , pow2 ) ; + } + pos = strlen( chn ) ; + } + if ( pow3 ) { + if ( pow2 ) { + strcat( chn , "*" ) ; + pos = strlen( chn ) ; + } + if ( pow3 == 1 ) { + sprintf( &chn[pos] , "%d" , 3 ) ; + } + else { + sprintf( &chn[pos] , "3**%d" , pow3 ) ; + } + pos = strlen( chn ) ; + } + if ( n != 1 ) { + if ( pow2 || pow3 ) { + sprintf( &chn[pos] , "*%d" , n ) ; + } + else { + sprintf( &chn[pos] , "%d" , n ) ; + } + } + } + return chn ; +} + +static long Next( const long prev , long &pow2 ) { + long next = ( 3*prev + 1 )/2 ; + pow2 = 1 ; + while ( ( next & 1 ) == 0 ) { + next = ( next >> 1 ) ; + pow2 += 1 ; + } + return next ; +} + +int T1a( int n0 , int n1 ) { + return (1<<(6*n1+2))*(3*n0+0) + (1<<(6*n1+1)) + S2(3*n1+0) ; +} +int T1b( int n0 , int n1 ) { + return (1<<(6*n1+6))*(3*n0+1) + (1<<(6*n1+5)) + S2(3*n1+2) ; +} +int T1c( int n0 , int n1 ) { + return (1<<(6*n1+4))*(3*n0+2) + (1<<(6*n1+3)) + S2(3*n1+1) ; +} +int T2a( int n0 , int n1 ) { + return (1<<(6*n1+7))*(3*n0+0) + S2(3*n1+2) ; +} +int T2b( int n0 , int n1 ) { + return (1<<(6*n1+3))*(3*n0+1) + S2(3*n1+0) ; +} +int T2c( int n0 , int n1 ) { + return (1<<(6*n1+5))*(3*n0+2) + S2(3*n1+1) ; +} + +int P1a1( int n0 , int n1 ) { + return (1<<(6*n1+4))*(3*n0+0) + (1<<(6*n1+3)) + S2(3*n1+1) ; +} +int P1a2( int n0 , int n1 ) { + return (1<<(6*n1+6))*(3*n0+0) + (1<<(6*n1+5)) + S2(3*n1+2) ; +} +int P1b1( int n0 , int n1 ) { + return (1<<(6*n1+2))*(3*n0+1) + (1<<(6*n1+1)) + S2(3*n1+0) ; +} +int P1b2( int n0 , int n1 ) { + return (1<<(6*n1+4))*(3*n0+1) + (1<<(6*n1+3)) + S2(3*n1+1) ; +} +int P1c1( int n0 , int n1 ) { + return (1<<(6*n1+2))*(3*n0+2) + (1<<(6*n1+1)) + S2(3*n1+0) ; +} +int P1c2( int n0 , int n1 ) { + return (1<<(6*n1+6))*(3*n0+2) + (1<<(6*n1+5)) + S2(3*n1+2) ; +} + +int P2a1( int n0 , int n1 ) { + return (1<<(6*n1+3))*(3*n0+0) + S2(3*n1+0) ; +} +int P2a2( int n0 , int n1 ) { + return (1<<(6*n1+5))*(3*n0+0) + S2(3*n1+1) ; +} +int P2b1( int n0 , int n1 ) { + return (1<<(6*n1+5))*(3*n0+1) + S2(3*n1+1) ; +} +int P2b2( int n0 , int n1 ) { + return (1<<(6*n1+7))*(3*n0+1) + S2(3*n1+2) ; +} +int P2c1( int n0 , int n1 ) { + return (1<<(6*n1+3))*(3*n0+2) + S2(3*n1+0) ; +} +int P2c2( int n0 , int n1 ) { + return (1<<(6*n1+7))*(3*n0+2) + S2(3*n1+2) ; +} + +typedef int (*fct)(int,int); + +ostream * _Trace ; + +void Compute( char * fctname , fct afct , int PT , int PP , int PPNext ) { + int n0 ; + int n1 ; + long value = 0 ; + long next = 0 ; + for ( n1 = 0 ; n1 <= 3 ; n1++ ) { + bool pn1 = true ; + for ( n0 = 0 ; n0 <= 500 && value < 3000 ; n0++ ) { + value = afct( n0 , n1 ) ; + long pow2 ; + next = Next( value , pow2 ) ; + long kp2 ; + if ( ( rP( value ) == 3 && rP( Next( next , kp2 ) ) == PPNext ) || + ( rT( value ) == PT && rP( value ) == PP && + rP( next ) == PPNext ) ) { + if ( rQ( value ) == 3 || + ( rQ( value ) == 1 && ( nQ( value ) & 1 ) == 0 ) ) { +// if ( pn1 ) { +// *_Trace << " n1 " << n1 ; +// *_Trace << " n0 " << n0 << " " ; +// pn1 = false ; +// } +// else { + if ( value < 10 ) + *_Trace << "000" ; + else if ( value < 100 ) + *_Trace << "00" ; + else if ( value < 1000 ) + *_Trace << "0" ; + *_Trace << value << " " ; + long lownext = (next-1)/4 ; + if ( 4*lownext+1 == next && ( lownext & 1 ) == 1 ) { + *_Trace << "---" ; + } + *_Trace << fctname << " n0 " << n0 << " " ; +// } + *_Trace << value << " = 6[3*" << nT( value ) << "+" + << rT( value ) << "]+" << rP( value ) << " --> " + << next << " (>>" << pow2 << ") = 6[3*" + << nT( next ) << "+" << rT( next ) + << "] + " << rP( next ) << endl ; + } +#if 0 + else { + if ( pn1 ) { + *_Trace << " n1 " << n1 ; + *_Trace << " n0 " << n0 << " " ; + pn1 = false ; + } + else { + *_Trace << " n0 " << n0 << " " ; + } + *_Trace << "---" << value << " = 6[3*" << nT( value ) << "+" + << rT( value ) << "]+" << rP( value ) << " = 4*[" + << "2*" << nQ( value )/2 << "+1]+1" ; + if ( Next( (value-1)/4 , kp2 ) != next ) + *_Trace << " " << Next( (value-1)/4 , kp2 ) << " != " << next ; + *_Trace << endl ; + } +#endif + } + } + value = 0 ; + } +} + +int SeqSyr( int n ) { + long pow2 ; + int nstep = 0 ; + int EQ ; + int r ; + int q ; + int Sr ; + int Sq ; + int nn = n ; + *_Trace << " " << n ; + while ( n != 1 ) { + n = Next( n , pow2 ) ; + nstep += 1 ; + int EQ ; + r = rQ( n ) ; + q = nQ( n ) ; + if ( r == 3 ) { + EQ = 4 ; + } + else { + EQ = 8 ; + } + if ( ( nstep % 2 ) == 0 ) { + *_Trace << endl << " " ; + } + Sr = rP( n ) ; + Sq = nP( n ) ; + *_Trace << " -> " << n << " = " << EQ << "*" << q << "+" << r + << " = 6*" << Sq << "+" << Sr ; + if ( r == 5 ) { + break ; + } + } + *_Trace << endl ; + if ( r == 5 && q > nn/8 ) { + return n ; + } + return 0 ; +} + +void little( int depth , int prt , int n , int r ) { + + int n0 ; + int r0 ; + int n1 ; + int r1 ; + int r2 ; + depth += 1 ; + + if ( depth == prt ) + *_Trace << endl << depth << " little2 n = " << n << " r = " << r << endl ; + + n0 = n*2 ; + r0 = r*2 - 1 ; + if ( ( r0 % 3 ) == 0 ) { + r1 = r0/3 ; + if ( depth == prt ) { + *_Trace << "n->3n " << n0 << "n + " << r1 << " = 4[ " + << n0/4 << "n + " << r1/4 << " ]+3" << endl ; + SeqSyr( r1 ) ; + } + } + else if ( ( ( n0 + r0 ) % 3 ) == 0 ) { + r1 = ( n0 + r0 ) / 3 ; + if ( depth == prt ) { + *_Trace << "n->3n+1 " << n0 << "n + " << r1 << " = 4[ " + << n0/4 << "n + " << r1/4 << " ]+3" << endl ; + SeqSyr( r1 ) ; + } + } + else if ( ( ( 2*n0 + r0 ) % 3 ) == 0 ) { + r1 = ( 2*n0 + r0 ) / 3 ; + if ( depth == prt ) { + *_Trace << "n->3n+2 " << n0 << "n + " << r1 << " = 4[ " + << n0/4 << "n + " << r1/4 << " ]+3" << endl ; + SeqSyr( r1 ) ; + } + } + + if ( depth == prt ) + *_Trace << endl << depth << " little4 n = " << n << " r = " << r << endl ; + + n1 = n0*2 ; + r2 = r0*2 + 1 ; + if ( ( r2 % 3 ) == 0 ) { + r2 = r2/3 ; + if ( depth == prt ) { + *_Trace << "n->3n " << n1 << "n + " << r2 << " = 8[ " + << n1/8 << "n + " << r2/8 << " ]+1" << endl ; + SeqSyr( r2 ) ; + } + } + else if ( ( ( n1 + r2 ) % 3 ) == 0 ) { + r2 = ( n1 + r2 ) / 3 ; + if ( depth == prt ) { + *_Trace << "n->3n+1 " << n1 << "n + " << r2 << " = 8[ " + << n1/8 << "n + " << r2/8 << " ]+1" << endl ; + SeqSyr( r2 ) ; + } + } + else if ( ( ( 2*n1 + r2 ) % 3 ) == 0 ) { + r2 = ( 2*n1 + r2 ) / 3 ; + if ( depth == prt ) { + *_Trace << "n->3n+2 " << n1 << "n + " << r2 << " = 8[ " + << n1/8 << "n + " << r2/8 << " ]+1" << endl ; + SeqSyr( r2 ) ; + } + } + + if ( depth < prt ) { + little( depth , prt , n0 , r1 ) ; + little( depth , prt , n1 , r2 ) ; + } + +} + +int main(int argc, char **argv) { + + int k ; + int i ; + int j ; + int l ; + int l1 ; + int n = 0 ; + int p ; + int P ; + int Prem = 37 ; + + _Trace = new ofstream( "/cas_01/jr/linux/SyrP.log" ); + + for ( l = 0 ; l <= 17 ; l++ ) { + for ( l1 = -1 ; l1 <= 1 ; l1 += 2 ) { + P = 6*l + l1 ; + if ( P > 0 && NextPrime( P-1 ) == P ) { + for ( k = -1 ; k <= 1 ; k += 2 ) { + for ( i = 1 ; i <= 30 ; i++ ) { + for ( j = 1 ; j <= 30 ; j++ ) { + n = int( pow( (double)2 , (double)i ) * pow( (double)3 , (double)j )*P ) + k ; + if ( n < 0 || n > pow( (double)2 , (double)30 ) ) { + break ; + } + if ( NextPrime( n-1 ) == n ) { + *_Trace << n << " = 2**" << i << " * 3**" << j << " * " << P << " + " + << k << endl ; + } +#if 0 + if ( NextPrime( n-1 ) != n && ( n % P ) == 0 ) { + *_Trace << n << " = 2**" << i << " * 3**" << j << " * " << P << " + " + << k << " = " ; + p = 5 ; + while ( p*p <= n ) { + while ( ( n % p ) == 0 ) { + *_Trace << p << "*" ; + n = n / p ; + } + p = NextPrime( p + 1 ) ; + } + *_Trace << n << endl ; + } +#endif + } + *_Trace << endl ; + } + } + } + *_Trace << endl ; + } + } + +#if 0 + _Trace = new ofstream( "/cas_01/jr/linux/Syr.log" ); + + int n = 1 ; + int prt ; + +#if 0 + for ( prt = 1 ; prt <= 5 ; prt++ ) { + *_Trace << endl << prt << ". 8n + 1 :" << endl ; + little( 0 , prt , 8 , 1 ) ; + } + + for ( prt = 1 ; prt <= 5 ; prt++ ) { + *_Trace << endl << prt << ". 4n + 3 :" << endl ; + little( 0 , prt , 4 , 3 ) ; + } + + for ( prt = 1 ; prt <= 6 ; prt++ ) { + *_Trace << endl << prt << ". 8n + 5 :" << endl ; + little( 0 , prt , 8 , 5 ) ; + } +#endif + + int i ; + int max = 256 ; + for ( i = 0 ; i <= max ; i++ ) { + *_Trace << endl << endl << "8*" << i << "+5 = 4[2*" << i << "+1]+1 = " ; + int ii = 2*i+1 ; + while ( ((ii-1) & 7) == 4 ) { + *_Trace << endl << " 8*" << ii/8 << "+5 = 4[2*" << ii/4 + << "+1]+1 = " ; + ii = 2*(ii/4)+1 ; + } + *_Trace << "6*" << nP(8*i + 5) << "+" << rP(8*i + 5) << " :" << endl ; + n = SeqSyr( 8*i + 5 ) ; + n = n/8 ; + while ( n && n > max ) { + *_Trace << endl << " ==> 8*" << n << "+5 = 4[2*" << n << "+1]+1 = " ; + int ii = 2*n+1 ; + while ( ((ii-1) & 7) == 4 ) { + *_Trace << endl << "8*" << ii/8 << "+5 = 4[2*" << ii/4 << "+1]+1 = " ; + ii = 2*(ii/4)+1 ; + } + *_Trace << "6*" << nP(8*n + 5) << "+" << rP(8*n + 5) << " :" << endl ; + n = SeqSyr( 8*n + 5 ) ; + n = n/8 ; + } + } + +#if 0 + int x ; + int rx ; + int a ; + int q ; + int r ; + int X ; + int n ; + int rn ; + int xx ; + int y ; + int p ; + int pow ; + + *_Trace << "2**[x(n+1)] = (2**x-1)*S[x](n)+1" << endl << endl ; + + *_Trace << "2**[(2x+1)(2n+rn+1)] = (2**(2x+1)-1)*S[2x+1](2n+rn)+1" << endl ; + *_Trace << " = 2**(2x+1){(2**(2x+1)-1)*S[2x+1](2n+rn)-1}" + << endl << endl ; + *_Trace << "2**[2x(3n+rn+1)] = (2**2x-1)*S[2x](3n+rn)+1" << endl ; + *_Trace << " = 2**2x{(2**2x-1)*S[2x](3n+rn-1)-1}" + << endl << endl ; + *_Trace << "2**(2x+1)-1 = 6S2(x-1)+1" << endl << endl ; + + *_Trace << "2**(2(3x+1))-1 = 3(6*2*7*S6(x-1)+1) *4 :" << endl ; + *_Trace << "2**(2(3x+2))-1 = 3(6*2**3*7*S6(x-1)+5) *4 :" << endl ; + *_Trace << "2**(2(3x+3))-1 = 3(6*2**5*7*S6(x-1)+21)" << endl ; + *_Trace << " = 3**2(2**6*7*S6(x-1)+7)" << endl ; + *_Trace << " = 3**2*7(2**6*S6(x-1)+1)" << endl ; + *_Trace << " = 3**2*7*S6(x)" << endl ; + *_Trace << "2**(2(3x))-1 = 3**2*7*S6(x-1)" << endl ; + *_Trace << "2**(2(3x+4))-1 = 3(6*2*7*S6(x)+1) *4 :" << endl ; + *_Trace << "2**(2(3x+5))-1 = 3(6*2**3*7*S6(x)+5)" << endl << endl ; + *_Trace << "2**(2(3x+rx))-1 = 3**2*2**(2rx)*7*S6(x-1)+2**(2rx)-1" << endl + << endl ; + + *_Trace << "2**[(2x+1)(2n+rn+1)] = (6S2(x-1)+1)*S[2x+1](2n+rn)+1" << endl ; + *_Trace << "2**[2(3x+rx)(3n+rn+1)] = {3**2*2**(2rx)*7*S6(x-1)+2**(2rx)-1}*" + << endl << " S[2(3x+rx)](3n+rn)+1" << endl + << endl ; + + *_Trace << "(6x+5)y+x = 2**3*7*S6(x-1)" << endl ; + *_Trace << "x = 0 ; y = 0" << endl ; + *_Trace << "x = 1 ; y = 5" << endl ; + *_Trace << "x = 2 ; y = 214 = 2*107 = 2*O153" << endl ; + *_Trace << "x = 3 ; y = 10131 = 3*3377 = 3*O6461" << endl ; + *_Trace << "x = 4 ; y = 514244 = 4*128561 = 4*O373061" << endl ; + *_Trace << "x = 5 ; y = ?" << endl ; + *_Trace << "x = 6 ; y = 1489853154 = 6*248308859 = 6*O1663162173" << endl + << endl ; + + for ( pow = 1 ; pow <= 31 ; pow++ ) { + *_Trace << endl ; + for ( x = 0 ; x <= 30 ; x++ ) { + for ( n = 0 ; n <= 30 ; n++ ) { + for ( rn = 0 ; rn <= 1 ; rn++ ) { + if ( (2*x+1)*(2*n+rn+1) == pow && (2*x+1)*(2*n+rn+1) <= 31 ) { + int val = (1 << (2*x+1)*(2*n+rn+1)) ; + *_Trace << "2**(" << 2*x+1 << "*(" << 2*n+rn << "+1)) = " ; + *_Trace << "2**[(2*" << x << "+1)(2*" << n << "+" << rn + << "+1)] = (6*" ; + int SIG = S(2,x-1) ; + int pow3 = 0 ; + while ( SIG && (SIG % 3) == 0 ) { + pow3 += 1 ; + SIG = SIG/3 ; + } + *_Trace << "3**" << pow3 << "*" << SIG + << "+1) * " << fact( S(2*x+1,2*n+rn) ) + << " + 1 = " << endl + << " (6*S2(" << x-1 << ")+1)*S" << 2*x+1 << "(" + << 2*n+rn << ")+1 = " + << "(6*S2(" << x << "-1)+1)*S[2*" << x << "+1](2*" + << n << "+" << rn << ")+1 = " << val << endl ; + if ( val != (6*S(2,x-1)+1)*S(2*x+1,2*n+rn)+1 ) { + *_Trace << val << " != " << (6*S(2,x-1)+1)*S(2*x+1,2*n+rn)+1 + << endl ; + } + } + } + } + } + for ( x = 0 ; x <= 30 ; x++ ) { + for ( rx = 0 ; rx <= 2 ; rx++ ) { + for ( n = 0 ; n <= 30 ; n++ ) { + for ( rn = 0 ; rn <= 2 ; rn++ ) { + if ( 3*x+rx != 0 && 2*(3*x+rx)*(3*n+rn+1) == pow + && 2*(3*x+rx)*(3*n+rn+1) <= 31 ) { + *_Trace << "2**[" << 2*(3*x+rx) << "*(" << 3*n+rn << "+1)] = " ; + *_Trace << "2**[2(3*" << x << "+" << rx << ")(3*" << n << "+" + << rn << "+1)] = [9*" << (1 << (2*rx)) << "*7*" + << S(6,x-1) << "+" ; + int DRX = (1 << (2*rx))-1 ; + int pow3 = 0 ; + while ( DRX && (DRX % 3) == 0 ) { + pow3 += 1 ; + DRX = DRX/3 ; + } + *_Trace << "3**" << pow3 << "*" << DRX << "] * " ; + int SIG = S(2*(3*x+rx),3*n+rn) ; + pow3 = 0 ; + while ( SIG && (SIG % 3) == 0 ) { + pow3 += 1 ; + SIG = SIG/3 ; + } + *_Trace << "3**" << pow3 << "*" << fact( SIG ) + << " + 1 = " << endl + << " [3**2*2**" << 2*rx << "*7*S6(" + << x << "-1)+" << (1 << (2*rx))-1 << "] * S" + << 2*(3*x+rx) << "(" << 3*n+rn << ")+1 = " << endl + << " {3**2*2**(2*" << rx << ")*7*S6(" + << x << "-1)+2**(2*" << rx << ")-1} * S[2(3*" + << x << "+" << rx << ")](3*" << n << "+" << rn << ")+1" + << endl ; + int val = (1 << (2*(3*x+rx)*(3*n+rn+1)) ) ; + if ( val != (3*3*(1<<(2*rx))*7*S(6,x-1)+(1<<(2*rx))-1)*S(2*(3*x+rx),3*n+rn)+1 ) { + *_Trace << val << " != " << (3*3*(1<<(2*rx))*7*S(6,x-1)+(1<<(2*rx))-1) * S(2*(3*x+rx),3*n+rn)+1 << endl ; + } + } + } + } + } + } + } + return 0; + + + *_Trace << endl ; + for ( x = 1 ; x <= 30 ; x++ ) { + for ( n = 0 ; n <= 30 ; n++ ) { + if ( x*(n+1) <= 30 ) { + X = ((1 << x ) - 1)*S(x,n) + 1 ; + if ( (1 << (x*(n+1)) ) == X ) { + *_Trace << "2**[" << x << "(" << n << "+1)] = 2**[[" ; + int pow2 = 0 ; + int pow3 = 0 ; + int p ; + p = x ; + while ( p && (p & 1) == 0 ) { + pow2 += 1 ; + p = (p >> 1 ) ; + } + while ( p && (p % 3) == 0 ) { + pow3 += 1 ; + p = p/3 ; + } + if ( pow2 ) { + *_Trace << "2" ; + if ( pow2 != 1 ) { + *_Trace << "**" << pow2 ; + } + if ( pow3 || p != 1 ) { + *_Trace << "*" ; + } + } + if ( pow3 ) { + *_Trace << "3" ; + if ( pow3 != 1 ) { + *_Trace << "**" << pow3 ; + } + if ( p != 1 ) { + *_Trace << "*" ; + } + } + if ( !((pow2 || pow3) && p == 1) ) { + *_Trace << p ; + } + *_Trace << "][" ; + p = n+1 ; + pow2 = 0 ; + pow3 = 0 ; + while ( p && (p & 1) == 0 ) { + pow2 += 1 ; + p = (p >> 1 ) ; + } + while ( p && (p % 3) == 0 ) { + pow3 += 1 ; + p = p/3 ; + } + if ( pow2 ) { + *_Trace << "2" ; + if ( pow2 != 1 ) { + *_Trace << "**" << pow2 ; + } + if ( pow3 || p != 1 ) { + *_Trace << "*" ; + } + } + if ( pow3 ) { + *_Trace << "3" ; + if ( pow3 != 1 ) { + *_Trace << "**" << pow3 ; + } + if ( p != 1 ) { + *_Trace << "*" ; + } + } + if ( !((pow2 || pow3) && p == 1) ) { + *_Trace << p ; + } + *_Trace << "]]" ; + int d = (1 << x) - 1 ; + pow3 = 0 ; + while ( (d % 3) == 0 ) { + pow3 += 1 ; + d = d / 3 ; + } + *_Trace << " = (2**" << x << "-1)*S" ; + if ( x & 1 ) { + *_Trace << x << "[2*" << n/2 ; + if ( n & 1 ) { + *_Trace << "+1" ; + } + *_Trace << "]+1 = " ; + } + else { + *_Trace << x << "[3*" << n/3 << "+" << (n % 3) << "]+1 = " ; + } + *_Trace << "{" ; + if ( pow3 ) { + *_Trace << "3" ; + if ( pow3 != 1 ) { + *_Trace << "**" << pow3 ; + } + *_Trace << "*" ; + } + if ( d == 1 ) { + } + else if ( d == 5 ) { + *_Trace << "[5]" ; + } + else { + if ( nP(d) ) { + *_Trace << "[6*" << nP(d) << "+" << rP(d) << "]" ; + } + else { + *_Trace << "[" << rP(d) << "]" ; + } + } + *_Trace << "}*{" ; + int Y = S(x,n) ; + pow2 = 0 ; + while ( (Y % 2) == 0 ) { + pow2 += 1 ; + Y = Y / 2 ; + } + pow3 = 0 ; + while ( (Y % 3) == 0 ) { + pow3 += 1 ; + Y = Y / 3 ; + } + if ( pow2 ) { + *_Trace << "2" ; + if ( pow2 != 1 ) { + *_Trace << "**" << pow2 ; + } + *_Trace << "*" ; + } + if ( pow3 ) { + *_Trace << "3" ; + if ( pow3 != 1 ) { + *_Trace << "**" << pow3 ; + } + *_Trace << "*" ; + } + if ( nP(Y) && ( (nP(Y) & 1) == 0 || (nP(Y) % 3) == 0 ) ) { + *_Trace << "[6*" ; + int YY = nP(Y) ; + pow2 = 0 ; + while ( (YY % 2) == 0 ) { + pow2 += 1 ; + YY = YY / 2 ; + } + pow3 = 0 ; + while ( (YY % 3) == 0 ) { + pow3 += 1 ; + YY = YY / 3 ; + } + if ( pow2 ) { + *_Trace << "2" ; + if ( pow2 != 1 ) { + *_Trace << "**" << pow2 ; + } + *_Trace << "*" ; + } + if ( pow3 ) { + *_Trace << "3" ; + if ( pow3 != 1 ) { + *_Trace << "**" << pow3 ; + } + *_Trace << "*" ; + } + *_Trace << YY << "+" << rP(Y) << "]}+1" << endl ; + } + else { + if ( nP(Y) ) { + *_Trace << "[6*" << nP(Y) << "+" << rP(Y) << "]}+1" << endl ; + } + else { + *_Trace << "[" << rP(Y) << "]}+1" << endl ; + } + } + } + else { + *_Trace << endl << (1 << (x*(n+1)) ) << " = 2**[" << x << "(" << n + << "+1)] != " << X << "(2**" << x + << "-1)*S" << x << "[" << n << "]+1" << endl ; + } + } + } + } + return 0; + + *_Trace << "S[x]( n ) = Sigma((2**x)*i) i = 0 , n" << endl ; + *_Trace << "S[x]( aq + r ) = X*S[a*x]( q - 1 ) + Sx( r )" << endl ; + for ( x = 2 ; x <= 10 ; x++ ) { + *_Trace << endl << endl ; + for ( a = 2 ; a <= 12 ; a++ ) { + *_Trace << endl ; + for ( q = 1 ; q <= 12 ; q++ ) { + for ( r = 0 ; r < a ; r++ ) { + if ( a*q + r <= 24 ) { + int i = S( x , a*q+r ) - S( x , r ) ; + int X = i / S( a*x , q-1 ) ; + int p2 = 0 ; + if ( X*S( a*x , q-1 ) == i && (i % S( a*x , q-1 ) ) == 0 ) { + while ( ( X & 1 ) == 0 ) { + p2 += 1 ; + X = ( X >> 1 ) ; + } + int p3 = 0 ; + while ( X > 0 && ( X % 3 ) == 0 ) { + p3 += 1 ; + X = ( X / 3 ) ; + } + *_Trace << "S( " << x << " , " << a << "*" << q << " + " << r + << " ) = 2**" << p2 << "*3**" << p3 << "*"<< X + << "*S[" << a << "*" << x << "]( " << q << "-1 ) + S( " + << x << " , " << r << " )" << endl ; + } + } + } + } + } + } + return 0; + + int PT ; + int PP ; + int PPNext ; + for ( PP = 1 ; PP <= 5 ; PP+=4 ) { + for ( PPNext = 1 ; PPNext <= 5 ; PPNext+=4 ) { + for ( PT = 0 ; PT <= 2 ; PT++ ) { + if ( PT == 0 && PP == 5 ) { + *_Trace << endl << "T1a 2**(6n1+2)(3n0) + 2**(6n1+1) + S2(3n1+0) --> 6(3n0+0)+5" + << endl ; + Compute( "T1a" , T1a , PT , PP , PPNext ) ; + } + if ( PT == 1 && PP == 1 ) { + *_Trace << endl << "T2b 2**(6n1+3)(3n0+1) + S2(3n1+0) --> 6(3n0+1)+1" + << endl ; + Compute( "T2b" , T2b , PT , PP , PPNext ) ; + } + if ( PT == 0 && PP == 1 ) { + *_Trace << endl << "T2a 2**(6n1+7)(3n0) + S2(3n1+2) --> 6(3n0+0)+1" + << endl ; + Compute( "T2a" , T2a , PT , PP , PPNext ) ; + } + if ( PT == 2 && PP == 5 ) { + *_Trace << endl << "T1c 2**(6n1+4)(3n0+2) + 2**(6n1+3) + S2(3n1+1) --> 6(3n0+2)+5" + << endl ; + Compute( "T1c" , T1c , PT , PP , PPNext ) ; + } + if ( PT == 2 && PP == 1 ) { + *_Trace << endl << "T2c 2**(6n1+5)(3n0+2) + S2(3n1+1) --> 6(3n0+2)+1" + << endl ; + Compute( "T2c" , T2c , PT , PP , PPNext ) ; + } + if ( PT == 1 && PP == 5 ) { + *_Trace << endl << "T1b 2**(6n1+6)(3n0+1) + 2**(6n1+5) + S2(3n1+2) --> 6(3n0+1)+5" + << endl ; + Compute( "T1b" , T1b , PT , PP , PPNext ) ; + } + +// for ( PPNext = 1 ; PPNext <= 5 ; PPNext+=4 ) { + *_Trace << endl << "P2a1 (1<<(6*n1+3))*(3*n0+0) + S2(3*n1+0) --> 6(3n0+0)+1" + << endl ; + Compute( "P2a1" , P2a1 , PT , PP , PPNext ) ; + + *_Trace << endl << "P2a2 (1<<(6*n1+5))*(3*n0+0) + S2(3*n1+1) --> 6(3n0+0)+1" + << endl ; + Compute( "P2a2" , P2a2 , PT , PP , PPNext ) ; + + *_Trace << endl << "P1b1 (1<<(6*n1+2))*(3*n0+1) + (1<<(6*n1+1)) + S2(3*n1+0) --> 6(3n0+1)+5" + << endl ; + Compute( "P1b1" , P1b1 , PT , PP , PPNext ) ; + + *_Trace << endl << "P1c1 (1<<(6*n1+2))*(3*n0+2) + (1<<(6*n1+1)) + S2(3*n1+0) --> 6(3n0+2)+5" + << endl ; + Compute( "P1c1" , P1c1 , PT , PP , PPNext ) ; + + *_Trace << endl << "P1a1 (1<<(6*n1+4))*(3*n0+0) + (1<<(6*n1+3)) + S2(3*n1+1) --> 6(3n0+0)+5" + << endl ; + Compute( "P1a1" , P1a1 , PT , PP , PPNext ) ; + + *_Trace << endl << "P2c1 (1<<(6*n1+3))*(3*n0+2) + S2(3*n1+0) --> 6(3n0+2)+1" + << endl ; + Compute( "P2c1" , P2c1 , PT , PP , PPNext ) ; + + *_Trace << endl << "P1b2 (1<<(6*n1+4))*(3*n0+1) + (1<<(6*n1+3)) + S2(3*n1+1) --> 6(3n0+1)+5" + << endl ; + Compute( "P1b2" , P1b2 , PT , PP , PPNext ) ; + + *_Trace << endl << "P2b1 (1<<(6*n1+5))*(3*n0+1) + S2(3*n1+1) --> 6(3n0+1)+1" + << endl ; + Compute( "P2b1" , P2b1 , PT , PP , PPNext ) ; + + *_Trace << endl << "P1a2 (1<<(6*n1+6))*(3*n0+0) + (1<<(6*n1+5)) + S2(3*n1+2) --> 6(3n0)+5" + << endl ; + Compute( "P1a2" , P1a2 , PT , PP , PPNext ) ; + + *_Trace << endl << "P2b2 (1<<(6*n1+7))*(3*n0+1) + S2(3*n1+2) --> 6(3n0+1)+1" + << endl ; + Compute( "P2b2" , P2b2 , PT , PP , PPNext ) ; + + *_Trace << endl << "P1c2 (1<<(6*n1+6))*(3*n0+2) + (1<<(6*n1+5)) + S2(3*n1+2) --> 6(3n0+2)+5" + << endl ; + Compute( "P1c2" , P1c2 , PT , PP , PPNext ) ; + + *_Trace << endl << "P2c2 (1<<(6*n1+7))*(3*n0+2) + S2(3*n1+2) --> 6(3n0+2)+1" + << endl ; + Compute( "P2c2" , P2c2 , PT , PP , PPNext ) ; + } + + } + } +#endif + +#endif + + return 0; +} + diff --git a/src/SyrComponent/SyrComponent_Impl.cxx b/src/SyrComponent/SyrComponent_Impl.cxx new file mode 100755 index 0000000..3c93ed7 --- /dev/null +++ b/src/SyrComponent/SyrComponent_Impl.cxx @@ -0,0 +1,398 @@ +// SuperVisionTest SyrComponent : example of component performing some mathinatical operations +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SyrComponent_Impl.cxx +// Author : Jean Rahuel, CEA +// Module : SuperVisionTest + +using namespace std; +#include +#include +#include +#include +#include + +//#include "utilities.h" + +#include "SyrComponent_Impl.hxx" +#include "Adder_Impl.hxx" + +SyrComponent_Impl::SyrComponent_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + const bool kactivate ) : + Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,true) { + MESSAGE("SyrComponent_Impl::SyrComponent_Impl this " << hex << this << dec + << "activate object instanceName(" + << instanceName << ") interfaceName(" << interfaceName << ")" ) + if ( kactivate ) { + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + } +} + +SyrComponent_Impl::SyrComponent_Impl() { +} + +SyrComponent_Impl::~SyrComponent_Impl() { +} + +long SyrComponent_Impl::C_ISEVEN( const long anInteger ) { + bool RetVal ; + beginService( " SyrComponent_Impl::C_ISEVEN" ); + sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_ISEVEN is Computing"); + int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); + sleep(S); + RetVal = ( anInteger & 1 ) == 0 ; + endService( " SyrComponent_Impl::C_ISEVEN" ); + return RetVal ; +} + +long SyrComponent_Impl::C_ISONE( const long anOddInteger ) { + bool RetVal ; + beginService( " SyrComponent_Impl::C_ISONE" ); + sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_ISONE is Computing"); + int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); + sleep(S); + RetVal = ( anOddInteger == 1 ) ; + endService( " SyrComponent_Impl::C_ISONE" ); + return RetVal ; +} + +long SyrComponent_Impl::C_M3( const long anOddInteger ) { + beginService( " SyrComponent_Impl::C_M3" ); + sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_M3 is Computing"); + int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); + sleep(S); + endService( " SyrComponent_Impl::C_M3" ); + if ( C_ISEVEN( anOddInteger ) ) + return 0 ; + return ( 3*anOddInteger ) ; +} + +long SyrComponent_Impl::C_M3P1( const long anOddInteger ) { + beginService( " SyrComponent_Impl::C_M3P1" ); + sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_M3P1 is Computing"); + int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); + sleep(S); + endService( " SyrComponent_Impl::C_M3P1" ); + if ( C_ISEVEN( anOddInteger ) ) + return 0 ; + return ( 3*anOddInteger + 1 ) ; +} + +long SyrComponent_Impl::C_DIV2( const long anEvenInteger ) { + beginService( " SyrComponent_Impl::C_DIV2" ); + sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_DIV2 is Computing"); + int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); + sleep(S); + endService( " SyrComponent_Impl::C_DIV2" ); + if ( !C_ISEVEN( anEvenInteger ) ) + return 0 ; + return ( anEvenInteger >> 1 ) ; +} + +long SyrComponent_Impl::C_INCR( const long aCount ) { + beginService( " SyrComponent_Impl::C_INCR" ); + sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_INCR is Computing"); + int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); + sleep(S); + endService( " SyrComponent_Impl::C_INCR" ); + return ( aCount + 1 ) ; +} + +long SyrComponent_Impl::C_MIN( const long aMinVal , const long anInteger ) { + beginService( " SyrComponent_Impl::C_MIN" ); + sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_MIN is Computing"); + int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); + sleep(S); + int min = aMinVal ; + if ( anInteger < min || aMinVal == 0 ) { + min = anInteger ; + } + string trace = "SyrComponent_Impl::C_MIN : " ; + char cmin[ 30 ] ; + sprintf( cmin , "%d" , min ) ; + trace += cmin ; + sendMessage(NOTIF_TRACE, trace.c_str() ); + endService( " SyrComponent_Impl::C_MIN" ); + return min ; +} + +long SyrComponent_Impl::C_MAX( const long aMaxVal , const long anInteger ) { + beginService( " SyrComponent_Impl::C_MAX" ); + sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_MAX is Computing"); + int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); + sleep(S); + int max = aMaxVal ; + if ( anInteger > max ) { + max = anInteger ; + } + string trace = "SyrComponent_Impl::C_MAX : " ; + char cmax[ 30 ] ; + sprintf( cmax , "%d" , max ) ; + trace += cmax ; + sendMessage(NOTIF_TRACE, trace.c_str() ); + endService( " SyrComponent_Impl::C_MAX" ); + return max ; +} + +SuperVisionTest::ListOfSyr_ptr SyrComponent_Impl::C_LISTOFSYR() { + beginService( " SyrComponent_Impl::C_LISTOFSYR" ); + sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_LISTOFSYR is Computing"); + int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); + sleep(S); + ListOfSyr_Impl * aNewListOfSyr = new ListOfSyr_Impl( _orb , _poa, _contId, + instanceName() , interfaceName() , + graphName() , nodeName() ) ; + SuperVisionTest::ListOfSyr_var iobject = (SuperVisionTest::ListOfSyr_var ) NULL ; + PortableServer::ObjectId * id = aNewListOfSyr->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = SuperVisionTest::ListOfSyr::_narrow(obj) ; + endService( " SyrComponent_Impl::C_LISTOFSYR" ); + return SuperVisionTest::ListOfSyr::_duplicate( iobject ) ; +// return ( aNewListOfSyr._retn() ) ; +} + +SuperVisionTest::ListOfSyr_ptr SyrComponent_Impl::C_AVERAGE( + const SuperVisionTest::ListOfSyr_ptr aListOfSyr , + const long anInteger , + const long aCount , + double & anAverage ) { + beginService( " SyrComponent_Impl::C_AVERAGE" ); + sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_AVERAGE is Computing"); + int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); + sleep(S); + SuperVisionTest::SeqOfSyr * aSeqOfSyr = aListOfSyr->GetSeqOfSyr() ; + int len = aSeqOfSyr->length() ; + aSeqOfSyr->length( len + 1 ) ; + (*aSeqOfSyr)[ len ] = anInteger ; + aListOfSyr->SetSeqOfSyr( *aSeqOfSyr ) ; + anAverage = 0 ; + int i ; + for ( i = 0 ; i < len + 1 ; i++ ) { + anAverage += (*aSeqOfSyr)[ i ] ; + } + anAverage = anAverage / ( len + 1 ) ; + string end = " SyrComponent_Impl::C_AVERAGE " ; + char caverage[ 30 ] ; + sprintf( caverage , "%fd" , anAverage ) ; + end += caverage ; + endService( end.c_str() ); + return SuperVisionTest::ListOfSyr::_duplicate( aListOfSyr ) ; +} + +SuperVisionTest::Syr_ptr SyrComponent_Impl::Init( const long anOddInteger ) { + beginService( "SyrComponent_Impl::Init" ); + sendMessage(NOTIF_STEP, "SyrComponent_Impl creates Syr_Impl"); + int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); + sleep(S); + Syr_Impl * mySyr ; + mySyr = new Syr_Impl( _orb , _poa, _contId, + instanceName() , interfaceName() , + graphName() , nodeName() , anOddInteger ) ; + SuperVisionTest::Syr_var iobject = (SuperVisionTest::Syr_var ) NULL ; + PortableServer::ObjectId * id = mySyr->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = SuperVisionTest::Syr::_narrow(obj) ; + endService( "SyrComponent_Impl::Init" ); + return SuperVisionTest::Syr::_duplicate(iobject) ; +} + +ListOfSyr_Impl::ListOfSyr_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char * instanceName , + const char * interfaceName , + const char * graphName , + const char * nodeName ) : + Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,true) { + Names( graphName , nodeName ) ; + MESSAGE("ListOfSyr_Impl::ListOfSyr_Impl activate object instanceName(" + << instanceName << ") interfaceName(" << interfaceName << ") --> " + << hex << (void *) this << dec ) + beginService( "ListOfSyr_Impl::ListOfSyr_Impl" ); + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + sendMessage(NOTIF_STEP, "ListOfSyr_Impl is Created"); + endService( "ListOfSyr_Impl::ListOfSyr_Impl" ); +} + +ListOfSyr_Impl::ListOfSyr_Impl() { +} + +ListOfSyr_Impl::~ListOfSyr_Impl() { + beginService( "ListOfSyr_Impl::~ListOfSyr_Impl" ); + endService( "ListOfSyr_Impl::~ListOfSyr_Impl" ); +} + +SuperVisionTest::SeqOfSyr * ListOfSyr_Impl::GetSeqOfSyr() { + SuperVisionTest::SeqOfSyr_var aSeqOfSyr = new SuperVisionTest::SeqOfSyr( _SeqOfSyr ) ; + return ( aSeqOfSyr._retn() ) ; +} + +void ListOfSyr_Impl::SetSeqOfSyr( const SuperVisionTest::SeqOfSyr & aSeqOfSyr ) { + _SeqOfSyr = aSeqOfSyr ; + return ; +} + +extern "C" +{ + PortableServer::ObjectId * SyrComponentEngine_factory + (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) + { + MESSAGE("SyrComponentEngine_factory SyrComponentEngine (" + << instanceName << "," << interfaceName << "," << getpid() << ")"); + SyrComponent_Impl * mySyrComponent + = new SyrComponent_Impl(orb, poa, contId, instanceName, interfaceName); + return mySyrComponent->getId() ; + } +} + +Syr_Impl::Syr_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char * instanceName , + const char * interfaceName , + const char * graphName , + const char * nodeName , + const long anOddInteger ) : + SyrComponent_Impl(orb, poa, contId, instanceName, interfaceName,false) { + Names( graphName , nodeName ) ; + MESSAGE("Syr_Impl::Syr_Impl activate object instanceName(" + << instanceName << ") interfaceName(" << interfaceName << ") --> " + << hex << (void *) this << dec ) + beginService( "Syr_Impl::Syr_Impl" ); + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + _InitialInteger = anOddInteger ; + _CurrentInteger = anOddInteger ; + _Count = 0 ; + sendMessage(NOTIF_STEP, "Syr_Impl is Created"); + endService( "Syr_Impl::Syr_Impl" ); +} + +Syr_Impl::Syr_Impl() { +} + +Syr_Impl::~Syr_Impl() { + beginService( "Syr_Impl::~Syr_Impl" ); + endService( "Syr_Impl::~Syr_Impl" ); +} + +long Syr_Impl::Initial() { + beginService( " Syr_Impl::Initial" ); + sendMessage(NOTIF_STEP, "Syr_Impl::Initial is Computing"); + int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); + sleep(S); + endService( " Syr_Impl::Initial" ); + return _InitialInteger ; +} + +long Syr_Impl::Current() { + beginService( " Syr_Impl::Current" ); + sendMessage(NOTIF_STEP, "Syr_Impl::Current is Computing"); + int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); + sleep(S); + endService( " Syr_Impl::Current" ); + return _CurrentInteger ; +} + +long Syr_Impl::IsEven() { + bool RetVal ; + beginService( " Syr_Impl::IsEven" ); + sendMessage(NOTIF_STEP, "Syr_Impl::IsEven is Computing"); + int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); + sleep(S); + RetVal = ( _CurrentInteger & 1 ) == 0 ; + MESSAGE( " Syr_Impl::IsEven " << _CurrentInteger << " " << RetVal ); + endService( " Syr_Impl::IsEven" ); + return RetVal ; +} + +long Syr_Impl::IsOne() { + bool RetVal ; + beginService( " Syr_Impl::IsOne" ); + sendMessage(NOTIF_STEP, "Syr_Impl::IsOne is Computing"); + int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); + sleep(S); + RetVal = ( _CurrentInteger == 1 ) ; + MESSAGE( " Syr_Impl::IsOne " << _CurrentInteger << " " << RetVal ); + endService( " Syr_Impl::IsOne" ); + return RetVal ; +} + +long Syr_Impl::Count() { + beginService( " Syr_Impl::Count" ); + sendMessage(NOTIF_STEP, "Syr_Impl::Count is Computing"); + int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); + sleep(S); + MESSAGE( " Syr_Impl::Count " << _Count ); + endService( " Syr_Impl::Count" ); + return _Count ; +} + +void Syr_Impl::M3p1() { + beginService( " Syr_Impl::M3p1" ); + sendMessage(NOTIF_STEP, "Syr_Impl::M3p1 is Computing"); + int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); + sleep(S); + if ( IsEven() ) + _CurrentInteger = 0 ; + else + _CurrentInteger = 3*_CurrentInteger + 1 ; + MESSAGE( " Syr_Impl::M3p1 " << _CurrentInteger ); + endService( " Syr_Impl::M3p1" ); +} + +void Syr_Impl::Div2() { + beginService( " Syr_Impl::Div2" ); + sendMessage(NOTIF_STEP, "Syr_Impl::Div2 is Computing"); + int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); + sleep(S); + if ( !IsEven() ) + _CurrentInteger = 0 ; + else + _CurrentInteger = ( _CurrentInteger >> 1 ) ; + MESSAGE( " Syr_Impl::Div2 " << _CurrentInteger ); + endService( " Syr_Impl::Div2" ); +} + +void Syr_Impl::Incr() { + beginService( " Syr_Impl::Incr" ); + sendMessage(NOTIF_STEP, "Syr_Impl::Incr is Computing"); + int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); + sleep(S); + _Count = _Count + 1 ; + MESSAGE( " Syr_Impl::Incr " << _Count ); + endService( " Syr_Impl::Incr" ); +} + + + diff --git a/src/SyrComponent/SyrComponent_Impl.hxx b/src/SyrComponent/SyrComponent_Impl.hxx new file mode 100755 index 0000000..e4291df --- /dev/null +++ b/src/SyrComponent/SyrComponent_Impl.hxx @@ -0,0 +1,150 @@ +// SuperVisionTest SyrComponent : example of component performing some mathinatical operations +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SyrComponent_Impl.hxx +// Author : Jean Rahuel, CEA +// Module : SuperVisionTest +// $Header: + +#ifndef _SYRCOMPONENT_IMPL_HXX_ +#define _SYRCOMPONENT_IMPL_HXX_ + +//#include +#include +#include CORBA_SERVER_HEADER(SyrComponent) +#include CORBA_SERVER_HEADER(SALOME_Component) +#include "SALOME_Component_i.hxx" + +class SyrComponent_Impl : public POA_SuperVisionTest::SyrComponent , + public Engines_Component_i { +public: + SyrComponent_Impl() ; + SyrComponent_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + const bool kactivate = true ) ; + + virtual ~SyrComponent_Impl(); + + virtual long C_ISEVEN( const long anInteger ) ; + + virtual long C_ISONE( const long anOddInteger ) ; + + virtual long C_M3( const long anOddInteger ) ; + + virtual long C_M3P1( const long anOddInteger ) ; + + virtual long C_DIV2( const long anEvenInteger ) ; + + virtual long C_INCR( const long aCount ) ; + + virtual long C_MIN( const long aMinVal , const long anInteger ) ; + + virtual long C_MAX( const long aMaxVal , const long anInteger ) ; + + virtual SuperVisionTest::ListOfSyr_ptr C_LISTOFSYR() ; + + virtual SuperVisionTest::ListOfSyr_ptr C_AVERAGE( + const SuperVisionTest::ListOfSyr_ptr aListOfSyr , + const long anInteger , + const long aCount , + double & anAverage ) ; + + virtual SuperVisionTest::Syr_ptr Init( const long anOddInteger ) ; + +private: + +}; + +class ListOfSyr_Impl : public POA_SuperVisionTest::ListOfSyr , + public Engines_Component_i { +public: + ListOfSyr_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + const char * graphName , + const char * nodeName ) ; + ListOfSyr_Impl() ; + virtual ~ListOfSyr_Impl(); + + virtual SuperVisionTest::SeqOfSyr * GetSeqOfSyr() ; + + virtual void SetSeqOfSyr( const SuperVisionTest::SeqOfSyr & ) ; + +private: + SuperVisionTest::SeqOfSyr _SeqOfSyr ; + +}; + +extern "C" + PortableServer::ObjectId * SyrComponentEngine_factory + ( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName ) ; + +class Syr_Impl : public POA_SuperVisionTest::Syr , + public SyrComponent_Impl { +public: + Syr_Impl() ; + Syr_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + const char * graphName , + const char * nodeName , + const long anOddInteger ); + + virtual ~Syr_Impl(); + + virtual long Initial() ; + + virtual long Current() ; + + virtual long IsEven() ; + + virtual long IsOne() ; + + virtual long Count() ; + + virtual void M3p1() ; + + virtual void Div2() ; + + virtual void Incr() ; + +private: + + long _InitialInteger ; + long _CurrentInteger ; + long _Count ; + +}; + +#endif diff --git a/src/SyrControlComponent/Makefile.in b/src/SyrControlComponent/Makefile.in new file mode 100644 index 0000000..79b026f --- /dev/null +++ b/src/SyrControlComponent/Makefile.in @@ -0,0 +1,32 @@ +# Copyright (C) 2003 CEA/DEN, EDF R&D +# +# +# +# File : Makefile.in +# Author : Jean Rahuel +# Module : SuperVisionTest +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + +@COMMENCE@ + +EXPORT_PYSCRIPTS = SyrControlComponent.py + +# Libraries targets + +LIB = +LIB_SRC = +LIB_CLIENT_IDL = + +# Executables targets +BIN = +BIN_SRC = + +LDFLAGS+= + + +@CONCLUDE@ diff --git a/src/SyrControlComponent/SyrControlComponent.py b/src/SyrControlComponent/SyrControlComponent.py new file mode 100644 index 0000000..e9b8288 --- /dev/null +++ b/src/SyrControlComponent/SyrControlComponent.py @@ -0,0 +1,127 @@ +#! /usr/bin/env python +# +# Copyright (C) 2003 CEA/DEN, EDF R&D +# +# +# +# File : SyrControlComponent.py +# Author : Jean Rahuel +# Module : SuperVisionTest +# $Header: + +import os +import sys +import time +import sys +from omniORB import CORBA, PortableServer +import CosNaming +import Engines, Engines__POA +import SuperVisionTest, SuperVisionTest__POA +from SALOME_ComponentPy import * + +from LifeCycleCORBA import * +from SALOME_NamingServicePy import * + +from SyrComponent_idl import * + +from SyrControlComponent_idl import * + +orb = CORBA.ORB_init([''], CORBA.ORB_ID) + +lcc = LifeCycleCORBA(orb) + +naming_service = SALOME_NamingServicePy_i(orb) + +modulecatalog = naming_service.Resolve("/Kernel/ModulCatalog") + +class SyrControlComponent( SuperVisionTest__POA.SyrControlComponent, SALOME_ComponentPy_i): + + def L_OneEven( self , ValOne , ValEven ): + self.beginService( 'SyrControlComponent L_OneEven' ) + self.sendMessage( NOTIF_STEP , "time.sleep( 1 )" ) + time.sleep( 1 ) + Finished = ValOne + if Finished == 0 : + Incr = 1 + Even = ValEven + if Even == 0 : + self.sendMessage( NOTIF_TRACE , "OddNumber" ) + Odd = 1 + else : + self.sendMessage( NOTIF_TRACE , "EvenNumber" ) + Odd = 0 + else : + self.sendMessage( NOTIF_TRACE , "Syracuse is TRUE : NumberOne" ) + Incr = 0 + Even = 0 + Odd = 0 + Even = ValEven + self.endService( 'SyrControlComponent L_OneEven' ) + return Finished,Incr,Even,Odd + + def C_NotOneIsEven( self ): + self.beginService( 'SyrControlComponent C_NotOneIsEven' ) + self.sendMessage( NOTIF_TRACE , "EvenNumber" ) + time.sleep( 1 ) + self.endService( 'SyrControlComponent C_NotOneIsEven' ) + return 0,1 + + def LOOPN( self , InLoop , iN , iK , min , max ): + self.beginService( 'SyrControlComponent LOOPN' ) + self.sendMessage( NOTIF_TRACE , "LOOPN" ) + time.sleep( 1 ) + OutLoop = 0 + N = 0 + if InLoop != 0 : + if min > 0 & min <= max : + N = min + OutLoop = 1 + else : + if iN < max : + N = iN + 1 + OutLoop = 1 + print 'SyrControlComponent LOOPN InLoop iN OutLoop N',InLoop,iN,OutLoop,N + self.endService( 'SyrControlComponent LOOPN' ) + return OutLoop,N,0 + + def WHILENOTONE( self , N ): + OutLoop = self.Syr.C_ISONE( N ) + if OutLoop == 0 : + OutLoop = 1 + else : + OutLoop = 0 + print 'SyrControlComponent WHILENOTONE OutLoop N',OutLoop,N + return OutLoop + + def IFNOTEVEN( self , N ) : + Even = self.Syr.C_ISEVEN( N ) + Odd = 0 + if Even == 0 : + Odd = 1 + print 'SyrControlComponent IFNOTEVEN Odd Even N',Odd,Even,N + return Odd,Even + + def LOOPi( self , InLoop , ii ): + OutLoop = 0 + i = 0 + if InLoop != 0 : + i = 0 + OutLoop = 1 + else : + if ii+1 < 2 : + i = ii + 1 + OutLoop = 1 + print 'SyrControlComponent LOOPi InLoop ii OutLoop i',InLoop,ii,OutLoop,i + return OutLoop,i + + def WHILEEVEN( self , N ) : + OutLoop = self.Syr.C_ISEVEN( N ) + print 'SyrControlComponent WHILEEVEN OutLoop N',OutLoop,N + return OutLoop + + def __init__(self, orb, poa, this, containerName, instanceName, interfaceName): + SALOME_ComponentPy_i.__init__(self, orb, poa, this, containerName, + instanceName, interfaceName, 1) + self.Syr = lcc.FindOrLoadComponent( 'FactoryServer' , 'SyrComponent' ) + print "SyrControlComponent::__init__",dir(self.Syr) +