+//=============================================================================
+/*!
+ * GetTag: Returns the tag from entry
+ */
+//=============================================================================
+int GetTag(const TCollection_AsciiString &theEntry)
+{
+ const int aGeomObjDepth = 3;
+ const int aTag = theEntry.Token(":", aGeomObjDepth).IntegerValue();
+
+ return aTag;
+}
+
+//=============================================================================
+/*!
+ * FillMapOfRef: Fill the map of references
+ */
+//=============================================================================
+void FillMapOfRef(const Handle(GEOM_Function) &theFunction,
+ TIntToListIntMap &theRefMap)
+{
+ TDF_LabelSequence aSeq;
+ TCollection_AsciiString anObjEntry;
+ int anObjTag;
+
+ TDF_Tool::Entry(theFunction->GetOwnerEntry(), anObjEntry);
+ anObjTag = GetTag(anObjEntry);
+ theFunction->GetDependency(aSeq);
+
+ const Standard_Integer aLen = aSeq.Length();
+ Standard_Integer i;
+
+ for (i = 1; i <= aLen; i++) {
+ TDF_Label aRefLabel = aSeq.Value(i);
+ Handle(TDF_Reference) aRef;
+
+ if (aRefLabel.FindAttribute(TDF_Reference::GetID(), aRef)) {
+ if (!aRef.IsNull() && !aRef->Get().IsNull()) {
+ Handle(TDataStd_TreeNode) aT;
+
+ if (TDataStd_TreeNode::Find(aRef->Get(), aT)) {
+ TDF_Label aDepLabel = aT->Label();
+ Handle(GEOM_Function) aRefFunct = GEOM_Function::GetFunction(aDepLabel);
+
+ if (!aRefFunct.IsNull()) {
+ // Get entry of the referenced object.
+ TDF_Tool::Entry(aRefFunct->GetOwnerEntry(), anObjEntry);
+
+ const int aRefTag = GetTag(anObjEntry);
+
+ if (anObjTag != aRefTag) {
+ // Avoid making references for operations without copy.
+ theRefMap[anObjTag].push_back(aRefTag);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+