From 48fa2ac12a26fa3e6f5787d17f082745f219674e Mon Sep 17 00:00:00 2001 From: rnv Date: Tue, 29 Oct 2013 06:43:14 +0000 Subject: [PATCH] Porting SALOME COMPONENT module to win32 platform. --- CMakeLists.txt | 9 +- SalomeCOMPONENTConfig.cmake.in | 4 +- src/AddComponent/AddComponent.hxx | 41 ++++++ .../AddComponent_CheckOfUndefined.cxx | 4 +- src/AddComponent/AddComponent_Impl.cxx | 39 ++++- src/AddComponent/AddComponent_Impl.hxx | 8 +- src/AddComponent/Adder_Impl.cxx | 26 +++- src/AddComponent/Adder_Impl.hxx | 5 +- src/AddComponent/CMakeLists.txt | 1 + src/AdditionComponent/AdditionComponent.hxx | 40 ++++++ .../AdditionComponent_CheckOfUndefined.cxx | 2 + .../AdditionComponent_Impl.cxx | 42 +++++- .../AdditionComponent_Impl.hxx | 7 +- src/AdditionComponent/Addition_Adder_Impl.cxx | 26 +++- src/AdditionComponent/Addition_Adder_Impl.hxx | 5 +- src/AdditionComponent/CMakeLists.txt | 1 + src/CMakeLists.txt | 6 +- .../DataStreamComponent_CheckOfUndefined.cxx | 2 + .../DataStreamComponent_Impl.cxx | 9 ++ .../DataStreamComponent_Impl.hxx | 19 ++- src/DivComponent/DivComponent.cxx | 8 +- src/DivComponent/DivComponent.hxx | 15 +- src/MulComponent/MulComponent.cxx | 8 +- src/MulComponent/MulComponent.hxx | 15 +- src/SIGNALSComponent/CMakeLists.txt | 1 + src/SIGNALSComponent/SIGNALSComponent.cxx | 2 + src/SIGNALSComponent/SIGNALSComponent.hxx | 7 +- .../SIGNALSComponent_CheckOfUndefined.cxx | 4 +- .../SIGNALSComponent_Impl.cxx | 26 +++- .../SIGNALSComponent_Impl.hxx | 7 +- .../SIGNALSComponent_defines.hxx | 40 ++++++ src/SubComponent/SubComponent.cxx | 8 +- src/SubComponent/SubComponent.hxx | 15 +- .../SyrComponent_CheckOfUndefined.cxx | 2 + src/SyrComponent/SyrComponent_Impl.cxx | 136 +++++++++++++++--- src/SyrComponent/SyrComponent_Impl.hxx | 23 ++- src/TestFunctions/DynInvoke.cxx | 2 + src/TestFunctions/DynInvoke.hxx | 18 ++- src/TestFunctions/TestFunctions.cxx | 2 + src/TestFunctions/TestFunctionsMemory.cxx | 3 + src/TestFunctions/TestFunctionsMemory1.cxx | 2 + src/TestFunctions/TestFunctionsMemory2.cxx | 2 + src/TestFunctions/TestFunctionsMemory3.cxx | 2 + src/TestFunctions/TestFunctionsMemory4.cxx | 2 + .../TypesCheck_CheckOfUndefined.cxx | 2 + src/TypesCheck/TypesCheck_Impl.cxx | 12 +- src/TypesCheck/TypesCheck_Impl.hxx | 15 +- 47 files changed, 585 insertions(+), 90 deletions(-) create mode 100755 src/AddComponent/AddComponent.hxx create mode 100755 src/AdditionComponent/AdditionComponent.hxx create mode 100755 src/SIGNALSComponent/SIGNALSComponent_defines.hxx diff --git a/CMakeLists.txt b/CMakeLists.txt index d72e86d..cfeb252 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,9 +139,16 @@ SET(_${PROJECT_NAME}_exposed_targets AddComponentEngine AdditionComponentEngine DivComponentEngine MulComponentEngine SubComponentEngine SyrComponentEngine DynInvoke TypesCheckEngine DataStreamFactoryEngine SIGNALSComponentEngine - UndefinedSymbolComponentEngine SalomeIDLCOMPONENT + SalomeIDLCOMPONENT ) +IF(NOT WIN32) + LIST(APPEND _${PROJECT_NAME}_exposed_targets + UndefinedSymbolComponentEngine) +ENDIF(NOT WIN32) + + + # Add all targets to the build-tree export set EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets} FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake) diff --git a/SalomeCOMPONENTConfig.cmake.in b/SalomeCOMPONENTConfig.cmake.in index 22bb14a..0459399 100644 --- a/SalomeCOMPONENTConfig.cmake.in +++ b/SalomeCOMPONENTConfig.cmake.in @@ -106,6 +106,8 @@ SET(COMPONENT_SyrComponentEngine SyrComponentEngine) SET(COMPONENT_TypesCheckEngine TypesCheckEngine) SET(COMPONENT_DataStreamFactoryEngine DataStreamFactoryEngine) SET(COMPONENT_SIGNALSComponentEngine SIGNALSComponentEngine) -SET(COMPONENT_UndefinedSymbolComponentEngine UndefinedSymbolComponentEngine) +IF(NOT WIN32) + SET(COMPONENT_UndefinedSymbolComponentEngine UndefinedSymbolComponentEngine) +ENDIF(NOT WIN32) SET(COMPONENT_DynInvoke DynInvoke) SET(COMPONENT_SalomeIDLCOMPONENT ${SalomeIDLCOMPONENT}) \ No newline at end of file diff --git a/src/AddComponent/AddComponent.hxx b/src/AddComponent/AddComponent.hxx new file mode 100755 index 0000000..34dc70a --- /dev/null +++ b/src/AddComponent/AddComponent.hxx @@ -0,0 +1,41 @@ +// Copyright (C) 2007-2013 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. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// 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 AddComponent : example of component that adds two numbers +// File : AddComponent.hxx +// Author : Roman NIKOLAEV, OPEN CASCADE +// $Header: +// +#ifndef _ADD_COMPONENT_HXX_ +#define _ADD_COMPONENT_HXX_ + +#ifdef WIN32 +# if defined ADDCOMPONENTENGINE_EXPORTS || defined AddComponentEngine_EXPORTS +# define ADDCOMPONENTENGINE_EXPORT __declspec( dllexport ) +# else +# define ADDCOMPONENTENGINE_EXPORT __declspec( dllimport ) +# endif +#else +# define ADDCOMPONENTENGINE_EXPORT +#endif + +#endif _ADD_COMPONENT_HXX_ diff --git a/src/AddComponent/AddComponent_CheckOfUndefined.cxx b/src/AddComponent/AddComponent_CheckOfUndefined.cxx index 550f2f4..ea53059 100644 --- a/src/AddComponent/AddComponent_CheckOfUndefined.cxx +++ b/src/AddComponent/AddComponent_CheckOfUndefined.cxx @@ -31,7 +31,7 @@ #include #include -#ifndef WNT +#ifndef WIN32 #include #else #include @@ -54,8 +54,10 @@ //CCRT #include #include +#ifndef WIN32 #include #include +#endif //end-CCRT #include "Container_init_python.hxx" diff --git a/src/AddComponent/AddComponent_Impl.cxx b/src/AddComponent/AddComponent_Impl.cxx index 662a2d7..a990354 100644 --- a/src/AddComponent/AddComponent_Impl.cxx +++ b/src/AddComponent/AddComponent_Impl.cxx @@ -26,7 +26,11 @@ // Module : SuperVisionTest // #include +#ifndef WIN32 #include +#else +#include +#endif #include #include #include @@ -81,9 +85,13 @@ CORBA::Double AddComponent_Impl::Add( CORBA::Double x , CORBA::Double y , CORBA: sendMessage(NOTIF_STEP, "AddComponent_Impl::Add is Computing"); // S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); S = 5 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif MESSAGE( "AddComponent_Impl::Add( " << x << " , " << y << " , " << z << " ) returns " << (x - y) << " after " << S << " seconds" ) LastAddition = z ; @@ -115,25 +123,37 @@ CORBA::Long AddComponent_Impl::Sigma( CORBA::Long n ) { void AddComponent_Impl::Setx( CORBA::Double x ) { int S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif xx = x ; } void AddComponent_Impl::Sety( CORBA::Double y ) { int S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif yy = y ; } CORBA::Double AddComponent_Impl::Addxy() { int S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif double zz = xx + yy ; LastAddition = zz ; return zz; @@ -141,9 +161,13 @@ CORBA::Double AddComponent_Impl::Addxy() { CORBA::Double AddComponent_Impl::AddyTox( CORBA::Double y ) { int S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif double zz = xx + y ; LastAddition = zz ; return zz; @@ -249,8 +273,13 @@ extern "C" const char *instanceName, const char *interfaceName) { +#ifndef WIN32 MESSAGE("AddComponentEngine_factory AddComponentEngine (" << instanceName << "," << interfaceName << "," << getpid() << ")"); +#else + MESSAGE("AddComponentEngine_factory AddComponentEngine (" + << instanceName << "," << interfaceName << "," << _getpid() << ")"); +#endif AddComponent_Impl * myAddComponent = new AddComponent_Impl(orb, poa, contId, instanceName, interfaceName); return myAddComponent->getId() ; diff --git a/src/AddComponent/AddComponent_Impl.hxx b/src/AddComponent/AddComponent_Impl.hxx index d6db6e2..85393e2 100644 --- a/src/AddComponent/AddComponent_Impl.hxx +++ b/src/AddComponent/AddComponent_Impl.hxx @@ -29,14 +29,15 @@ #ifndef _ADDINTERFACE_IMPL_HXX_ #define _ADDINTERFACE_IMPL_HXX_ -//#include + +#include "AddComponent.hxx" #include #include CORBA_SERVER_HEADER(AddComponent) #include CORBA_SERVER_HEADER(SALOME_Component) #include "SALOME_Component_i.hxx" -class AddComponent_Impl : public POA_SuperVisionTest::AddComponent , - public Engines_Component_i { +class ADDCOMPONENTENGINE_EXPORT AddComponent_Impl : public POA_SuperVisionTest::AddComponent , + public Engines_Component_i { public: AddComponent_Impl() ; AddComponent_Impl( CORBA::ORB_ptr orb, @@ -83,6 +84,7 @@ private: }; extern "C" + ADDCOMPONENTENGINE_EXPORT PortableServer::ObjectId * AddComponentEngine_factory ( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , diff --git a/src/AddComponent/Adder_Impl.cxx b/src/AddComponent/Adder_Impl.cxx index 8ea1382..6f11474 100644 --- a/src/AddComponent/Adder_Impl.cxx +++ b/src/AddComponent/Adder_Impl.cxx @@ -26,7 +26,9 @@ // Module : SuperVisionTest // #include +#ifndef WIN32 #include +#endif #include #include #include @@ -95,9 +97,13 @@ CORBA::Double Adder_Impl::Add( CORBA::Double x , CORBA::Double y , CORBA::Double sendMessage(NOTIF_STEP, "Adder_Impl::Add is Computing"); // S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); S = 5 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif MESSAGE( "Adder_Impl::Add( " << x << " , " << y << " , " << z << " ) returns " << -(x - y) << " after " << S << " seconds" ) LastAddition = z ; @@ -122,9 +128,13 @@ CORBA::Double Adder_Impl::AddAndCompare( CORBA::Double x , CORBA::Double y , sendMessage(NOTIF_STEP, "Adder_Impl::AddAndCompare is Computing"); // S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); S = 5 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif MESSAGE( "Adder_Impl::AddAndCompare( " << x << " , " << y << " , " << z << " ) returns " << -(x - y) << " after " << S << " seconds" ) LastAddition = z ; @@ -150,9 +160,13 @@ void Adder_Impl::SetLastResult( CORBA::Double z ) { int S; // S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); S = 5 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif LastAddition = z ; endService( " Adder_Impl::SetLastResult" ); return ; @@ -164,9 +178,13 @@ void Adder_Impl::LastResult( CORBA::Double & z ) { int S; // S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); S = 5 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif z = LastAddition ; endService( " Adder_Impl::LastResult" ); return ; diff --git a/src/AddComponent/Adder_Impl.hxx b/src/AddComponent/Adder_Impl.hxx index edc632d..e5934ef 100644 --- a/src/AddComponent/Adder_Impl.hxx +++ b/src/AddComponent/Adder_Impl.hxx @@ -29,14 +29,15 @@ #ifndef _ADDER_IMPL_HXX_ #define _ADDER_IMPL_HXX_ +#include "AddComponent.hxx" #include #include #include CORBA_SERVER_HEADER(AddComponent) #include CORBA_SERVER_HEADER(SALOME_Component) #include "SALOME_Component_i.hxx" -class Adder_Impl : public POA_SuperVisionTest::Adder , - public Engines_Component_i { +class ADDCOMPONENTENGINE_EXPORT Adder_Impl : public POA_SuperVisionTest::Adder , + public Engines_Component_i { public: Adder_Impl() ; Adder_Impl( CORBA::ORB_ptr orb , diff --git a/src/AddComponent/CMakeLists.txt b/src/AddComponent/CMakeLists.txt index 5cf248f..31d7f7b 100644 --- a/src/AddComponent/CMakeLists.txt +++ b/src/AddComponent/CMakeLists.txt @@ -57,6 +57,7 @@ SET(_link_LIBRARIES SET(AddComponentEngine_HEADERS AddComponent_Impl.hxx Adder_Impl.hxx + AddComponent.hxx ) # --- sources --- diff --git a/src/AdditionComponent/AdditionComponent.hxx b/src/AdditionComponent/AdditionComponent.hxx new file mode 100755 index 0000000..48ec1b2 --- /dev/null +++ b/src/AdditionComponent/AdditionComponent.hxx @@ -0,0 +1,40 @@ +// Copyright (C) 2007-2013 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. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File : AdditionComponent.hxx +// Author : Roman NIKOLAEV, OPEN CASCADE +// $Header: +// +#ifndef _ADDITION_COMPONENT_HXX_ +#define _ADDITION_COMPONENT_HXX_ + +#ifdef WIN32 +# if defined ADDITIONCOMPONENTENGINE_EXPORTS || defined AdditionComponentEngine_EXPORTS +# define ADDITIONCOMPONENTENGINE_EXPORT __declspec( dllexport ) +# else +# define ADDITIONCOMPONENTENGINE_EXPORT __declspec( dllimport ) +# endif +#else +# define ADDITIONCOMPONENTENGINE_EXPORT +#endif + +#endif _ADDITION_COMPONENT_HXX_ diff --git a/src/AdditionComponent/AdditionComponent_CheckOfUndefined.cxx b/src/AdditionComponent/AdditionComponent_CheckOfUndefined.cxx index f847991..77112df 100644 --- a/src/AdditionComponent/AdditionComponent_CheckOfUndefined.cxx +++ b/src/AdditionComponent/AdditionComponent_CheckOfUndefined.cxx @@ -26,7 +26,9 @@ // #include #include +#ifndef WIN32 #include +#endif #include "AdditionComponent_Impl.hxx" diff --git a/src/AdditionComponent/AdditionComponent_Impl.cxx b/src/AdditionComponent/AdditionComponent_Impl.cxx index 89266b6..386296a 100644 --- a/src/AdditionComponent/AdditionComponent_Impl.cxx +++ b/src/AdditionComponent/AdditionComponent_Impl.cxx @@ -26,7 +26,11 @@ // Module : SuperVisionTest // #include +#ifndef WIN32 #include +#else +#include +#endif #include #include #include @@ -81,11 +85,14 @@ CORBA::Double AdditionInterface_Impl::Add( CORBA::Double x , CORBA::Double y , C sendMessage(NOTIF_STEP, "AdditionInterface_Impl::Add is Computing"); // S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); S = 5 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } - MESSAGE( "AdditionInterface_Impl::Add( " << x << " , " << y << " , " << z - << " ) returns " << (x - y) << " after " << S << " seconds" ) +#else + Sleep(S*1000); +#endif + MESSAGE( "AdditionInterface_Impl::Add( " << x << " , " << y << " , " << z << " ) returns " << (x - y) << " after " << S << " seconds" ) LastAddition = z ; endService( " AdditionInterface_Impl::Add" ); return (x - y) ; @@ -115,25 +122,37 @@ CORBA::Long AdditionInterface_Impl::Sigma( CORBA::Long n ) { void AdditionInterface_Impl::Setx( CORBA::Double x ) { int S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif xx = x ; } void AdditionInterface_Impl::Sety( CORBA::Double y ) { int S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif yy = y ; } CORBA::Double AdditionInterface_Impl::Addxy() { int S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif double zz = xx + yy ; LastAddition = zz ; return zz; @@ -141,9 +160,13 @@ CORBA::Double AdditionInterface_Impl::Addxy() { CORBA::Double AdditionInterface_Impl::AddyTox( CORBA::Double y ) { int S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif double zz = xx + y ; LastAddition = zz ; return zz; @@ -249,8 +272,13 @@ extern "C" const char *instanceName, const char *interfaceName) { +#ifndef WIN32 MESSAGE("AdditionComponentEngine_factory AdditionInterfaceEngine (" << instanceName << "," << interfaceName << "," << getpid() << ")"); +#else + MESSAGE("AdditionComponentEngine_factory AdditionInterfaceEngine (" + << instanceName << "," << interfaceName << "," << _getpid() << ")"); +#endif AdditionInterface_Impl * myAdditionInterface = new AdditionInterface_Impl(orb, poa, contId, instanceName, interfaceName); return myAdditionInterface->getId() ; diff --git a/src/AdditionComponent/AdditionComponent_Impl.hxx b/src/AdditionComponent/AdditionComponent_Impl.hxx index 92d08fb..e9889f6 100644 --- a/src/AdditionComponent/AdditionComponent_Impl.hxx +++ b/src/AdditionComponent/AdditionComponent_Impl.hxx @@ -29,14 +29,14 @@ #ifndef _ADDITIONINTERFACE_IMPL_HXX_ #define _ADDITIONINTERFACE_IMPL_HXX_ -//#include +#include "AdditionComponent.hxx" #include #include CORBA_SERVER_HEADER(AdditionComponent) #include CORBA_SERVER_HEADER(SALOME_Component) #include "SALOME_Component_i.hxx" -class AdditionInterface_Impl : public POA_AdditionComponent::AdditionInterface , - public Engines_Component_i { +class ADDITIONCOMPONENTENGINE_EXPORT AdditionInterface_Impl : public POA_AdditionComponent::AdditionInterface , + public Engines_Component_i { public: AdditionInterface_Impl() ; AdditionInterface_Impl( CORBA::ORB_ptr orb, @@ -83,6 +83,7 @@ private: }; extern "C" + ADDITIONCOMPONENTENGINE_EXPORT PortableServer::ObjectId * AdditionInterfaceEngine_factory ( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , diff --git a/src/AdditionComponent/Addition_Adder_Impl.cxx b/src/AdditionComponent/Addition_Adder_Impl.cxx index a2c36f6..7fd3a9b 100644 --- a/src/AdditionComponent/Addition_Adder_Impl.cxx +++ b/src/AdditionComponent/Addition_Adder_Impl.cxx @@ -26,7 +26,9 @@ // Module : SuperVisionTest // #include +#ifndef WIN32 #include +#endif #include #include #include @@ -95,9 +97,13 @@ CORBA::Double Adder_Impl::Add( CORBA::Double x , CORBA::Double y , CORBA::Double sendMessage(NOTIF_STEP, "Adder_Impl::Add is Computing"); // S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); S = 5 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif MESSAGE( "Adder_Impl::Add( " << x << " , " << y << " , " << z << " ) returns " << -(x - y) << " after " << S << " seconds" ) LastAddition = z ; @@ -122,9 +128,13 @@ CORBA::Double Adder_Impl::AddAndCompare( CORBA::Double x , CORBA::Double y , sendMessage(NOTIF_STEP, "Adder_Impl::AddAndCompare is Computing"); // S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); S = 5 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif MESSAGE( "Adder_Impl::AddAndCompare( " << x << " , " << y << " , " << z << " ) returns " << -(x - y) << " after " << S << " seconds" ) LastAddition = z ; @@ -150,9 +160,13 @@ void Adder_Impl::SetLastResult( CORBA::Double z ) { int S; // S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); S = 5 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif LastAddition = z ; endService( " Adder_Impl::SetLastResult" ); return ; @@ -164,9 +178,13 @@ void Adder_Impl::LastResult( CORBA::Double & z ) { int S; // S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); S = 5 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif z = LastAddition ; endService( " Adder_Impl::LastResult" ); return ; diff --git a/src/AdditionComponent/Addition_Adder_Impl.hxx b/src/AdditionComponent/Addition_Adder_Impl.hxx index fe9083b..01abad0 100644 --- a/src/AdditionComponent/Addition_Adder_Impl.hxx +++ b/src/AdditionComponent/Addition_Adder_Impl.hxx @@ -29,14 +29,15 @@ #ifndef _ADDITION_ADDER_IMPL_HXX_ #define _ADDITION_ADDER_IMPL_HXX_ +#include "AdditionComponent.hxx" #include #include #include CORBA_SERVER_HEADER(AdditionComponent) #include CORBA_SERVER_HEADER(SALOME_Component) #include "SALOME_Component_i.hxx" -class Adder_Impl : public POA_AdditionComponent::Adder , - public Engines_Component_i { +class ADDITIONCOMPONENTENGINE_EXPORT Adder_Impl : public POA_AdditionComponent::Adder , + public Engines_Component_i { public: Adder_Impl() ; Adder_Impl( CORBA::ORB_ptr orb , diff --git a/src/AdditionComponent/CMakeLists.txt b/src/AdditionComponent/CMakeLists.txt index d2be5cc..9d1c97e 100644 --- a/src/AdditionComponent/CMakeLists.txt +++ b/src/AdditionComponent/CMakeLists.txt @@ -66,6 +66,7 @@ SET(AdditionComponentEngine_HEADERS SET(AdditionComponentEngine_SOURCES Addition_Adder_Impl.cxx AdditionComponent_Impl.cxx + AdditionComponent.hxx ) # bin programs diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 756064d..ff774dd 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -32,13 +32,17 @@ SET(SUBDIRS_COMMON TypesCheck DataStreamComponent SIGNALSComponent - UndefinedSymbolComponent SIGNALSComponent_Swig TestFunctions ) +IF(NOT WIN32) + SET(SUBDIRS_UNDEFINED UndefinedSymbolComponent) +ENDIF(NOT WIN32) + SET(SUBDIRS ${SUBDIRS_COMMON} + ${SUBDIRS_UNDEFINED} ) FOREACH(dir ${SUBDIRS}) diff --git a/src/DataStreamComponent/DataStreamComponent_CheckOfUndefined.cxx b/src/DataStreamComponent/DataStreamComponent_CheckOfUndefined.cxx index c9ae1c9..e410f11 100644 --- a/src/DataStreamComponent/DataStreamComponent_CheckOfUndefined.cxx +++ b/src/DataStreamComponent/DataStreamComponent_CheckOfUndefined.cxx @@ -26,7 +26,9 @@ // #include #include +#ifndef WIN32 #include +#endif #include "DataStreamComponent_Impl.hxx" diff --git a/src/DataStreamComponent/DataStreamComponent_Impl.cxx b/src/DataStreamComponent/DataStreamComponent_Impl.cxx index 5b49ffe..093cc46 100644 --- a/src/DataStreamComponent/DataStreamComponent_Impl.cxx +++ b/src/DataStreamComponent/DataStreamComponent_Impl.cxx @@ -26,7 +26,11 @@ // Module : SuperVisionTest // #include +#ifndef WIN32 #include +#else +#include +#endif #include #include #include @@ -111,8 +115,13 @@ extern "C" const char *instanceName, const char *interfaceName) { +#ifndef WIN32 MESSAGE("DataStreamFactoryEngine_factory DataStreamFactoryEngine (" << instanceName << "," << interfaceName << "," << getpid() << ")"); +#else + MESSAGE("DataStreamFactoryEngine_factory DataStreamFactoryEngine (" + << instanceName << "," << interfaceName << "," << _getpid() << ")"); +#endif DataStreamFactory_Impl * myDataStreamFactory = new DataStreamFactory_Impl(orb, poa, contId, instanceName, interfaceName); return myDataStreamFactory->getId() ; diff --git a/src/DataStreamComponent/DataStreamComponent_Impl.hxx b/src/DataStreamComponent/DataStreamComponent_Impl.hxx index 963979d..841a12f 100644 --- a/src/DataStreamComponent/DataStreamComponent_Impl.hxx +++ b/src/DataStreamComponent/DataStreamComponent_Impl.hxx @@ -29,13 +29,23 @@ #ifndef _DATASTREAMINTERFACE_IMPL_HXX_ #define _DATASTREAMINTERFACE_IMPL_HXX_ +#ifdef WIN32 +# if defined DATASTREAMFACTORYENGINE_EXPORTS || defined DataStreamFactoryEngine_EXPORTS +# define DATASTREAMFACTORYENGINE_EXPORT __declspec( dllexport ) +# else +# define DATASTREAMFACTORYENGINE_EXPORT __declspec( dllimport ) +# endif +#else +# define DATASTREAMFACTORYENGINE_EXPORT +#endif + #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 { +class DATASTREAMFACTORYENGINE_EXPORT DataStreamFactory_Impl : public POA_DataStreamComponent::DataStreamFactory , + public Engines_Component_i { public: DataStreamFactory_Impl() ; DataStreamFactory_Impl( CORBA::ORB_ptr orb, @@ -67,6 +77,7 @@ private: }; extern "C" + DATASTREAMFACTORYENGINE_EXPORT PortableServer::ObjectId * DataStreamFactoryEngine_factory ( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , @@ -75,8 +86,8 @@ extern "C" const char *interfaceName ) ; -class DataStream_Impl : public POA_DataStreamComponent::DataStream , - public Engines_Component_i { +class DATASTREAMFACTORYENGINE_EXPORT DataStream_Impl : public POA_DataStreamComponent::DataStream , + public Engines_Component_i { public: DataStream_Impl() ; DataStream_Impl( CORBA::ORB_ptr orb , diff --git a/src/DivComponent/DivComponent.cxx b/src/DivComponent/DivComponent.cxx index 7cdcb8a..11f96f1 100644 --- a/src/DivComponent/DivComponent.cxx +++ b/src/DivComponent/DivComponent.cxx @@ -26,7 +26,9 @@ // Module : SuperVisionTest // #include +#ifndef WIN32 #include +#endif #include #include #include @@ -76,9 +78,13 @@ 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)); S = 5 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif sendMessage(NOTIF_TRACE, "Div is Much More Difficult Operation"); MESSAGE("DivComponentEngine::Div( " << x << " , " << y << " , " << z << " ) after " << S << " seconds" ) diff --git a/src/DivComponent/DivComponent.hxx b/src/DivComponent/DivComponent.hxx index a6826ee..0a7026b 100644 --- a/src/DivComponent/DivComponent.hxx +++ b/src/DivComponent/DivComponent.hxx @@ -29,14 +29,24 @@ #ifndef _DIVCOMPONENTENGINE_HXX_ #define _DIVCOMPONENTENGINE_HXX_ +#ifdef WIN32 +# if defined DIVCOMPONENTENGINE_EXPORTS || defined DivComponentEngine_EXPORTS +# define DIVCOMPONENTENGINE_EXPORT __declspec( dllexport ) +# else +# define DIVCOMPONENTENGINE_EXPORT __declspec( dllimport ) +# endif +#else +# define DIVCOMPONENTENGINE_EXPORT +#endif + //#include #include #include CORBA_SERVER_HEADER(DivComponent) #include CORBA_SERVER_HEADER(SALOME_Component) #include "SALOME_Component_i.hxx" -class DivComponentEngine : public POA_SuperVisionTest::DivComponent , - public Engines_Component_i { +class DIVCOMPONENTENGINE_EXPORT DivComponentEngine : public POA_SuperVisionTest::DivComponent , + public Engines_Component_i { public: DivComponentEngine() ; DivComponentEngine( CORBA::ORB_ptr orb, @@ -58,6 +68,7 @@ private: }; extern "C" + DIVCOMPONENTENGINE_EXPORT PortableServer::ObjectId * DivComponentEngine_factory ( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , diff --git a/src/MulComponent/MulComponent.cxx b/src/MulComponent/MulComponent.cxx index a5a71a0..620ff74 100644 --- a/src/MulComponent/MulComponent.cxx +++ b/src/MulComponent/MulComponent.cxx @@ -26,7 +26,9 @@ // Module : SuperVisionTest // #include +#ifndef WIN32 #include +#endif #include #include #include @@ -76,9 +78,13 @@ 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)); S = 5 ; + #ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif MESSAGE( "MulComponentEngine::Mul( " << x << " , " << y << " , " << z << " ) after " << S << " seconds" ) endService( " MulComponentEngine::Mul" ); diff --git a/src/MulComponent/MulComponent.hxx b/src/MulComponent/MulComponent.hxx index 90341d1..a79a82a 100644 --- a/src/MulComponent/MulComponent.hxx +++ b/src/MulComponent/MulComponent.hxx @@ -29,14 +29,24 @@ #ifndef _MULCOMPONENTENGINE_HXX_ #define _MULCOMPONENTENGINE_HXX_ +#ifdef WIN32 +# if defined MULCOMPONENTENGINE_EXPORTS || defined MulComponentEngine_EXPORTS +# define MULCOMPONENTENGINE_EXPORT __declspec( dllexport ) +# else +# define MULCOMPONENTENGINE_EXPORT __declspec( dllimport ) +# endif +#else +# define MULCOMPONENTENGINE_EXPORT +#endif + //#include #include #include CORBA_SERVER_HEADER(MulComponent) #include CORBA_SERVER_HEADER(SALOME_Component) #include "SALOME_Component_i.hxx" -class MulComponentEngine : public POA_SuperVisionTest::MulComponent , - public Engines_Component_i { +class MULCOMPONENTENGINE_EXPORT MulComponentEngine : public POA_SuperVisionTest::MulComponent , + public Engines_Component_i { public: MulComponentEngine() ; MulComponentEngine( CORBA::ORB_ptr orb, @@ -58,6 +68,7 @@ private: }; extern "C" + MULCOMPONENTENGINE_EXPORT PortableServer::ObjectId * MulComponentEngine_factory ( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , diff --git a/src/SIGNALSComponent/CMakeLists.txt b/src/SIGNALSComponent/CMakeLists.txt index 0bb0286..40c7d84 100644 --- a/src/SIGNALSComponent/CMakeLists.txt +++ b/src/SIGNALSComponent/CMakeLists.txt @@ -52,6 +52,7 @@ SET(_link_LIBRARIES # header files / no moc processing SET(SIGNALSComponentEngine_HEADERS SIGNALSComponent_Impl.hxx + SIGNALSComponent_defines.hxx ) # --- sources --- diff --git a/src/SIGNALSComponent/SIGNALSComponent.cxx b/src/SIGNALSComponent/SIGNALSComponent.cxx index 543c66f..d1b294d 100755 --- a/src/SIGNALSComponent/SIGNALSComponent.cxx +++ b/src/SIGNALSComponent/SIGNALSComponent.cxx @@ -26,7 +26,9 @@ // Module : SuperVisionTest // #include +#ifndef WIN32 #include +#endif #include #include #include diff --git a/src/SIGNALSComponent/SIGNALSComponent.hxx b/src/SIGNALSComponent/SIGNALSComponent.hxx index 8e2a47c..cd5d018 100755 --- a/src/SIGNALSComponent/SIGNALSComponent.hxx +++ b/src/SIGNALSComponent/SIGNALSComponent.hxx @@ -29,14 +29,14 @@ #ifndef _SIGNALSCOMPONENTENGINE_HXX_ #define _SIGNALSCOMPONENTENGINE_HXX_ -//#include +#include "SIGNALSComponent_defines.hxx" #include #include CORBA_SERVER_HEADER(SIGNALSComponent) #include CORBA_SERVER_HEADER(SALOME_Component) #include "SALOME_Component_i.hxx" -class SIGNALSComponentEngine : public POA_SuperVisionTest::SIGNALSComponent , - public Engines_Component_i { +class SIGNALSCOMPONENTENGINE_EXPORT SIGNALSComponentEngine : public POA_SuperVisionTest::SIGNALSComponent , + public Engines_Component_i { public: SIGNALSComponentEngine() ; SIGNALSComponentEngine( CORBA::ORB_ptr orb, @@ -57,6 +57,7 @@ private: }; extern "C" + SIGNALSCOMPONENTENGINE_EXPORT PortableServer::ObjectId * SIGNALSComponentEngine_factory ( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , diff --git a/src/SIGNALSComponent/SIGNALSComponent_CheckOfUndefined.cxx b/src/SIGNALSComponent/SIGNALSComponent_CheckOfUndefined.cxx index aabad63..4001680 100644 --- a/src/SIGNALSComponent/SIGNALSComponent_CheckOfUndefined.cxx +++ b/src/SIGNALSComponent/SIGNALSComponent_CheckOfUndefined.cxx @@ -30,7 +30,7 @@ #include #include -#ifndef WNT +#ifndef WIN32 #include #else #include @@ -53,8 +53,10 @@ //CCRT #include #include +#ifndef WIN32 #include #include +#endif //end-CCRT #include "Container_init_python.hxx" diff --git a/src/SIGNALSComponent/SIGNALSComponent_Impl.cxx b/src/SIGNALSComponent/SIGNALSComponent_Impl.cxx index 8baecc8..4055075 100755 --- a/src/SIGNALSComponent/SIGNALSComponent_Impl.cxx +++ b/src/SIGNALSComponent/SIGNALSComponent_Impl.cxx @@ -26,7 +26,9 @@ // Module : SuperVisionTest // #include +#ifndef WIN32 #include +#endif #include #include #include @@ -72,11 +74,20 @@ char* SIGNALSComponent_Impl::getVersion() CORBA::Long SIGNALSComponent_Impl::SIGSEGVfunc() { beginService( " SIGNALSComponent_Impl::SIGSEGVfunc" ); +#ifndef WIN32 cout << pthread_self() << "SIGNALSComponent_Impl::SIGSEGVfunc" << endl ; +#else + cout << pthread_self().p << "SIGNALSComponent_Impl::SIGSEGVfunc" << endl ; +#endif int S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); + +#ifndef WIN32 while ( S ) { S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif long nullptr = *NULLPTR ; endService( " SIGNALSComponent_Impl::SIGSEGVfunc" ); return nullptr ; @@ -84,11 +95,19 @@ CORBA::Long SIGNALSComponent_Impl::SIGSEGVfunc() { CORBA::Long SIGNALSComponent_Impl::SIGFPEfunc( CORBA::Long a , CORBA::Long b ) { beginService( " SIGNALSComponent_Impl::SIGFPEfunc" ); +#ifndef WIN32 cout << pthread_self() << "SIGNALSComponent_Impl::SIGFPEfunc" << endl ; +#else + cout << pthread_self().p << "SIGNALSComponent_Impl::SIGFPEfunc" << endl ; +#endif int S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); +#ifndef WIN32 while ( S ) { S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif long c = a/b ; endService( " SIGNALSComponent_Impl::SIGFPEfunc" ); return c ; @@ -97,7 +116,12 @@ CORBA::Long SIGNALSComponent_Impl::SIGFPEfunc( CORBA::Long a , CORBA::Long b ) { void SIGNALSComponent_Impl::MethodToKill() { beginService( " SIGNALSComponent_Impl::MethodToKill" ); while ( 1 ) { - sleep(1) ; +#ifndef WIN32 + sleep(1); +#else + Sleep(1000); +#endif + } endService( " SIGNALSComponent_Impl::MethodToKill" ); return ; diff --git a/src/SIGNALSComponent/SIGNALSComponent_Impl.hxx b/src/SIGNALSComponent/SIGNALSComponent_Impl.hxx index 8679fa2..0857845 100755 --- a/src/SIGNALSComponent/SIGNALSComponent_Impl.hxx +++ b/src/SIGNALSComponent/SIGNALSComponent_Impl.hxx @@ -29,14 +29,14 @@ #ifndef _SIGNALSCOMPONENT_IMPL_HXX_ #define _SIGNALSCOMPONENT_IMPL_HXX_ -//#include +#include "SIGNALSComponent_defines.hxx" #include #include CORBA_SERVER_HEADER(SIGNALSComponent) #include CORBA_SERVER_HEADER(SALOME_Component) #include "SALOME_Component_i.hxx" -class SIGNALSComponent_Impl : public POA_SuperVisionTest::SIGNALSComponent , - public Engines_Component_i { +class SIGNALSCOMPONENTENGINE_EXPORT SIGNALSComponent_Impl : public POA_SuperVisionTest::SIGNALSComponent , + public Engines_Component_i { public: SIGNALSComponent_Impl() ; SIGNALSComponent_Impl( CORBA::ORB_ptr orb, @@ -61,6 +61,7 @@ private: }; extern "C" + SIGNALSCOMPONENTENGINE_EXPORT PortableServer::ObjectId * SIGNALSComponentEngine_factory ( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , diff --git a/src/SIGNALSComponent/SIGNALSComponent_defines.hxx b/src/SIGNALSComponent/SIGNALSComponent_defines.hxx new file mode 100755 index 0000000..cbb654e --- /dev/null +++ b/src/SIGNALSComponent/SIGNALSComponent_defines.hxx @@ -0,0 +1,40 @@ +// Copyright (C) 2007-2013 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. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File : SIGNALSComponent_defines.hxx +// Author : Roman NIKOLAEV, OPEN CASCADE +// $Header$ +// +#ifndef _SIGNALSCOMPONENT_DEFINES_HXX_ +#define _SIGNALSCOMPONENT_DEFINES_HXX_ + +#ifdef WIN32 +# if defined SIGNALSCOMPONENTENGINE_EXPORTS || defined SIGNALSComponentEngine_EXPORTS +# define SIGNALSCOMPONENTENGINE_EXPORT __declspec( dllexport ) +# else +# define SIGNALSCOMPONENTENGINE_EXPORT __declspec( dllimport ) +# endif +#else +# define SIGNALSCOMPONENTENGINE_EXPORT +#endif + +#endif //_SIGNALSCOMPONENT_DEFINES_HXX_ diff --git a/src/SubComponent/SubComponent.cxx b/src/SubComponent/SubComponent.cxx index 3868afc..662681d 100644 --- a/src/SubComponent/SubComponent.cxx +++ b/src/SubComponent/SubComponent.cxx @@ -26,7 +26,9 @@ // Module : SuperVisionTest // #include +#ifndef WIN32 #include +#endif #include #include #include @@ -75,9 +77,13 @@ 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)); S = 5 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif MESSAGE( "SubComponentEngine::Sub( " << x << " , " << y << " , " << z << " ) after " << S << " seconds" ) endService( " SubComponentEngine::Sub" ); diff --git a/src/SubComponent/SubComponent.hxx b/src/SubComponent/SubComponent.hxx index fe2b7d2..edf3e48 100644 --- a/src/SubComponent/SubComponent.hxx +++ b/src/SubComponent/SubComponent.hxx @@ -29,13 +29,23 @@ #ifndef _SUBCOMPONENTENGINE_HXX_ #define _SUBCOMPONENTENGINE_HXX_ +#ifdef WIN32 +# if defined SUBCOMPONENTENGINE_EXPORTS || defined SubComponentEngine_EXPORTS +# define SUBCOMPONENTENGINE_EXPORT __declspec( dllexport ) +# else +# define SUBCOMPONENTENGINE_EXPORT __declspec( dllimport ) +# endif +#else +# define SUBCOMPONENTENGINE_EXPORT +#endif + #include #include CORBA_SERVER_HEADER(SubComponent) #include CORBA_SERVER_HEADER(SALOME_Component) #include "SALOME_Component_i.hxx" -class SubComponentEngine : public POA_SuperVisionTest::SubComponent , - public Engines_Component_i { +class SUBCOMPONENTENGINE_EXPORT SubComponentEngine : public POA_SuperVisionTest::SubComponent , + public Engines_Component_i { public: SubComponentEngine() ; SubComponentEngine( CORBA::ORB_ptr orb, @@ -57,6 +67,7 @@ private: }; extern "C" + SUBCOMPONENTENGINE_EXPORT PortableServer::ObjectId * SubComponentEngine_factory ( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , diff --git a/src/SyrComponent/SyrComponent_CheckOfUndefined.cxx b/src/SyrComponent/SyrComponent_CheckOfUndefined.cxx index ae5e436..8ac46db 100755 --- a/src/SyrComponent/SyrComponent_CheckOfUndefined.cxx +++ b/src/SyrComponent/SyrComponent_CheckOfUndefined.cxx @@ -25,7 +25,9 @@ // Module : SuperVisionTest // #include +#ifndef WIN32 #include +#endif #include #include #include diff --git a/src/SyrComponent/SyrComponent_Impl.cxx b/src/SyrComponent/SyrComponent_Impl.cxx index c4ef2fb..81b5df8 100755 --- a/src/SyrComponent/SyrComponent_Impl.cxx +++ b/src/SyrComponent/SyrComponent_Impl.cxx @@ -26,7 +26,11 @@ // Module : SuperVisionTest // #include +#ifndef WIN32 #include +#else +#include +#endif #include #include #include @@ -74,9 +78,13 @@ CORBA::Long SyrComponent_Impl::C_ISEVEN( CORBA::Long anInteger ) { sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_ISEVEN is Computing"); // int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); int S = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif RetVal = ( anInteger & 1 ) == 0 ; endService( " SyrComponent_Impl::C_ISEVEN" ); return RetVal ; @@ -88,9 +96,13 @@ CORBA::Long SyrComponent_Impl::C_ISONE( CORBA::Long anOddInteger ) { sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_ISONE is Computing"); // int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); int S = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif RetVal = ( anOddInteger == 1 ) ; endService( " SyrComponent_Impl::C_ISONE" ); return RetVal ; @@ -101,10 +113,13 @@ CORBA::Long SyrComponent_Impl::C_M3( CORBA::Long anOddInteger ) { sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_M3 is Computing"); // int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); int S = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } - endService( " SyrComponent_Impl::C_M3" ); +#else + Sleep(S*1000); +#endif endService( " SyrComponent_Impl::C_M3" ); if ( C_ISEVEN( anOddInteger ) ) return 0 ; return ( 3*anOddInteger ) ; @@ -115,9 +130,13 @@ CORBA::Long SyrComponent_Impl::C_M3P1( CORBA::Long anOddInteger ) { sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_M3P1 is Computing"); // int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); int S = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif endService( " SyrComponent_Impl::C_M3P1" ); if ( C_ISEVEN( anOddInteger ) ) return 0 ; @@ -129,9 +148,13 @@ CORBA::Long SyrComponent_Impl::C_DIV2( CORBA::Long anEvenInteger ) { sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_DIV2 is Computing"); // int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); int S = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif endService( " SyrComponent_Impl::C_DIV2" ); if ( !C_ISEVEN( anEvenInteger ) ) return 0 ; @@ -143,9 +166,13 @@ CORBA::Long SyrComponent_Impl::C_INCR( CORBA::Long aCount ) { sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_INCR is Computing"); // int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); int S = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif endService( " SyrComponent_Impl::C_INCR" ); return ( aCount + 1 ) ; } @@ -155,9 +182,13 @@ void SyrComponent_Impl::CPP_SETLONG( CORBA::Long aCount ) { sendMessage(NOTIF_STEP, "SyrComponent_Impl::CPP_SETLONG is Computing"); // int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); int S = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif _Count = aCount ; endService( " SyrComponent_Impl::CPP_SETLONG" ); return ; @@ -168,9 +199,13 @@ CORBA::Long SyrComponent_Impl::CPP_ADDTOLONG( CORBA::Long anIncr ) { sendMessage(NOTIF_STEP, "SyrComponent_Impl::CPP_ADDTOLONG is Computing"); // int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); int S = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif endService( " SyrComponent_Impl::CPP_ADDTOLONG" ); return ( _Count + anIncr ) ; } @@ -180,9 +215,13 @@ CORBA::Long SyrComponent_Impl::C_MIN( CORBA::Long aMinVal , CORBA::Long anIntege sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_MIN is Computing"); // int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); int S = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif int min = aMinVal ; if ( anInteger < min || aMinVal == 0 ) { min = anInteger ; @@ -201,9 +240,13 @@ CORBA::Long SyrComponent_Impl::C_MAX( CORBA::Long aMaxVal , CORBA::Long anIntege sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_MAX is Computing"); // int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); int S = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif int max = aMaxVal ; if ( anInteger > max ) { max = anInteger ; @@ -222,9 +265,13 @@ SuperVisionTest::ListOfSyr_ptr 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 = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif ListOfSyr_Impl * aNewListOfSyr = new ListOfSyr_Impl( _orb , _poa, _contId, instanceName() , interfaceName() , graphName() , nodeName() ) ; @@ -246,9 +293,13 @@ SuperVisionTest::ListOfSyr_ptr 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 = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif SuperVisionTest::SeqOfSyr * aSeqOfSyr = aListOfSyr->GetSeqOfSyr() ; int len = aSeqOfSyr->length() ; aSeqOfSyr->length( len + 1 ) ; @@ -273,9 +324,13 @@ SuperVisionTest::Syr_ptr SyrComponent_Impl::Init( CORBA::Long anOddInteger ) { sendMessage(NOTIF_STEP, "SyrComponent_Impl creates Syr_Impl"); // int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); int S = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif Syr_Impl * mySyr ; mySyr = new Syr_Impl( _orb , _poa, _contId, instanceName() , interfaceName() , @@ -343,8 +398,13 @@ extern "C" const char *instanceName, const char *interfaceName) { +#ifndef WIN32 MESSAGE("SyrComponentEngine_factory SyrComponentEngine (" << instanceName << "," << interfaceName << "," << getpid() << ")"); +#else + MESSAGE("SyrComponentEngine_factory SyrComponentEngine (" + << instanceName << "," << interfaceName << "," << _getpid() << ")"); +#endif SyrComponent_Impl * mySyrComponent = new SyrComponent_Impl(orb, poa, contId, instanceName, interfaceName); return mySyrComponent->getId() ; @@ -387,9 +447,13 @@ CORBA::Long Syr_Impl::Initial() { sendMessage(NOTIF_STEP, "Syr_Impl::Initial is Computing"); // int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); int S = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif endService( " Syr_Impl::Initial" ); return _InitialInteger ; } @@ -399,9 +463,13 @@ CORBA::Long Syr_Impl::Current() { sendMessage(NOTIF_STEP, "Syr_Impl::Current is Computing"); // int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); int S = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif endService( " Syr_Impl::Current" ); return _CurrentInteger ; } @@ -412,9 +480,13 @@ CORBA::Long Syr_Impl::IsEven() { sendMessage(NOTIF_STEP, "Syr_Impl::IsEven is Computing"); // int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); int S = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif RetVal = ( _CurrentInteger & 1 ) == 0 ; MESSAGE( " Syr_Impl::IsEven " << _CurrentInteger << " " << RetVal ); endService( " Syr_Impl::IsEven" ); @@ -427,9 +499,13 @@ CORBA::Long Syr_Impl::IsOne() { sendMessage(NOTIF_STEP, "Syr_Impl::IsOne is Computing"); // int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); int S = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif RetVal = ( _CurrentInteger == 1 ) ; MESSAGE( " Syr_Impl::IsOne " << _CurrentInteger << " " << RetVal ); endService( " Syr_Impl::IsOne" ); @@ -441,9 +517,13 @@ CORBA::Long Syr_Impl::Count() { sendMessage(NOTIF_STEP, "Syr_Impl::Count is Computing"); // int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); int S = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif MESSAGE( " Syr_Impl::Count " << _Count ); endService( " Syr_Impl::Count" ); return _Count ; @@ -454,9 +534,13 @@ void Syr_Impl::M3p1() { sendMessage(NOTIF_STEP, "Syr_Impl::M3p1 is Computing"); // int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); int S = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif if ( IsEven() ) _CurrentInteger = 0 ; else @@ -470,9 +554,13 @@ void Syr_Impl::Div2() { sendMessage(NOTIF_STEP, "Syr_Impl::Div2 is Computing"); // int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); int S = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif if ( !IsEven() ) _CurrentInteger = 0 ; else @@ -486,9 +574,13 @@ void Syr_Impl::Incr() { sendMessage(NOTIF_STEP, "Syr_Impl::Incr is Computing"); // int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); int S = 1 ; +#ifndef WIN32 while ( S ) { - S = sleep(S); + S = sleep( S ) ; } +#else + Sleep(S*1000); +#endif _Count = _Count + 1 ; MESSAGE( " Syr_Impl::Incr " << _Count ); endService( " Syr_Impl::Incr" ); diff --git a/src/SyrComponent/SyrComponent_Impl.hxx b/src/SyrComponent/SyrComponent_Impl.hxx index 35d94f3..fa48f76 100755 --- a/src/SyrComponent/SyrComponent_Impl.hxx +++ b/src/SyrComponent/SyrComponent_Impl.hxx @@ -29,14 +29,24 @@ #ifndef _SYRCOMPONENT_IMPL_HXX_ #define _SYRCOMPONENT_IMPL_HXX_ +#ifdef WIN32 +# if defined SYRCOMPONENTENGINE_EXPORTS || defined SyrComponentEngine_EXPORTS +# define SYRCOMPONENTENGINE_EXPORT __declspec( dllexport ) +# else +# define SYRCOMPONENTENGINE_EXPORT __declspec( dllimport ) +# endif +#else +# define SYRCOMPONENTENGINE_EXPORT +#endif + //#include #include #include CORBA_SERVER_HEADER(SyrComponent) #include CORBA_SERVER_HEADER(SALOME_Component) #include "SALOME_Component_i.hxx" -class SyrComponent_Impl : public POA_SuperVisionTest::SyrComponent , - public Engines_Component_i { +class SYRCOMPONENTENGINE_EXPORT SyrComponent_Impl : public POA_SuperVisionTest::SyrComponent, + public Engines_Component_i { public: SyrComponent_Impl() ; SyrComponent_Impl( CORBA::ORB_ptr orb , @@ -85,8 +95,8 @@ private: long _Count ; }; -class ListOfSyr_Impl : public POA_SuperVisionTest::ListOfSyr , - public Engines_Component_i { +class SYRCOMPONENTENGINE_EXPORT ListOfSyr_Impl : public POA_SuperVisionTest::ListOfSyr , + public Engines_Component_i { public: ListOfSyr_Impl( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , @@ -110,6 +120,7 @@ private: }; extern "C" + SYRCOMPONENTENGINE_EXPORT PortableServer::ObjectId * SyrComponentEngine_factory ( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , @@ -117,8 +128,8 @@ extern "C" const char *instanceName , const char *interfaceName ) ; -class Syr_Impl : public POA_SuperVisionTest::Syr , - public SyrComponent_Impl { +class SYRCOMPONENTENGINE_EXPORT Syr_Impl : public POA_SuperVisionTest::SyrComponent , + public SyrComponent_Impl { public: Syr_Impl() ; Syr_Impl( CORBA::ORB_ptr orb , diff --git a/src/TestFunctions/DynInvoke.cxx b/src/TestFunctions/DynInvoke.cxx index 47ee16f..3283172 100644 --- a/src/TestFunctions/DynInvoke.cxx +++ b/src/TestFunctions/DynInvoke.cxx @@ -27,7 +27,9 @@ // $Header: // #include +#ifndef WIN32 #include +#endif #include #include #include diff --git a/src/TestFunctions/DynInvoke.hxx b/src/TestFunctions/DynInvoke.hxx index 9847ef9..4e68df5 100644 --- a/src/TestFunctions/DynInvoke.hxx +++ b/src/TestFunctions/DynInvoke.hxx @@ -27,6 +27,16 @@ #ifndef _DYNINVOKE_ #define _DYNINVOKE_ +#ifdef WIN32 +# if defined DYNINVOKE_EXPORTS || defined DynInvoke_EXPORTS +# define DYNINVOKE_EXPORT __declspec( dllexport ) +# else +# define DYNINVOKE_EXPORT __declspec( dllimport ) +# endif +#else +# define DYNINVOKE_EXPORT +#endif + struct ServicesAnyData { std::string Name; @@ -38,9 +48,9 @@ struct ServicesAnyData { // dynamic call for function with list of in parameters, followed // by out parameters with no return value -void DynInvoke(Engines::EngineComponent_ptr obj, - const char *method, - ServicesAnyData * inParams, int nInParams, - ServicesAnyData * outParams, int nOutParams); +void DYNINVOKE_EXPORT DynInvoke(Engines::EngineComponent_ptr obj, + const char *method, + ServicesAnyData * inParams, int nInParams, + ServicesAnyData * outParams, int nOutParams); #endif diff --git a/src/TestFunctions/TestFunctions.cxx b/src/TestFunctions/TestFunctions.cxx index 3e03d6c..d836bd9 100644 --- a/src/TestFunctions/TestFunctions.cxx +++ b/src/TestFunctions/TestFunctions.cxx @@ -26,7 +26,9 @@ // #include #include +#ifndef WIN32 #include +#endif #include #include CORBA_CLIENT_HEADER(AddComponent) diff --git a/src/TestFunctions/TestFunctionsMemory.cxx b/src/TestFunctions/TestFunctionsMemory.cxx index e2a0f3d..e4492fd 100644 --- a/src/TestFunctions/TestFunctionsMemory.cxx +++ b/src/TestFunctions/TestFunctionsMemory.cxx @@ -27,7 +27,10 @@ // #include #include + +#ifndef WIN32 #include +#endif #include #include CORBA_CLIENT_HEADER(AddComponent) diff --git a/src/TestFunctions/TestFunctionsMemory1.cxx b/src/TestFunctions/TestFunctionsMemory1.cxx index f74fa63..73fc2d9 100644 --- a/src/TestFunctions/TestFunctionsMemory1.cxx +++ b/src/TestFunctions/TestFunctionsMemory1.cxx @@ -27,7 +27,9 @@ // #include #include +#ifndef WIN32 #include +#endif #include #include CORBA_CLIENT_HEADER(AddComponent) diff --git a/src/TestFunctions/TestFunctionsMemory2.cxx b/src/TestFunctions/TestFunctionsMemory2.cxx index f40ad47..7e43760 100644 --- a/src/TestFunctions/TestFunctionsMemory2.cxx +++ b/src/TestFunctions/TestFunctionsMemory2.cxx @@ -27,7 +27,9 @@ // #include #include +#ifndef WIN32 #include +#endif #include #include CORBA_CLIENT_HEADER(AddComponent) diff --git a/src/TestFunctions/TestFunctionsMemory3.cxx b/src/TestFunctions/TestFunctionsMemory3.cxx index 6020f5a..51c1859 100644 --- a/src/TestFunctions/TestFunctionsMemory3.cxx +++ b/src/TestFunctions/TestFunctionsMemory3.cxx @@ -27,7 +27,9 @@ // #include #include +#ifndef WIN32 #include +#endif #include #include CORBA_CLIENT_HEADER(AddComponent) diff --git a/src/TestFunctions/TestFunctionsMemory4.cxx b/src/TestFunctions/TestFunctionsMemory4.cxx index 56665fa..c06f97b 100644 --- a/src/TestFunctions/TestFunctionsMemory4.cxx +++ b/src/TestFunctions/TestFunctionsMemory4.cxx @@ -27,7 +27,9 @@ // #include #include +#ifndef WIN32 #include +#endif #include #include CORBA_CLIENT_HEADER(AddComponent) diff --git a/src/TypesCheck/TypesCheck_CheckOfUndefined.cxx b/src/TypesCheck/TypesCheck_CheckOfUndefined.cxx index 75c4425..890040c 100644 --- a/src/TypesCheck/TypesCheck_CheckOfUndefined.cxx +++ b/src/TypesCheck/TypesCheck_CheckOfUndefined.cxx @@ -26,7 +26,9 @@ // #include #include +#ifndef WIN32 #include +#endif #include "TypesCheck_Impl.hxx" diff --git a/src/TypesCheck/TypesCheck_Impl.cxx b/src/TypesCheck/TypesCheck_Impl.cxx index 7c505d7..3ccd6ba 100644 --- a/src/TypesCheck/TypesCheck_Impl.cxx +++ b/src/TypesCheck/TypesCheck_Impl.cxx @@ -26,7 +26,11 @@ // Module : SuperVisionTest // #include +#ifndef WIN32 #include +#else +#include +#endif #include #include #include @@ -148,8 +152,14 @@ extern "C" PortableServer::ObjectId * contId , const char *instanceName , const char *interfaceName ) { +#ifndef WIN32 MESSAGE("TypesCheckEngine_factory TypesCheckEngine (" - << instanceName << "," << interfaceName << "," << getpid() << ")"); + << instanceName << "," << interfaceName << "," << getpid()<< ")"); +#else + MESSAGE("TypesCheckEngine_factory TypesCheckEngine (" + << instanceName << "," << interfaceName << "," << _getpid()<< ")"); +#endif + TypesCheck_Impl * myTypesCheck = new TypesCheck_Impl(orb, poa, contId, instanceName, interfaceName); return myTypesCheck->getId() ; } diff --git a/src/TypesCheck/TypesCheck_Impl.hxx b/src/TypesCheck/TypesCheck_Impl.hxx index 0d4ba70..935325a 100644 --- a/src/TypesCheck/TypesCheck_Impl.hxx +++ b/src/TypesCheck/TypesCheck_Impl.hxx @@ -29,6 +29,16 @@ #ifndef _TYPESCHECK_IMPL_HXX_ #define _TYPESCHECK_IMPL_HXX_ +#ifdef WIN32 +# if defined TYPESCHECKENGINE_EXPORTS || defined TypesCheckEngine_EXPORTS +# define TYPESCHECKENGINE_EXPORT __declspec( dllexport ) +# else +# define TYPESCHECKENGINE_EXPORT __declspec( dllimport ) +# endif +#else +# define TYPESCHECKENGINE_EXPORT +#endif + #include #include CORBA_SERVER_HEADER(AddComponent) #include CORBA_SERVER_HEADER(TypesCheck) @@ -37,8 +47,8 @@ #include "AddComponent_Impl.hxx" -class TypesCheck_Impl : public POA_SuperVisionTest::TypesCheck , - public Engines_Component_i { +class TYPESCHECKENGINE_EXPORT TypesCheck_Impl : public POA_SuperVisionTest::TypesCheck , + public Engines_Component_i { public: TypesCheck_Impl() ; TypesCheck_Impl( CORBA::ORB_ptr orb , @@ -78,6 +88,7 @@ class TypesCheck_Impl : public POA_SuperVisionTest::TypesCheck , }; extern "C" + TYPESCHECKENGINE_EXPORT PortableServer::ObjectId * TypesCheckEngine_factory ( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , PortableServer::ObjectId * contId , -- 2.39.2