Salome HOME
rnv: Prepare SALOME-6.4.0 for Windows.
authorrnv <rnv@opencascade.com>
Tue, 15 Nov 2011 07:07:18 +0000 (07:07 +0000)
committerrnv <rnv@opencascade.com>
Tue, 15 Nov 2011 07:07:18 +0000 (07:07 +0000)
src/Basics/Basics_Utils.cxx
src/Basics/Basics_Utils.hxx
src/KernelHelpers/KernelHelpers.hxx [new file with mode: 0755]
src/KernelHelpers/KernelHelpersUseCases.cxx
src/KernelHelpers/Makefile.am
src/KernelHelpers/SALOMEDS_DriverDefaultImpl.hxx
src/KernelHelpers/SALOME_KernelServices.hxx
src/KernelHelpers/SALOME_StudyEditor.hxx
src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx

index eacda61be098dcb592fe4a532d0bd43e92ecf1aa..8c19e413d08540fef31fd4d825adbc610ea3957d 100644 (file)
@@ -21,6 +21,7 @@
 //  Autor  : Alexander A. BORODIN
 //  Module : SALOME
 //
+
 #include "Basics_Utils.hxx"
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/stat.h>
 #include <execinfo.h>
-#else
-#include <winsock2.h>
 #endif
 
+
 namespace Kernel_Utils
 {
   std::string GetHostname()
index 507217dbe1251f2a6b08ea2cfa255ff72db4adb2..94991fd811771f1c73912686d4e1263a37a8dc5b 100644 (file)
 #define _Basics_UTILS_HXX_
 
 #include "SALOME_Basics.hxx"
-
 #include <string>
 #include <iostream>
+
 #ifndef WIN32
 #include <sys/time.h>
 #else
-#include <sys/timeb.h>
+#include <winsock2.h>
+#include <windows.h>
 #endif
 
 
@@ -68,7 +69,7 @@ namespace Kernel_Utils
 // Helper macro for time analysis
 // =============================================================
 //
-
+#ifndef WIN32
 #define START_TIMING(name) static long name##tcount=0;static long name##cumul;long name##tt0; timeval name##tv; gettimeofday(&name##tv,0); \
                            name##tt0=name##tv.tv_usec+name##tv.tv_sec*1000000; \
                            if(name##tcount==0)std::cerr<<__FILE__<<":"<<__LINE__<<":"<<#name<<std::endl;
@@ -78,6 +79,19 @@ namespace Kernel_Utils
                                 if(name##tcount==NUMBER){ \
                                   std::cerr <<__FILE__<<":"<<__LINE__<<":"<<#name<<" temps CPU(mus): "<< name##cumul<<std::endl; \
                                   name##tcount=0;name##cumul=0;}
+#else
+
+#define START_TIMING(name) static long name##tcount=0;static long name##cumul;long name##tt0; SYSTEMTIME name##tv; GetSystemTime(&name##tv); \
+                           name##tt0=name##tv.wMilliseconds + name##tv.wSecond*1000; \
+                           if(name##tcount==0)std::cerr<<__FILE__<<":"<<__LINE__<<":"<<#name<<std::endl;
+
+#define END_TIMING(name,NUMBER) name##tcount=name##tcount+1;GetSystemTime(&name##tv); \
+                                name##cumul=name##cumul+name##tv.wMilliseconds + name##tv.wSecond*1000 - name##tt0; \
+                                if(name##tcount==NUMBER){ \
+                                  std::cerr <<__FILE__<<":"<<__LINE__<<":"<<#name<<" temps CPU(mus): "<< name##cumul<<std::endl; \
+                                  name##tcount=0;name##cumul=0;}
+#endif
+
 
 
 //
diff --git a/src/KernelHelpers/KernelHelpers.hxx b/src/KernelHelpers/KernelHelpers.hxx
new file mode 100755 (executable)
index 0000000..98a7184
--- /dev/null
@@ -0,0 +1,39 @@
+// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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   : SALOME_Basics.hxx
+//  Author : Roman NIKOLAEV
+//  Module : SALOME
+//  $Header$
+//
+#ifndef _SALOME_KERNEL_HELPERS_HXX_
+#define _SALOME_KERNEL_HELPERS_HXX_
+
+
+#ifdef WIN32
+# if defined KERNELHELPERS_EXPORTS || defined SalomeKernelHelpers_EXPORTS
+#  define KERNELHELPERS_EXPORT __declspec( dllexport )
+# else
+#  define KERNELHELPERS_EXPORT __declspec( dllimport )
+# endif
+#else
+# define KERNELHELPERS
+#endif
+
+#endif //_SALOME_KERNEL_HELPERS_HXX_
index 1d788b92be7046696c03f6cff159c925b856e464..4c986cb7404c512db3d68509ed2cb81e7faa9fd7 100644 (file)
@@ -96,8 +96,11 @@ bool TEST_getSalomeLauncher() {
     catch (const std::exception& ex) {
       LOG("Receive undefined exception : "<<ex.what());
     }
-
-    sleep(2);
+#ifndef WIN32
+      sleep(2);
+#else
+      Sleep(2000);
+#endif
   }
   return true;
 }
index be642821974259c4bfeb93517e6a73a9e9cd4672..5210fc3eadaaac100113c66240c86d4f46f71aba 100644 (file)
@@ -27,7 +27,8 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am
 salomeinclude_HEADERS =                \
        SALOME_KernelServices.hxx      \
        SALOME_StudyEditor.hxx         \
-       SALOMEDS_DriverDefaultImpl.hxx
+       SALOMEDS_DriverDefaultImpl.hxx \
+       KernelHelpers.hxx
 
 # Libraries targets
 lib_LTLIBRARIES = libSalomeKernelHelpers.la
index 6f44ca6a9ee957e11fd2d69c3c4c22bf643039aa..ed611f80a498c8844ac8321b216d32a31a21de45 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __SALOMEDS_DRIVER_DEFAULT_IMPL_H__
 #define __SALOMEDS_DRIVER_DEFAULT_IMPL_H__
 
+#include "KernelHelpers.hxx"
+
 #include "SALOME_Component_i.hxx"
 #include "SALOME_NamingService.hxx"
 
@@ -9,7 +11,7 @@
 
 //---------------------------------------------------------
 
-class SALOMEDS_DriverDefaultImpl:
+class KERNELHELPERS_EXPORT SALOMEDS_DriverDefaultImpl:
   public virtual POA_SALOMEDS::Driver
 //---------------------------------------------------------
   {
@@ -18,10 +20,10 @@ class SALOMEDS_DriverDefaultImpl:
     SALOMEDS_DriverDefaultImpl();
   public:
     SALOMEDS_DriverDefaultImpl(CORBA::ORB_ptr orb,
-                              PortableServer::POA_ptr poa,
-                              PortableServer::ObjectId * contId,
-                              const char *instanceName,
-                              const char *interfaceName);
+             PortableServer::POA_ptr poa,
+             PortableServer::ObjectId * contId,
+             const char *instanceName,
+             const char *interfaceName);
 
 
     virtual ~SALOMEDS_DriverDefaultImpl();
@@ -32,45 +34,45 @@ class SALOMEDS_DriverDefaultImpl:
 
     //virtual SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
      SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
-                                   const char* theURL,
-                                   bool isMultiFile);
+            const char* theURL,
+            bool isMultiFile);
 
     virtual SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent,
-                                        const char* theURL,
-                                        bool isMultiFile);
+           const char* theURL,
+           bool isMultiFile);
 
     virtual bool Load(SALOMEDS::SComponent_ptr,
-                     const SALOMEDS::TMPFile &,
-                     const char* theURL,
-                     bool isMultiFile);
+          const SALOMEDS::TMPFile &,
+          const char* theURL,
+          bool isMultiFile);
 
     virtual bool LoadASCII(SALOMEDS::SComponent_ptr,
-                          const SALOMEDS::TMPFile &,
-                          const char* theURL,
-                          bool isMultiFile);
+         const SALOMEDS::TMPFile &,
+         const char* theURL,
+         bool isMultiFile);
 
     virtual void Close(SALOMEDS::SComponent_ptr IORSComponent);
 
     virtual char* ComponentDataType();
 
     virtual char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
