From 1dc75a6e2025dc6419695f9e413449ccce8f1a3b Mon Sep 17 00:00:00 2001 From: prascle Date: Fri, 22 Oct 2004 12:36:45 +0000 Subject: [PATCH] PR: manual correction while merge PAL_OCC to HEAD --- src/OBJECT/VTKViewer_Common.h | 70 ------ src/OCCViewer/OCCViewer_Selector.cxx | 71 ------- src/OCCViewer/OCCViewer_Selector.h | 66 ------ src/SALOMEDS/SALOMEDS_Tool.cxx | 306 --------------------------- src/SALOMEDS/SALOMEDS_Tool.hxx | 53 ----- src/Utils/Utils_CatchSignals.cxx | 236 --------------------- src/Utils/Utils_CatchSignals.h | 60 ------ 7 files changed, 862 deletions(-) delete mode 100755 src/OBJECT/VTKViewer_Common.h delete mode 100644 src/OCCViewer/OCCViewer_Selector.cxx delete mode 100644 src/OCCViewer/OCCViewer_Selector.h delete mode 100644 src/SALOMEDS/SALOMEDS_Tool.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_Tool.hxx delete mode 100644 src/Utils/Utils_CatchSignals.cxx delete mode 100644 src/Utils/Utils_CatchSignals.h diff --git a/src/OBJECT/VTKViewer_Common.h b/src/OBJECT/VTKViewer_Common.h deleted file mode 100755 index 6f6eb4b88..000000000 --- a/src/OBJECT/VTKViewer_Common.h +++ /dev/null @@ -1,70 +0,0 @@ -// File : VTKViewer_Common.h -// Created : Wed May 21 11:36:07 2003 -// Author : Michael PONIKAROV -// Project : SALOME -// Module : VTKViewer -// Copyright : Open CASCADE 2002 -// $Header$ - -#ifndef __VTKViewer_Common_h -#define __VTKViewer_Common_h - -// common vtk include files -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif diff --git a/src/OCCViewer/OCCViewer_Selector.cxx b/src/OCCViewer/OCCViewer_Selector.cxx deleted file mode 100644 index e037b6b35..000000000 --- a/src/OCCViewer/OCCViewer_Selector.cxx +++ /dev/null @@ -1,71 +0,0 @@ -// SALOME OCCViewer : build OCC Viewer into Salome desktop -// -// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : OCCViewer_Selector.cxx -// Author : Nicolas REJNERI -// Module : SALOME -// $Header$ - -using namespace std; -/*! - \class OCCViewer_Selector OCCViewer_Selector.h - \brief Base class for object selection in Open CASCADE Viewer. -*/ - -#include "OCCViewer_Selector.h" - -/*! - Constructor -*/ -OCCViewer_Selector::OCCViewer_Selector() : - myNumSelected (0), - myEnableSelection( true ), - myEnableMultipleSelection( true ) -{ -} - -/*! - Destructor -*/ -OCCViewer_Selector::~OCCViewer_Selector() -{ -} - -/*! - Enables/disables selection -*/ -void OCCViewer_Selector::enableSelection( bool bEnable ) -{ - myEnableSelection = bEnable; -} - -/*! - Enables/disables multiple selection i.e - selection of several objects at the same time. - If enabled, non-multiple selection is enabled as well. -*/ -void OCCViewer_Selector::enableMultipleSelection( bool bEnable ) -{ - myEnableMultipleSelection = bEnable; - if ( bEnable ) myEnableSelection = bEnable; -} diff --git a/src/OCCViewer/OCCViewer_Selector.h b/src/OCCViewer/OCCViewer_Selector.h deleted file mode 100644 index 96c960034..000000000 --- a/src/OCCViewer/OCCViewer_Selector.h +++ /dev/null @@ -1,66 +0,0 @@ -// SALOME OCCViewer : build OCC Viewer into Salome desktop -// -// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : OCCViewer_Selector.h -// Author : Nicolas REJNERI -// Module : SALOME -// $Header$ - -#ifndef OCCViewer_SELECTOR_H -#define OCCViewer_SELECTOR_H - -#include "QAD.h" - -// QT Include -#include - -// Open CASCADE Include -#include -#include - -class QAD_EXPORT OCCViewer_Selector : public QObject -{ - Q_OBJECT - - public: - OCCViewer_Selector(); - virtual ~OCCViewer_Selector(); - - public: - void enableSelection( bool ); - void enableMultipleSelection( bool ); - - signals: - - void selSelectionDone( bool bAdded ); - void selSelectionCancel( bool bAdded ); - - protected: - - int myNumSelected; - bool myEnableSelection; - bool myEnableMultipleSelection; -}; - -#endif - diff --git a/src/SALOMEDS/SALOMEDS_Tool.cxx b/src/SALOMEDS/SALOMEDS_Tool.cxx deleted file mode 100644 index 341ba99a5..000000000 --- a/src/SALOMEDS/SALOMEDS_Tool.cxx +++ /dev/null @@ -1,306 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : SALOMEDS_Tool.cxx -// Author : Sergey RUIN -// Module : SALOME - -using namespace std; -#include "SALOMEDS_Tool.hxx" - -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -//============================================================================ -// function : GetTempDir -// purpose : Return a temp directory to store created files like "/tmp/sub_dir/" -//============================================================================ -char* SALOMEDS_Tool::GetTmpDir() -{ - //Find a temporary directory to store a file - - TCollection_AsciiString aTmpDir; - - char *Tmp_dir = getenv("SALOME_TMP_DIR"); - if(Tmp_dir != NULL) { - aTmpDir = TCollection_AsciiString(Tmp_dir); -#ifdef WIN32 - if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\'; -#else - if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/'; -#endif - } - else { -#ifdef WIN32 - aTmpDir = TCollection_AsciiString("C:\\"); -#else - aTmpDir = TCollection_AsciiString("/tmp/"); -#endif - } - - 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 - TCollection_AsciiString aSubDir(aRND); - if(aSubDir.Length() <= 1) aSubDir = TCollection_AsciiString("123409876"); - - MESSAGE("#### RND " << aRND); - - aTmpDir += aSubDir; //Get RND sub directory - -#ifdef WIN32 - if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\'; -#else - if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/'; -#endif - - OSD_Path aPath(aTmpDir); - OSD_Directory aDir(aPath); - - for(aRND = 0; aDir.Exists(); aRND++) { - aTmpDir.Insert((aTmpDir.Length() - 1), TCollection_AsciiString(aRND)); //Build a unique directory name - aPath = OSD_Path(aTmpDir); - aDir = OSD_Directory(aPath); - } - - MESSAGE("#### TMP" << aTmpDir.ToCString()); - - OSD_Protection aProtection(OSD_RW, OSD_RWX, OSD_RX, OSD_RX); - aDir.Build(aProtection); - - return CORBA::string_dup(aTmpDir.ToCString()); -} - -//============================================================================ -// function : RemoveTemporaryFiles -// purpose : Removes files listed in theFileList -//============================================================================ -void SALOMEDS_Tool::RemoveTemporaryFiles(const char* theDirectory, - const SALOMEDS::ListOfFileNames& theFiles, - const bool IsDirDeleted) -{ - TCollection_AsciiString aDirName(const_cast(theDirectory)); - - int i, aLength = theFiles.length(); - for(i=0; i(theFromDirectory)); //Get a temporary directory for saved a file - - long aBufferSize = 0; - long aCurrentPos; - - int aNbFiles = 0; - int* aFileNameSize= new int[aLength]; - long* aFileSize= new long[aLength]; - - //Determine the required size of the buffer - - for(i=0; i 4) ? 4 : sizeof(int))); - - - aCurrentPos = 4; - - for(i=0; i 4) ? 4 : sizeof(int))); - aCurrentPos += 4; - - //Copy the file name to the buffer - memcpy((aBuffer + aCurrentPos), theFiles[i], aFileNameSize[i]); - aCurrentPos += aFileNameSize[i]; - - if (!theNamesOnly) { // mpv 15.01.2003: we don't copy file content to the buffer if !theNamesOnly - //Initialize 8 bytes of the buffer by 0 - memset((aBuffer + aCurrentPos), 0, 8); - //Copy the length of the file to the buffer - memcpy((aBuffer + aCurrentPos), (aFileSize + i), ((sizeof(long) > 8) ? 8 : sizeof(long))); - aCurrentPos += 8; - - aFile->seekg(0, ios::beg); - aFile->read((char *)(aBuffer + aCurrentPos), aFileSize[i]); - aFile->close(); - delete(aFile); - aCurrentPos += aFileSize[i]; - } - } - - delete[] aFileNameSize; - delete[] aFileSize; - - - CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer; - - return (new SALOMEDS::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1)); -} - -//============================================================================ -// function : PutStreamToFile -// purpose : converts the stream "theStream" to the files -//============================================================================ -SALOMEDS::ListOfFileNames* -SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream, - const char* theToDirectory, - const int theNamesOnly) -{ - if(theStream.length() == 0) return NULL; - TCollection_AsciiString aTmpDir(const_cast(theToDirectory)); //Get a temporary directory for saving a file - - unsigned char *aBuffer = (unsigned char*)theStream.NP_data(); - - if(aBuffer == NULL) return NULL; - - long aBufferSize = theStream.length(); - long aFileSize, aCurrentPos = 4; - int i, aFileNameSize, aNbFiles = 0; - - //Copy the number of files in the stream - memcpy(&aNbFiles, aBuffer, sizeof(int)); - - SALOMEDS::ListOfFileNames_var aFiles = new SALOMEDS::ListOfFileNames; - aFiles->length(aNbFiles); - - for(i=0; i 4) ? 4 : sizeof(int))); - aCurrentPos += 4; - - char *aFileName = new char[aFileNameSize]; - //Put a file name to aFileName - memcpy(aFileName, (aBuffer + aCurrentPos), aFileNameSize); - aCurrentPos += aFileNameSize; - - //Put a length of the file to aFileSize - if (!theNamesOnly) { - memcpy(&aFileSize, (aBuffer + aCurrentPos), ((sizeof(long) > 8) ? 8 : sizeof(long))); - aCurrentPos += 8; - - TCollection_AsciiString aFullPath = aTmpDir + aFileName; - ofstream aFile(aFullPath.ToCString()); - aFile.write((char *)(aBuffer+aCurrentPos), aFileSize); - aFile.close(); - aCurrentPos += aFileSize; - } - aFiles[i] = CORBA::string_dup(aFileName); - delete[] aFileName; - } - - return aFiles._retn(); -} - -//============================================================================ -// function : GetNameFromPath -// purpose : Returns the name by the path -//============================================================================ -char* SALOMEDS_Tool::GetNameFromPath(const char* thePath) { - if (thePath == NULL) return strdup(""); - OSD_Path aPath = OSD_Path(TCollection_AsciiString(strdup(thePath))); - TCollection_AsciiString aNameString(aPath.Name()); - return CORBA::string_dup(aNameString.ToCString()); -} - -//============================================================================ -// function : GetDirFromPath -// purpose : Returns the dir by the path -//============================================================================ -char* SALOMEDS_Tool::GetDirFromPath(const char* thePath) { - if (thePath == NULL) return strdup(""); - OSD_Path aPath = OSD_Path(TCollection_AsciiString(strdup(thePath))); - TCollection_AsciiString aDirString(aPath.Trek()); - aDirString.ChangeAll('|','/'); - return CORBA::string_dup(aDirString.ToCString()); -} diff --git a/src/SALOMEDS/SALOMEDS_Tool.hxx b/src/SALOMEDS/SALOMEDS_Tool.hxx deleted file mode 100644 index 85557372d..000000000 --- a/src/SALOMEDS/SALOMEDS_Tool.hxx +++ /dev/null @@ -1,53 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : SALOMEDS_Tool.hxx -// Author : Sergey RUIN -// Module : SALOME - -#ifndef __SALOMEDS_Tool_H__ -#define __SALOMEDS_Tool_H__ - - - -// IDL headers -#include - -class 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 - static char* GetTmpDir(); - - - // Removes files which are in , the files for deletion are listed in - // if is true is also deleted if it is empty - static void RemoveTemporaryFiles(const char* theDirectory, - const SALOMEDS::ListOfFileNames& theFiles, - const bool IsDirDeleted); - - // Converts files listed in which are in into a byte sequence TMPFile - static SALOMEDS::TMPFile* PutFilesToStream(const char* theFromDirectory, - const SALOMEDS::ListOfFileNames& theFiles, - const int theNamesOnly = 0); - - // Converts a byte sequence to files and places them in - static SALOMEDS::ListOfFileNames* PutStreamToFiles(const SALOMEDS::TMPFile& theStream, - const char* theToDirectory, - const int theNamesOnly = 0); - - // Returns the name by the path - // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "doc1" - static char* GetNameFromPath(const char* thePath); - - // Returns the directory by the path - // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "/tmp/aaa" - static char* GetDirFromPath(const char* thePath); - -}; -#endif diff --git a/src/Utils/Utils_CatchSignals.cxx b/src/Utils/Utils_CatchSignals.cxx deleted file mode 100644 index 5ffc4f936..000000000 --- a/src/Utils/Utils_CatchSignals.cxx +++ /dev/null @@ -1,236 +0,0 @@ -// KERNEL Utils : common utils for KERNEL -// Copyright (C) 2003 CEA -// -// 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.org -// -// -// -// File : Utils_CatchSignals.cxx -// Author : Oksana Tchebanova -// Module : KERNEL -// $Header: - - -#include "Utils_CatchSignals.h" -#include "utilities.h" - -#include - -#define RESERVE_SIZE 100000 - -static void* theCallBack = NULL; -static int *myReserve = NULL; -using namespace std; -//======================================================================= -//function : Utils_CatchSignals -//purpose : Constructor -//======================================================================= -Utils_CatchSignals::Utils_CatchSignals() - :myIsActivated(false) -{ - - for(int i = 0; i -#endif - -#ifdef SOLARIS -# include -# include -# include -# include -#endif - -#include -#include - -#ifdef LIN -# include -# include -#else -# ifdef SA_SIGINFO -# ifndef AIX -# include -# endif -# endif -#endif - - -#ifdef IRIX -# include -# include -#endif - -#include -//============================================================================ -//function : Handler -//purpose : univisal handler for signals -//============================================================================ -static void Handler(const int theSig ) -{ - if (myReserve) { - delete myReserve; - myReserve = NULL; - } - char aMessage[1000]; - -#if defined __GNUC__ - #if __GNUC__ == 2 - #define __GNUC_2__ - #endif -#endif -#if defined __GNUC_2__ - const char* message = "La fonction strsignal n'est pas supportée par gcc2.95.4"; - sprintf (aMessage, "%d signal cautch : %s", theSig, message); -#else - sprintf (aMessage, "%d signal cautch : %s", theSig, strsignal(theSig)); -#endif - - - MESSAGE("Utils_CatchSignal Handler :: " << aMessage ); - if(theCallBack == NULL) { - MESSAGE("Utils_CatchSignal Handler : throw std::runtime_error()"); - throw (std::runtime_error(aMessage)); - } - else ((void (*)())theCallBack)(); -} -//======================================================================= -//function : TryHandlerReset -//purpose : Redefine signal handlers. If the handler of the signal is -// set as SIG_IGN. That's why the shells often ignore some -// signal when starting child processes. We keep it. -//======================================================================= -static SIG_PFV TryHandlerReset( int theSigNum ) -{ - if (signal(theSigNum, (SIG_PFV) &Handler) == SIG_IGN) - { - signal(theSigNum, SIG_IGN); - MESSAGE("signal "< -#define SIG_MAX_NUM 11 - -typedef void (* SIG_PFV) (int); - -class Utils_CatchSignals { - - public: - Utils_CatchSignals(); - void Destroy() ; - ~Utils_CatchSignals() - { - Destroy(); - } - - static void SetCallBack(const int theAddressHiPart,const int theAddressLowPart) ; - static void UnsetCallBack() ; - void Activate(); - void Deactivate() ; - bool ReserveMemory(); - void FreeReserved(); - -private: - - SIG_PFV mySigStates[SIG_MAX_NUM]; - int myFloatOpWord; - bool myIsActivated; -}; - -#endif -- 2.39.2