ACE
6.1.0
|
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. | |
int | open (size_t size=DEFAULT_SIZE) |
Initialize the repository. | |
~ACE_Service_Repository (void) | |
int | close (void) |
Close down all the services. | |
int | fini (void) |
Finalize (call fini() and possibly delete) all the services. | |
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. | |
int | suspend (const ACE_TCHAR name[], const ACE_Service_Type **srp=0) |
Suspend a service record. | |
size_t | current_size (void) const |
Return the current size of the repository. | |
void | dump (void) const |
Dump the state of an object. | |
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. | |
static ACE_Service_Repository * | instance (ACE_Service_Repository *) |
static void | close_singleton (void) |
Delete the dynamically allocated Singleton. | |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
Protected Types | |
typedef ACE_Array_Map< size_t, const ACE_Service_Type * > | array_type |
The typedef of the array used to store the services. | |
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. | |
Protected Attributes | |
array_type | service_array_ |
Contains all the configured services. | |
Static Protected Attributes | |
static ACE_Service_Repository * | svc_rep_ = 0 |
Pointer to a process-wide ACE_Service_Repository. | |
static bool | delete_svc_rep_ = false |
Must delete the svc_rep_ if true. | |
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.
typedef ACE_Array_Map<size_t, const ACE_Service_Type*> ACE_Service_Repository::array_type [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.
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.
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. |
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.
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.
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.
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.
friend class ACE_Service_Repository_Iterator [friend] |
friend class ACE_Service_Type_Dynamic_Guard [friend] |
Declare the dynamic allocation hooks.
bool ACE_Service_Repository::delete_svc_rep_ = false [static, protected] |
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)!
array_type ACE_Service_Repository::service_array_ [protected] |
Contains all the configured services.
ACE_Service_Repository * ACE_Service_Repository::svc_rep_ = 0 [static, protected] |
Pointer to a process-wide ACE_Service_Repository.
Process-wide Service Repository.