ACE
6.3.3
|
Contains all the services offered by a Service Configurator-based application. More...
#include <Service_Repository.h>
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... | |
Static Public Member Functions | |
static ACE_Service_Repository * | instance (size_t size=ACE_Service_Repository::DEFAULT_SIZE) |
Get pointer to a process-wide ACE_Service_Repository. More... | |
static ACE_Service_Repository * | instance (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... | |
Static Protected Attributes | |
static ACE_Service_Repository * | svc_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 |
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.
|
protected |
The typedef of the array used to store the services.
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.
int ACE_Service_Repository::close | ( | void | ) |
Close down all the services.
Close down the repository and free up dynamically allocated resources.
|
static |
Delete the dynamically allocated Singleton.
|
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.
name | The name of the service to search for. |
srp | Optional; 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_suspended | If true, the search ignores suspended services. |
0 | Named service was located. |
-1 | Named service was not found. |
-2 | Named service was found, but is suspended and ignore_suspended is true. |
|
protected |
Locate a named entry in the service table, optionally ignoring suspended entries.
service_name | The name of the service to search for. |
slot | Receives the position index of the service if it is found. Contents are meaningless if this method returns -1. |
srp | Optional; 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_suspended | If true, the search ignores suspended services. |
0 | Named service was located; index in the table is set in slot. |
-1 | Named service was not found. |
-2 | Named 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 | ) |
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.
|
static |
Get pointer to a process-wide ACE_Service_Repository.
|
static |
Set pointer to a process-wide ACE_Service_Repository and return existing pointer.
int ACE_Service_Repository::open | ( | size_t | size = DEFAULT_SIZE | ) |
Initialize the repository.
Initialize the Repository to a clean slate.
|
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.
|
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.
|
friend |
|
friend |
ACE_Service_Repository::ACE_ALLOC_HOOK_DECLARE |
Declare the dynamic allocation hooks.
|
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)!
|
protected |
Contains all the configured services.
|
staticprotected |
Pointer to a process-wide ACE_Service_Repository.
Process-wide Service Repository.