#include <iostream>
#include <sstream>
#include <string>
-#ifdef WNT
+#ifdef WIN32
# include<winsock2.h>
#else
# include <netdb.h>
#include <iostream>
#include <fstream>
#include <sstream>
+#include <string>
#include "Batch_BatchManager_LSF.hxx"
+using namespace std;
+
namespace Batch {
BatchManager_LSF::BatchManager_LSF(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(parent, host)
#include "Batch_IOMutex.hxx"
#include "Batch_BatchManager_Local.hxx"
+using namespace std;
+
namespace Batch {
#include <vector>
#include <map>
#include <queue>
-#include <deque>
#include <pthread.h>
#include "Batch_Job.hxx"
#include "Batch_JobId.hxx"
struct Child {
pthread_t thread_id;
- queue<Commande, deque<Commande> > command_queue;
+ std::queue<Commande, std::deque<Commande> > command_queue;
pid_t pid;
int exit_code;
Status status;
protected:
int _connect; // Local connect id
pthread_mutex_t _threads_mutex;
- map<Id, Child > _threads;
+ std::map<Id, Child > _threads;
// Methode abstraite qui renvoie la commande de copie du fichier source en destination
- virtual string copy_command(const string & host_source, const string & source, const string & host_destination, const string & destination) const = 0;
+ virtual std::string copy_command( const std::string & host_source,
+ const std::string & source,
+ const std::string & host_destination,
+ const std::string & destination) const = 0;
// Methode abstraite qui renvoie la commande a executer
- virtual string exec_command(Parametre & param) const = 0;
+ virtual std::string exec_command(Parametre & param) const = 0;
// Methode abstraite qui renvoie la commande d'effacement du fichier
- virtual string remove_command(const string & host_destination, const string & destination) const = 0;
+ virtual std::string remove_command( const std::string & host_destination,
+ const std::string & destination) const = 0;
private:
virtual pthread_t submit(const Job_Local & job);
pthread_cond_t _thread_id_id_association_cond;
#ifndef WIN32 //TODO: porting of following functionality
//reason: pthread_t on win32 is a struct of pointer and int members
- map<pthread_t, Id> _thread_id_id_association;
+ std::map<pthread_t, Id> _thread_id_id_association;
#endif
#ifdef SWIG
#error "RSH undefined. You must set RSH to a valid path to a rsh-like command."
#endif
+using namespace std;
+
namespace Batch {
protected:
// Methode abstraite qui renvoie la commande de copie du fichier source en destination
- virtual string copy_command(const string & host_source, const string & source, const string & host_destination, const string & destination) const;
+ virtual std::string copy_command( const std::string & host_source,
+ const std::string & source,
+ const std::string & host_destination,
+ const std::string & destination) const;
// Methode abstraite qui renvoie la commande a executer
- virtual string exec_command(Parametre & param) const;
+ virtual std::string exec_command(Parametre & param) const;
// Methode qui renvoie la commande d'effacement du fichier
- virtual string remove_command(const string & host_destination, const string & destination) const;
+ virtual std::string remove_command( const std::string & host_destination,
+ const std::string & destination) const;
};
#error "SH undefined. You must set SH to a valid path to a sh-like command."
#endif
+using namespace std;
+
namespace Batch {
protected:
// Methode qui renvoie la commande de copie du fichier source en destination
- virtual string copy_command(const string & host_source, const string & source, const string & host_destination, const string & destination) const;
+ virtual std::string copy_command( const std::string & host_source,
+ const std::string & source,
+ const std::string & host_destination,
+ const std::string & destination) const;
// Methode qui renvoie la commande a executer
- virtual string exec_command(Parametre & param) const;
+ virtual std::string exec_command(Parametre & param) const;
// Methode qui renvoie la commande d'effacement du fichier
- virtual string remove_command(const string & host_destination, const string & destination) const;
+ virtual std::string remove_command( const std::string & host_destination,
+ const std::string & destination) const;
};
#error "SSH undefined. You must set SSH to a valid path to a ssh-like command."
#endif
+using namespace std;
+
namespace Batch {
protected:
// Methode abstraite qui renvoie la commande de copie du fichier source en destination
- virtual string copy_command(const string & host_source, const string & source, const string & host_destination, const string & destination) const;
+ virtual std::string copy_command( const std::string & host_source,
+ const std::string & source,
+ const std::string & host_destination,
+ const std::string & destination) const;
// Methode abstraite qui renvoie la commande a executer
- virtual string exec_command(Parametre & param) const;
+ virtual std::string exec_command(Parametre & param) const;
// Methode qui renvoie la commande d'effacement du fichier
- virtual string remove_command(const string & host_destination, const string & destination) const;
+ virtual std::string remove_command( const std::string & host_destination,
+ const std::string & destination) const;
};
*
*/
+#include "Batch_BatchManager_eClient.hxx"
+#include "Basics_DirUtils.hxx"
+
#include <iostream>
#include <fstream>
#include <sstream>
#include <sys/stat.h>
-#include "Batch_BatchManager_eClient.hxx"
-#include "OpUtil.hxx"
+
+using namespace std;
+
namespace Batch {
string BatchManager_eClient::BuildTemporaryFileName() const
{
//build more complex file name to support multiple salome session
- string aFileName = OpUtil_Dir::GetTmpFileName();
+ string aFileName = Kernel_Utils::GetTmpFileName();
#ifndef WIN32
aFileName += ".sh";
#else
#include "MpiImpl.hxx"
#include "Batch_BatchManager.hxx"
+#include <string>
+
namespace Batch {
class Job;
std::string BuildTemporaryFileName() const;
void RmTmpFile(std::string & TemporaryFileName);
- MpiImpl* FactoryMpiImpl(string mpiImpl) throw(EmulationException);
+ MpiImpl* FactoryMpiImpl(std::string mpiImpl) throw(EmulationException);
void exportInputFiles(const Job & job) throw(EmulationException);
private:
# include <io.h>
#endif
+using namespace std;
+
namespace Batch {
BatchManager_eLSF::BatchManager_eLSF(const FactBatchManager * parent, const char * host, const char * protocol, const char * mpiImpl) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager_eClient(parent,host,protocol,mpiImpl)
# include <io.h>
#endif
+using namespace std;
+
namespace Batch {
BatchManager_ePBS::BatchManager_ePBS(const FactBatchManager * parent, const char * host, const char * protocol, const char * mpiImpl) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager_eClient(parent,host,protocol,mpiImpl)
#ifndef _FACTBATCHMANAGER_LSF_H_
#define _FACTBATCHMANAGER_LSF_H_
-using namespace std;
-#include <string>
-#include <map>
#include "Batch_FactBatchManager.hxx"
namespace Batch {
#ifndef _FACTBATCHMANAGER_LOCAL_H_
#define _FACTBATCHMANAGER_LOCAL_H_
-using namespace std;
-#include <string>
-#include <map>
#include "Batch_FactBatchManager.hxx"
namespace Batch {
#ifndef _FACTBATCHMANAGER_LOCAL_RSH_H_
#define _FACTBATCHMANAGER_LOCAL_RSH_H_
-using namespace std;
-#include <string>
-#include <map>
#include "Batch_FactBatchManager.hxx"
namespace Batch {
#ifndef _FACTBATCHMANAGER_LOCAL_SH_H_
#define _FACTBATCHMANAGER_LOCAL_SH_H_
-using namespace std;
-#include <string>
-#include <map>
#include "Batch_FactBatchManager.hxx"
namespace Batch {
#ifndef _FACTBATCHMANAGER_LOCAL_SSH_H_
#define _FACTBATCHMANAGER_LOCAL_SSH_H_
-using namespace std;
-#include <string>
-#include <map>
#include "Batch_FactBatchManager.hxx"
namespace Batch {
//#include "MEDMEM_STRING.hxx"
#include "Batch_JobInfo.hxx"
+using namespace std;
+
namespace Batch {
// Destructeur
JobInfo(const JobInfo & jinfo) : _param(jinfo._param), _env(jinfo._env) {};
// Operateur pour l'affichage sur un stream
- friend ostream & operator <<(ostream & os, const JobInfo & ji);
+ friend std::ostream & operator <<(std::ostream & os, const JobInfo & ji);
// Accesseurs
// _CS_gbo Ajout explicite du namespace pour les besoins de swig (mauvaise gestion
// Methodes pour l'interfacage avec Python (SWIG)
// TODO : supprimer ces methodes et transferer leur definitions dans SWIG
- string __str__() const; // SWIG : affichage en Python
- string __repr__() const { return __str__(); }; // SWIG : affichage en Python
+ std::string __str__() const; // SWIG : affichage en Python
+ std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python
protected:
Parametre _param; // parametres du job
#include <cstdio>
#include <sstream>
+#include <string>
#include "Batch_Parametre.hxx"
#include "Batch_Environnement.hxx"
#include "Batch_RunTimeException.hxx"
#include "Batch_APIInternalFailureException.hxx"
#include "Batch_JobInfo_LSF.hxx"
+using namespace std;
+
namespace Batch {
// Methodes pour l'interfacage avec Python (SWIG)
// TODO : supprimer ces methodes et transferer leur definitions dans SWIG
- string __str__() const; // SWIG : affichage en Python
- string __repr__() const { return __str__(); }; // SWIG : affichage en Python
+ std::string __str__() const; // SWIG : affichage en Python
+ std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python
protected:
bool _running; // etat du job en machine
private:
// Convertit une date HH:MM:SS en secondes
- long HMStoLong(const string &);
+ long HMStoLong(const std::string &);
};
#include "Batch_APIInternalFailureException.hxx"
#include "Batch_JobInfo_eLSF.hxx"
+using namespace std;
+
namespace Batch {
#ifndef _JOBINFO_LSF_H_
#define _JOBINFO_LSF_H_
-#include <string>
#include "Batch_RunTimeException.hxx"
#include "Batch_JobInfo.hxx"
+#include <string>
+
namespace Batch {
class JobInfo_eLSF : public JobInfo
// Methodes pour l'interfacage avec Python (SWIG)
// TODO : supprimer ces methodes et transferer leur definitions dans SWIG
- string __str__() const; // SWIG : affichage en Python
- string __repr__() const { return __str__(); }; // SWIG : affichage en Python
+ std::string __str__() const; // SWIG : affichage en Python
+ std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python
protected:
bool _running; // etat du job en machine
private:
// Convertit une date HH:MM:SS en secondes
- long HMStoLong(const string &);
+ long HMStoLong(const std::string &);
};
#include "Batch_APIInternalFailureException.hxx"
#include "Batch_JobInfo_ePBS.hxx"
+using namespace std;
+
namespace Batch {
// Methodes pour l'interfacage avec Python (SWIG)
// TODO : supprimer ces methodes et transferer leur definitions dans SWIG
- string __str__() const; // SWIG : affichage en Python
- string __repr__() const { return __str__(); }; // SWIG : affichage en Python
+ std::string __str__() const; // SWIG : affichage en Python
+ std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python
protected:
bool _running; // etat du job en machine
private:
// Convertit une date HH:MM:SS en secondes
- long HMStoLong(const string &);
+ long HMStoLong(const std::string &);
};
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <string.h>
+#include <string>
#include <vector>
#include "Batch_Job_LSF.hxx"
+using namespace std;
+
namespace Batch {
#include <lsf/lsf.h>
#include <lsf/lsbatch.h>
}
+#include <string>
#include "Batch_Job.hxx"
namespace Batch {
private:
struct submit * ParametreToSubmitStruct(const Parametre & P);
- char * string2char(const string &);
+ char * string2char(const std::string &);
};
}
#endif
#include "Batch_Job_Local.hxx"
+using namespace std;
+
namespace Batch {
// Constructeur
#define _NOTYETIMPLEMENTEDEXCEPTION_H_
#include "Batch_Defines.hxx"
-
-
#include "Batch_GenericException.hxx"
-using namespace std;
+
+#include <string>
namespace Batch {
{
public:
// Constructeur
- NotYetImplementedException(string ch = "undefined") : GenericException("NotYetImplementedException", ch) {}
+ NotYetImplementedException(std::string ch = "undefined") : GenericException("NotYetImplementedException", ch) {}
};
}
*
*/
-#include <map>
#include "Batch_Versatile.hxx"
#include "Batch_InvalidKeyException.hxx"
#include "Batch_Parametre.hxx"
+using namespace std;
+
// Definition des membres constants statiques
// Definition des noms globaux pour les clefs en tant que references
// TODO : supprimer les declarations statiques des clefs de la map
#include "Batch_InvalidKeyException.hxx"
#include "Batch_Versatile.hxx"
-using namespace std;
-
// Ces macros permettent de simplifier l'ajout de nouvelles
// clefs dans la map Parametre
// TODO : remplacer ce mecanisme statique par la lecture
// TODO : d'une descrption dans un fichier exterieur (genre XML)
-#define def_extern_MapKey(mk) extern BATCH_EXPORT const string & mk;
-#define def_static_MapKey(mk) const string Batch::Parametre::mk(#mk); \
- const string & mk = Batch::Parametre::mk;
+#define def_extern_MapKey(mk) extern BATCH_EXPORT const std::string & mk;
+#define def_static_MapKey(mk) const std::string Batch::Parametre::mk(#mk); \
+ const std::string & mk = Batch::Parametre::mk;
namespace Batch {
- class BATCH_EXPORT Parametre : public map< string, Versatile >
+ class BATCH_EXPORT Parametre : public std::map< std::string, Versatile >
{
public:
// Constructeur standard
Parametre(const Parametre & PM);
// Operateur de recherche dans la map
- Versatile & operator [] (const string &);
- const Versatile & operator [] (const string &) const;
+ Versatile & operator [] (const std::string &);
+ const Versatile & operator [] (const std::string &) const;
// Operateur d'affectation
Parametre & operator =(const Parametre & PM);
// Declarations statique des clefs de la map
// TODO : supprimer les declarations statiques des clefs de la map
- static const string ACCOUNT;
- static const string ARGUMENTS;
- static const string CHECKPOINT;
- static const string CKPTINTERVAL;
- static const string CREATIONTIME;
- static const string EGROUP;
- static const string ELIGIBLETIME;
- static const string ENDTIME;
- static const string EUSER;
- static const string EXECUTABLE;
- static const string EXECUTIONHOST;
- static const string EXITCODE;
- static const string HOLD;
- static const string ID;
- static const string INFILE;
- static const string MAIL;
- static const string MAXCPUTIME;
- static const string MAXDISKSIZE;
- static const string MAXRAMSIZE;
- static const string MAXWALLTIME;
- static const string MODIFICATIONTIME;
- static const string NAME;
- static const string NBPROC;
- static const string OUTFILE;
- static const string PID;
- static const string QUEUE;
- static const string QUEUEDTIME;
- static const string SERVER;
- static const string STARTTIME;
- static const string STATE;
- static const string TEXT;
- static const string TMPDIR;
- static const string USEDCPUTIME;
- static const string USEDDISKSIZE;
- static const string USEDRAMSIZE;
- static const string USEDWALLTIME;
- static const string USER;
- static const string WORKDIR;
- static const string HOMEDIR;
+ static const std::string ACCOUNT;
+ static const std::string ARGUMENTS;
+ static const std::string CHECKPOINT;
+ static const std::string CKPTINTERVAL;
+ static const std::string CREATIONTIME;
+ static const std::string EGROUP;
+ static const std::string ELIGIBLETIME;
+ static const std::string ENDTIME;
+ static const std::string EUSER;
+ static const std::string EXECUTABLE;
+ static const std::string EXECUTIONHOST;
+ static const std::string EXITCODE;
+ static const std::string HOLD;
+ static const std::string ID;
+ static const std::string INFILE;
+ static const std::string MAIL;
+ static const std::string MAXCPUTIME;
+ static const std::string MAXDISKSIZE;
+ static const std::string MAXRAMSIZE;
+ static const std::string MAXWALLTIME;
+ static const std::string MODIFICATIONTIME;
+ static const std::string NAME;
+ static const std::string NBPROC;
+ static const std::string OUTFILE;
+ static const std::string PID;
+ static const std::string QUEUE;
+ static const std::string QUEUEDTIME;
+ static const std::string SERVER;
+ static const std::string STARTTIME;
+ static const std::string STATE;
+ static const std::string TEXT;
+ static const std::string TMPDIR;
+ static const std::string USEDCPUTIME;
+ static const std::string USEDDISKSIZE;
+ static const std::string USEDRAMSIZE;
+ static const std::string USEDWALLTIME;
+ static const std::string USER;
+ static const std::string WORKDIR;
+ static const std::string HOMEDIR;
protected:
- map< string, TypeParam > TypeMap; // map interne servant a controler le type de la valeur associee a chaque clef
+ std::map< std::string, TypeParam > TypeMap; // map interne servant a controler le type de la valeur associee a chaque clef
private:
#include "Batch_PyVersatile.hxx"
#include <string>
+using namespace std;
+
namespace Batch {
// Constructeur a partir d'un objet Versatile
#include "Batch_TypeMismatchException.hxx"
#include "Batch_ListIsFullException.hxx"
#include "Batch_InvalidArgumentException.hxx"
-using namespace std;
namespace Batch {
${PYTHON_INCLUDES} \
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
- -I$(srcdir)/../Utils \
-I$(top_builddir)/salome_adm/unix
LIB_LIBADD = \
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SALOMEMultiComm.hxx"
-#ifndef WNT
-using namespace std;
-#endif
SALOMEMultiComm::SALOMEMultiComm():_type(SALOME::CORBA_)
{
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SALOME_Comm_i.hxx"
-#ifndef WNT
+#ifndef WIN32
#include <rpc/xdr.h>
#endif
#include "omniORB4/poa.h"
#include "SenderFactory.hxx"
using namespace std;
-#ifndef WNT
+#ifndef WIN32
CORBA::ORB_var &getGlobalORB(){
ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
CORBA::ORB_var &orb = init(0,0);
~SALOME_CorbaLongCSender_i();
CORBA::ULong getSize();
SALOME::vectorOfLong* sendPart(CORBA::ULong offset, CORBA::ULong length);
-#ifndef WNT
+#ifndef WIN32
SALOME::CorbaLongCSender_ptr _this();
#endif
};
#ifndef _SALOME_COMMIUNICATION_HXX_
#define _SALOME_COMMIUNICATION_HXX_
-#ifdef WNT
- #if defined COMMUNICATION_EXPORTS
- #if defined WIN32
- #define COMMUNICATION_EXPORT __declspec( dllexport )
- #else
- #define COMMUNICATION_EXPORT
- #endif
- #else
- #if defined WIN32
- #define COMMUNICATION_EXPORT __declspec( dllimport )
- #else
- #define COMMUNICATION_EXPORT
- #endif
- #endif
+#ifdef WIN32
+# ifdef COMMUNICATION_EXPORTS
+# define COMMUNICATION_EXPORT __declspec( dllexport )
+# else
+# define COMMUNICATION_EXPORT __declspec( dllimport )
+# endif
#else
- #define COMMUNICATION_EXPORT
+# define COMMUNICATION_EXPORT
#endif
#endif
#include "SALOME_Component_i.hxx"
#include "SALOME_Container_i.hxx"
#include "RegistryConnexion.hxx"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
#include <stdio.h>
-#ifndef WNT
+#ifndef WIN32
#include <dlfcn.h>
#endif
#include <cstdlib>
#include "utilities.h"
-#ifndef WNT
+#ifndef WIN32
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
void Engines_Component_i::ping()
{
-#ifndef WNT
+#ifndef WIN32
MESSAGE("Engines_Component_i::ping() pid "<< getpid() << " threadid "
<< pthread_self());
#else
// MESSAGE("Engines_Component_i::Kill_i() pthread_t "<< pthread_self()
// << " pid " << getpid() << " instanceName "
// << _instanceName.c_str() << " interface " << _interfaceName.c_str()
-// << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+// << " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
// << dec << " _ThreadId " << _ThreadId << " this " << hex << this
// << dec ) ;
bool RetVal = false ;
-#ifndef WNT
+#ifndef WIN32
if ( _ThreadId > 0 && pthread_self() != _ThreadId )
{
RetVal = Killer( _ThreadId , SIGUSR2 ) ;
bool Engines_Component_i::Stop_impl()
{
-#ifndef WNT
+#ifndef WIN32
MESSAGE("Engines_Component_i::Stop_i() pthread_t "<< pthread_self()
<< " pid " << getpid() << " instanceName "
<< _instanceName.c_str() << " interface " << _interfaceName.c_str()
- << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
<< dec << " _ThreadId " << _ThreadId );
#else
MESSAGE("Engines_Component_i::Stop_i() pthread_t "<< pthread_self().p
<< " pid " << _getpid() << " instanceName "
<< _instanceName.c_str() << " interface " << _interfaceName.c_str()
- << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
<< dec << " _ThreadId " << _ThreadId );
#endif
bool RetVal = false ;
-#ifndef WNT
+#ifndef WIN32
if ( _ThreadId > 0 && pthread_self() != _ThreadId )
{
RetVal = Killer( _ThreadId , 0 ) ;
bool Engines_Component_i::Suspend_impl()
{
-#ifndef WNT
+#ifndef WIN32
MESSAGE("Engines_Component_i::Suspend_i() pthread_t "<< pthread_self()
<< " pid " << getpid() << " instanceName "
<< _instanceName.c_str() << " interface " << _interfaceName.c_str()
- << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
<< dec << " _ThreadId " << _ThreadId );
#else
MESSAGE("Engines_Component_i::Suspend_i() pthread_t "<< pthread_self().p
<< " pid " << _getpid() << " instanceName "
<< _instanceName.c_str() << " interface " << _interfaceName.c_str()
- << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
<< dec << " _ThreadId " << _ThreadId );
#endif
bool RetVal = false ;
-#ifndef WNT
+#ifndef WIN32
if ( _ThreadId > 0 && pthread_self() != _ThreadId )
#else
if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p )
}
else
{
-#ifndef WNT
+#ifndef WIN32
RetVal = Killer( _ThreadId ,SIGINT ) ;
#else
RetVal = Killer( *_ThreadId ,SIGINT ) ;
bool Engines_Component_i::Resume_impl()
{
-#ifndef WNT
+#ifndef WIN32
MESSAGE("Engines_Component_i::Resume_i() pthread_t "<< pthread_self()
<< " pid " << getpid() << " instanceName "
<< _instanceName.c_str() << " interface " << _interfaceName.c_str()
- << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
<< dec << " _ThreadId " << _ThreadId );
#else
MESSAGE("Engines_Component_i::Resume_i() pthread_t "<< pthread_self().p
<< " pid " << _getpid() << " instanceName "
<< _instanceName.c_str() << " interface " << _interfaceName.c_str()
- << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
<< dec << " _ThreadId " << _ThreadId );
#endif
bool RetVal = false ;
-#ifndef WNT
+#ifndef WIN32
if ( _ThreadId > 0 && pthread_self() != _ThreadId )
#else
if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p )
{
if ( _ThreadId > 0 )
{
-#ifndef WNT
+#ifndef WIN32
if ( pthread_self() != _ThreadId )
#else
if ( pthread_self().p != _ThreadId->p )
{
// Get Cpu in the appropriate thread with that object !...
theEngines_Component = this ;
-#ifndef WNT
+#ifndef WIN32
Killer( _ThreadId ,SIGUSR1 ) ;
#else
Killer( *_ThreadId ,SIGUSR11 ) ;
void Engines_Component_i::beginService(const char *serviceName)
{
-#ifndef WNT
+#ifndef WIN32
MESSAGE(pthread_self() << "Send BeginService notification for " <<serviceName
<< endl << "Component instance : " << _instanceName << endl << endl);
#else
MESSAGE(pthread_self().p << "Send BeginService notification for " <<serviceName
<< endl << "Component instance : " << _instanceName << endl << endl);
#endif
-#ifndef WNT
+#ifndef WIN32
_ThreadId = pthread_self() ;
#else
_ThreadId = new pthread_t;
if ( !_CanceledThread )
_ThreadCpuUsed = CpuUsed_impl() ;
-#ifndef WNT
+#ifndef WIN32
MESSAGE(pthread_self() << " Send EndService notification for " << serviceName
<< endl << " Component instance : " << _instanceName << " StartUsed "
<< _StartUsed << " _ThreadCpuUsed "<< _ThreadCpuUsed << endl <<endl);
bool Engines_Component_i::Killer( pthread_t ThreadId , int signum )
{
-#ifndef WNT
+#ifndef WIN32
if ( ThreadId )
#else
if ( ThreadId.p )
}
else
{
-#ifndef WNT
+#ifndef WIN32
MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId
<< " pthread_canceled") ;
#else
}
else
{
-#ifndef WNT
+#ifndef WIN32
MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId
<< " pthread_killed(" << signum << ")") ;
#else
long Engines_Component_i::CpuUsed()
{
long cpu = 0 ;
-#ifndef WNT
+#ifndef WIN32
struct rusage usage ;
if ( _ThreadId || _Executed )
{
#include <string.h>
#include <stdio.h>
#include <time.h>
-#ifndef WNT
+#ifndef WIN32
#include <sys/time.h>
#include <dlfcn.h>
#include <unistd.h>
#include "utilities.h"
#include <SALOMEconfig.h>
-//#ifndef WNT
#include CORBA_SERVER_HEADER(SALOME_Component)
#include CORBA_SERVER_HEADER(SALOME_Exception)
-//#else
-//#include <SALOME_Component.hh>
-//#endif
#include <pthread.h> // must be before Python.h !
#include "SALOME_Container_i.hxx"
#include "SALOME_Component_i.hxx"
#include "SALOME_FileTransfer_i.hxx"
#include "Salome_file_i.hxx"
#include "SALOME_NamingService.hxx"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
#include <Python.h>
#include "Container_init_python.hxx"
_argc = argc ;
_argv = argv ;
- string hostname = GetHostname();
-#ifndef WNT
+ string hostname = Kernel_Utils::GetHostname();
+#ifndef WIN32
MESSAGE(hostname << " " << getpid() <<
" Engines_Container_i starting argc " <<
_argc << " Thread " << pthread_self() ) ;
if (!_isSupervContainer)
{
-#ifdef WNT
+#ifdef WIN32
PyEval_AcquireLock();
PyThreadState *myTstate = PyThreadState_New(KERNEL_PYTHON::_interp);
Py_ACQUIRE_NEW_THREAD;
#endif
-#ifdef WNT
+#ifdef WIN32
// mpv: this is temporary solution: there is a unregular crash if not
//Sleep(2000);
//
char* Engines_Container_i::getHostName()
{
- string s = GetHostname();
+ string s = Kernel_Utils::GetHostname();
// MESSAGE("Engines_Container_i::getHostName " << s);
return CORBA::string_dup(s.c_str()) ;
}
// --- try dlopen C++ component
-#ifndef WNT
+#ifndef WIN32
string impl_name = string ("lib") + aCompName + string("Engine.so");
#else
string impl_name = aCompName + string("Engine.dll");
return true;
}
-#ifndef WNT
+#ifndef WIN32
void* handle;
handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ;
#else
//--- try C++
-#ifndef WNT
+#ifndef WIN32
string impl_name = string ("lib") + genericRegisterName +string("Engine.so");
#else
string impl_name = genericRegisterName +string("Engine.dll");
{
MESSAGE("Engines_Container_i::Kill() pid "<< getpid() << " containerName "
<< _containerName.c_str() << " machineName "
- << GetHostname().c_str());
+ << Kernel_Utils::GetHostname().c_str());
INFOS("===============================================================");
INFOS("= REMOVE calls to Kill_impl in C++ container =");
INFOS("===============================================================");
const char *,
const char *) ;
-#ifndef WNT
+#ifndef WIN32
FACTORY_FUNCTION Component_factory = (FACTORY_FUNCTION)dlsym( handle, factory_name.c_str() );
#else
FACTORY_FUNCTION Component_factory = (FACTORY_FUNCTION)GetProcAddress( (HINSTANCE)handle, factory_name.c_str() );
if ( !Component_factory )
{
INFOS( "Can't resolve symbol: " + factory_name );
-#ifndef WNT
+#ifndef WIN32
SCRUTE( dlerror() );
#endif
return Engines::Component::_nil() ;
void ActSigIntHandler()
{
-#ifndef WNT
+#ifndef WIN32
struct sigaction SigIntAct ;
SigIntAct.sa_sigaction = &SigIntHandler ;
SigIntAct.sa_flags = SA_SIGINFO ;
// it must be only one signal ===> one call for SIGINT
// and an other one for SIGUSR1
-#ifndef WNT
+#ifndef WIN32
if ( sigaction( SIGINT , &SigIntAct, NULL ) )
{
perror("SALOME_Container main ") ;
void SetCpuUsed() ;
void CallCancelThread() ;
-#ifndef WNT
+#ifndef WIN32
void SigIntHandler(int what ,
siginfo_t * siginfo ,
void * toto )
return ;
}
}
-#else // Case WNT
+#else // Case WIN32
void SigIntHandler( int what )
{
-#ifndef WNT
+#ifndef WIN32
MESSAGE( pthread_self() << "SigIntHandler what " << what << endl );
#else
MESSAGE( "SigIntHandler what " << what << endl );
// $Header$
#include <time.h>
-#ifndef WNT
+#ifndef WIN32
#include <sys/time.h>
#endif
struct CONTAINER_EXPORT KERNEL_PYTHON
{
-#ifdef WNT
+#ifdef WIN32
static PyThreadState *get_gtstate() { return KERNEL_PYTHON::_gtstate; }
static PyObject *getsalome_shared_modules_module() { return KERNEL_PYTHON::salome_shared_modules_module; }
static PyInterpreterState *get_interp() { return KERNEL_PYTHON::_interp; }
../Basics/libSALOMEBasics.la \
../HDFPersist/libSalomeHDFPersist.la \
../Batch/libSalomeBatch.la \
- $(top_builddir)/idl/libSalomeIDLKernel.la\
+ $(top_builddir)/idl/libSalomeIDLKernel.la \
@MPI_LIBS@ \
@CORBA_LIBS@ \
$(PYTHON_LIBS)
SALOME_Container_LDADD = \
libSalomeContainer.la \
+ ../Basics/libSALOMEBasics.la \
$(HDF5_LIBS) \
$(MPI_LIBS) \
$(CORBA_LIBS) \
TestSalome_file_LDADD =\
libSalomeContainer.la \
+ ../Basics/libSALOMEBasics.la \
$(HDF5_LIBS) \
$(MPI_LIBS) \
$(CORBA_LIBS) \
#include <iostream>
#include <signal.h>
#include <stdlib.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#endif
#include <sys/types.h>
std::string _nodeName ;
private:
-#ifndef WNT
+#ifndef WIN32
pthread_t _ThreadId ;
#else
pthread_t* _ThreadId ;
#include <string>
#include <stdio.h>
#include <time.h>
-#ifndef WNT
+#ifndef WIN32
# include <sys/time.h>
# include <dlfcn.h>
#endif
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#else
#include <process.h>
PortableServer::POAManager_var pman = root_poa->the_POAManager();
// add new container to the kill list
-#ifndef WNT
+#ifndef WIN32
stringstream aCommand ;
aCommand << "addToKillList.py " << getpid() << " SALOME_Container" << ends ;
system(aCommand.str().c_str());
#ifndef _SALOME_Container_HXX_
#define _SALOME_Container_HXX_
-#ifdef WNT
- #if defined CONTAINER_EXPORTS
- #if defined WIN32
- #define CONTAINER_EXPORT __declspec( dllexport )
- #else
- #define CONTAINER_EXPORT
- #endif
- #else
- #if defined WIN32
- #define CONTAINER_EXPORT __declspec( dllimport )
- #else
- #define CONTAINER_EXPORT
- #endif
- #endif
+#ifdef WIN32
+# ifdef CONTAINER_EXPORTS
+# define CONTAINER_EXPORT __declspec( dllexport )
+# else
+# define CONTAINER_EXPORT __declspec( dllimport )
+# endif
#else
- #define CONTAINER_EXPORT
+# define CONTAINER_EXPORT
#endif
#endif
#include "SALOME_ContainerManager.hxx"
#include "SALOME_NamingService.hxx"
#include "SALOME_ModuleCatalog.hh"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
+#include "Basics_DirUtils.hxx"
#include <sys/types.h>
#include <sys/stat.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#endif
#include <vector>
vector<string> vec = _NS->list_directory_recurs();
list<string> lstCont;
for(vector<string>::iterator iter = vec.begin();iter!=vec.end();iter++){
- SCRUTE((*iter));
- CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
- Engines::Container_var cont=Engines::Container::_narrow(obj);
- if(!CORBA::is_nil(cont)){
- lstCont.push_back((*iter));
+ SCRUTE((*iter));
+ CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
+ Engines::Container_var cont=Engines::Container::_narrow(obj);
+ if(!CORBA::is_nil(cont)){
+ lstCont.push_back((*iter));
+ }
}
- }
MESSAGE("Container list: ");
for(list<string>::iterator iter=lstCont.begin();iter!=lstCont.end();iter++){
SCRUTE((*iter));
//If the machine name is localhost use the real name
if(theMachine == "localhost")
- theMachine=GetHostname();
+ theMachine=Kernel_Utils::GetHostname();
MESSAGE("try to launch it on " << theMachine);
"no possible computer");
return Engines::Container::_nil();
}
- else if(theMachine==GetHostname())
+ else if(theMachine==Kernel_Utils::GetHostname())
command = BuildCommandToLaunchLocalContainer(params,id,container_exe);
else
command = BuildCommandToLaunchRemoteContainer(theMachine,params,id,container_exe);
- RmTmpFile();
+ // RmTmpFile(); Too early! May be this function has not been used for a long time...
//check if an entry exists in Naming service
if(params.isMPI)
CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str());
if ( !CORBA::is_nil(obj) )
{
- // shutdown the registered container if it exists
- Engines::Container_var cont=Engines::Container::_narrow(obj);
- if(!CORBA::is_nil(cont))
- {
- try
- {
- cont->Shutdown();
- }
- catch(CORBA::Exception&)
+ // shutdown the registered container if it exists
+ Engines::Container_var cont=Engines::Container::_narrow(obj);
+ if(!CORBA::is_nil(cont))
+ {
+ try
+ {
+ cont->Shutdown();
+ }
+ catch(CORBA::Exception&)
{
- INFOS("CORBA::Exception ignored.");
- }
- }
+ INFOS("CORBA::Exception ignored.");
+ }
+ }
}
//redirect stdout and stderr in a file
// launch container with a system call
int status=system(command.c_str());
+
+ RmTmpFile(); // command file can be removed here
+
if (status == -1){
MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed " <<
"(system command status -1)");
int count=TIME_OUT_TO_LAUNCH_CONT;
MESSAGE("count = "<<count);
while ( CORBA::is_nil(ret) && count ){
-#ifndef WNT
+#ifndef WIN32
sleep( 1 ) ;
#else
Sleep(1000);
else
{
logFilename=":"+logFilename;
- logFilename="@"+GetHostname()+logFilename;
+ logFilename="@"+Kernel_Utils::GetHostname()+logFilename;
logFilename=getenv( "USER" )+logFilename;
ret->logfilename(logFilename.c_str());
}
else {
INFOS("[FindOrStartParallelContainer] on machine : " << theMachine);
string command;
- if(theMachine == GetHostname()) {
+ if(theMachine == Kernel_Utils::GetHostname()) {
// Step 3 : starting parallel container proxy
params.hostname = CORBA::string_dup(theMachine.c_str());
Engines::MachineParameters params_proxy(params);
for (int i = 0; i < params.nb_component_nodes; i++) {
char buffer [5];
-#ifndef WNT
+#ifndef WIN32
snprintf(buffer,5,"%d",i);
#else
_snprintf(buffer,5,"%d",i);
obj = _NS->Resolve(containerNameInNS.c_str());
while (CORBA::is_nil(obj) && count) {
INFOS("[FindOrStartParallelContainer] CONNECTION FAILED !!!!!!!!!!!!!!!!!!!!!!!!");
-#ifndef WNT
+#ifndef WIN32
sleep(1) ;
#else
Sleep(1000);
INFOS("[LaunchParallelContainer] Waiting for Parallel Container proxy on " << theMachine);
while (CORBA::is_nil(obj) && count) {
-#ifndef WNT
+#ifndef WIN32
sleep(1) ;
#else
Sleep(1000);
// Name of the node
char buffer [5];
-#ifndef WNT
+#ifndef WIN32
snprintf(buffer,5,"%d",i);
#else
_snprintf(buffer,5,"%d",i);
containerNameInNS = _NS->BuildContainerNameForNS((char*) name_cont.c_str(),theMachine.c_str());
cerr << "[LaunchContainer] Waiting for Parllel Container node " << containerNameInNS << " on " << theMachine << endl;
while (CORBA::is_nil(obj) && count) {
-#ifndef WNT
+#ifndef WIN32
sleep(1) ;
#else
Sleep(1000);
if(wdir == "$TEMPDIR")
{
// a new temporary directory is requested
- string dir = OpUtil_Dir::GetTmpDir();
+ string dir = Kernel_Utils::GetTmpDir();
#ifdef WIN32
//command += "cd /d "+ dir +";";
command_file << "cd /d " << dir << endl;
void SALOME_ContainerManager::RmTmpFile()
{
- if (_TmpFileName != "")
+ int lenght = _TmpFileName.size();
+ if ( lenght > 0)
{
-#ifndef WNT
- string command = "rm ";
-#else
+#ifdef WIN32
string command = "del /F ";
+#else
+ string command = "rm ";
#endif
- command += _TmpFileName;
- char *temp = strdup(command.c_str());
- int lgthTemp = strlen(temp);
- temp[lgthTemp - 3] = '*';
- temp[lgthTemp - 2] = '\0';
- system(temp);
- free(temp);
+ if ( lenght > 4 )
+ command += _TmpFileName.substr(0, lenght - 3 );
+ else
+ command += _TmpFileName;
+ command += '*';
+ system(command.c_str());
+ //if dir is empty - remove it
+ string tmp_dir = Kernel_Utils::GetDirByPath( _TmpFileName );
+ if ( Kernel_Utils::IsEmptyDir( tmp_dir ) )
+ {
+#ifdef WIN32
+ command = "del /F " + tmp_dir;
+#else
+ command = "rmdir " + tmp_dir;
+#endif
+ system(command.c_str());
+ }
}
}
string SALOME_ContainerManager::BuildTemporaryFileName() const
{
//build more complex file name to support multiple salome session
- string aFileName = OpUtil_Dir::GetTmpFileName();
+ string aFileName = Kernel_Utils::GetTmpFileName();
#ifndef WIN32
aFileName += ".sh";
#else
command += " > /tmp/";
command += _NS->ContainerName(rtn);
command += "_";
- command += GetHostname();
+ command += Kernel_Utils::GetHostname();
command += "_";
command += getenv( "USER" ) ;
command += ".log 2>&1 &" ;
#include <iostream>
#include <signal.h>
#include <stdlib.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#endif
#include <sys/types.h>
#include "SALOME_FileRef_i.hxx"
#include "utilities.h"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
#include <string>
using namespace std;
MESSAGE("fileRef_i::fileRef_i "<< origFileName);
_container = Engines::Container::_duplicate(container);
_origFileName = origFileName;
- _machine = GetHostname();
+ _machine = Kernel_Utils::GetHostname();
#if defined(_DEBUG_) || defined(_DEBUG)
int OK = addRef(_machine.c_str(), _origFileName.c_str());
SCRUTE(OK);
#include "utilities.h"
#include <stdlib.h>
#include "HDFOI.hxx"
-#ifndef WNT
+#ifndef WIN32
# include <unistd.h>
# define _getcwd getcwd
# define _open open
};
-# if defined(WNT) && !defined(HAVE_NO_DLL)
+# if defined(WIN32) && !defined(HAVE_NO_DLL)
# ifndef Standard_EXPORT
# define Standard_EXPORT __declspec( dllexport )
# define Standard_IMPORTC extern "C" __declspec( dllimport )
# endif /* Standard_IMPORT */
-# else /* WNT */
+# else /* WIN32 */
# ifndef Standard_EXPORT
# define Standard_EXPORT
# define Standard_IMPORTC extern "C"
# endif /* Standard_IMPORT */
-# endif /* WNT */
+# endif /* WIN32 */
# ifndef __Standard_API
-//# ifdef WNT
-# if !defined(WNT)
+//# ifdef WIN32
+# if !defined(WIN32)
# define __Standard_API Standard_EXPORT
# define __Standard_APIEXTERN Standard_EXPORTEXTERN
# else
# endif // __Standard_DLL
//# else
//# define __Standard_API
-//# endif // WNT
+//# endif // WIN32
# endif // __Standard_API
#include <iostream>
#include "DF_Container.hxx"
#include "DF_ChildIterator.hxx"
-#ifndef WNT
+#ifndef WIN32
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/types.h>
void GetSystemDate(int& year, int& month, int& day, int& hours, int& minutes, int& seconds)
{
-#ifdef WNT
+#ifdef WIN32
SYSTEMTIME st;
GetLocalTime ( &st );
string GetUserName()
{
-#ifdef WNT
+#ifdef WIN32
char* pBuff = new char[UNLEN + 1];
DWORD dwSize = UNLEN + 1;
string retVal;
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
bool Exists(const string thePath)
{
-#ifdef WNT
+#ifdef WIN32
if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) {
if ( GetLastError () != ERROR_FILE_NOT_FOUND ) {
return false;
#ifndef _DSC_Basic_HXX_
#define _DSC_Basic_HXX_
-#ifdef WNT
- #if defined DSC_BASIC_EXPORTS
- #if defined WIN32
- #define DSC_BASIC_EXPORT __declspec( dllexport )
- #else
- #define DSC_BASIC_EXPORT
- #endif
- #else
- #if defined WIN32
- #define DSC_BASIC_EXPORT __declspec( dllimport )
- #else
- #define DSC_BASIC_EXPORT
- #endif
- #endif
+#ifdef WIN32
+# ifdef DSC_BASIC_EXPORTS
+# define DSC_BASIC_EXPORT __declspec( dllexport )
+# else
+# define DSC_BASIC_EXPORT __declspec( dllimport )
+# endif
#else
- #define DSC_BASIC_EXPORT
+# define DSC_BASIC_EXPORT
#endif
#endif
#include "basic_port_factory.hxx"
+using namespace std;
+
basic_port_factory::basic_port_factory() {}
basic_port_factory::~basic_port_factory() {}
#include "data_short_port_provides.hxx"
#include "data_short_port_uses.hxx"
-using namespace std;
-
/*! \class basic_port_factory
* \brief This class is an example of factory for DSC_User ports.
*
* \param type the basic port's type.
* \return a pointer of the provides port.
*/
- virtual provides_port * create_data_servant(string type);
+ virtual provides_port * create_data_servant(std::string type);
/*!
* This method creates a uses port of Basic ports.
* \param type the basic port's type.
* \return a pointer of the uses port.
*/
- virtual uses_port * create_data_proxy(string type);
+ virtual uses_port * create_data_proxy(std::string type);
};
#endif
#include "utilities.h"
-#ifndef WNT
+#ifndef WIN32
extern "C"
{
#endif
#include <string.h>
-#ifndef WNT
+#ifndef WIN32
}
#endif
-#ifdef _DEBUG_
+#if defined(_DEBUG_) || defined(_DEBUG)
# ifdef __GNUC__
# define LOC(message) (message), __FILE__ , __LINE__ , __FUNCTION__
# else
double & ti,
double const & tf,
long & i,
- const string & nomVar,
+ const std::string & nomVar,
size_t bufferLength,
size_t & nRead,
T1 * &data )
// T1 est le type de données
template <typename T1 > static void
ecp_lecture ( Superv_Component_i & component,
- int const & dependencyType,
- double & ti,
- double const & tf,
- long & i,
- const string & nomVar,
- size_t bufferLength,
- size_t & nRead,
- T1 * &data )
+ int const & dependencyType,
+ double & ti,
+ double const & tf,
+ long & i,
+ const std::string & nomVar,
+ size_t bufferLength,
+ size_t & nRead,
+ T1 * &data )
{
ecp_lecture<T1,T1> (component,dependencyType,ti,tf,
i,nomVar,bufferLength,nRead,data);
// T2 : PortType
template <typename T1, typename T2> static void
ecp_ecriture ( Superv_Component_i & component,
- int const & dependencyType,
- double const & t,
- long const & i,
- const string & nomVar,
- size_t bufferLength,
- T1 const & data )
+ int const & dependencyType,
+ double const & t,
+ long const & i,
+ const std::string & nomVar,
+ size_t bufferLength,
+ T1 const & data )
{
assert(&component);
#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecriture), Valeur de corbaData : " << std::endl;
for (int i = 0; i < corbaData->length(); ++i)
- cout << "-------- CalciumInterface(ecriture), corbaData[" << i << "] = " << (*corbaData)[i] << endl;
+ std::cout << "-------- CalciumInterface(ecriture), corbaData[" << i << "] = " << (*corbaData)[i] << std::endl;
#endif
// if ( !IsSameType<T1,InnerType>::value ) delete corbaData;
int const & dependencyType,
double const & t,
long const & i,
- const string & nomVar,
+ const std::string & nomVar,
size_t bufferLength,
T1 const & data ) {
ecp_ecriture<T1,T1> (component,dependencyType,t,i,nomVar,bufferLength,data);
#include "calcium_port_factory.hxx"
+using namespace std;
+
calcium_port_factory::calcium_port_factory() {}
calcium_port_factory::~calcium_port_factory() {}
#include "calcium_logical_port_uses.hxx"
#include "calcium_complex_port_uses.hxx"
-using namespace std;
-
class calcium_port_factory :
public port_factory
{
calcium_port_factory();
virtual ~calcium_port_factory();
- virtual provides_port * create_data_servant(string type);
- virtual uses_port * create_data_proxy(string type);
+ virtual provides_port * create_data_servant(std::string type);
+ virtual uses_port * create_data_proxy(std::string type);
};
#endif
#include <iostream>
// Pour l'utilisation de "vector" de la STL
-using namespace std;
-
// Classe filtre_elementaire
//
// Implémente une structure de donnée décrivant un filtre élémentaire
// Données de configuration de filtrage et conversion:
// une table de filtres élémentaires
// avec leurs données de conversion associées éventuelles
- vector<conversion_elementaire> config;
+ std::vector<conversion_elementaire> config;
public:
// Constructeur: juste une allocation mémoire initiale
// réclamer la mémoire utilisée par tous les éléments du vecteur config
~filtre_conversion()
{
- vector<conversion_elementaire>::iterator i;
+ std::vector<conversion_elementaire>::iterator i;
for (i = this->config.begin(); i != this->config.end(); i ++)
{
delete (*i).p_convers;
}
// applique_filtre_conversion: Opération du filtre et de la conversion
- template <typename T > T applique_filtre_conversion (T valeur_initiale, vector<T>& liste_conversions) const;
+ template <typename T > T applique_filtre_conversion (T valeur_initiale, std::vector<T>& liste_conversions) const;
};
// si cette longueur est 0, c'est que la valeur initiale ne passe pas le filtre
//
template <typename T>
-T filtre_conversion::applique_filtre_conversion (T valeur_initiale, vector<T>& liste_conversions) const
+T filtre_conversion::applique_filtre_conversion (T valeur_initiale, std::vector<T>& liste_conversions) const
{
// Part d'une liste vierge
liste_conversions.clear();
// et cherche pour chacun d'eux si la valeur initiale est présente parmi les valeurs filtrées
// Pour tous les éléments de configuration du filtrage/conversion
- vector<conversion_elementaire>::const_iterator i;
+ std::vector<conversion_elementaire>::const_iterator i;
for (i = config.begin(); i != config.end(); i ++)
{
std::cout << "----Cst ---- InternalDataIdContainer(const DataId & dataId..) " << dataId <<std::endl;
policy.filtre_convert_TIME.applique_filtre_conversion(dataId.first, _lTime);
int c=0;
- for(vector<CORBA::Long>::iterator i=_lTime.begin();i!=_lTime.end();++i)
+ for(std::vector<CORBA::Long>::iterator i=_lTime.begin();i!=_lTime.end();++i)
std::cout << "_lTime["<< c++ << "] : " << *i << std::endl;
policy.filtre_convert_TAG.applique_filtre_conversion(dataId.second, _lTag);
c=0;
- for(vector<CORBA::Long>::iterator i=_lTag.begin();i!=_lTag.end();++i)
+ for(std::vector<CORBA::Long>::iterator i=_lTag.begin();i!=_lTag.end();++i)
std::cout << "_lTag["<< c++ << "] : " << *i << std::endl;
}
#include "palm_port_factory.hxx"
+using namespace std;
+
palm_port_factory::palm_port_factory() {
}
#include "palm_data_short_port_provides.hxx"
#include "palm_data_seq_short_port_provides.hxx"
-using namespace std;
-
class palm_port_factory :
public port_factory
{
palm_port_factory();
virtual ~palm_port_factory();
- virtual provides_port * create_data_servant(string type);
- virtual uses_port * create_data_proxy(string type);
+ virtual provides_port * create_data_servant(std::string type);
+ virtual uses_port * create_data_proxy(std::string type);
};
#endif
#include "Superv_Component_i.hxx"
+using namespace std;
+
DSC_EXCEPTION_CXX(Superv_Component_i,BadFabType);
DSC_EXCEPTION_CXX(Superv_Component_i,BadType);
DSC_EXCEPTION_CXX(Superv_Component_i,BadCast);
#include "DSC_Exception.hxx"
-
-using namespace std;
-
/*! \class Superv_Component_i
* \brief This class implements DSC_User component.
*
MESSAGE("GenericObj_i::GenericObj_i() - this = "<<this<<
"; CORBA::is_nil(thePOA) = "<<CORBA::is_nil(thePOA));
if(CORBA::is_nil(thePOA))
-#ifndef WNT
+#ifndef WIN32
myPOA = PortableServer::ServantBase::_default_POA();
#else
myPOA = ServantBase::_default_POA();
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SALOME_GenericObj)
-#if defined GENERICOBJ_EXPORTS
-#if defined WIN32
-#define GENERICOBJ_EXPORT __declspec( dllexport )
+#ifdef WIN32
+# ifdef GENERICOBJ_EXPORTS
+# define GENERICOBJ_EXPORT __declspec( dllexport )
+# else
+# define GENERICOBJ_EXPORT __declspec( dllimport )
+# endif
#else
-#define GENERICOBJ_EXPORT
-#endif
-#else
-#if defined WNT
-#define GENERICOBJ_EXPORT __declspec( dllimport )
-#else
-#define GENERICOBJ_EXPORT
-#endif
+# define GENERICOBJ_EXPORT
#endif
namespace SALOME{
#include <stdio.h>
#include <string>
-#ifdef WNT
+#ifdef WIN32
#include <io.h>
#include <time.h>
#include <windows.h>
aDir = aTmpDir+buffer; //Build a unique directory name
}
-#ifdef WNT
+#ifdef WIN32
//fuction CreateDirectory create only final directory, but not intermediate
CreateDirectory(aTmpDir.c_str(), NULL);
CreateDirectory(aDir.c_str(), NULL);
bool Exists(const string thePath)
{
-#ifdef WNT
+#ifdef WIN32
if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) {
if ( GetLastError () != ERROR_FILE_NOT_FOUND ) {
return false;
void Move(const string& fName, const string& fNameDst)
{
-#ifdef WNT
+#ifdef WIN32
MoveFileEx (fName.c_str(), fNameDst.c_str(),MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED);
#else
rename(fName.c_str(), fNameDst.c_str());
#include "HDFconvert.hxx"
using namespace std;
-#ifdef WNT
+#ifdef WIN32
#include <io.h>
#include <windows.h>
#endif
perror("HDFConvert::FromAscii");
return -1;
};
-#elif defined WNT
+#elif defined WIN32
#define SHMEMSIZE 4096
extern "C"
{
#include "HDFtypes.h"
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#include <sys/mman.h>
#else
extern "C"
{
#include "hdfi.h"
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#else
#include <io.h>
#include "hdfi.h"
}
#include "HDFinternalObject.hxx"
-#ifndef WNT
-using namespace std;
-#endif
HDFinternalObject::HDFinternalObject(const char *name)
: HDFobject(name)
#include <sstream>
#include <sys/stat.h>
+#ifdef WIN32
+# include <time.h>
+#endif
+
using namespace std;
//=============================================================================
SALOME_LauncherServer_LDADD =\
libSalomeLauncher.la \
+ ../Basics/libSALOMEBasics.la \
$(MPI_LIBS) \
$(CORBA_LIBS) \
$(LIBXML_LIBS) \
#include "SALOME_FileTransferCORBA.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
#include "utilities.h"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
using namespace std;
container = _theFileRef->getContainer();
ASSERT(! CORBA::is_nil(container));
- string myMachine = GetHostname();
+ string myMachine = Kernel_Utils::GetHostname();
string localCopy = _theFileRef->getRef(myMachine.c_str());
if (localCopy.empty()) // no existing copy available
#include <string>
-#ifdef WNT
+#ifdef WIN32
# if defined LIFECYCLECORBA_EXPORTS
# define LIFECYCLECORBA_EXPORT __declspec( dllexport )
# else
#include <iomanip>
#include <time.h>
-#ifndef WNT
+#ifndef WIN32
#include <sys/time.h>
#endif
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
#include "utilities.h"
#include <ServiceUnreachable.hxx>
#include "SALOME_LifeCycleCORBA.hxx"
-#ifndef WNT
#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
#include CORBA_CLIENT_HEADER(SALOME_Session)
#include CORBA_CLIENT_HEADER(DSC_Engines)
#include CORBA_CLIENT_HEADER(SALOME_Registry)
#include CORBA_CLIENT_HEADER(SALOMEDS)
-#else
-#include "SALOME_ModuleCatalog.hh"
-#include "SALOME_Session.hh"
-#include "DSC_Engines.hh"
-#include "SALOME_Registry.hh"
-#include "SALOMEDS.hh"
-#endif
+
#include "SALOME_ContainerManager.hxx"
#include "SALOME_Component_i.hxx"
#include "SALOME_NamingService.hxx"
{
// containerName doesn't contain "/" => Local container
params->container_name=CORBA::string_dup(stContainer);
- params->hostname=CORBA::string_dup(GetHostname().c_str());
+ params->hostname=CORBA::string_dup(Kernel_Utils::GetHostname().c_str());
}
else
{
}
}
- string hostname = GetHostname();
+ string hostname = Kernel_Utils::GetHostname();
// 1) SalomeLauncher
CORBA::Object_var objSL = _NS->Resolve("/SalomeLauncher");
#define _SALOME_LIFECYCLECORBA_HXX_
#include <stdlib.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#endif
#include <string>
#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
#include CORBA_CLIENT_HEADER(SALOME_Component)
#include <iostream>
-using namespace std;
-#ifdef WNT
+
+#ifdef WIN32
# if defined LIFECYCLECORBA_EXPORTS
# define LIFECYCLECORBA_EXPORT __declspec( dllexport )
# else
#include "SALOME_FileTransferCORBA.hxx"
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
#include <iostream>
#include <fstream>
// --- get a local container (with a name based on local hostname),
// load an engine, check that the CORBA object is not null
- string containerName = GetHostname();
+ string containerName = Kernel_Utils::GetHostname();
containerName += "/theContainer";
DEVTRACE("containerName = " << containerName);
Engines::Component_var mycompo =
_LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");
CPPUNIT_ASSERT(!CORBA::is_nil(mycompo1));
- containerName = GetHostname();
+ containerName = Kernel_Utils::GetHostname();
containerName += "/aContainer";
DEVTRACE("containerName = " << containerName);
Engines::Component_var mycompo2 =
Engines::MachineParameters params;
_LCC.preSet(params);
- string hostname=GetHostname();
+ string hostname=Kernel_Utils::GetHostname();
params.hostname=hostname.c_str();
Engines::Component_var mycompo =
_LCC.FindOrLoad_Component(params,"SalomeTestComponent");
Engines::Container_var c1 = m1->GetContainerRef();
CPPUNIT_ASSERT(!CORBA::is_nil(c1));
string hostname1 = c1->getHostName();
- CPPUNIT_ASSERT_EQUAL(hostname1, GetHostname());
+ CPPUNIT_ASSERT_EQUAL(hostname1, Kernel_Utils::GetHostname());
}
Engines::Container_var c1 = m1->GetContainerRef();
CPPUNIT_ASSERT(!CORBA::is_nil(c1));
string hostname1 = c1->getHostName();
- CPPUNIT_ASSERT_EQUAL(hostname1, GetHostname());
+ CPPUNIT_ASSERT_EQUAL(hostname1, Kernel_Utils::GetHostname());
string cname1 = c1->name();
CPPUNIT_ASSERT(cname1.find(containerName) != string::npos);
}
SALOME_LifeCycleCORBA _LCC(&_NS);
string origFileName = getenv("KERNEL_ROOT_DIR");
origFileName += "/lib/salome/libSalomeLifeCycleCORBA.so.0.0.0";
- SALOME_FileTransferCORBA transfer( GetHostname(),
+ SALOME_FileTransferCORBA transfer( Kernel_Utils::GetHostname(),
origFileName);
string local = transfer.getLocalFile();
CPPUNIT_ASSERT(!local.empty());
resourcesManager->GetFittingResources(params,clist);
CPPUNIT_ASSERT(hostList->length() > 1);
- string localHost = GetHostname();
+ string localHost = Kernel_Utils::GetHostname();
string remoteHost;
for (unsigned int i=0; i < hostList->length(); i++)
{
// $Header$
#include <iostream>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#endif
#include <SALOMEconfig.h>
-#ifndef WNT
#include CORBA_CLIENT_HEADER(SALOME_Component)
#include CORBA_CLIENT_HEADER(SALOME_TestComponent)
-#else
-#include <SALOME_Component.hh>
-#include <SALOME_TestComponent.hh>
-#endif
#include "SALOME_NamingService.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
#include "SALOME_FileTransferCORBA.hxx"
#include "utilities.h"
-#include <OpUtil.hxx>
+#include <Basics_Utils.hxx>
using namespace std;
// --- yet another container, with hostname,
// load an engine, and invoque methods on that engine
- string containerName4 = GetHostname();
+ string containerName4 = Kernel_Utils::GetHostname();
containerName4 += "/titiPy";
Engines::Component_var mycompo4 =
_LCC.FindOrLoad_Component(containerName4.c_str(),"SALOME_TestComponentPy");
// --- try a local file transfer
string origFileName = "/home/prascle/petitfichier";
- SALOME_FileTransferCORBA transfer( GetHostname(),
+ SALOME_FileTransferCORBA transfer( Kernel_Utils::GetHostname(),
origFileName);
string local = transfer.getLocalFile();
SCRUTE(local);
# include <unistd.h>
#endif
-#ifdef WNT
+#ifdef WIN32
#include <omnithread/pthread_nt.h>
#endif
#include <SALOMEconfig.h>
-#ifndef WNT
+#ifndef WIN32
#include <fstream.h>
#else
#include <fstream>
#include <omnithread.h>
#include "Logger.hh"
-#ifdef WNT
+#ifdef WIN32
# if defined LOGGER_EXPORTS
# define LOGGER_EXPORT __declspec( dllexport )
# else
//otherwise all messages will be put into terminal via cout
bool m_putIntoFile;
//ofstream class specialized for disk file output
-#ifndef WNT
+#ifndef WIN32
ofstream m_outputFile;
#else
std::ofstream m_outputFile;
for (i = 1; i <= NumberOfTries; i++)
{
-#ifndef WNT
+#ifndef WIN32
if (i != 1) nanosleep(&ts_req, &ts_rem);
#else
if (i != 1) Sleep(TIMESleep / 1000000);
#include <iostream>
using namespace std;
-#ifdef WNT
+#ifdef WIN32
#include <omnithread/pthread_nt.h>
#endif
// searchin for naming service for 0.25*40=10 seconds
for (i = 1; i <= NumberOfTries; i++) {
-#ifndef WNT
+#ifndef WIN32
if (i != 1) nanosleep(&ts_req,&ts_rem);
#else
if (i != 1) Sleep(TIMESleep / 1000000);
name[0].id=CORBA::string_dup("Logger");
for(i = 1; i <= NumberOfTries; i++){
-#ifndef WNT
+#ifndef WIN32
if (i != 1) nanosleep(&ts_req, &ts_rem);
#else
if (i != 1) Sleep(TIMESleep / 1000000);
#include "Logger.hh"
//these declarations for files don't using OCC includes (for example HDF)
-# ifdef WNT
+# ifdef WIN32
# ifndef Standard_EXPORT
# define Standard_EXPORT __declspec( dllexport )
# define Standard_IMPORTC extern "C" __declspec( dllimport )
# endif /* Standard_IMPORT */
-# else /* WNT */
+# else /* WIN32 */
# ifndef Standard_EXPORT
# define Standard_EXPORT
# define Standard_IMPORTC extern "C"
# endif /* Standard_IMPORT */
-# endif /* WNT */
+# endif /* WIN32 */
class SALOME_Trace : public std::ostrstream
{
CORBA::Object_var obj=_poa->id_to_reference(*_id);
Engines::Container_var pCont = Engines::Container::_narrow(obj);
- string hostname = GetHostname();
+ string hostname = Kernel_Utils::GetHostname();
_containerName = _NS->BuildContainerNameForNS(containerName,hostname.c_str());
SCRUTE(_containerName);
_NS->Register(pCont, _containerName.c_str());
_length = S_in.ServiceoutParameter.length();
S_out.ServiceoutParameter.length(_length);
-#ifndef WNT
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
-#else
- for (ind2 = 0; ind2 < _length ; ind2 ++)
-#endif
duplicate(S_out.ServiceoutParameter[ind2],
S_in.ServiceoutParameter[ind2]);
_length = S_in.ServiceinDataStreamParameter.length();
S_out.ServiceinDataStreamParameter.length(_length);
-#ifndef WNT
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
-#else
- for (ind2 = 0; ind2 < _length ; ind2 ++)
-#endif
duplicate(S_out.ServiceinDataStreamParameter[ind2],
S_in.ServiceinDataStreamParameter[ind2]);
if(MYDEBUG) SCRUTE(_length);
S_out.ServiceoutDataStreamParameter.length(_length);
-#ifndef WNT
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
-#else
- for (ind2 = 0; ind2 < _length ; ind2 ++)
-#endif
duplicate(S_out.ServiceoutDataStreamParameter[ind2],
S_in.ServiceoutDataStreamParameter[ind2]);
}
MESSAGE("Get Typed Component list (SUPERV Type)");
list_typed_composants
= Catalogue->GetTypedComponentList(SALOME_ModuleCatalog::SUPERV);
-#ifndef WNT
for (unsigned int ind = 0; ind < list_typed_composants->length();ind++)
-#else
- for (ind = 0; ind < list_typed_composants->length();ind++)
-#endif
MESSAGE("Component SUPERV list : " << list_typed_composants[ind]);
// Get list of couple (component name, component icone)
SALOME_ModuleCatalog::ListOfIAPP_Affich_var list_composants_icone
= Catalogue->GetComponentIconeList();
-#ifndef WNT
for (unsigned int ind = 0; ind < list_composants_icone->length();ind++)
-#else
- for (ind = 0; ind < list_composants_icone->length();ind++)
-#endif
{
MESSAGE("Component name: " << list_composants_icone[ind].modulename);
MESSAGE("Component icone: " << list_composants_icone[ind].moduleicone);
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);
list<string> dirList;
-#ifdef WNT
+#ifdef WIN32
dirList = splitStringToList(_general_path, SEPARATOR);
#else
//check for new format
// The components in the general catalog are taken only if they're
// not defined in the personal catalog
-#ifndef WNT
+#ifndef WIN32
for(unsigned int ind=0; ind < _general_module_list.size();ind++){
#else
for(ind=0; ind < _general_module_list.size();ind++){
// The components in the general catalog are taken only if they're
// not defined in the personal catalog
-#ifndef WNT
+#ifndef WIN32
for(unsigned int ind=0; ind < _general_module_list.size();ind++){
#else
for(ind=0; ind < _general_module_list.size();ind++){
// The components in the general catalog are taken only if they're
// not defined in the personal catalog
-#ifndef WNT
+#ifndef WIN32
for (unsigned int ind=0; ind < _general_module_list.size();ind++)
#else
for (ind=0; ind < _general_module_list.size();ind++)
_length = S_parser.outParameters.size();
S_corba.ServiceoutParameter.length(_length);
-#ifndef WNT
+#ifndef WIN32
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
#else
for (ind2 = 0; ind2 < _length ; ind2 ++)
_length = S_parser.inDataStreamParameters.size();
S_corba.ServiceinDataStreamParameter.length(_length);
-#ifndef WNT
+#ifndef WIN32
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
#else
for (ind2 = 0; ind2 < _length ; ind2 ++)
// if(MYDEBUG) SCRUTE(_length);
S_corba.ServiceoutDataStreamParameter.length(_length);
-#ifndef WNT
+#ifndef WIN32
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
#else
for (ind2 = 0; ind2 < _length ; ind2 ++)
}
// Parse if a computer name is twice in the list of computers
-#ifndef WNT
for (unsigned int ind = 0; ind < _machine_list.size(); ind++)
-#else
- for (ind = 0; ind < _machine_list.size(); ind++)
-#endif
{
for (unsigned int ind1 = ind+1 ; ind1 < _machine_list.size(); ind1++)
{
#ifndef _SALOME_NOTIFICATION_SWIG_HXX_
#define _SALOME_NOTIFICATION_SWIG_HXX_
-#ifdef WNT
- #if defined NOTIFICATION_SWIG_EXPORTS
- #if defined WIN32
- #define NOTIFICATION_SWIG_EXPORT __declspec( dllexport )
- #else
- #define NOTIFICATION_SWIG_EXPORT
- #endif
- #else
- #if defined WIN32
- #define NOTIFICATION_SWIG_EXPORT __declspec( dllimport )
- #else
- #define NOTIFICATION_SWIG_EXPORT
- #endif
- #endif
+#ifdef WIN32
+# ifdef NOTIFICATION_SWIG_EXPORTS
+# define NOTIFICATION_SWIG_EXPORT __declspec( dllexport )
+# else
+# define NOTIFICATION_SWIG_EXPORT __declspec( dllimport )
+# endif
#else
- #define NOTIFICATION_SWIG_EXPORT
+# define NOTIFICATION_SWIG_EXPORT
#endif
#endif
salomeinclude_HEADERS =\
SALOME_NamingService.hxx \
ServiceUnreachable.hxx \
- NamingService_WaitForServerReadiness.hxx
+ NamingService_WaitForServerReadiness.hxx \
+ SALOME_NamingService_defs.hxx
# Scripts to be exported
dist_salomescript_DATA =\
break; // server found, no more try to do
}
MESSAGE("Server "<< serverName <<" not yet ready, waiting...");
-#ifndef WNT
+#ifndef WIN32
nanosleep(&ts_req,&ts_rem); // wait before retry
#else
Sleep(TIMESleep/1000000);
catch( ServiceUnreachable& )
{
MESSAGE("CORBA::COMM_FAILURE: Naming Service not yet ready, waiting...");
-#ifndef WNT
+#ifndef WIN32
nanosleep(&ts_req,&ts_rem); // wait before retry
#else
Sleep(TIMESleep/1000000);
#include "Utils_Mutex.hxx"
#include "ServiceUnreachable.hxx"
-#ifdef WIN32
-# ifdef NAMINGSERVICE_EXPORTS
-# define NAMINGSERVICE_EXPORT __declspec( dllexport )
-# else
-# define NAMINGSERVICE_EXPORT __declspec( dllimport )
-# endif
-#else
-# define NAMINGSERVICE_EXPORT
-#endif
+#include "SALOME_NamingService_defs.hxx"
class NAMINGSERVICE_EXPORT SALOME_NamingService
{
--- /dev/null
+// SALOME NamingService : wrapping NamingService services
+//
+// 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 : SALOME_NamingService_defs.hxx
+// Author : Alexander A. BORODIN
+// Module : SALOME
+// $Header$
+
+#ifndef SALOME_NAMINGSERVICE_DEFS_HXX
+#define SALOME_NAMINGSERVICE_DEFS_HXX
+
+#ifdef WIN32
+# ifdef NAMINGSERVICE_EXPORTS
+# define NAMINGSERVICE_EXPORT __declspec( dllexport )
+# else
+# define NAMINGSERVICE_EXPORT __declspec( dllimport )
+# endif
+#else
+# define NAMINGSERVICE_EXPORT
+#endif
+
+#endif //SALOME_NAMINGSERVICE_DEFS_HXX
#if !defined ( SERVICEUNREACHABLE_H )
#define SERVICEUNREACHABLE_H
-#if defined NAMINGSERVICE_EXPORTS
-#if defined WNT
-#define NAMINGSERVICE_EXPORT __declspec( dllexport )
-#else
-#define NAMINGSERVICE_EXPORT
-#endif
-#else
-#if defined WNT
-#define NAMINGSERVICE_EXPORT __declspec( dllimport )
-#else
-#define NAMINGSERVICE_EXPORT
-#endif
-#endif
-
+#include "SALOME_NamingService_defs.hxx"
#include "Utils_SALOME_Exception.hxx"
//! exception class for NamingService : ServiceUnreachable
#ifndef _SALOME_NOTIFICATION_HXX_
#define _SALOME_NOTIFICATION_HXX_
-#ifdef WNT
- #if defined NOTIFICATION_EXPORTS
- #if defined WIN32
- #define NOTIFICATION_EXPORT __declspec( dllexport )
- #else
- #define NOTIFICATION_EXPORT
- #endif
- #else
- #if defined WIN32
- #define NOTIFICATION_EXPORT __declspec( dllimport )
- #else
- #define NOTIFICATION_EXPORT
- #endif
- #endif
+#ifdef WIN32
+# ifdef NOTIFICATION_EXPORTS
+# define NOTIFICATION_EXPORT __declspec( dllexport )
+# else
+# define NOTIFICATION_EXPORT __declspec( dllimport )
+# endif
#else
- #define NOTIFICATION_EXPORT
+# define NOTIFICATION_EXPORT
#endif
#endif
#include "SALOME_ParallelComponent_i.hxx"
#include "SALOME_ParallelContainer_i.hxx"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
#include <stdio.h>
-#ifndef WNT
+#ifndef WIN32
#include <dlfcn.h>
#endif
#include <cstdlib>
#include "utilities.h"
-#ifndef WNT
+#ifndef WIN32
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
// << dec ) ;
bool RetVal = false ;
-#ifndef WNT
+#ifndef WIN32
if ( _ThreadId > 0 && pthread_self() != _ThreadId )
{
RetVal = Killer( _ThreadId , 0 ) ;
MESSAGE("Engines_Parallel_Component_i::Stop_i() pthread_t "<< pthread_self()
<< " pid " << getpid() << " instanceName "
<< _instanceName.c_str() << " interface " << _interfaceName.c_str()
- << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
<< dec << " _ThreadId " << _ThreadId );
bool RetVal = false ;
-#ifndef WNT
+#ifndef WIN32
if ( _ThreadId > 0 && pthread_self() != _ThreadId )
{
RetVal = Killer( _ThreadId , 0 ) ;
MESSAGE("Engines_Parallel_Component_i::Suspend_i() pthread_t "<< pthread_self()
<< " pid " << getpid() << " instanceName "
<< _instanceName.c_str() << " interface " << _interfaceName.c_str()
- << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
<< dec << " _ThreadId " << _ThreadId );
bool RetVal = false ;
-#ifndef WNT
+#ifndef WIN32
if ( _ThreadId > 0 && pthread_self() != _ThreadId )
#else
if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p )
}
else
{
-#ifndef WNT
+#ifndef WIN32
RetVal = Killer( _ThreadId ,SIGINT ) ;
#else
RetVal = Killer( *_ThreadId ,SIGINT ) ;
MESSAGE("Engines_Parallel_Component_i::Resume_i() pthread_t "<< pthread_self()
<< " pid " << getpid() << " instanceName "
<< _instanceName.c_str() << " interface " << _interfaceName.c_str()
- << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
<< dec << " _ThreadId " << _ThreadId );
bool RetVal = false ;
-#ifndef WNT
+#ifndef WIN32
if ( _ThreadId > 0 && pthread_self() != _ThreadId )
#else
if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p )
{
if ( _ThreadId > 0 )
{
-#ifndef WNT
+#ifndef WIN32
if ( pthread_self() != _ThreadId )
#else
if ( pthread_self().p != _ThreadId->p )
{
// Get Cpu in the appropriate thread with that object !...
theEngines_Component = this ;
-#ifndef WNT
+#ifndef WIN32
Killer( _ThreadId ,SIGUSR1 ) ;
#else
Killer( *_ThreadId ,SIGUSR11 ) ;
{
MESSAGE(pthread_self() << "Send BeginService notification for " <<serviceName
<< endl << "Component instance : " << _instanceName << endl << endl);
-#ifndef WNT
+#ifndef WIN32
_ThreadId = pthread_self() ;
#else
_ThreadId = new pthread_t;
bool Engines_Parallel_Component_i::Killer( pthread_t ThreadId , int signum )
{
-#ifndef WNT
+#ifndef WIN32
if ( ThreadId )
#else
if ( ThreadId.p )
long Engines_Parallel_Component_i::CpuUsed()
{
long cpu = 0 ;
-#ifndef WNT
+#ifndef WIN32
struct rusage usage ;
if ( _ThreadId || _Executed )
{
#include <iostream>
#include <signal.h>
#include <stdlib.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#endif
#include <sys/types.h>
class Engines_Parallel_Container_i;
-#if defined CONTAINER_EXPORTS
-#if defined WIN32
-#define CONTAINER_EXPORT __declspec( dllexport )
+#ifdef WIN32
+# ifdef CONTAINER_EXPORTS
+# define CONTAINER_EXPORT __declspec( dllexport )
+# else
+# define CONTAINER_EXPORT __declspec( dllimport )
+# endif
#else
-#define CONTAINER_EXPORT
-#endif
-#else
-#if defined WNT
-#define CONTAINER_EXPORT __declspec( dllimport )
-#else
-#define CONTAINER_EXPORT
-#endif
+# define CONTAINER_EXPORT
#endif
class CONTAINER_EXPORT Engines_Parallel_Component_i:
char * _proxy;
private:
-#ifndef WNT
+#ifndef WIN32
pthread_t _ThreadId ;
#else
pthread_t* _ThreadId ;
#include <string>
#include <stdio.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#else
#include <process.h>
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
#include "SALOMETraceCollector.hxx"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
using namespace std;
PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
PortableServer::POAManager_var pman = root_poa->the_POAManager();
-#ifndef WNT
+#ifndef WIN32
// add this container to the kill list
char aCommand[100];
sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerNode", getpid());
obj = root_poa->id_to_reference(*_id);
// In the NamingService
- string hostname = GetHostname();
+ string hostname = Kernel_Utils::GetHostname();
int myid = 0;
char buffer [5];
snprintf(buffer, 5, "%d", myid);
#include <string>
#include <stdio.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#else
#include <process.h>
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
#include "SALOMETraceCollector.hxx"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
using namespace std;
PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
PortableServer::POAManager_var pman = root_poa->the_POAManager();
-#ifndef WNT
+#ifndef WIN32
// add this container to the kill list
char aCommand[100];
sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerNodeMpi", getpid());
obj = root_poa->id_to_reference(*_id);
// In the NamingService
- string hostname = GetHostname();
+ string hostname = Kernel_Utils::GetHostname();
int myid;
MPI_Comm_rank(MPI_COMM_WORLD, &myid);
#include <string>
#include <stdio.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#else
#include <process.h>
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
#include "SALOMETraceCollector.hxx"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
#ifdef DEBUG_PARALLEL
#include <signal.h>
PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
PortableServer::POAManager_var pman = root_poa->the_POAManager();
-#ifndef WNT
+#ifndef WIN32
// add this container to the kill list
char aCommand[100];
sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerProxyDummy", getpid());
obj = root_poa->id_to_reference(_id);
// In the NamingService
- string hostname = GetHostname();
+ string hostname = Kernel_Utils::GetHostname();
Engines::Container_var pCont = Engines::Container::_narrow(obj);
string _containerName = ns->BuildContainerNameForNS(containerName.c_str(),
hostname.c_str());
#include <string>
#include <stdio.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#else
#include <process.h>
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
#include "SALOMETraceCollector.hxx"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
using namespace std;
#ifdef DEBUG_PARALLEL
PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
PortableServer::POAManager_var pman = root_poa->the_POAManager();
-#ifndef WNT
+#ifndef WIN32
// add this container to the kill list
char aCommand[100];
sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerProxyMpi", getpid());
obj = root_poa->id_to_reference(_id);
// in the NamingService
- string hostname = GetHostname();
+ string hostname = Kernel_Utils::GetHostname();
Engines::Container_var pCont = Engines::Container::_narrow(obj);
string _containerName = ns->BuildContainerNameForNS(containerName.c_str(),
hostname.c_str());
// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
#include <SALOMEconfig.h>
-#ifndef WNT
+#ifndef WIN32
#else
#include <SALOME_Component.hxx>
#endif
#include "SALOME_FileRef_i.hxx"
#include "SALOME_FileTransfer_i.hxx"
#include "SALOME_NamingService.hxx"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
-#include "OpUtil.hxx"
#include <string.h>
#include <stdio.h>
-#ifndef WNT
+#ifndef WIN32
#include <dlfcn.h>
#include <unistd.h>
#else
// Other Containers are started via start_impl of FactoryServer
extern "C" {void ActSigIntHandler() ; }
-#ifndef WNT
+#ifndef WIN32
extern "C" {void SigIntHandler(int, siginfo_t *, void *) ; }
#else
extern "C" {void SigIntHandler( int ) ; }
_argc = argc ;
_argv = argv ;
- string hostname = GetHostname();
+ string hostname = Kernel_Utils::GetHostname();
_orb = CORBA::ORB::_duplicate(orb) ;
_poa = PortableServer::POA::_duplicate(poa) ;
char* Engines_Parallel_Container_i::getHostName()
{
- string s = GetHostname();
+ string s = Kernel_Utils::GetHostname();
MESSAGE("Engines_Parallel_Container_i::getHostName " << s);
return CORBA::string_dup(s.c_str()) ;
}
string aCompName = componentName;
// --- try dlopen C++ component
-#ifndef WNT
+#ifndef WIN32
string impl_name = string ("lib") + aCompName + string("Engine.so");
#else
string impl_name = aCompName + string("Engine.dll");
}
void* handle;
-#ifndef WNT
+#ifndef WIN32
handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ;
#else
handle = dlopen( impl_name.c_str() , 0 ) ;
}
//--- try C++
-#ifndef WNT
+#ifndef WIN32
string impl_name = string ("lib") + aCompName +string("Engine.so");
#else
string impl_name = aCompName +string("Engine.dll");
{
MESSAGE("Engines_Parallel_Container_i::Kill() pid "<< getpid() << " containerName "
<< _containerName.c_str() << " machineName "
- << GetHostname().c_str());
+ << Kernel_Utils::GetHostname().c_str());
INFOS("===============================================================");
INFOS("= REMOVE calls to Kill_impl in C++ container =");
INFOS("===============================================================");
string instanceName = aGenRegisterName + "_inst_" + aNumI ;
string component_registerName = _containerName + "/" + instanceName;
- string hostname = GetHostname();
+ string hostname = Kernel_Utils::GetHostname();
CORBA::Object_var temp = _NS->Resolve(component_registerName.c_str());
Engines::Component_var obj_proxy = Engines::Component::_narrow(temp);
void ActSigIntHandler()
{
-#ifndef WNT
+#ifndef WIN32
struct sigaction SigIntAct ;
SigIntAct.sa_sigaction = &SigIntHandler ;
SigIntAct.sa_flags = SA_SIGINFO ;
// (SIGINT | SIGUSR1) :
// it must be only one signal ===> one call for SIGINT
// and an other one for SIGUSR1
-#ifndef WNT
+#ifndef WIN32
if ( sigaction( SIGINT , &SigIntAct, NULL ) ) {
perror("SALOME_Container main ") ;
exit(0) ;
void SetCpuUsed() ;
-#ifndef WNT
+#ifndef WIN32
void SigIntHandler(int what , siginfo_t * siginfo ,
void * toto ) {
//PAL9042 JR : during the execution of a Signal Handler (and of methods called through Signal Handlers)
return ;
}
}
-#else // Case WNT
+#else // Case WIN32
void SigIntHandler( int what ) {
MESSAGE( pthread_self() << "SigIntHandler what " << what << endl );
if ( _Sleeping ) {
#include <iostream>
#include <signal.h>
#include <stdlib.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#endif
#include <sys/types.h>
class SALOME_NamingService;
-
-#if defined CONTAINER_EXPORTS
-#if defined WIN32
-#define CONTAINER_EXPORT __declspec( dllexport )
-#else
-#define CONTAINER_EXPORT
-#endif
+#ifdef WIN32
+# ifdef CONTAINER_EXPORTS
+# define CONTAINER_EXPORT __declspec( dllexport )
+# else
+# define CONTAINER_EXPORT __declspec( dllimport )
+# endif
#else
-#if defined WNT
-#define CONTAINER_EXPORT __declspec( dllimport )
-#else
-#define CONTAINER_EXPORT
-#endif
+# define CONTAINER_EXPORT
#endif
class CONTAINER_EXPORT Engines_Parallel_Container_i: