Salome HOME
sources v1.2c
[modules/visu.git] / src / VISU_I / VISUConfig.hh
index 9b73f0590a44491ac9c92e32aaded65f49b2dc9f..68f5d16c9c7dccecc80d8dfdf3eaadb1ba8bb4dc 100644 (file)
@@ -1,24 +1,43 @@
-// File:       VISU_Common.hh
-// Created:    Tue Dec 24 17:13:35 2002
-// Author:     Alexey PETROV
-//             <apo@ivanox.nnov.matra-dtv.fr>
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  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   : VISUConfig.hh
+//  Author : Alexey PETROV
+//  Module : VISU
 
 #ifndef __VISU_CONFIG_H__
 #define __VISU_CONFIG_H__
 
 // standard C++ headers
 #include <stdio.h>
-#include <iostream.h>
+#include <iostream>
 #include <string>
 #include <qstring.h> 
 #include <qthread.h> 
 #include <qfileinfo.h>
 #include <qapplication.h>
 
-using namespace std;
 // IDL headers
-#include <SALOMEconfig.h>
+#include "SALOMEconfig.h"
 #include CORBA_SERVER_HEADER(VISU_Gen)
 #include CORBA_SERVER_HEADER(MED)
 #include CORBA_SERVER_HEADER(SALOMEDS)
@@ -29,18 +48,19 @@ using namespace std;
 #include "utilities.h"
 
 #include <stdexcept>
-#include <strstream>   
+#include <sstream>     
 
 namespace VISU{
   //===========================================================================
   class VISU_Gen_i;
+
   class Base_i : public virtual POA_VISU::Base,
                  public virtual PortableServer::RefCountServantBase
   {
   public:
     virtual ~Base_i();
     virtual char* GetID();
-    virtual VISU::VISUType GetType()=0;
+    virtual VISU::VISUType GetType() = 0;
   protected:
     static QMutex* myMutex;
     static CORBA::ORB_var myOrb;
@@ -54,52 +74,62 @@ namespace VISU{
     static SALOME_NamingService* GetNS() { return myNamingService;}
     static SALOME_LifeCycleCORBA* GetLCC() { return myEnginesLifeCycle;}
     static VISU_Gen_i* GetVisuGenImpl() { return myVisuGenImpl;}
-    static VISU_Gen_var GetVisuGenInter();
   };
+
+
   //===========================================================================
   class Mutex{
     QMutex* myMutex;
     QApplication* myQApp;
-    int isQAppLocked, isSessionLocked;
+    int isQAppLocked, isSessionLocked, myDelay;
   public:
-    Mutex(QMutex* theMutex, QApplication* theQApp);
+    Mutex(QMutex* theMutex, QApplication* theQApp, int theDelay = 0);
     ~Mutex();
   };
+
+
   //===========================================================================
   class Storable : public virtual Base_i {
   protected:
-    virtual void ToStream(ostrstream& theStr) = 0;
+    virtual void ToStream(std::ostringstream& theStr) = 0;
   public:
-    string ToString();
+    std::string ToString();
     virtual const char* GetComment() const = 0;
-    typedef map<string,QString> TRestoringMap;
+    typedef std::map<std::string,QString> TRestoringMap;
     typedef Storable* (*TStorableEngine)(SALOMEDS::SObject_ptr theSObject, 
-                                        const string& thePrefix, const TRestoringMap& theMap);
-    typedef map<string,TStorableEngine> TCallbackMap;
+                                        const std::string& thePrefix, const TRestoringMap& theMap);
+    typedef std::map<string,TStorableEngine> TCallbackMap;
     static void Registry(const char* theComment, TStorableEngine theEngine) 
       throw(std::logic_error&);
-    static Storable* Create(SALOMEDS::SObject_ptr, const string& thePrefix, const string& theString) 
+    static Storable* Create(SALOMEDS::SObject_ptr, const std::string& thePrefix, const std::string& theString) 
       throw(std::runtime_error&);
-    static const QString& FindValue(const TRestoringMap& theMap, const string& theArg, bool* isFind = NULL)
+    static const QString& FindValue(const TRestoringMap& theMap, const std::string& theArg, bool* isFind = NULL)
       throw(std::logic_error&);
     static void StrToMap(const QString& theStr, VISU::Storable::TRestoringMap& theMap);
     static SALOMEDS::SObject_ptr GetResultSO(SALOMEDS::SObject_ptr theSObject);
-    static void DataToStream(ostrstream& theStr, const QString& theName, const QString& theVal);
-    static void DataToStream(ostrstream& theStr, const QString& theName, const int theVal);
-    static void DataToStream(ostrstream& theStr, const QString& theName, const double theVal);
+    static void DataToStream(std::ostringstream& theStr, const QString& theName, const QString& theVal);
+    static void DataToStream(std::ostringstream& theStr, const QString& theName, const int theVal);
+    static void DataToStream(std::ostringstream& theStr, const QString& theName, const double theVal);
   };
+
+
   //===========================================================================
   const CORBA::Boolean IsMultifile();
+  QString GenerateName(const string& theFmt, int theId);
+
   PortableServer::Servant GetServant(CORBA::Object_ptr theObject);
   CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr theSObject);
+
   SALOMEDS::SComponent_var FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument);
-  string CreateAttributes(SALOMEDS::Study_ptr theStudyDocument, 
-                         const char* theFatherEntry, const char* theRefFatherEntry,
-                         const char* theIOR, const char* theName, 
-                         const char* thePersistentRef, const char* theComment,
-                         CORBA::Boolean theCreateNew = true);
-  string FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, const char* theStartEntry,
-                             const char* theComment, int IsAllLevels = true);
+
+  std::string CreateAttributes(SALOMEDS::Study_ptr theStudyDocument, 
+                              const char* theFatherEntry, const char* theRefFatherEntry,
+                              const char* theIOR, const char* theName, 
+                              const char* thePersistentRef, const char* theComment,
+                              CORBA::Boolean theCreateNew = true);
+
+  std::string FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, const char* theStartEntry,
+                                  const char* theComment, int IsAllLevels = true);
 }
 
 #endif