ACE 8.0.1
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
ACE_Strategy_Connector< SVC_HANDLER, PEER_CONNECTOR > Class Template Reference

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

#include <Connector.h>

Inheritance diagram for ACE_Strategy_Connector< SVC_HANDLER, PEER_CONNECTOR >:
Inheritance graph
[legend]
Collaboration diagram for ACE_Strategy_Connector< SVC_HANDLER, PEER_CONNECTOR >:
Collaboration graph
[legend]

Public Types

typedef ACE_Creation_Strategy< SVC_HANDLERcreation_strategy_type
 
typedef ACE_Connect_Strategy< SVC_HANDLER, PEER_CONNECTORconnect_strategy_type
 
typedef ACE_Concurrency_Strategy< SVC_HANDLERconcurrency_strategy_type
 
typedef ACE_Connector< SVC_HANDLER, PEER_CONNECTORbase_type
 
typedef ACE_Creation_Strategy< SVC_HANDLERCREATION_STRATEGY
 
typedef ACE_Connect_Strategy< SVC_HANDLER, PEER_CONNECTORCONNECT_STRATEGY
 
typedef ACE_Concurrency_Strategy< SVC_HANDLERCONCURRENCY_STRATEGY
 
typedef ACE_Connector< SVC_HANDLER, PEER_CONNECTORSUPER
 
- Public Types inherited from ACE_Connector< SVC_HANDLER, PEER_CONNECTOR >
typedef SVC_HANDLER::addr_type addr_type
 
typedef PEER_CONNECTOR connector_type
 
typedef SVC_HANDLER handler_type
 
typedef SVC_HANDLER::stream_type stream_type
 
typedef PEER_CONNECTOR::PEER_ADDR peer_addr_type
 
typedef PEER_CONNECTOR::PEER_ADDR PEER_ADDR_TYPEDEF
 
- Public Types inherited from ACE_Event_Handler
enum  {
  LO_PRIORITY = 0 , HI_PRIORITY = 10 , NULL_MASK = 0 , READ_MASK = (1 << 0) ,
  WRITE_MASK = (1 << 1) , EXCEPT_MASK = (1 << 2) , ACCEPT_MASK = (1 << 3) , CONNECT_MASK = (1 << 4) ,
  TIMER_MASK = (1 << 5) , QOS_MASK = (1 << 6) , GROUP_QOS_MASK = (1 << 7) , SIGNAL_MASK = (1 << 8) ,
  ALL_EVENTS_MASK , RWE_MASK , DONT_CALL = (1 << 9)
}
 
enum  { ACE_EVENT_HANDLER_NOT_RESUMED = -1 , ACE_REACTOR_RESUMES_HANDLER = 0 , ACE_APPLICATION_RESUMES_HANDLER }
 
typedef long Reference_Count
 Reference count type.
 

Public Member Functions

 ACE_Strategy_Connector (ACE_Reactor *r=ACE_Reactor::instance(), ACE_Creation_Strategy< SVC_HANDLER > *=0, ACE_Connect_Strategy< SVC_HANDLER, PEER_CONNECTOR > *=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, PEER_CONNECTOR > *=0, ACE_Concurrency_Strategy< SVC_HANDLER > *=0, int flags=0)
 
virtual ~ACE_Strategy_Connector ()
 Shutdown a connector and release resources.
 
virtual int close ()
 Close down the Connector.
 
virtual ACE_Creation_Strategy< SVC_HANDLER > * creation_strategy () const
 
virtual ACE_Connect_Strategy< SVC_HANDLER, PEER_CONNECTOR > * connect_strategy () const
 
virtual ACE_Concurrency_Strategy< SVC_HANDLER > * concurrency_strategy () const
 
- Public Member Functions inherited from ACE_Connector< SVC_HANDLER, PEER_CONNECTOR >
 ACE_Connector (ACE_Reactor *r=ACE_Reactor::instance(), int flags=0)
 
virtual ~ACE_Connector ()
 Shutdown a connector and release resources.
 
virtual int connect (SVC_HANDLER *&svc_handler, const typename PEER_CONNECTOR::PEER_ADDR &remote_addr, const ACE_Synch_Options &synch_options=ACE_Synch_Options::defaults, const typename PEER_CONNECTOR::PEER_ADDR &local_addr=reinterpret_cast< const peer_addr_type & >(peer_addr_type::sap_any), int reuse_addr=0, int flags=O_RDWR, int perms=0)
 
