// 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()
#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
// 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;
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
+
//
--- /dev/null
+// 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_
catch (const std::exception& ex) {
LOG("Receive undefined exception : "<<ex.what());
}
-
- sleep(2);
+#ifndef WIN32
+ sleep(2);
+#else
+ Sleep(2000);
+#endif
}
return true;
}
salomeinclude_HEADERS = \
SALOME_KernelServices.hxx \
SALOME_StudyEditor.hxx \
- SALOMEDS_DriverDefaultImpl.hxx
+ SALOMEDS_DriverDefaultImpl.hxx \
+ KernelHelpers.hxx
# Libraries targets
lib_LTLIBRARIES = libSalomeKernelHelpers.la
#ifndef __SALOMEDS_DRIVER_DEFAULT_IMPL_H__
#define __SALOMEDS_DRIVER_DEFAULT_IMPL_H__
+#include "KernelHelpers.hxx"
+
#include "SALOME_Component_i.hxx"
#include "SALOME_NamingService.hxx"
//---------------------------------------------------------
-class SALOMEDS_DriverDefaultImpl:
+class KERNELHELPERS_EXPORT SALOMEDS_DriverDefaultImpl:
public virtual POA_SALOMEDS::Driver
//---------------------------------------------------------
{
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();
//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);
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
#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)
// ---------------------------------------------
// 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);
#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);
#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);