Chaste  Release::3.4
DynamicModelLoaderRegistry Class Reference

#include <DynamicModelLoaderRegistry.hpp>

+ Inheritance diagram for DynamicModelLoaderRegistry:
+ Collaboration diagram for DynamicModelLoaderRegistry:

Public Member Functions

DynamicCellModelLoaderPtr GetLoader (const std::string &rPath)
 
DynamicCellModelLoaderPtr GetLoader (const FileFinder &rFileFinder)
 
void ScheduleForDeletion (DynamicCellModelLoaderPtr pLoader)
 

Static Public Member Functions

static DynamicModelLoaderRegistryInstance ()
 

Private Member Functions

 DynamicModelLoaderRegistry ()
 

Private Attributes

std::map< std::string,
DynamicCellModelLoaderWeakPtr > 
mLoaders
 
std::set
< DynamicCellModelLoaderPtr > 
mDeletableLoaders
 

Static Private Attributes

static std::auto_ptr
< DynamicModelLoaderRegistry
mpInstance
 

Detailed Description

This class provides a static registry to keep track of the cell model loaders used, hence ensuring that we don't have a given .so loaded more than once at any given point.

Definition at line 54 of file DynamicModelLoaderRegistry.hpp.

Constructor & Destructor Documentation

DynamicModelLoaderRegistry::DynamicModelLoaderRegistry ( )
private

Private constructor; all access should be via Instance().

Definition at line 81 of file DynamicModelLoaderRegistry.cpp.

Referenced by Instance().

Member Function Documentation

DynamicCellModelLoaderPtr DynamicModelLoaderRegistry::GetLoader ( const std::string &  rPath)
Returns
the loader for the given .so file.
Parameters
rPathabsolute path to the .so
Todo:
#1957 causes segfaults
Todo:
#1957 remove when unloading working

Definition at line 48 of file DynamicModelLoaderRegistry.cpp.

References DynamicCellModelLoader::Create(), mLoaders, and ScheduleForDeletion().

Referenced by CellMLToSharedLibraryConverter::Convert(), GetLoader(), and AbstractCardiacTissue< SPACE_DIM >::LoadCardiacCells().

DynamicCellModelLoaderPtr DynamicModelLoaderRegistry::GetLoader ( const FileFinder rFileFinder)
Returns
the loader for the given .so file.
Parameters
rFileFinderfinder for the .so file

Definition at line 71 of file DynamicModelLoaderRegistry.cpp.

References FileFinder::GetAbsolutePath(), and GetLoader().

void DynamicModelLoaderRegistry::ScheduleForDeletion ( DynamicCellModelLoaderPtr  pLoader)

Schedule the given loader for deletion prior to loading any new .so.

Parameters
pLoaderthe loader to schedule for deletion

Definition at line 76 of file DynamicModelLoaderRegistry.cpp.

References mDeletableLoaders.

Referenced by GetLoader(), and AbstractDynamicallyLoadableEntity::~AbstractDynamicallyLoadableEntity().

Member Data Documentation

std::set<DynamicCellModelLoaderPtr> DynamicModelLoaderRegistry::mDeletableLoaders
private

Loaders to be deleted before creating any new ones.

Definition at line 91 of file DynamicModelLoaderRegistry.hpp.

Referenced by ScheduleForDeletion().

std::map<std::string, DynamicCellModelLoaderWeakPtr> DynamicModelLoaderRegistry::mLoaders
private

Loaders for shared-library cell models. Weak pointers are used so that the registry doesn't keep loaders alive when all cells created from them have been destroyed. Map is from absolute path of the library, to loader object.

Definition at line 88 of file DynamicModelLoaderRegistry.hpp.

Referenced by GetLoader().

std::auto_ptr< DynamicModelLoaderRegistry > DynamicModelLoaderRegistry::mpInstance
staticprivate

The single instance of this class.

The loader registry instance

Definition at line 94 of file DynamicModelLoaderRegistry.hpp.

Referenced by Instance().


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