Free Electron
Public Member Functions | Private Member Functions | Private Attributes | List of all members
fe::Registry Class Reference

Dynamic Library Manager. More...

#include <Registry.h>

Inheritance diagram for fe::Registry:
Inheritance graph
[legend]

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< Componentcreate (const String &a_pattern, BWORD quiet=FALSE) const
 Instantiate a Component of the given named implementation. More...
 
sp< Componentcreate (const char *a_pattern, BWORD quiet=FALSE) const
 
sp< Componentcreate (Regex &a_regex, BWORD quiet=FALSE) const
 
sp< Countedcreate (String implementation, String name) const
 Instantiate a Counted of the given named implementation. More...
 
sp< Mastermaster (void) const
 Access the Master (ptr may not be valid) More...
 
sp< Catalogmanifest (void)
 Access the table of loadable components. More...
 
sp< CatalogtypeManifest (void)
 Access the table of loadable types. More...
 
Trackertracker (void)
 Access the component tracker. More...
 
const Stringname (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 Protectableclone (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< ComponentcreateInternal (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< Masterm_hpMaster
 
sp< Catalogm_spManifest
 
sp< Catalogm_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)
 

Detailed Description

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.

Member Function Documentation

◆ addDependent()

void fe::Registry::addDependent ( sp< Counted spCounted)
inline

reference a Counted that is released just before unloading libraries

Any number of dependents can be added.

◆ addPath()

Result fe::Registry::addPath ( String  a_absPath)

Add a path search for managed dynamic libraries.

Currently, this only used on Windows.

References fe::DL_Loader::addPath().

◆ create() [1/2]

sp< Component > fe::Registry::create ( const String a_pattern,
BWORD  quiet = FALSE 
) const

◆ create() [2/2]

sp< Counted > fe::Registry::create ( String  implementation,
String  name 
) const

Instantiate a Counted of the given named implementation.

References fe::Component::create().

◆ listAvailable()

I32 fe::Registry::listAvailable ( const String pattern,
Array< String > &  available 
) const

Return a list of available implementations that match the string pattern.

◆ manage() [1/2]

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

◆ manage() [2/2]

Result fe::Registry::manage ( sp< Library > &  a_rspLibrary)

Register the factories in the Library object.

In cases where using a dso is not practical, the method can add factories directly from an existing Library object.

◆ manifest()

sp< Catalog > fe::Registry::manifest ( void  )

Access the table of loadable components.

◆ master()

sp< Master > fe::Registry::master ( void  ) const

Access the Master (ptr may not be valid)

◆ prioritize()

void fe::Registry::prioritize ( const String a_implementation,
I32  a_priority 
)

Adjust the priority of matching a particular implementation.

◆ prune()

U32 fe::Registry::prune ( void  )

Potentially release libraries who don't have instantiated components.

◆ substituteLibrary()

void fe::Registry::substituteLibrary ( const String oldDlName,
const String newDlName 
)

Substitute a dynamic library.

Further create() calls will load and use the new library.

◆ tracker()

Tracker& fe::Registry::tracker ( void  )
inline

Access the component tracker.

◆ typeManifest()

sp< Catalog > fe::Registry::typeManifest ( void  )

Access the table of loadable types.

◆ unmanage()

Result fe::Registry::unmanage ( const String filename)

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


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