-                                        const char* IORString,
-                                        CORBA::Boolean isMultiFile,
-                                        CORBA::Boolean isASCII);
+           const char* IORString,
+           CORBA::Boolean isMultiFile,
+           CORBA::Boolean isASCII);
 
     virtual char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
-                                        const char* aLocalPersistentID,
-                                        CORBA::Boolean isMultiFile,
-                                        CORBA::Boolean isASCII);
+           const char* aLocalPersistentID,
+           CORBA::Boolean isMultiFile,
+           CORBA::Boolean isASCII);
 
     virtual bool CanPublishInStudy(CORBA::Object_ptr theIOR);
 
     virtual SALOMEDS::SObject_ptr PublishInStudy
                              (SALOMEDS::Study_ptr theStudy,
-                             SALOMEDS::SObject_ptr theSObject,
-                             CORBA::Object_ptr theObject,
-                             const char* theName) 
-                               throw (SALOME::SALOME_Exception);
+                  SALOMEDS::SObject_ptr theSObject,
+            CORBA::Object_ptr theObject,
+            const char* theName) 
+              throw (SALOME::SALOME_Exception);
 
     virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
 
@@ -81,7 +83,7 @@ class SALOMEDS_DriverDefaultImpl:
                             CORBA::Long theObjectID);
 
     virtual SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
