-// Copyright (C) 2003 CEA/DEN, EDF R&D
+// 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.
//
-// File : VISU_Common.hh
+// 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>
-#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)
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOME_NamingService.hxx"
+#include "SALOME_LifeCycleCORBA.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
+#include "SALOMEDSClient_SObject.hxx"
+#include "SALOMEDSClient_Study.hxx"
+
+// QT headers
+#include <qstring.h>
+#include <qthread.h>
+#include <qfileinfo.h>
+#include <qapplication.h>
+
+// standard C++ headers
+#include <stdio.h>
+
+// STL headers
+#include <map>
+#include <string>
+#include <sstream>
+#include <iostream>
#include <stdexcept>
-#include <sstream>
-namespace VISU{
+class SUIT_Session;
+class SUIT_ResourceMgr;
+
+namespace VISU
+{
+
+ SUIT_Session *GetSession();
+ SUIT_ResourceMgr *GetResourceMgr();
+
//===========================================================================
+
+ class VISU_Gen_i;
+
class Base_i : public virtual POA_VISU::Base,
public virtual PortableServer::RefCountServantBase
{
public:
+ Base_i();
virtual ~Base_i();
virtual char* GetID();
virtual VISU::VISUType GetType() = 0;
+
+ protected:
+ std::string myID;
+
protected:
static QMutex* myMutex;
static CORBA::ORB_var myOrb;
- static PortableServer::POA_var myPOA;
+ static PortableServer::POA_var myPoa;
+ static SALOME_NamingService* myNamingService;
+ static VISU_Gen_i* myVisuGenImpl;
+ static SALOME_LifeCycleCORBA* myEnginesLifeCycle;
+
+ public:
+ static CORBA::ORB_var GetORB() { return myOrb;}
+ static PortableServer::POA_var GetPOA() { return myPoa;}
+ static SALOME_NamingService* GetNS() { return myNamingService;}
+ static SALOME_LifeCycleCORBA* GetLCC() { return myEnginesLifeCycle;}
+ static VISU_Gen_i* GetVisuGenImpl() { return myVisuGenImpl;}
};
+
+
//===========================================================================
class Mutex{
QMutex* myMutex;
- QApplication* myQApp;
- int isQAppLocked, isSessionLocked, myDelay;
+ int isQAppLocked;
public:
- Mutex(QMutex* theMutex, QApplication* theQApp, int theDelay = 0);
+ Mutex(QMutex* theMutex);
~Mutex();
};
+
+
//===========================================================================
class Storable : public virtual Base_i {
protected:
virtual void ToStream(std::ostringstream& theStr) = 0;
public:
- const char* ToString();
+ std::string ToString();
virtual const char* GetComment() const = 0;
- typedef map<string,QString> TRestoringMap;
- typedef Storable* (*TStorableEngine)(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const TRestoringMap& theMap);
- typedef 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)
- throw(std::runtime_error&);
- static const QString& FindValue(const TRestoringMap& theMap, const string& theArg, bool* isFind = NULL)
- throw(std::logic_error&);
+ typedef std::map<std::string,QString> TRestoringMap;
+ typedef Storable* (*TStorableEngine)(SALOMEDS::SObject_ptr theSObject,
+ const std::string& thePrefix, const TRestoringMap& theMap);
+ typedef std::map<std::string,TStorableEngine> TCallbackMap;
+ static void Registry(const char* theComment, TStorableEngine theEngine);
+ static Storable* Create(SALOMEDS::SObject_ptr, const std::string& thePrefix, const std::string& theString);
+ static QString FindValue(const TRestoringMap& theMap, const std::string& theArg, bool* isFind = NULL);
+ static QString FindValue(const TRestoringMap& theMap, const std::string& theArg, const QString& theDefaultValue);
static void StrToMap(const QString& theStr, VISU::Storable::TRestoringMap& theMap);
static SALOMEDS::SObject_ptr GetResultSO(SALOMEDS::SObject_ptr theSObject);
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);
};
+
+ //===========================================================================
+ class RemovableObject_i : public virtual POA_VISU::RemovableObject,
+ public virtual Storable
+ {
+ public:
+ virtual void RemoveFromStudy() = 0;
+ };
+
//===========================================================================
- CORBA::ORB_var GetORB();
- PortableServer::POA_var GetPOA();
- VISU_Gen_var GetVisu();
- 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);
const CORBA::Boolean IsMultifile();
+ QString GenerateName(const std::string& theFmt, int theId);
+
+ PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject);
+ CORBA::Object_var ClientSObjectToObject(_PTR(SObject) theSObject);
+ CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr);
+
+ _PTR(SComponent) ClientFindOrCreateVisuComponent(_PTR(Study) theStudyDocument);
+ SALOMEDS::SComponent_var FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument);
+
+ 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 CreateAttributes(_PTR(Study) 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);
+
+ SALOMEDS::SObject_var GetSObject(_PTR(SObject));
+ _PTR(SObject) GetClientSObject(SALOMEDS::SObject_var, _PTR(Study));
+
+ SALOMEDS::Study_var GetDSStudy(_PTR(Study));
+
+ void RemoveFromStudy(SALOMEDS::SObject_ptr theSObject,
+ bool theIsAttrOnly = true,
+ bool theDestroySubObjects = false);
+ void RemoveFromStudy(_PTR(SObject) theSObject,
+ bool theIsAttrOnly = true,
+ bool theDestroySubObjects = false);
}
#endif