| Updated: October 28, 2024 |
After selecting a provider, applications can explore its root namespace to learn what data can be exchanged through this provider.
pips_entity_t* entity = NULL ;
pips_namespace_t* root = pips_provider_root( provider ) ;
/* Enumerate the entities in the root namespace. */
while ( (entity = pips_namespace_next_child( root, entity )) ) {
if ( pips_topic_narrow( entity ) ) {
printf( "Topic: %s\n", entity->name ) ;
}
else if ( pips_namespace_narrow( entity ) ) {
printf( "Namespace: %s\n", entity->name ) ;
}
else {
printf( "Unknown Entity Type: %s\n", entity->name ) ;
}
}
Usually, your application would do something other than merely printing the entity names. The above code would be useful to display the contents of a namespace to a user; for example, if they wanted to see whether a provider's root namespace contains sub-namespaces or certain topics.