Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# ACE_Oneshot_Acceptor Class Template Reference

Generic factory for passively connecting clients and creating exactly one service handler (SVC_HANDLER). More...

`#include <Acceptor.h>`

Inheritance diagram for ACE_Oneshot_Acceptor

[legend]
Collaboration diagram for ACE_Oneshot_Acceptor:

[legend]
List of all members.

## Public Methods
| ACE_Oneshot_Acceptor (void)
| Constructor.
| ACE_Oneshot_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr, ACE_Reactor *reactor = ACE_Reactor::instance (), ACE_Concurrency_Strategy<SVC_HANDLER> * = 0)
int | open (const ACE_PEER_ACCEPTOR_ADDR &, ACE_Reactor *reactor = ACE_Reactor::instance (), ACE_Concurrency_Strategy<SVC_HANDLER> * = 0)
virtual | ~ACE_Oneshot_Acceptor (void)
| Close down the <Oneshot_Acceptor>.
virtual int | accept (SVC_HANDLER * = 0, ACE_PEER_ACCEPTOR_ADDR *remote_addr = 0, const ACE_Synch_Options &synch_options = ACE_Synch_Options::defaults, int restart = 1, int reset_new_handle = 0)
| Create a <SVC_HANDLER>, accept the connection into the <SVC_HANDLER>, and activate the <SVC_HANDLER>.
virtual int | cancel (void)
| Cancel a oneshot acceptor that was started asynchronously.
virtual | operator ACE_PEER_ACCEPTOR & () const
| Return the underlying <PEER_ACCEPTOR> object.
virtual ACE_PEER_ACCEPTOR& | acceptor (void) const
| Return the underlying <PEER_ACCEPTOR> object.
virtual int | close (void)
| Close down the <Oneshot_Acceptor>.
void | dump (void) const
| Dump the state of an object.
## Public Attributes
| ACE_ALLOC_HOOK_DECLARE
| Declare the dynamic allocation hooks.
## Protected Methods
virtual int | activate_svc_handler (SVC_HANDLER *svc_handler)
int | shared_accept (SVC_HANDLER *svc_handler, ACE_PEER_ACCEPTOR_ADDR *remote_addr, ACE_Time_Value *timeout, int restart, int reset_new_handle)
| Factors out the code shared between the and <handle_input> methods.
virtual ACE_HANDLE | get_handle (void) const
| Returns the listening acceptor's .
virtual int | handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK)
| Perform termination activities when <this> is removed from the <reactor>.
virtual int | handle_input (ACE_HANDLE)
| Accept one connection from a client and activates the SVC_HANDLER.
virtual int | handle_timeout (const ACE_Time_Value &tv, const void *arg)
| Called when an acceptor times out...
virtual int | init (int argc, ACE_TCHAR *argv[])
| Default version does no work and returns -1. Must be overloaded by application developer to do anything meaningful.
virtual int | fini (void)
| Default version does no work and returns -1. Must be overloaded by application developer to do anything meaningful.
virtual int | info (ACE_TCHAR **, size_t) const
| Default version returns address info in <buf>.
virtual int | suspend (void)
| Default version does no work and returns -1. Must be overloaded by application developer to do anything meaningful.
virtual int | resume (void)
| Default version does no work and returns -1. Must be overloaded by application developer to do anything meaningful.
## Private Methods
int | register_handler (SVC_HANDLER *svc_handler, const ACE_Synch_Options &options, int restart)
## Private Attributes
SVC_HANDLER* | svc_handler_
| Hold the svc_handler_ across asynchrony boundaries.
int | restart_
| Hold the restart flag across asynchrony boundaries.
ACE_PEER_ACCEPTOR | peer_acceptor_
| Factory that establishes connections passively.
ACE_Concurrency_Strategy<SVC_HANDLER>* | concurrency_strategy_
| Concurrency strategy for an Acceptor.
int | delete_concurrency_strategy_
| 1 if Acceptor created the concurrency strategy and thus should delete it, else 0.

## Detailed Description

### template<class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> template class ACE_Oneshot_Acceptor

