Isis Developer Reference
Isis::EmbreeTargetManager Class Reference

Class for managing the construction and destruction of EmbreeTargetShapes. More...

#include <EmbreeTargetManager.h>

Collaboration diagram for Isis::EmbreeTargetManager:
Collaboration graph

Public Member Functions

EmbreeTargetShapecreate (const QString &shapeFile)
 Get a pointer to an EmbreeTargetShape containing the information from a shape file.
 
void free (const QString &shapeFile)
 Notify the manager that an EmbreeTargetShape is no longer in use.
 
int currentCacheSize () const
 Return the number of currently stored EmbreeTargetShapes.
 
int maxCacheSize () const
 Return the maximum number of stored EmbreeTargetShapes.
 
bool inCache (const QString &shapeFile) const
 Check if there is an already created EmbreeTargetShape for a file.
 
void setMaxCacheSize (const int &numShapes)
 Set the maximum number of stored EmbreeTargetShapes.
 

Static Public Member Functions

static EmbreeTargetManagergetInstance ()
 Retrieve reference to Singleton instance of this object.
 

Detailed Description

Class for managing the construction and destruction of EmbreeTargetShapes.

This class is a singleton that constructs and holds EmbreeTargetShape. Due to the time required to construct a new EmbreeTargetShape and the large memory requirements, this class limits their creation and the number that can be held in memory at one time.

When an EmbreeTargetShape is requested the EmbreeTargetManager will first check if an EmbreeTargetShape for that file already exists. If one does, a pointer to the existing EmbreeTargetShape is given and the reference count is incremented. If one does not exist yet, a new EmbreeTargetShape is created on the heap. When an EmbreeTargetShape is no longer used, the EmbreeTargetManager should be notified and it will decrement the reference count on that EmbreeTargetShape. If the EmbreeTargetShape is no longer used by anything, then it is deleted.

Author
2017-05-08 Jesse mapel

Member Function Documentation

◆ create()

EmbreeTargetShape * Isis::EmbreeTargetManager::create ( const QString & shapeFile)

Get a pointer to an EmbreeTargetShape containing the information from a shape file.

If the shape file has already been stored in an EmbreeTargetShape then a pointer to that is returned. If the shape file has not been loaded yet, then it is loaded and a pointer to the EmbreeTargetShape is returned.

In both cases, ownership of the pointer is not passed. Use EmbreeTargetManager::free to notify the EmbreeTargetManager that the pointer is no longer in use.

The EmbreeTargetShapes take a large amount of time to create and memory to store, so the manager limits the number that can be opened at one time. If the limit is reached and a new one is requested, an error is thrown. Use EmbreeTargetManager::setMaxCacheSize to change the maximum number of EmbreeTargetShapes.

Parameters
shapeFileThe path to the file to create an EmbreeTargetShape from
Returns
EmbreeTargetShape* A pointer to the loaded target shape. The manager still owns the object so it should not be deleted. Use EmbreeTargetManager::free to notify the manager that it is no longer in use.
See also
EmbreeTargetManager::free
Exceptions
IException::Programmer

References _FILEINFO_.

Referenced by Isis::EmbreeShapeModel::EmbreeShapeModel(), and Isis::EmbreeShapeModel::EmbreeShapeModel().

◆ currentCacheSize()

int Isis::EmbreeTargetManager::currentCacheSize ( ) const

Return the number of currently stored EmbreeTargetShapes.

Returns
int The number of currently stored EmbreeTargetShapes.

◆ free()

void Isis::EmbreeTargetManager::free ( const QString & shapeFile)

Notify the manager that an EmbreeTargetShape is no longer in use.

This method will decrease the internal reference count for the target shape. Then if there are not more references. the EmbreeTargetShape is destroyed to free up memory.

Parameters
shapeFileThe path to the file used to create the EmbreeTargetShape. This should be the same as the parameter used with EmbreeTargetManager::create to get a pointer to the EmbreeTargetShape.
See also
EmbreeTargetManager::free
Exceptions
IException::Programmer

References _FILEINFO_.

Referenced by Isis::EmbreeShapeModel::~EmbreeShapeModel().

◆ getInstance()

EmbreeTargetManager * Isis::EmbreeTargetManager::getInstance ( )
static

Retrieve reference to Singleton instance of this object.

The only access provided for Singleton instance of this object. All method access is made through the pointer returned by this method. The object is created upon the first call to this method. The object is deleted when Qt shuts down.

Returns
EmbreeTargetManager* Pointer to Singleton instance of this object.

Referenced by Isis::ShapeModelFactory::create().

◆ inCache()

bool Isis::EmbreeTargetManager::inCache ( const QString & shapeFile) const

Check if there is an already created EmbreeTargetShape for a file.

Parameters
shapeFileThe path to the file to check for

◆ maxCacheSize()

int Isis::EmbreeTargetManager::maxCacheSize ( ) const

Return the maximum number of stored EmbreeTargetShapes.

Returns
int The maximum number of stored EmbreeTargetShapes.

◆ setMaxCacheSize()

void Isis::EmbreeTargetManager::setMaxCacheSize ( const int & numShapes)

Set the maximum number of stored EmbreeTargetShapes.

This does not apply retroactively. If there are more stored EmbreeTargetShapes than the new maximum, then they will remain and new EmbreeTargetShapes cannot be created until the number currently open goes below the maximum.

Parameters
numShapesThe new maximum number of stored EmbreeTargetShapes.

The documentation for this class was generated from the following files: