ACE  6.4.2
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
ACE_Service_Repository Class Reference

Contains all the services offered by a Service Configurator-based application. More...

#include <Service_Repository.h>

Collaboration diagram for ACE_Service_Repository:
Collaboration graph
[legend]

Public Types

enum  { DEFAULT_SIZE = ACE_DEFAULT_SERVICE_REPOSITORY_SIZE }
 

Public Member Functions

 ACE_Service_Repository (size_t size=DEFAULT_SIZE)
 Initialize the repository. More...
 
int open (size_t size=DEFAULT_SIZE)
 Initialize the repository. More...
 
 ~ACE_Service_Repository (void)
 
int close (void)
 Close down all the services. More...
 
int fini (void)
 Finalize (call fini() and possibly delete) all the services. More...
 
int insert (const ACE_Service_Type *sr)
 
int find (const ACE_TCHAR name[], const ACE_Service_Type **srp=0, bool ignore_suspended=true) const
 
int remove (const ACE_TCHAR name[], ACE_Service_Type **sr=0)
 
int resume (const ACE_TCHAR name[], const ACE_Service_Type **srp=0)
 Resume a service record. More...
 
int suspend (const ACE_TCHAR name[], const ACE_Service_Type **srp=0)
 Suspend a service record. More...
 
size_t current_size (void) const
 Return the current size of the repository. More...
 
void dump (void) const
 Dump the state of an object. More...
 
ACE_SYNCH_RECURSIVE_MUTEXlock (void) const
 Returns a reference to the lock used by the ACE_Service_Repository. More...
 

Static Public Member Functions

static ACE_Service_Repositoryinstance (size_t size=ACE_Service_Repository::DEFAULT_SIZE)
 Get pointer to a process-wide ACE_Service_Repository. More...
 
static ACE_Service_Repositoryinstance (ACE_Service_Repository *)
 
static void close_singleton (void)
 Delete the dynamically allocated Singleton. More...
 

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...
 

Protected Types

typedef ACE_Array_Map< size_t, const ACE_Service_Type * > array_type
 The typedef of the array used to store the services. More...
 

Protected Member Functions

int remove_i (const ACE_TCHAR[], ACE_Service_Type **sr)
 
int find_i (const ACE_TCHAR service_name[], size_t &slot, const ACE_Service_Type **srp=0, bool ignore_suspended=true) const
 
int relocate_i (size_t begin, size_t end, const ACE_DLL &adll)
 Relocate (static) services to another DLL. More...
 

Protected Attributes

array_type service_array_
 Contains all the configured services. More...
 
ACE_SYNCH_RECURSIVE_MUTEX lock_
 Synchronization variable for the ACE_Service_Repository. More...
 

Static Protected Attributes

static ACE_Service_Repositorysvc_rep_ = 0
 Pointer to a process-wide ACE_Service_Repository. More...
 
static bool delete_svc_rep_ = false
 Must delete the svc_rep_ if true. More...
 

Friends

class ACE_Service_Repository_Iterator
 
class ACE_Service_Type_Dynamic_Guard
 

Detailed Description

Contains all the services offered by a Service Configurator-based application.

This class contains a vector of ACE_Service_Types *'s and allows an administrative entity to centrally manage and control the behavior of application services. Note that if services are removed from the middle of the repository the order won't necessarily be maintained since the remove method performs compaction. However, the common case is not to remove services, so typically they are deleted in the reverse order that they were added originally.

Member Typedef Documentation

The typedef of the array used to store the services.

Member Enumeration Documentation

anonymous enum
Enumerator
DEFAULT_SIZE 

Constructor & Destructor Documentation

ACE_Service_Repository::ACE_Service_Repository ( size_t  size = DEFAULT_SIZE)

Initialize the repository.

ACE_Service_Repository::~ACE_Service_Repository ( void  )

Close down the repository and free up dynamically allocated resources.

Member Function Documentation

int ACE_Service_Repository::close ( void  )

Close down all the services.

Close down the repository and free up dynamically allocated resources.

void ACE_Service_Repository::close_singleton ( void  )
static

Delete the dynamically allocated Singleton.

size_t ACE_Service_Repository::current_size ( void  ) const
inline

Return the current size of the repository.

void ACE_Service_Repository::dump ( void  ) const

Dump the state of an object.

int ACE_Service_Repository::find ( const ACE_TCHAR  name[],
const ACE_Service_Type **  srp = 0,
bool  ignore_suspended = true 
) const

Locate a named entry in the service table, optionally ignoring suspended entries.