virtual int connect (SVC_HANDLER *&svc_handler_hint, SVC_HANDLER *&svc_handler, const typename PEER_CONNECTOR::PEER_ADDR &remote_addr, const ACE_Synch_Options &synch_options=ACE_Synch_Options::defaults, const typename PEER_CONNECTOR::PEER_ADDR &local_addr=reinterpret_cast< const peer_addr_type & >(peer_addr_type::sap_any), int reuse_addr=0, int flags=O_RDWR, int perms=0)
 
virtual int connect_n (size_t n, SVC_HANDLER *svc_handlers[], typename PEER_CONNECTOR::PEER_ADDR remote_addrs[], ACE_TCHAR *failed_svc_handlers=0, const ACE_Synch_Options &synch_options=ACE_Synch_Options::defaults)
 
virtual int cancel (SVC_HANDLER *svc_handler)
 
virtual PEER_CONNECTORconnector () const
 Return the underlying PEER_CONNECTOR object.
 
virtual void initialize_svc_handler (ACE_HANDLE handle, SVC_HANDLER *svc_handler)
 Initialize Svc_Handler.
 
virtual void reactor (ACE_Reactor *reactor)
 Set Reactor.
 
virtual ACE_Reactorreactor () const
 Get Reactor.
 
void dump () const
 Dump the state of an object.
 
- Public Member Functions inherited from ACE_Connector_Base< SVC_HANDLER >
virtual ~ACE_Connector_Base ()=default
 
- Public Member Functions inherited from ACE_Service_Object
 ACE_Service_Object (ACE_Reactor *=0)
 Constructor.
 
virtual ~ACE_Service_Object ()
 Destructor.
 
- Public Member Functions inherited from ACE_Event_Handler
virtual ~ACE_Event_Handler ()=default
 Destructor is virtual to enable proper cleanup.
 
virtual ACE_HANDLE get_handle () const
 Get the I/O handle.
 
virtual void set_handle (ACE_HANDLE)
 Set the I/O handle.
 
virtual int priority () const
 
virtual void priority (int priority)
 Set the priority of the Event_Handler.
 
virtual int handle_input (ACE_HANDLE fd=ACE_INVALID_HANDLE)
 Called when input events occur (e.g., connection or data).
 
virtual int handle_output (ACE_HANDLE fd=ACE_INVALID_HANDLE)
 
virtual int handle_exception (ACE_HANDLE fd=ACE_INVALID_HANDLE)
 Called when an exceptional events occur (e.g., SIGURG).
 
virtual int handle_timeout (const ACE_Time_Value &current_time, const void *act=0)
 
virtual int handle_exit (ACE_Process *)
 Called when a process exits.
 
virtual int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask)
 
virtual int handle_signal (int signum, siginfo_t *=0, ucontext_t *=0)
 
virtual int resume_handler ()
 
virtual int handle_qos (ACE_HANDLE=ACE_INVALID_HANDLE)
 
virtual int handle_group_qos (ACE_HANDLE=ACE_INVALID_HANDLE)
 
virtual ACE_Reactor_Timer_Interfacereactor_timer_interface () const
 Get only the reactor's timer related interface.
 
virtual Reference_Count add_reference ()
 Increment reference count on the handler.
 
virtual Reference_Count remove_reference ()
 Decrement reference count on the handler.
 
Reference_Counting_Policyreference_counting_policy ()
 Current Reference_Counting_Policy.
 
- Public Member Functions inherited from ACE_Shared_Object
 ACE_Shared_Object ()
 Constructor.
 
virtual ~ACE_Shared_Object ()
 Destructor.
 

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.
 
- Public Attributes inherited from ACE_Connector< SVC_HANDLER, PEER_CONNECTOR >
 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.
 
- Public Attributes inherited from ACE_Service_Object
 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.
 

Protected Member Functions

virtual int make_svc_handler (SVC_HANDLER *&sh)
 
virtual int connect_svc_handler (SVC_HANDLER *&sh, const typename PEER_CONNECTOR::PEER_ADDR &remote_addr, ACE_Time_Value *timeout, const typename PEER_CONNECTOR::PEER_ADDR &local_addr, int reuse_addr, int flags, int perms)
 
virtual int connect_svc_handler (SVC_HANDLER *&sh, SVC_HANDLER *&sh_copy, const typename PEER_CONNECTOR::PEER_ADDR &remote_addr, ACE_Time_Value *timeout, const typename PEER_CONNECTOR::PEER_ADDR &local_addr, int reuse_addr, int flags, int perms)
 
