From 0b007051cfcc68032863156764eb51b54af14061 Mon Sep 17 00:00:00 2001 From: yfr Date: Fri, 18 Jun 2004 13:52:48 +0000 Subject: [PATCH] DCQ : Merge with Ecole_Ete_a6. --- resources/COMPONENTCatalog.xml | 3117 ++++++++++------- src/AddComponent/AddComponent_Impl.cxx | 12 +- src/CalculatorComponent/CalculatorEngine.cxx | 687 ++++ src/CalculatorComponent/CalculatorEngine.hxx | 87 + src/CalculatorComponent/Makefile.in | 60 + .../DataStreamComponent_CheckOfUndefined.cxx | 37 + .../DataStreamComponent_Impl.cxx | 160 + .../DataStreamComponent_Impl.hxx | 106 + src/DataStreamComponent/Makefile.in | 60 + src/DivComponent/DivComponent.cxx | 2 +- src/Makefile.in | 7 +- src/MulComponent/MulComponent.cxx | 2 +- src/SubComponent/SubComponent.cxx | 2 +- src/SyrComponent/COMPONENT_shared_modules.py | 1 + src/SyrComponent/SyrComponent_Impl.cxx | 38 +- 15 files changed, 3086 insertions(+), 1292 deletions(-) create mode 100644 src/CalculatorComponent/CalculatorEngine.cxx create mode 100644 src/CalculatorComponent/CalculatorEngine.hxx create mode 100755 src/CalculatorComponent/Makefile.in create mode 100644 src/DataStreamComponent/DataStreamComponent_CheckOfUndefined.cxx create mode 100644 src/DataStreamComponent/DataStreamComponent_Impl.cxx create mode 100644 src/DataStreamComponent/DataStreamComponent_Impl.hxx create mode 100644 src/DataStreamComponent/Makefile.in diff --git a/resources/COMPONENTCatalog.xml b/resources/COMPONENTCatalog.xml index 79827bd..e88a350 100644 --- a/resources/COMPONENTCatalog.xml +++ b/resources/COMPONENTCatalog.xml @@ -1,6 +1,5 @@ - - + @@ -11,1345 +10,1943 @@ - - AddComponent - AddComponent - SuperVisionTest - MTJ - 1.0 - Test SuperVision SALOME/src/SALOME_SWIG/supervisionexample[1].py - 0 + + AddComponent + SuperVisionTestAdd + SuperVisionTest + MTJ + 1.0 + + 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 + 0 + + + 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 + 0 + + + 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 + 0 + + + SuperVisionTest::Adder + Adder + Adder Object + + + double + z + number + + + + + + LastResult + MTJ + 1.0 + get the last result field + 1 + 0 + + + SuperVisionTest::Adder + Adder + Adder Object + + + + + double + z + number + + + + + + - - AddComponent - + ... + + + SubComponent + SuperVisionTestSub + 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 + + + + + + - - - - 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 - + ... + + + MulComponent + SuperVisionTestMul + 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 + + + + + + - - - - 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 - - - - - - + + + DivComponent + SuperVisionTestDiv + 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 + + + + + + - - SubComponent - SubComponent - SuperVisionTest - MTJ - 1.0 - Test SuperVision SALOME/src/SALOME_SWIG/supervisionexample[1].py - 0 + SyrComponent + SuperVisionTestSyr + 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 + + + + + + + + - - SubComponent - - ... + + + FactorialComponent + SuperVisionTestFactorial + 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 + + + + + + - - - - Sub - MTJ - 1.0 - Floating substract - 1 - - - - double - x - First number - - - double - y - Second number - - - - - double - z - Substraction result - - - - - - + + SyrControlComponent + SuperVisionTestSyrControl + 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 + + + + + + + + + TypesCheck + SuperVisionTestTypes + + + + + 1 + + + + TypesCheck + + + + StringCheck + + + + 0 + + + string + InString + + + + + + string + OutString + + + + + + BoolCheck + + + + 0 + + + boolean + InBool + + + + + + boolean + OutBool + + + + + + CharCheck + + + + 0 + + + char + InChar + + + + + + char + OutChar + + + + + + ShortCheck + + + + 0 + + + short + InShort + + + + + + short + OutShort + + + + + + LongCheck + + + + 0 + + + long + InLong + + + + + + long + OutLong + + + + + + FloatCheck + + + + 0 + + + float + InFloat + + + + + + float + OutFloat + + + + + + DoubleCheck + + + + 0 + + + double + InDouble + + + + + + double + OutDouble + + + + + + ObjRefCheck + + + + 0 + + + SuperVisionTest::Adder + InObjRef + + + + + + SuperVisionTest::Adder + OutObjRef + + + + + + MiscTypes + JR + 1.0 + Check of types + 1 + + + string + InString + + + + boolean + InBool + + + + char + InChar + + + + short + InShort + + + + long + InLong + + + + float + InFloat + + + + double + InDouble + + + + SuperVisionTest::Adder + InObjRef + + + + + + string + OutString + + + + boolean + OutBool + + + + char + OutChar + + + + short + OutShort + + + + long + OutLong + + + + float + OutFloat + + + + double + OutDouble + + + + SuperVisionTest::Adder + OutObjRef + + + + + + + + + - MulComponent - MulComponent - SuperVisionTest - MTJ + Calculator + Calculator + SOLVER + LD 1.0 - Test SuperVision SALOME/src/SALOME_SWIG/supervisionexample[1].py + Test component (Arithmetic operations with MED_Field) - SALOME component 0 + hostname = localhost - MulComponent - * ... + Calculator + No comment Mul - MTJ + LD 1.0 - Float multiply + Multiplication of 2 fields of double 1 - double - x - First number + FIELDDOUBLE + field1 + initial field of double double - y - Second number + x1 + multiplicator - - - double - z - Multiplication result - - + + + FIELDDOUBLE + return + result + + - - - - - - - DivComponent - DivComponent - SuperVisionTest - MTJ - 1.0 - Test SuperVision SALOME/src/SALOME_SWIG/supervisionexample[1].py - 0 - - - DivComponent - / ... - - - Div - MTJ + Add + LD 1.0 - Floating divide + Addition of 2 fields of double 1 - double - x - First number + FIELDDOUBLE + field1 + first field of double - double - y - Second number + FIELDDOUBLE + field2 + second field of double - - - double - z - Division result - - + + + FIELDDOUBLE + return + 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 + + Constant + LD + 1.0 + Build a constant field of doubles + 1 + - long - aMinVal - + FIELDDOUBLE + field1 + allows to build the support - long - anInteger - - - - - - long - aNewMinVal - - - - - - C_MAX - - - - 0 - - - long - aMaxVal - - - - long - anInteger - + double + x1 + the constant - - - long - aNewMaxVal - - - - - - C_LISTOFSYR - - - - 0 - - - - - ListOfSyr - aListOfSyr - - - + + + FIELDDOUBLE + return + result based on first field support + + - C_AVERAGE - - - - 0 + + PutToStudy + mpv + 1.0 + Put field to the study stucture + 1 + - ListOfSyr - aListOfSyr - - - - long - anInteger - + FIELDDOUBLE + field1 + field to put to study 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 - + StudyId + the ID of the study - - - long - BoolEven - - - + + + FIELDDOUBLE + return + the same field like in input + + - - 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 + writeMEDfile + LD 1.0 - Factorial + write a field in a Med file 1 - long - n - + FIELDDOUBLE + field1 + transient Med field - - - - long - f - result - - - - - sigma - JR - 1.0 - Sigma - 0 - - - long - n - + string + filename + Med filename - - - 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 - - - - + DataStreamFactory + DataStreamFactory + OTHER + jr + 1 + unknown + 1 + + + + DataStreamFactory + unknown + + + Setxy + jr + 1 + unknown + 0 + + + x + long + unknown + + + y + long + unknown + + + + + + istream + INTEGER + unknown + T + + + ostream + INTEGER + unknown + T + + + + + Getxy + jr + 1 + unknown + 0 + + + + x + long + unknown + + + y + long + unknown + + + + - C_NotOneIsEven - - - - 0 - - - - long - ValOne - - - - long - ValEven - - - - + Add + jr + 1 + unknown + 0 + + + x + long + unknown + + + y + long + unknown + + + + + z + long + unknown + + + + + istream + INTEGER + unknown + I + + + ostream + INTEGER + unknown + I + + + OStream + INTEGER + unknown + I + + + - 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 - - - - + Sub + jr + 1 + unknown + 0 + + + x + long + unknown + + + y + long + unknown + + + + + z + long + unknown + + + + + istream + INTEGER + unknown + I + + + Istream + INTEGER + unknown + I + + + - LOOPi - - - - 0 - - - long - InLoop - - - - long - ii - - - - - - long - OutLoop - - - - long - i - - - - + Mul + jr + 1 + unknown + 0 + + + x + long + unknown + + + y + long + unknown + + + + + z + long + unknown + + + + - WHILEEVEN - - - - 0 - - - long - N - - - - - - long - OutLoop - - - - + Div + jr + 1 + unknown + 0 + + + x + long + unknown + + + y + long + unknown + + + + + z + long + unknown + + + + + ostream + INTEGER + unknown + I + + + + + NewDataStream + jr + 1 + unknown + 0 + + + + DataStream + DataStream + unknown + + + + - + DataStream + unknown + + + StreamSetxy + jr + 1 + unknown + 0 + 1 + + + objref + this + unknown + + + long + x + unknown + + + long + y + unknown + + + + + + istream + INTEGER + unknown + T + + + ostream + INTEGER + unknown + T + + + + + StreamGetxy + jr + 1 + unknown + 0 + 1 + + + objref + this + unknown + + + + + long + x + unknown + + + long + y + unknown + + + + + + StreamAdd + jr + 1 + unknown + 0 + 1 + + + objref + this + unknown + + + long + x + unknown + + + long + y + unknown + + + + + long + z + unknown + + + + + istream + INTEGER + unknown + I + + + ostream + INTEGER + unknown + I + + + OStream + INTEGER + unknown + I + + + + + StreamSub + jr + 1 + unknown + 0 + 1 + + + objref + this + unknown + + + long + x + unknown + + + long + y + unknown + + + + + long + z + unknown + + + + + istream + INTEGER + unknown + I + + + Istream + INTEGER + unknown + I + + + + + StreamMul + jr + 1 + unknown + 0 + 1 + + + objref + this + unknown + + + long + x + unknown + + + long + y + unknown + + + + + long + z + unknown + + + + + + StreamDiv + jr + 1 + unknown + 0 + 1 + + + objref + this + unknown + + + long + x + unknown + + + long + y + unknown + + + + + long + z + unknown + + + + + ostream + INTEGER + unknown + I + + + + + - - - TypesCheck - TypesCheck - - - - - 1 - - - - TypesCheck - - - - StringCheck - - - - 0 - - - string - InString - - - - - - string - OutString - - - - - - BoolCheck - - - - 0 - - - boolean - InBool - - - - - - boolean - OutBool - - - - - - CharCheck - - - - 0 - - - char - InChar - - - - - - char - OutChar - - - - - - ShortCheck - - - - 0 - - - short - InShort - - - - - - short - OutShort - - - - - - LongCheck - - - - 0 - - - long - InLong - - - - - - long - OutLong - - - - - - FloatCheck - - - - 0 - - - float - InFloat - - - - - - float - OutFloat - - - - - - DoubleCheck - - - - 0 - - - double - InDouble - - - - - - double - OutDouble - - - - - - ObjRefCheck - - - - 0 - - - SuperVisionTest::Adder - InObjRef - - - - - - SuperVisionTest::Adder - OutObjRef - - - - - - - MiscTypes - JR - 1.0 - Check of types - 1 - - - - string - InString - - - - boolean - InBool - - - - char - InChar - - - - short - InShort - - - - long - InLong - - - - float - InFloat - - - - double - InDouble - - - - SuperVisionTest::Adder - InObjRef - - - - - - string - OutString - - - - boolean - OutBool - - - - char - OutChar - - - - short - OutShort - - - - long - OutLong - - - - float - OutFloat - - - - double - OutDouble - - - - SuperVisionTest::Adder - OutObjRef - - - - - - - + diff --git a/src/AddComponent/AddComponent_Impl.cxx b/src/AddComponent/AddComponent_Impl.cxx index 491e79b..3574c08 100644 --- a/src/AddComponent/AddComponent_Impl.cxx +++ b/src/AddComponent/AddComponent_Impl.cxx @@ -80,7 +80,7 @@ double AddComponent_Impl::Add( double x , double y , double & z ) { sendMessage(NOTIF_STEP, "AddComponent_Impl::Add is Computing"); S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); MESSAGE( "AddComponent_Impl::Add( " << x << " , " << y << " , " << z << " ) returns " << (x - y) << " after " << S << " seconds" ) LastAddition = z ; @@ -107,7 +107,7 @@ double 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); + sleep(1); endService( " AddComponent_Impl::LastResult" ); return LastAddition ; } @@ -165,7 +165,7 @@ double Adder_Impl::Add( double x , double y , double & z ) { sendMessage(NOTIF_STEP, "Adder_Impl::Add is Computing"); S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); MESSAGE( "Adder_Impl::Add( " << x << " , " << y << " , " << z << " ) returns " << -(x - y) << " after " << S << " seconds" ) LastAddition = z ; @@ -182,7 +182,7 @@ double Adder_Impl::AddAndCompare( const double x , const double y , sendMessage(NOTIF_STEP, "Adder_Impl::AddAndCompare is Computing"); S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); MESSAGE( "Adder_Impl::AddAndCompare( " << x << " , " << y << " , " << z << " ) returns " << -(x - y) << " after " << S << " seconds" ) LastAddition = z ; @@ -207,7 +207,7 @@ void Adder_Impl::SetLastResult( double z ) { sendMessage(NOTIF_STEP, "Adder_Impl::SetLastResult is Computing"); int S; S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); LastAddition = z ; endService( " Adder_Impl::SetLastResult" ); return ; @@ -218,7 +218,7 @@ void Adder_Impl::LastResult( double & z ) { sendMessage(NOTIF_STEP, "Adder_Impl::LastResult is Computing"); int S; S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); z = LastAddition ; endService( " Adder_Impl::LastResult" ); return ; diff --git a/src/CalculatorComponent/CalculatorEngine.cxx b/src/CalculatorComponent/CalculatorEngine.cxx new file mode 100644 index 0000000..d6503dd --- /dev/null +++ b/src/CalculatorComponent/CalculatorEngine.cxx @@ -0,0 +1,687 @@ +// 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 : CalculatorEngine.cxx +// Author : Laurent DADA, CEA +// Module : CalculatorComponent +// $Header$ + +using namespace std; +#include +#include "utilities.h" +#include "CalculatorEngine.hxx" +#include +#include +#include "MEDMEM_Support_i.hxx" + +#include "MEDMEM_define.hxx" +#include "MEDMEM_STRING.hxx" +#include "MEDMEM_Exception.hxx" +#include "MEDMEM_Unit.hxx" + + +//================================================================================ +// static PrintFieldValues - shows field contents +//================================================================================ + +static void PrintFieldValues (FIELD * field, int until_index) +{ + const double * values = field -> getValue(MED_FULL_INTERLACE); + int nb_comp = field -> getNumberOfComponents(); + MESSAGE( "Field : " << field -> getName() ); + MESSAGE( " Description : " << field -> getDescription() ); + MESSAGE( " Number of components : " << nb_comp ); + + for (int i=0 ; i getComponentName(i+1) << endl \ + << " Unit : " << field -> getMEDComponentUnit(i+1) << endl \ + << " Description : " << field -> getComponentDescription(i+1) ); + } + MESSAGE( " First " << until_index << " values : " ); + + for (int j=0 ; j < until_index ; j++) { + for (int i=0;iactivate_object(_thisObj); + SALOME_NamingService *NS = new SALOME_NamingService(orb); + _NS=NS; +} + +CalculatorEngine::CalculatorEngine() +{ +} + +//================================================================================ +// Destructors +//================================================================================ + +CalculatorEngine::~CalculatorEngine() +{ +} + +SALOME_MED::FIELDDOUBLE_ptr CalculatorEngine::PutToStudy(SALOME_MED::FIELDDOUBLE_ptr theField1, + long int theStudyId) { + CORBA::Object_var anObj = _NS->Resolve("/myStudyManager"); + SALOMEDS::StudyManager_var aManager = SALOMEDS::StudyManager::_narrow(anObj); +// SALOMEDS::ListOfOpenStudies_var aList = aManager->GetOpenStudies(); +// SALOMEDS::Study_var aStudy = aManager->GetStudyByName(aList[0]); + SALOMEDS::Study_var aStudy = aManager->GetStudyByID(theStudyId); + SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder(); + + SALOMEDS::SComponent_var aComponent = aStudy->FindComponent("Calculator"); + if (aComponent->_is_nil()) aComponent = aBuilder->NewComponent("Calculator"); + SALOMEDS::GenericAttribute_var anAttr = aBuilder->FindOrCreateAttribute(aComponent, "AttributeName"); + SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue("Calculator"); + + SALOMEDS::SObject_var aSO = aBuilder->NewObject(aComponent); + anAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + char aFieldName[10]; + sprintf(aFieldName, "Field_%d", (int)aSO->Tag()); + aName->SetValue(strdup(aFieldName)); + + ORB_INIT &init = *SINGLETON_::Instance() ; + ASSERT(SINGLETON_::IsAlreadyExisting()) ; + CORBA::ORB_var &orb = init(0,0); + + string iorStr = orb->object_to_string(theField1); + anAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeIOR"); + SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(iorStr.c_str()); + + return SALOME_MED::FIELDDOUBLE::_duplicate(theField1); +} + + +//======================================================================================= +// Addition of 2 FieldNodeDouble (based on Med library) +// +// We assume that : +// - support +// - number of components +// - name, type, unit and description of components +// are the same for the 2 fields. +// +// Otherwise, +// the result will be a copy of the first field. +// +//======================================================================================= + +SALOME_MED::FIELDDOUBLE_ptr CalculatorEngine::Add(SALOME_MED::FIELDDOUBLE_ptr FirstField, + SALOME_MED::FIELDDOUBLE_ptr SecondField) +{ + ostringstream tmp; + bool same_support = true; + + beginService("CalculatorEngine::Add"); + + sendMessage(NOTIF_TRACE, "CalculatorEngine::Add is Computing"); + + BEGIN_OF("CalculatorEngine::Add(SALOME_MED::FIELDDOUBLE_ptr FirstField,SALOME_MED::FIELDDOUBLE_ptr SecondField)"); + + SCRUTE(FirstField); + SCRUTE(SecondField); + + string message = string("\n CalculatorEngine::Add : ") + + string("\n first field name --> ") + FirstField -> getName() + + string("\n second field name --> ") + SecondField -> getName(); + + sendMessage(NOTIF_TRACE, message.c_str()); + + // Number of components + int nb_comp1 = FirstField -> getNumberOfComponents(); + int nb_comp2 = SecondField -> getNumberOfComponents(); + if (nb_comp1 != nb_comp2) same_support = false; + MESSAGE( " nb_comp1 --> " << nb_comp1 < " << nb_comp2 < getComponentName(i+1)); + component_unit[i].assign(FirstField -> getComponentUnit(i+1)); + + if (same_support) { + if ( + (component_name[i] != SecondField -> getComponentName(i+1)) || + (component_unit[i] != SecondField -> getComponentUnit(i+1))) + same_support = false; + } + } + + MESSAGE("CalculatorEngine::Add Number of entities in the Support of each fields"); + + // Number of entities in the Support of the field + + int len_value1 = 0; + int len_value2 = 0; + SALOME_MED::SUPPORT_ptr support1 = FirstField -> getSupport(); + SALOME_MED::SUPPORT_ptr support2 = SecondField -> getSupport(); + + SCRUTE(support1); + + SCRUTE(support2); + + SALOME_MED::MESH_ptr mesh1 = support1 -> getMesh(); + SALOME_MED::MESH_ptr mesh2 = support2 -> getMesh(); + + SCRUTE(mesh1); + SCRUTE(mesh2); + + if (same_support && support1 != support2) same_support = false; + + if (support1 -> isOnAllElements()) + len_value1 = support1 -> getMesh() -> getNumberOfElements(support1 -> getEntity(),SALOME_MED::MED_ALL_ELEMENTS); + else + len_value1 = support1 -> getNumberOfElements(SALOME_MED::MED_ALL_ELEMENTS); + + SCRUTE(len_value1); + + if (support2 -> isOnAllElements()) + len_value2 = support2 -> getMesh() -> getNumberOfElements(support2 -> getEntity(),SALOME_MED::MED_ALL_ELEMENTS); + else + len_value2 = support2 -> getNumberOfElements(SALOME_MED::MED_ALL_ELEMENTS); + + if (same_support && len_value1 != len_value2) same_support = false; + + SCRUTE(len_value2); + + // Values of new field + SALOME_MED::double_array * first_value = FirstField -> getValue(SALOME_MED::MED_FULL_INTERLACE); + SALOME_MED::double_array * second_value; + if (same_support) { + second_value = SecondField -> getValue(SALOME_MED::MED_FULL_INTERLACE); + tmp << "\n CalculatorEngine::Add : " ; + tmp << "\n Number of entities in the Support of first field = " << len_value1 ; + tmp << "\n Number of entities in the Support of second field = " << len_value2 ; + message = tmp.str(); + + sendMessage(NOTIF_TRACE, message.c_str()); + + } + + int totalLength = nb_comp1*len_value1; + double * new_value = new double[totalLength]; + if (same_support) + { + sendMessage(NOTIF_TRACE, "CalculatorEngine::Add - field1 and field2 have the same support"); + + for(int i=0 ; i * fieldloc = new FIELD(); + fieldloc -> allocValue(nb_comp1,len_value1); + fieldloc -> setValue(MED_FULL_INTERLACE,new_value); + fieldloc -> setValueType(MED_EN::MED_REEL64); + fieldloc -> setName("-new_Add-"); + fieldloc -> setDescription( FirstField -> getDescription() ); + fieldloc -> setComponentsNames(component_name); + fieldloc -> setMEDComponentsUnits(component_unit); + + // Control + int until_index = ( 20 > len_value1)? len_value1 : 20; + PrintFieldValues (fieldloc,until_index); + + sendMessage(NOTIF_TRACE, "CalculatorEngine::Add - new field created"); + + // Export result + // Creation of the new CORBA field + + MESSAGE("CalculatorEngine::Add Creation of the CORBA field"); + + FIELDDOUBLE_i * NewField = new FIELDDOUBLE_i(support1,fieldloc) ; + + POA_SALOME_MED::FIELDDOUBLE_tie * myFieldTie = new POA_SALOME_MED::FIELDDOUBLE_tie(NewField) ; + SALOME_MED::FIELDDOUBLE_ptr myFieldIOR = myFieldTie->_this() ; + + sleep(4); + + END_OF("CalculatorEngine::Add(SALOME_MED::FIELDDOUBLE_ptr FirstField,SALOME_MED::FIELDDOUBLE_ptr SecondField)"); + + endService("CalculatorEngine::Add"); + return myFieldIOR; + +} + + +//=============================================================================== +// Multiplication of a FieldNodeDouble by a double value (based on Med library) +//=============================================================================== + +SALOME_MED::FIELDDOUBLE_ptr CalculatorEngine::Mul(SALOME_MED::FIELDDOUBLE_ptr OldField, + CORBA::Double x1) +{ + beginService("CalculatorEngine::Mul"); + + BEGIN_OF("CalculatorEngine::Mul(SALOME_MED::FIELDDOUBLE_ptr OldField,CORBA::Double x1)"); + + SCRUTE(OldField); + SCRUTE(x1); + + // Name and description of field + string field_name = OldField -> getName(); + string field_description = OldField -> getDescription(); + + // Number of components + int nb_comp = OldField -> getNumberOfComponents(); + string * component_name = new string[nb_comp]; + string * component_unit = new string[nb_comp]; + + for (int i=0 ; i getComponentName(i+1); + component_unit[i] = OldField -> getComponentUnit(i+1); + } + + MESSAGE("CalculatorEngine::Mul Number of entities in the Support of the field"); + + // Number of entities in the Support of the field + int len_value = 0; + + SALOME_MED::SUPPORT_ptr support = OldField -> getSupport(); + + SCRUTE(support); + + SALOME_MED::MESH_ptr mesh = support -> getMesh(); + + SCRUTE(mesh); + + if (support -> isOnAllElements()) + len_value = support -> getMesh() -> getNumberOfElements(support -> getEntity(),SALOME_MED::MED_ALL_ELEMENTS); + else + len_value = support -> getNumberOfElements(SALOME_MED::MED_ALL_ELEMENTS); + + SCRUTE(len_value); + + // Values of new field + SALOME_MED::double_array * old_value = OldField -> getValue(SALOME_MED::MED_FULL_INTERLACE); + + int totalLength = nb_comp*len_value; + double * new_value = new double[totalLength]; + for(int i=0 ; i * fieldloc = new FIELD(); + fieldloc -> allocValue(nb_comp,len_value); + fieldloc -> setValue(MED_FULL_INTERLACE,new_value); + fieldloc -> setValueType(MED_EN::MED_REEL64); + fieldloc -> setName("-new_Mul-"); + fieldloc -> setDescription(field_description); + fieldloc -> setComponentsNames(component_name); + fieldloc -> setMEDComponentsUnits(component_unit); + + + // Creation of the new CORBA field + + MESSAGE("CalculatorEngine::Mul Creation of the CORBA field"); + + FIELDDOUBLE_i * NewField = new FIELDDOUBLE_i(support,fieldloc) ; + + POA_SALOME_MED::FIELDDOUBLE_tie * myFieldTie = new POA_SALOME_MED::FIELDDOUBLE_tie(NewField) ; + SALOME_MED::FIELDDOUBLE_ptr myFieldIOR = myFieldTie->_this() ; + + sleep(4); + + END_OF("CalculatorEngine::Mul(SALOME_MED::FIELDDOUBLE_ptr OldField,CORBA::Double x1)"); + + endService("CalculatorEngine::Mul"); + return myFieldIOR; +} + + +//================================================================================ +// Build a constant field of double based on first field support (Med library) +//================================================================================ + +SALOME_MED::FIELDDOUBLE_ptr CalculatorEngine::Constant(SALOME_MED::FIELDDOUBLE_ptr FirstField, + CORBA::Double x1) +{ + + beginService("CalculatorEngine::Const"); + + BEGIN_OF("CalculatorEngine::Constant(SALOME_MED::FIELDDOUBLE_ptr FirstField,CORBA::Double x1)"); + + // Name and description of field + string field_name = FirstField -> getName(); + string field_description = FirstField -> getDescription(); + + SALOME_MED::SUPPORT_ptr FirstSupport = FirstField -> getSupport(); + + // Number of components + int nb_comp = FirstField -> getNumberOfComponents(); + + // Type, name, unit and description of components + string * component_name = new string[nb_comp]; + string * component_unit = new string[nb_comp]; + + for (int i = 0 ; i getComponentName(i+1); + component_unit[i] = FirstField -> getComponentUnit(i+1); + } + + MESSAGE("CalculatorEngine::Constant Number of entities in the Support of the field"); + + // Number of entities in the Support of the field + int len_value = 0; + + SCRUTE(FirstSupport); + + SALOME_MED::MESH_ptr mesh = FirstSupport -> getMesh(); + + SCRUTE(mesh); + + if ( FirstSupport -> isOnAllElements() ) + len_value = FirstSupport -> getMesh() -> getNumberOfElements(FirstSupport -> getEntity(),SALOME_MED::MED_ALL_ELEMENTS); + else + len_value = FirstSupport -> getNumberOfElements(SALOME_MED::MED_ALL_ELEMENTS); + + // Values of new field + SALOME_MED::double_array * old_value = FirstField -> getValue(SALOME_MED::MED_FULL_INTERLACE); + + int totalLength = nb_comp*len_value; + double * new_value = new double[totalLength]; + + for(int i=0 ; i * fieldloc = new FIELD(); + fieldloc -> allocValue(nb_comp,len_value); + fieldloc -> setValue(MED_FULL_INTERLACE,new_value); + fieldloc -> setValueType(MED_EN::MED_REEL64); + fieldloc -> setName("-new_Const_Field-"); + fieldloc -> setDescription(field_description); + fieldloc -> setComponentsNames(component_name); + fieldloc -> setMEDComponentsUnits(component_unit); + + // Control + int until_index = ( 20 > len_value)? len_value : 20 ; + PrintFieldValues (fieldloc,until_index); + + // Creation of the new CORBA field + + MESSAGE("CalculatorEngine::Constant Creation of the CORBA field"); + + FIELDDOUBLE_i * NewField = new FIELDDOUBLE_i(FirstSupport,fieldloc) ; + + POA_SALOME_MED::FIELDDOUBLE_tie * myFieldTie = new POA_SALOME_MED::FIELDDOUBLE_tie(NewField) ; + SALOME_MED::FIELDDOUBLE_ptr myFieldIOR = myFieldTie->_this() ; + + sleep(4); + + endService("CalculatorEngine::Const"); + + END_OF("CalculatorEngine::Constant(SALOME_MED::FIELDDOUBLE_ptr FirstField,CORBA::Double x1)"); + + return myFieldIOR; + +} + +//================================================================================ +// write a field in a MED file +//================================================================================ + +void CalculatorEngine::writeMEDfile(SALOME_MED::FIELDDOUBLE_ptr field, const char *filename) +{ + beginService("CalculatorEngine::writeMEDfile"); + MESSAGE("fichier d'impression du champ resultat:"< getSupport(); + + // get mesh from this support + + SALOME_MED::MESH_ptr mesh = support -> getMesh(); + + // write the mesh + + int index_m = mesh->addDriver(SALOME_MED::MED_DRIVER,filename,mesh->getName()); + + mesh -> write(index_m,""); + + //write the field + + const char * LOC = "CalculatorEngine::writeMEDfile "; + + MESSAGE("fichier :"< (filename) ,(MED_FR::med_mode_acces) MED_ECRI); + SCRUTE(_medIdt); + + if (_medIdt<0) return; + + int err ; + + int component_count= field->getNumberOfComponents(); + string component_name(component_count*MED_TAILLE_PNOM,' ') ; + string component_unit(component_count*MED_TAILLE_PNOM,' ') ; + + for (int i=0; i < component_count ; i++) { + component_name.replace(i*MED_TAILLE_PNOM,MED_TAILLE_PNOM,(field -> getComponentName(i+1)),0,MED_TAILLE_PNOM); + component_unit.replace(i*MED_TAILLE_PNOM,MED_TAILLE_PNOM,(field -> getComponentUnit(i+1)),0,MED_TAILLE_PNOM); + } + + MESSAGE("component_name=|"<getName())==0) { // Found ! + Find = true ; + break ; + } + + delete[] compName ; + delete[] compUnit ; + + } + if (Find) { + // the same ? + if (nbComp != component_count) + throw MEDEXCEPTION ( LOCALIZED (STRING(LOC) + <<": Field exist in file, but number of component are different : " \ + <getName()); + + MESSAGE(LOC << "|" << dataGroupName << "|" ); + + med_idt gid = H5Gopen(_medIdt, dataGroupName.c_str() ); + + if ( gid < 0 ) { + // create field : + err=MED_FR::MEDchampCr(_medIdt, + const_cast (field->getName()), + MED_FR::MED_REEL64, + const_cast ( component_name.c_str() ), + const_cast ( component_unit.c_str() ), + component_count); + if ( err < 0 ) + throw MEDEXCEPTION( LOCALIZED (STRING(LOC) + << ": Error MEDchampCr : "< getSupport(); + SCRUTE(mySupport); + + if (! mySupport->isOnAllElements()) + throw MEDEXCEPTION ( LOCALIZED (STRING(LOC) + <<": Field must be on all entity" + ) + ); + + SALOME_MED::MESH_ptr myMesh = mySupport -> getMesh(); + SCRUTE(mesh); + + SALOME_MED::medGeometryElement_array* Types = mySupport->getTypes() ; + + int NumberOfType = Types->length() ; + + for ( int i = 0; i < NumberOfType; i++ ) + { + int NumberOfElements = mySupport->getNumberOfElements ( (*Types)[i] ) ; + int NumberOfGaussPoint = mySupport->getNumberOfGaussPoint ( (*Types)[i] ) ; + + MESSAGE( " " << field->getName() ); + MESSAGE( " " << NumberOfElements ); + MESSAGE( " " << NumberOfGaussPoint ); + MESSAGE( " " << (int) (convertIdlEntToMedEnt(mySupport->getEntity())) ); + MESSAGE( " " << (int)(convertIdlEltToMedElt((*Types)[i])) ); + MESSAGE( " " << field->getIterationNumber() ); + MESSAGE( " " << field->getTime() ); + MESSAGE( " " << field->getOrderNumber() ); + MESSAGE( "MEDchampEcr :" << myMesh->getName() ); + + SALOME_MED::double_array * value = field->getValue( SALOME_MED::MED_FULL_INTERLACE ) ; + double *locvalue = new double[NumberOfElements]; + for (int k = 0; k < NumberOfElements; k++) + locvalue[k] = (*value) [k]; + + err=MED_FR::MEDchampEcr(_medIdt, + const_cast (myMesh->getName()) , + const_cast (field->getName()), + (unsigned char*)locvalue, + MED_FR::MED_FULL_INTERLACE, + NumberOfElements, + NumberOfGaussPoint, + MED_ALL, + MED_NOPFL, + MED_FR::MED_REMP, + (MED_FR::med_entite_maillage)convertIdlEntToMedEnt(mySupport->getEntity()), + (MED_FR::med_geometrie_element)(convertIdlEltToMedElt((*Types)[i])), + field->getIterationNumber(), + " ", + field->getTime(), + field->getOrderNumber() + ); + delete locvalue; + + if (err < MED_VALID ) + throw MEDEXCEPTION(LOCALIZED( STRING(LOC) + <<": Error in writing Field "<< field->getName() <<", type "<<(*Types)[i] + ) + ); + } + END_OF( LOC ); + + SCRUTE( err ); + if (err < 0 ) return ; + + MED_FR::MEDfermer(_medIdt) ; + + endService("CalculatorEngine::writeMEDfile"); + return ; + +} + +extern "C" +{ + //=========================================================================== + // CalculatorEngine_factory + //=========================================================================== + PortableServer::ObjectId * CalculatorEngine_factory + (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) + { + MESSAGE("CalculatorEngine_factory CalculatorEngine (" + << instanceName << "," << interfaceName << ")"); + CalculatorEngine * myCalculator + = new CalculatorEngine(orb, poa, contId, instanceName, interfaceName); + return myCalculator->getId() ; + } +} + diff --git a/src/CalculatorComponent/CalculatorEngine.hxx b/src/CalculatorComponent/CalculatorEngine.hxx new file mode 100644 index 0000000..31b6149 --- /dev/null +++ b/src/CalculatorComponent/CalculatorEngine.hxx @@ -0,0 +1,87 @@ +// 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 : CalculatorEngine.hxx +// Author : Laurent DADA, CEA +// Module : CalculatorComponent +// $Header : Exp $ + +#ifndef _CALCULATORWRAPPER_HXX_ +#define _CALCULATORWRAPPER_HXX_ + +// IDL headers +#include +#include +#include CORBA_SERVER_HEADER(Calculator) +#include "SALOME_Component_i.hxx" +#include CORBA_CLIENT_HEADER(MED) +#include "MEDMEM_Med_i.hxx" +#include "MEDMEM_Field.hxx" +#include "MEDMEM_FieldDouble_i.hxx" + +#include "SALOME_NamingService.hxx" + +class CalculatorEngine : + virtual public POA_SuperVisionTest::Calculator, + public Engines_Component_i +{ + +public: + CalculatorEngine() ; + CalculatorEngine( CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName); + + virtual ~CalculatorEngine(); + + + SALOME_MED::FIELDDOUBLE_ptr PutToStudy(SALOME_MED::FIELDDOUBLE_ptr theField, + long int theStudyId); + + SALOME_MED::FIELDDOUBLE_ptr Add(SALOME_MED::FIELDDOUBLE_ptr FirstField, + SALOME_MED::FIELDDOUBLE_ptr SecondField); + + SALOME_MED::FIELDDOUBLE_ptr Mul(SALOME_MED::FIELDDOUBLE_ptr OldField, + CORBA::Double x1); + + SALOME_MED::FIELDDOUBLE_ptr Constant(SALOME_MED::FIELDDOUBLE_ptr FirstField, + CORBA::Double x1); + + void writeMEDfile(SALOME_MED::FIELDDOUBLE_ptr field1 , + const char *fileName); + +private: + + SALOME_NamingService * _NS ; + +}; + +extern "C" + PortableServer::ObjectId * CalculatorEngine_factory + (CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName ) ; + +#endif diff --git a/src/CalculatorComponent/Makefile.in b/src/CalculatorComponent/Makefile.in new file mode 100755 index 0000000..04cc930 --- /dev/null +++ b/src/CalculatorComponent/Makefile.in @@ -0,0 +1,60 @@ +# 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@ + +# Libraries targets + +LIB = libCalculatorEngine.la +LIB_SRC = CalculatorEngine.cxx +#LIB_SERVER_IDL = Calculator.idl SALOME_Exception.idl SALOME_Component.idl SALOMEDS.idl SALOMEDS_Attributes.idl MED.idl +LIB_SERVER_IDL = Calculator.idl +LIB_CLIENT_IDL = SALOME_Exception.idl SALOME_Component.idl SALOMEDS.idl SALOMEDS_Attributes.idl MED.idl +# Executables targets +BIN = +BIN_SRC = +BIN_CLIENT_IDL = +BIN_SERVER_IDL = + +EXPORT_HEADERS = + +CPPFLAGS+= $(PYTHON_INCLUDES) $(HDF5_INCLUDES) $(MED2_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I${MED_ROOT_DIR}/include/salome +CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ $(PYTHON_INCLUDES) -ftemplate-depth-42 -Wall -I${KERNEL_ROOT_DIR}/include/salome -I${MED_ROOT_DIR}/include/salome +LDFLAGS+= -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeContainer -lSalomeNS -lOpUtil -lRegistry -lSalomeNotification -lSALOMELocalTrace -L${MED_ROOT_DIR}/lib/salome -lMEDEngine + + +MED.hh MEDSK.cc: ${MED_ROOT_DIR}/idl/salome/MED.idl + omniidl -bcxx -Wbtp -I${KERNEL_ROOT_DIR}/idl/salome $^ + +@CONCLUDE@ diff --git a/src/DataStreamComponent/DataStreamComponent_CheckOfUndefined.cxx b/src/DataStreamComponent/DataStreamComponent_CheckOfUndefined.cxx new file mode 100644 index 0000000..05cfb16 --- /dev/null +++ b/src/DataStreamComponent/DataStreamComponent_CheckOfUndefined.cxx @@ -0,0 +1,37 @@ +// SuperVisionTest DataStreamComponent : example of component +// +// 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 : DataStreamComponent_CheckOfUndefined.cxx +// Module : SuperVisionTest + +using namespace std; +#include +#include +#include + +#include "DataStreamComponent_Impl.hxx" + +int main(int argc, char **argv) { + return 0; +} + diff --git a/src/DataStreamComponent/DataStreamComponent_Impl.cxx b/src/DataStreamComponent/DataStreamComponent_Impl.cxx new file mode 100644 index 0000000..0cfff2a --- /dev/null +++ b/src/DataStreamComponent/DataStreamComponent_Impl.cxx @@ -0,0 +1,160 @@ +// SuperVisionTest DataStreamComponent : example +// +// 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 : DataStreamComponent_Impl.cxx +// Author : Jean Rahuel +// Module : SuperVisionTest + +using namespace std; +#include +#include +#include +#include +#include + +#include "DataStreamComponent_Impl.hxx" + +DataStreamFactory_Impl::DataStreamFactory_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("DataStreamFactory_Impl::DataStreamFactory_Impl this " << hex << this << dec + << "activate object instanceName(" + << instanceName << ") interfaceName(" << interfaceName << ")" ) + _thisObj = this ; + _id = _poa->activate_object(_thisObj); +} + +DataStreamFactory_Impl::DataStreamFactory_Impl() { +} + +DataStreamFactory_Impl::~DataStreamFactory_Impl() { +} + +void DataStreamFactory_Impl::Setxy( const long x , const long y ) { + _x = x ; + _y = y ; +} + +void DataStreamFactory_Impl::Getxy( long & x , long & y ) { + x = _x ; + y = _y ; +} + +void DataStreamFactory_Impl::Add( const long x , const long y , long & z ) { + z = x+y ; +} +void DataStreamFactory_Impl::Sub( const long x , const long y , long & z ) { + z = x-y ; +} +void DataStreamFactory_Impl::Mul( const long x , const long y , long & z ) { + z = x*y ; +} +void DataStreamFactory_Impl::Div( const long x , const long y , long & z ) { + z = x/y ; +} + +DataStreamComponent::DataStream_ptr DataStreamFactory_Impl::NewDataStream() { + beginService( "DataStreamFactory_Impl::NewDataStream" ); + sendMessage(NOTIF_STEP, "DataStreamFactory_Impl creates DataStream_Impl"); + DataStream_Impl * myDataStream ; + myDataStream = new DataStream_Impl( _orb , _poa, _contId, + instanceName() , interfaceName() , + graphName() , nodeName() ) ; + DataStreamComponent::DataStream_var iobject ; + PortableServer::ObjectId * id = myDataStream->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = DataStreamComponent::DataStream::_narrow(obj) ; + endService( "DataStreamFactory_Impl::NewDataStream" ); + return DataStreamComponent::DataStream::_duplicate(iobject) ; +} + +extern "C" +{ + PortableServer::ObjectId * DataStreamFactoryEngine_factory + (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) + { + MESSAGE("DataStreamFactoryEngine_factory DataStreamFactoryEngine (" + << instanceName << "," << interfaceName << "," << getpid() << ")"); + DataStreamFactory_Impl * myDataStreamFactory + = new DataStreamFactory_Impl(orb, poa, contId, instanceName, interfaceName); + return myDataStreamFactory->getId() ; + } +} + +DataStream_Impl::DataStream_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("DataStream_Impl::DataStream_Impl activate object instanceName(" + << instanceName << ") interfaceName(" << interfaceName << ") --> " + << hex << (void *) this << dec ) + beginService( "DataStream_Impl::DataStream_Impl" ); + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + sendMessage(NOTIF_STEP, "DataStream_Impl is Created"); + endService( "DataStream_Impl::DataStream_Impl" ); +} + +DataStream_Impl::DataStream_Impl() { +} + +DataStream_Impl::~DataStream_Impl() { + beginService( "DataStream_Impl::~DataStream_Impl" ); + endService( "DataStream_Impl::~DataStream_Impl" ); +} + +void DataStream_Impl::StreamSetxy( const long x , const long y ) { + _x = x ; + _y = y ; +} + +void DataStream_Impl::StreamGetxy( long & x , long & y ) { + x = _x ; + y = _y ; +} + +void DataStream_Impl::StreamAdd( const long x , const long y , long & z ) { + z = x+y ; +} +void DataStream_Impl::StreamSub( const long x , const long y , long & z ) { + z = x-y ; +} +void DataStream_Impl::StreamMul( const long x , const long y , long & z ) { + z = x*y ; +} +void DataStream_Impl::StreamDiv( const long x , const long y , long & z ) { + z = x/y ; +} + diff --git a/src/DataStreamComponent/DataStreamComponent_Impl.hxx b/src/DataStreamComponent/DataStreamComponent_Impl.hxx new file mode 100644 index 0000000..6998143 --- /dev/null +++ b/src/DataStreamComponent/DataStreamComponent_Impl.hxx @@ -0,0 +1,106 @@ +// SuperVisionTest DataStreamComponent : example of component +// +// 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 : DataStreamComponent_Impl.hxx +// Author : Jean Rahuel +// Module : SuperVisionTest +// $Header: + +#ifndef _DATASTREAMINTERFACE_IMPL_HXX_ +#define _DATASTREAMINTERFACE_IMPL_HXX_ + +#include +#include CORBA_SERVER_HEADER(DataStreamComponent) +#include CORBA_SERVER_HEADER(SALOME_Component) +#include "SALOME_Component_i.hxx" + +class DataStreamFactory_Impl : public POA_DataStreamComponent::DataStreamFactory , + public Engines_Component_i { +public: + DataStreamFactory_Impl() ; + DataStreamFactory_Impl( CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName); + + virtual ~DataStreamFactory_Impl(); + + virtual void Setxy( const long x , const long y ) ; + + virtual void Getxy( long & x , long & y ) ; + + virtual void Add( const long x , const long y , long & z ) ; + virtual void Sub( const long x , const long y , long & z ) ; + virtual void Mul( const long x , const long y , long & z ) ; + virtual void Div( const long x , const long y , long & z ) ; + + virtual DataStreamComponent::DataStream_ptr NewDataStream() ; + +private: + + long _x ; + long _y ; + +}; + +extern "C" + PortableServer::ObjectId * DataStreamFactoryEngine_factory + ( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName ) ; + + +class DataStream_Impl : public POA_DataStreamComponent::DataStream , + public Engines_Component_i { +public: + DataStream_Impl() ; + DataStream_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 ~DataStream_Impl(); + + virtual void StreamSetxy( const long x , const long y ) ; + + virtual void StreamGetxy( long & x , long & y ) ; + + virtual void StreamAdd( const long x , const long y , long & z ) ; + virtual void StreamSub( const long x , const long y , long & z ) ; + virtual void StreamMul( const long x , const long y , long & z ) ; + virtual void StreamDiv( const long x , const long y , long & z ) ; + +private: + + long _x ; + long _y ; + +}; + +#endif diff --git a/src/DataStreamComponent/Makefile.in b/src/DataStreamComponent/Makefile.in new file mode 100644 index 0000000..d359713 --- /dev/null +++ b/src/DataStreamComponent/Makefile.in @@ -0,0 +1,60 @@ +# SUPERV DataStreamComponent : example of component +# +# 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 : Jean Rahuel +# Module : SUPERV +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +EXPORT_HEADERS = \ + DataStreamComponent_Impl.hxx + +# Libraries targets +LIB = libDataStreamFactoryEngine.la +LIB_SRC = \ + DataStreamComponent_Impl.cxx + +LIB_SERVER_IDL = SALOME_Component.idl \ + DataStreamComponent.idl + +# Executables targets +BIN = DataStreamComponent_CheckOfUndefined +BIN_SRC = +BIN_SERVER_IDL = + +CPPFLAGS+= $(PYTHON_INCLUDES) \ + -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS+= -lSalomeContainer -lSalomeNS -lOpUtil -lRegistry -lSalomeNotification -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace + +LDFLAGSFORBIN+= -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeContainer -lSalomeNS -lOpUtil -lRegistry -lSalomeNotification -lSALOMELocalTrace + +@CONCLUDE@ + diff --git a/src/DivComponent/DivComponent.cxx b/src/DivComponent/DivComponent.cxx index 4a4522f..ab84e79 100644 --- a/src/DivComponent/DivComponent.cxx +++ b/src/DivComponent/DivComponent.cxx @@ -64,7 +64,7 @@ void DivComponentEngine::Div( double x , double y , double & z ) { sendMessage(NOTIF_STEP, "Div is Computing"); S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); sendMessage(NOTIF_TRACE, "Div is Much More Difficult Operation"); MESSAGE("DivComponentEngine::Div( " << x << " , " << y << " , " << z << " ) after " << S << " seconds" ) diff --git a/src/Makefile.in b/src/Makefile.in index 9b3ce3d..c20e8ec 100755 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -21,17 +21,16 @@ # # File : Makefile.in # Author : Patrick GOLDBRONN (CEA) -# Module : SuperVisionTest -# $Header: +# Module : COMPONENT +# $Header$ top_srcdir=@top_srcdir@ top_builddir=.. srcdir=@srcdir@ VPATH=.:@srcdir@ - @COMMENCE@ -SUBDIRS = AddComponent DivComponent FactorialComponent MulComponent SubComponent SyrComponent SyrControlComponent TypesCheck +SUBDIRS = AddComponent DivComponent FactorialComponent MulComponent SubComponent SyrControlComponent SyrComponent TypesCheck DataStreamComponent CalculatorComponent @MODULE@ diff --git a/src/MulComponent/MulComponent.cxx b/src/MulComponent/MulComponent.cxx index 1b4c41f..32d0bcd 100644 --- a/src/MulComponent/MulComponent.cxx +++ b/src/MulComponent/MulComponent.cxx @@ -64,7 +64,7 @@ void MulComponentEngine::Mul( double x , double y , double & z ) { sendMessage(NOTIF_STEP, "Mul is Computing"); S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); MESSAGE( "MulComponentEngine::Mul( " << x << " , " << y << " , " << z << " ) after " << S << " seconds" ) endService( " MulComponentEngine::Mul" ); diff --git a/src/SubComponent/SubComponent.cxx b/src/SubComponent/SubComponent.cxx index 76ed6e1..e5cd824 100644 --- a/src/SubComponent/SubComponent.cxx +++ b/src/SubComponent/SubComponent.cxx @@ -64,7 +64,7 @@ void SubComponentEngine::Sub( double x , double y , double & z ) { sendMessage(NOTIF_STEP, "Sub is Computing"); S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); MESSAGE( "SubComponentEngine::Sub( " << x << " , " << y << " , " << z << " ) after " << S << " seconds" ) endService( " SubComponentEngine::Sub" ); diff --git a/src/SyrComponent/COMPONENT_shared_modules.py b/src/SyrComponent/COMPONENT_shared_modules.py index 1dad963..9e85b61 100644 --- a/src/SyrComponent/COMPONENT_shared_modules.py +++ b/src/SyrComponent/COMPONENT_shared_modules.py @@ -9,6 +9,7 @@ print "============== import SuperVisionTest =======================" import SuperVisionTest +import DataStreamComponent # this function is required diff --git a/src/SyrComponent/SyrComponent_Impl.cxx b/src/SyrComponent/SyrComponent_Impl.cxx index 3c93ed7..c80e1b2 100755 --- a/src/SyrComponent/SyrComponent_Impl.cxx +++ b/src/SyrComponent/SyrComponent_Impl.cxx @@ -64,7 +64,7 @@ long SyrComponent_Impl::C_ISEVEN( const long anInteger ) { 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); + sleep(1); RetVal = ( anInteger & 1 ) == 0 ; endService( " SyrComponent_Impl::C_ISEVEN" ); return RetVal ; @@ -75,7 +75,7 @@ long SyrComponent_Impl::C_ISONE( const long anOddInteger ) { 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); + sleep(1); RetVal = ( anOddInteger == 1 ) ; endService( " SyrComponent_Impl::C_ISONE" ); return RetVal ; @@ -85,7 +85,7 @@ 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); + sleep(1); endService( " SyrComponent_Impl::C_M3" ); if ( C_ISEVEN( anOddInteger ) ) return 0 ; @@ -96,7 +96,7 @@ 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); + sleep(1); endService( " SyrComponent_Impl::C_M3P1" ); if ( C_ISEVEN( anOddInteger ) ) return 0 ; @@ -107,7 +107,7 @@ 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); + sleep(1); endService( " SyrComponent_Impl::C_DIV2" ); if ( !C_ISEVEN( anEvenInteger ) ) return 0 ; @@ -118,7 +118,7 @@ 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); + sleep(1); endService( " SyrComponent_Impl::C_INCR" ); return ( aCount + 1 ) ; } @@ -127,7 +127,7 @@ 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); + sleep(1); int min = aMinVal ; if ( anInteger < min || aMinVal == 0 ) { min = anInteger ; @@ -145,7 +145,7 @@ 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); + sleep(1); int max = aMaxVal ; if ( anInteger > max ) { max = anInteger ; @@ -163,7 +163,7 @@ 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); + sleep(1); ListOfSyr_Impl * aNewListOfSyr = new ListOfSyr_Impl( _orb , _poa, _contId, instanceName() , interfaceName() , graphName() , nodeName() ) ; @@ -184,7 +184,7 @@ SuperVisionTest::ListOfSyr_ptr SyrComponent_Impl::C_AVERAGE( 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); + sleep(1); SuperVisionTest::SeqOfSyr * aSeqOfSyr = aListOfSyr->GetSeqOfSyr() ; int len = aSeqOfSyr->length() ; aSeqOfSyr->length( len + 1 ) ; @@ -208,7 +208,7 @@ 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); + sleep(1); Syr_Impl * mySyr ; mySyr = new Syr_Impl( _orb , _poa, _contId, instanceName() , interfaceName() , @@ -310,7 +310,7 @@ 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); + sleep(1); endService( " Syr_Impl::Initial" ); return _InitialInteger ; } @@ -319,7 +319,7 @@ 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); + sleep(1); endService( " Syr_Impl::Current" ); return _CurrentInteger ; } @@ -329,7 +329,7 @@ long Syr_Impl::IsEven() { 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); + sleep(1); RetVal = ( _CurrentInteger & 1 ) == 0 ; MESSAGE( " Syr_Impl::IsEven " << _CurrentInteger << " " << RetVal ); endService( " Syr_Impl::IsEven" ); @@ -341,7 +341,7 @@ long Syr_Impl::IsOne() { 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); + sleep(1); RetVal = ( _CurrentInteger == 1 ) ; MESSAGE( " Syr_Impl::IsOne " << _CurrentInteger << " " << RetVal ); endService( " Syr_Impl::IsOne" ); @@ -352,7 +352,7 @@ 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); + sleep(1); MESSAGE( " Syr_Impl::Count " << _Count ); endService( " Syr_Impl::Count" ); return _Count ; @@ -362,7 +362,7 @@ 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); + sleep(1); if ( IsEven() ) _CurrentInteger = 0 ; else @@ -375,7 +375,7 @@ 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); + sleep(1); if ( !IsEven() ) _CurrentInteger = 0 ; else @@ -388,7 +388,7 @@ 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); + sleep(1); _Count = _Count + 1 ; MESSAGE( " Syr_Impl::Incr " << _Count ); endService( " Syr_Impl::Incr" ); -- 2.39.2