Reference

ACE_Service_Repository(3)

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

NAME

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

SYNOPSIS

#include <ace/Service_Repository.h>
class ACE_Service_Repository
{
  public:
    friend class ACE_Service_Repository_Iterator;
    enum{ DEFAULT_SIZE = ACE_DEFAULT_SERVICE_REPOSITORY_SIZE };
    ACE_Service_Repository (void);
    ACE_Service_Repository (int size);
    int open (int size = DEFAULT_SIZE);
    ~ACE_Service_Repository (void);
    int close (void);
    int fini (void);
    static ACE_Service_Repository *instance (
        int size = ACE_Service_Repository::DEFAULT_SIZE
        );
    static ACE_Service_Repository *instance (
        ACE_Service_Repository *
        );
    static void close_singleton (void);
    int insert (const ACE_Service_Type *);
    int find (
        const ASYS_TCHAR name[],
        const ACE_Service_Type **srp = 0,
        int ignore_suspended = 1
        );
    int remove (const ASYS_TCHAR[]);
    int resume (const ASYS_TCHAR[], const ACE_Service_Type ** = 0);
    int suspend (const ASYS_TCHAR[], const ACE_Service_Type ** = 0);
    int current_size (void);
    int total_size (void);
    void dump (void) const;
    ACE_ALLOC_HOOK_DECLARE;
  private:
    int find_i (
        const ASYS_TCHAR service_name[],
        const ACE_Service_Type ** = 0,
        int ignore_suspended = 1
        );
    const ACE_Service_Type **service_vector_;
    int current_size_;
    int total_size_;
    static ACE_Service_Repository *svc_rep_;
    static int delete_svc_rep_;
    ACE_Thread_Mutex lock_;
};

DESCRIPTION

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.

Initialization and termination methods.

ACE_Service_Repository (void);

Initialize the repository.

ACE_Service_Repository (int size);

Initialize the repository.

int open (int size = DEFAULT_SIZE);

Initialize the repository.

~ACE_Service_Repository (void);

Close down the repository and free up dynamically allocated resources.

int close (void);

Close down the repository and free up dynamically allocated resources.

int fini (void);

Finalize all the services by calling fini and deleteing dynamically allocated services.

static ACE_Service_Repository *instance (
    int size = ACE_Service_Repository::DEFAULT_SIZE
    );

Get pointer to a process-wide ACE_Service_Repository.

static ACE_Service_Repository *instance (ACE_Service_Repository *);

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

static void close_singleton (void);

Delete the dynamically allocated Singleton.

Search structure operations (all acquire locks as necessary).

int insert (const ACE_Service_Type *);

Insert a new service record.

int find (
    const ASYS_TCHAR name[],
    const ACE_Service_Type **srp = 0,
    int ignore_suspended = 1
    );

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.

int remove (const ASYS_TCHAR[]);

Remove an existing service record.

Liveness control

int resume (const ASYS_TCHAR[], const ACE_Service_Type ** = 0);

Resume a service record.

int suspend (const ASYS_TCHAR[], const ACE_Service_Type ** = 0);

Suspend a service record.

int current_size (void);

Return the current size of the repository.

int total_size (void);

Return the total size of the repository.

void dump (void) const;

Dump the state of an object.

ACE_ALLOC_HOOK_DECLARE;

Declare the dynamic allocation hooks.

AUTHOR

Doug Schmidt

LIBRARY

ace