Salome HOME
Issue 0020194: EDF 977 ALL: Get rid of warnings PACKAGE_VERSION already defined
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_Study_i.hxx
index 18b9ef8fbc2cbbdb74eb7b0205374440bcc3d092..307f09fb2cf745227bd40cedadaf765c532a743e 100644 (file)
-//  SALOME SALOMEDS : data structure of SALOME and sources of Salome data server 
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  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 
+//  Copyright (C) 2003-2007  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   : SALOMEDS_Study_i.hxx
-//  Author : Yves FRICAUD
+//  Author : Sergey RUIN
 //  Module : SALOME
-//  $Header$
-
+//
 #ifndef __SALOMEDS_STUDY_I_H__
 #define __SALOMEDS_STUDY_I_H__
 
 // std C++ headers
-#include <map>
-#include <string>
+#include <iostream>
 
 // IDL headers
 #include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOME_GenericObj)
 #include CORBA_SERVER_HEADER(SALOMEDS)
 
-// Cascade headers
-#include <TDF_Tool.hxx>
-#include <TDF_Data.hxx>
-#include <TDF_Label.hxx>
-#include <TDocStd_Document.hxx>
-#include <TColStd_SequenceOfInteger.hxx>
-#include <TColStd_SequenceOfAsciiString.hxx>
+#include <stdio.h>
 
 //SALOMEDS headers
-#include "SALOMEDS_DataMapStringLabel.hxx"
-#include "SALOMEDS_IORAttribute.hxx"
-
 #include "SALOMEDS_SComponentIterator_i.hxx"
-#include "SALOMEDS_ChildIterator_i.hxx"
-
-class SALOMEDS_StudyManager_i;
-class SALOMEDS_UseCaseBuilder_i;
-class SALOMEDS_StudyBuilder_i;
-class SALOMEDS_SObject_i;
+#include "SALOMEDS_StudyBuilder_i.hxx"
+#include "SALOMEDS_SObject_i.hxx"
+#include "SALOMEDS_UseCaseBuilder_i.hxx"
 
+#include "SALOMEDSImpl_Study.hxx"
+#include "SALOMEDSImpl_AttributeIOR.hxx"
 
-bool operator<(const TDF_Label& theLeft, const TDF_Label& theRight);
-
-
-class SALOMEDS_Study_i: public virtual POA_SALOMEDS::Study,
-                       public virtual PortableServer::RefCountServantBase 
+class Standard_EXPORT SALOMEDS_Study_i: public POA_SALOMEDS::Study
 {
+private:
+  CORBA::ORB_ptr                 _orb;
+  SALOMEDSImpl_Study*            _impl;  
+  SALOMEDS_StudyBuilder_i*       _builder;    
+
 public:
-  typedef TDF_Label TSObjectID;
-  typedef std::pair<SALOMEDS_SObject_i*,SALOMEDS::SObject_var> TSObjectHolder;
-  typedef std::map<TSObjectID,TSObjectHolder> TSObjectMap;
 
-  SALOMEDS_Study_i(SALOMEDS_StudyManager_i* theStudyManager,
-                  const Handle(TDocStd_Document)& theDoc,
-                  const char* theStudyName);
+  //! standard constructor
+  SALOMEDS_Study_i(SALOMEDSImpl_Study*, CORBA::ORB_ptr);
   
+  //! standard destructor
   virtual ~SALOMEDS_Study_i(); 
   
-
-  SALOMEDS_StudyManager_i* GetStudyManager(){ return _StudyManager; }
-
-  Handle(TDocStd_Document) GetDocument(){ return _doc; }
-
-  TSObjectMap& GetSObjectMap(){ return mySObjectMap;}
-
-  CORBA::ORB_var GetORB() const;
-
-  PortableServer::POA_var GetPOA() const;
-
-  SALOMEDS_SObject_i* DownCast(SALOMEDS::SObject_ptr theSObject) const;
-
-  SALOMEDS::Callback_ptr SetOnAddSObject(SALOMEDS::Callback_ptr theCallback);
-
-  SALOMEDS::Callback_ptr SetOnRemoveSObject(SALOMEDS::Callback_ptr theCallback);
-
-  void OnAddSObject(SALOMEDS::SObject_ptr theObject);
-
-  void OnRemoveSObject(SALOMEDS::SObject_ptr theObject);
-
-  void CheckLocked();
-
-
-  virtual char* ConvertObjectToIOR(CORBA::Object_ptr theObject);
-
-  virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR);
-
   //! method to Get persistent reference of study (idem URL())
   /*!
     \sa URL()
@@ -225,20 +182,17 @@ public:
     \return ChildIterator_ptr arguments, the created ChildIterator
   */  
   virtual SALOMEDS::ChildIterator_ptr NewChildIterator(SALOMEDS::SObject_ptr aSO);
