Salome HOME
Merge from V6_main_20120808 08Aug12
[samples/component.git] / src / SyrComponent / SyrComponent_Impl.cxx
index be0ace40f42bad434bf804e46d7c577e1017cfcd..12f36e4b6d2c7acde459f72fe0fcd47d551ec1e9 100755 (executable)
@@ -1,31 +1,30 @@
-//  SuperVisionTest SyrComponent : example of component performing some mathinatical operations
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  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.
 //
-//  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 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
+//  SuperVisionTest SyrComponent : example of component performing some mathinatical operations
 //  File   : SyrComponent_Impl.cxx
 //  Author : Jean Rahuel, CEA
 //  Module : SuperVisionTest
-
-using namespace std;
+//
 #include <stdio.h>
 #include <unistd.h>
 #include <fstream>
@@ -37,6 +36,8 @@ using namespace std;
 #include "SyrComponent_Impl.hxx"
 #include "Adder_Impl.hxx"
 
+using namespace std;
+
 SyrComponent_Impl::SyrComponent_Impl( CORBA::ORB_ptr orb ,
                                      PortableServer::POA_ptr poa ,
                                      PortableServer::ObjectId * contId , 
@@ -59,12 +60,12 @@ SyrComponent_Impl::SyrComponent_Impl() {
 SyrComponent_Impl::~SyrComponent_Impl() {
 }
 
-long SyrComponent_Impl::C_ISEVEN( const long anInteger ) {
+CORBA::Long SyrComponent_Impl::C_ISEVEN( CORBA::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));
-  int S = 3 ;
+  int S = 1 ;
   while ( S ) {
     S = sleep(S);
   }
@@ -73,12 +74,12 @@ long SyrComponent_Impl::C_ISEVEN( const long anInteger ) {
   return RetVal ;
 }
 
-long SyrComponent_Impl::C_ISONE( const long anOddInteger ) {
+CORBA::Long SyrComponent_Impl::C_ISONE( CORBA::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));
-  int S = 3 ;
+  int S = 1 ;
   while ( S ) {
     S = sleep(S);
   }
@@ -87,11 +88,11 @@ long SyrComponent_Impl::C_ISONE( const long anOddInteger ) {
   return RetVal ;
 }
 
-long SyrComponent_Impl::C_M3( const long anOddInteger ) {
+CORBA::Long SyrComponent_Impl::C_M3( CORBA::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));
-  int S = 3 ;
+  int S = 1 ;
   while ( S ) {
     S = sleep(S);
   }
@@ -101,11 +102,11 @@ long SyrComponent_Impl::C_M3( const long anOddInteger ) {
   return ( 3*anOddInteger ) ;
 }
 
-long SyrComponent_Impl::C_M3P1( const long anOddInteger ) {
+CORBA::Long SyrComponent_Impl::C_M3P1( CORBA::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));
-  int S = 3 ;
+  int S = 1 ;
   while ( S ) {
     S = sleep(S);
   }
@@ -115,11 +116,11 @@ long SyrComponent_Impl::C_M3P1( const long anOddInteger ) {
   return ( 3*anOddInteger + 1 ) ;
 }
 
-long SyrComponent_Impl::C_DIV2( const long anEvenInteger ) {
+CORBA::Long SyrComponent_Impl::C_DIV2( CORBA::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));
-  int S = 3 ;
+  int S = 1 ;
   while ( S ) {
     S = sleep(S);
   }
@@ -129,11 +130,11 @@ long SyrComponent_Impl::C_DIV2( const long anEvenInteger ) {
   return ( anEvenInteger >> 1 ) ;
 }
 
-long SyrComponent_Impl::C_INCR( const long aCount ) {
+CORBA::Long SyrComponent_Impl::C_INCR( CORBA::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));
-  int S = 3 ;
+  int S = 1 ;
   while ( S ) {
     S = sleep(S);
   }
@@ -141,11 +142,36 @@ long SyrComponent_Impl::C_INCR( const long aCount ) {
   return ( aCount + 1 ) ;
 }
 
-long SyrComponent_Impl::C_MIN( const long aMinVal , const long anInteger ) {
+void SyrComponent_Impl::CPP_SETLONG( CORBA::Long aCount ) {
+  beginService( " SyrComponent_Impl::CPP_SETLONG" );
+  sendMessage(NOTIF_STEP, "SyrComponent_Impl::CPP_SETLONG is Computing");
+//  int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 1 ;
+  while ( S ) {
+    S = sleep(S);
+  }
+  _Count = aCount ;
+  endService( " SyrComponent_Impl::CPP_SETLONG"  );
+  return ;
+}
+
+CORBA::Long SyrComponent_Impl::CPP_ADDTOLONG( CORBA::Long anIncr ) {
+  beginService( " SyrComponent_Impl::CPP_ADDTOLONG" );
+  sendMessage(NOTIF_STEP, "SyrComponent_Impl::CPP_ADDTOLONG is Computing");
+//  int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0));
+  int S = 1 ;
+  while ( S ) {
+    S = sleep(S);
+  }
+  endService( " SyrComponent_Impl::CPP_ADDTOLONG"  );
+  return ( _Count + anIncr ) ;
+}
+
+CORBA::Long SyrComponent_Impl::C_MIN( CORBA::Long aMinVal , CORBA::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));
-  int S = 3 ;
+  int S = 1 ;
   while ( S ) {
     S = sleep(S);
   }
@@ -162,11 +188,11 @@ long SyrComponent_Impl::C_MIN( const long aMinVal , const long anInteger ) {
   return min ;
 }
 
-long SyrComponent_Impl::C_MAX( const long aMaxVal , const long anInteger ) {
+CORBA::Long SyrComponent_Impl::C_MAX( CORBA::Long aMaxVal , CORBA::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));
-  int S = 3 ;
+  int S = 1 ;
   while ( S ) {
     S = sleep(S);
   }
@@ -187,7 +213,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));
-  int S = 3 ;
+  int S = 1 ;
   while ( S ) {
     S = sleep(S);
   }
