Salome HOME
*** empty log message ***
authorrahuel <rahuel@opencascade.com>
Tue, 15 Feb 2005 14:14:53 +0000 (14:14 +0000)
committerrahuel <rahuel@opencascade.com>
Tue, 15 Feb 2005 14:14:53 +0000 (14:14 +0000)
src/SubComponent/SubComponent.cxx
src/SyrComponent/SyrComponent_Impl.cxx
src/TestFunctions/DynInvoke.cxx [new file with mode: 0644]
src/TestFunctions/DynInvoke.hxx [new file with mode: 0644]
src/TestFunctions/GEOM.py [new file with mode: 0644]
src/TestFunctions/Makefile.in [new file with mode: 0644]
src/TestFunctions/TestFunctions.cxx [new file with mode: 0644]
src/TestFunctions/TestFunctions.py [new file with mode: 0644]
src/UndefinedSymbolComponent/Makefile.in [new file with mode: 0755]
src/UndefinedSymbolComponent/UndefinedSymbolComponent.cxx [new file with mode: 0755]
src/UndefinedSymbolComponent/UndefinedSymbolComponent.hxx [new file with mode: 0755]

index 76ed6e197f375139438bcaa1490d30ffdc90b235..7b35c6dbdd533ee5f8b540ca0e39f4a21fec6fb1 100644 (file)
@@ -63,8 +63,11 @@ void SubComponentEngine::Sub( double x , double y , double & z ) {
   int S;
   
   sendMessage(NOTIF_STEP, "Sub is Computing");
-  S = 1+(int) (15.0*rand()/(RAND_MAX+1.0));
-  sleep(S);
+//  S = 1+(int) (15.0*rand()/(RAND_MAX+1.0));
+  S = 5 ;
+  while ( S ) {
+    S = sleep(S);
+  }
   MESSAGE( "SubComponentEngine::Sub( " <<  x << " , " << y << " , " << z
        << " ) after " << S << " seconds" )
   endService( " SubComponentEngine::Sub"  );
index 3c93ed7000007ee0a3cae68c4a8bbfefbc95a25e..be0ace40f42bad434bf804e46d7c577e1017cfcd 100755 (executable)
@@ -63,8 +63,11 @@ 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);
+//  int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 3 ;
+  while ( S ) {
+    S = sleep(S);
+  }
   RetVal = ( anInteger & 1 ) == 0 ;
   endService( " SyrComponent_Impl::C_ISEVEN"  );
   return RetVal ;
@@ -74,8 +77,11 @@ 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);
+//  int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 3 ;
+  while ( S ) {
+    S = sleep(S);
+  }
   RetVal = ( anOddInteger == 1 ) ;
   endService( " SyrComponent_Impl::C_ISONE"  );
   return RetVal ;
@@ -84,8 +90,11 @@ long SyrComponent_Impl::C_ISONE( const long anOddInteger ) {
 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);
+//  int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 3 ;
+  while ( S ) {
+    S = sleep(S);
+  }
   endService( " SyrComponent_Impl::C_M3"  );
   if ( C_ISEVEN( anOddInteger ) )
     return 0 ;
@@ -95,8 +104,11 @@ long SyrComponent_Impl::C_M3( const long 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);
+//  int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 3 ;
+  while ( S ) {
+    S = sleep(S);
+  }
   endService( " SyrComponent_Impl::C_M3P1"  );
   if ( C_ISEVEN( anOddInteger ) )
     return 0 ;
@@ -106,8 +118,11 @@ long SyrComponent_Impl::C_M3P1( const long anOddInteger ) {
 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);
+//  int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 3 ;
+  while ( S ) {
+    S = sleep(S);
+  }
   endService( " SyrComponent_Impl::C_DIV2"  );
   if ( !C_ISEVEN( anEvenInteger ) )
     return 0 ;
@@ -117,8 +132,11 @@ long SyrComponent_Impl::C_DIV2( const long anEvenInteger ) {
 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);
+//  int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 3 ;
+  while ( S ) {
+    S = sleep(S);
+  }
   endService( " SyrComponent_Impl::C_INCR"  );
   return ( aCount + 1 ) ;
 }
