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]

List of all members.

Public Types

enum  { DEFAULT_SIZE = ACE_DEFAULT_SERVICE_REPOSITORY_SIZE }

Public Member Functions

 ACE_Service_Repository (void)
 Initialize the repository.
 ACE_Service_Repository (size_t size)
 Initialize the repository.
int open (size_t size=DEFAULT_SIZE)
 Initialize the repository.
 ~ACE_Service_Repository (void)
int close (void)
int fini (void)
int insert (const ACE_Service_Type *)
int find (const ACE_TCHAR name[], const ACE_Service_Type **srp=0, bool ignore_suspended=true) const
int remove (const ACE_TCHAR[], ACE_Service_Type **sr=0)
 Completely remove a <name> entry from the Repository and dynamically unlink it if it was originally dynamically linked.
int resume (const ACE_TCHAR[], const ACE_Service_Type **=0)
 Resume a service record.
int suspend (const ACE_TCHAR[], const ACE_Service_Type **=0)
 Suspend a service record.
size_t current_size (void) const
 Return the current size of the repository.
size_t total_size (void) const
 Return the total size of the repository.
void dump (void) const
 Dump the state of an object.

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.
static ACE_Service_Repositoryinstance (ACE_Service_Repository *)
static void close_singleton (void)
 Delete the dynamically allocated Singleton.

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.

Private 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.

Private Attributes

const ACE_Service_Type ** service_vector_
 Contains all the configured services.
size_t current_size_
 Current number of services.
size_t total_size_
 Maximum number of services.

Static Private Attributes

static ACE_Service_Repositorysvc_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


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 Enumeration Documentation

anonymous enum

Enumerator:
DEFAULT_SIZE 


Constructor & Destructor Documentation

ACE_Service_Repository::ACE_Service_Repository ( void   ) 

Initialize the repository.

ACE_Service_Repository::ACE_Service_Repository ( size_t  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::open ( size_t  size = DEFAULT_SIZE  ) 

Initialize the repository.

int ACE_Service_Repository::close ( void   ) 

Close down the repository and free up dynamically allocated resources.

int ACE_Service_Repository::fini ( void   ) 

Finalize all the services by calling <fini> and deleting dynamically allocated services.

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.

void ACE_Service_Repository::close_singleton ( void   )  [static]

Delete the dynamically allocated Singleton.

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.

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:
service_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.
Return values:
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::remove ( const   ACE_TCHAR[],
ACE_Service_Type **  sr = 0 
)

Completely remove a <name> entry from the Repository and dynamically unlink it if it was originally dynamically linked.

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::resume ( const   ACE_TCHAR[],
const ACE_Service_Type **  srp = 0 
)

Resume a service record.

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

Suspend a service record.

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE size_t ACE_Service_Repository::current_size ( void   )  const

Return the current size of the repository.

ACE_INLINE size_t ACE_Service_Repository::total_size ( void   )  const

Return the total size of the repository.

void ACE_Service_Repository::dump ( void   )  const

Dump the state of an object.

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

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::find_i ( const ACE_TCHAR  service_name[],
size_t &  slot,
const ACE_Service_Type **  srp = 0,
bool  ignore_suspended = true 
) const [private]

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

Parameters:
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.
Return values:
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.

int ACE_Service_Repository::relocate_i ( size_t  begin,
size_t  end,
const ACE_DLL adll 
) [private]

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.


Friends And Related Function Documentation

friend class ACE_Service_Repository_Iterator [friend]

friend class ACE_Service_Type_Dynamic_Guard [friend]


Member Data Documentation

Declare the dynamic allocation hooks.

Contains all the configured services.

Current number of services.

Maximum number of services.

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Service_Repository * ACE_Service_Repository::svc_rep_ = 0 [static, private]

Pointer to a process-wide ACE_Service_Repository.

bool ACE_Service_Repository::delete_svc_rep_ = false [static, private]

Must delete the <svc_rep_> if true.


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

Generated on Wed Apr 23 02:41:24 2008 for ACE by  doxygen 1.5.5