permanent IDs for topological entities (solids, faces, edges, vertices)

Given a Compound, you can get an indexed list of, say, the solids, with:
TopExp::MapShapes(Compound,TopAbs_SOLID,solidMap);
so say, your model has 3 solids, indexed 1,2,3 .. you can then access the solid shape using the index and the solidMap.
Problem is that those indexes are not permanent if you start deleting/adding things in your model ... for example, if I delete solid 2, the index for solid 1 probably stays 1 but the index for solid 3 becomes 2.
How do I get permanent IDs for the topological entities?
If I delete solid 2, I want to make sure indices 1 and 3 are still valid and can refer somehow to the proper solid shape.
Same idea for faces, edges and vertices.

Ugo Capeto's picture

ok, let me rephrase using Parasolid terminology, as they have what they call "identifiers" which enable to retrieve any topology from an outside application, no matter what you has happened to your model.
Here's the blurb about it:
---------------------------------------------------------------------------------------
Identifiers are integer values which are attached to all entities within a part, except for fins and the part itself. The identifiers within a part are distinct. Unlike tags, they are saved when a part is archived, so identifiers can be stored with a part key in an external database to keep a handle on a particular entity.

There is no guarantee that the same entities have the same tags when loaded into another session. The decision as to whether the application uses identifiers depends upon whether it needs to reference entities within archived parts in different modeling sessions.

When a part is archived, the application must use PK_ENTITY_ask_identifier to record the identifiers of entities it wishes to access in a new session.

When the part is retrieved, PK_PART_find_entity_by_ident is used to get the new tags of required entities.
---------------------------------------------------------------------------------------
Is there something similar in OCC, or could somebody point me to some documentation/code that shows something in the same vein ?
Many thanks, in advance.