if (!(TN->ID() == myTreeID) )
Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::Append : uncompatible GUID");
+ if(TN->Label() == Label())
+ Standard_Failure::Raise("Attempt of self linking");
+
Handle(SALOMEDSImpl_AttributeTreeNode) bid;
TN->SetNext(bid); // Deconnects from next.
if (!(TN->ID() == myTreeID) )
Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::Prepend : uncompatible GUID");
+ if(TN->Label() == Label())
+ Standard_Failure::Raise("Attempt of self linking");
+
Handle(SALOMEDSImpl_AttributeTreeNode) bid;
TN->SetPrevious(bid);
if (HasFirst()) {
if (!(TN->ID() == myTreeID) )
Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::InsertBefore : uncompatible GUID");
+ if(TN->Label() == Label())
+ Standard_Failure::Raise("Attempt of self linking");
+
TN->SetFather(GetFather());
TN->SetPrevious(GetPrevious());
TN->SetNext(this);
{
CheckLocked();
+ if(TN->Label() == Label())
+ Standard_Failure::Raise("Attempt of self linking");
+
if (!(TN->ID() == myTreeID) )
Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::InsertAfter : uncompatible GUID");
}
if (strncmp(aTypeOfAttribute.ToCString(), "AttributeUserID",15) == 0 ) {
+ Standard_GUID aUserGUID;
+ if (strcmp(aTypeOfAttribute.ToCString(), "AttributeUserID") == 0) {
+ aUserGUID = SALOMEDSImpl_AttributeUserID::DefaultID();
+ } else {
+ char* aGUIDString = new char[40];
+ char* aType = (char*)aTypeOfAttribute.ToCString();
+ sprintf(aGUIDString, &(aType[15]));
+ if(!Standard_GUID::CheckGUIDFormat(aGUIDString)) {
+ delete(aGUIDString);
+ return NULL;
+ }
+ aUserGUID = Standard_GUID(aGUIDString); // create tree node GUID by name
+ delete(aGUIDString);
+ }
Handle(SALOMEDSImpl_AttributeUserID) anAttr;
if (!Lab.FindAttribute(SALOMEDSImpl_AttributeUserID::DefaultID(), anAttr)) {
CheckLocked();
- anAttr = SALOMEDSImpl_AttributeUserID::Set(Lab, SALOMEDSImpl_AttributeUserID::DefaultID());
+ anAttr = SALOMEDSImpl_AttributeUserID::Set(Lab, aUserGUID);
}
return anAttr;
}
if(_root.IsNull() || theFather.IsNull() || theObject.IsNull()) return false;
TDF_Label aFatherLabel = theFather->GetLabel(), aLabel = theObject->GetLabel();
+ if(aFatherLabel == aLabel) return false;
+
Handle(SALOMEDSImpl_AttributeTreeNode) aFather, aNode;
if(aFatherLabel.IsNull()) return false;
if(_root.IsNull() || theFirst.IsNull() || theNext.IsNull()) return false;
TDF_Label aFirstLabel = theFirst->GetLabel(), aLabel= theNext->GetLabel();
+ if(aFirstLabel == aLabel) return false;
+
Handle(SALOMEDSImpl_AttributeTreeNode) aFirstNode, aNode;
if(aFirstLabel.IsNull()) return false;
{
TCollection_AsciiString aString;
if(_root.IsNull()) return aString;
-
+
Handle(SALOMEDSImpl_AttributeName) aName;
if (!_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) return aString;
aString = TCollection_AsciiString(aName->Value());