Generic factory for passively connecting clients and creating exactly one service handler (SVC_HANDLER).

This class works similarly to the regular , with the following differences: 1. This class doesn't automagically register <this> with the since it expects to have its method called directly. However, it stashes the pointer away in case it's needed later to finish accepting a connection asynchronously. 2. The class doesn't need an (since the user supplies the SVC_HANDLER) or an (since this class only accepts one connection and then removes all traces of itself from the if it was registered for asynchronous accepts).

## Constructor & Destructor Documentation

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
ACE_Oneshot_Acceptor<SVC_HANDLER, >::ACE_Oneshot_Acceptor<SVC_HANDLER, > ( | void )

| Constructor.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
ACE_Oneshot_Acceptor<SVC_HANDLER, >::ACE_Oneshot_Acceptor<SVC_HANDLER, > ( | const ACE_PEER_ACCEPTOR_ADDR & local_addr,
| ACE_Reactor * reactor = ACE_Reactor::instance (),
| ACE_Concurrency_Strategy< SVC_HANDLER >* cs = 0 )

| Initialize the appropriate strategies for concurrency and then open the <peer_acceptor> at the designated <local_addr>. Note that unlike the and , this method does NOT register <this> acceptor with the <reactor> at this point -- it just stashes the <reactor> away in case it's needed later.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
ACE_Oneshot_Acceptor<SVC_HANDLER, >::~ACE_Oneshot_Acceptor<SVC_HANDLER, > ( | void )`[virtual]`

| Close down the <Oneshot_Acceptor>.

## Member Function Documentation

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
int ACE_Oneshot_Acceptor<SVC_HANDLER, >::accept ( | SVC_HANDLER * svc_handler = 0,
| ACE_PEER_ACCEPTOR_ADDR * remote_addr = 0,
| const ACE_Synch_Options & synch_options = ACE_Synch_Options::defaults,
| int restart = 1,
| int reset_new_handle = 0 )`[virtual]`

| Create a <SVC_HANDLER>, accept the connection into the <SVC_HANDLER>, and activate the <SVC_HANDLER>.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
ACE_PEER_ACCEPTOR & ACE_Oneshot_Acceptor<SVC_HANDLER, >::acceptor ( | void ) const`[virtual]`

| Return the underlying <PEER_ACCEPTOR> object.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
int ACE_Oneshot_Acceptor<SVC_HANDLER, >::activate_svc_handler ( | SVC_HANDLER * svc_handler )`[protected, virtual]`

| Bridge method for activating a <svc_handler> with the appropriate concurrency strategy. Default behavior is to activate the <SVC_HANDLER> as a "passive object." 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).

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
int ACE_Oneshot_Acceptor<SVC_HANDLER, >::cancel ( | void )`[virtual]`

| Cancel a oneshot acceptor that was started asynchronously.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
int ACE_Oneshot_Acceptor<SVC_HANDLER, >::close ( | void )`[virtual]`

| Close down the <Oneshot_Acceptor>.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
void ACE_Oneshot_Acceptor<SVC_HANDLER, >::dump ( | void ) const

| Dump the state of an object.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
int ACE_Oneshot_Acceptor<SVC_HANDLER, >::fini ( | void )`[protected, virtual]`

| Default version does no work and returns -1. Must be overloaded by application developer to do anything meaningful. Reimplemented from ACE_Shared_Object.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
ACE_HANDLE ACE_Oneshot_Acceptor<SVC_HANDLER, >::get_handle ( | void ) const`[protected, virtual]`

| Returns the listening acceptor's . Reimplemented from ACE_Event_Handler.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
int ACE_Oneshot_Acceptor<SVC_HANDLER, >::handle_close ( | ACE_HANDLE handle = ACE_INVALID_HANDLE,
| ACE_Reactor_Mask close_mask = ACE_Event_Handler::ALL_EVENTS_MASK )`[protected, virtual]`

| Perform termination activities when <this> is removed from the <reactor>. Reimplemented from ACE_Event_Handler.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
int ACE_Oneshot_Acceptor<SVC_HANDLER, >::handle_input ( | ACE_HANDLE listener )`[protected, virtual]`