virtual int activate_svc_handler (SVC_HANDLER *svc_handler)
 
- Protected Member Functions inherited from ACE_Connector< SVC_HANDLER, PEER_CONNECTOR >
int nonblocking_connect (SVC_HANDLER *, const ACE_Synch_Options &)
 Creates and registers ACE_NonBlocking_Connect_Handler.
 
virtual int connect_i (SVC_HANDLER *&svc_handler, SVC_HANDLER **sh_copy, const typename PEER_CONNECTOR::PEER_ADDR &remote_addr, const ACE_Synch_Options &synch_options, const typename PEER_CONNECTOR::PEER_ADDR &local_addr, int reuse_addr, int flags, int perms)
 Implementation of the connect methods.
 
ACE_Unbounded_Set< ACE_HANDLE > & non_blocking_handles ()
 
virtual int init (int argc, ACE_TCHAR *argv[])
 
virtual int fini ()
 Calls handle_close() to shutdown the Connector gracefully.
 
virtual int info (ACE_TCHAR **strp, size_t length) const
 Default version returns address info in buf.
 
virtual int suspend ()
 
virtual int resume ()
 
- Protected Member Functions inherited from ACE_Event_Handler
 ACE_Event_Handler (ACE_Reactor *=nullptr, int priority=ACE_Event_Handler::LO_PRIORITY)
 Force ACE_Event_Handler to be an abstract base class.
 

Protected Attributes

CREATION_STRATEGYcreation_strategy_
 Creation strategy for an Connector.
 
bool delete_creation_strategy_
 
CONNECT_STRATEGYconnect_strategy_
 Connect strategy for a Connector.
 
bool delete_connect_strategy_
 
CONCURRENCY_STRATEGYconcurrency_strategy_
 Concurrency strategy for a Connector.
 
bool delete_concurrency_strategy_
 
- Protected Attributes inherited from ACE_Event_Handler
Atomic_Reference_Count reference_count_
 Reference count.
 

Additional Inherited Members

- Static Public Member Functions inherited from ACE_Event_Handler
static ACE_THR_FUNC_RETURN read_adapter (void *event_handler)
 
static int register_stdin_handler (ACE_Event_Handler *eh, ACE_Reactor *reactor, ACE_Thread_Manager *thr_mgr, int flags=THR_DETACHED)
 
static int remove_stdin_handler (ACE_Reactor *reactor, ACE_Thread_Manager *thr_mgr)
 Performs the inverse of the register_stdin_handler() method.
 
- Protected Types inherited from ACE_Connector< SVC_HANDLER, PEER_CONNECTOR >
typedef ACE_NonBlocking_Connect_Handler< SVC_HANDLERNBCH
 
- Protected Types inherited from ACE_Event_Handler
typedef std::atomic< Reference_CountAtomic_Reference_Count
 Typedef for implementation of reference counting.
 

Detailed Description

template<class SVC_HANDLER, typename PEER_CONNECTOR>
class ACE_Strategy_Connector< SVC_HANDLER, PEER_CONNECTOR >

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

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 initiating a new connection from the client, and (3) activating the SVC_HANDLER with a particular concurrency mechanism after the connection is established.

Member Typedef Documentation

◆ base_type

◆ CONCURRENCY_STRATEGY

◆ concurrency_strategy_type

◆ CONNECT_STRATEGY

◆ connect_strategy_type

◆ CREATION_STRATEGY

◆ creation_strategy_type

◆ SUPER

Constructor & Destructor Documentation

◆ ACE_Strategy_Connector()

Initialize a connector. flags indicates how SVC_HANDLER's should be initialized prior to being activated. Right now, the only flag that is processed is ACE_NONBLOCK, which enabled non-blocking I/O on the SVC_HANDLER when it is opened.

◆ ~ACE_Strategy_Connector()

Shutdown a connector and release resources.

Member Function Documentation

◆ activate_svc_handler()

int ACE_Strategy_Connector< SVC_HANDLER, PEER_CONNECTOR >::activate_svc_handler ( SVC_HANDLER * svc_handler)
protectedvirtual

Bridge method for activating a SVC_HANDLER with the appropriate concurrency strategy. The default behavior of this method is to activate the SVC_HANDLER by calling its <open> method (which allows the SVC_HANDLER to define its own concurrency strategy). However, subclasses can override this strategy to do more sophisticated concurrency activations (such as creating the SVC_HANDLER as an "active object" via multi-threading or multi-processing).

