From: eap Date: Thu, 26 Feb 2015 09:50:03 +0000 (+0300) Subject: 22874: [CEA 1425] Performance SMESH Module X-Git-Tag: V7_6_0a1~17 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=af72965e1b231077430300d281912b17b83bfd45;p=modules%2Fkernel.git 22874: [CEA 1425] Performance SMESH Module + SObject::GetLastChildTag(); --- diff --git a/idl/SALOMEDS.idl b/idl/SALOMEDS.idl index 20f10df82..8ddffd4d3 100644 --- a/idl/SALOMEDS.idl +++ b/idl/SALOMEDS.idl @@ -1093,39 +1093,42 @@ Gets the list of open studies boolean IsNull(); /*! Gets an object %ID - \return ID of the %SObject. */ ID GetID(); -/*! Acquisition of the father %Component of the %SObject +/*! Acquisition of the father %Component of the %SObject \return The father %Component of the %SObject. */ SComponent GetFatherComponent(); -/*! Acquisition of the father %SObject of the %SObject +/*! Acquisition of the father %SObject of the %SObject \return the father %SObject of the given %SObject. */ SObject GetFather(); -/*! Gets the %tag of a %SObject +/*! Gets the %tag of a %SObject \return the %tag of a %SObject. */ short Tag(); -/*! Gets the depth of a %SObject +/*! Returns a tag of the last child %SObject (if any) of this %SObject. + Returns zero if this %SObject has no children. +*/ + short GetLastChildTag(); + +/*! Gets the depth of a %SObject \return the depth of a %SObject. */ short Depth(); -/*! Looks for subobjects of a given %SObject. +/*! Looks for subobjects of a given %SObject. \param atag Tag of the given %SObject \return True if it finds a subobject of the %SObject with a definite tag as well as the required subobject. */ - boolean FindSubObject (in long atag, out SObject obj); -/*! Looks for attributes of a given %SObject +/*! Looks for attributes of a given %SObject \param aTypeOfAttribute String value defining the type of the required attribute of the given %SObject. \return True if it finds an attribute of a definite type of the given %SObject as well as the discovered attribute. @@ -1133,29 +1136,28 @@ Gets the list of open studies */ boolean FindAttribute(out GenericAttribute anAttribute, in string aTypeOfAttribute); -/*! Looks for a %SObject which the given %SObject refers to. +/*! Looks for a %SObject which the given %SObject refers to. \return The object which the given %SObject refers to as well as True if it finds this object. */ boolean ReferencedObject(out SObject obj); // A REVOIR -/*! Gets all attributes of a given %SObject +/*! Gets all attributes of a given %SObject \return The list of all attributes of the given %SObject. See \ref example17 for an example of this method usage in batchmode of %SALOME application. */ ListOfAttributes GetAllAttributes(); -/*! Gets the study of a given %SObject. +/*! Gets the study of a given %SObject. \return The study containing the given %SObject. */ Study GetStudy(); /*! Gets the CORBA object by its own IOR attribute. Returns nil, if can't. - \return The CORBA object of the %SObject. */ Object GetObject(); diff --git a/src/DF/DF_Label.cxx b/src/DF/DF_Label.cxx index 9c2f29248..6ba881612 100644 --- a/src/DF/DF_Label.cxx +++ b/src/DF/DF_Label.cxx @@ -374,6 +374,12 @@ DF_Label DF_Label::NewChild() return FindChild(tag, true); } +//Returns a tag of the last child +int DF_Label::LastChildTag() const +{ + return _node->_lastChild ? _node->_lastChild->_tag : 0; +} + //Returns a string entry of this Label std::string DF_Label::Entry() const { diff --git a/src/DF/DF_Label.hxx b/src/DF/DF_Label.hxx index 810bec7aa..02fb88729 100644 --- a/src/DF/DF_Label.hxx +++ b/src/DF/DF_Label.hxx @@ -152,6 +152,9 @@ public: //Creates a new child Label of this Label. Standard_EXPORT DF_Label NewChild(); + //Returns a tag of the last child + Standard_EXPORT int LastChildTag() const; + //Returns a string presentation of the entry Standard_EXPORT std::string Entry() const; diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.cxx b/src/SALOMEDS/SALOMEDS_SObject_i.cxx index ccc2779ec..8914aad8a 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.cxx @@ -265,6 +265,17 @@ CORBA::Short SALOMEDS_SObject_i::Tag() return _impl->Tag(); } +//============================================================================ +/*! Function : GetLastChildTag + * Purpose : + */ +//============================================================================ +CORBA::Short SALOMEDS_SObject_i::GetLastChildTag() +{ + SALOMEDS::Locker lock; + return (CORBA::Short) _impl->GetLastChildTag(); +} + //============================================================================ /*! Function : Depth * Purpose : diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.hxx b/src/SALOMEDS/SALOMEDS_SObject_i.hxx index 280c907de..976a04997 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.hxx @@ -75,6 +75,7 @@ public: virtual void SetAttrString(const char*, const char*); virtual CORBA::Short Tag(); + virtual CORBA::Short GetLastChildTag(); virtual CORBA::Short Depth(); virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx index 77831f261..4f90d7768 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx @@ -88,39 +88,48 @@ std::string SALOMEDSImpl_SObject::GetID() const { return _lab.Entry(); } - + //============================================================================ /*! Function : GetFatherComponent - * Purpose : + * Purpose : */ //============================================================================ SALOMEDSImpl_SComponent SALOMEDSImpl_SObject::GetFatherComponent() const { - SALOMEDSImpl_SComponent sco; + SALOMEDSImpl_SComponent sco; DF_Label LF = _lab; while (!SALOMEDSImpl_SComponent::IsA(LF) && !LF.IsRoot()) { LF = LF.Father(); } - + if(LF.IsRoot()) return sco; - + return GetStudy()->GetSComponent(LF); } - + //============================================================================ /*! Function : GetFather - * Purpose : + * Purpose : */ //============================================================================ SALOMEDSImpl_SObject SALOMEDSImpl_SObject::GetFather() const { - return GetStudy()->GetSObject(_lab.Father()); + return GetStudy()->GetSObject(_lab.Father()); } +//============================================================================ +/*! Function : GetLastChild + * Purpose : + */ +//============================================================================ +int SALOMEDSImpl_SObject::GetLastChildTag() const +{ + return _lab.LastChildTag(); +} //============================================================================ /*! Function : GetStudy - * Purpose : + * Purpose : */ //============================================================================ SALOMEDSImpl_Study* SALOMEDSImpl_SObject::GetStudy() const diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_SObject.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_SObject.hxx index 9a5bbe0fa..ad90da654 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_SObject.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_SObject.hxx @@ -55,6 +55,7 @@ public: virtual std::string GetID() const; virtual SALOMEDSImpl_SComponent GetFatherComponent() const; virtual SALOMEDSImpl_SObject GetFather() const ; + virtual int GetLastChildTag() const ; virtual bool FindAttribute(DF_Attribute*& theAttribute, const std::string& theTypeOfAttribute) const; virtual bool ReferencedObject(SALOMEDSImpl_SObject& theObject) const ; virtual bool FindSubObject(int theTag, SALOMEDSImpl_SObject& theObject);