Chaste Commit::1fd4e48e3990e67db148bc1bc4cf6991a0049d0c
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::shared_ptr< DynamicModelLoaderRegistrympInstance
 

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::DynamicModelLoaderRegistry ( )
private

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

Definition at line 81 of file DynamicModelLoaderRegistry.cpp.

Referenced by Instance().

Member Function Documentation

◆ GetLoader() [1/2]

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().

◆ GetLoader() [2/2]

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< ELEMENT_DIM, SPACE_DIM >::LoadCardiacCells().

◆ Instance()

◆ ScheduleForDeletion()

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 AbstractDynamicallyLoadableEntity::~AbstractDynamicallyLoadableEntity(), and GetLoader().

Member Data Documentation

◆ mDeletableLoaders

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().

◆ mLoaders

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().

◆ mpInstance

std::shared_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: