From: vsv Date: Wed, 23 Apr 2014 13:27:25 +0000 (+0400) Subject: Migration to VC9 and boost::shared_ptr with connection to SALOME X-Git-Tag: V_0.2~134 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9fb117423f35d7271d96badbe4b8ec320641bc6e;p=modules%2Fshaper.git Migration to VC9 and boost::shared_ptr with connection to SALOME --- diff --git a/CMakeCommon/FindSalome.cmake b/CMakeCommon/FindSalome.cmake new file mode 100644 index 000000000..bf82cdecc --- /dev/null +++ b/CMakeCommon/FindSalome.cmake @@ -0,0 +1,12 @@ + + +SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI directory") +IF(EXISTS ${GUI_ROOT_DIR}) + SET(HAVE_SALOME YES) + + FIND_LIBRARY(LightApp LightApp ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(OCCViewer OCCViewer ${GUI_ROOT_DIR}/lib/salome) + + SET(SALOME_GUI_INCLUDE ${GUI_ROOT_DIR}/include/salome) + ADD_DEFINITIONS( -DHAVE_SALOME ) +ENDIF(EXISTS ${GUI_ROOT_DIR}) diff --git a/CMakeLists.txt b/CMakeLists.txt index dc4b8fd19..2d5d0d479 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,9 @@ SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeCommon" ${CMAKE_MODULE_PATH}) INCLUDE(Common) INCLUDE(FindQt) +INCLUDE(FindBoost) INCLUDE(FindPython) +INCLUDE(FindSalome) IF(UNIX) IF(CMAKE_COMPILER_IS_GNUCC) @@ -32,3 +34,7 @@ ADD_SUBDIRECTORY (src/PyEvent) ADD_SUBDIRECTORY (src/PyInterp) ADD_SUBDIRECTORY (src/XGUI) ADD_SUBDIRECTORY (src/GeomApp) + +#IF(${HAVE_SALOME}) +# ADD_SUBDIRECTORY (src/SalomeModule) +#ENDIF(${HAVE_SALOME}) diff --git a/build_vc9_Salome_deb.bat b/build_vc9_Salome_deb.bat new file mode 100644 index 000000000..cbf4e4927 --- /dev/null +++ b/build_vc9_Salome_deb.bat @@ -0,0 +1,19 @@ +@ECHO OFF + +REM Find absolute path to ROOT_DIR +@SET PARENT_DIR=%~dp0.. +@SET ROOT_DIR= +pushd %PARENT_DIR% +@SET ROOT_DIR=%CD% +popd + +@SET SRC_DIR=%ROOT_DIR%\sources +@SET OCC_LIB_PREFIX=d + +call %SRC_DIR%\msvc9_env_Salome.bat +mkdir %ROOT_DIR%\build +cd %ROOT_DIR%\build + +cmake %SRC_DIR% -G "Visual Studio 9 2008" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=%ROOT_DIR%\install + +start "" %MSVC_EXE% NewGEOM.sln diff --git a/msvc10_env.bat b/msvc10_env.bat index ac0173ad4..7717e8047 100644 --- a/msvc10_env.bat +++ b/msvc10_env.bat @@ -121,7 +121,6 @@ set PATH=%CMAKEDIR%\bin;%PATH% @SET PATH=%PDIR%\swig-2.0.9\bin;%PATH% @REM ------------------------- -@REM ------------------------- @REM BOOST @SET BOOST_ROOT_DIR=%PDIR%\boost-1.52.0 @SET PATH=%BOOST_ROOT_DIR%\lib;%PATH% @@ -130,6 +129,13 @@ set PATH=%CMAKEDIR%\bin;%PATH% @SET NEW_GEOM_CONFIG_FILE=%ROOT_DIR%\install\plugins @SET PATH=%ROOT_DIR%\install\plugins;%PATH% +@REM ------------------------- +if "%GUI_ROOT_DIR%" == "" ( + @SET GUI_ROOT_DIR=%ROOT_DIR%\SALOME\GUI\DEBUG\GUI_INSTALL +) +@REM ------------------------- + + rem -------- Visual Studio -------------------- rem Detect Visual Studio (either commercial or Express edition) if "%VS100COMNTOOLS%" == "" ( diff --git a/msvc9_env_Salome.bat b/msvc9_env_Salome.bat new file mode 100644 index 000000000..44f6dd335 --- /dev/null +++ b/msvc9_env_Salome.bat @@ -0,0 +1,71 @@ +@echo off + +IF NOT EXIST "%VS90COMNTOOLS%..\..\VC\vcvarsall.bat" GOTO ERROR1 + +@REM Load local settings from file localenv.bat that should be located in the root directory +if "%ROOT_DIR%" == "" ( + set ROOT_DIR=%~dp0.. +) + +if exist "%ROOT_DIR%\localenv.bat" ( + echo Setting local environment from %ROOT_DIR%\localenv.bat + call "%ROOT_DIR%\localenv.bat" +) else ( + echo Warning: file %ROOT_DIR%\localenv.bat does not exist; using default environment +) + +if "%SALOME_ROOT_DIR%" == "" ( + set SALOME_ROOT_DIR=%ROOT_DIR%\SALOME +) + +call "%SALOME_ROOT_DIR%\WORK\set_env.bat" +call "%PDIR%\env_compile.bat" + +@REM ------------------------- +@REM Python +@SET PYTHON_LIB_DIR=%PYTHON_ROOT_DIR%\libs +@SET PYTHON_INC_DIR=%PYTHON_ROOT_DIR%\include +@REM ------------------------- + +@REM ------------------------- +@REM CASCADE +@SET PATH=%CASROOT%;%CASROOT%\win32\bin%OCC_LIB_PREFIX%;%PATH% +@SET LIB=%CASROOT%\win32\lib%OCC_LIB_PREFIX%;%LIB% +@set CSF_MDTVFontDirectory=%CASROOT%\src\FontMFT +@set CSF_LANGUAGE=us +@set MMGT_CLEAR=1 +@set CSF_EXCEPTION_PROMPT=1 +@set CSF_SHMessage=%CASROOT%\src\SHMessage +@set CSF_MDTVTexturesDirectory=%CASROOT%\src\Textures +@set CSF_XSMessage=%CASROOT%\src\XSMessage +@set CSF_StandardDefaults=%CASROOT%\src\StdResource +@set CSF_PluginDefaults=%CASROOT%\src\StdResource +@set CSF_XCAFDefaults=%CASROOT%\src\StdResource +@set CSF_StandardLiteDefaults=%CASROOT%\src\StdResource +@set CSF_UnitsLexicon=%CASROOT%\src\UnitsAPI\Lexi_Expr.dat +@set CSF_UnitsDefinition=%CASROOT%\src\UnitsAPI\Units.dat +@set CSF_IGESDefaults=%CASROOT%\src\XSTEPResource +@set CSF_STEPDefaults=%CASROOT%\src\XSTEPResource +@set CSF_XmlOcafResource=%CASROOT%\src\XmlOcafResource +@REM ------------------------- + +@REM ------------------------- +@REM Create launch path +@SET PATH=%LIBXML2_ROOT_DIR%\bin;%PATH% +@SET PATH=%PDIR%\tbb\bin;%PATH% +@SET PATH=%PDIR%\freeimage-3.15.4\bin;%PATH% +@SET PATH=%PDIR%\ftgl-2.1.3\bin;%PATH% +@SET PATH=%PDIR%\freetype-2.4.11\bin;%PATH% +@SET PATH=%PDIR%\gl2ps-1.3.8\bin;%PATH% +@REM ------------------------- + +IF "%ARCH%" == "Win64" ( + call "%VS90COMNTOOLS%..\..\VC\vcvarsall.bat" x64 +) ELSE ( + IF "%ARCH%" == "Win32" ( + call "%VS90COMNTOOLS%..\..\VC\vcvarsall.bat" x86 + ) ELSE ( + echo Wrong architecture is used. Win32 or Win64 architecture is allowed only. + echo Refer to the set_env.bat script. + ) +) diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plugin.cxx b/src/ConstructionPlugin/ConstructionPlugin_Plugin.cxx index c433491f9..5c1f39f2f 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plugin.cxx +++ b/src/ConstructionPlugin/ConstructionPlugin_Plugin.cxx @@ -14,11 +14,11 @@ ConstructionPlugin_Plugin::ConstructionPlugin_Plugin() ModelAPI_PluginManager::get()->registerPlugin(this); } -shared_ptr ConstructionPlugin_Plugin::createFeature(string theFeatureID) +boost::shared_ptr ConstructionPlugin_Plugin::createFeature(string theFeatureID) { if (theFeatureID == "Point") { - return shared_ptr(new ConstructionPlugin_Point); + return boost::shared_ptr(new ConstructionPlugin_Point); } // feature of such kind is not found - return shared_ptr(); + return boost::shared_ptr(); } diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plugin.h b/src/ConstructionPlugin/ConstructionPlugin_Plugin.h index 91875f362..0201b40a3 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plugin.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Plugin.h @@ -13,7 +13,7 @@ class CONSTRUCTIONPLUGIN_EXPORT ConstructionPlugin_Plugin: public ModelAPI_Plugi { public: /// Creates the feature object of this plugin by the feature string ID - virtual std::shared_ptr createFeature(std::string theFeatureID); + virtual boost::shared_ptr createFeature(std::string theFeatureID); public: /// Is needed for python wrapping by swig diff --git a/src/Model/CMakeLists.txt b/src/Model/CMakeLists.txt index 1d56def92..53f1ec956 100644 --- a/src/Model/CMakeLists.txt +++ b/src/Model/CMakeLists.txt @@ -24,7 +24,7 @@ SET(PROJECT_SOURCES Model_Events.cxx ) -ADD_DEFINITIONS(-DMODEL_EXPORTS ${CAS_DEFINITIONS}) +ADD_DEFINITIONS(-DMODEL_EXPORTS ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS}) ADD_LIBRARY(Model SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS}) TARGET_LINK_LIBRARIES(Model ${PROJECT_LIBRARIES} ${CAS_OCAF} ModelAPI Event Config) diff --git a/src/Model/Model_Application.cxx b/src/Model/Model_Application.cxx index 40704967e..166b4e1a1 100644 --- a/src/Model/Model_Application.cxx +++ b/src/Model/Model_Application.cxx @@ -19,12 +19,12 @@ Handle(Model_Application) Model_Application::getApplication() } //======================================================================= -const std::shared_ptr& Model_Application::getDocument(string theDocID) +const boost::shared_ptr& Model_Application::getDocument(string theDocID) { if (myDocs.find(theDocID) != myDocs.end()) return myDocs[theDocID]; - std::shared_ptr aNew(new Model_Document(theDocID)); + boost::shared_ptr aNew(new Model_Document(theDocID)); myDocs[theDocID] = aNew; return myDocs[theDocID]; } diff --git a/src/Model/Model_Application.h b/src/Model/Model_Application.h index 386543479..ddd3155bd 100644 --- a/src/Model/Model_Application.h +++ b/src/Model/Model_Application.h @@ -30,7 +30,7 @@ public: //! Retuns the application: one per process MODEL_EXPORT static Handle_Model_Application getApplication(); //! Returns the main document (on first call creates it) by the string identifier - MODEL_EXPORT const std::shared_ptr& getDocument(std::string theDocID); + MODEL_EXPORT const boost::shared_ptr& getDocument(std::string theDocID); //! Returns true if document has been created MODEL_EXPORT bool hasDocument(std::string theDocID); //! Deletes the document from the application @@ -50,7 +50,7 @@ public: private: /// Map from string identifiers to created documents of an application - std::map > myDocs; + std::map > myDocs; }; #endif diff --git a/src/Model/Model_AttributeDocRef.cxx b/src/Model/Model_AttributeDocRef.cxx index 07712d0b6..9df9c2219 100644 --- a/src/Model/Model_AttributeDocRef.cxx +++ b/src/Model/Model_AttributeDocRef.cxx @@ -7,18 +7,18 @@ using namespace std; -void Model_AttributeDocRef::setValue(std::shared_ptr theDoc) +void Model_AttributeDocRef::setValue(boost::shared_ptr theDoc) { myComment->Set(TCollection_ExtendedString(theDoc->id().c_str())); } -std::shared_ptr Model_AttributeDocRef::value() +boost::shared_ptr Model_AttributeDocRef::value() { if (myComment->Get().Length()) return Model_Application::getApplication()->getDocument( TCollection_AsciiString(myComment->Get()).ToCString()); // not initialized - return std::shared_ptr(); + return boost::shared_ptr(); } Model_AttributeDocRef::Model_AttributeDocRef(TDF_Label& theLabel) diff --git a/src/Model/Model_AttributeDocRef.h b/src/Model/Model_AttributeDocRef.h index 778ed316b..f3a3fcf89 100644 --- a/src/Model/Model_AttributeDocRef.h +++ b/src/Model/Model_AttributeDocRef.h @@ -20,10 +20,10 @@ class Model_AttributeDocRef : public ModelAPI_AttributeDocRef Handle_TDataStd_Comment myComment; ///< reference to document is identified as string-id public: /// Defines the document referenced from this attribute - MODEL_EXPORT virtual void setValue(std::shared_ptr theDoc); + MODEL_EXPORT virtual void setValue(boost::shared_ptr theDoc); /// Returns document referenced from this attribute - MODEL_EXPORT virtual std::shared_ptr value(); + MODEL_EXPORT virtual boost::shared_ptr value(); protected: /// Initializes attibutes diff --git a/src/Model/Model_Data.cxx b/src/Model/Model_Data.cxx index a9ac29bf0..87c7be867 100644 --- a/src/Model/Model_Data.cxx +++ b/src/Model/Model_Data.cxx @@ -41,35 +41,35 @@ void Model_Data::addAttribute(string theID, string theAttrType) anAttr = new Model_AttributeDouble(anAttrLab); if (anAttr) - myAttrs[theID] = std::shared_ptr(anAttr); + myAttrs[theID] = boost::shared_ptr(anAttr); else ; // TODO: generate error on unknown attribute request and/or add mechanism for customization } -shared_ptr Model_Data::docRef(const string theID) +boost::shared_ptr Model_Data::docRef(const string theID) { - map >::iterator aFound = myAttrs.find(theID); + map >::iterator aFound = myAttrs.find(theID); if (aFound == myAttrs.end()) { // TODO: generate error on unknown attribute request and/or add mechanism for customization - return std::shared_ptr(); + return boost::shared_ptr(); } - shared_ptr aRes = - dynamic_pointer_cast(aFound->second); + boost::shared_ptr aRes = + boost::dynamic_pointer_cast(aFound->second); if (!aRes) { // TODO: generate error on invalid attribute type request } return aRes; } -shared_ptr Model_Data::real(const string theID) +boost::shared_ptr Model_Data::real(const string theID) { - map >::iterator aFound = myAttrs.find(theID); + map >::iterator aFound = myAttrs.find(theID); if (aFound == myAttrs.end()) { // TODO: generate error on unknown attribute request and/or add mechanism for customization - return std::shared_ptr(); + return boost::shared_ptr(); } - shared_ptr aRes = - dynamic_pointer_cast(aFound->second); + boost::shared_ptr aRes = + boost::dynamic_pointer_cast(aFound->second); if (!aRes) { // TODO: generate error on invalid attribute type request } diff --git a/src/Model/Model_Data.h b/src/Model/Model_Data.h index d33819a8f..5c3ffdf2f 100644 --- a/src/Model/Model_Data.h +++ b/src/Model/Model_Data.h @@ -23,9 +23,9 @@ class Model_Data: public ModelAPI_Data { TDF_Label myLab; ///< label of the feature in the document /// All attributes of the object identified by the attribute ID - std::map > myAttrs; + std::map > myAttrs; - std::shared_ptr myDoc; ///< document this feature belongs to + boost::shared_ptr myDoc; ///< document this feature belongs to Model_Data(); @@ -40,9 +40,9 @@ public: /// Defines the name of the feature visible by the user in the object browser MODEL_EXPORT virtual void setName(std::string theName); /// Returns the attribute that references to another document - MODEL_EXPORT virtual std::shared_ptr docRef(const std::string theID); + MODEL_EXPORT virtual boost::shared_ptr docRef(const std::string theID); /// Returns the attribute that contains real value with double precision - MODEL_EXPORT virtual std::shared_ptr real(const std::string theID); + MODEL_EXPORT virtual boost::shared_ptr real(const std::string theID); /// Initializes object by the attributes: must be called just after the object is created /// for each attribute of the object @@ -51,13 +51,13 @@ public: MODEL_EXPORT virtual void addAttribute(std::string theID, std::string theAttrType); /// Returns the document of this data - MODEL_EXPORT virtual std::shared_ptr document() {return myDoc;} + MODEL_EXPORT virtual boost::shared_ptr document() {return myDoc;} /// Puts feature to the document data sub-structure MODEL_EXPORT void setLabel(TDF_Label& theLab); /// Sets the document of this data - MODEL_EXPORT virtual void setDocument(const std::shared_ptr& theDoc) {myDoc = theDoc;} + MODEL_EXPORT virtual void setDocument(const boost::shared_ptr& theDoc) {myDoc = theDoc;} }; #endif diff --git a/src/Model/Model_Document.cxx b/src/Model/Model_Document.cxx index 22641f4b3..c022362e8 100644 --- a/src/Model/Model_Document.cxx +++ b/src/Model/Model_Document.cxx @@ -206,25 +206,25 @@ void Model_Document::redo() subDocument(*aSubIter)->redo(); } -shared_ptr Model_Document::addFeature(string theID) +boost::shared_ptr Model_Document::addFeature(string theID) { - shared_ptr aFeature = ModelAPI_PluginManager::get()->createFeature(theID); + boost::shared_ptr aFeature = ModelAPI_PluginManager::get()->createFeature(theID); if (aFeature) { - dynamic_pointer_cast(aFeature->documentToAdd())->addFeature(aFeature); + boost::dynamic_pointer_cast(aFeature->documentToAdd())->addFeature(aFeature); } else { // TODO: generate error that feature is not created } return aFeature; } -void Model_Document::addFeature(const std::shared_ptr theFeature) +void Model_Document::addFeature(const boost::shared_ptr theFeature) { const std::string& aGroup = theFeature->getGroup(); TDF_Label aGroupLab = groupLabel(aGroup); TDF_Label anObjLab = aGroupLab.NewChild(); - std::shared_ptr aData(new Model_Data); + boost::shared_ptr aData(new Model_Data); aData->setLabel(anObjLab); - shared_ptr aThis = Model_Application::getApplication()->getDocument(myID); + boost::shared_ptr aThis = Model_Application::getApplication()->getDocument(myID); aData->setDocument(aThis); theFeature->setData(aData); setUniqueName(theFeature); @@ -241,7 +241,7 @@ void Model_Document::addFeature(const std::shared_ptr theFeatu Event_Loop::loop()->send(aMsg); } -shared_ptr Model_Document::feature(TDF_Label& theLabel) +boost::shared_ptr Model_Document::feature(TDF_Label& theLabel) { Handle(TDataStd_Integer) aFeatureIndex; if (theLabel.FindAttribute(TDataStd_Integer::GetID(), aFeatureIndex)) { @@ -251,15 +251,15 @@ shared_ptr Model_Document::feature(TDF_Label& theLabel) return myFeatures[aGroup][aFeatureIndex->Get()]; } } - return std::shared_ptr(); // not found + return boost::shared_ptr(); // not found } -int Model_Document::featureIndex(shared_ptr theFeature) +int Model_Document::featureIndex(boost::shared_ptr theFeature) { if (theFeature->data()->document().get() != this) { return theFeature->data()->document()->featureIndex(theFeature); } - shared_ptr aData = dynamic_pointer_cast(theFeature->data()); + boost::shared_ptr aData = boost::dynamic_pointer_cast(theFeature->data()); Handle(TDataStd_Integer) aFeatureIndex; if (aData->label().FindAttribute(TDataStd_Integer::GetID(), aFeatureIndex)) { return aFeatureIndex->Get(); @@ -267,7 +267,7 @@ int Model_Document::featureIndex(shared_ptr theFeature) return -1; // not found } -shared_ptr Model_Document::subDocument(string theDocID) +boost::shared_ptr Model_Document::subDocument(string theDocID) { // just store sub-document identifier here to manage it later if (mySubs.find(theDocID) == mySubs.end()) @@ -275,22 +275,22 @@ shared_ptr Model_Document::subDocument(string theDocID) return Model_Application::getApplication()->getDocument(theDocID); } -shared_ptr Model_Document::featuresIterator(const string theGroup) +boost::shared_ptr Model_Document::featuresIterator(const string theGroup) { - shared_ptr aThis(Model_Application::getApplication()->getDocument(myID)); + boost::shared_ptr aThis(Model_Application::getApplication()->getDocument(myID)); // create an empty iterator for not existing group // (to avoidance of attributes management outside the transaction) if (myGroups.find(theGroup) == myGroups.end()) - return shared_ptr(new Model_Iterator()); - return shared_ptr(new Model_Iterator(aThis, groupLabel(theGroup))); + return boost::shared_ptr(new Model_Iterator()); + return boost::shared_ptr(new Model_Iterator(aThis, groupLabel(theGroup))); } -shared_ptr Model_Document::feature(const string& theGroupID, const int theIndex) +boost::shared_ptr Model_Document::feature(const string& theGroupID, const int theIndex) { // TODO: optimize this method - shared_ptr anIter = featuresIterator(theGroupID); + boost::shared_ptr anIter = featuresIterator(theGroupID); for(int a = 0; a != theIndex && anIter->more(); anIter->next()) a++; - return anIter->more() ? anIter->current() : shared_ptr(); + return anIter->more() ? anIter->current() : boost::shared_ptr(); } const vector& Model_Document::getGroups() const @@ -317,17 +317,16 @@ TDF_Label Model_Document::groupLabel(const string theGroup) myGroupsNames.push_back(theGroup); // set to the group label the group idntifier to restore on "open" TDataStd_Comment::Set(myGroups[theGroup], theGroup.c_str()); - myFeatures[theGroup] = vector >(); + myFeatures[theGroup] = vector >(); } return myGroups[theGroup]; } -void Model_Document::setUniqueName( - shared_ptr theFeature) +void Model_Document::setUniqueName(boost::shared_ptr theFeature) { // first count all objects of such kind to start with index = count + 1 int aNumObjects = 0; - shared_ptr anIter = featuresIterator(theFeature->getGroup()); + boost::shared_ptr anIter = featuresIterator(theFeature->getGroup()); for(; anIter->more(); anIter->next()) { if (anIter->currentKind() == theFeature->getKind()) aNumObjects++; @@ -352,7 +351,7 @@ void Model_Document::setUniqueName( void Model_Document::synchronizeFeatures() { - shared_ptr aThis = Model_Application::getApplication()->getDocument(myID); + boost::shared_ptr aThis = Model_Application::getApplication()->getDocument(myID); // iterate groups labels TDF_ChildIDIterator aGroupsIter(myDoc->Main().FindChild(TAG_OBJECTS), TDataStd_Comment::GetID(), Standard_False); @@ -380,7 +379,7 @@ void Model_Document::synchronizeFeatures() aGroupsIter.Value())->Get()).ToCString(); myGroupsNames.push_back(aGroupName); myGroups[aGroupName] = aGroupsIter.Value()->Label(); - myFeatures[aGroupName] = vector >(); + myFeatures[aGroupName] = vector >(); } // update features group by group aGroupsIter.Initialize(myDoc->Main().FindChild(TAG_OBJECTS), @@ -389,8 +388,8 @@ void Model_Document::synchronizeFeatures() string aGroupName = TCollection_AsciiString(Handle(TDataStd_Comment)::DownCast( aGroupsIter.Value())->Get()).ToCString(); // iterate features in internal container - vector >& aFeatures = myFeatures[aGroupName]; - vector >::iterator aFIter = aFeatures.begin(); + vector >& aFeatures = myFeatures[aGroupName]; + vector >::iterator aFIter = aFeatures.begin(); // and in parallel iterate labels of features TDF_ChildIDIterator aFLabIter( aGroupsIter.Value()->Label(), TDataStd_Comment::GetID(), Standard_False); @@ -398,7 +397,7 @@ void Model_Document::synchronizeFeatures() static const int INFINITE_TAG = INT_MAX; // no label means that it exists somwhere in infinite int aFeatureTag = INFINITE_TAG; if (aFIter != aFeatures.end()) { // existing tag for feature - shared_ptr aData = dynamic_pointer_cast((*aFIter)->data()); + boost::shared_ptr aData = boost::dynamic_pointer_cast((*aFIter)->data()); aFeatureTag = aData->label().Tag(); } int aDSTag = INFINITE_TAG; @@ -412,11 +411,11 @@ void Model_Document::synchronizeFeatures() Event_Loop::loop()->send(aMsg); } else if (aDSTag < aFeatureTag) { // a new feature is inserted // create a feature - shared_ptr aFeature = ModelAPI_PluginManager::get()->createFeature( + boost::shared_ptr aFeature = ModelAPI_PluginManager::get()->createFeature( TCollection_AsciiString(Handle(TDataStd_Comment)::DownCast( aFLabIter.Value())->Get()).ToCString()); - std::shared_ptr aData(new Model_Data); + boost::shared_ptr aData(new Model_Data); TDF_Label aLab = aFLabIter.Value()->Label(); aData->setLabel(aLab); aData->setDocument(Model_Application::getApplication()->getDocument(myID)); diff --git a/src/Model/Model_Document.h b/src/Model/Model_Document.h index 3b2477c32..f98788c5e 100644 --- a/src/Model/Model_Document.h +++ b/src/Model/Model_Document.h @@ -61,23 +61,23 @@ public: //! Adds to the document the new feature of the given feature id //! \param creates feature and puts it in the document - MODEL_EXPORT virtual std::shared_ptr addFeature(std::string theID); + MODEL_EXPORT virtual boost::shared_ptr addFeature(std::string theID); //! Returns the existing feature by the label //! \param theLabel base label of the feature - MODEL_EXPORT virtual std::shared_ptr feature(TDF_Label& theLabel); + MODEL_EXPORT virtual boost::shared_ptr feature(TDF_Label& theLabel); //! Adds a new sub-document by the identifier, or returns existing one if it is already exist - MODEL_EXPORT virtual std::shared_ptr subDocument(std::string theDocID); + MODEL_EXPORT virtual boost::shared_ptr subDocument(std::string theDocID); //! Creates an iterator of the features by the specific groups - MODEL_EXPORT virtual std::shared_ptr featuresIterator( + MODEL_EXPORT virtual boost::shared_ptr featuresIterator( const std::string theGroup); MODEL_EXPORT virtual const std::string& id() const {return myID;} //! Returns the feature in the group by the index (started from zero) - MODEL_EXPORT virtual std::shared_ptr + MODEL_EXPORT virtual boost::shared_ptr feature(const std::string& theGroupID, const int theIndex); ///! Returns the vector of groups already added to the document @@ -85,7 +85,7 @@ public: //! Returns the index of feature in the group (zero based) //! \retruns -1 if not found - MODEL_EXPORT virtual int featureIndex(std::shared_ptr theFeature); + MODEL_EXPORT virtual int featureIndex(boost::shared_ptr theFeature); protected: @@ -94,10 +94,10 @@ protected: //! Initializes feature with a unique name in this group (unique name is generated as //! feature type + "_" + index - void setUniqueName(std::shared_ptr theFeature); + void setUniqueName(boost::shared_ptr theFeature); //! Adds to the document the new feature - void addFeature(const std::shared_ptr theFeature); + void addFeature(const boost::shared_ptr theFeature); //! Synchronizes myGroups, myGroupsNames, myFeatures and mySubs list with the updated document void synchronizeFeatures(); @@ -116,7 +116,7 @@ private: std::map myGroups; std::vector myGroupsNames; ///< names of added groups to the document /// Features managed by this document: by group name - std::map > > myFeatures; + std::map > > myFeatures; std::set mySubs; ///< set of identifiers of sub-documents of this document /// transaction indexes (related to myTransactionsAfterSave) which were empty in this doc std::map myIsEmptyTr; diff --git a/src/Model/Model_Events.cxx b/src/Model/Model_Events.cxx index dc35573eb..a83e9cabd 100644 --- a/src/Model/Model_Events.cxx +++ b/src/Model/Model_Events.cxx @@ -6,13 +6,13 @@ #include ModelAPI_FeatureUpdatedMessage::ModelAPI_FeatureUpdatedMessage( - const std::shared_ptr& theDoc, - const std::shared_ptr& theFeature, const Event_ID& theEvent) + const boost::shared_ptr& theDoc, + const boost::shared_ptr& theFeature, const Event_ID& theEvent) : Event_Message(theEvent, 0), myFeature(theFeature), myDoc(theDoc) {} ModelAPI_FeatureDeletedMessage::ModelAPI_FeatureDeletedMessage( - const std::shared_ptr& theDoc, const std::string& theGroup) + const boost::shared_ptr& theDoc, const std::string& theGroup) : Event_Message(messageId(), 0), myDoc(theDoc), myGroup(theGroup) { diff --git a/src/Model/Model_Events.h b/src/Model/Model_Events.h index c4af9f527..81828bf30 100644 --- a/src/Model/Model_Events.h +++ b/src/Model/Model_Events.h @@ -7,7 +7,7 @@ #include #include -#include +#include #include class ModelAPI_Feature; @@ -22,35 +22,35 @@ static const char * EVENT_FEATURE_DELETED = "FeatureDeleted"; /// Message that feature was changed (used for Object Browser update) class ModelAPI_FeatureUpdatedMessage : public Event_Message { - std::shared_ptr myDoc; ///< document owner of the feature - std::shared_ptr myFeature; ///< which feature is changed + boost::shared_ptr myDoc; ///< document owner of the feature + boost::shared_ptr myFeature; ///< which feature is changed public: /// sender is not important, all information is located in the feature ModelAPI_FeatureUpdatedMessage( - const std::shared_ptr& theDoc, - const std::shared_ptr& theFeature, + const boost::shared_ptr& theDoc, + const boost::shared_ptr& theFeature, const Event_ID& theEvent); /// Returns the feature that has been updated - std::shared_ptr feature() const {return myFeature;} + boost::shared_ptr feature() const {return myFeature;} /// Returns the document that has been updated - std::shared_ptr document() const {return myDoc;} + boost::shared_ptr document() const {return myDoc;} }; /// Message that feature was deleted (used for Object Browser update) class ModelAPI_FeatureDeletedMessage : public Event_Message { - std::shared_ptr myDoc; ///< document owner of the feature + boost::shared_ptr myDoc; ///< document owner of the feature std::string myGroup; ///< group identifier that contained the deleted feature public: /// creates a message by initialization of fields - ModelAPI_FeatureDeletedMessage(const std::shared_ptr& theDoc, + ModelAPI_FeatureDeletedMessage(const boost::shared_ptr& theDoc, const std::string& theGroup); /// Returns the ID of this message (EVENT_FEATURE_DELETED) static const Event_ID messageId(); /// Returns the feature that has been updated - std::shared_ptr document() const {return myDoc;} + boost::shared_ptr document() const {return myDoc;} /// Returns the group where the feature was deleted const std::string& group() const {return myGroup;} diff --git a/src/Model/Model_Iterator.cxx b/src/Model/Model_Iterator.cxx index 001ebdff8..ba59cdf75 100644 --- a/src/Model/Model_Iterator.cxx +++ b/src/Model/Model_Iterator.cxx @@ -21,7 +21,7 @@ bool Model_Iterator::more() return myIter.More() == Standard_True; } -shared_ptr Model_Iterator::current() +boost::shared_ptr Model_Iterator::current() { TDF_Label aLab = myIter.Value()->Label(); return myDoc->feature(aLab); @@ -51,10 +51,10 @@ int Model_Iterator::numIterationsLeft() return aResult; } -bool Model_Iterator::isEqual(std::shared_ptr theFeature) +bool Model_Iterator::isEqual(boost::shared_ptr theFeature) { return (myIter.Value()->Label() == - dynamic_pointer_cast(theFeature->data())->label()) == Standard_True; + boost::dynamic_pointer_cast(theFeature->data())->label()) == Standard_True; } @@ -62,6 +62,6 @@ Model_Iterator::Model_Iterator() { } -Model_Iterator::Model_Iterator(std::shared_ptr theDoc, TDF_Label theLab) +Model_Iterator::Model_Iterator(boost::shared_ptr theDoc, TDF_Label theLab) : myDoc(theDoc), myIter(theLab, TDataStd_Comment::GetID(), Standard_False) {} diff --git a/src/Model/Model_Iterator.h b/src/Model/Model_Iterator.h index 5d8c61bae..ff116605d 100644 --- a/src/Model/Model_Iterator.h +++ b/src/Model/Model_Iterator.h @@ -20,7 +20,7 @@ class Model_Document; class Model_Iterator : public ModelAPI_Iterator { - std::shared_ptr myDoc; ///< the document of iterated objects + boost::shared_ptr myDoc; ///< the document of iterated objects TDF_ChildIDIterator myIter; ///< iterator of the features-labels public: /// Iterates to the next feature @@ -28,7 +28,7 @@ public: /// Returns true if the current iteration is valid and next iteration is possible MODEL_EXPORT virtual bool more(); /// Returns the currently iterated feature - MODEL_EXPORT virtual std::shared_ptr current(); + MODEL_EXPORT virtual boost::shared_ptr current(); /// Returns the kind of the current feature (faster than Current()->getKind()) MODEL_EXPORT virtual std::string currentKind(); /// Returns the name of the current feature (faster than Current()->getName()) @@ -39,7 +39,7 @@ public: /// Compares the current feature with the given one /// \returns true if given feature equals to the current one - MODEL_EXPORT virtual bool isEqual(std::shared_ptr theFeature); + MODEL_EXPORT virtual bool isEqual(boost::shared_ptr theFeature); protected: /// Creates an empty iterator that alway returns More false @@ -47,7 +47,7 @@ protected: /// Initializes iterator /// \param theDoc document where the iteration is performed /// \param theLab label of the features group to iterate - Model_Iterator(std::shared_ptr theDoc, TDF_Label theLab); + Model_Iterator(boost::shared_ptr theDoc, TDF_Label theLab); friend class Model_Document; }; diff --git a/src/Model/Model_PluginManager.cxx b/src/Model/Model_PluginManager.cxx index eb279208a..435ba3f50 100644 --- a/src/Model/Model_PluginManager.cxx +++ b/src/Model/Model_PluginManager.cxx @@ -16,7 +16,7 @@ using namespace std; static Model_PluginManager* myImpl = new Model_PluginManager(); -shared_ptr Model_PluginManager::createFeature(string theFeatureID) +boost::shared_ptr Model_PluginManager::createFeature(string theFeatureID) { if (this != myImpl) return myImpl->createFeature(theFeatureID); @@ -28,18 +28,18 @@ shared_ptr Model_PluginManager::createFeature(string theFeatur loadLibrary(myCurrentPluginName); } if (myPluginObjs.find(myCurrentPluginName) != myPluginObjs.end()) { - std::shared_ptr aCreated = + boost::shared_ptr aCreated = myPluginObjs[myCurrentPluginName]->createFeature(theFeatureID); return aCreated; } } - return std::shared_ptr(); // return nothing + return boost::shared_ptr(); // return nothing } -std::shared_ptr Model_PluginManager::rootDocument() +boost::shared_ptr Model_PluginManager::rootDocument() { - return std::shared_ptr( + return boost::shared_ptr( Model_Application::getApplication()->getDocument("root")); } @@ -48,14 +48,14 @@ bool Model_PluginManager::hasRootDocument() return Model_Application::getApplication()->hasDocument("root"); } -shared_ptr Model_PluginManager::currentDocument() +boost::shared_ptr Model_PluginManager::currentDocument() { if (!myCurrentDoc) myCurrentDoc = rootDocument(); return myCurrentDoc; } -void Model_PluginManager::setCurrentDocument(shared_ptr theDoc) +void Model_PluginManager::setCurrentDocument(boost::shared_ptr theDoc) { myCurrentDoc = theDoc; } @@ -66,7 +66,7 @@ Model_PluginManager::Model_PluginManager() //TODO(sbh): Implement static method to extract event id [SEID] static Event_ID aFeatureEvent = Event_Loop::eventByName("FeatureRegisterEvent"); - ModelAPI_PluginManager::SetPluginManager(std::shared_ptr(this)); + ModelAPI_PluginManager::SetPluginManager(boost::shared_ptr(this)); // register the configuration reading listener Event_Loop* aLoop = Event_Loop::loop(); aLoop->registerListener(this, aFeatureEvent); diff --git a/src/Model/Model_PluginManager.h b/src/Model/Model_PluginManager.h index 8fc49bdf2..018f705b1 100644 --- a/src/Model/Model_PluginManager.h +++ b/src/Model/Model_PluginManager.h @@ -25,19 +25,19 @@ class Model_PluginManager : public ModelAPI_PluginManager, public Event_Listener std::map myPlugins; std::map myPluginObjs; ///< instances of the already plugins std::string myCurrentPluginName; ///< name of the plugin that must be loaded currently - std::shared_ptr myCurrentDoc; ///< current working document + boost::shared_ptr myCurrentDoc; ///< current working document public: /// Returns the root document of the application (that may contains sub-documents) - MODEL_EXPORT virtual std::shared_ptr rootDocument(); + MODEL_EXPORT virtual boost::shared_ptr rootDocument(); /// Return true if root document has been already created MODEL_EXPORT virtual bool hasRootDocument(); /// Returns the current document that used for current work in the application - MODEL_EXPORT virtual std::shared_ptr currentDocument(); + MODEL_EXPORT virtual boost::shared_ptr currentDocument(); /// Defines the current document that used for current work in the application - MODEL_EXPORT virtual void setCurrentDocument(std::shared_ptr theDoc); + MODEL_EXPORT virtual void setCurrentDocument(boost::shared_ptr theDoc); /// Registers the plugin that creates features. /// It is obligatory for each plugin to call this function on loading to be found by @@ -55,7 +55,7 @@ protected: void LoadPluginsInfo(); /// Creates the feature object using plugins functionality - virtual std::shared_ptr createFeature(std::string theFeatureID); + virtual boost::shared_ptr createFeature(std::string theFeatureID); }; #endif diff --git a/src/ModelAPI/ModelAPI.i b/src/ModelAPI/ModelAPI.i index c0bcc3221..19be24d4d 100644 --- a/src/ModelAPI/ModelAPI.i +++ b/src/ModelAPI/ModelAPI.i @@ -18,10 +18,10 @@ // standard definitions %include "typemaps.i" %include "std_string.i" -%include +//%include // boost pointers -// %include +%include %shared_ptr(ModelAPI_Document) %shared_ptr(ModelAPI_PluginManager) %shared_ptr(ModelAPI_Feature) diff --git a/src/ModelAPI/ModelAPI_AttributeDocRef.h b/src/ModelAPI/ModelAPI_AttributeDocRef.h index 9b0a6c295..473db7a44 100644 --- a/src/ModelAPI/ModelAPI_AttributeDocRef.h +++ b/src/ModelAPI/ModelAPI_AttributeDocRef.h @@ -17,10 +17,10 @@ class MODELAPI_EXPORT ModelAPI_AttributeDocRef : public ModelAPI_Attribute { public: /// Defines the document referenced from this attribute - virtual void setValue(std::shared_ptr theDoc) = 0; + virtual void setValue(boost::shared_ptr theDoc) = 0; /// Returns document referenced from this attribute - virtual std::shared_ptr value() = 0; + virtual boost::shared_ptr value() = 0; /// Returns the type of this class of attributes static std::string type() {return "DocRef";} diff --git a/src/ModelAPI/ModelAPI_Data.h b/src/ModelAPI/ModelAPI_Data.h index c8f006ea5..73fe3d7de 100644 --- a/src/ModelAPI/ModelAPI_Data.h +++ b/src/ModelAPI/ModelAPI_Data.h @@ -7,7 +7,7 @@ #include "ModelAPI.h" #include -#include +#include class ModelAPI_AttributeDocRef; class ModelAPI_AttributeDouble; @@ -30,9 +30,9 @@ public: virtual void setName(std::string theName) = 0; /// Returns the attribute that references to another document - virtual std::shared_ptr docRef(const std::string theID) = 0; + virtual boost::shared_ptr docRef(const std::string theID) = 0; /// Returns the attribute that contains real value with double precision - virtual std::shared_ptr real(const std::string theID) = 0; + virtual boost::shared_ptr real(const std::string theID) = 0; /// Initializes object by the attributes: must be called just after the object is created /// for each attribute of the object @@ -41,7 +41,7 @@ public: virtual void addAttribute(std::string theID, std::string theAttrType) = 0; /// Returns the document of this data - virtual std::shared_ptr document() = 0; + virtual boost::shared_ptr document() = 0; /// To virtually destroy the fields of successors virtual ~ModelAPI_Data() {} diff --git a/src/ModelAPI/ModelAPI_Document.h b/src/ModelAPI/ModelAPI_Document.h index 378915c63..efc85b275 100644 --- a/src/ModelAPI/ModelAPI_Document.h +++ b/src/ModelAPI/ModelAPI_Document.h @@ -7,7 +7,7 @@ #include #include -#include +#include #include class ModelAPI_Feature; @@ -68,24 +68,24 @@ public: //! Adds to the document the new feature of the given feature id //! \param creates feature and puts it in the document - MODELAPI_EXPORT virtual std::shared_ptr addFeature(std::string theID) = 0; + MODELAPI_EXPORT virtual boost::shared_ptr addFeature(std::string theID) = 0; ///! Adds a new sub-document by the identifier, or returns existing one if it is already exist - MODELAPI_EXPORT virtual std::shared_ptr subDocument(std::string theDocID) = 0; + MODELAPI_EXPORT virtual boost::shared_ptr subDocument(std::string theDocID) = 0; ///! Creates an iterator of the features by the specific groups - MODELAPI_EXPORT virtual std::shared_ptr featuresIterator( + MODELAPI_EXPORT virtual boost::shared_ptr featuresIterator( const std::string theGroup) = 0; ///! Returns the id of hte document MODELAPI_EXPORT virtual const std::string& id() const = 0; //! Returns the feature in the group by the index (started from zero) - MODELAPI_EXPORT virtual std::shared_ptr + MODELAPI_EXPORT virtual boost::shared_ptr feature(const std::string& theGroupID, const int theIndex) = 0; //! Returns the index of feature in the group (zero based) - MODELAPI_EXPORT virtual int featureIndex(std::shared_ptr theFeature) = 0; + MODELAPI_EXPORT virtual int featureIndex(boost::shared_ptr theFeature) = 0; ///! Returns the vector of groups already added to the document MODELAPI_EXPORT virtual const std::vector& getGroups() const = 0; diff --git a/src/ModelAPI/ModelAPI_Feature.h b/src/ModelAPI/ModelAPI_Feature.h index 7cb9256a0..8c1a82e75 100644 --- a/src/ModelAPI/ModelAPI_Feature.h +++ b/src/ModelAPI/ModelAPI_Feature.h @@ -9,7 +9,7 @@ #include "ModelAPI_PluginManager.h" #include -#include +#include class ModelAPI_Data; class ModelAPI_Document; @@ -21,7 +21,7 @@ class ModelAPI_Document; */ class ModelAPI_Feature { - std::shared_ptr myData; ///< manager of the data model of a feature + boost::shared_ptr myData; ///< manager of the data model of a feature public: /// Returns the kind of a feature (like "Point") @@ -37,11 +37,11 @@ public: MODELAPI_EXPORT virtual void execute() = 0; /// Returns the data manager of this feature - MODELAPI_EXPORT virtual std::shared_ptr data() {return myData;} + MODELAPI_EXPORT virtual boost::shared_ptr data() {return myData;} /// Must return document where the new feature must be added to /// By default it is current document - MODELAPI_EXPORT virtual std::shared_ptr documentToAdd() + MODELAPI_EXPORT virtual boost::shared_ptr documentToAdd() {return ModelAPI_PluginManager::get()->currentDocument();} /// To virtually destroy the fields of successors @@ -54,7 +54,7 @@ protected: {} /// Sets the data manager of an object (document does) - MODELAPI_EXPORT void setData(std::shared_ptr theData) {myData = theData;} + MODELAPI_EXPORT void setData(boost::shared_ptr theData) {myData = theData;} friend class Model_Document; }; diff --git a/src/ModelAPI/ModelAPI_Iterator.h b/src/ModelAPI/ModelAPI_Iterator.h index 8a128a59d..db4a5d119 100644 --- a/src/ModelAPI/ModelAPI_Iterator.h +++ b/src/ModelAPI/ModelAPI_Iterator.h @@ -7,7 +7,7 @@ #include "ModelAPI.h" #include -#include +#include class ModelAPI_Feature; class ModelAPI_Document; @@ -26,7 +26,7 @@ public: /// Returns true if the current iteration is valid and next iteration is possible virtual bool more() = 0; /// Returns the currently iterated feature - virtual std::shared_ptr current() = 0; + virtual boost::shared_ptr current() = 0; /// Returns the kind of the current feature (faster than Current()->getKind()) virtual std::string currentKind() = 0; /// Returns the name of the current feature (faster than Current()->getName()) @@ -36,7 +36,7 @@ public: virtual int numIterationsLeft() = 0; /// Compares the current feature with the given one /// \returns true if given feature equals to the current one - virtual bool isEqual(std::shared_ptr theFeature) = 0; + virtual bool isEqual(boost::shared_ptr theFeature) = 0; /// To virtually destroy the fields of successors virtual ~ModelAPI_Iterator() {} diff --git a/src/ModelAPI/ModelAPI_Plugin.h b/src/ModelAPI/ModelAPI_Plugin.h index fb084002c..fb65e0b14 100644 --- a/src/ModelAPI/ModelAPI_Plugin.h +++ b/src/ModelAPI/ModelAPI_Plugin.h @@ -7,7 +7,7 @@ #include "ModelAPI.h" #include -#include +#include class ModelAPI_Feature; @@ -20,7 +20,7 @@ class MODELAPI_EXPORT ModelAPI_Plugin { public: /// Creates the feature object of this plugin by the feature string ID - virtual std::shared_ptr createFeature(std::string theFeatureID) = 0; + virtual boost::shared_ptr createFeature(std::string theFeatureID) = 0; /// To virtually destroy the fields of successors virtual ~ModelAPI_Plugin() {} diff --git a/src/ModelAPI/ModelAPI_PluginManager.cxx b/src/ModelAPI/ModelAPI_PluginManager.cxx index f3e7e9b9d..772ac8d98 100644 --- a/src/ModelAPI/ModelAPI_PluginManager.cxx +++ b/src/ModelAPI/ModelAPI_PluginManager.cxx @@ -31,19 +31,19 @@ using namespace std; string library(const string& theLibName); /// Manager that will be initialized from Model package, one per application -std::shared_ptr MY_MANAGER; +boost::shared_ptr MY_MANAGER; ModelAPI_PluginManager::ModelAPI_PluginManager() { } void ModelAPI_PluginManager::SetPluginManager( - std::shared_ptr theManager) + boost::shared_ptr theManager) { MY_MANAGER = theManager; } -std::shared_ptr ModelAPI_PluginManager::get() +boost::shared_ptr ModelAPI_PluginManager::get() { if (!MY_MANAGER) { // import Model library that implements this interface of ModelAPI loadLibrary("Model"); diff --git a/src/ModelAPI/ModelAPI_PluginManager.h b/src/ModelAPI/ModelAPI_PluginManager.h index 2b2f2fc27..ce89be8cb 100644 --- a/src/ModelAPI/ModelAPI_PluginManager.h +++ b/src/ModelAPI/ModelAPI_PluginManager.h @@ -7,7 +7,7 @@ #include "ModelAPI.h" #include -#include +#include class ModelAPI_Feature; class ModelAPI_Plugin; @@ -24,7 +24,7 @@ class MODELAPI_EXPORT ModelAPI_PluginManager { public: /// Returns the real implementation (the alone instance per application) of the plugin manager - static std::shared_ptr get(); + static boost::shared_ptr get(); /// Registers the plugin that creates features. /// It is obligatory for each plugin to call this function on loading to be found by @@ -32,16 +32,16 @@ public: virtual void registerPlugin(ModelAPI_Plugin* thePlugin) = 0; /// Returns the root document of the application (that may contains sub-documents) - virtual std::shared_ptr rootDocument() = 0; + virtual boost::shared_ptr rootDocument() = 0; /// Return true if root document has been already created virtual bool hasRootDocument() = 0; /// Returns the current document that used for current work in the application - virtual std::shared_ptr currentDocument() = 0; + virtual boost::shared_ptr currentDocument() = 0; /// Defines the current document that used for current work in the application - virtual void setCurrentDocument(std::shared_ptr theDoc) = 0; + virtual void setCurrentDocument(boost::shared_ptr theDoc) = 0; /// loads the library with specific name, appends "lib*.dll" or "*.so" depending on the platform static void loadLibrary(const std::string theLibName); @@ -54,9 +54,9 @@ public: protected: /// Creates the feature object using plugins functionality - virtual std::shared_ptr createFeature(std::string theFeatureID) = 0; + virtual boost::shared_ptr createFeature(std::string theFeatureID) = 0; - static void SetPluginManager(std::shared_ptr theManager); + static void SetPluginManager(boost::shared_ptr theManager); friend class Model_Document; }; diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index e2e6891c4..6d1dac2cc 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -54,7 +54,7 @@ QString ModuleBase_Operation::operationId() const return myOperationId; } -std::shared_ptr ModuleBase_Operation::feature() const +boost::shared_ptr ModuleBase_Operation::feature() const { return myFeature; } @@ -112,7 +112,7 @@ bool ModuleBase_Operation::isGranted() const /* * Returns pointer to the root document. */ -std::shared_ptr ModuleBase_Operation::document() const +boost::shared_ptr ModuleBase_Operation::document() const { return ModelAPI_PluginManager::get()->rootDocument(); } @@ -268,8 +268,8 @@ void ModuleBase_Operation::storeReal(double theValue) return; } QString anId = sender()->objectName(); - std::shared_ptr aData = myFeature->data(); - std::shared_ptr aReal = aData->real(anId.toStdString()); + boost::shared_ptr aData = myFeature->data(); + boost::shared_ptr aReal = aData->real(anId.toStdString()); aReal->setValue(theValue); } @@ -292,7 +292,7 @@ bool ModuleBase_Operation::isReadyToStart() const */ void ModuleBase_Operation::startOperation() { - std::shared_ptr aDoc = ModelAPI_PluginManager::get()->rootDocument(); + boost::shared_ptr aDoc = ModelAPI_PluginManager::get()->rootDocument(); myFeature = aDoc->addFeature(myOperationId.toStdString()); if (myFeature) // TODO: generate an error if feature was not created myFeature->execute(); diff --git a/src/ModuleBase/ModuleBase_Operation.h b/src/ModuleBase/ModuleBase_Operation.h index a3c0c40c1..d7441c339 100644 --- a/src/ModuleBase/ModuleBase_Operation.h +++ b/src/ModuleBase/ModuleBase_Operation.h @@ -14,7 +14,7 @@ #include #include -#include +#include class SUIT_Study; class XGUI_Workshop; @@ -76,7 +76,7 @@ public: // Operation processing. virtual QString operationId() const; - std::shared_ptr feature() const; + boost::shared_ptr feature() const; OperationState state() const; bool isRunning() const; @@ -122,7 +122,7 @@ protected: void setExecStatus(const int); void setState(const OperationState); - std::shared_ptr document() const; + boost::shared_ptr document() const; private: int myFlags; //!< Operation flags @@ -132,7 +132,7 @@ private: //!< Next fields could be extracted into a subclass; QString myOperationId; QString myXmlRepr; - std::shared_ptr myFeature; + boost::shared_ptr myFeature; }; #endif diff --git a/src/PartSet/PartSet_OperationSketchBase.cpp b/src/PartSet/PartSet_OperationSketchBase.cpp index c5b70b0e0..69bbe52dc 100644 --- a/src/PartSet/PartSet_OperationSketchBase.cpp +++ b/src/PartSet/PartSet_OperationSketchBase.cpp @@ -31,7 +31,7 @@ PartSet_OperationSketchBase::~PartSet_OperationSketchBase() */ const TopoDS_Shape& PartSet_OperationSketchBase::preview() const { - shared_ptr aFeature = dynamic_pointer_cast(feature()); + boost::shared_ptr aFeature = boost::dynamic_pointer_cast(feature()); return aFeature->preview(); } diff --git a/src/PartSetPlugin/PartSetPlugin_Part.cxx b/src/PartSetPlugin/PartSetPlugin_Part.cxx index 440eb6f25..144411717 100644 --- a/src/PartSetPlugin/PartSetPlugin_Part.cxx +++ b/src/PartSetPlugin/PartSetPlugin_Part.cxx @@ -22,13 +22,13 @@ void PartSetPlugin_Part::initAttributes() void PartSetPlugin_Part::execute() { - shared_ptr aDocRef = data()->docRef(PART_ATTR_DOC_REF); + boost::shared_ptr aDocRef = data()->docRef(PART_ATTR_DOC_REF); if (!aDocRef->value()) { // create a document if not yet created - shared_ptr aPartSetDoc = ModelAPI_PluginManager::get()->rootDocument(); + boost::shared_ptr aPartSetDoc = ModelAPI_PluginManager::get()->rootDocument(); aDocRef->setValue(aPartSetDoc->subDocument(data()->getName())); } } -shared_ptr PartSetPlugin_Part::documentToAdd() { +boost::shared_ptr PartSetPlugin_Part::documentToAdd() { return ModelAPI_PluginManager::get()->rootDocument(); } diff --git a/src/PartSetPlugin/PartSetPlugin_Part.h b/src/PartSetPlugin/PartSetPlugin_Part.h index f1ee43064..25af3bea7 100644 --- a/src/PartSetPlugin/PartSetPlugin_Part.h +++ b/src/PartSetPlugin/PartSetPlugin_Part.h @@ -32,7 +32,7 @@ public: /// Request for initialization of data model of the feature: adding all attributes PARTSETPLUGIN_EXPORT virtual void initAttributes(); - PARTSETPLUGIN_EXPORT virtual std::shared_ptr documentToAdd(); + PARTSETPLUGIN_EXPORT virtual boost::shared_ptr documentToAdd(); /// Use plugin manager for features creation PartSetPlugin_Part(); diff --git a/src/PartSetPlugin/PartSetPlugin_Plugin.cxx b/src/PartSetPlugin/PartSetPlugin_Plugin.cxx index 7ef8f66e1..85ea1c37e 100644 --- a/src/PartSetPlugin/PartSetPlugin_Plugin.cxx +++ b/src/PartSetPlugin/PartSetPlugin_Plugin.cxx @@ -14,11 +14,11 @@ PartSetPlugin_Plugin::PartSetPlugin_Plugin() ModelAPI_PluginManager::get()->registerPlugin(this); } -shared_ptr PartSetPlugin_Plugin::createFeature(string theFeatureID) +boost::shared_ptr PartSetPlugin_Plugin::createFeature(string theFeatureID) { if (theFeatureID == "Part") { - return shared_ptr(new PartSetPlugin_Part); + return boost::shared_ptr(new PartSetPlugin_Part); } // feature of such kind is not found - return shared_ptr(); + return boost::shared_ptr(); } diff --git a/src/PartSetPlugin/PartSetPlugin_Plugin.h b/src/PartSetPlugin/PartSetPlugin_Plugin.h index 74f6e73c0..ff577f79a 100644 --- a/src/PartSetPlugin/PartSetPlugin_Plugin.h +++ b/src/PartSetPlugin/PartSetPlugin_Plugin.h @@ -13,7 +13,7 @@ class PARTSETPLUGIN_EXPORT PartSetPlugin_Plugin: public ModelAPI_Plugin { public: /// Creates the feature object of this plugin by the feature string ID - virtual std::shared_ptr createFeature(std::string theFeatureID); + virtual boost::shared_ptr createFeature(std::string theFeatureID); public: /// Is needed for python wrapping by swig diff --git a/src/SalomeModule/CMakeLists.txt b/src/SalomeModule/CMakeLists.txt new file mode 100644 index 000000000..2749ccfc9 --- /dev/null +++ b/src/SalomeModule/CMakeLists.txt @@ -0,0 +1,41 @@ +SET(CMAKE_AUTOMOC ON) + +SET(PROJECT_HEADERS + SalomeModule.h + SalomeModule_Module.h +) + +SET(PROJECT_AUTOMOC + ${CMAKE_CURRENT_BINARY_DIR}/XGUI_automoc.cpp +) + +SET(PROJECT_SOURCES + SalomeModule_Module.cpp +) + + +SET(PROJECT_LIBRARIES + Event + Config + ${QT_LIBRARIES} + XGUI +) + +ADD_DEFINITIONS( -DSalomeModule_EXPORTS ${CAS_DEFINITIONS} ) + +INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/XGUI + ${SALOME_GUI_INCLUDE} + ${CAS_INCLUDE_DIRS} +) + +ADD_LIBRARY(SalomeModule SHARED + ${PROJECT_SOURCES} + ${PROJECT_HEADERS} +) + +ADD_DEPENDENCIES(SalomeModule XGUI) + +# The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore +TARGET_LINK_LIBRARIES(SalomeModule ${PROJECT_LIBRARIES}) + +INSTALL(TARGETS SalomeModule DESTINATION bin) diff --git a/src/SalomeModule/SalomeModule.h b/src/SalomeModule/SalomeModule.h new file mode 100644 index 000000000..e8977e5a8 --- /dev/null +++ b/src/SalomeModule/SalomeModule.h @@ -0,0 +1,21 @@ +#ifndef SalomeModule_H +#define SalomeModule_H + +#if defined SalomeModule_EXPORTS +#if defined WIN32 +#define SalomeModule_EXPORT __declspec( dllexport ) +#else +#define SalomeModule_EXPORT +#endif +#else +#if defined WIN32 +#define SalomeModule_EXPORT __declspec( dllimport ) +#else +#define SalomeModule_EXPORT +#endif +#endif + +#endif + + + diff --git a/src/SalomeModule/SalomeModule_Module.cpp b/src/SalomeModule/SalomeModule_Module.cpp new file mode 100644 index 000000000..1190e77e9 --- /dev/null +++ b/src/SalomeModule/SalomeModule_Module.cpp @@ -0,0 +1,44 @@ + + +#include "SalomeModule_Module.h" + +#include +#include + + + +SalomeModule_Module::SalomeModule_Module() +: LightApp_Module( "NewGeom" ) +{ +} + + +SalomeModule_Module::~SalomeModule_Module() +{ +} + +void SalomeModule_Module::initialize(CAM_Application* theApp) +{ +} + +void SalomeModule_Module::windows(QMap& theWndMap) const +{ + theWndMap.insert( LightApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea ); +} + +void SalomeModule_Module::viewManagers(QStringList& theList) const +{ + theList.append( OCCViewer_Viewer::Type() ); +} + +bool SalomeModule_Module::activateModule(SUIT_Study* theStudy) +{ + return LightApp_Module::activateModule(theStudy); +} + +bool SalomeModule_Module::deactivateModule(SUIT_Study* theStudy) +{ + return LightApp_Module::deactivateModule(theStudy); +} + + diff --git a/src/SalomeModule/SalomeModule_Module.h b/src/SalomeModule/SalomeModule_Module.h new file mode 100644 index 000000000..d4acd2708 --- /dev/null +++ b/src/SalomeModule/SalomeModule_Module.h @@ -0,0 +1,27 @@ + + +#ifndef SalomeModule_Module_H +#define SalomeModule_Module_H + +#include + +class SalomeModule_Module: public LightApp_Module +{ + Q_OBJECT +public: + SalomeModule_Module(); + virtual ~SalomeModule_Module(); + + virtual void initialize( CAM_Application* theApp); + virtual void windows( QMap& theWndMap) const; + virtual void viewManagers( QStringList& theList) const; + +public slots: + bool activateModule( SUIT_Study* theStudy); + bool deactivateModule( SUIT_Study* theStudy); + +private: + +}; + +#endif diff --git a/src/SketchPlugin/SketchPlugin_Plugin.cpp b/src/SketchPlugin/SketchPlugin_Plugin.cpp index 56f3b20e7..114940981 100644 --- a/src/SketchPlugin/SketchPlugin_Plugin.cpp +++ b/src/SketchPlugin/SketchPlugin_Plugin.cpp @@ -14,14 +14,14 @@ SketchPlugin_Plugin::SketchPlugin_Plugin() ModelAPI_PluginManager::get()->registerPlugin(this); } -shared_ptr SketchPlugin_Plugin::createFeature(string theFeatureID) +boost::shared_ptr SketchPlugin_Plugin::createFeature(string theFeatureID) { if (theFeatureID == "Sketch") { - return shared_ptr(new SketchPlugin_Sketch); + return boost::shared_ptr(new SketchPlugin_Sketch); } /*else if (theFeatureID == "Point") { return shared_ptr(new SketchPlugin_Point); }*/ // feature of such kind is not found - return shared_ptr(); + return boost::shared_ptr(); } diff --git a/src/SketchPlugin/SketchPlugin_Plugin.h b/src/SketchPlugin/SketchPlugin_Plugin.h index 2b2666350..f232b68fa 100644 --- a/src/SketchPlugin/SketchPlugin_Plugin.h +++ b/src/SketchPlugin/SketchPlugin_Plugin.h @@ -13,7 +13,7 @@ class SKETCHPLUGIN_EXPORT SketchPlugin_Plugin: public ModelAPI_Plugin { public: /// Creates the feature object of this plugin by the feature string ID - virtual std::shared_ptr createFeature(std::string theFeatureID); + virtual boost::shared_ptr createFeature(std::string theFeatureID); public: /// Is needed for python wrapping by swig diff --git a/src/XGUI/XGUI_Constants.h b/src/XGUI/XGUI_Constants.h index f523c3ed8..f228e092e 100644 --- a/src/XGUI/XGUI_Constants.h +++ b/src/XGUI/XGUI_Constants.h @@ -12,7 +12,7 @@ typedef QList QShortList; //!< list of short int values typedef QList QDoubleList; //!< list of double values //! Pointer on feature object -typedef std::shared_ptr FeaturePtr; +typedef boost::shared_ptr FeaturePtr; typedef QList QFeatureList; //!< List of features namespace XGUI diff --git a/src/XGUI/XGUI_DataTreeModel.h b/src/XGUI/XGUI_DataTreeModel.h index c602d02c1..676c9d8fd 100644 --- a/src/XGUI/XGUI_DataTreeModel.h +++ b/src/XGUI/XGUI_DataTreeModel.h @@ -15,7 +15,7 @@ class XGUI_EXPORT XGUI_FeaturesModel : public QAbstractItemModel { public: - XGUI_FeaturesModel(const std::shared_ptr& theDocument, QObject* theParent): + XGUI_FeaturesModel(const boost::shared_ptr& theDocument, QObject* theParent): QAbstractItemModel(theParent), myDocument(theDocument) {} //! Returns Feature object by the given Model index. @@ -23,13 +23,13 @@ public: virtual FeaturePtr feature(const QModelIndex& theIndex) const = 0; //! Returns parent index of the given feature - virtual QModelIndex findParent(const std::shared_ptr& theFeature) const = 0; + virtual QModelIndex findParent(const boost::shared_ptr& theFeature) const = 0; //! Returns index corresponded to the group virtual QModelIndex findGroup(const std::string& theGroup) const = 0; protected: - std::shared_ptr myDocument; + boost::shared_ptr myDocument; }; @@ -40,13 +40,13 @@ protected: class XGUI_PartModel : public XGUI_FeaturesModel { public: - XGUI_PartModel(const std::shared_ptr& theDocument, QObject* theParent): + XGUI_PartModel(const boost::shared_ptr& theDocument, QObject* theParent): XGUI_FeaturesModel(theDocument, theParent) {} void setPartId(int theId) { myId = theId; } //! Returns true if the given document is a sub-document of this tree - virtual bool hasDocument(const std::shared_ptr& theDoc) const = 0; + virtual bool hasDocument(const boost::shared_ptr& theDoc) const = 0; protected: //! Id of the current part object in the document diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 1df329170..5300fe5c1 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -26,7 +26,7 @@ XGUI_Displayer::~XGUI_Displayer() * Display the feature * \param theFeature a feature instance */ -void XGUI_Displayer::Display(std::shared_ptr theFeature) +void XGUI_Displayer::Display(boost::shared_ptr theFeature) { } @@ -35,7 +35,7 @@ void XGUI_Displayer::Display(std::shared_ptr theFeature) * \param theFeature a feature instance * \param theFeature a shape */ -void XGUI_Displayer::Display(std::shared_ptr theFeature, +void XGUI_Displayer::Display(boost::shared_ptr theFeature, const TopoDS_Shape& theShape) { Handle(AIS_InteractiveContext) aContext = myViewer->AISContext(); diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index cf5dbbbd9..10480ef97 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -4,6 +4,7 @@ #include "XGUI.h" #include +#include #include @@ -20,9 +21,9 @@ public: XGUI_Displayer(XGUI_Viewer* theViewer); virtual ~XGUI_Displayer(); - void Display(std::shared_ptr theFeature); + void Display(boost::shared_ptr theFeature); - void Display(std::shared_ptr theFeature, const TopoDS_Shape& theShape); + void Display(boost::shared_ptr theFeature, const TopoDS_Shape& theShape); protected: XGUI_Viewer* myViewer; ///< the viewer diff --git a/src/XGUI/XGUI_DocumentDataModel.cpp b/src/XGUI/XGUI_DocumentDataModel.cpp index 9ccc7f643..7fae4b2bd 100644 --- a/src/XGUI/XGUI_DocumentDataModel.cpp +++ b/src/XGUI/XGUI_DocumentDataModel.cpp @@ -19,7 +19,7 @@ XGUI_DocumentDataModel::XGUI_DocumentDataModel(QObject* theParent) : QAbstractItemModel(theParent) { // Find Document object - std::shared_ptr aMgr = ModelAPI_PluginManager::get(); + boost::shared_ptr aMgr = ModelAPI_PluginManager::get(); myDocument = aMgr->currentDocument(); // Register in event loop @@ -43,8 +43,8 @@ void XGUI_DocumentDataModel::processEvent(const Event_Message* theMessage) // Created object event ******************* if (QString(theMessage->eventID().eventText()) == EVENT_FEATURE_CREATED) { const ModelAPI_FeatureUpdatedMessage* aUpdMsg = dynamic_cast(theMessage); - std::shared_ptr aDoc = aUpdMsg->document(); - std::shared_ptr aFeature = aUpdMsg->feature(); + boost::shared_ptr aDoc = aUpdMsg->document(); + boost::shared_ptr aFeature = aUpdMsg->feature(); if (aDoc == myDocument) { // If root objects if (aFeature->getGroup().compare(PARTS_GROUP) == 0) { // Updsate only Parts group @@ -80,7 +80,7 @@ void XGUI_DocumentDataModel::processEvent(const Event_Message* theMessage) // Deteted object event *********************** } else if (QString(theMessage->eventID().eventText()) == EVENT_FEATURE_DELETED) { const ModelAPI_FeatureDeletedMessage* aUpdMsg = dynamic_cast(theMessage); - std::shared_ptr aDoc = aUpdMsg->document(); + boost::shared_ptr aDoc = aUpdMsg->document(); if (aDoc == myDocument) { // If root objects if (aUpdMsg->group().compare(PARTS_GROUP) == 0) { // Updsate only Parts group diff --git a/src/XGUI/XGUI_DocumentDataModel.h b/src/XGUI/XGUI_DocumentDataModel.h index ba7558e0e..592308ae8 100644 --- a/src/XGUI/XGUI_DocumentDataModel.h +++ b/src/XGUI/XGUI_DocumentDataModel.h @@ -74,7 +74,7 @@ private: bool hasSubModel(const QAbstractItemModel* theModel) const; //! Document - std::shared_ptr myDocument; + boost::shared_ptr myDocument; //! Data model of top part of data tree (not parts object) XGUI_TopDataModel* myModel; diff --git a/src/XGUI/XGUI_PartDataModel.cpp b/src/XGUI/XGUI_PartDataModel.cpp index 127c3478f..ba5bbbea3 100644 --- a/src/XGUI/XGUI_PartDataModel.cpp +++ b/src/XGUI/XGUI_PartDataModel.cpp @@ -9,7 +9,7 @@ #include -XGUI_TopDataModel::XGUI_TopDataModel(const std::shared_ptr& theDocument, QObject* theParent) +XGUI_TopDataModel::XGUI_TopDataModel(const boost::shared_ptr& theDocument, QObject* theParent) : XGUI_FeaturesModel(theDocument, theParent) { } @@ -29,7 +29,7 @@ QVariant XGUI_TopDataModel::data(const QModelIndex& theIndex, int theRole) const return tr("Parameters"); case ParamObject: { - std::shared_ptr aFeature = myDocument->feature(PARAMETERS_GROUP, theIndex.row()); + boost::shared_ptr aFeature = myDocument->feature(PARAMETERS_GROUP, theIndex.row()); if (aFeature) return aFeature->data()->getName().c_str(); } @@ -37,7 +37,7 @@ QVariant XGUI_TopDataModel::data(const QModelIndex& theIndex, int theRole) const return tr("Constructions"); case ConstructObject: { - std::shared_ptr aFeature = myDocument->feature(CONSTRUCTIONS_GROUP, theIndex.row()); + boost::shared_ptr aFeature = myDocument->feature(CONSTRUCTIONS_GROUP, theIndex.row()); if (aFeature) return aFeature->data()->getName().c_str(); } @@ -141,7 +141,7 @@ FeaturePtr XGUI_TopDataModel::feature(const QModelIndex& theIndex) const } -QModelIndex XGUI_TopDataModel::findParent(const std::shared_ptr& theFeature) const +QModelIndex XGUI_TopDataModel::findParent(const boost::shared_ptr& theFeature) const { QString aGroup(theFeature->getGroup().c_str()); @@ -165,7 +165,7 @@ QModelIndex XGUI_TopDataModel::findGroup(const std::string& theGroup) const //****************************************************************** //****************************************************************** //****************************************************************** -XGUI_PartDataModel::XGUI_PartDataModel(const std::shared_ptr& theDocument, QObject* theParent) +XGUI_PartDataModel::XGUI_PartDataModel(const boost::shared_ptr& theDocument, QObject* theParent) : XGUI_PartModel(theDocument, theParent) { } @@ -183,7 +183,7 @@ QVariant XGUI_PartDataModel::data(const QModelIndex& theIndex, int theRole) cons switch (theIndex.internalId()) { case MyRoot: { - std::shared_ptr aFeature = myDocument->feature(PARTS_GROUP, myId); + boost::shared_ptr aFeature = myDocument->feature(PARTS_GROUP, myId); if (aFeature) return aFeature->data()->getName().c_str(); } @@ -193,14 +193,14 @@ QVariant XGUI_PartDataModel::data(const QModelIndex& theIndex, int theRole) cons return tr("Constructions"); case ParamObject: { - std::shared_ptr aFeature = + boost::shared_ptr aFeature = featureDocument()->feature(PARAMETERS_GROUP, theIndex.row()); if (aFeature) return aFeature->data()->getName().c_str(); } case ConstructObject: { - std::shared_ptr aFeature = + boost::shared_ptr aFeature = featureDocument()->feature(CONSTRUCTIONS_GROUP, theIndex.row()); if (aFeature) return aFeature->data()->getName().c_str(); @@ -299,9 +299,9 @@ bool XGUI_PartDataModel::hasChildren(const QModelIndex& theParent) const } -std::shared_ptr XGUI_PartDataModel::featureDocument() const +boost::shared_ptr XGUI_PartDataModel::featureDocument() const { - std::shared_ptr aFeature = myDocument->feature(PARTS_GROUP, myId); + boost::shared_ptr aFeature = myDocument->feature(PARTS_GROUP, myId); return aFeature->data()->docRef("PartDocument")->value(); } @@ -321,13 +321,13 @@ FeaturePtr XGUI_PartDataModel::feature(const QModelIndex& theIndex) const return FeaturePtr(); } -bool XGUI_PartDataModel::hasDocument(const std::shared_ptr& theDoc) const +bool XGUI_PartDataModel::hasDocument(const boost::shared_ptr& theDoc) const { return (featureDocument() == theDoc); } -QModelIndex XGUI_PartDataModel::findParent(const std::shared_ptr& theFeature) const +QModelIndex XGUI_PartDataModel::findParent(const boost::shared_ptr& theFeature) const { QString aGroup(theFeature->getGroup().c_str()); diff --git a/src/XGUI/XGUI_PartDataModel.h b/src/XGUI/XGUI_PartDataModel.h index 15c863519..f81f303f4 100644 --- a/src/XGUI/XGUI_PartDataModel.h +++ b/src/XGUI/XGUI_PartDataModel.h @@ -14,7 +14,7 @@ class XGUI_EXPORT XGUI_TopDataModel : public XGUI_FeaturesModel { Q_OBJECT public: - XGUI_TopDataModel(const std::shared_ptr& theDocument, QObject* theParent); + XGUI_TopDataModel(const boost::shared_ptr& theDocument, QObject* theParent); virtual ~XGUI_TopDataModel(); // Reimplementation from QAbstractItemModel @@ -37,7 +37,7 @@ public: virtual FeaturePtr feature(const QModelIndex& theIndex) const; //! Returns parent index of the given feature - virtual QModelIndex findParent(const std::shared_ptr& theFeature) const; + virtual QModelIndex findParent(const boost::shared_ptr& theFeature) const; //! Returns index corresponded to the group virtual QModelIndex findGroup(const std::string& theGroup) const; @@ -63,7 +63,7 @@ class XGUI_PartDataModel : public XGUI_PartModel { Q_OBJECT public: - XGUI_PartDataModel(const std::shared_ptr& theDocument, QObject* theParent); + XGUI_PartDataModel(const boost::shared_ptr& theDocument, QObject* theParent); virtual ~XGUI_PartDataModel(); // Reimplementation from QAbstractItemModel @@ -86,16 +86,16 @@ public: virtual FeaturePtr feature(const QModelIndex& theIndex) const; //! Returns true if the given document is a sub-document of this tree - virtual bool hasDocument(const std::shared_ptr& theDoc) const; + virtual bool hasDocument(const boost::shared_ptr& theDoc) const; //! Returns parent index of the given feature - virtual QModelIndex findParent(const std::shared_ptr& theFeature) const; + virtual QModelIndex findParent(const boost::shared_ptr& theFeature) const; //! Returns index corresponded to the group virtual QModelIndex findGroup(const std::string& theGroup) const; private: - std::shared_ptr featureDocument() const; + boost::shared_ptr featureDocument() const; //! Types of QModelIndexes enum DataIds { diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index 510fb1b40..6421d278b 100644 --- a/src/XGUI/XGUI_SelectionMgr.cpp +++ b/src/XGUI/XGUI_SelectionMgr.cpp @@ -34,8 +34,8 @@ void XGUI_SelectionMgr::onSelectionChanged() if (mySelectedData.size() > 0) { FeaturePtr aFeature = mySelectedData.first(); - std::shared_ptr aMgr = ModelAPI_PluginManager::get(); - std::shared_ptr aDocRef = aFeature->data()->docRef("PartDocument"); + boost::shared_ptr aMgr = ModelAPI_PluginManager::get(); + boost::shared_ptr aDocRef = aFeature->data()->docRef("PartDocument"); if (aDocRef) aMgr->setCurrentDocument(aDocRef->value()); } diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 891172028..9e2586a77 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -73,12 +73,12 @@ void XGUI_Workshop::startApplication() updateCommandStatus(); onNew(); // Testing of document creation - //std::shared_ptr aMgr = ModelAPI_PluginManager::get(); - //std::shared_ptr aPoint1 = aMgr->rootDocument()->addFeature("Point"); - //std::shared_ptr aPart = aMgr->rootDocument()->addFeature("Part"); + //boost::shared_ptr aMgr = ModelAPI_PluginManager::get(); + //boost::shared_ptr aPoint1 = aMgr->rootDocument()->addFeature("Point"); + //boost::shared_ptr aPart = aMgr->rootDocument()->addFeature("Part"); //aPart->execute(); //aMgr->setCurrentDocument(aPart->data()->docRef("PartDocument")->value()); - //std::shared_ptr aPoint2 = aMgr->rootDocument()->addFeature("Point"); + //boost::shared_ptr aPoint2 = aMgr->rootDocument()->addFeature("Point"); //aPoint2 = aMgr->rootDocument()->addFeature("Point"); //aPart = aMgr->rootDocument()->addFeature("Part"); @@ -296,8 +296,8 @@ void XGUI_Workshop::onSaveAs() void XGUI_Workshop::onUndo() { myMainWindow->objectBrowser()->setCurrentIndex(QModelIndex()); - std::shared_ptr aMgr = ModelAPI_PluginManager::get(); - std::shared_ptr aDoc = aMgr->rootDocument(); + boost::shared_ptr aMgr = ModelAPI_PluginManager::get(); + boost::shared_ptr aDoc = aMgr->rootDocument(); aDoc->undo(); updateCommandStatus(); } @@ -306,8 +306,8 @@ void XGUI_Workshop::onUndo() void XGUI_Workshop::onRedo() { myMainWindow->objectBrowser()->setCurrentIndex(QModelIndex()); - std::shared_ptr aMgr = ModelAPI_PluginManager::get(); - std::shared_ptr aDoc = aMgr->rootDocument(); + boost::shared_ptr aMgr = ModelAPI_PluginManager::get(); + boost::shared_ptr aDoc = aMgr->rootDocument(); aDoc->redo(); updateCommandStatus(); } @@ -391,7 +391,7 @@ void XGUI_Workshop::updateCommandStatus() QList aCommands = aMenuBar->features(); QList::const_iterator aIt; - std::shared_ptr aMgr = ModelAPI_PluginManager::get(); + boost::shared_ptr aMgr = ModelAPI_PluginManager::get(); if (aMgr->hasRootDocument()) { XGUI_Command* aUndoCmd; XGUI_Command* aRedoCmd; @@ -403,7 +403,7 @@ void XGUI_Workshop::updateCommandStatus() else // Enable all commands (*aIt)->enable(); } - std::shared_ptr aDoc = aMgr->rootDocument(); + boost::shared_ptr aDoc = aMgr->rootDocument(); aUndoCmd->setEnabled(aDoc->canUndo()); aRedoCmd->setEnabled(aDoc->canRedo()); } else {