Arc::ModuleManager Class Reference

Manager of shared libraries. More...

#include <ModuleManager.h>

Inheritance diagram for Arc::ModuleManager:
Arc::PluginsFactory Arc::ClassLoader

Public Member Functions

 ModuleManager (XMLNode cfg)
Glib::Module * load (const std::string &name, bool probe)
std::string find (const std::string &name)
Glib::Module * reload (Glib::Module *module)
void use (Glib::Module *module)
void unuse (Glib::Module *module)
std::string findLocation (const std::string &name)
bool makePersistent (Glib::Module *module)
bool makePersistent (const std::string &name)
void setCfg (XMLNode cfg)

Protected Member Functions

void unload (Glib::Module *module)
void unload (const std::string &name)

Detailed Description

Manager of shared libraries.

This class loads shared libraries/modules. There supposed to be created one instance of it per executable. In such circumstances it would cache handles to loaded modules and not load them multiple times.


Constructor & Destructor Documentation

Arc::ModuleManager::ModuleManager ( XMLNode  cfg  ) 

Constructor. It is supposed to process correponding configuration subtree and tune module loading parameters accordingly.


Member Function Documentation

std::string Arc::ModuleManager::find ( const std::string &  name  ) 

Finds loadable module by 'name' looking in same places as load() does, but does not load it.

std::string Arc::ModuleManager::findLocation ( const std::string &  name  ) 

Finds shared library corresponding to module 'name' and returns path to it

Glib::Module* Arc::ModuleManager::load ( const std::string &  name,
bool  probe 
)

Finds module 'name' in cache or loads corresponding loadable module

bool Arc::ModuleManager::makePersistent ( const std::string &  name  ) 

Make sure this module is never unloaded. Even if unload() is called.

bool Arc::ModuleManager::makePersistent ( Glib::Module *  module  ) 

Make sure this module is never unloaded. Even if unload() is called. Call to this method does not affect how other methods arel behaving. Just loaded module stays in memory after all unloading procedures.

Glib::Module* Arc::ModuleManager::reload ( Glib::Module *  module  ) 

Reload module previously loaded in probe mode. New module is loaded with all symbols resolved and old module handler is unloaded. In case of error old module is not unloaded.

void Arc::ModuleManager::setCfg ( XMLNode  cfg  ) 

Input the configuration subtree, and trigger the module loading (do almost the same as the Constructor). This method is desigined for ClassLoader to adopt the singleton pattern.

void Arc::ModuleManager::unload ( const std::string &  name  )  [protected]

Unload module by its name

void Arc::ModuleManager::unload ( Glib::Module *  module  )  [protected]

Unload module by its identifier. Decreases load counter and unloads module when it reaches 0.

void Arc::ModuleManager::unuse ( Glib::Module *  module  ) 

Decrease usage count till it reaches 0. This call does not unload module. Usage counter is only for preventing unexpected unload. Unloading is done by unload() methods and by desctructor if usage counter is zero.

void Arc::ModuleManager::use ( Glib::Module *  module  ) 

Increase usage count of loaded module. It is intended to be called by plugins or other code which needs prevent module to be unloaded while its code is running. Must be accompanied by unuse when module is not needed.


The documentation for this class was generated from the following file:
Generated on Wed Jun 27 11:54:23 2012 for Hosting Environment (Daemon) by  doxygen 1.6.3