Reference

ACE_Singleton_Strategy(3)

Defines the interface for specifying a creation strategy for a SVC_HANDLER that always returns the same SVC_HANDLER (i.e., it's a Singleton).

NAME

ACE_Singleton_Strategy - Defines the interface for specifying a creation strategy for a SVC_HANDLER that always returns the same SVC_HANDLER (i.e., it's a Singleton).

SYNOPSIS

#include <ace/ACE_Strategies_T.h>
template<class SVC_HANDLER>
class ACE_Singleton_Strategy : 
  public ACE_Creation_Strategy<SVC_HANDLER>
{
  public:
    ACE_Singleton_Strategy (
        SVC_HANDLER * = 0,
        ACE_Thread_Manager * = 0
        );
    int open (SVC_HANDLER *, ACE_Thread_Manager * = 0);
    virtual ~ACE_Singleton_Strategy (void);
    virtual int make_svc_handler (SVC_HANDLER *&);
    void dump (void) const;
    ACE_ALLOC_HOOK_DECLARE;
  protected:
    SVC_HANDLER *svc_handler_;
    int delete_svc_handler_;
};

DESCRIPTION

Note that this class takes over the ownership of the SVC_HANDLER passed into it as a parameter and it becomes responsible for deleting this object.

Initialization and termination methods.

ACE_Singleton_Strategy (SVC_HANDLER * = 0, ACE_Thread_Manager * = 0);

int open (SVC_HANDLER *, ACE_Thread_Manager * = 0);

virtual ~ACE_Singleton_Strategy (void);

Factory method.

virtual int make_svc_handler (SVC_HANDLER *&);

Create a Singleton SVC_HANDLER by always returning the same SVC_HANDLER. Returns -1 on failure, else 0.

void dump (void) const;

Dump the state of an object.

ACE_ALLOC_HOOK_DECLARE;

Declare the dynamic allocation hooks.

AUTHOR

Doug Schmidt

LIBRARY

ace