@@ -126,8 +144,11 @@ long SyrComponent_Impl::C_INCR( const long aCount ) {
 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 S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 3 ;
+  while ( S ) {
+    S = sleep(S);
+  }
   int min = aMinVal ;
   if ( anInteger < min || aMinVal == 0 ) {
     min = anInteger ;
@@ -144,8 +165,11 @@ long SyrComponent_Impl::C_MIN( const long aMinVal , const long anInteger ) {
 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 S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 3 ;
+  while ( S ) {
+    S = sleep(S);
+  }
   int max = aMaxVal ;
   if ( anInteger > max ) {
     max = anInteger ;
@@ -162,8 +186,11 @@ long SyrComponent_Impl::C_MAX( const long aMaxVal , const long anInteger ) {
 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);
+//  int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 3 ;
+  while ( S ) {
+    S = sleep(S);
+  }
   ListOfSyr_Impl * aNewListOfSyr = new ListOfSyr_Impl( _orb , _poa, _contId,
                         instanceName() , interfaceName() ,
                         graphName() , nodeName() ) ;
@@ -183,8 +210,11 @@ SuperVisionTest::ListOfSyr_ptr SyrComponent_Impl::C_AVERAGE(
                        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);
+//  int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 3 ;
+  while ( S ) {
+    S = sleep(S);
+  }
   SuperVisionTest::SeqOfSyr * aSeqOfSyr = aListOfSyr->GetSeqOfSyr() ;
   int len = aSeqOfSyr->length() ;
   aSeqOfSyr->length( len + 1 ) ;
@@ -207,8 +237,11 @@ SuperVisionTest::ListOfSyr_ptr SyrComponent_Impl::C_AVERAGE(
 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);
+//  int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 3 ;
+  while ( S ) {
+    S = sleep(S);
+  }
   Syr_Impl * mySyr ;
   mySyr = new Syr_Impl( _orb , _poa, _contId,
                         instanceName() , interfaceName() ,
@@ -309,8 +342,11 @@ 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);
+//  int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 3 ;
+  while ( S ) {
+    S = sleep(S);
+  }
   endService( " Syr_Impl::Initial"  );
   return _InitialInteger ;
 }
@@ -318,8 +354,11 @@ long Syr_Impl::Initial() {
 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);
+//  int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 3 ;
+  while ( S ) {
+    S = sleep(S);
+  }
   endService( " Syr_Impl::Current"  );
   return _CurrentInteger ;
 }
@@ -328,8 +367,11 @@ 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);
+//  int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 3 ;
+  while ( S ) {
+    S = sleep(S);
+  }
   RetVal = ( _CurrentInteger & 1 ) == 0 ;
   MESSAGE( " Syr_Impl::IsEven " << _CurrentInteger << " " << RetVal );
   endService( " Syr_Impl::IsEven"  );
@@ -340,8 +382,11 @@ 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);
+//  int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 3 ;
+  while ( S ) {
+    S = sleep(S);
+  }
   RetVal = ( _CurrentInteger == 1 ) ;
   MESSAGE( " Syr_Impl::IsOne " << _CurrentInteger << " " << RetVal );
   endService( " Syr_Impl::IsOne"  );
@@ -351,8 +396,11 @@ long Syr_Impl::IsOne() {
 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);
+//  int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 3 ;
+  while ( S ) {
+    S = sleep(S);
+  }
   MESSAGE( " Syr_Impl::Count " << _Count );
   endService( " Syr_Impl::Count"  );
   return _Count ;
@@ -361,8 +409,11 @@ long Syr_Impl::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);
+//  int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 3 ;
+  while ( S ) {
+    S = sleep(S);
+  }
   if ( IsEven() )
     _CurrentInteger = 0 ;
   else
@@ -374,8 +425,11 @@ void 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);
+//  int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 3 ;
+  while ( S ) {
+    S = sleep(S);
+  }
   if ( !IsEven() )
     _CurrentInteger = 0 ;
   else
@@ -387,8 +441,11 @@ void 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);
+//  int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 3 ;
+  while ( S ) {
+    S = sleep(S);
+  }
   _Count = _Count + 1 ;
   MESSAGE( " Syr_Impl::Incr " << _Count );
   endService( " Syr_Impl::Incr"  );
