_VarComponents->remove( _Id ) ;
}
_Id = 0 ;
-#ifndef WNT
+#ifndef WIN32
delete [] _Ior;
#else
delete [] (char*) _Ior;
# include <time.h>
}
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#else
#include <process.h>
_Compteur = -1 ;
if ( _SessionName )
{
-#ifndef WNT
+#ifndef WIN32
delete [] _SessionName ;
#else
delete [] (char*)_SessionName ;
return (CORBA::ULong)_Compteur ;
}
-#ifndef WNT
+#ifndef WIN32
void RegistryService::remove( const CORBA::ULong id)
#else
void RegistryService::remove( CORBA::ULong id)
}
-#ifndef WNT
+#ifndef WIN32
void RegistryService::hello( const CORBA::ULong id )
#else
void RegistryService::hello( CORBA::ULong id )
}
void RegistryService::ping()
{
-#ifndef WNT
+#ifndef WIN32
MESSAGE(" RegistryService::ping() pid "<< getpid());
#else
MESSAGE(" RegistryService::ping() pid "<< _getpid());
CORBA::Long getPID();
virtual CORBA::ULong add (const Registry::Infos & infos);
virtual CORBA::ULong size ( void );
-#ifndef WNT
+#ifndef WIN32
virtual void remove( const CORBA::ULong id );
virtual void hello( const CORBA::ULong id );
#else
#ifndef _SALOME_Registry_HXX_
#define _SALOME_Registry_HXX_
-#ifdef WNT
- #if defined REGISTRY_EXPORTS
- #if defined WIN32
- #define REGISTRY_EXPORT __declspec( dllexport )
- #else
- #define REGISTRY_EXPORT
- #endif
- #else
- #if defined WIN32
- #define REGISTRY_EXPORT __declspec( dllimport )
- #else
- #define REGISTRY_EXPORT
- #endif
- #endif
+#ifdef WIN32
+# ifdef REGISTRY_EXPORTS
+# define REGISTRY_EXPORT __declspec( dllexport )
+# else
+# define REGISTRY_EXPORT __declspec( dllimport )
+# endif
#else
- #define REGISTRY_EXPORT
+# define REGISTRY_EXPORT
#endif
#endif
for (int i = 1; i<=NumberOfTries; i++)
{
if (i!=1)
-#ifndef WNT
+#ifndef WIN32
a=nanosleep(&ts_req,&ts_rem);
#else
Sleep(TIMESleep/1000000);
for(int j=1; j<=NumberOfTries; j++)
{
if (j!=1)
-#ifndef WNT
+#ifndef WIN32
a=nanosleep(&ts_req, &ts_rem);
#else
Sleep(TIMESleep/1000000);
COMMON_LIBS =\
../NamingService/libSalomeNS.la \
../Utils/libOpUtil.la \
+ ../Basics/libSALOMEBasics.la \
$(top_builddir)/idl/libSalomeIDLKernel.la \
@LIBXML_LIBS@
ResourcesManager.cxx
libResourcesManager_la_CPPFLAGS =\
- $(COMMON_CPPFLAGS)
+ -I$(srcdir)/../Basics \
+ -I$(srcdir)/../SALOMELocalTrace \
+ -I$(srcdir)/../Utils \
+ @LIBXML_INCLUDES@
libResourcesManager_la_LDFLAGS = -no-undefined -version-info=0:0:0
libResourcesManager_la_LIBADD =\
+ ../Basics/libSALOMEBasics.la \
@LIBXML_LIBS@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "ResourcesManager.hxx"
-#include <OpUtil.hxx>
+#include <Basics_Utils.hxx>
#include <fstream>
#include <iostream>
#include <sstream>
#ifndef WIN32
# include <unistd.h>
+#else
+# include <algorithm>
#endif
#define MAX_SIZE_FOR_HOSTNAME 256;
const char *hostname = params.hostname.c_str();
#if defined(_DEBUG_) || defined(_DEBUG)
- cerr << "GetFittingResources " << hostname << " " << GetHostname().c_str() << endl;
+ cerr << "GetFittingResources " << hostname << " " << Kernel_Utils::GetHostname().c_str() << endl;
#endif
if (hostname[0] != '\0'){
//#endif
if ( strcmp(hostname, "localhost") == 0 ||
- strcmp(hostname, GetHostname().c_str()) == 0 )
+ strcmp(hostname, Kernel_Utils::GetHostname().c_str()) == 0 )
{
//#if defined(_DEBUG_) || defined(_DEBUG)
// cerr << "ResourcesManager_cpp::GetFittingResources : localhost" << endl;
//#endif
- vec.push_back(GetHostname().c_str());
+ vec.push_back(Kernel_Utils::GetHostname().c_str());
//#if defined(_DEBUG_) || defined(_DEBUG)
// cerr << "ResourcesManager_cpp::GetFittingResources : " << vec.size() << endl;
//#endif
#include "OpUtil.hxx"
#include <stdlib.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#else
#include <io.h>
SALOMEDS_Server_SOURCES = SALOMEDS_Server.cxx
SALOMEDS_Server_CPPFLAGS = $(COMMON_CPPFLAGS)
SALOMEDS_Server_LDADD = libSalomeDS.la \
- $(HDF5_LIBS) $(CORBA_LIBS)
+ ../Basics/libSALOMEBasics.la \
+ $(HDF5_LIBS) \
+ $(CORBA_LIBS)
SALOMEDS_Client_SOURCES = SALOMEDS_Client.cxx
SALOMEDS_Client_CPPFLAGS = $(COMMON_CPPFLAGS)
SALOMEDS_Client_LDADD = libSalomeDS.la \
- $(HDF5_LIBS) $(CORBA_LIBS)
+ ../Basics/libSALOMEBasics.la \
+ $(HDF5_LIBS) \
+ $(CORBA_LIBS)
// Module : SALOME
// $Header$
-#ifdef WNT
-#include <SALOMEDS.hxx>
-#include <SALOMEDS_StudyManager.hxx>
-#include <SALOMEDS_Study.hxx>
-#include <SALOMEDS_SObject.hxx>
-#include <SALOMEDS_StudyBuilder.hxx>
-#include <SALOMEDS_SComponent.hxx>
-#include <SALOMEDSClient.hxx>
-#include <SALOMEDSClient_IParameters.hxx>
-#include <SALOMEDS_IParameters.hxx>
-#include <SALOMEDS_StudyManager_i.hxx>
-#else
#include "SALOMEDS.hxx"
#include "SALOMEDS_StudyManager.hxx"
#include "SALOMEDS_Study.hxx"
#include "SALOMEDSClient_IParameters.hxx"
#include "SALOMEDS_IParameters.hxx"
#include "SALOMEDS_StudyManager_i.hxx"
-#endif
#include "SALOMEDS_Defines.hxx"
SALOMEDS::Locker lock;
aName = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->GetCreatorName();
}
-#ifndef WNT
+#ifndef WIN32
else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserName();
#else
else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserNameA();
SALOMEDS::Locker lock;
SALOMEDS_AttributeTreeNode_i* aFather;
aFather = new SALOMEDS_AttributeTreeNode_i(dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->GetFather(), _orb);
-#ifndef WNT
+#ifndef WIN32
return aFather->POA_SALOMEDS::AttributeTreeNode::_this();
#else
return aFather->AttributeTreeNode::_this();
SALOMEDS::Locker lock;
SALOMEDS_AttributeTreeNode_i* aPrevious;
aPrevious=new SALOMEDS_AttributeTreeNode_i(dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->GetPrevious(), _orb);
-#ifndef WNT
+#ifndef WIN32
return aPrevious->POA_SALOMEDS::AttributeTreeNode::_this();
#else
return aPrevious->AttributeTreeNode::_this();
SALOMEDS::Locker lock;
SALOMEDS_AttributeTreeNode_i* aNext;
aNext = new SALOMEDS_AttributeTreeNode_i(dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->GetNext(), _orb);
-#ifndef WNT
+#ifndef WIN32
return aNext->POA_SALOMEDS::AttributeTreeNode::_this();
#else
return aNext->AttributeTreeNode::_this();
SALOMEDS::Locker lock;
SALOMEDS_AttributeTreeNode_i* aFirst;
aFirst = new SALOMEDS_AttributeTreeNode_i(dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->GetFirst(), _orb);
-#ifndef WNT
+#ifndef WIN32
return aFirst->POA_SALOMEDS::AttributeTreeNode::_this();
#else
return aFirst->AttributeTreeNode::_this();
#ifndef _SALOMEDS_Defines_HXX_
#define _SALOMEDS_Defines_HXX_
-#ifdef WNT
- #if defined SALOMEDS_EXPORTS
- #if defined WIN32
- #define SALOMEDS_EXPORT __declspec( dllexport )
- #else
- #define SALOMEDS_EXPORT
- #endif
- #else
- #if defined WIN32
- #define SALOMEDS_EXPORT __declspec( dllimport )
- #else
- #define SALOMEDS_EXPORT
- #endif
- #endif
+#ifdef WIN32
+# ifdef SALOMEDS_EXPORTS
+# define SALOMEDS_EXPORT __declspec( dllexport )
+# else
+# define SALOMEDS_EXPORT __declspec( dllimport )
+# endif
#else
- #define SALOMEDS_EXPORT
+# define SALOMEDS_EXPORT
#endif
#endif
#include "SALOMEDS_ClientAttributes.hxx"
#include "SALOMEDS.hxx"
+#include "Basics_Utils.hxx"
+
#ifdef WIN32
#include <process.h>
#else
#include <unistd.h>
#endif
-#include "OpUtil.hxx"
-
using namespace std;
SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(SALOMEDSImpl_GenericAttribute* theGA)
long pid = (long)getpid();
#endif
- CORBA::LongLong addr = theGA->GetLocalImpl(GetHostname().c_str(), pid, _isLocal);
+ CORBA::LongLong addr = theGA->GetLocalImpl(Kernel_Utils::GetHostname().c_str(), pid, _isLocal);
if(_isLocal) {
_local_impl = reinterpret_cast<SALOMEDSImpl_GenericAttribute*>(addr);
_corba_impl = SALOMEDS::GenericAttribute::_nil();
#include "SALOMEDSImpl_SObject.hxx"
#include "SALOMEDSImpl_Study.hxx"
#include "Utils_ExceptHandlers.hxx"
+#include "Basics_Utils.hxx"
#include <map>
#ifdef WIN32
#include <unistd.h>
#endif
-#include "OpUtil.hxx"
-
using namespace std;
UNEXPECT_CATCH(GALockProtection, SALOMEDS::GenericAttribute::LockProtection);
#else
long pid = (long)getpid();
#endif
- isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0;
+ isLocal = (strcmp(theHostname, Kernel_Utils::GetHostname().c_str()) == 0 && pid == thePID)?1:0;
return reinterpret_cast<CORBA::LongLong>(_impl);
}
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
+#include "Basics_Utils.hxx"
+
+#include "utilities.h"
+
#ifdef WIN32
#include <windows.h>
#include <process.h>
#include <unistd.h>
#endif
-#include "OpUtil.hxx"
-#include "utilities.h"
+
using namespace std;
#endif
CORBA::LongLong addr = // mpv: fix for IPAL13534: for 64-bit platforms use 8-bytes long for pointer storage
- theSObject->GetLocalImpl(GetHostname().c_str(), pid, _isLocal);
+ theSObject->GetLocalImpl(Kernel_Utils::GetHostname().c_str(), pid, _isLocal);
if(_isLocal) {
_local_impl = reinterpret_cast<SALOMEDSImpl_SObject*>(addr);
#include "SALOMEDSImpl_SComponent.hxx"
#include "SALOMEDSImpl_Study.hxx"
#include "SALOMEDSImpl_AttributeIOR.hxx"
+#include "Basics_Utils.hxx"
#include <map>
#include <unistd.h>
#endif
-#include "OpUtil.hxx"
-
using namespace std;
SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const SALOMEDSImpl_SObject& theImpl, CORBA::ORB_ptr theORB)
#else
long pid = (long)getpid();
#endif
- isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0;
+ isLocal = (strcmp(theHostname, Kernel_Utils::GetHostname().c_str()) == 0 && pid == thePID)?1:0;
return reinterpret_cast<CORBA::LongLong>(_impl);
}
for (int i = 1; i<=NumberOfTries; i++)
{
if (i!=1)
-#ifndef WNT
+#ifndef WIN32
a=nanosleep(&ts_req,&ts_rem);
#else
Sleep(TIMESleep/1000000);
for(int j=1; j<=NumberOfTries; j++)
{
if (j!=1)
-#ifndef WNT
+#ifndef WIN32
a=nanosleep(&ts_req, &ts_rem);
#else
Sleep(TIMESleep/1000000);
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
+#include "Basics_Utils.hxx"
+
#ifdef WIN32
#include <process.h>
#else
#include <unistd.h>
#endif
-#include "OpUtil.hxx"
-
using namespace std;
SALOMEDS_Study::SALOMEDS_Study(SALOMEDSImpl_Study* theStudy)
long pid = (long)getpid();
#endif
- long addr = theStudy->GetLocalImpl(GetHostname().c_str(), pid, _isLocal);
+ long addr = theStudy->GetLocalImpl(Kernel_Utils::GetHostname().c_str(), pid, _isLocal);
if(_isLocal) {
_local_impl = reinterpret_cast<SALOMEDSImpl_Study*>(addr);
_corba_impl = SALOMEDS::Study::_duplicate(theStudy);
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
+#include "Basics_Utils.hxx"
+
#ifdef WIN32
#include <process.h>
#else
#include <unistd.h>
#endif
-#include "OpUtil.hxx"
-
using namespace std;
SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_ptr orb);
long pid = (long)getpid();
#endif
- CORBA::LongLong addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal);
+ CORBA::LongLong addr = theManager->GetLocalImpl(Kernel_Utils::GetHostname().c_str(), pid, _isLocal);
if(_isLocal) {
_local_impl = reinterpret_cast<SALOMEDSImpl_StudyManager*>(addr);
_corba_impl = SALOMEDS::StudyManager::_duplicate(theManager);
long pid = (long)getpid();
#endif
- CORBA::LongLong addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal);
+ CORBA::LongLong addr = theManager->GetLocalImpl(Kernel_Utils::GetHostname().c_str(), pid, _isLocal);
if(_isLocal) {
_local_impl = reinterpret_cast<SALOMEDSImpl_StudyManager*>(addr);
_corba_impl = SALOMEDS::StudyManager::_duplicate(theManager);
#include "SALOMEDSImpl_AttributeIOR.hxx"
#include "Utils_CorbaException.hxx"
+#include "Utils_ExceptHandlers.hxx"
+#include "Basics_Utils.hxx"
+#include "SALOME_GenericObj_i.hh"
#include <strstream>
#include <vector>
#include <map>
-using namespace std;
#ifdef WIN32
#include <process.h>
#include <unistd.h>
#endif
-#include "OpUtil.hxx"
-
-#include "SALOME_GenericObj_i.hh"
-
-#include "Utils_ExceptHandlers.hxx"
+using namespace std;
UNEXPECT_CATCH(SalomeException,SALOME::SALOME_Exception);
UNEXPECT_CATCH(LockProtection, SALOMEDS::StudyBuilder::LockProtection);
#else
long pid = (long)getpid();
#endif
- isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0;
- return ((CORBA::LongLong)(void*)_impl);
+ isLocal = (strcmp(theHostname, Kernel_Utils::GetHostname().c_str()) == 0 && pid == thePID)?1:0;
+ return reinterpret_cast<CORBA::LongLong>(_impl);
}
//===========================================================================
// std C++ headers
#include <iostream>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#endif
#include "DF_Label.hxx"
#include "DF_Attribute.hxx"
+#include "Basics_Utils.hxx"
+
#ifdef WIN32
#include <process.h>
#else
#include <unistd.h>
#endif
-#include "OpUtil.hxx"
-
using namespace std;
//============================================================================
* Purpose :
*/
//============================================================================
-#ifndef WNT
+#ifndef WIN32
void SALOMEDS_Study_i::RemovePostponed(const CORBA::Long /*theUndoLimit*/)
#else
void SALOMEDS_Study_i::RemovePostponed(CORBA::Long /*theUndoLimit*/)
* Purpose :
*/
//============================================================================
-#ifndef WNT
+#ifndef WIN32
void SALOMEDS_Study_i::UndoPostponed(const CORBA::Long theWay)
#else
void SALOMEDS_Study_i::UndoPostponed(CORBA::Long theWay)
#else
long pid = (long)getpid();
#endif
- isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0;
+ isLocal = (strcmp(theHostname, Kernel_Utils::GetHostname().c_str()) == 0 && pid == thePID)?1:0;
return reinterpret_cast<CORBA::LongLong>(_impl);
}
virtual void AddCreatedPostponed(const char* theIOR);
-#ifndef WNT
+#ifndef WIN32
virtual void RemovePostponed(const CORBA::Long theUndoLimit); // removes postponed IORs of old transaction
// if theUndoLimit==0, removes all
virtual void UndoPostponed(const CORBA::Long theWay); // theWay = 1: resurrect objects,
dist_TestSALOMEDS_SOURCES = TestSALOMEDS.cxx
TestSALOMEDS_CPPFLAGS = $(COMMON_CPPFLAGS)
TestSALOMEDS_LDADD = libSALOMEDSTest.la \
+ $(RPATH)/Basics/libSALOMEBasics.la \
$(CORBA_LIBS)
#include "utilities.h"
#include "Utils_SINGLETON.hxx"
#include "Utils_ORB_INIT.hxx"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
#include "SALOME_NamingService.hxx"
#include "NamingService_WaitForServerReadiness.hxx"
#include "SALOMEDS_StudyManager_i.hxx"
+using namespace std;
+
// ============================================================================
/*!
* Main program source for Unit Tests with cppunit package does not depend
sleep(15);
- string host; // = GetHostname();
+ string host; // = Kernel_Utils::GetHostname();
char* wait_Superv = getenv("SALOMEDS_UNITTESTS_WAIT_SUPERVISOR");
- if(wait_Superv) host = GetHostname();
+ if(wait_Superv) host = Kernel_Utils::GetHostname();
SALOME_NamingService NS(orb);
if(host.empty())
#include "SALOMEDSImpl_AttributeDrawable.hxx"
-#ifndef WNT
using namespace std;
-#endif
//=======================================================================
//function : GetID
#include "SALOMEDSImpl_AttributeExpandable.hxx"
-#ifndef WNT
using namespace std;
-#endif
//=======================================================================
//function : GetID
#include "SALOMEDSImpl_AttributeIOR.hxx"
#include "SALOMEDSImpl_Study.hxx"
-#ifndef WNT
using namespace std;
-#endif
//=======================================================================
//function : GetID
#include "SALOMEDSImpl_AttributeString.hxx"
-#ifndef WNT
using namespace std;
-#endif
//=======================================================================
//function : GetID
}
catch (HDFexception)
{
-//#ifndef WNT
-// char eStr[strlen(aUrl.ToCString())+17];
-//#else
- char *eStr;
- eStr = new char[strlen(aUrl.c_str())+17];
-//#endif
- sprintf(eStr,"Can't open file %s",aUrl.c_str());
-//#ifdef WNT
- delete [] eStr;
-//#endif
- _errorCode = string(eStr);
- return NULL;
+ char *eStr;
+ eStr = new char[strlen(aUrl.c_str())+17];
+ sprintf(eStr,"Can't open file %s",aUrl.c_str());
+ delete [] eStr;
+ _errorCode = string(eStr);
+ return NULL;
}
// Temporary aStudyUrl in place of study name
}
catch (HDFexception)
{
-//#ifndef WNT
-// char eStr[strlen(aUrl.ToCString())+17];
-//#else
- char *eStr = new char [strlen(aUrl.c_str())+17];
-//#endif
+ char *eStr = new char [strlen(aUrl.c_str())+17];
sprintf(eStr,"Can't open file %s", aUrl.c_str());
_errorCode = string(eStr);
return NULL;
#include "SALOMEDSImpl_Tool.hxx"
-#ifndef WNT
+#ifndef WIN32
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/types.h>
bool Exists(const string thePath)
{
-#ifdef WNT
+#ifdef WIN32
if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) {
if ( GetLastError () != ERROR_FILE_NOT_FOUND ) {
return false;
#endif
-#ifdef WNT
+#ifdef WIN32
CreateDirectory(aDir.c_str(), NULL);
#else
mkdir(aDir.c_str(), 0x1ff);
aFile += theFiles[i-1];
if(!Exists(aFile)) continue;
-#ifdef WNT
+#ifdef WIN32
DeleteFile(aFile.c_str());
#else
unlink(aFile.c_str());
if(IsDirDeleted) {
if(Exists(aDirName)) {
-#ifdef WNT
+#ifdef WIN32
RemoveDirectory(aDirName.c_str());
#else
rmdir(aDirName.c_str());
path = thePath+"/";
}
-#ifdef WNT //Check if the only disk letter is given as path
+#ifdef WIN32 //Check if the only disk letter is given as path
if(path.size() == 2 && path[1] == ':') path +='\\';
#endif
void SALOMEDSImpl_Tool::GetSystemDate(int& year, int& month, int& day, int& hours, int& minutes, int& seconds)
{
-#ifdef WNT
+#ifdef WIN32
SYSTEMTIME st;
GetLocalTime ( &st );
}
//Warning undef of Ascii Winwows define
-#ifdef WNT
+#ifdef WIN32
# undef GetUserName
#endif
string SALOMEDSImpl_Tool::GetUserName()
{
-#ifdef WNT
+#ifdef WIN32
char* pBuff = new char[UNLEN + 1];
DWORD dwSize = UNLEN + 1;
string retVal;
public:
// Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set
- // otherwise return /tmp/something/ for Unix or c:\something\ for WNT
+ // otherwise return /tmp/something/ for Unix or c:\something\ for WIN32
static std::string GetTmpDir();
// Class attributes initialisation, for class method BaseTraceCollector::run
BaseTraceCollector* BaseTraceCollector::_singleton = 0;
-#ifndef WNT
+#ifndef WIN32
pthread_mutex_t BaseTraceCollector::_singletonMutex;
#else
pthread_mutex_t BaseTraceCollector::_singletonMutex =
myTraceBuffer->retrieve(myTrace);
if (myTrace.traceType == ABORT_MESS)
{
-#ifndef WNT
+#ifndef WIN32
traceFile << "INTERRUPTION from thread " << myTrace.threadId
<< " : " << myTrace.trace;
#else
#endif
traceFile.close();
cout << flush ;
-#ifndef WNT
+#ifndef WIN32
MESSAGE ( "INTERRUPTION from thread " << myTrace.threadId
- << " : " << myTrace.trace );
+ << " : " << myTrace.trace );
#else
MESSAGE ( "INTERRUPTION from thread " << (void*)(&myTrace.threadId)
<< " : " << myTrace.trace );
}
else
{
-#ifndef WNT
+#ifndef WIN32
traceFile << "th. " << myTrace.threadId
<< " " << myTrace.trace;
#else
#include <limits.h>
#include <cassert>
-#ifndef WNT
+#ifndef WIN32
#include <dlfcn.h>
#else
#include <windows.h>
// Class static attributes initialisation
LocalTraceBufferPool* LocalTraceBufferPool::_singleton = 0;
-//#ifndef WNT
+//#ifndef WIN32
//pthread_mutex_t LocalTraceBufferPool::_singletonMutex;
//#else
pthread_mutex_t LocalTraceBufferPool::_singletonMutex =
}
else // --- try a dynamic library
{
-#ifndef WNT
+#ifndef WIN32
void* handle;
string impl_name = string ("lib") + traceKind
+ string("TraceCollector.so");
if ( handle )
{
typedef BaseTraceCollector * (*FACTORY_FUNCTION) (void);
-#ifndef WNT
+#ifndef WIN32
FACTORY_FUNCTION TraceCollectorFactory =
(FACTORY_FUNCTION) dlsym(handle, "SingletonInstance");
#else
if ( !TraceCollectorFactory )
{
MESSAGE ( "Can't resolve symbol: SingletonInstance" );
-#ifndef WNT
+#ifndef WIN32
MESSAGE ( "dlerror: " << dlerror() );
#endif
exit( 1 );
while (ret)
{
ret = sem_wait(&_fullBufferSemaphore);
- if (ret) MESSAGE(" LocalTraceBufferPool::retrieve, sem_wait");
+ if (ret) MESSAGE (" LocalTraceBufferPool::retrieve, sem_wait");
}
// get the next buffer to print
if (myTrace.traceType == ABORT_MESS)
{
cout << flush ;
-#ifndef WNT
+#ifndef WIN32
cerr << "INTERRUPTION from thread " << myTrace.threadId
<< " : " << myTrace.trace;
#else
else
{
cout << flush ;
-#ifndef WNT
+#ifndef WIN32
cerr << "th. " << myTrace.threadId << " " << myTrace.trace;
#else
cerr << "th. " << (void*)(&myTrace.threadId) << " " << myTrace.trace;
#ifndef _SALOME_LOCALTRACE_HXX_
#define _SALOME_LOCALTRACE_HXX_
-#ifdef WNT
- #if defined SALOMELOCALTRACE_EXPORTS
- #if defined WIN32
- #define SALOMELOCALTRACE_EXPORT __declspec( dllexport )
- #else
- #define SALOMELOCALTRACE_EXPORT
- #endif
- #else
- #if defined WIN32
- #define SALOMELOCALTRACE_EXPORT __declspec( dllimport )
- #else
- #define SALOMELOCALTRACE_EXPORT
- #endif
- #endif
+#ifdef WIN32
+# ifdef SALOMELOCALTRACE_EXPORTS
+# define SALOMELOCALTRACE_EXPORT __declspec( dllexport )
+# else
+# define SALOMELOCALTRACE_EXPORT __declspec( dllimport )
+# endif
#else
- #define SALOMELOCALTRACE_EXPORT
+# define SALOMELOCALTRACE_EXPORT
#endif
#endif
if (myTrace.traceType == ABORT_MESS)
{
stringstream abortMessage("");
-#ifndef WNT
+#ifndef WIN32
abortMessage << "INTERRUPTION from thread "
<< myTrace.threadId << " : " << myTrace.trace;
#else
else
{
stringstream aMessage("");
-#ifndef WNT
+#ifndef WIN32
aMessage << "th. " << myTrace.threadId
#else
aMessage << "th. " << (void*)&myTrace.threadId
//! See LocalTraceCollector instead of SALOMETraceCollector,
//! for usage without CORBA
-#if defined WNT
-# if defined SALOMETRACECOLLECTOR_EXPORTS
+#ifdef WIN32
+# ifdef SALOMETRACECOLLECTOR_EXPORTS
# define SALOMETRACECOLLECTOR_EXPORT __declspec( dllexport )
# else
# define SALOMETRACECOLLECTOR_EXPORT
#include <iostream>
#include <ctime>
-#ifdef WNT
+#ifdef WIN32
#include <omnithread/pthread_nt.h>
#endif
cout << "Caught exception: Naming Service can't found Logger";
}
}
-#ifndef WNT
+#ifndef WIN32
nanosleep(&ts_req,&ts_rem);
#else
Sleep(TIMESleep / 1000000);
#include "SALOMEDS_Tool.hxx"
#include "utilities.h"
-#include "OpUtil.hxx"
+#include "Basics_DirUtils.hxx"
-#ifndef WNT
+#ifndef WIN32
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/types.h>
bool Exists(const string thePath)
{
-#ifdef WNT
+#ifdef WIN32
if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) {
if ( GetLastError () == ERROR_FILE_NOT_FOUND ) {
return false;
//============================================================================
std::string SALOMEDS_Tool::GetTmpDir()
{
- return OpUtil_Dir::GetTmpDirByEnv("SALOME_TMP_DIR");
+ return Kernel_Utils::GetTmpDirByEnv("SALOME_TMP_DIR");
//Find a temporary directory to store a file
/*string aTmpDir = "";
#endif
-#ifdef WNT
+#ifdef WIN32
CreateDirectory(aDir.c_str(), NULL);
#else
mkdir(aDir.c_str(), 0x1ff);
aFile += theFiles[i-1];
if(!Exists(aFile)) continue;
-#ifdef WNT
+#ifdef WIN32
DeleteFile(aFile.c_str());
#else
unlink(aFile.c_str());
if(IsDirDeleted) {
if(Exists(aDirName)) {
-#ifdef WNT
+#ifdef WIN32
RemoveDirectory(aDirName.c_str());
#else
rmdir(aDirName.c_str());
if (!theNamesOnly) { // mpv 15.01.2003: if only file names must be stroed, then size of files is zero
string aFullPath = aTmpDir + const_cast<char*>(theFiles[i].in());
if(!Exists(aFullPath)) continue;
-#ifdef WNT
+#ifdef WIN32
ifstream aFile(aFullPath.c_str(), ios::binary);
#else
ifstream aFile(aFullPath.c_str());
if (!theNamesOnly) { // mpv 15.01.2003: we don't open any file if theNamesOnly = true
string aFullPath = aTmpDir + const_cast<char*>(theFiles[i].in());
if(!Exists(aFullPath)) continue;
-#ifdef WNT
+#ifdef WIN32
aFile = new ifstream(aFullPath.c_str(), ios::binary);
#else
aFile = new ifstream(aFullPath.c_str());
aCurrentPos += 8;
string aFullPath = aTmpDir + aFileName;
-#ifdef WNT
+#ifdef WIN32
ofstream aFile(aFullPath.c_str(), ios::binary);
#else
ofstream aFile(aFullPath.c_str());
path = thePath+"/";
}
-#ifdef WNT //Check if the only disk letter is given as path
+#ifdef WIN32 //Check if the only disk letter is given as path
if(path.size() == 2 && path[1] == ':') path +='\\';
#endif
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SALOMEDS)
-#ifdef WNT
- #if defined TOOLSDS_EXPORTS
- #if defined WIN32
- #define TOOLSDS_EXPORT __declspec( dllexport )
- #else
- #define TOOLSDS_EXPORT
- #endif
- #else
- #if defined WIN32
- #define TOOLSDS_EXPORT __declspec( dllimport )
- #else
- #define TOOLSDS_EXPORT
- #endif
- #endif
+#ifdef WIN32
+# ifdef TOOLSDS_EXPORTS
+# define TOOLSDS_EXPORT __declspec( dllexport )
+# else
+# define TOOLSDS_EXPORT __declspec( dllimport )
+# endif
#else
- #define TOOLSDS_EXPORT
+# define TOOLSDS_EXPORT
#endif
class TOOLSDS_EXPORT SALOMEDS_Tool
public:
// Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set
- // otherwise return /tmp/something/ for Unix or c:\something\ for WNT
+ // otherwise return /tmp/something/ for Unix or c:\something\ for WIN32
static std::string GetTmpDir();
TestContainer_SOURCES = TestContainer.cxx
TestContainer_CPPFLAGS = $(COMMON_CPPFLAGS)
TestContainer_LDADD = libSalomeTestComponentEngine.la \
+ ../Basics/libSALOMEBasics.la \
$(CORBA_LIBS)
TestLogger_SOURCES = TestLogger.cxx
TestLogger_CPPFLAGS = $(COMMON_CPPFLAGS)
TestLogger_LDADD = libSalomeTestComponentEngine.la \
+ ../Basics/libSALOMEBasics.la \
$(CORBA_LIBS)
// Module : SALOME
// $Header$
-#ifndef WNT
+#ifndef WIN32
# define private protected
#endif
#include "utilities.h"
#include "SALOME_NamingService.hxx"
#include "NamingService_WaitForServerReadiness.hxx"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
#include "Utils_SALOME_Exception.hxx"
{
SALOME_NamingService _NS(orb) ;
string containerName = "/Containers/" ;
- string hostName = GetHostname();
+ string hostName = Kernel_Utils::GetHostname();
containerName += hostName + "/FactoryServer";
NamingService_WaitForServerReadiness(&_NS,containerName);
# include "Utils_ORB_INIT.hxx"
# include "Utils_SINGLETON.hxx"
#include "SALOME_NamingService.hxx"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
using namespace std;
int main (int argc, char * argv[])
// Use Name Service to find container
SALOME_NamingService NS(orb) ;
string containerName = "/Containers/" ;
- string hostName = GetHostname();
+ string hostName = Kernel_Utils::GetHostname();
containerName += hostName + "/MPIFactoryServer_" + argv[2];
string dirn(getenv("KERNEL_ROOT_DIR"));
# Libraries targets
lib_LTLIBRARIES = libOpUtil.la
libOpUtil_la_SOURCES =\
- OpUtil.cxx Utils_Timer.cxx duplicate.cxx \
+ Utils_Timer.cxx \
+ duplicate.cxx \
Utils_CommException.cxx \
Utils_SALOME_Exception.cxx \
Utils_Identity.cxx Utils_ORB_INIT.cxx \
+++ /dev/null
-// SALOME Utils : general SALOME's definitions and tools
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-//
-//
-// File : OpUtil.cxx
-// Module : SALOME
-
-#include "utilities.h"
-#include "OpUtil.hxx"
-#include <errno.h>
-#include <string.h>
-
-#ifndef WNT
-#include <unistd.h>
-#include <sys/stat.h>
-#else
-#include <winsock2.h>
-#endif
-using namespace std;
-
-#ifdef WIN32
-# define separator '\\'
-#else
-# define separator '/'
-#endif
-
-//int gethostname(char *name, size_t len);
-
-std::string GetHostname()
-{
- int ls = 100, r = 1;
- char *s;
-
- while (ls < 10000 && r) {
- ls *= 2;
- s = new char[ls];
- r = gethostname(s, ls-1);
- switch (r)
- {
- case 0:
- break;
- default:
-#ifdef EINVAL
- case EINVAL:
-#endif
-#ifdef ENAMETOOLONG
- case ENAMETOOLONG:
-#endif
- delete [] s;
- continue;
- }
- }
-
- if (r != 0) {
- s = new char[50];
- strcpy(s, "localhost");
- }
-
- // remove all after '.'
- char *aDot = (strchr(s,'.'));
- if (aDot) aDot[0] = '\0';
-
- string p = s;
- delete [] s;
- return p;
-}
-
-
-std::string OpUtil_Dir::GetTmpDirByEnv( const std::string& tmp_path_env )
-{
- string dir;
- char* val = getenv( tmp_path_env.c_str() );
- val ? dir = string( val ) : "";
- return GetTmpDirByPath( dir );
-}
-
-std::string OpUtil_Dir::GetTmpDirByPath( const std::string& tmp_path )
-{
- string aTmpDir = tmp_path;
- if ( aTmpDir == "" )
- {
-#ifdef WNT
- char *Tmp_dir = getenv("TEMP");
- if( Tmp_dir == NULL )
- {
- Tmp_dir = getenv("TMP");
- if (Tmp_dir == NULL)
- aTmpDir = string("C:\\");
- else
- aTmpDir = string(Tmp_dir);
- }
- else
- aTmpDir = string(Tmp_dir);
-#else
- aTmpDir = string("/tmp/");
-#endif
- }
-
- if(aTmpDir[aTmpDir.size()-1] != separator)
- aTmpDir+=separator;
-
- srand((unsigned int)time(NULL));
- int aRND = 999 + (int)(100000.0*rand()/(RAND_MAX+1.0)); //Get a random number to present a name of a sub directory
- char buffer[127];
- sprintf(buffer, "%d", aRND);
- string aSubDir(buffer);
- if(aSubDir.size() <= 1) aSubDir = string("123409876");
-
- aTmpDir += aSubDir; //Get RND sub directory
-
- string aDir = aTmpDir;
-
- if(IsExists(aDir)) {
- for(aRND = 0; IsExists(aDir); aRND++) {
- sprintf(buffer, "%d", aRND);
- aDir = aTmpDir+buffer; //Build a unique directory name
- }
- }
-
- if(aDir[aDir.size()-1] != separator) aDir+=separator;
-
-#ifdef WNT
- CreateDirectory(aDir.c_str(), NULL);
-#else
- mkdir(aDir.c_str(), 0x1ff);
-#endif
-
- return aDir;
-}
-
-//============================================================================
-// function : GetTempDir
-// purpose : Return a temp directory to store created files like "/tmp/sub_dir/"
-//============================================================================
-std::string OpUtil_Dir::GetTmpDir()
-{
- return GetTmpDirByPath( "" );
-}
-
-string OpUtil_Dir::GetTmpFileName()
-{
- string tmpDir = GetTmpDir();
- string aFilePath = "";
- if(IsExists(tmpDir)) {
- srand((unsigned int)time(NULL));
- int aRND = 999 + (int)(100000.0*rand()/(RAND_MAX+1.0)); //Get a random number to present a name of a sub directory
- char buffer[127];
- sprintf(buffer, "%d", aRND);
- string aSubDir(buffer);
- if(aSubDir.size() <= 1) aSubDir = string("123409876");
-
- string aFilePath = tmpDir;
- for(aRND = 0; IsExists(aFilePath); aRND++) {
- sprintf(buffer, "%d", aRND);
- aFilePath = tmpDir+buffer; //Build a unique file name
- }
- }
- return aFilePath;
-}
-
-
-bool OpUtil_Dir::IsExists(const string& thePath)
-{
-#ifdef WNT
- if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) {
- if ( GetLastError () == ERROR_FILE_NOT_FOUND ) {
- return false;
- }
- }
-#else
- int status = access ( thePath.c_str() , F_OK );
- if (status != 0) return false;
-#endif
- return true;
-}
\ No newline at end of file
#include "SALOME_Utils.hxx"
-#include <string>
-
-UTILS_EXPORT std::string GetHostname();
UTILS_EXPORT const char *duplicate(const char * const);
-class UTILS_EXPORT OpUtil_Dir
-{
-public:
- // Returns the unique temporary directory, that is defined in tmp_path_env if this variable is set
- // otherwise return /tmp/something/ for Unix or c:\something\ for WNT
- static std::string GetTmpDirByEnv( const std::string& tmp_path_env );
-
- // Returns the unique temporary directory, that is defined in tmp_path if this variable is set
- // otherwise return /tmp/something/ for Unix or c:\something\ for WNT
- static std::string GetTmpDirByPath( const std::string& tmp_path );
-
- // Returns the unique temporary directory in
- // /tmp/something/ for Unix or c:\something\ for WNT
- static std::string GetTmpDir();
-
- // Returns the unique temporary file name without any extension
- // /tmp/something/file for Unix or c:\something\file for WNT
- static std::string GetTmpFileName();
-
- // Returns True(False) if the path (not)exists
- static bool IsExists( const std::string& path );
-
-};
-
#endif
#ifndef _SALOME_UTILS_HXX_
#define _SALOME_UTILS_HXX_
-#ifdef WNT
+#ifdef WIN32
# if defined UTILS_EXPORTS
# define UTILS_EXPORT __declspec( dllexport )
# else
{
# include <string.h>
-#ifndef WNT /* unix functionality */
+#ifndef WIN32 /* unix functionality */
# include <pwd.h>
#endif
}
-#ifndef WNT /* unix functionality */
+#ifndef WIN32 /* unix functionality */
# include <arpa/inet.h>
# include <netinet/in.h>
#define getcwd _getcwd
#define getpid _getpid
-#endif /* WNT */
+#endif /* WIN32 */
Identity::Identity( const char *name ): _name(duplicate(name)),\
{
return _name ;
}
-#ifndef WNT
+#ifndef WIN32
const pid_t& Identity::pid(void) const
#else
const DWORD& Identity::pid(void) const
return _pid ;
}
-#ifndef WNT
+#ifndef WIN32
const struct utsname &Identity::hostid(void) const
#else
const char* const Identity::hostid(void) const
return _hostid ;
}
-#ifndef WNT
+#ifndef WIN32
const uid_t& Identity::uid(void) const
#else
const PSID& Identity::uid(void) const
const char* Identity::host_char( void ) const
{
-#ifndef WNT
+#ifndef WIN32
return _hostid.nodename;
#else
return _hostid;
os << '\t' << "Numero de PID : " << monid._pid << std::endl;
os << '\t' << "Uid utilisateur : " << monid._uid << std::endl;
os << '\t' << "nom utilisateur : " << monid._pwname << std::endl;
-#ifndef WNT
+#ifndef WIN32
os << '\t' << "Nom de machine : " << monid._hostid.nodename << std::endl;
#else
os << '\t' << "Nom de machine : " << monid._hostid << std::endl;
{
# include <stdlib.h>
# include <time.h>
-#ifndef WNT
+#ifndef WIN32
# include <unistd.h>
# include <sys/utsname.h>
#else
const char* const _name ;
const char* const _adip; // Internet address
-#ifndef WNT
+#ifndef WIN32
const struct utsname _hostid;
const pid_t _pid ;
const uid_t _uid ;
~Identity();
friend std::ostream & operator<< ( std::ostream& os , const Identity& monid );
-#ifndef WNT
+#ifndef WIN32
const pid_t& pid(void) const;
const struct utsname& hostid(void) const;
const uid_t& uid(void) const;
{
pthread_mutex_lock( &myHelperMutex );
-#ifndef WNT
+#ifndef WIN32
if ( myCount > 0 && myThread == pthread_self() ) {
#else
if ( myCount > 0 && myThread.p == pthread_self().p ) {
{
pthread_mutex_lock( &myHelperMutex );
-#ifndef WNT
+#ifndef WIN32
if ( myThread == pthread_self() ) {
#else
if ( myThread.p == pthread_self().p ) {
#include "Utils_SALOME_Exception.hxx"
#include "utilities.h"
-#ifndef WNT
+#ifndef WIN32
extern "C"
{
#endif
#include <math.h>
#include <stdio.h>
#include <string.h>
-#ifndef WNT
+#ifndef WIN32
}
#endif
#ifdef LOCALIZED
#undef LOCALIZED
#endif
-#ifdef _DEBUG_
+#if defined(_DEBUG_) || defined(_DEBUG)
# define LOCALIZED(message) #message , __FILE__ , __LINE__
#else
# define LOCALIZED(message) #message
//swig tool on Linux doesn't pass defines from header SALOME_Utils.hxx
//therefore (temporary solution) defines are placed below
-#ifdef WNT
-# if defined UTILS_EXPORTS
+#ifdef WIN32
+# ifdef UTILS_EXPORTS
# define UTILS_EXPORT __declspec( dllexport )
# else
# define UTILS_EXPORT __declspec( dllimport )
#include "utilities.h"
-#ifndef WNT
+#ifndef WIN32
static struct timezone *tz=(struct timezone*) malloc(sizeof(struct timezone));
#else
//timezone *tz=_timezone;
#endif
Utils_Timer::Utils_Timer() {
-#ifndef WNT
+#ifndef WIN32
RefToInitialTMS = new tms;
RefToCurrentTMS = new tms;
void Utils_Timer::Start() {
if (Stopped) {
Stopped = 0;
-#ifndef WNT
+#ifndef WIN32
times(RefToInitialTMS);
gettimeofday(RefToInitialTimeB,tz);
#else
void Utils_Timer::Stop() {
if (!Stopped) {
-#ifndef WNT
+#ifndef WIN32
times(RefToCurrentTMS);
int diffr_user = RefToCurrentTMS->tms_utime - RefToInitialTMS->tms_utime;
int diffr_sys = RefToCurrentTMS->tms_stime - RefToInitialTMS->tms_stime;
void Utils_Timer::ShowAbsolute(){
#if defined(_DEBUG_) || defined(_DEBUG)
-#ifndef WNT
+#ifndef WIN32
unsigned long Absolute_user = (unsigned long) ((timeval*)RefToCurrentTimeB)->tv_sec ;
#else
unsigned long Absolute_user = *RefToCurrentTimeB;
#include <stdlib.h>
#include <time.h>
-#ifndef WNT
+#ifndef WIN32
# include <sys/times.h>
# include <sys/time.h>
# include <unistd.h>
double Cumul_user;
double Cumul_sys;
bool Stopped;
-#ifndef WNT
+#ifndef WIN32
tms *RefToCurrentTMS, *RefToInitialTMS;
timeval *RefToCurrentTimeB, *RefToInitialTimeB;
#else