TAttrID2FunMap::const_iterator anEnd = __AttrID2FunMap__.end();
for(; anIter != anEnd; anIter++){
const TAttrID2FunMap::key_type& aKey = anIter->first;
- const TAttrID2FunMap::data_type& aValue = anIter->second;
+ const TAttrID2FunMap::mapped_type& aValue = anIter->second;
__GUID2AttrIDMap__[aValue.myGetGUID()] = aKey;
};
{
TAttrID2FunMap::const_iterator anIter = __AttrID2FunMap__.find(theType);
if(anIter != __AttrID2FunMap__.end()){
- const TAttrID2FunMap::data_type& aValue = anIter->second;
+ const TAttrID2FunMap::mapped_type& aValue = anIter->second;
return aValue.myGetGUID();
}
// create tree node GUID by name
* Purpose :
*/
//============================================================================
+TDF_Label SALOMEDS_SObject_i::GetFatherComponentLabel()
+{
+ TDF_Label aLabel = _lab;
+ while(!SALOMEDS_SComponent_i::IsA(aLabel) && !aLabel.IsRoot())
+ aLabel = aLabel.Father();
+
+ return aLabel;
+}
+
SALOMEDS::SComponent_ptr SALOMEDS_SObject_i::GetFatherComponent()
{
- TDF_Label aSCompLabel = _lab;
- while(!SALOMEDS_SComponent_i::IsA(aSCompLabel) && !aSCompLabel.IsRoot()){
- aSCompLabel = aSCompLabel.Father();
- }
+ TDF_Label aSCompLabel = GetFatherComponentLabel();
+
return SALOMEDS_SComponent_i::NewRef(_study,aSCompLabel)._retn();
}
SALOMEDS_SObject_i::TAttrHolder
SALOMEDS_SObject_i::_FindGenAttribute(const Handle(TDF_Attribute)& theAttr)
{
- TAttrHolder anGenAttr;
-
- Standard_GUID aGUID = theAttr->ID();
-
- TGUID2AttrIDMap::const_iterator anIter = __GUID2AttrIDMap__.find(aGUID);
- if(anIter != __GUID2AttrIDMap__.end()){
- const TAttributeID& anAttributeID = anIter->second;
- anGenAttr = _FindGenAttribute(anAttributeID.c_str());
- }
-
- return anGenAttr;
+ std::string aType = GetType(theAttr);
+ return _FindGenAttribute(aType.c_str());
}
SALOMEDS_GenericAttribute_i* anAttr;
TAttrID2FunMap::const_iterator anIter = __AttrID2FunMap__.find(theType);
if(anIter != __AttrID2FunMap__.end()){
- const TAttrID2FunMap::data_type& aValue = anIter->second;
+ const TAttrID2FunMap::mapped_type& aValue = anIter->second;
- if(aValue.myIsCheckLockedStudy())
- _study->CheckLocked();
+ //if(aValue.myIsCheckLockedStudy()) // mpv 03.02.05: creation of CORBA objects does not modify the study
+ // _study->CheckLocked();
anAttr = aValue.myNewInstance(theAttr,this);
return TAttrHolder(anAttr,anAttr->_this());
}
-SALOMEDS::GenericAttribute_ptr
-SALOMEDS_SObject_i::_FindCORBAAttribute(const char* theType)
+CORBA::Boolean
+SALOMEDS_SObject_i::FindAttribute(SALOMEDS::GenericAttribute_out theAttribute,
+ const char* theType)
{
TAttrHolder anAttr = _FindGenAttribute(theType);
SALOMEDS::GenericAttribute_var anGenAttr = anAttr.second;
if(!CORBA::is_nil(anGenAttr)){
- return anGenAttr._retn();
+ theAttribute = SALOMEDS::GenericAttribute::_duplicate(anGenAttr);
+ return true;
}
-
- return SALOMEDS::GenericAttribute::_nil();
-}
-
-
-CORBA::Boolean
-SALOMEDS_SObject_i::FindAttribute(SALOMEDS::GenericAttribute_out theAttribute,
- const char* theType)
-{
- theAttribute = _FindCORBAAttribute(theType);
- return !CORBA::is_nil(theAttribute);
+ return false;
}
Handle(TDF_Attribute) anAttr;
TAttrID2FunMap::const_iterator anIter = __AttrID2FunMap__.find(theType);
if(anIter != __AttrID2FunMap__.end()){
- const TAttrID2FunMap::data_type& aValue = anIter->second;
+ const TAttrID2FunMap::mapped_type& aValue = anIter->second;
if(aValue.myIsCheckLockedStudy())
_study->CheckLocked();
if(!_lab.FindAttribute(aGUID,anAttr)){
_study->CheckLocked();
anAttr = TDataStd_TreeNode::Set(_lab,aGUID);
- _lab.AddAttribute(anAttr);
return anAttr;
}
}
if(!_lab.FindAttribute(aGUID,anAttr)){
_study->CheckLocked();
anAttr = TDataStd_UAttribute::Set(_lab,aGUID);
- _lab.AddAttribute(anAttr);
return anAttr;
}
}