Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

ACE_DLL_Manager Class Reference

This class is a singleton and serves as a factory and repository for instances of ACE_DLL_Handle. More...

#include <DLL_Manager.h>

Collaboration diagram for ACE_DLL_Manager:

Collaboration graph
[legend]
List of all members.

Public Types

enum  { DEFAULT_SIZE = ACE_DEFAULT_DLL_MANAGER_SIZE }

Public Methods

ACE_DLL_Handleopen_dll (const ACE_TCHAR *dll_name, int openmode, ACE_SHLIB_HANDLE handle)
int close_dll (const ACE_TCHAR *dll_name)
 Close the underlying dll. Decrements the refcount.

u_long unload_policy (void) const
 Returns the current per-process UNLOAD_POLICY.

void unload_policy (u_long unload_policy)

Static Public Methods

ACE_DLL_Manager * instance (int size=ACE_DLL_Manager::DEFAULT_SIZE)
 Return a unique instance.


Protected Methods

int open (int size)
int close (void)
ACE_DLL_Handlefind_dll (const ACE_TCHAR *dll_name) const
int unload_dll (ACE_DLL_Handle *dll_handle, int force_unload=0)

Private Methods

 ACE_DLL_Manager (int size=ACE_DLL_Manager::DEFAULT_SIZE)
 Default constructor.

 ~ACE_DLL_Manager (void)
 Destructor.

 ACE_DLL_Manager (const ACE_DLL_Manager &)
void operator= (const ACE_DLL_Manager &)

Static Private Methods

void close_singleton (void)
 Close the singleton instance.


Private Attributes

ACE_DLL_Handle ** handle_vector_
 Vector containing all loaded handle objects.

int current_size_
 Current number of handles.

int total_size_
 Maximum number of handles.

u_long unload_policy_
 Unload strategy.


Static Private Attributes

ACE_DLL_Manager * instance_ = 0
 Pointer to a process-wide <ACE_DLL_Manager>.


Friends

class ACE_Framework_Repository

Detailed Description

This class is a singleton and serves as a factory and repository for instances of ACE_DLL_Handle.

This class is a singleton whose lifetime is managed by the ACE_Framework_Repository. Although it is normally meant to be used directly only by ACE_DLL, applications can call the unload_policy() methods in order get/set the the dll unload policy. Unload policies include per_process/per-dll and eager/lazy. Dlls can export set their own policy by using the ACE_DLL_UNLOAD_POLICY macro found in config-all.h. If a dll choses to set an unload policy, it will be used when the per-dll policy (the default) is in effect. If the per-dll policy is in effect and a dll has not chosen to set a policy, the current per-process policy will be used.

The following policy macros are provided in config-all.h:

ACE_DLL_UNLOAD_POLICY_PER_PROCESS - Per-process policy that unloads dlls eagerly.

ACE_DLL_UNLOAD_POLICY_PER_DLL - Apply policy on a per-dll basis. If the dll doesn't use one of the macros below, the current per-process policy will be used.

ACE_DLL_UNLOAD_POLICY_LAZY - Don't unload dll when refcount reaches zero, i.e., wait for either an explicit unload request or program exit.

ACE_DLL_UNLOAD_POLICY_DEFAULT - Default policy allows dlls to control their own destinies, but will unload those that don't make a choice eagerly.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
DEFAULT_SIZE 


Constructor & Destructor Documentation

ACE_DLL_Manager::ACE_DLL_Manager int    size = ACE_DLL_Manager::DEFAULT_SIZE [private]
 

Default constructor.

ACE_DLL_Manager::~ACE_DLL_Manager void    [private]
 

Destructor.

ACE_DLL_Manager::ACE_DLL_Manager const ACE_DLL_Manager &    [private]
 


Member Function Documentation

int ACE_DLL_Manager::close void    [protected]
 

int ACE_DLL_Manager::close_dll const ACE_TCHAR   dll_name
 

Close the underlying dll. Decrements the refcount.

void ACE_DLL_Manager::close_singleton void    [static, private]
 

Close the singleton instance.

ACE_DLL_Handle * ACE_DLL_Manager::find_dll const ACE_TCHAR   dll_name const [protected]
 

ACE_DLL_Manager * ACE_DLL_Manager::instance int    size = ACE_DLL_Manager::DEFAULT_SIZE [static]
 

Return a unique instance.

int ACE_DLL_Manager::open int    size [protected]
 

ACE_DLL_Handle * ACE_DLL_Manager::open_dll const ACE_TCHAR   dll_name,
int    openmode,
ACE_SHLIB_HANDLE    handle
 

Factory for ACE_DLL_Handle objects. If one already exits, its refcount is incremented.

void ACE_DLL_Manager::operator= const ACE_DLL_Manager &    [private]
 

int ACE_DLL_Manager::unload_dll ACE_DLL_Handle   dll_handle,
int    force_unload = 0
[protected]
 

void ACE_DLL_Manager::unload_policy u_long    unload_policy
 

Set the per-process UNLOAD_POLICY. If the policy is changed from LAZY to EAGER, then it will also unload any dlls with zero refcounts.

u_long ACE_DLL_Manager::unload_policy void    const
 

Returns the current per-process UNLOAD_POLICY.


Friends And Related Function Documentation

friend class ACE_Framework_Repository [friend]
 


Member Data Documentation

int ACE_DLL_Manager::current_size_ [private]
 

Current number of handles.

ACE_DLL_Handle** ACE_DLL_Manager::handle_vector_ [private]
 

Vector containing all loaded handle objects.

ACE_DLL_Manager * ACE_DLL_Manager::instance_ = 0 [static, private]
 

Pointer to a process-wide <ACE_DLL_Manager>.

int ACE_DLL_Manager::total_size_ [private]
 

Maximum number of handles.

u_long ACE_DLL_Manager::unload_policy_ [private]
 

Unload strategy.


The documentation for this class was generated from the following files:
Generated on Fri Apr 2 16:48:05 2004 for ACE by doxygen1.2.18