XCAFDoc_ShapeTool NewShape does not generate a random tag

When adding a shape to the XCAFDoc_ShapeTool using NewShape, the newly created label has a Tag of 0. How can I have a generated tag for this label? Or is there another way to identify this label, so I can retrieve it later? (say the shapes name are populating a tree view, normally I need to store some identification feature, like a unique integer, so when the user click on an item in the tree, I can retrieve the shape by knowing the tag that I would store in the tree item as a simple integer).

mfregeau's picture

Got it, added that TDF_TagSource::NewChild line:

TDF_Label aLabel = myAssembly->NewShape();
TDF_TagSource::NewChild(aLabel);

now the aLabel.Tag(); has a unique integer.