#include <Dev_Poll_Reactor.h>
Collaboration diagram for ACE_Dev_Poll_Reactor_Handler_Repository:

Public Member Functions | |
| ACE_Dev_Poll_Reactor_Handler_Repository (void) | |
| Constructor. | |
| int | open (size_t size) |
| Initialize a repository of the appropriate . | |
| int | close (void) |
| Close down the repository. | |
| size_t | size (void) const |
| Returns the current table size. | |
| void | dump (void) const |
| Dump the state of an object. | |
Repository Manipulation Operations | |
| ACE_Event_Handler * | find (ACE_HANDLE handle, size_t *index_p=0) |
| void | mask (ACE_HANDLE handle, ACE_Reactor_Mask mask) |
| ACE_Reactor_Mask | mask (ACE_HANDLE handle) |
| void | suspend (ACE_HANDLE handle) |
| void | resume (ACE_HANDLE handle) |
| int | suspended (ACE_HANDLE handle) const |
| Is the event handler for the given handle suspended? | |
| int | bind (ACE_HANDLE handle, ACE_Event_Handler *handler, ACE_Reactor_Mask mask) |
| int | unbind (ACE_HANDLE handle, bool decr_refcnt=true) |
| int | unbind_all (void) |
Remove all the (ACE_HANDLE, ACE_Event_Handler) tuples. | |
Sanity Checking | |
Methods used to prevent "out-of-range" errors when indexing the underlying handler array. | |
| int | invalid_handle (ACE_HANDLE handle) const |
| int | handle_in_range (ACE_HANDLE handle) const |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. | |
Private Attributes | |
| int | max_size_ |
| Maximum number of handles. | |
| ACE_Dev_Poll_Event_Tuple * | handlers_ |
| The underlying array of event handlers. | |
For internal use only.
This class is simply a container that maps a handle to its corresponding event handler. It is not meant for use outside of the Dev_Poll_Reactor.
Definition at line 330 of file Dev_Poll_Reactor.h.
|
|
Constructor.
Definition at line 578 of file Dev_Poll_Reactor.cpp. References ACE_TRACE.
|
|
||||||||||||||||
|
Bind the ACE_Event_Handler to the Definition at line 687 of file Dev_Poll_Reactor.cpp. References ACE_Reactor_Mask, ACE_TRACE, ACE_Event_Handler::add_reference(), ACE_Dev_Poll_Event_Tuple::event_handler, ACE_Event_Handler::get_handle(), handlers_, invalid_handle(), and ACE_Dev_Poll_Event_Tuple::mask. Referenced by ACE_Dev_Poll_Reactor::register_handler_i().
00691 {
00692 ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::bind");
00693
00694 if (handle == ACE_INVALID_HANDLE)
00695 handle = event_handler->get_handle ();
00696
00697 if (this->invalid_handle (handle))
00698 return -1;
00699
00700 this->handlers_[handle].event_handler = event_handler;
00701 this->handlers_[handle].mask = mask;
00702 event_handler->add_reference ();
00703
00704 return 0;
00705 }
|
|
|
Close down the repository.
Definition at line 647 of file Dev_Poll_Reactor.cpp. References ACE_TRACE, handlers_, and unbind_all(). Referenced by ACE_Dev_Poll_Reactor::close().
00648 {
00649 ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::close");
00650
00651 if (this->handlers_ != 0)
00652 {
00653 this->unbind_all ();
00654
00655 delete [] this->handlers_;
00656 this->handlers_ = 0;
00657 }
00658
00659 return 0;
00660 }
|
|
|
Dump the state of an object.
|
|
||||||||||||
|
Return the Definition at line 663 of file Dev_Poll_Reactor.cpp. References ACE_TRACE, ACE_Dev_Poll_Event_Tuple::event_handler, handle_in_range(), and handlers_. Referenced by ACE_Dev_Poll_Reactor::dispatch_io_event(), ACE_Dev_Poll_Reactor::find_handler(), ACE_Dev_Poll_Reactor::handler(), ACE_Dev_Poll_Reactor::register_handler_i(), ACE_Dev_Poll_Reactor::remove_handler_i(), ACE_Dev_Poll_Reactor::resume_handler_i(), ACE_Dev_Poll_Reactor::suspend_handler_i(), and unbind().
00665 {
00666 ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::find");
00667
00668 ACE_Event_Handler *eh = 0;
00669
00670 // Only bother to search for the <handle> if it's in range.
00671 if (this->handle_in_range (handle))
00672 {
00673 eh = this->handlers_[handle].event_handler;
00674 if (eh != 0)
00675 {
00676 if (index_p != 0)
00677 *index_p = handle;
00678 }
00679 else
00680 errno = ENOENT;
00681 }
00682
00683 return eh;
00684 }
|
|
|
Definition at line 601 of file Dev_Poll_Reactor.cpp. References ACE_TRACE. Referenced by find(), mask(), ACE_Dev_Poll_Reactor::mask_ops_i(), resume(), suspend(), and suspended().
|
|
|
Definition at line 586 of file Dev_Poll_Reactor.cpp. References ACE_TRACE. Referenced by bind().
|
|
|
Retrieve the event mask for the event handler associated with the given handle. Definition at line 42 of file Dev_Poll_Reactor.inl. References ACE_Reactor_Mask, ACE_TRACE, handle_in_range(), handlers_, and ACE_Dev_Poll_Event_Tuple::mask.
00043 {
00044 ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::mask");
00045
00046 ACE_Reactor_Mask mask = ACE_Event_Handler::NULL_MASK;
00047
00048 // Only bother to search for the handle if it's in range.
00049 if (this->handle_in_range (handle))
00050 mask = this->handlers_[handle].mask;
00051
00052 if (mask == ACE_Event_Handler::NULL_MASK)
00053 errno = ENOENT;
00054
00055 return mask;
00056 }
|
|
||||||||||||
|
Set the event mask for event handler associated with the given handle. Definition at line 31 of file Dev_Poll_Reactor.inl. References ACE_Reactor_Mask, ACE_TRACE, handle_in_range(), handlers_, and ACE_Dev_Poll_Event_Tuple::mask. Referenced by ACE_Dev_Poll_Reactor::mask_ops_i(), ACE_Dev_Poll_Reactor::remove_handler_i(), and ACE_Dev_Poll_Reactor::resume_handler_i().
00033 {
00034 ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::mask");
00035
00036 // Only bother to search for the handle if it's in range.
00037 if (this->handle_in_range (handle))
00038 this->handlers_[handle].mask = mask;
00039 }
|
|
|
Initialize a repository of the appropriate .
Definition at line 616 of file Dev_Poll_Reactor.cpp. References ACE_NEW_RETURN, ACE_TRACE, and ACE::set_handle_limit(). Referenced by ACE_Dev_Poll_Reactor::open().
00617 {
00618 ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::open");
00619
00620 this->max_size_ = size;
00621
00622 // Try to allocate the memory.
00623 ACE_NEW_RETURN (this->handlers_,
00624 ACE_Dev_Poll_Event_Tuple[size],
00625 -1);
00626
00627 // Try to increase the number of handles if <size> is greater than
00628 // the current limit.
00629 return ACE::set_handle_limit (size);
00630 }
|
|
|
Mark the event handler associated with the given handle as "resumed." Definition at line 69 of file Dev_Poll_Reactor.inl. References ACE_TRACE, handle_in_range(), handlers_, and ACE_Dev_Poll_Event_Tuple::suspended. Referenced by ACE_Dev_Poll_Reactor::resume_handler_i().
00070 {
00071 ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::resume");
00072
00073 // Only bother to search for the handle if it's in range.
00074 if (this->handle_in_range (handle))
00075 this->handlers_[handle].suspended = 0;
00076 }
|
|
|
Returns the current table size.
Definition at line 90 of file Dev_Poll_Reactor.inl. References ACE_TRACE. Referenced by ACE_Dev_Poll_Reactor::resume_handlers(), and ACE_Dev_Poll_Reactor::suspend_handlers().
|
|
|
Mark the event handler associated with the given handle as "suspended." Definition at line 59 of file Dev_Poll_Reactor.inl. References ACE_TRACE, handle_in_range(), handlers_, and ACE_Dev_Poll_Event_Tuple::suspended. Referenced by ACE_Dev_Poll_Reactor::suspend_handler_i().
00060 {
00061 ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::suspend");
00062
00063 // Only bother to search for the handle if it's in range.
00064 if (this->handle_in_range (handle))
00065 this->handlers_[handle].suspended = 1;
00066 }
|
|
|
Is the event handler for the given handle suspended?
Definition at line 79 of file Dev_Poll_Reactor.inl. References ACE_TRACE, handle_in_range(), handlers_, and ACE_Dev_Poll_Event_Tuple::suspended. Referenced by ACE_Dev_Poll_Reactor::mask_ops_i(), ACE_Dev_Poll_Reactor::resume_handler_i(), ACE_Dev_Poll_Reactor::resume_handlers(), ACE_Dev_Poll_Reactor::suspend_handler_i(), and ACE_Dev_Poll_Reactor::suspend_handlers().
00080 {
00081 ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::suspended");
00082
00083 if (this->handle_in_range (handle))
00084 return this->handlers_[handle].suspended;
00085
00086 return -1;
00087 }
|
|
||||||||||||
|
Remove the binding for Definition at line 708 of file Dev_Poll_Reactor.cpp. References ACE_TRACE, ACE_Dev_Poll_Event_Tuple::event_handler, find(), handlers_, ACE_Dev_Poll_Event_Tuple::mask, ACE_Event_Handler::remove_reference(), and ACE_Dev_Poll_Event_Tuple::suspended. Referenced by ACE_Dev_Poll_Reactor::register_handler_i(), ACE_Dev_Poll_Reactor::remove_handler_i(), and unbind_all().
00710 {
00711 ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::unbind");
00712
00713 if (this->find (handle) == 0)
00714 return -1;
00715
00716 if (decr_refcnt)
00717 this->handlers_[handle].event_handler->remove_reference ();
00718 this->handlers_[handle].event_handler = 0;
00719 this->handlers_[handle].mask = ACE_Event_Handler::NULL_MASK;
00720 this->handlers_[handle].suspended = 0;
00721
00722 return 0;
00723 }
|
|
|
Remove all the (
Definition at line 633 of file Dev_Poll_Reactor.cpp. References ACE_TRACE, and unbind(). Referenced by close().
|
|
|
Declare the dynamic allocation hooks.
Definition at line 416 of file Dev_Poll_Reactor.h. |
|
|
The underlying array of event handlers.
The array of event handlers is directly indexed directly using an Definition at line 428 of file Dev_Poll_Reactor.h. Referenced by bind(), close(), find(), mask(), resume(), suspend(), suspended(), and unbind(). |
|
|
Maximum number of handles.
Definition at line 421 of file Dev_Poll_Reactor.h. |
1.3.6