How do I get a link between a XCAFDoc_GeomToleranceObject and a XCAFDimTolObjects_DatumObject?

I get the Datum Objects using the following code:

    ...

    cout << "***** Datum List *****" << endl;
    TDF_LabelSequence datSeq;
    dimTolTool->GetDatumLabels(datSeq);
    for (Standard_Integer idx = datSeq.Lower(); idx < datSeq.Upper(); idx++) {
        TDF_Label lab = datSeq.Value(idx);

        Handle(XCAFDoc_Datum) dat;
        if (lab.FindAttribute(XCAFDoc_Datum::GetID(), dat)) {
            Handle(XCAFDimTolObjects_DatumObject) datObj = dat->GetObject();
            ...
        }
    }

    ...

The logic for getting the GeomTolerance Objects is pretty much the same. My problem is that I can't figure out a way to establish a link between those two. (Either by common reference or any other way). The guide on Open Cascade doesn't explain this and on the forums I haven't found a solution.

My goal is to group the Dimension, Datum and GeomTol Labels into the "blocks" they belong to according to the step file.

Please help!

Attachments: