Free Electron
|
Dynamic Library Manager. More...
#include <Registry.h>
Public Member Functions | |
Registry (Master *pMaster) | |
virtual void | initialize (void) |
Result | addPath (String a_absPath) |
Add a path search for managed dynamic libraries. More... | |
Result | manage (const String &filename, bool adaptname=true, bool manageDependencies=true) |
Register the factories in the named dynamic library. More... | |
Result | manage (sp< Library > &a_rspLibrary) |
Register the factories in the Library object. More... | |
Result | unmanage (const String &filename) |
(prototypical) Release interest in the named library More... | |
void | substituteLibrary (const String &oldDlName, const String &newDlName) |
Substitute a dynamic library. More... | |
Result | registerLibrary (sp< Library > spLibrary) |
U32 | prune (void) |
Potentially release libraries who don't have instantiated components. More... | |
I32 | listAvailable (const String &pattern, Array< String > &available) const |
Return a list of available implementations that match the string pattern. More... | |
void | prioritize (const String &a_implementation, I32 a_priority) |
Adjust the priority of matching a particular implementation. More... | |
sp< Component > | create (const String &a_pattern, BWORD quiet=FALSE) const |
Instantiate a Component of the given named implementation. More... | |
sp< Component > | create (const char *a_pattern, BWORD quiet=FALSE) const |
sp< Component > | create (Regex &a_regex, BWORD quiet=FALSE) const |
sp< Counted > | create (String implementation, String name) const |
Instantiate a Counted of the given named implementation. More... | |
sp< Master > | master (void) const |
Access the Master (ptr may not be valid) More... | |
sp< Catalog > | manifest (void) |
Access the table of loadable components. More... | |
sp< Catalog > | typeManifest (void) |
Access the table of loadable types. More... | |
Tracker & | tracker (void) |
Access the component tracker. More... | |
const String & | name (void) const |
void | dump (void) const |
void | dumpLibraries (void) const |
void | addDependent (sp< Counted > spCounted) |
reference a Counted that is released just before unloading libraries More... | |
std::map< String, FactoryLocation * > & | factoryMap (void) |
Public Member Functions inherited from fe::Initialized | |
void | initializeAll (void) |
void | setActive (bool a_active) |
Public Member Functions inherited from fe::Handled< Registry > | |
const hp< Registry > & | getHandle (void) const |
Get a safe handle to this object. More... | |
Public Member Functions inherited from fe::Protectable | |
virtual I32 | protection (void) const |
virtual void | protect (void) |
virtual void | unprotect (void) |
virtual Protectable * | clone (Protectable *pInstance=NULL) |
Public Member Functions inherited from fe::Counted | |
virtual void | acquire (void) |
Increment the reference count. More... | |
virtual void | acquire (int &rCount) |
Increment the reference count (and get the count) More... | |
virtual void | release (void) |
Decrement the reference count. More... | |
virtual void | abandon (void) |
Decrement the reference count. More... | |
int | count (void) const |
Return the count of references. More... | |
void | setName (const String &) |
void | trackReference (void *pReference, String what) |
void | untrackReference (void *pReference) |
void | registerRegion (void *pT, U32 bytes) |
Private Member Functions | |
void | clear (void) |
sp< Component > | createInternal (const String *a_pattern, Regex *a_pRegex, BWORD quiet=FALSE) const |
I32 | findIndex (const String &filename) const |
void | unmanage (U32 index) |
Private Attributes | |
String | m_name |
Array< LoadedLibrary * > | m_loaderStack |
Array< sp< Counted > > | m_dependents |
std::map< String, FactoryLocation * > | m_factoryMap |
Tracker | m_tracker |
hp< Master > | m_hpMaster |
sp< Catalog > | m_spManifest |
sp< Catalog > | m_spTypeManifest |
Additional Inherited Members | |
Static Public Member Functions inherited from fe::Counted | |
static String | reportTracker (void) |
static U32 | trackerCount (void) |
Protected Types inherited from fe::Initialized | |
typedef void(* | InitializeFunction) (Initialized *) |
Protected Member Functions inherited from fe::Initialized | |
void | addInitializer (InitializeFunction function) |
Protected Member Functions inherited from fe::Handled< Registry > | |
void | abandonHandle (void) |
Protected Member Functions inherited from fe::Counted | |
int | releaseInternal (void) |
Decrement the reference count. More... | |
void | suppressReport (void) |
Dynamic Library Manager.
Libraries can only be safely loaded and unloaded in a FILO (first-in last-out) manner. These restrictions are handled internally, but it may require some forethought to optimize memory usage by reducing library retention.
reference a Counted that is released just before unloading libraries
Any number of dependents can be added.
Add a path search for managed dynamic libraries.
Currently, this only used on Windows.
References fe::DL_Loader::addPath().
Instantiate a Component of the given named implementation.
Referenced by fe::ext::DrawOpenGL::setContrast(), fe::ext::DroneMission::start(), and fe::ext::SurfaceGroundTireSystem::step().
Instantiate a Counted of the given named implementation.
References fe::Component::create().
Return a list of available implementations that match the string pattern.
Result fe::Registry::manage | ( | const String & | filename, |
bool | adaptname = true , |
||
bool | manageDependencies = true |
||
) |
Register the factories in the named dynamic library.
adaptname will append the platform-specific prefix and suffix to an abbreviated filename, such as from 'MyLib' to 'libMyLib.so',
manageDependencies will automatically preload any libraries that the given library says it needs.
Referenced by beacon::GlobalDictionary::start().
void fe::Registry::prioritize | ( | const String & | a_implementation, |
I32 | a_priority | ||
) |
Adjust the priority of matching a particular implementation.
U32 fe::Registry::prune | ( | void | ) |
Potentially release libraries who don't have instantiated components.
Substitute a dynamic library.
Further create() calls will load and use the new library.
|
inline |
Access the component tracker.
(prototypical) Release interest in the named library
This doesn't necessarily unload the library from memory.
In the current system, trying to re-manage a library may be unpredictable.