X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_Document.h;h=218ea615bf88cdc004b6c5f8ece6bae4b2acdcc9;hb=6b4c275bd0ec90bbd4f34614ece1535a6ce2bbe7;hp=678a3f83d00466f33a40db2fb7b0aaf94ea0e277;hpb=34c92803a174324249d12ae0eb45143e0d8a9c23;p=modules%2Fshaper.git diff --git a/src/Model/Model_Document.h b/src/Model/Model_Document.h index 678a3f83d..218ea615b 100644 --- a/src/Model/Model_Document.h +++ b/src/Model/Model_Document.h @@ -16,13 +16,10 @@ class Handle_Model_Document; /**\class Model_Document * \ingroup DataModel - * \brief Document for internal data structure of any object storage. Corresponds to the SALOME study. - * Document contains all data of te SALOME Study specific to this module - * that must be written into the HDF file. + * \brief Document for internal data structure of any object storage. + * Document contains all data that must be stored/retrived in the file. * Also it provides acces to this data: open/save, transactions management etc. - * to provide access to all stored data. */ - class Model_Document: public ModelAPI_Document { public: @@ -64,31 +61,24 @@ 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); - - //! Creates an iterator of the features by the specific groups - MODEL_EXPORT virtual std::shared_ptr featuresIterator( - const std::string theGroup); + MODEL_EXPORT virtual boost::shared_ptr subDocument(std::string theDocID); + ///! Returns the id of hte document 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 - MODEL_EXPORT virtual const std::vector& getGroups() const; - - //! Returns the index of feature in the group (zero based) - //! \retruns -1 if not found - MODEL_EXPORT virtual int featureIndex(std::shared_ptr theFeature); + //! Returns the number of features in the group + MODEL_EXPORT virtual int size(const std::string& theGroupID); protected: @@ -97,12 +87,16 @@ 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 + //! Returns the object by the feature + boost::shared_ptr objectByFeature( + const boost::shared_ptr theFeature); + + //! Synchronizes myFeatures list with the updated document void synchronizeFeatures(); //! Creates new document with binary file format @@ -115,12 +109,13 @@ private: Handle_TDocStd_Document myDoc; ///< OCAF document /// number of transactions after the last "save" call, used for "IsModified" method int myTransactionsAfterSave; - /// root labels of the features groups identified by names - 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::set mySubs; ///< set of identifiers of sub-documents of this document + /// number of myTransactionsAfterSave for the nested transaction start + int myNestedStart; + /// All features managed by this document (not only in history of OB) + std::vector > myFeatures; + + ///< set of identifiers of sub-documents of this document + std::set mySubs; /// transaction indexes (related to myTransactionsAfterSave) which were empty in this doc std::map myIsEmptyTr; };