Accessing to Loaded Data

Here is an example of access to all the viewpoints loaded from a file:

// iresmgr is a pointer to the RED::IResourceManager interface.
// context is the vector of loaded contexts.

RED::IDataManager* idatamgr = iresmgr->GetDataManager()->As< RED::IDataManager >();

for( unsigned int c = 0; c < context.size(); ++c )
{
    // Get the number of viewpoints in the current context.
    unsigned int vcount;
    RC_TEST( idatamgr->GetViewpointsCount( vcount, context[c] ) );

    for( unsigned int v = 0; v < vcount; ++v )
    {
        RED::Object* viewpoint;
        RC_TEST( idatamgr->GetViewpoint( viewpoint, context[c], v, iresmgr->GetState() ) );
    }
}

Data stored in the RED data manager are not managed by the RED resource manager. Therefore, to destroy loaded data, you need to call a dedicated method in RED::IDataManager. The example below illustrates the destruction of an image, a full context or the whole stored data:

// image is a pointer to a loaded image.
// image_context is the context of the loaded image.

// Delete the image.
RC_TEST( idatamgr->ReleaseData( image_context, image, iresmgr->GetState() ) );

// Delete all the other image context data.
RC_TEST( idatamgr->ReleaseContext( image_context, false, iresmgr->GetState() ) );

// Delete all the contexts.
RC_TEST( idatamgr->Release( iresmgr->GetState() ) );