| Accept one connection from a client and activates the SVC_HANDLER. Reimplemented from ACE_Event_Handler.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
int ACE_Oneshot_Acceptor<SVC_HANDLER, >::handle_timeout ( | const ACE_Time_Value & tv,
| const void * arg )`[protected, virtual]`

| Called when an acceptor times out... Reimplemented from ACE_Event_Handler.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
int ACE_Oneshot_Acceptor<SVC_HANDLER, >::info ( | ACE_TCHAR ** strp,
| size_t length ) const`[protected, virtual]`

| Default version returns address info in <buf>. Reimplemented from ACE_Shared_Object.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
int ACE_Oneshot_Acceptor<SVC_HANDLER, >::init ( | int argc,
| ACE_TCHAR * argv[] )`[protected, virtual]`

| Default version does no work and returns -1. Must be overloaded by application developer to do anything meaningful. Reimplemented from ACE_Shared_Object.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
int ACE_Oneshot_Acceptor<SVC_HANDLER, >::open ( | const ACE_PEER_ACCEPTOR_ADDR & local_addr,
| ACE_Reactor * reactor = ACE_Reactor::instance (),
| ACE_Concurrency_Strategy< SVC_HANDLER >* con_s = 0 )

| Initialize the appropriate strategies for concurrency and then open the <peer_acceptor> at the designated <local_addr>. Note that unlike the and , this method does NOT register <this> acceptor with the <reactor> at this point -- it just stashes the <reactor> away in case it's needed later.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
ACE_Oneshot_Acceptor<SVC_HANDLER, >::operator ACE_PEER_ACCEPTOR & ( | ) const`[virtual]`

| Return the underlying <PEER_ACCEPTOR> object.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
int ACE_Oneshot_Acceptor<SVC_HANDLER, >::register_handler ( | SVC_HANDLER * svc_handler,
| const ACE_Synch_Options & options,
| int restart )`[private]`

| Insert ourselves into the so that we can continue accepting this connection asynchronously. This method should NOT be called by developers directly.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
int ACE_Oneshot_Acceptor<SVC_HANDLER, >::resume ( | void )`[protected, virtual]`

| Default version does no work and returns -1. Must be overloaded by application developer to do anything meaningful. Reimplemented from ACE_Service_Object.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
int ACE_Oneshot_Acceptor<SVC_HANDLER, >::shared_accept ( | SVC_HANDLER * svc_handler,
| ACE_PEER_ACCEPTOR_ADDR * remote_addr,
| ACE_Time_Value * timeout,
| int restart,
| int reset_new_handle )`[protected]`

| Factors out the code shared between the and <handle_input> methods.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
int ACE_Oneshot_Acceptor<SVC_HANDLER, >::suspend ( | void )`[protected, virtual]`

| Default version does no work and returns -1. Must be overloaded by application developer to do anything meaningful. Reimplemented from ACE_Service_Object.

## Member Data Documentation

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
ACE_Oneshot_Acceptor<SVC_HANDLER, >::ACE_ALLOC_HOOK_DECLARE

| Declare the dynamic allocation hooks.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
ACE_Concurrency_Strategy< SVC_HANDLER >* ACE_Oneshot_Acceptor<SVC_HANDLER, >::concurrency_strategy_`[private]`

| Concurrency strategy for an Acceptor.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
int ACE_Oneshot_Acceptor<SVC_HANDLER, >::delete_concurrency_strategy_`[private]`

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

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
ACE_PEER_ACCEPTOR ACE_Oneshot_Acceptor<SVC_HANDLER, >::peer_acceptor_`[private]`

| Factory that establishes connections passively.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
int ACE_Oneshot_Acceptor<SVC_HANDLER, >::restart_`[private]`

| Hold the restart flag across asynchrony boundaries.

template<classSVC_HANDLER, ACE_PEER_ACCEPTOR_1>
SVC_HANDLER * ACE_Oneshot_Acceptor<SVC_HANDLER, >::svc_handler_`[private]`

| Hold the svc_handler_ across asynchrony boundaries.

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

- Acceptor.h
- Acceptor.cpp