Reimplemented from ACE_Connector< SVC_HANDLER, PEER_CONNECTOR >.

◆ close()

Close down the Connector.

Reimplemented from ACE_Connector< SVC_HANDLER, PEER_CONNECTOR >.

◆ concurrency_strategy()

◆ connect_strategy()

◆ connect_svc_handler() [1/2]

int ACE_Strategy_Connector< SVC_HANDLER, PEER_CONNECTOR >::connect_svc_handler ( SVC_HANDLER *& sh,
const typename PEER_CONNECTOR::PEER_ADDR & remote_addr,
ACE_Time_Value * timeout,
const typename PEER_CONNECTOR::PEER_ADDR & local_addr,
int reuse_addr,
int flags,
int perms )
protectedvirtual

Bridge method for connecting the new connection into the SVC_HANDLER. The default behavior delegates to the <PEER_CONNECTOR::connect> in the <Connect_Strategy>.

Reimplemented from ACE_Connector< SVC_HANDLER, PEER_CONNECTOR >.

◆ connect_svc_handler() [2/2]

int ACE_Strategy_Connector< SVC_HANDLER, PEER_CONNECTOR >::connect_svc_handler ( SVC_HANDLER *& sh,
SVC_HANDLER *& sh_copy,
const typename PEER_CONNECTOR::PEER_ADDR & remote_addr,
ACE_Time_Value * timeout,
const typename PEER_CONNECTOR::PEER_ADDR & local_addr,
int reuse_addr,
int flags,
int perms )
protectedvirtual

Bridge method for connecting the new connection into the SVC_HANDLER. The default behavior delegates to the <PEER_CONNECTOR::connect> in the <Connect_Strategy>. sh_copy is used to obtain a copy of the sh pointer, but that can be kept in the stack; the motivation is a bit too long to include here, but basically we want to modify sh safely, using the internal locks in the Connect_Strategy, while saving a TSS copy in sh_copy, usually located in the stack.

Reimplemented from ACE_Connector< SVC_HANDLER, PEER_CONNECTOR >.

◆ creation_strategy()

◆ make_svc_handler()

int ACE_Strategy_Connector< SVC_HANDLER, PEER_CONNECTOR >::make_svc_handler ( SVC_HANDLER *& sh)
protectedvirtual

Bridge method for creating a SVC_HANDLER. The strategy for creating a SVC_HANDLER are configured into the Connector via it's <creation_strategy_>. The default is to create a new SVC_HANDLER only if sh == 0, else sh is unchanged. However, subclasses can override this policy to perform SVC_HANDLER creation in any way that they like (such as creating subclass instances of SVC_HANDLER, using a singleton, dynamically linking the handler, etc.). Returns -1 if failure, else 0.

Reimplemented from ACE_Connector< SVC_HANDLER, PEER_CONNECTOR >.

◆ open() [1/2]

Initialize a connector. flags indicates how SVC_HANDLER's should be initialized prior to being activated. Right now, the only flag that is processed is ACE_NONBLOCK, which enabled non-blocking I/O on the SVC_HANDLER when it is opened. Default strategies would be created and used.

Reimplemented from ACE_Connector< SVC_HANDLER, PEER_CONNECTOR >.

◆ open() [2/2]

Initialize a connector. flags indicates how SVC_HANDLER's should be initialized prior to being activated. Right now, the only flag that is processed is ACE_NONBLOCK, which enabled non-blocking I/O on the SVC_HANDLER when it is opened.

Member Data Documentation

◆ ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.

◆ concurrency_strategy_

Concurrency strategy for a Connector.

◆ connect_strategy_

Connect strategy for a Connector.

◆ creation_strategy_

Creation strategy for an Connector.

◆ delete_concurrency_strategy_

bool ACE_Strategy_Connector< SVC_HANDLER, PEER_CONNECTOR >::delete_concurrency_strategy_
protected

True if Connector created the concurrency strategy and thus should delete it, else false.

◆ delete_connect_strategy_

bool ACE_Strategy_Connector< SVC_HANDLER, PEER_CONNECTOR >::delete_connect_strategy_
protected

True if Connector created the connect strategy and thus should delete it, else false.

◆ delete_creation_strategy_

bool ACE_Strategy_Connector< SVC_HANDLER, PEER_CONNECTOR >::delete_creation_strategy_
protected

True if Connector created the creation strategy and thus should delete it, else false.


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