Reference

ACE_Strategy_Connector(3)

Abstract factory for creating a service handler (SVC_HANDLER), connecting the SVC_HANDLER, and activating the SVC_HANDLER.

NAME

ACE_Strategy_Connector - Abstract factory for creating a service handler (SVC_HANDLER), connecting the SVC_HANDLER, and activating the SVC_HANDLER.

SYNOPSIS

#include <ace/Connector.h>
template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1>
class ACE_Strategy_Connector : 
  public ACE_Connector <SVC_HANDLER, ACE_PEER_CONNECTOR_2>
{
  public:
    ACE_Strategy_Connector (
        ACE_Reactor *r = ACE_Reactor::instance (),
        ACE_Creation_Strategy<SVC_HANDLER> * = 0,
        ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> * = 0,
        ACE_Concurrency_Strategy<SVC_HANDLER> * = 0,
        int flags = 0
        );
    virtual int open (ACE_Reactor *r, int flags);
    virtual int open (
        ACE_Reactor *r = ACE_Reactor::instance (),
        ACE_Creation_Strategy<SVC_HANDLER> * = 0,
        ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> * = 0,
        ACE_Concurrency_Strategy<SVC_HANDLER> * = 0,
        int flags = 0
        );
    virtual ~ACE_Strategy_Connector (void);
    virtual int close (void);
    typedef ACE_Creation_Strategy<SVC_HANDLER> CREATION_STRATEGY;
        typedef ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> CONNECT_STRATEGY;
        
        typedef ACE_Concurrency_Strategy<SVC_HANDLER> CONCURRENCY_STRATEGY;
        
    typedef ACE_Connector <SVC_HANDLER, ACE_PEER_CONNECTOR_2> SUPER;
    virtual ACE_Creation_Strategy<SVC_HANDLER> *creation_strategy (
        void
        ) const;
    virtual ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> *connect_strategy (
        void
        ) const;
    virtual ACE_Concurrency_Strategy<SVC_HANDLER> *concurrency_strategy (
        void
        ) const;
  protected:
    virtual int make_svc_handler (SVC_HANDLER *&sh);
    virtual int connect_svc_handler (
        SVC_HANDLER *&sh,
        const ACE_PEER_CONNECTOR_ADDR &remote_addr,
        ACE_Time_Value *timeout,
        const ACE_PEER_CONNECTOR_ADDR &local_addr,
        int reuse_addr,
        int flags,
        int perms
        );
    virtual int connect_svc_handler (
        SVC_HANDLER *&sh,
        SVC_HANDLER *&sh_copy,
        const ACE_PEER_CONNECTOR_ADDR &remote_addr,
        ACE_Time_Value *timeout,
        const ACE_PEER_CONNECTOR_ADDR &local_addr,
        int reuse_addr,
        int flags,
        int perms
        );
    virtual int activate_svc_handler (SVC_HANDLER *svc_handler);
    CREATION_STRATEGY *creation_strategy_;
    int delete_creation_strategy_;
    CONNECT_STRATEGY *connect_strategy_;
    int delete_connect_strategy_;
    CONCURRENCY_STRATEGY *concurrency_strategy_;
    int delete_concurrency_strategy_;
};

DESCRIPTION

Implements a flexible and extensible set of strategies for actively establishing connections with clients. There are three main strategies: (1) creating a SVC_HANDLER, (2) actively connecting a new connection from a client into the SVC_HANDLER, and (3) activating the SVC_HANDLER with a particular concurrency mechanism.

Define some useful typedefs traits.

typedef ACE_Creation_Strategy<SVC_HANDLER> CREATION_STRATEGY;

    typedef ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> CONNECT_STRATEGY;
    

typedef ACE_Concurrency_Strategy<SVC_HANDLER> CONCURRENCY_STRATEGY;

typedef ACE_Connector <SVC_HANDLER, ACE_PEER_CONNECTOR_2> SUPER;

Strategies accessors

virtual ACE_Creation_Strategy<SVC_HANDLER> *creation_strategy (
    void
    ) const;

virtual ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> *connect_strategy (
    void
    ) const;

virtual ACE_Concurrency_Strategy<SVC_HANDLER> *concurrency_strategy (
    void
    ) const;

Strategy objects.

CREATION_STRATEGY *creation_strategy_;

Creation strategy for an Connector.

int delete_creation_strategy_;

1 if Connector created the creation strategy and thus should delete it, else 0.

CONNECT_STRATEGY *connect_strategy_;

Connect strategy for a Connector.

int delete_connect_strategy_;

1 if Connector created the connect strategy and thus should delete it, else 0.

CONCURRENCY_STRATEGY *concurrency_strategy_;

Concurrency strategy for an Connector.

int delete_concurrency_strategy_;

1 if Connector created the concurrency strategy and thus should delete it, else 0.

AUTHOR

Doug Schmidt

LIBRARY

ace