diff --git a/src/TestFunctions/DynInvoke.cxx b/src/TestFunctions/DynInvoke.cxx
new file mode 100644 (file)
index 0000000..975e77a
--- /dev/null
@@ -0,0 +1,218 @@
+//  SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
+//
+//  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   : DataFlowBase_DynInvoke.cxx
+//  Author : Marc Tajchman, CEA
+//  Module : SUPERV
+//  $Header:
+
+#include <iostream>
+#include <unistd.h>
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <iomanip>
+#include <string>
+#include <map>
+
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOME_Component)
+
+#include "DynInvoke.hxx"
+
+#include <stdarg.h>
+
+using namespace std;
+using namespace CORBA ;
+
+void DynInvoke( Engines::Component_ptr objComponent ,
+               const char *method , 
+               ServicesAnyData * inParams , int nInParams ,
+               ServicesAnyData * outParams , int nOutParams ) {
+  Request_var req = objComponent->_request( method ) ;
+  const char *ArgName ;
+  int Type ;
+
+  NVList_ptr arguments = req->arguments() ;
+
+  int i ;
+
+  int n_in  = nInParams ;
+  int n_out = nOutParams ;
+
+//  char * aComponent = ObjectToString( objComponent ) ;
+//  MESSAGE( aComponent << "->" << method ) ;
+  for ( i = 0 ; i < n_in ; i++ ) {
+    CORBA::Any & data = inParams[i].Value ;
+    ArgName           = inParams[i].Name.c_str() ;
+    Type              = data.type()->kind() ;
+    arguments->add_value( ArgName , data , CORBA::ARG_IN ) ;
+#if 0
+    switch ( Type ) {
+    case CORBA::tk_string : {
+      char * t ;
+      data >>= t ;
+      MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << t << " (string)" ) ;
+      break ;
+    }
+    case CORBA::tk_boolean : {
+      bool b ;
+      data >>= (CORBA::Any::to_boolean ) b ;
+      MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << b << " (boolean)" ) ;
+      break ;
+    }
+    case CORBA::tk_char : {
+      unsigned char c ;
+      data >>= (CORBA::Any::to_char ) c ;
+      MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << (int ) c << " (char)" ) ;
+      break ;
+    }
+    case CORBA::tk_short : {
+      short s ;
+      data >>= s ;
+      MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << s << " (short)" ) ;
+      break ;
+    }
+    case CORBA::tk_long : {
+      long l ;
+      data >>= l ;
+      MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << l << " (long)" ) ;
+      break ;
+    }
+    case CORBA::tk_float : {
+      float f ;
+      data >>= f ;
+      MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << f << " (float)" ) ;
+      break ;
+    }
+    case CORBA::tk_double : {
+      double d ;
+      data >>= d ;
+      MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << d << " (double)" ) ;
+      break ;
+    }
+    case CORBA::tk_objref : {
+      CORBA::Object_ptr obj ;
+      char * retstr = "Catched ERROR";
+      try {
+        data >>= obj ;
+        retstr = ObjectToString( obj ) ;
+      }
+      catch( ... ) {
+      }
+      MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << retstr << "(object reference)" ) ;
+      break ;
+    }
+    default : {
+      MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << "(other ERROR) kind " << Type ) ;
+    }
+    }
+    MESSAGE("") ;
+#endif
+  }
+
+  for ( i = 0 ; i < n_out ; i++ ) {
+    CORBA::Any & data = outParams[i].Value ;
+    ArgName           = outParams[i].Name.c_str() ;
+    Type              = data.type()->kind() ;
+    arguments->add_value( ArgName , data , CORBA::ARG_OUT ) ;
+#if 0
+    switch ( Type ) {
+    case CORBA::tk_string : {
+      char * t ;
+      data >>= t ;
+      MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << t << " (string)" ) ;
+      break ;
+    }
+    case CORBA::tk_boolean : {
+      bool b ;
+      data >>= (CORBA::Any::to_boolean ) b ;
+      MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << b << " (boolean)" ) ;
+      break ;
+    }
+    case CORBA::tk_char : {
+      unsigned char c ;
+      data >>= (CORBA::Any::to_char ) c ;
+      MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << (int ) c << " (char)" ) ;
+      break ;
+    }
+    case CORBA::tk_short : {
+      short s ;
+      data >>= s ;
+      MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << s << " (short)" ) ;
+      break ;
+    }
+    case CORBA::tk_long : {
+      long l ;
+      data >>= l ;
+      MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << l << " (long)" ) ;
+      break ;
+    }
+    case CORBA::tk_float : {
+      float f ;
+      data >>= f ;
+      MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << f << " (float)" ) ;
+      break ;
+    }
+    case CORBA::tk_double : {
+      double d ;
+      data >>= d ;
+      MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << d << " (double)" ) ;
+      break ;
+    }
+    case CORBA::tk_objref : {
+      CORBA::Object_ptr obj ;
+      char * retstr = "Catched ERROR";
+      try {
+        data >>= obj ;
+        retstr = ObjectToString( obj ) ;
+      }
+      catch( ... ) {
+      }
+      MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << retstr << "(object reference)" ) ;
+      break ;
+    }
+    default : {
+      MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << "(other ERROR) kind " << Type ) ;
+    }
+    }
+    MESSAGE("") ;
+#endif
+  }
+
+  req->invoke();
+
+  if( req->env()->exception() ) {
+    req->env()->exception()->_raise() ;
+    return ; // pas utile ?
+  }
+
+  for ( i = 0 ; i < n_out ; i++ ) {
+
+      outParams[i].Value = *( arguments->item( i + n_in )->value() ) ;
+  }
+
+  return;
+
+}
+
diff --git a/src/TestFunctions/DynInvoke.hxx b/src/TestFunctions/DynInvoke.hxx
new file mode 100644 (file)
index 0000000..d862377
--- /dev/null
@@ -0,0 +1,46 @@
+//  SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
+//
+//  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   : DataFlowExecutor_DynInvoke.hxx
+//  Module : SUPERV
+
+#ifndef _DYNINVOKE_
+#define _DYNINVOKE_
+
+struct ServicesAnyData {
+
+  std::string Name;
+  CORBA::Any Value;
+
+};
+
+
+// dynamic call for function with list of in parameters, followed 
+// by out parameters with no return value
+
+void DynInvoke(Engines::Component_ptr obj,
+              const char *method, 
+              ServicesAnyData * inParams, int nInParams,
+              ServicesAnyData * outParams, int nOutParams);
+
+#endif
diff --git a/src/TestFunctions/GEOM.py b/src/TestFunctions/GEOM.py
new file mode 100644 (file)
index 0000000..7de6f24
--- /dev/null
@@ -0,0 +1,9 @@
+from LifeCycleCORBA import *
+orb = CORBA.ORB_init([''], CORBA.ORB_ID)
+lcc = LifeCycleCORBA(orb)
+import GEOM_Superv_idl
+GEOMComponent = lcc.FindOrLoadComponent('FactoryServer','GEOM_Superv')
+
+theFormats,thePatterns = GEOMComponent.ExportTranslators()
+theFormats
+thePatterns
diff --git a/src/TestFunctions/Makefile.in b/src/TestFunctions/Makefile.in
new file mode 100644 (file)
index 0000000..2ba4063
--- /dev/null
@@ -0,0 +1,58 @@
+#  SuperVisionTest TestFunctions : 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 = 
+
+# Libraries targets
+LIB = libDynInvoke.la
+LIB_SRC = DynInvoke.cxx
+
+LIB_CLIENT_IDL = SALOME_Component.idl 
+
+# Executables targets
+BIN = TestFunctions
+BIN_SRC = 
+BIN_CLIENT_IDL = SALOME_Component.idl \
+                 AddComponent.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 -lSalomeNS -lOpUtil 
+
+LDFLAGSFORBIN+= -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeLifeCycleCORBA -lSalomeNS -lOpUtil 
+
+@CONCLUDE@
+
diff --git a/src/TestFunctions/TestFunctions.cxx b/src/TestFunctions/TestFunctions.cxx
new file mode 100644 (file)
index 0000000..06d9c44
--- /dev/null
@@ -0,0 +1,103 @@
+//  SuperVisionTest TestFunctions : 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   : TestFunctions.cxx
+//  Module : SuperVisionTest
+
+#include <iostream>
+#include <fstream>
+#include <unistd.h>
+
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(AddComponent)
+#include CORBA_CLIENT_HEADER(SALOME_Component)
+
+#include "utilities.h"
+#include "SALOME_NamingService.hxx"
+#include "SALOME_LifeCycleCORBA.hxx"
+#include <OpUtil.hxx>
+
+#include "DynInvoke.hxx"
+
+using namespace std;
+
+int main(int argc, char **argv) {
+  CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+  CORBA::Object_var obj = orb->resolve_initial_references("RootPOA") ;
+  PortableServer::POA_var poa = PortableServer::POA::_narrow(obj) ;
+  SALOME_NamingService _NS(orb) ;
+  SALOME_LifeCycleCORBA _LCC(&_NS) ;
+
+  Engines::Component_var AddComponent = _LCC.FindOrLoad_Component( "FactoryServer" ,
+                                                                   "AddComponent");
+  SuperVisionTest::AddComponent_var AddInterface ;
+  AddInterface = SuperVisionTest::AddComponent::_narrow( AddComponent );
+
+// Direct call to AdditionObjRef1
+  SuperVisionTest::Adder_var Adder1 ;
+  bool sts1 = AddInterface->AdditionObjRef1( Adder1 ) ;
+  double Func1 , z1 ;
+  Func1 = Adder1->Add( 1. , 2. , z1 ) ;
+  cout << "TestFunctions sts1 " << sts1 << " Func1 " << Func1 << " z1 " << z1 << endl ;
+
+// Call to AdditionObjRef1 via dynamic invocation
+  int ninParams = 0 ;
+  ServicesAnyData * inParams = NULL ;
+  int noutParams = 2 ;
+  ServicesAnyData * outParams = new ServicesAnyData[noutParams] ;
+  bool b = 0 ;
+  outParams[ 0 ].Value <<= (CORBA::Any::from_boolean ) b ;
+  outParams[ 1 ].Value <<= CORBA::Object::_nil()  ;
+  DynInvoke( AddInterface , "AdditionObjRef1" , inParams , ninParams ,
+                                                outParams , noutParams ) ;
+  outParams[ 0 ].Value >>= sts1 ;
+  CORBA::Object_ptr objptr ;
+  outParams[ 1 ].Value >>= objptr ;
+  Adder1 = SuperVisionTest::Adder::_narrow( objptr ) ;
+  Func1 = Adder1->Add( 1. , 2. , z1 ) ;
+  cout << "TestFunctions DynInvoke sts1 " << sts1 << " Func1 " << Func1 << " z1 " << z1
+       << endl ;
+
+// Direct call to AdditionObjRef2
+  SuperVisionTest::Adder_var Adder2 ;
+  bool sts2 ;
+  AddInterface->AdditionObjRef2( sts2 , Adder2 ) ;
+  double Func2 , z2 ;
+  Func2 = Adder2->Add( 1. , 2. , z2 ) ;
+  cout << "TestFunctions sts2 " << sts2 << " Func2 " << Func2 << " z2 " << z2 << endl ;
+
+// Call to AdditionObjRef2 via dynamic invocation
+  outParams[ 0 ].Value <<= (CORBA::Any::from_boolean ) b ;
+  outParams[ 1 ].Value <<= CORBA::Object::_nil()  ;
+  DynInvoke( AddInterface , "AdditionObjRef2" , inParams , ninParams ,
+                                                outParams , noutParams ) ;
+  outParams[ 0 ].Value >>= sts2 ;
+  outParams[ 1 ].Value >>= objptr ;
+  Adder2 = SuperVisionTest::Adder::_narrow( objptr ) ;
+  Func2 = Adder2->Add( 1. , 2. , z2 ) ;
+  cout << "TestFunctions DynInvoke sts2 " << sts2 << " Func2 " << Func2 << " z2 " << z2
+       << endl ;
+
+  return 0;
+}
+
diff --git a/src/TestFunctions/TestFunctions.py b/src/TestFunctions/TestFunctions.py
new file mode 100644 (file)
index 0000000..5626f09
--- /dev/null
@@ -0,0 +1,21 @@
+from LifeCycleCORBA import *
+orb = CORBA.ORB_init([''], CORBA.ORB_ID)
+lcc = LifeCycleCORBA(orb)
+import AddComponent_idl
+AddComponent = lcc.FindOrLoadComponent('FactoryServer','AddComponent')
+
+Func,z = AddComponent.Add( 1. , 2. )
+Func
+z
+
+Bool1,ObjRef1 = AddComponent.AdditionObjRef1()
+Bool1
+ObjRef1
+ObjRef1.ping()
+dir (ObjRef1)
+
+Bool2,ObjRef2 = AddComponent.AdditionObjRef2()
+Bool2
+ObjRef2
+ObjRef2.ping()
+dir (ObjRef2)
diff --git a/src/UndefinedSymbolComponent/Makefile.in b/src/UndefinedSymbolComponent/Makefile.in
new file mode 100755 (executable)
index 0000000..dabcf4a
--- /dev/null
@@ -0,0 +1,60 @@
+#  SuperVisionTest UndefinedSymbolComponent : 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 =  \
+       UndefinedSymbolComponent.hxx 
+
+# Libraries targets
+LIB = libUndefinedSymbolComponentEngine.la
+LIB_SRC = \
+       UndefinedSymbolComponent.cxx 
+
+LIB_SERVER_IDL = SALOME_Component.idl \
+                 UndefinedSymbolComponent.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/UndefinedSymbolComponent/UndefinedSymbolComponent.cxx b/src/UndefinedSymbolComponent/UndefinedSymbolComponent.cxx
new file mode 100755 (executable)
index 0000000..283da60
--- /dev/null
@@ -0,0 +1,90 @@
+//  SuperVisionTest UndefinedSymbolComponent : 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   : UndefinedSymbolComponentEngine.cxx
+//  Author : MARC TAJCHMAN, CEA
+//  Module : SuperVisionTest
+
+using namespace std;
+#include <stdio.h>
+#include <unistd.h>
+#include <fstream>
+#include <sstream>
+#include <string>
+
+//#include "utilities.h"
+#include "UndefinedSymbolComponent.hxx"
+
+UndefinedSymbolComponentEngine::UndefinedSymbolComponentEngine( 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("UndefinedSymbolComponentEngine::UndefinedSymbolComponentEngine activate object instanceName("
+//          << instanceName << ") interfaceName(" << interfaceName << ")" )
+  _thisObj = this ;
+  _id = _poa->activate_object(_thisObj);
+}
+
+UndefinedSymbolComponentEngine::UndefinedSymbolComponentEngine() :
+  Engines_Component_i()
+{
+}
+
+UndefinedSymbolComponentEngine::~UndefinedSymbolComponentEngine()
+{
+}
+
+extern "C" { long CallUndefined() ; } ;
+
+long UndefinedSymbolComponentEngine::UndefinedSymbol() {
+  beginService( " UndefinedSymbolComponentEngine::UndefinedSymbol" );
+  int S = 10 ;
+  while ( S ) {
+    S = sleep( S ) ;
+  }
+  long value = CallUndefined() ;
+  endService( " UndefinedSymbolComponentEngine::UndefinedSymbol"  );
+  return value ;
+}
+
+extern "C"
+{
+  PortableServer::ObjectId * UndefinedSymbolComponentEngine_factory
+     (CORBA::ORB_ptr orb,
+      PortableServer::POA_ptr poa, 
+      PortableServer::ObjectId * contId,
+      const char *instanceName,
+      const char *interfaceName)
+  {
+    MESSAGE("UndefinedSymbolComponentEngine_factory UndefinedSymbolComponentEngine ("
+            << instanceName << "," << interfaceName << ")");
+    UndefinedSymbolComponentEngine * myUndefinedSymbolComponent 
+      = new UndefinedSymbolComponentEngine(orb, poa, contId, instanceName, interfaceName);
+    return myUndefinedSymbolComponent->getId() ;
+  }
+}
+
+
diff --git a/src/UndefinedSymbolComponent/UndefinedSymbolComponent.hxx b/src/UndefinedSymbolComponent/UndefinedSymbolComponent.hxx
new file mode 100755 (executable)
index 0000000..7313544
--- /dev/null
@@ -0,0 +1,66 @@
+//  SuperVisionTest UndefinedSymbolComponent : 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   : UndefinedSymbolComponentEngine.hxx
+//  Author : MARC TAJCHMAN, CEA
+//  Module : SuperVisionTest
+//  $Header$
+
+#ifndef _UNDEFINEDSYMBOLCOMPONENTENGINE_HXX_
+#define _UNDEFINEDSYMBOLCOMPONENTENGINE_HXX_
+
+//#include <iostream.h>
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(UndefinedSymbolComponent)
+#include CORBA_SERVER_HEADER(SALOME_Component)
+#include "SALOME_Component_i.hxx"
+
+class UndefinedSymbolComponentEngine :  public POA_SuperVisionTest::UndefinedSymbolComponent ,
+                            public Engines_Component_i {
+public:
+  UndefinedSymbolComponentEngine() ;
+  UndefinedSymbolComponentEngine( CORBA::ORB_ptr orb,
+                     PortableServer::POA_ptr poa,
+                     PortableServer::ObjectId * contId, 
+                     const char *instanceName,
+                      const char *interfaceName);
+
+  virtual ~UndefinedSymbolComponentEngine();
+
+  long UndefinedSymbol() ;
+
+private:
+
+  int _nexec ;
+
+};
+
+extern "C"
+  PortableServer::ObjectId * UndefinedSymbolComponentEngine_factory
+                                   ( CORBA::ORB_ptr orb ,
+                                     PortableServer::POA_ptr poa , 
+                                     PortableServer::ObjectId * contId ,
+                                     const char *instanceName ,
+                                     const char *interfaceName ) ;
+
+#endif