-  SALOMEDS_ChildIterator_i GetChildIterator(SALOMEDS::SObject_ptr theSObject);
 
   //! method to Create a SComponentIterator 
   /*!
     \return SComponentIterator_ptr arguments, the created SComponentIterator
   */  
   virtual SALOMEDS::SComponentIterator_ptr NewComponentIterator();
-  SALOMEDS_SComponentIterator_i GetComponentIterator();
 
   //! method to Create a StudyBuilder
   /*!
     \return StudyBuilder_ptr arguments, the created StudyBuilder
   */  
-  SALOMEDS_StudyBuilder_i* GetBuilder();
   virtual SALOMEDS::StudyBuilder_ptr NewBuilder();
  
   //! method to get study name
@@ -271,6 +225,9 @@ public:
   */
   virtual CORBA::Boolean IsModified();
 
+ //! method to set Modified flag of a Study to True
+  virtual void Modified();
+
   //! method to get URL of the study (idem GetPersistentReference) 
   /*!
     \return char* arguments, the study URL 
@@ -286,73 +243,95 @@ public:
   virtual CORBA::Short StudyId();
   virtual void  StudyId(CORBA::Short id);
 
-  void IORUpdated(const Handle(SALOMEDS_IORAttribute) theAttribute);
+  static SALOMEDS::Study_ptr GetStudy(const DF_Label& theLabel, CORBA::ORB_ptr orb);
+
+  static void IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute);
 
   virtual void UpdateIORLabelMap(const char* anIOR, const char* aLabel);
   
   virtual SALOMEDS::Study::ListOfSObject* FindDependances(SALOMEDS::SObject_ptr anObject);
 
-  virtual SALOMEDS::AttributeStudyProperties_ptr SALOMEDS_Study_i::GetProperties();
+  virtual SALOMEDS::AttributeStudyProperties_ptr GetProperties();
 
   virtual char* GetLastModificationDate();
 
   virtual SALOMEDS::ListOfDates* GetModificationsDate();
 
+  virtual char* ConvertObjectToIOR(CORBA::Object_ptr theObject) {return _orb->object_to_string(theObject); }
+  virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); };
+
   virtual SALOMEDS::UseCaseBuilder_ptr GetUseCaseBuilder();
 
   virtual void Close();
 
-  void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled) { _autoFill = isEnabled; }
+  void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled)
 
   // postponed destroying of CORBA object functionality
   virtual void AddPostponed(const char* theIOR);
 
   virtual void AddCreatedPostponed(const char* theIOR);
 
+#ifndef WIN32
   virtual void RemovePostponed(const CORBA::Long theUndoLimit); // removes postponed IORs of old transaction
                                                         // if theUndoLimit==0, removes all
   virtual void UndoPostponed(const CORBA::Long theWay); // theWay = 1: resurrect objects,
                                                 // theWay = -1: get back to the list of postponed
-private:
-  friend class SALOMEDS_StudyBuilder_i;
-  friend class SALOMEDS_SObject_i;
-  SALOMEDS_StudyManager_i* _StudyManager;
+#else
+  virtual void RemovePostponed(CORBA::Long theUndoLimit); // removes postponed IORs of old transaction
+                                                        // if theUndoLimit==0, removes all
+  virtual void UndoPostponed(CORBA::Long theWay); // theWay = 1: resurrect objects,
+                                                // theWay = -1: get back to the list of postponed
+#endif
 
-  TSObjectMap mySObjectMap;
+  virtual SALOMEDS::AttributeParameter_ptr GetCommonParameters(const char* theID, CORBA::Long theSavePoint);
+  virtual SALOMEDS::AttributeParameter_ptr GetModuleParameters(const char* theID, 
+                                                              const char* theModuleName, 
+                                                              CORBA::Long theSavePoint);
 
-  SALOMEDS_UseCaseBuilder_i* _UseCaseBuilder;
-  SALOMEDS_StudyBuilder_i* _Builder;
-  SALOMEDS::Callback_var   _callbackOnAdd;
-  SALOMEDS::Callback_var   _callbackOnRemove;
+  virtual void SetStudyLock(const char* theLockerID);
 
-  char*                    _name;  
-  Handle(TDocStd_Document) _doc;  // OCAF Document
-  CORBA::Boolean           _isSaved; // True if the Study is saved
-  char*                    _URL; //URL of the persistent reference of the study
-  CORBA::Short             _StudyId;
+  virtual bool IsStudyLocked();
 
-  SALOMEDS_DataMapStringLabel myIORLabels;
+  virtual void UnLockStudy(const char* theLockerID);
 
-  // data structures for postponed destroying of CORBA object functionality
-  TColStd_SequenceOfAsciiString myPostponedIORs; // ordered set of IORs
-  TColStd_SequenceOfInteger myNbPostponed; // number of IOR in the each transaction
-  int myNbUndos; // number of current Undos, made by user
+  virtual SALOMEDS::ListOfStrings* GetLockerID();
 
-  TDF_Label                _current;
-  bool                     _autoFill;  
+  virtual void SetReal(const char* theVarName, CORBA::Double theValue);
+  
+  virtual void SetInteger(const char* theVarName, CORBA::Long theValue);
 
-  SALOMEDS::SObject_ptr    _FindObject(TDF_Label theLabel,
-                                      const char* theObjectIOR, 
-                                      bool& theIsFound);
-  SALOMEDS::SObject_ptr    _FindObjectIOR(TDF_Label theLabel,
-                                         const char* theObjectIOR, 
-                                         bool& theIsFound);
+  virtual void SetBoolean(const char* theVarName, CORBA::Boolean theValue);
 
-  SALOMEDS_Study_i(); // Not implemented
-  void operator=(const SALOMEDS_Study_i&); // Not implemented
+  virtual CORBA::Double GetReal(const char* theVarName);
+  
+  virtual CORBA::Long GetInteger(const char* theVarName);
 
-};
+  virtual CORBA::Boolean GetBoolean(const char* theVarName);
 
+  virtual CORBA::Boolean IsReal(const char* theVarName);
+  
+  virtual CORBA::Boolean IsInteger(const char* theVarName);
+
+  virtual CORBA::Boolean IsBoolean(const char* theVarName);
+
+  virtual CORBA::Boolean IsVariable(const char* theVarName);
+
+  virtual SALOMEDS::ListOfStrings* GetVariableNames();
+
+  virtual CORBA::Boolean RemoveVariable(const char* theVarName);
+
+  virtual CORBA::Boolean RenameVariable(const char* theVarName, const char* theNewVarName);
 
+  virtual CORBA::Boolean IsVariableUsed(const char* theVarName);
+  
+  virtual SALOMEDS::ListOfListOfStrings* ParseVariables(const char* theVars);
+
+  virtual char* GetDefaultScript(const char* theModuleName, const char* theShift);
+
+  virtual CORBA::Boolean DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished);
+
+  virtual SALOMEDSImpl_Study* GetImpl() { return _impl; }
+
+  virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
+};
 #endif