@@ -204,14 +230,14 @@ SuperVisionTest::ListOfSyr_ptr SyrComponent_Impl::C_LISTOFSYR() {
 }
 
 SuperVisionTest::ListOfSyr_ptr SyrComponent_Impl::C_AVERAGE(
-                       const SuperVisionTest::ListOfSyr_ptr aListOfSyr ,
-                       const long anInteger ,
-                       const long aCount ,
-                       double & anAverage ) {
+                       SuperVisionTest::ListOfSyr_ptr aListOfSyr ,
+                       CORBA::Long anInteger ,
+                       CORBA::Long aCount ,
+                       CORBA::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));
-  int S = 3 ;
+  int S = 1 ;
   while ( S ) {
     S = sleep(S);
   }
@@ -234,11 +260,11 @@ SuperVisionTest::ListOfSyr_ptr SyrComponent_Impl::C_AVERAGE(
   return SuperVisionTest::ListOfSyr::_duplicate( aListOfSyr ) ;
 }
 
-SuperVisionTest::Syr_ptr SyrComponent_Impl::Init( const long anOddInteger ) {
+SuperVisionTest::Syr_ptr SyrComponent_Impl::Init( CORBA::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));
-  int S = 3 ;
+  int S = 1 ;
   while ( S ) {
     S = sleep(S);
   }
@@ -315,7 +341,7 @@ Syr_Impl::Syr_Impl( CORBA::ORB_ptr orb ,
                     const char * interfaceName , 
                    const char * graphName ,
                     const char * nodeName ,
-                    const long anOddInteger ) :
+                    const CORBA::Long anOddInteger ) :
   SyrComponent_Impl(orb, poa, contId, instanceName, interfaceName,false) {
   Names( graphName , nodeName ) ;
   MESSAGE("Syr_Impl::Syr_Impl activate object instanceName("
@@ -339,11 +365,11 @@ Syr_Impl::~Syr_Impl() {
   endService( "Syr_Impl::~Syr_Impl" );
 }
 
-long Syr_Impl::Initial() {
+CORBA::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));
-  int S = 3 ;
+  int S = 1 ;
   while ( S ) {
     S = sleep(S);
   }
@@ -351,11 +377,11 @@ long Syr_Impl::Initial() {
   return _InitialInteger ;
 }
 
-long Syr_Impl::Current() {
+CORBA::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));
-  int S = 3 ;
+  int S = 1 ;
   while ( S ) {
     S = sleep(S);
   }
@@ -363,12 +389,12 @@ long Syr_Impl::Current() {
   return _CurrentInteger ;
 }
 
-long Syr_Impl::IsEven() {
+CORBA::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));
-  int S = 3 ;
+  int S = 1 ;
   while ( S ) {
     S = sleep(S);
   }
@@ -378,12 +404,12 @@ long Syr_Impl::IsEven() {
   return RetVal ;
 }
 
-long Syr_Impl::IsOne() {
+CORBA::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));
-  int S = 3 ;
+  int S = 1 ;
   while ( S ) {
     S = sleep(S);
   }
@@ -393,11 +419,11 @@ long Syr_Impl::IsOne() {
   return RetVal ;
 }
 
-long Syr_Impl::Count() {
+CORBA::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));
-  int S = 3 ;
+  int S = 1 ;
   while ( S ) {
     S = sleep(S);
   }
@@ -410,7 +436,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));
-  int S = 3 ;
+  int S = 1 ;
   while ( S ) {
     S = sleep(S);
   }
@@ -426,7 +452,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));
-  int S = 3 ;
+  int S = 1 ;
   while ( S ) {
     S = sleep(S);
   }
@@ -442,7 +468,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));
-  int S = 3 ;
+  int S = 1 ;
   while ( S ) {
     S = sleep(S);
   }