-                                   CORBA::Long theObjectID,
-                                   SALOMEDS::SObject_ptr theObject);
+            CORBA::Long theObjectID,
+            SALOMEDS::SObject_ptr theObject);
   };
 #endif
index 875a1c46d19ce4c5879d679773fa892310c039a6..7caf01a7514eea769e2b1237f68dc8e5f3d6eb35 100644 (file)
@@ -21,6 +21,8 @@
 #ifndef __KERNEL_SERVICES_H__
 #define __KERNEL_SERVICES_H__
 
+#include "KernelHelpers.hxx"
+
 #include "SALOMEconfig.h"
 #include CORBA_SERVER_HEADER(SALOMEDS)
 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
@@ -35,22 +37,22 @@ namespace KERNEL {
 
   // ---------------------------------------------
   // SALOME KERNEL main services
-  CORBA::ORB_ptr                getORB();
-  SALOME_NamingService *        getNamingService();
-  SALOME_LifeCycleCORBA *       getLifeCycleCORBA();
-  SALOME::Session_ptr           getSalomeSession();
-  SALOMEDS::StudyManager_ptr    getStudyManager();
-  Engines::SalomeLauncher_ptr   getSalomeLauncher();
-  Engines::ResourcesManager_ptr getResourcesManager();
+  KERNELHELPERS_EXPORT CORBA::ORB_ptr                getORB();
+  KERNELHELPERS_EXPORT SALOME_NamingService *        getNamingService();
+  KERNELHELPERS_EXPORT SALOME_LifeCycleCORBA *       getLifeCycleCORBA();
+  KERNELHELPERS_EXPORT SALOME::Session_ptr           getSalomeSession();
+  KERNELHELPERS_EXPORT SALOMEDS::StudyManager_ptr    getStudyManager();
+  KERNELHELPERS_EXPORT Engines::SalomeLauncher_ptr   getSalomeLauncher();
+  KERNELHELPERS_EXPORT Engines::ResourcesManager_ptr getResourcesManager();
 
   // ---------------------------------------------
   // SALOME KERNEL services to deal with a SALOME study, SObject and
   // SComponent.
   //
-  SALOMEDS::Study_ptr getStudyById(int aStudyId);
-  int                 getStudyId(SALOMEDS::Study_ptr study);
-  CORBA::Object_ptr   IORToObject(char * IOR);
-  CORBA::Object_ptr   SObjectToObject(SALOMEDS::SObject_ptr);
+  KERNELHELPERS_EXPORT SALOMEDS::Study_ptr getStudyById(int aStudyId);
+  KERNELHELPERS_EXPORT int                 getStudyId(SALOMEDS::Study_ptr study);
+  KERNELHELPERS_EXPORT CORBA::Object_ptr   IORToObject(char * IOR);
+  KERNELHELPERS_EXPORT CORBA::Object_ptr   SObjectToObject(SALOMEDS::SObject_ptr);
   
 
 
index b3b56d52d66623c1215d519e1566fd7a26342ff2..e2ea1ce6e370d809a3bbffd66b9da49fa9a58dff 100644 (file)
 #ifndef __STUDY_EDITOR_HXX__
 #define __STUDY_EDITOR_HXX__
 
+#include "KernelHelpers.hxx"
+
 #include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(SALOMEDS)
 #include CORBA_SERVER_HEADER(SALOME_Component)
 
 #include <vector>
 
-class SALOME_StudyEditor {
+class KERNELHELPERS_EXPORT SALOME_StudyEditor {
 
 public:
   SALOME_StudyEditor(int studyId);
index 96fb9c896b678f5ecd9be59b8a377074d42f5f24..67f16053a61f2ca95b7064e9b35f751c6865e4e5 100644 (file)
 #include "HDFexplorer.hxx"
 #include "Basics_Utils.hxx"
 
+//Warning undef of Ascii Winwows define
+#ifdef WIN32
+# undef GetUserName
+#endif
+
 #include "SALOMEDSImpl_Attributes.hxx"
 #include "SALOMEDSImpl_Tool.hxx"
 #include "SALOMEDSImpl_SComponent.hxx"
 #include <stdlib.h>
 #include <string.h>
 
-#ifdef WIN32
-#include <Windows.h>
-#endif
-
-//Warning undef of Ascii Winwows define
-#ifdef WIN32
-# undef GetUserName
-#endif
-
 #define USE_CASE_LABEL_ID                       "0:2"
 
 static void SaveAttributes(const SALOMEDSImpl_SObject& SO, HDFgroup *hdf_group_sobject);