Parameters
nameThe name of the service to search for.
srpOptional; if not 0, it is a pointer to a location to receive the ACE_Service_Type pointer for the located service. Meaningless if this method returns -1.
ignore_suspendedIf true, the search ignores suspended services.
Return values
0Named service was located.
-1Named service was not found.
-2Named service was found, but is suspended and ignore_suspended is true.
int ACE_Service_Repository::find_i ( const ACE_TCHAR  name[],
size_t &  slot,
const ACE_Service_Type **  srp = 0,
bool  ignore_suspended = true 
) const
protected

Locate a named entry in the service table, optionally ignoring suspended entries.

Parameters
service_nameThe name of the service to search for.
slotReceives the position index of the service if it is found. Contents are meaningless if this method returns -1.
srpOptional; if not 0, it is a pointer to a location to receive the ACE_Service_Type pointer for the located service. Meaningless if this method returns -1.
ignore_suspendedIf true, the search ignores suspended services.
Return values
0Named service was located; index in the table is set in slot.
-1Named service was not found.
-2Named service was found, but is suspended and ignore_suspended is true.

Locate an entry with name in the table. If ignore_suspended is set then only consider services marked as resumed. If the caller wants the located entry, pass back a pointer to the located entry via srp. If name is not found -1 is returned. If name is found, but it is suspended and the caller wants to ignore suspended services a -2 is returned. Must be called with locks held.

int ACE_Service_Repository::fini ( void  )

Finalize (call fini() and possibly delete) all the services.

Finalize all the services by calling fini() and deleting dynamically allocated services.

int ACE_Service_Repository::insert ( const ACE_Service_Type sr)

Insert a new service record. Returns -1 when the service repository is full and 0 on success.

ACE_Service_Repository * ACE_Service_Repository::instance ( size_t  size = ACE_Service_Repository::DEFAULT_SIZE)
static

Get pointer to a process-wide ACE_Service_Repository.

ACE_Service_Repository * ACE_Service_Repository::instance ( ACE_Service_Repository s)
static

Set pointer to a process-wide ACE_Service_Repository and return existing pointer.

ACE_SYNCH_RECURSIVE_MUTEX & ACE_Service_Repository::lock ( void  ) const
inline

Returns a reference to the lock used by the ACE_Service_Repository.

int ACE_Service_Repository::open ( size_t  size = DEFAULT_SIZE)

Initialize the repository.

Initialize the Repository to a clean slate.

int ACE_Service_Repository::relocate_i ( size_t  begin,
size_t  end,
const ACE_DLL adll 
)
protected

Relocate (static) services to another DLL.

Relocate (a static) service to another DLL.

If any have been registered in the context of a "forward declaration" guard, those really aren't static services. Their code is in the DLL's code segment, or in one of the dependent DLLs. Therefore, such services need to be associated with the proper DLL in order to prevent failures upon finalization. The method locks the repo.

Works by having the service type keep a reference to a specific DLL. No locking, caller makes sure calling it is safe. You can forcefully relocate any DLLs in the given range, not only the static ones - but that will cause Very Bad Things (tm) to happen.

Works by having the service type keep a reference to a specific DLL. No locking, caller makes sure calling it is safe. You can forcefully relocate any DLLs in the given range, not only the static ones - but that will cause Very Bad Things (tm) to happen.

int ACE_Service_Repository::remove ( const ACE_TCHAR  name[],
ACE_Service_Type **  sr = 0 
)

Remove an existing service record. If sr == 0, the service record is deleted before control is returned to the caller. If sr != 0, the service's record is removed from the repository, but not deleted; *sr receives the service record pointer and the caller is responsible for properly disposing of it.

int ACE_Service_Repository::remove_i ( const ACE_TCHAR  [],
ACE_Service_Type **  sr 
)
protected

Remove an existing service record. It requires sr != 0, which receives the service record pointer and the caller is responsible for properly disposing of it.

int ACE_Service_Repository::resume ( const ACE_TCHAR  name[],
const ACE_Service_Type **  srp = 0 
)

Resume a service record.

int ACE_Service_Repository::suspend ( const ACE_TCHAR  name[],
const ACE_Service_Type **  srp = 0 
)

Suspend a service record.

Friends And Related Function Documentation

friend class ACE_Service_Repository_Iterator
friend
friend class ACE_Service_Type_Dynamic_Guard
friend

Member Data Documentation

ACE_Service_Repository::ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.

bool ACE_Service_Repository::delete_svc_rep_ = false
staticprotected

Must delete the svc_rep_ if true.

Controls whether the Service_Repository is deleted when we shut down (we can only delete it safely if we created it)!

ACE_SYNCH_RECURSIVE_MUTEX ACE_Service_Repository::lock_
mutableprotected

Synchronization variable for the ACE_Service_Repository.

array_type ACE_Service_Repository::service_array_
protected

Contains all the configured services.

ACE_Service_Repository * ACE_Service_Repository::svc_rep_ = 0
staticprotected

Pointer to a process-wide ACE_Service_Repository.

Process-wide Service Repository.


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