diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
commit | 6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (patch) | |
tree | da50d054f9c761c3f6a5923f6979e93306c56d68 /TAO/orbsvcs/orbsvcs/Event | |
parent | 0e555b9150d38e3b3473ba325b56db2642e6352b (diff) | |
download | ATCD-6b846cf03c0bcbd8c276cb0af61a181e5f98eaae.tar.gz |
Repo restructuring
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Event')
220 files changed, 0 insertions, 28189 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Adapters.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_Adapters.cpp deleted file mode 100644 index 8813fee591c..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Adapters.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/ECG_Adapters.h" - -ACE_RCSID (Event, - ECG_Adapters, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_ECG_Handler_Shutdown::~TAO_ECG_Handler_Shutdown (void) -{ -} - -TAO_ECG_Dgram_Handler::~TAO_ECG_Dgram_Handler (void) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Adapters.h b/TAO/orbsvcs/orbsvcs/Event/ECG_Adapters.h deleted file mode 100644 index 8c79e6415f6..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Adapters.h +++ /dev/null @@ -1,79 +0,0 @@ -// -*- C++ -*- - -/** - * @file ECG_Adapters.h - * - * $Id$ - * - * @author Marina Spivak <marina@atdesk.com> - * - * Define interfaces ECG Receivers and Mcast and UDP handlers can use - * to communicate with each other. - * Use of these interfaces eliminates the coupling of specific - * Receivers on specific handlers, and vice versa. - * - */ -#ifndef TAO_ECG_ADAPTERS_H -#define TAO_ECG_ADAPTERS_H -#include /**/ "ace/pre.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" -#include "orbsvcs/RtecUDPAdminC.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Refcounted_Auto_Ptr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -class ACE_SOCK_Dgram; -ACE_END_VERSIONED_NAMESPACE_DECL - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_ECG_Handler_Shutdown - * - * @brief Interface that should be implemented - * by multicast and udp handlers in EC gateways, so the - * handlers can be notified of shutdown (usually by Event Receivers). - */ -class TAO_RTEvent_Serv_Export TAO_ECG_Handler_Shutdown -{ -public: - - // Define virtual destructor to make sure we can delete derived - // objects through a pointer to TAO_ECG_Handler_Shutdown. - virtual ~TAO_ECG_Handler_Shutdown (void); - virtual int shutdown (void) = 0; -}; - -/** - * @class TAO_ECG_Dgram_Handler - * - * @brief Interface used by mcast/udp handlers to notify interested - * components (usually Event Receivers) that there is data - * available on the dgram for reading, and to query them about - * event type to mcast group mappings. - */ -class TAO_RTEvent_Serv_Export TAO_ECG_Dgram_Handler -{ -public: - - virtual ~TAO_ECG_Dgram_Handler (void); - - virtual int handle_input (ACE_SOCK_Dgram& dgram) = 0; - - virtual void get_addr (const RtecEventComm::EventHeader& header, - RtecUDPAdmin::UDP_Addr_out addr - ACE_ENV_ARG_DECL) = 0; -}; - -typedef ACE_Refcounted_Auto_Ptr<TAO_ECG_Handler_Shutdown, - ACE_Null_Mutex> TAO_ECG_Refcounted_Handler; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* TAO_ECG_ADAPTERS_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Address_Server_Base.h b/TAO/orbsvcs/orbsvcs/Event/ECG_Address_Server_Base.h deleted file mode 100644 index 2490b33d051..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Address_Server_Base.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- -/** - * @file ECG_Address_Server_Base.h - * - * $Id$ - * - * @author Marina Spivak (marina@atdesk.com) - * - */ - -#ifndef TAO_ECG_ADDRESS_SERVER_BASE_H -#define TAO_ECG_ADDRESS_SERVER_BASE_H -#include /**/ "ace/pre.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" -#include "orbsvcs/RtecUDPAdminS.h" -#include "orbsvcs/Event/EC_Lifetime_Utils.h" -#include "ace/Auto_Ptr.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_ECG_Address_Server_Base - * - * @brief All implementations of RtecUDPAdmin::AddrServer idl - * interface should inherit from this abstract base. - * - * Adds init () virtual method so that all AddrServer implementations can be - * initialized in the same fasion. - */ -class TAO_RTEvent_Serv_Export TAO_ECG_Address_Server_Base - : public virtual POA_RtecUDPAdmin::AddrServer -{ -public: - - virtual int init (const char *arg) = 0; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* TAO_ECG_ADDRESS_SERVER_BASE_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Receiver.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Receiver.cpp deleted file mode 100644 index faf377fd386..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Receiver.cpp +++ /dev/null @@ -1,608 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/ECG_CDR_Message_Receiver.h" -#include "orbsvcs/Event/ECG_CDR_Message_Sender.h" - -#include "tao/Exception.h" - -#include "ace/SOCK_Dgram.h" -#include "ace/ACE.h" -#include "ace/OS_NS_string.h" - -#if !defined(__ACE_INLINE__) -#include "orbsvcs/Event/ECG_CDR_Message_Receiver.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (Event, - ECG_CDR_Message_Receiver, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_ECG_CDR_Processor::~TAO_ECG_CDR_Processor (void) -{ -} -// **************************************************************** - -TAO_ECG_UDP_Request_Entry::~TAO_ECG_UDP_Request_Entry (void) -{ - if (this->own_received_fragments_) - { - this->own_received_fragments_ = 0; - delete[] this->received_fragments_; - } -} - -TAO_ECG_UDP_Request_Entry:: -TAO_ECG_UDP_Request_Entry (CORBA::Boolean byte_order, - CORBA::ULong request_id, - CORBA::ULong request_size, - CORBA::ULong fragment_count) - : byte_order_ (byte_order) - , request_id_ (request_id) - , request_size_ (request_size) - , fragment_count_ (fragment_count) -{ - ACE_CDR::grow (&this->payload_, this->request_size_); - this->payload_.wr_ptr (request_size_); - - this->received_fragments_ = this->default_received_fragments_; - this->own_received_fragments_ = 0; - const int bits_per_ulong = sizeof(CORBA::ULong) * CHAR_BIT; - this->received_fragments_size_ = - this->fragment_count_ / bits_per_ulong + 1; - if (this->received_fragments_size_ > ECG_DEFAULT_FRAGMENT_BUFSIZ) - { - ACE_NEW (this->received_fragments_, - CORBA::ULong[this->received_fragments_size_]); - this->own_received_fragments_ = 1; - } - - for (CORBA::ULong i = 0; i < this->received_fragments_size_; ++i) - this->received_fragments_[i] = 0; - CORBA::ULong idx = this->fragment_count_ / bits_per_ulong; - CORBA::ULong bit = this->fragment_count_ % bits_per_ulong; - this->received_fragments_[idx] = (0xFFFFFFFF << bit); -} - -int -TAO_ECG_UDP_Request_Entry::validate_fragment (CORBA::Boolean byte_order, - CORBA::ULong request_size, - CORBA::ULong fragment_size, - CORBA::ULong fragment_offset, - CORBA::ULong /* fragment_id */, - CORBA::ULong fragment_count) const -{ - if (byte_order != this->byte_order_ - || request_size != this->request_size_ - || fragment_count != this->fragment_count_) - return 0; - - if (fragment_offset >= request_size - || fragment_offset + fragment_size > request_size) - return 0; - - return 1; -} - -int -TAO_ECG_UDP_Request_Entry::test_received (CORBA::ULong fragment_id) const -{ - // Assume out-of-range fragments as received, so they are dropped... - if (fragment_id > this->fragment_count_) - return 1; - - const int bits_per_ulong = sizeof(CORBA::ULong) * CHAR_BIT; - CORBA::ULong idx = fragment_id / bits_per_ulong; - CORBA::ULong bit = fragment_id % bits_per_ulong; - return ACE_BIT_ENABLED (this->received_fragments_[idx], 1<<bit); -} - -void -TAO_ECG_UDP_Request_Entry::mark_received (CORBA::ULong fragment_id) -{ - // Assume out-of-range fragments as received, so they are dropped... - if (fragment_id > this->fragment_count_) - return; - - const int bits_per_ulong = sizeof(CORBA::ULong) * CHAR_BIT; - CORBA::ULong idx = fragment_id / bits_per_ulong; - CORBA::ULong bit = fragment_id % bits_per_ulong; - ACE_SET_BITS (this->received_fragments_[idx], 1<<bit); -} - -int -TAO_ECG_UDP_Request_Entry::complete (void) const -{ - for (CORBA::ULong i = 0; - i < this->received_fragments_size_; - ++i) - { - if (this->received_fragments_[i] != 0xFFFFFFFF) - return 0; - } - return 1; -} - -char* -TAO_ECG_UDP_Request_Entry::fragment_buffer (CORBA::ULong fragment_offset) -{ - return this->payload_.rd_ptr () + fragment_offset; -} -// **************************************************************** - -int -TAO_ECG_CDR_Message_Receiver::Requests::init (size_t size, - size_t min_purge_count) -{ - // Already initialized. - if (this->fragmented_requests_) - return -1; - - ACE_NEW_RETURN (this->fragmented_requests_, - TAO_ECG_UDP_Request_Entry*[size], - -1); - - this->size_ = size; - this->id_range_low_ = 0; - this->id_range_high_ = size - 1; - this->min_purge_count_ = min_purge_count; - - for (size_t i = 0; i < size; ++i) - { - this->fragmented_requests_[i] = 0; - } - - return 0; -} - -TAO_ECG_CDR_Message_Receiver::Requests::~Requests (void) -{ - for (size_t i = 0; i < this->size_; ++i) - { - TAO_ECG_UDP_Request_Entry* request = - this->fragmented_requests_[i]; - - if (request != &TAO_ECG_CDR_Message_Receiver::Request_Completed_) - delete request; - } - - delete [] this->fragmented_requests_; - - this->fragmented_requests_ = 0; - this->size_ = 0; - this->id_range_low_ = 0; - this->id_range_high_ = 0; -} - -TAO_ECG_UDP_Request_Entry ** -TAO_ECG_CDR_Message_Receiver::Requests::get_request (CORBA::ULong request_id) -{ - if (request_id < this->id_range_low_) - // <request_id> is below the current range. - { - return 0; - } - - if (request_id > this->id_range_high_) - // <request_id> is above the current range - need to shift the range - // to include it. - { - CORBA::ULong new_slots_needed = request_id - this->id_range_high_; - - if (new_slots_needed < this->min_purge_count_) - new_slots_needed = this->min_purge_count_; - - if (new_slots_needed > this->size_) - // Shifting the range by more than the size of array. - { - this->purge_requests (this->id_range_low_, this->id_range_high_); - this->id_range_high_ = request_id; - this->id_range_low_ = request_id - this->size_ + 1; - } - else - { - this->purge_requests (this->id_range_low_, - this->id_range_low_ + new_slots_needed - 1); - this->id_range_high_ += new_slots_needed; - this->id_range_low_ += new_slots_needed; - } - } - - // Return array location for <request_id>. - int index = request_id % this->size_; - return this->fragmented_requests_ + index; -} - - -void -TAO_ECG_CDR_Message_Receiver::Requests::purge_requests ( - CORBA::ULong purge_first, - CORBA::ULong purge_last) -{ - for (CORBA::ULong i = purge_first; i <= purge_last; ++i) - { - size_t index = i % this->size_; - if (this->fragmented_requests_[index] - != &TAO_ECG_CDR_Message_Receiver::Request_Completed_) - { - delete this->fragmented_requests_[index]; - } - this->fragmented_requests_[index] = 0; - } -} - -// **************************************************************** - -TAO_ECG_UDP_Request_Entry -TAO_ECG_CDR_Message_Receiver::Request_Completed_ (0, 0, 0, 0); - -int -TAO_ECG_CDR_Message_Receiver::handle_input ( - ACE_SOCK_Dgram& dgram, - TAO_ECG_CDR_Processor *cdr_processor) -{ - char nonaligned_header[TAO_ECG_CDR_Message_Sender::ECG_HEADER_SIZE - + ACE_CDR::MAX_ALIGNMENT]; - char *header_buf = ACE_ptr_align_binary (nonaligned_header, - ACE_CDR::MAX_ALIGNMENT); - - char nonaligned_data[ACE_MAX_DGRAM_SIZE + ACE_CDR::MAX_ALIGNMENT]; - char *data_buf = ACE_ptr_align_binary (nonaligned_data, - ACE_CDR::MAX_ALIGNMENT); - - // Read the message from dgram. - - const int iovcnt = 2; - iovec iov[iovcnt]; - iov[0].iov_base = header_buf; - iov[0].iov_len = TAO_ECG_CDR_Message_Sender::ECG_HEADER_SIZE; - iov[1].iov_base = data_buf; - iov[1].iov_len = ACE_MAX_DGRAM_SIZE; - - ACE_INET_Addr from; - ssize_t n = dgram.recv (iov, iovcnt, from); - - if (n == -1) - { - if (errno == EWOULDBLOCK) - return 0; - - ACE_ERROR_RETURN ((LM_ERROR, "Error reading mcast fragment (%m).\n"), - -1); - } - - if (n == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, "Trying to read mcast fragment: " - "read 0 bytes from socket.\n"), - 0); - } - - if (n < TAO_ECG_CDR_Message_Sender::ECG_HEADER_SIZE) - { - ACE_ERROR_RETURN ((LM_ERROR, "Trying to read mcast fragment: " - "# of bytes read < mcast header size.\n"), - -1); - } - - u_int crc = 0; - - if (this->check_crc_) - { - iov[1].iov_len = n - iov[0].iov_len; - iov[0].iov_len -= 4; // don't include crc - - crc = ACE::crc32 (iov, 2); - } - // Check whether the message is a loopback message. - if (this->ignore_from_.get () != 0 - && this->ignore_from_->is_loopback (from)) - { - return 0; - } - - // Decode and validate mcast header. - Mcast_Header header; - if (header.read (header_buf, n, this->check_crc_) == -1) - return -1; - - if ( this->check_crc_ && header.crc != crc) - { - static unsigned int err_count = 0; - ACE_ERROR ((LM_DEBUG, - "******************************\n")); - - ACE_ERROR ((LM_DEBUG, - "ERROR DETECTED \n")); - - if (crc == 0) - { - ACE_ERROR ((LM_DEBUG, - "Sending process may not have computed CRC \n")); - } - else - { - ACE_ERROR ((LM_DEBUG, - " NETWORK CRC CHECKSUM FAILED\n")); - } - - ACE_ERROR ((LM_ERROR, - "Message was received from [%s:%s:%d] \n", - from.get_host_name (), - from.get_host_addr (), - from.get_port_number())); - - ACE_ERROR ((LM_ERROR, - "Num errors = %d \n", - ++err_count)); - ACE_ERROR ((LM_ERROR, - "This is a bad thing. Attempting to ignore ..\n")); - - return 0; - } - - // Process received data. - if (header.fragment_count == 1) - { - // Update <request_map_> to mark this request as completed. (Not - // needed if we don't care about duplicates.) - int result = this->mark_received (from, header.request_id); - if (result != 1) - return result; - - TAO_InputCDR cdr (data_buf, header.request_size, header.byte_order); - if (cdr_processor->decode (cdr) == -1) - return -1; - else - return 1; - } - - return this->process_fragment (from, header, data_buf, cdr_processor); -} - -int -TAO_ECG_CDR_Message_Receiver::mark_received (const ACE_INET_Addr &from, - CORBA::ULong request_id) -{ - // ACE_GUARD_RETURN (ACE_Lock, guard, *this->lock_, -1); - - Request_Map::ENTRY * entry = this->get_source_entry (from); - if (!entry) - return -1; - - TAO_ECG_UDP_Request_Entry ** request = - entry->int_id_->get_request (request_id); - - if (request == 0) - { - ACE_DEBUG ((LM_WARNING, "Received mcast request with sequence" - "below currently expected range.\n")); - return 0; - } - if (*request == &Request_Completed_) - { - ACE_DEBUG ((LM_INFO, "Received duplicate mcast fragment. " - "(Request already complete).\n")); - return 0; - } - if (*request != 0) - { - ACE_ERROR_RETURN ((LM_ERROR, "Inconsistent fragments for " - "mcast request.\n"), - -1); - } - - *request = &Request_Completed_; - return 1; -} - -int -TAO_ECG_CDR_Message_Receiver::process_fragment ( - const ACE_INET_Addr &from, - const Mcast_Header &header, - char * data_buf, - TAO_ECG_CDR_Processor *cdr_processor) -{ - // ACE_GUARD_RETURN (ACE_Lock, guard, *this->lock_, -1); - - Request_Map::ENTRY * source_entry = this->get_source_entry (from); - if (!source_entry) - return -1; - - TAO_ECG_UDP_Request_Entry ** request = - source_entry->int_id_->get_request (header.request_id); - - if (request == 0) - { - ACE_DEBUG ((LM_WARNING, "Received mcast request with sequence " - "below currently expected range.\n")); - return 0; - } - if (*request == &Request_Completed_) - { - ACE_DEBUG ((LM_INFO, "Received duplicate mcast fragment. " - "(Request already complete).\n")); - return 0; - } - if (*request == 0) - // Entry for this request has not yet been allocated. - { - ACE_NEW_RETURN (*request, - TAO_ECG_UDP_Request_Entry (header.byte_order, - header.request_id, - header.request_size, - header.fragment_count), - -1); - } - - // Validate the fragment. - if ((*request)->validate_fragment (header.byte_order, - header.request_size, - header.fragment_size, - header.fragment_offset, - header.fragment_id, - header.fragment_count) == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Received invalid mcast fragment.\n"), - -1); - } - - // Check whether this fragment was already received. - if ((*request)->test_received (header.fragment_id) == 1) - { - ACE_DEBUG ((LM_INFO, "Received duplicate mcast fragment.\n")); - return 0; - } - - // Add the fragment to the request entry. - (*request)->mark_received (header.fragment_id); - ACE_OS::memcpy ((*request)->fragment_buffer (header.fragment_offset), - data_buf, - header.fragment_size); - - // The request is not yet complete. - if (!(*request)->complete ()) - { - return 0; - } - - // The request is complete - decode it. - TAO_InputCDR cdr ((*request)->fragment_buffer (0), - header.request_size, - header.byte_order); - - if (cdr_processor->decode (cdr) == -1) - return -1; - - delete *request; - *request = &Request_Completed_; - return 1; -} - -TAO_ECG_CDR_Message_Receiver::Request_Map::ENTRY* -TAO_ECG_CDR_Message_Receiver::get_source_entry (const ACE_INET_Addr &from) -{ - // Get the entry for <from> from the <request_map_>. - Request_Map::ENTRY * entry; - - if (this->request_map_.find (from, entry) == -1) - { - // Create an entry if one doesn't exist. - Requests *requests = 0; - ACE_NEW_RETURN (requests, - Requests, - 0); - auto_ptr<Requests> requests_aptr (requests); - - if (requests->init (this->max_requests_, this->min_purge_count_) == -1 - || this->request_map_.bind (from, requests, entry) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, "Unable to create hash map " - "entry for a new request.\n"), - 0); - } - requests_aptr.release (); - } - - return entry; -} - -void -TAO_ECG_CDR_Message_Receiver::shutdown (void) -{ - // ACE_GUARD (ACE_Lock, guard, *this->lock_); - - Request_Map::iterator end = this->request_map_.end (); - for (Request_Map::iterator i = this->request_map_.begin (); - i != end; - ++i) - { - delete (*i).int_id_; - (*i).int_id_ = 0; - } - - this->ignore_from_.reset (); -} - -// **************************************************************** -int -TAO_ECG_CDR_Message_Receiver::Mcast_Header::read (char *header, - size_t bytes_received, - CORBA::Boolean checkcrc) -{ - // Decode. - this->byte_order = header[0]; - if(this->byte_order != 0 && this->byte_order != 1) - { - ACE_ERROR_RETURN ((LM_ERROR, "Reading mcast packet header: byte " - "order is neither 0 nor 1, it is %d.\n", - this->byte_order), - -1); - } - - TAO_InputCDR header_cdr (header, - TAO_ECG_CDR_Message_Sender::ECG_HEADER_SIZE, - byte_order); - CORBA::Boolean unused; - CORBA::Octet a, b, c; - if (!header_cdr.read_boolean (unused) - || !header_cdr.read_octet (a) - || !header_cdr.read_octet (b) - || !header_cdr.read_octet (c) - || a != 'A' || b != 'B' || c != 'C') - { - ACE_ERROR_RETURN ((LM_ERROR, "Error reading magic bytes " - "in mcast packet header.\n"), - -1); - } - - if (!header_cdr.read_ulong (this->request_id) - || !header_cdr.read_ulong (this->request_size) - || !header_cdr.read_ulong (this->fragment_size) - || !header_cdr.read_ulong (this->fragment_offset) - || !header_cdr.read_ulong (this->fragment_id) - || !header_cdr.read_ulong (this->fragment_count)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Error decoding mcast packet header.\n"), - -1); - } - - if (checkcrc) - { - CORBA::Octet padding[4]; - header_cdr.read_octet_array (padding, 4); - - unsigned char *crcparts = (unsigned char *)(&this->crc); - - for (int cnt=0; cnt != 4; ++cnt) - { - crcparts[cnt] = padding[cnt]; - } - - this->crc = ntohl (this->crc); - } - - // Validate. - size_t data_bytes_received = - bytes_received - TAO_ECG_CDR_Message_Sender::ECG_HEADER_SIZE; - - if (this->request_size < this->fragment_size - || this->fragment_offset >= this->request_size - || this->fragment_id >= this->fragment_count - || (this->fragment_count == 1 - && (this->fragment_size != this->request_size - || this->request_size != data_bytes_received))) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Invalid mcast fragment: " - "inconsistent header fields.\n"), - -1); - } - - return 0; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Receiver.h b/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Receiver.h deleted file mode 100644 index 8159a4e2f15..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Receiver.h +++ /dev/null @@ -1,318 +0,0 @@ -// -*- C++ -*- -/** - * @file ECG_CDR_Message_Receiver.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * @author Marina Spivak (marina@atdesk.com) - */ - -#ifndef TAO_ECG_CDR_MESSAGE_RECEIVER_H -#define TAO_ECG_CDR_MESSAGE_RECEIVER_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/ECG_UDP_Out_Endpoint.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/CDR.h" -#include "tao/Environment.h" - -#include "ace/Hash_Map_Manager.h" -#include "ace/INET_Addr.h" -#include "ace/Null_Mutex.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_ECG_CDR_Processor - * - * @brief Interface for callback objects used by - * TAO_ECG_CDR_Message_Receiver to propagate received data to - * its callers. - */ -class TAO_ECG_CDR_Processor -{ -public: - virtual ~TAO_ECG_CDR_Processor (void); - - /// Extracts data from <cdr>. Returns 0 on success, -1 on error. - virtual int decode (TAO_InputCDR &cdr) = 0; -}; - -// **************************************************************** -/** - * @class TAO_ECG_UDP_Request_Entry - * - * @brief Keeps information about an incomplete request. - * - * When a request arrives in fragments this object is used to - * keep track of the incoming data. - */ -class TAO_ECG_UDP_Request_Entry -{ -public: - enum { - ECG_DEFAULT_FRAGMENT_BUFSIZ = 8 - }; - - /// Initialize the fragment, allocating memory, etc. - TAO_ECG_UDP_Request_Entry (CORBA::Boolean byte_order, - CORBA::ULong request_id, - CORBA::ULong request_size, - CORBA::ULong fragment_count); - - ~TAO_ECG_UDP_Request_Entry (void); - - /// Validate a fragment, it should be rejected if it is invalid.. - int validate_fragment (CORBA::Boolean byte_order, - CORBA::ULong request_size, - CORBA::ULong fragment_size, - CORBA::ULong fragment_offset, - CORBA::ULong fragment_id, - CORBA::ULong fragment_count) const; - - /// Has @a fragment_id been received? - int test_received (CORBA::ULong fragment_id) const; - - /// Mark @a fragment_id as received, reset timeout counter... - void mark_received (CORBA::ULong fragment_id); - - /// Is the message complete? - int complete (void) const; - - /// Return a buffer for the fragment at offset @a fragment_offset - char* fragment_buffer (CORBA::ULong fragment_offset); - -private: - - TAO_ECG_UDP_Request_Entry (const TAO_ECG_UDP_Request_Entry & rhs); - TAO_ECG_UDP_Request_Entry& operator= (const TAO_ECG_UDP_Request_Entry & rhs); - -private: - /// This attributes should remain constant in all the fragments, used - /// for validation.... - CORBA::Boolean byte_order_; - CORBA::ULong request_id_; - CORBA::ULong request_size_; - CORBA::ULong fragment_count_; - - ACE_Message_Block payload_; - - /// This is a bit vector, used to keep track of the received buffers. - CORBA::ULong* received_fragments_; - int own_received_fragments_; - CORBA::ULong received_fragments_size_; - CORBA::ULong default_received_fragments_[ECG_DEFAULT_FRAGMENT_BUFSIZ]; -}; - -// **************************************************************** - -/** - * @class TAO_ECG_CDR_Message_Receiver - * - * @brief Receives UDP and Multicast messages. - * - * @todo Update class documentation below. - * - * 5) Make status array size and purge_count configurable. - * - * This class receives UDP and Multicast message fragments, assembles - * them (described in detail below), and passes complete messages - * in the form of cdr streams to the calling classes. - * - * This class is used by various Gateway classes (Senders/Receivers) - * responsible for federating Event Channels with UDP/Mcast. - * - * = REASSEMBLY - * Fragmentation is described in ECG_CDR_Message_Sender.h - * Whenever an incomplete fragment is received (one with - * fragment_count > 1) we allocate an entry for the message in an - * map indexed by (host,port,request_id). The entry contains the - * buffer, a bit vector to keep track of the fragments received - * so far, and a timeout counter. This timeout counter is set to - * 0 on each (new) fragment arrival, and incremented on a regular - * basis. If the counter reaches a maximum value the message is - * dropped. - * Once all the fragments have been received the message is sent - * up to the calling classes, and the memory reclaimed. - */ -class TAO_RTEvent_Serv_Export TAO_ECG_CDR_Message_Receiver -{ -public: - /// Initialization and termination methods. - //@{ - TAO_ECG_CDR_Message_Receiver (CORBA::Boolean check_crc); - ~TAO_ECG_CDR_Message_Receiver (void); - - /** - * @param ignore_from Endpoint used to remove events generated by - * the same process. - */ - void init (TAO_ECG_Refcounted_Endpoint ignore_from - /* , ACE_Lock *lock = 0 */); - - // Shutdown the component: close down the request map, etc. - void shutdown (void); - //@} - - /// Main method: read the data from @a dgram and either pass ready data - /// to @a cdr_processor or update the <request_map_> if the request - /// is not yet complete. - /** - * Returns 1 if data was read successfully and accepted by - * <cdr_processor> without errors. - * Returns 0 if there were no errors, but no data has been passed to - * <cdr_processor>, either due to request being incomplete (not all - * fragments received), or it being a duplicate. - * Returns -1 if there were errors. - */ - int handle_input (ACE_SOCK_Dgram& dgram, - TAO_ECG_CDR_Processor *cdr_processor); - - /// Represents any request that has been fully received and - /// serviced, to simplify the internal logic. - static TAO_ECG_UDP_Request_Entry Request_Completed_; - -private: - - enum { - ECG_DEFAULT_MAX_FRAGMENTED_REQUESTS = 1024, - ECG_DEFAULT_FRAGMENTED_REQUESTS_MIN_PURGE_COUNT = 32 - }; - - struct Mcast_Header; - class Requests; - - typedef ACE_Hash_Map_Manager<ACE_INET_Addr, - Requests*, - ACE_Null_Mutex> Request_Map; - -private: - - /// Returns 1 on success, 0 if <request_id> has already been - /// received or is below current request range, and -1 on error. - int mark_received (const ACE_INET_Addr &from, - CORBA::ULong request_id); - - /// Returns 1 if complete request is received and <event> is - /// populated, 0 if request has only partially been received or is a - /// duplicate, and -1 on error. - int process_fragment (const ACE_INET_Addr &from, - const Mcast_Header &header, - char * data_buf, - TAO_ECG_CDR_Processor *cdr_processor); - - - Request_Map::ENTRY* get_source_entry (const ACE_INET_Addr &from); - -private: - - /// Ignore any events coming from this IP address. - TAO_ECG_Refcounted_Endpoint ignore_from_; - - /// The map containing all the incoming requests which have been - /// partially received. - Request_Map request_map_; - - /// Serializes use of <request_map_>. - // ACE_Lock* lock_; - - /// Size of a fragmented requests array, i.e., max number of - /// partially received requests kept at any given time per source. - size_t max_requests_; - - /// Minimum number of requests purged from a fragmented requests - /// array when the range of requests represented there needs to be - /// shifted. - size_t min_purge_count_; - - /// Flag to indicate whether CRC should be computed and checked. - CORBA::Boolean check_crc_; -}; - -// **************************************************************** - -/// Helper for decoding, validating and storing mcast header. -struct TAO_ECG_CDR_Message_Receiver::Mcast_Header -{ - int byte_order; - CORBA::ULong request_id; - CORBA::ULong request_size; - CORBA::ULong fragment_size; - CORBA::ULong fragment_offset; - CORBA::ULong fragment_id; - CORBA::ULong fragment_count; - CORBA::ULong crc; - int read (char * header, - size_t bytes_received, - CORBA::Boolean checkcrc = 0); -}; - -// **************************************************************** - -/// Once init() has been called: -/// Invariant: id_range_high_- id_range_low_ == size_ - 1 -class TAO_ECG_CDR_Message_Receiver::Requests -{ -public: - - Requests (void); - ~Requests (void); - - /// Allocates and initializes <fragmented_requests_>. - int init (size_t size, size_t min_purge_count); - - /// Returns pointer to a <fragmented_requests_> element - /// representing <request_id>. - /** - * If <request_id> < <id_range_low> return 0. - * If <request_id> > <id_range_high>, shift the range so it - * includes <request_id>, purging incomplete requests as needed. - */ - TAO_ECG_UDP_Request_Entry ** get_request (CORBA::ULong request_id); - -private: - - /// Delete any outstanding requests with ids in the range - /// [<purge_first>, <purge_last>] from <fragmented_requests> and - /// and reset their slots. - void purge_requests (CORBA::ULong purge_first, - CORBA::ULong purge_last); - - Requests & operator= (const Requests &rhs); - Requests (const Requests &rhs); - -private: - /// Array, used in a circular fashion, that stores partially received - /// requests (and info on which requests have been fully received - /// and processed) for a range of request ids. - TAO_ECG_UDP_Request_Entry** fragmented_requests_; - - /// Size of <fragmented_requests_> array. - size_t size_; - - /// The range of request ids, currently represented in - /// <fragmented_requests>. - //@{ - CORBA::ULong id_range_low_; - CORBA::ULong id_range_high_; - //@} - - /// Minimum range shifting amount. - size_t min_purge_count_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined(__ACE_INLINE__) -#include "orbsvcs/Event/ECG_CDR_Message_Receiver.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* TAO_ECG_CDR_MESSAGE_RECEIVER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Receiver.i b/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Receiver.i deleted file mode 100644 index 078166a6088..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Receiver.i +++ /dev/null @@ -1,51 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_ECG_CDR_Message_Receiver::Requests::Requests (void) - : fragmented_requests_ (0) - , size_ (0) - , id_range_low_ (0) - , id_range_high_ (0) - , min_purge_count_ (0) -{ -} - -// **************************************************************** - -ACE_INLINE -TAO_ECG_CDR_Message_Receiver::TAO_ECG_CDR_Message_Receiver (CORBA::Boolean crc) - : ignore_from_ () - , request_map_ () - /* , lock_ (0) */ - , max_requests_ (ECG_DEFAULT_MAX_FRAGMENTED_REQUESTS) - , min_purge_count_ (ECG_DEFAULT_FRAGMENTED_REQUESTS_MIN_PURGE_COUNT) - , check_crc_ (crc) -{ -// ACE_NEW (this->lock_, -// ACE_Lock_Adapter<ACE_Null_Mutex>); -} - -ACE_INLINE -TAO_ECG_CDR_Message_Receiver::~TAO_ECG_CDR_Message_Receiver (void) -{ - this->shutdown (); -} - -ACE_INLINE void -TAO_ECG_CDR_Message_Receiver::init (TAO_ECG_Refcounted_Endpoint ignore_from - /*, ACE_Lock *lock */) -{ - this->ignore_from_ = ignore_from; - -// if (lock) -// { -// delete this->lock_; -// this->lock_ = lock; -// } -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Sender.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Sender.cpp deleted file mode 100644 index be2af5fe269..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Sender.cpp +++ /dev/null @@ -1,340 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/ECG_CDR_Message_Sender.h" -#include "tao/CDR.h" -#include "ace/SOCK_Dgram.h" -#include "ace/INET_Addr.h" -#include "ace/ACE.h" - -#if !defined(__ACE_INLINE__) -#include "orbsvcs/Event/ECG_CDR_Message_Sender.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, ECG_CDR_Message_Sender, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -void -TAO_ECG_CDR_Message_Sender::init ( - TAO_ECG_Refcounted_Endpoint endpoint_rptr - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - if (endpoint_rptr.get () == 0 - || endpoint_rptr->dgram ().get_handle () == ACE_INVALID_HANDLE) - { - ACE_ERROR ((LM_ERROR, "TAO_ECG_CDR_Message_Sender::init(): " - "nil or unitialized endpoint argument.\n")); - ACE_THROW (CORBA::INTERNAL ()); - } - - this->endpoint_rptr_ = endpoint_rptr; -} - -void -TAO_ECG_CDR_Message_Sender::send_message (const TAO_OutputCDR &cdr, - const ACE_INET_Addr &addr - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - if (this->endpoint_rptr_.get () == 0) - { - ACE_ERROR ((LM_ERROR, "Attempt to invoke send_message() " - "on non-initialized sender object.\n")); - ACE_THROW (CORBA::INTERNAL ()); - } - - CORBA::ULong max_fragment_payload = this->mtu () - - TAO_ECG_CDR_Message_Sender::ECG_HEADER_SIZE; - // ACE_ASSERT (max_fragment_payload != 0); - -#if defined (ACE_HAS_BROKEN_DGRAM_SENDV) - const int TAO_WRITEV_MAX = ACE_IOV_MAX - 1; -#else - const int TAO_WRITEV_MAX = ACE_IOV_MAX; -#endif /* ACE_HAS_BROKEN_DGRAM_SENDV */ - iovec iov[TAO_WRITEV_MAX]; - - CORBA::ULong total_length; - CORBA::ULong fragment_count = - this->compute_fragment_count (cdr.begin (), - cdr.end (), - TAO_WRITEV_MAX, - max_fragment_payload, - total_length); - - CORBA::ULong request_id = this->endpoint_rptr_->next_request_id (); - - // Reserve the first iovec for the header... - int iovcnt = 1; - CORBA::ULong fragment_id = 0; - CORBA::ULong fragment_offset = 0; - CORBA::ULong fragment_size = 0; - for (const ACE_Message_Block* b = cdr.begin (); - b != cdr.end (); - b = b->cont ()) - { - CORBA::ULong l = b->length (); - - char* rd_ptr = b->rd_ptr (); - - iov[iovcnt].iov_base = rd_ptr; - iov[iovcnt].iov_len = l; - fragment_size += l; - ++iovcnt; - while (fragment_size > max_fragment_payload) - { - // This fragment is full, we have to send it... - - // First adjust the last iov entry: - CORBA::ULong last_mb_length = - max_fragment_payload - (fragment_size - l); - iov[iovcnt - 1].iov_len = last_mb_length; - - this->send_fragment (addr, - request_id, - total_length, - max_fragment_payload, - fragment_offset, - fragment_id, - fragment_count, - iov, - iovcnt - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - ++fragment_id; - fragment_offset += max_fragment_payload; - - // Reset, but don't forget that the last Message_Block - // may need to be sent in multiple fragments.. - l -= last_mb_length; - rd_ptr += last_mb_length; - iov[1].iov_base = rd_ptr; - iov[1].iov_len = l; - fragment_size = l; - iovcnt = 2; - } - if (fragment_size == max_fragment_payload) - { - // We filled a fragment, but this time it was filled - // exactly, the treatment is a little different from the - // loop above... - this->send_fragment (addr, - request_id, - total_length, - max_fragment_payload, - fragment_offset, - fragment_id, - fragment_count, - iov, - iovcnt - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - ++fragment_id; - fragment_offset += max_fragment_payload; - - iovcnt = 1; - fragment_size = 0; - } - if (iovcnt == TAO_WRITEV_MAX) - { - // Now we ran out of space in the iovec, we must send a - // fragment to work around that.... - this->send_fragment (addr, - request_id, - total_length, - fragment_size, - fragment_offset, - fragment_id, - fragment_count, - iov, - iovcnt - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - ++fragment_id; - fragment_offset += fragment_size; - - iovcnt = 1; - fragment_size = 0; - } - } - // There is something left in the iovvec that we must send - // also... - if (iovcnt != 1) - { - // Now we ran out of space in the iovec, we must send a - // fragment to work around that.... - this->send_fragment (addr, - request_id, - total_length, - fragment_size, - fragment_offset, - fragment_id, - fragment_count, - iov, - iovcnt - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - ++fragment_id; - fragment_offset += fragment_size; - - // reset, not needed here... - // iovcnt = 1; - // fragment_size = 0; - } - // ACE_ASSERT (total_length == fragment_offset); - // ACE_ASSERT (fragment_id == fragment_count); - -} - - -void -TAO_ECG_CDR_Message_Sender::send_fragment (const ACE_INET_Addr &addr, - CORBA::ULong request_id, - CORBA::ULong request_size, - CORBA::ULong fragment_size, - CORBA::ULong fragment_offset, - CORBA::ULong fragment_id, - CORBA::ULong fragment_count, - iovec iov[], - int iovcnt - ACE_ENV_ARG_DECL) -{ - CORBA::ULong header[TAO_ECG_CDR_Message_Sender::ECG_HEADER_SIZE - / sizeof(CORBA::ULong) - + ACE_CDR::MAX_ALIGNMENT]; - char* buf = reinterpret_cast<char*> (header); - TAO_OutputCDR cdr (buf, sizeof(header)); - cdr.write_boolean (TAO_ENCAP_BYTE_ORDER); - // Insert some known values in the padding bytes, so we can smoke - // test the message on the receiving end. - cdr.write_octet ('A'); cdr.write_octet ('B'); cdr.write_octet ('C'); - cdr.write_ulong (request_id); - cdr.write_ulong (request_size); - cdr.write_ulong (fragment_size); - cdr.write_ulong (fragment_offset); - cdr.write_ulong (fragment_id); - cdr.write_ulong (fragment_count); - CORBA::Octet padding[4]; - - - // MRH - if (checksum_) - { - // Compute CRC - iov[0].iov_base = cdr.begin ()->rd_ptr (); - iov[0].iov_len = cdr.begin ()->length (); - unsigned int crc = 0; - unsigned char *crc_parts = (unsigned char *)(&crc); - if (iovcnt > 1) - { - crc = ACE::crc32 (iov, iovcnt); - crc = htonl (crc); - } - for (int cnt=0; cnt<4; ++cnt) - { - padding[cnt] = crc_parts[cnt]; - } - } - else - { - for (int cnt=0; cnt<4; ++cnt) - { - padding[cnt] = 0; - } - } - //End MRH - cdr.write_octet_array (padding, 4); - - iov[0].iov_base = cdr.begin ()->rd_ptr (); - iov[0].iov_len = cdr.begin ()->length (); - - ssize_t n = this->dgram ().send (iov, - iovcnt, - addr); - size_t expected_n = 0; - for (int i = 0; i < iovcnt; ++i) - expected_n += iov[i].iov_len; - if (n > 0 && size_t(n) != expected_n) - { - ACE_DEBUG ((LM_ERROR, ("Sent only %d out of %d bytes " - "for mcast fragment.\n"), - n, - expected_n)); - } - - if (n == -1) - { - if (errno == EWOULDBLOCK) - { - ACE_DEBUG ((LM_ERROR, "Send of mcast fragment failed (%m).\n")); - // @@ TODO Use a Event Channel specific exception - ACE_THROW (CORBA::COMM_FAILURE ()); - } - else - { - ACE_DEBUG ((LM_WARNING, "Send of mcast fragment blocked (%m).\n")); - } - } - else if (n == 0) - { - ACE_DEBUG ((LM_WARNING, "EOF on send of mcast fragment (%m).\n")); - } -} - - -CORBA::ULong -TAO_ECG_CDR_Message_Sender::compute_fragment_count (const ACE_Message_Block* begin, - const ACE_Message_Block* end, - int iov_size, - CORBA::ULong max_fragment_payload, - CORBA::ULong& total_length) -{ - CORBA::ULong fragment_count = 0; - total_length = 0; - - CORBA::ULong fragment_size = 0; - // Reserve the first iovec for the header... - int iovcnt = 1; - for (const ACE_Message_Block* b = begin; - b != end; - b = b->cont ()) - { - CORBA::ULong l = b->length (); - total_length += l; - fragment_size += l; - ++iovcnt; - while (fragment_size > max_fragment_payload) - { - // Ran out of space, must create a fragment... - ++fragment_count; - - // The next iovector will contain what remains of this - // buffer, but also consider - iovcnt = 2; - l -= max_fragment_payload - (fragment_size - l); - fragment_size = l; - } - if (fragment_size == max_fragment_payload) - { - ++fragment_count; - iovcnt = 1; - fragment_size = 0; - } - if (iovcnt >= iov_size) - { - // Ran out of space in the iovector.... - ++fragment_count; - iovcnt = 1; - fragment_size = 0; - } - } - if (iovcnt != 1) - { - // Send the remaining data in another fragment - ++fragment_count; - } - return fragment_count; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Sender.h b/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Sender.h deleted file mode 100644 index 0f7d8b723ba..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Sender.h +++ /dev/null @@ -1,190 +0,0 @@ -// -*- C++ -*- - -/** - * @file ECG_CDR_Message_Sender.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * @author Marina Spivak (marina@atdesk.com) - */ - -#ifndef TAO_ECG_CDR_MESSAGE_SENDER_H -#define TAO_ECG_CDR_MESSAGE_SENDER_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/ECG_UDP_Out_Endpoint.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#include "tao/SystemException.h" -#include "tao/Environment.h" - -#include "ace/INET_Addr.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_ECG_CDR_Message_Sender - * - * @brief Sends CDR messages using UDP. - * NOT THREAD-SAFE. - * - * This class breaks up a CDR message into fragments and sends each - * fragment with a header (described below) using UDP. - * The UDP address can be a normal IP address or it can be a multicast - * group. The UDP address is obtained from a RtecUDPAdmin::AddrServer - * class. - * - * This class is used by various Gateway (Senders/Receivers) classes - * responsible for federating Event Channels with UDP/Mcast. - * - * <H2>MESSAGE FORMAT</H2> - * Message header are encapsulated using CDR, with the - * following format: - * struct Header { - * octet byte_order_flags; - * // bit 0 represents the byte order as in GIOP 1.1 - * // bit 1 is set if this is the last fragment - * unsigned long request_id; - * // The request ID, senders must not send two requests with - * // the same ID, senders can be distinguished using recvfrom.. - * unsigned long request_size; - * // The size of this request, this can be used to pre-allocate - * // the request buffer. - * unsgined long fragment_size; - * // The size of this fragment, excluding the header... - * unsigned long fragment_offset; - * // Where does this fragment fit in the complete message... - * unsigned long fragment_id; - * // The ID of this fragment... - * unsigned long fragment_count; - * // The total number of fragments to expect in this request - * - * // @todo This could be eliminated if efficient reassembly - * // could be implemented without it. - * octet padding[4]; - * - * // Ensures the header ends at an 8-byte boundary. - * }; // size (in CDR stream) = 32 - */ -class TAO_RTEvent_Serv_Export TAO_ECG_CDR_Message_Sender -{ -public: - - enum { - ECG_HEADER_SIZE = 32, - ECG_MIN_MTU = 32 + 8, - ECG_MAX_MTU = 65536, // Really optimistic... - ECG_DEFAULT_MTU = 1024 - }; - - /// Initialization and termination methods. - //@{ - TAO_ECG_CDR_Message_Sender (CORBA::Boolean crc = 0); - - /// Set the endpoint for sending messages. - /** - * If init () is successful, shutdown () must be called when the - * sender is no longer needed. If shutdown () is not called by the - * user, cleanup activities will be performed by the destructor. - */ - void init (TAO_ECG_Refcounted_Endpoint endpoint_rptr - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - // Shutdown this component. Frees up the endpoint. - void shutdown (ACE_ENV_SINGLE_ARG_DECL); - //@} - - /// Setters/getters. - //@{ - /// Get the local endpoint used to send the events. - int get_local_addr (ACE_INET_Addr& addr); - - /** - * The sender may need to fragment the message, otherwise the - * network may drop the packets. - * Setting the MTU can fail if the value is too small (at least the - * header + 8 bytes must fit). - */ - int mtu (CORBA::ULong mtu); - CORBA::ULong mtu (void) const; - //@} - - /// The main method - send a CDR message. - /** - * @todo Under some platforms, notably Linux, the fragmentation code - * in this method is woefully naive. The fragments are sent it a - * big burst, unfortunately, that can fill up the local kernel - * buffer before all the data is sent. In those circumstances some - * of the fragments are silently (gulp!) dropped by the kernel, - * check the documentation for sendto(2) specially the ENOBUFS - * error condition. - * There is no easy solution that I know off, except "pacing" the - * fragments, i.e. never sending more than a prescribed number of - * bytes per-second, sleeping before sending more or queueing them - * to send later via the reactor. - */ - void send_message (const TAO_OutputCDR &cdr, - const ACE_INET_Addr &addr - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - -private: - /// Return the datagram... - ACE_SOCK_Dgram& dgram (void); - - /** - * Send one fragment, the first entry in the iovec is used to send - * the header, the rest of the iovec array should contain pointers - * to the actual data. - */ - void send_fragment (const ACE_INET_Addr &addr, - CORBA::ULong request_id, - CORBA::ULong request_size, - CORBA::ULong fragment_size, - CORBA::ULong fragment_offset, - CORBA::ULong fragment_id, - CORBA::ULong fragment_count, - iovec iov[], - int iovcnt - ACE_ENV_ARG_DECL); - - /** - * Count the number of fragments that will be required to send the - * message blocks in the range [begin,end) - * The maximum fragment payload (i.e. the size without the header is - * also required); <total_length> returns the total message size. - */ - CORBA::ULong compute_fragment_count (const ACE_Message_Block* begin, - const ACE_Message_Block* end, - int iov_size, - CORBA::ULong max_fragment_payload, - CORBA::ULong& total_length); - -private: - /// The datagram used for sendto (). - TAO_ECG_Refcounted_Endpoint endpoint_rptr_; - - /// The MTU for this sender... - CORBA::ULong mtu_; - - /// Should crc checksum be caluclated and sent? - CORBA::Boolean checksum_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined(__ACE_INLINE__) -#include "orbsvcs/Event/ECG_CDR_Message_Sender.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* TAO_ECG_CDR_MESSAGE_SENDER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Sender.i b/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Sender.i deleted file mode 100644 index aa1242d07fe..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Sender.i +++ /dev/null @@ -1,56 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/Null_Mutex.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_ECG_CDR_Message_Sender::TAO_ECG_CDR_Message_Sender (CORBA::Boolean crc) - : endpoint_rptr_ () - , mtu_ (TAO_ECG_CDR_Message_Sender::ECG_DEFAULT_MTU) - , checksum_ (crc) -{ -} - -ACE_INLINE void -TAO_ECG_CDR_Message_Sender::shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) -{ - // Release the endpoint. - TAO_ECG_Refcounted_Endpoint empty_endpoint_rptr; - this->endpoint_rptr_ = empty_endpoint_rptr; -} - -ACE_INLINE ACE_SOCK_Dgram& -TAO_ECG_CDR_Message_Sender::dgram (void) -{ - ACE_ASSERT (this->endpoint_rptr_.get ()); - return this->endpoint_rptr_->dgram (); -} - -ACE_INLINE int -TAO_ECG_CDR_Message_Sender::get_local_addr (ACE_INET_Addr& addr) -{ - if (this->endpoint_rptr_.get () == 0) - return -1; - return this->dgram ().get_local_addr (addr); -} - -ACE_INLINE CORBA::ULong -TAO_ECG_CDR_Message_Sender::mtu (void) const -{ - return this->mtu_; -} - -ACE_INLINE int -TAO_ECG_CDR_Message_Sender::mtu (CORBA::ULong new_mtu) -{ - if (new_mtu < TAO_ECG_CDR_Message_Sender::ECG_MIN_MTU - || new_mtu >= TAO_ECG_CDR_Message_Sender::ECG_MAX_MTU) - return -1; - this->mtu_ = new_mtu; - return 0; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.cpp deleted file mode 100644 index 3091fb79acf..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.cpp +++ /dev/null @@ -1,170 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/ECG_Complex_Address_Server.h" -#include "ace/SString.h" -#include "ace/streams.h" - -#if !defined(__ACE_INLINE__) -#include "orbsvcs/Event/ECG_Complex_Address_Server.i" -#endif /* __ACE_INLINE__ */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_ECG_Complex_Address_Server::TAO_ECG_Complex_Address_Server ( - int is_source_mapping) - : is_source_mapping_ (is_source_mapping) -{ -} - -TAO_ECG_Complex_Address_Server::~TAO_ECG_Complex_Address_Server (void) -{ -} - -int -TAO_ECG_Complex_Address_Server::init (const char *arg) -{ - ACE_CString key_string; - ACE_CString mcast_string; - - // Our position in parsing initialization string. - const char * data = arg; - - // Parse initialization string until we reach the end. - while (*data != '\0') - { - // Extract lookup value (it is followed by '@'). - const char * location = 0; - location = ACE_OS::strchr (data, '@'); - if (!location) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to initialize address " - "server: cannot find <@> separator " - "in initialization string " - "as expected\n"), - -1); - } - size_t len = location - data; - key_string.set (data, len, 1); - data += len + 1; - - // Extract mcast address to be mapped to just extracted lookup - // value. - location = 0; - location = ACE_OS::strchr (data, ' '); - if (location) - { - len = location - data; - mcast_string.set (data, len, 1); - data += len + 1; - } - else - { - // This must be the last entry in the mapping. - len = ACE_OS::strlen (data); - mcast_string.set (data, len, 1); - data += len; - } - - // Add new entry to the mapping. - if (this->add_entry (key_string.c_str (), - mcast_string.c_str ()) == -1) - return -1; - } - return 0; -} - -int -TAO_ECG_Complex_Address_Server::add_entry (const char * key, - const char * mcast_addr) -{ - // Check whether this is the default mcast address. - if (ACE_OS::strlen (key) == 1 - && *key == '*') - { - if (this->default_addr_.set (mcast_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "Unable to initialize: invalid " - "mcast address specified: %s.\n", - mcast_addr), - -1); - return 0; - } - - // Convert strings to values. - char * endptr = 0; - CORBA::Long header_value = ACE_OS::strtol (key, &endptr, 0); - if (*endptr != '\0') - { - ACE_ERROR_RETURN ((LM_ERROR, "Unable to initialize: invalid " - "source/type specified: %s.\n", - key), - -1); - } - - ACE_INET_Addr addr; - if (addr.set (mcast_addr) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, "Unable to initialize: invalid " - "mcast address specified: %s.\n", - mcast_addr), - -1); - } - - if (this->mcast_mapping_.bind (header_value, addr) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, "Unable to initialize: error adding " - "new entry to the mapping.\n"), - -1); - } - - return 0; -} - - -void -TAO_ECG_Complex_Address_Server::get_addr ( - const RtecEventComm::EventHeader& header, - RtecUDPAdmin::UDP_Addr_out addr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - CORBA::Long key; - if (this->is_source_mapping_) - key = header.source; - else - key = header.type; - - MAP::ENTRY * mapping_entry = 0; - if (this->mcast_mapping_.find (key, mapping_entry) == -1) - { - // Key was not found in the mapping. Use default. - addr.ipaddr = this->default_addr_.get_ip_address (); - addr.port = this->default_addr_.get_port_number (); - } - else - { - addr.ipaddr = mapping_entry->int_id_.get_ip_address (); - addr.port = mapping_entry->int_id_.get_port_number (); - } -} - -void -TAO_ECG_Complex_Address_Server::dump_content (void) -{ - ACE_DEBUG ((LM_DEBUG, "Default address: %s:%d\n", - this->default_addr_.get_host_addr (), - this->default_addr_.get_port_number ())); - - for (MAP::iterator iter = this->mcast_mapping_.begin (); - iter != this->mcast_mapping_.end (); - iter++) - { - MAP::ENTRY & entry = *iter; - ACE_DEBUG ((LM_DEBUG, "%d --> %s:%d\n", - entry.ext_id_, - this->default_addr_.get_host_addr (), - this->default_addr_.get_port_number ())); - } -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.h b/TAO/orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.h deleted file mode 100644 index bbe55390465..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.h +++ /dev/null @@ -1,118 +0,0 @@ -// -*- C++ -*- - -/** - * @file ECG_Complex_Address_Server.h - * - * $Id$ - * - * @author Marina Spivak (marina@atdesk.com) - * - */ - -#ifndef TAO_ECG_COMPLEX_ADDRESS_SERVER_H -#define TAO_ECG_COMPLEX_ADDRESS_SERVER_H - -#include /**/ "ace/pre.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#include "orbsvcs/RtecUDPAdminS.h" -#include "ace/Hash_Map_Manager_T.h" -#include "ace/INET_Addr.h" -#include "ace/Null_Mutex.h" - -#include "orbsvcs/Event/EC_Lifetime_Utils_T.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_ECG_Complex_Address_Server - * - * @brief Implementation of RtecUDPAdmin idl interface, which returns - * a different multicast address based on event source (or event type - * - depending on how the server is configured). - * - * INITIALIZATION STRING FORMAT - * - * The string is a sequence of <key>@<value> pairs separated by - * a single space, where <key> is event source (or type) - * and <value> is the corresponding mcast address. Example: - * "34@230.100.0.2:2300 45@230.100.123.43:2300" - * The string above represents two key-value pairs. - * - * A special key "*" is used to specify the default mcast address, - * i.e., the one that will be returned for event sources that weren't - * explicitly specified in the initialization string. Example: - * "*@230.100.0.2:2300 45@230.100.123.43:2300" - * - */ -class TAO_RTEvent_Serv_Export TAO_ECG_Complex_Address_Server : - public virtual POA_RtecUDPAdmin::AddrServer -{ -public: - - /// Create a new TAO_ECG_Complex_Address_Server object. - /* - * (Constructor access is restricted to insure that all - * TAO_ECG_Complex_Address_Server objects are heap-allocated.) - * <is_source_mapping> flag indicates whether this - * server maps based on event header source or event header type. - */ - static TAO_EC_Servant_Var<TAO_ECG_Complex_Address_Server> - create (int is_source_mapping = 1); - - /// Destructor - virtual ~TAO_ECG_Complex_Address_Server (void); - - /// Initializes the mapping from the <arg> string. See class notes - /// for the expected format. - int init (const char *arg); - - // = The RtecUDPAdmin::AddrServer methods - virtual void get_addr (const RtecEventComm::EventHeader& header, - RtecUDPAdmin::UDP_Addr_out addr - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Prints out complete content of the address server. Useful for - /// debugging. - void dump_content (void); - -protected: - - /// Constructor (protected). Clients can create new - /// TAO_ECG_Complex_Address_Server objects using the static create() - /// method. - /// <is_source_mapping> flag indicates whether this - /// server maps based on event header source or event header type. - TAO_ECG_Complex_Address_Server (int is_source_mapping = 1); - -private: - - /// Helper. Given key and mcast address in string form, add them to - /// the mapping. - int add_entry (const char * key, const char * mcast_addr); - - /// Flag indicating whether this address server maps event source or - /// event type to mcast groups. - int is_source_mapping_; - - typedef ACE_Hash_Map_Manager_Ex<CORBA::Long, ACE_INET_Addr, - ACE_Hash<CORBA::Long>, ACE_Equal_To<CORBA::Long>, ACE_Null_Mutex> MAP; - - MAP mcast_mapping_; - - /// Mcast group to be used for all sources (or types) not explicitly - /// mapped. - ACE_INET_Addr default_addr_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined(__ACE_INLINE__) -#include "orbsvcs/Event/ECG_Complex_Address_Server.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* TAO_ECG_COMPLEX_ADDRESS_SERVER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.i b/TAO/orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.i deleted file mode 100644 index b47e2db3e68..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.i +++ /dev/null @@ -1,17 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE TAO_EC_Servant_Var<TAO_ECG_Complex_Address_Server> -TAO_ECG_Complex_Address_Server::create (int is_source_mapping) -{ - TAO_EC_Servant_Var<TAO_ECG_Complex_Address_Server> s; - ACE_NEW_RETURN (s, - TAO_ECG_Complex_Address_Server (is_source_mapping), - s); - return s; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_ConsumerEC_Control.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_ConsumerEC_Control.cpp deleted file mode 100644 index b5b65cc294b..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_ConsumerEC_Control.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/ECG_ConsumerEC_Control.h" - -ACE_RCSID(Event, ECG_ConsumerEventChannelControl, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_ECG_ConsumerEC_Control::TAO_ECG_ConsumerEC_Control (void) -{ -} - -TAO_ECG_ConsumerEC_Control::~TAO_ECG_ConsumerEC_Control (void) -{ -} - -int -TAO_ECG_ConsumerEC_Control::activate (void) -{ - return 0; -} - -int -TAO_ECG_ConsumerEC_Control::shutdown (void) -{ - return 0; -} - -void -TAO_ECG_ConsumerEC_Control::event_channel_not_exist (TAO_EC_Gateway_IIOP * - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_ECG_ConsumerEC_Control::system_exception (TAO_EC_Gateway_IIOP *, - CORBA::SystemException & - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_ConsumerEC_Control.h b/TAO/orbsvcs/orbsvcs/Event/ECG_ConsumerEC_Control.h deleted file mode 100644 index a8141829787..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_ConsumerEC_Control.h +++ /dev/null @@ -1,83 +0,0 @@ -// -*- C++ -*- - -/** - * @file ECG_ConsumerEC_Control.h - * - * $Id$ - * - * @author Johnny Willemsen (jwillemsen@remedy.nl) - * - */ - -#ifndef TAO_ECG_ConsumerEC_Control_H -#define TAO_ECG_ConsumerEC_Control_H - -#include /**/ "ace/pre.h" -#include "ace/CORBA_macros.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/Basic_Types.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Gateway_IIOP; -class TAO_EC_ProxyPushSupplier; - -namespace CORBA -{ - class Environment; - class SystemException; -} - -/** - * @class TAO_ECG_ConsumerEC_Control - * - * @brief EventChannelControl - * - * Defines the interface for the consumer event channel control strategy. - * This strategy handles misbehaving or failing event channels that are consumer - * of a gateway. - */ -class TAO_RTEvent_Serv_Export TAO_ECG_ConsumerEC_Control -{ -public: - /// Constructor. - TAO_ECG_ConsumerEC_Control (void); - - /// Destructor. - virtual ~TAO_ECG_ConsumerEC_Control (void); - - /// Activate any internal threads or timers used to poll the state of - /// the event channel. - virtual int activate (void); - - /// Shutdown any internal threads or timers used to poll the state of - /// the event channel. - virtual int shutdown (void); - - /** - * When pushing an event to the event channel a CORBA::OBJECT_NOT_EXIST - * exception was raised. The only interpretation is that the object - * has been destroyed. The strategy has to (at the very least), - * reclaim all the resources attached to that object. - */ - virtual void event_channel_not_exist (TAO_EC_Gateway_IIOP * gateway - ACE_ENV_ARG_DECL_NOT_USED); - - /// Some system exception was raised while trying to contact the - /// event channel - virtual void system_exception (TAO_EC_Gateway_IIOP * gateway, - CORBA::SystemException & - ACE_ENV_ARG_DECL_NOT_USED); -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* TAO_ECG_ConsumerEC_Control_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Defaults.h b/TAO/orbsvcs/orbsvcs/Event/ECG_Defaults.h deleted file mode 100644 index 77dd5a28dae..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Defaults.h +++ /dev/null @@ -1,79 +0,0 @@ -// -*- C++ -*- - -/** - * @file ECG_Defaults.h - * - * $Id$ - * - * In this file we set the compile time defaults for the event - * channel multicast gateway. - * - * @author Marina Spivak (marina@atdesk.com) - */ - -#ifndef TAO_ECG_DEFAULTS_H -#define TAO_ECG_DEFAULTS_H -#include /**/ "ace/pre.h" - -// Any of the definitions below can be overriden in the config.h file -// or the compilation line. - -#ifndef TAO_ECG_DEFAULT_SERVICE -# define TAO_ECG_DEFAULT_SERVICE ECG_MCAST_TWO_WAY -#endif /* TAO_ECG_DEFAULT_SERVICE */ - -#ifndef TAO_ECG_DEFAULT_HANDLER -# define TAO_ECG_DEFAULT_HANDLER ECG_HANDLER_BASIC -#endif /* TAO_ECG_DEFAULT_HANDLER */ - -#ifndef TAO_ECG_DEFAULT_ADDRESS_SERVER -# define TAO_ECG_DEFAULT_ADDRESS_SERVER ECG_ADDRESS_SERVER_BASIC -#endif /* TAO_ECG_DEFAULT_ADDRESS_SERVER */ - -/* must be provided by the user */ -#ifndef TAO_ECG_DEFAULT_ADDRESS_SERVER_ARG -# define TAO_ECG_DEFAULT_ADDRESS_SERVER_ARG 0 -#endif /* TAO_ECG_DEFAULT_ADDRESS_SERVER_ARG */ - -#ifndef TAO_ECG_DEFAULT_TTL -# define TAO_ECG_DEFAULT_TTL 0 /* don't set, use default */ -#endif /* TAO_ECG_DEFAULT_TTL */ - -#ifndef TAO_ECG_DEFAULT_NIC -# define TAO_ECG_DEFAULT_NIC 0 /* use default */ -#endif /* TAO_ECG_DEFAULT_NIC */ - -#ifndef TAO_ECG_DEFAULT_IP_MULTICAST_LOOP -# define TAO_ECG_DEFAULT_IP_MULTICAST_LOOP 1 /* loopback mcast messages */ -#endif /* TAO_ECG_DEFAULT_IP_MULTICAST_LOOP */ - -#ifndef TAO_ECG_DEFAULT_NON_BLOCKING -# define TAO_ECG_DEFAULT_NON_BLOCKING 1 /* write sockets are non-blocking */ -#endif /* TAO_ECG_DEFAULT_NON_BLOCKING */ - -#ifndef TAO_ECG_DEFAULT_IIOP_CONSUMEREC_CONTROL -# define TAO_ECG_DEFAULT_IIOP_CONSUMEREC_CONTROL 0 /* null */ -#endif /* TAO_ECG_DEFAULT_IIOP_CONSUMEREC_CONTROL */ - -#ifndef TAO_ECG_DEFAULT_IIOP_CONSUMEREC_CONTROL_PERIOD -# define TAO_ECG_DEFAULT_IIOP_CONSUMEREC_CONTROL_PERIOD 5000000 /* usecs */ -#endif /* TAO_ECG_DEFAULT_IIOP_CONSUMEREC_CONTROL_PERIOD */ - -#ifndef TAO_ECG_DEFAULT_IIOP_CONSUMEREC_CONTROL_TIMEOUT -# define TAO_ECG_DEFAULT_IIOP_CONSUMEREC_CONTROL_TIMEOUT 10000 /* usecs */ -#endif /* TAO_ECG_DEFAULT_IIOP_CONSUMEREC_CONTROL_TIMEOUT */ - -#ifndef TAO_ECG_DEFAULT_IIOP_ORB_ID -# define TAO_ECG_DEFAULT_IIOP_ORB_ID "" /* */ -#endif /* TAO_ECG_DEFAULT_IIOP_ORB_ID */ - -#ifndef TAO_ECG_DEFAULT_IIOP_USE_TTL -# define TAO_ECG_DEFAULT_IIOP_USE_TTL 1 /* use TTL */ -#endif /* TAO_ECG_DEFAULT_IIOP_USE_TTL */ - -#ifndef TAO_ECG_DEFAULT_IIOP_USE_CONSUMER_PROXY_MAP -# define TAO_ECG_DEFAULT_IIOP_USE_CONSUMER_PROXY_MAP 1 /* use consumer proxy map */ -#endif /* TAO_ECG_DEFAULT_IIOP_USE_CONSUMER_PROXY_MAP */ - -#include /**/ "ace/post.h" -#endif /* TAO_ECG_DEFAULTS_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_EH.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_EH.cpp deleted file mode 100644 index e72dafca760..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_EH.cpp +++ /dev/null @@ -1,303 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/ECG_Mcast_EH.h" -#include "orbsvcs/Event/ECG_UDP_Receiver.h" -#include "orbsvcs/Event_Service_Constants.h" -#include "orbsvcs/Event/EC_Lifetime_Utils_T.h" -#include "ace/Unbounded_Set.h" -#include "ace/OS_NS_string.h" -#include "ace/Reactor.h" -#include "ace/os_include/os_fcntl.h" - -#if !defined(__ACE_INLINE__) -#include "orbsvcs/Event/ECG_Mcast_EH.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, ECG_Mcast_EH, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_ECG_Mcast_EH::TAO_ECG_Mcast_EH (TAO_ECG_Dgram_Handler *recv, - const ACE_TCHAR *net_if, - CORBA::ULong sz) - : net_if_ (net_if ? ACE_OS::strdup (net_if) : 0) - , subscriptions_ () - , receiver_ (recv) - , recvbuf_size_ (sz) - , observer_ () - , auto_observer_disconnect_ () -{ - ACE_ASSERT (this->receiver_); -} - -TAO_ECG_Mcast_EH::~TAO_ECG_Mcast_EH (void) -{ - ACE_OS::free (this->net_if_); -} - -void -TAO_ECG_Mcast_EH::open (RtecEventChannelAdmin::EventChannel_ptr ec - ACE_ENV_ARG_DECL) -{ - if (!this->receiver_) - { - // We are shut down. - ACE_THROW (CORBA::INTERNAL()); - } - - if (CORBA::is_nil (ec)) - { - ACE_ERROR ((LM_ERROR, "TAO_ECG_Mcast_EH::open(): " - "nil ec argument")); - ACE_THROW (CORBA::INTERNAL ()); - } - - // Create and activate Event Channel Observer. - ACE_NEW (this->observer_, - Observer (this)); - - if (!this->observer_.in ()) - { - ACE_THROW (CORBA::NO_MEMORY ()); - } - - TAO_EC_Object_Deactivator observer_deactivator; - RtecEventChannelAdmin::Observer_var observer_ref; - PortableServer::POA_var poa = - this->observer_->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - activate (observer_ref, - poa.in (), - this->observer_.in (), - observer_deactivator - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - RtecEventChannelAdmin::Observer_Handle handle = - ec->append_observer (observer_ref.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->observer_->set_deactivator (observer_deactivator); - this->auto_observer_disconnect_.set_command - (Observer_Disconnect_Command (handle, ec)); -} - -int -TAO_ECG_Mcast_EH::shutdown (void) -{ - // Already shut down. - if (!this->receiver_) - return -1; - - // Disconnect Observer from EC. - this->auto_observer_disconnect_.execute (); - - // Shutdown the observer. - if (this->observer_.in ()) - { - this->observer_->shutdown (); - this->observer_ = 0; - } - - // Indicates that we are in a shutdown state. - this->receiver_ = 0; - - // Deregister from reactor, close and clean up sockets. - size_t subscriptions_size = this->subscriptions_.size (); - for (size_t i = 0; i != subscriptions_size; ++i) - { - (void) this->reactor ()->remove_handler ( - this->subscriptions_[i].dgram->get_handle (), - ACE_Event_Handler::READ_MASK); - (void) this->subscriptions_[i].dgram->close(); - delete this->subscriptions_[i].dgram; - } - this->subscriptions_.size (0); - - return 0; -} - -int -TAO_ECG_Mcast_EH::handle_input (ACE_HANDLE fd) -{ - size_t subscriptions_size = this->subscriptions_.size (); - for (size_t i = 0; i != subscriptions_size; ++i) - { - ACE_SOCK_Dgram_Mcast *socket = this->subscriptions_[i].dgram; - if (socket->get_handle () == fd) - { - return this->receiver_->handle_input (*socket); - } - } - return -1; -} - -void -TAO_ECG_Mcast_EH::update_consumer ( - const RtecEventChannelAdmin::ConsumerQOS& sub - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - Address_Set multicast_addresses; - - this->compute_required_subscriptions (sub, - multicast_addresses - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->delete_unwanted_subscriptions (multicast_addresses); - - this->add_new_subscriptions (multicast_addresses); -} - -void -TAO_ECG_Mcast_EH::compute_required_subscriptions ( - const RtecEventChannelAdmin::ConsumerQOS& sub, - Address_Set& multicast_addresses - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - CORBA::ULong count = sub.dependencies.length (); - for (CORBA::ULong i = 0; i != count; ++i) - { - const RtecEventComm::EventHeader& header = - sub.dependencies[i].event.header; - if (0 < header.type && header.type < ACE_ES_EVENT_UNDEFINED) - { - continue; - } - RtecUDPAdmin::UDP_Addr addr; - - this->receiver_->get_addr (header, addr ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - ACE_INET_Addr inet_addr (addr.port, addr.ipaddr); - // Ignore errors, if the element is in the set we simply ignore - // the problem... - (void) multicast_addresses.insert (inet_addr); - } -} - -int -TAO_ECG_Mcast_EH::delete_unwanted_subscriptions ( - Address_Set& multicast_addresses) -{ - for (size_t i = 0; i < this->subscriptions_.size (); ++i) - { - ACE_INET_Addr multicast_group = this->subscriptions_[i].mcast_addr; - if (multicast_addresses.find (multicast_group)) - { - // Remove from the list of subscriptions to be added, - // because we already subscribe to it... - (void) multicast_addresses.remove (multicast_group); - continue; - } - - // This subscription is no longer needed - remove from reactor, - // close and delete the socket. - ACE_SOCK_Dgram_Mcast *socket = this->subscriptions_[i].dgram; - (void) this->reactor ()->remove_handler (socket->get_handle (), - ACE_Event_Handler::READ_MASK); - (void) socket->close(); - delete socket; - // Move the deleted subscription out of the <subscriptions_> - // array by moving the last subscription in array into its place. - this->subscriptions_[i] = - this->subscriptions_[this->subscriptions_.size () - 1]; - this->subscriptions_.size (this->subscriptions_.size () - 1); - --i; - } - - return 0; -} - -void -TAO_ECG_Mcast_EH::add_new_subscriptions (Address_Set& multicast_addresses) -{ - typedef ACE_Unbounded_Set_Iterator<ACE_INET_Addr> Address_Iterator; - for (Address_Iterator k = multicast_addresses.begin (); - k != multicast_addresses.end (); - ++k) - { - Subscription new_subscription; - new_subscription.mcast_addr = *k; - ACE_NEW (new_subscription.dgram, ACE_SOCK_Dgram_Mcast); - - size_t subscriptions_size = this->subscriptions_.size (); - this->subscriptions_.size (subscriptions_size + 1); - this->subscriptions_[subscriptions_size] = new_subscription; - - ACE_SOCK_Dgram_Mcast *socket = new_subscription.dgram; - - if (socket->open (new_subscription.mcast_addr, this->net_if_, 1) == -1) { - ACE_ERROR ((LM_ERROR, - "Error: %d - Unable to open multicast socket\n", - errno )); - } - - if ( socket->enable (ACE_NONBLOCK) != 0 ) { - ACE_ERROR ((LM_ERROR, - "Error: %d - Unable to enable nonblocking on mcast_eh\n", - errno )); - } - - if (socket->join (new_subscription.mcast_addr, 1, this->net_if_) == -1) { - ACE_ERROR ((LM_ERROR, - "Error: %d - Unable to join multicast group\n", - errno )); - } - - if (this->recvbuf_size_ != 0 - && (((ACE_SOCK_Dgram *)socket)->set_option(SOL_SOCKET, - SO_RCVBUF, - (void *) &this->recvbuf_size_, - sizeof (this->recvbuf_size_)) == -1) - && errno != ENOTSUP ) - { - ACE_ERROR ((LM_ERROR, - "Error: %d - Unable to set mcast_eh recvbuf_size:%d\n", - errno, - this->recvbuf_size_)); - } - (void) this->reactor ()->register_handler ( - socket->get_handle (), - this, - ACE_Event_Handler::READ_MASK); - } -} - -// **************************************************************** - -TAO_ECG_Mcast_EH::Observer::Observer (TAO_ECG_Mcast_EH* eh) - : eh_ (eh) -{ -} - -void -TAO_ECG_Mcast_EH::Observer::update_consumer ( - const RtecEventChannelAdmin::ConsumerQOS& sub - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - if (this->eh_) - this->eh_->update_consumer (sub ACE_ENV_ARG_PARAMETER); -} - -void -TAO_ECG_Mcast_EH::Observer::update_supplier ( - const RtecEventChannelAdmin::SupplierQOS& - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void -TAO_ECG_Mcast_EH::Observer::shutdown (void) -{ - this->eh_ = 0; - this->deactivator_.deactivate (); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_EH.h b/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_EH.h deleted file mode 100644 index 6808a8bbd0d..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_EH.h +++ /dev/null @@ -1,294 +0,0 @@ -// -*- C++ -*- - -/** - * @file ECG_Mcast_EH.h - * - * $Id$ - * - * @author Carlos O'Ryan <coryan@uci.edu> - * @author Jaiganesh Balasubramanian <jai@doc.ece.uci.edu> - * @author Marina Spivak <marina@atdesk.com> - * @author Don Hinton <dhinton@ieee.org> - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - * - */ -#ifndef TAO_ECG_MCAST_EH_H -#define TAO_ECG_MCAST_EH_H - -#include /**/ "ace/pre.h" -#include "ace/Event_Handler.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Unbounded_Set.h" -#include "ace/Array_Base.h" -#include "ace/SOCK_Dgram_Mcast.h" - -#include "orbsvcs/RtecEventChannelAdminS.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" -#include "orbsvcs/Event/ECG_Adapters.h" -#include "orbsvcs/Event/EC_Lifetime_Utils.h" -#include "orbsvcs/Event/EC_Lifetime_Utils_T.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_ECG_Mcast_EH - * - * @brief Event Handler for Mcast messages. - * NOT THREAD-SAFE. - * - * This object acts as an Observer to Event Channel. It subscribes to - * multicast groups that carry events matching the EC's subscriptions. - * This object then receives callbacks from the Reactor when data is - * available on the mcast sockets and alerts TAO_ECG_Dgram_Handler, - * which reads the data, transforms it into event and pushes to the - * Event Channel. - */ -class TAO_RTEvent_Serv_Export TAO_ECG_Mcast_EH : - public ACE_Event_Handler, - public TAO_ECG_Handler_Shutdown -{ -public: - - /// Initialization and termination methods. - //@{ - /** - * Constructor. Messages received by this EH will be forwarded to - * the \a recv. \a net_if can be used to specify NIC where multicast - * messages are expected. \buf_sz would be used to alter the default - * buffer size. - * - * See comments for receiver_ data member on why raw pointer is - * used for the \a recv argument. - */ - TAO_ECG_Mcast_EH (TAO_ECG_Dgram_Handler *recv, - const ACE_TCHAR *net_if = 0, - CORBA::ULong buf_sz = 0); - - /// Destructor. - virtual ~TAO_ECG_Mcast_EH (void); - - /** - * Register for changes in the EC subscription list. - * When the subscription list becomes non-empty we join the proper - * multicast groups (using Dgram_Handler to translate between event - * types and mcast groups) and the class registers itself with the - * reactor. - * - * To insure proper resource clean up, if open () is successful, - * the user MUST call shutdown () when handler is no longer needed - * (and its reactor still exists). - */ - void open (RtecEventChannelAdmin::EventChannel_ptr ec - ACE_ENV_ARG_DECL_WITH_DEFAULTS); - - /// TAO_ECG_Handler_Shutdown method. - /** - * Remove ourselves from the event channel, unsubscribe from the - * multicast groups, close the sockets and deregister from the - * reactor. - */ - virtual int shutdown (void); - //@} - - /// Reactor callback. Notify receiver_ that a dgram corresponding - /// to \a fd is ready for reading. - virtual int handle_input (ACE_HANDLE fd); - -private: - - /** - * @class Observer - * - * @brief Observes changes in the EC consumer subscriptions and notifies - * TAO_ECG_Mcast_EH when there are changes. - */ - class Observer : - public virtual POA_RtecEventChannelAdmin::Observer, - public TAO_EC_Deactivated_Object - { - public: - /// Constructor. Changes in the EC subscriptions will be reported - /// to the \a eh. - Observer (TAO_ECG_Mcast_EH* eh); - - /// Shut down the observer: disconnect from EC and deactivate from - /// POA. - void shutdown (void); - - /// Event Channel Observer methods - //@{ - virtual void update_consumer ( - const RtecEventChannelAdmin::ConsumerQOS& sub - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - virtual void update_supplier ( - const RtecEventChannelAdmin::SupplierQOS& pub - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - private: - /// Handler we notify of subscriptions changes. - /* - * Observer can keep a raw pointer to mcast handler, because the handler - * guarantees to notify the observer (by calling shutdown ()) - * before going away. - */ - TAO_ECG_Mcast_EH *eh_; - }; - - /// Make update_consumer () accessible to Observer. - friend class Observer; - - /// The Observer method. Subscribe/unsubscribe to multicast groups - /// according to changes in consumer subscriptions. - void update_consumer (const RtecEventChannelAdmin::ConsumerQOS& sub - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - - typedef ACE_Unbounded_Set<ACE_INET_Addr> Address_Set; - - /// Helpers for updating multicast subscriptions based on changes in - /// consumer subscriptions. - //@{ - /// Compute the list of multicast addresses that we need to be - /// subscribed to, in order to receive the events described in the - /// ConsumerQOS parameter. - /** - * @param sub The list of event types that our event channel - * consumers are interested in. - * @param multicast_addresses This method populates this list with - * multicast addresses that we need to be subscribed to in - * order to receive event types specified in /a sub. - * - * @throw CORBA::SystemException This method needs to perform - * several CORBA invocations, and it propagates any exceptions - * back to the caller. - */ - void compute_required_subscriptions ( - const RtecEventChannelAdmin::ConsumerQOS& sub, - Address_Set& multicast_addresses - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Unsubscribe from any multicast addresses we are currently - /// subscribed to that are not in the \a multicast_addresses list. - /// Also remove from /a multicast_addresses any addresses to which we are - /// already subscribed. - /** - * @param multicast_addresses List of multicast - * addresses we need to be subscribed to in order receive all - * event types in the current consumer subscriptions. - */ - int delete_unwanted_subscriptions ( - Address_Set& multicast_addresses); - - /// Subscribe to all multicast addresses in /a multicast_addresses - - /// we are not subscribed to them yet, but need to be. - /** - * @param multicast_addresses List of multicast addresses to which - * we need to subscribe to in order to be receiving all event - * types in the current consumer subscriptions. - */ - void add_new_subscriptions ( - Address_Set& multicast_addresses); - //@} - - /** - * @class Observer_Disconnect_Command - * - * @brief Disconnects Observer from the Event Channel - * - * Utility class for use as a template argument to TAO_EC_Auto_Command. - * TAO_EC_Auto_Command<Observer_Disconnect_Command> manages - * observer connection to the Event Channel, automatically - * disconnecting from ec in its destructor, if necessary. - */ - class TAO_RTEvent_Serv_Export Observer_Disconnect_Command - { - public: - Observer_Disconnect_Command (void); - Observer_Disconnect_Command (RtecEventChannelAdmin::Observer_Handle handle, - RtecEventChannelAdmin::EventChannel_ptr ec); - - Observer_Disconnect_Command (const Observer_Disconnect_Command &rhs); - Observer_Disconnect_Command & operator= (const Observer_Disconnect_Command & rhs); - - void execute (ACE_ENV_SINGLE_ARG_DECL); - - private: - - RtecEventChannelAdmin::Observer_Handle handle_; - RtecEventChannelAdmin::EventChannel_var ec_; - }; - -private: - /// The NIC used to subscribe for multicast traffic. - ACE_TCHAR *net_if_; - - typedef struct { - ACE_INET_Addr mcast_addr; - ACE_SOCK_Dgram_Mcast* dgram; - } Subscription; - typedef ACE_Array_Base<Subscription> Subscriptions; - - /// List of multicast addresses we subscribe to and dgrams we use. - /* - * We use a dedicated socket for each multicast subscription. The - * reason: we assume the underlying software, i.e., ACE, binds each - * socket used to receive multicast to the multicast group (mcast addr - * + port) to avoid receiving promiscuous traffic, in which case it is - * not possible to subscribe to more than one mcast address on the same - * socket. - * - * Performance. We use array to store subscriptions (mcast addr / dgram - * pairs). If performance is not adequate, we should look into - * using a hash map, keyed on file descriptors, instead. When there - * are many subscriptions, handle_input() is likely to be more - * efficient with a hash lookup than an array iteration for locating a - * target dgram. Difference in costs of subscripton changes between - * hash map and array would need to be looked at as well, although - * it is probably highly dependent on the pattern of changes. - */ - Subscriptions subscriptions_; - - /// We callback to this object when a message arrives. - /* - * We can keep a raw pointer to the receiver (even though it may - * be a refcounted object) because receiver guarantees - * to notify us (by calling shutdown ()) before going away. - * - * We have to use raw pointer instead of a refcounting mechanism - * here to avoid a circular refcounting dependency between - * receiver and handler. - */ - TAO_ECG_Dgram_Handler * receiver_; - - /// SOCKbuf size - CORBA::ULong recvbuf_size_; - - /// Event Channel Observer. Detects changes in EC consumer subscriptions. - /// ORDER DEPENDENCY: this member should be declared before - /// <auto_observer_disconnect_>. - TAO_EC_Servant_Var<Observer> observer_; - - /// Manages connection of our observer to the Event Channel. - /// ORDER DEPENDENCY: this member should be declared AFTER <observer_>. - TAO_EC_Auto_Command<Observer_Disconnect_Command> auto_observer_disconnect_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined(__ACE_INLINE__) -#include "orbsvcs/Event/ECG_Mcast_EH.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* TAO_ECG_Mcast_EH_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_EH.i b/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_EH.i deleted file mode 100644 index 587c2721944..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_EH.i +++ /dev/null @@ -1,63 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_ECG_Mcast_EH:: -Observer_Disconnect_Command::Observer_Disconnect_Command (void) - : handle_ () - , ec_ () -{ -} - -ACE_INLINE -TAO_ECG_Mcast_EH:: -Observer_Disconnect_Command::Observer_Disconnect_Command ( - RtecEventChannelAdmin::Observer_Handle handle, - RtecEventChannelAdmin::EventChannel_ptr ec) - : handle_ (handle) - , ec_ (RtecEventChannelAdmin::EventChannel::_duplicate (ec)) -{ -} - -ACE_INLINE -TAO_ECG_Mcast_EH:: -Observer_Disconnect_Command::Observer_Disconnect_Command ( - const Observer_Disconnect_Command & rhs) - : handle_ (rhs.handle_) - , ec_ (RtecEventChannelAdmin::EventChannel::_duplicate (rhs.ec_.in())) -{ -} - -ACE_INLINE -TAO_ECG_Mcast_EH::Observer_Disconnect_Command & -TAO_ECG_Mcast_EH:: -Observer_Disconnect_Command::operator= ( - const Observer_Disconnect_Command & rhs) -{ - this->handle_ = rhs.handle_; - this->ec_ = RtecEventChannelAdmin::EventChannel::_duplicate (rhs.ec_.in()); - - return *this; -} - -ACE_INLINE void -TAO_ECG_Mcast_EH:: -Observer_Disconnect_Command::execute (ACE_ENV_SINGLE_ARG_DECL) -{ - if (CORBA::is_nil (this->ec_.in ())) - // We are not connected. - return; - - RtecEventChannelAdmin::EventChannel_var release_ec = - this->ec_._retn (); - - release_ec->remove_observer (this->handle_ ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -//*************************************************************************** - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_Gateway.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_Gateway.cpp deleted file mode 100644 index 723466ea888..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_Gateway.cpp +++ /dev/null @@ -1,705 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/ECG_Mcast_Gateway.h" - -#include "orbsvcs/Event/EC_Lifetime_Utils_T.h" -#include "orbsvcs/Event/ECG_Simple_Address_Server.h" -#include "orbsvcs/Event/ECG_Complex_Address_Server.h" -#include "orbsvcs/Event/ECG_Simple_Mcast_EH.h" -#include "orbsvcs/Event/ECG_Mcast_EH.h" -#include "orbsvcs/Event/ECG_UDP_EH.h" - -#include "orbsvcs/Event_Utilities.h" - -#include "ace/Dynamic_Service.h" -#include "ace/Arg_Shifter.h" -#include "tao/ORB_Core.h" -#include "ace/OS_NS_strings.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/ECG_Mcast_Gateway.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, ECG_Mcast_Gateway, "$Id$") - - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -typedef TAO_EC_Shutdown_Command<TAO_EC_Servant_Var<TAO_ECG_UDP_Sender> > -UDP_Sender_Shutdown; - -typedef TAO_EC_Shutdown_Command<TAO_EC_Servant_Var<TAO_ECG_UDP_Receiver> > -UDP_Receiver_Shutdown; - - -int -TAO_ECG_Mcast_Gateway::init_svcs (void) -{ - return ACE_Service_Config::static_svcs ()-> - insert (&ace_svc_desc_TAO_ECG_Mcast_Gateway); -} - - -int -TAO_ECG_Mcast_Gateway::fini (void) -{ - return 0; -} - -int -TAO_ECG_Mcast_Gateway::init (int argc, ACE_TCHAR* argv[]) -{ - int result = 0; - - ACE_Arg_Shifter arg_shifter (argc, argv); - - while (arg_shifter.is_anything_left ()) - { - const ACE_TCHAR *arg = arg_shifter.get_current (); - - if (ACE_OS::strcasecmp (arg, ACE_TEXT ("-ECGService")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT ("receiver")) == 0) - this->service_type_ = ECG_MCAST_RECEIVER; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT ("sender")) == 0) - this->service_type_ = ECG_MCAST_SENDER; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT ("two_way")) == 0) - this->service_type_ = ECG_MCAST_TWO_WAY; - else - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Unsupported <-ECGService> option ") - ACE_TEXT ("value: <%s>. Ignoring this option ") - ACE_TEXT ("- using defaults instead.\n"), - opt)); - result = -1; - } - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT ("-ECGAddressServer")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT ("basic")) == 0) - this->address_server_type_ = ECG_ADDRESS_SERVER_BASIC; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT ("source")) == 0) - this->address_server_type_ = ECG_ADDRESS_SERVER_SOURCE; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT ("type")) == 0) - this->address_server_type_ = ECG_ADDRESS_SERVER_TYPE; - else - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Unsupported <-ECGAddressServer> ") - ACE_TEXT ("option value: <%s>. Ignoring this ") - ACE_TEXT ("option - using defaults instead.\n"), - opt)); - result = -1; - } - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT ("-ECGAddressServerArg")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - this->address_server_arg_.set (arg_shifter.get_current ()); - arg_shifter.consume_arg (); - } - } - - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT ("-ECGHandler")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT ("basic")) == 0) - this->handler_type_ = ECG_HANDLER_BASIC; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT ("complex")) == 0) - this->handler_type_ = ECG_HANDLER_COMPLEX; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT ("udp")) == 0) - this->handler_type_ = ECG_HANDLER_UDP; - else - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Unsupported <-ECGHandler> ") - ACE_TEXT ("option value: <%s>. Ignoring this ") - ACE_TEXT ("option - using defaults instead.\n"), - opt)); - result = -1; - } - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT ("-ECGTTL")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - unsigned long tmp = ACE_OS::strtoul (opt, 0, 0) & 0xff; - this->ttl_value_ = static_cast<u_char> (tmp); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT ("-ECGNIC")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - this->nic_.set (arg_shifter.get_current ()); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT ("-ECGIPMULTICASTLOOP")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - this->ip_multicast_loop_ = - (ACE_OS::atoi(arg_shifter.get_current()) != 0); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT ("-ECGNONBLOCKING")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - this->non_blocking_ = - (ACE_OS::atoi(arg_shifter.get_current()) != 0); - arg_shifter.consume_arg (); - } - } - - else - { - arg_shifter.ignore_arg (); - ACE_DEBUG ((LM_WARNING, - ACE_TEXT ("Ignoring <%s> option ") - ACE_TEXT ("during initialization.\n"), - arg)); - result = -1; - } - } - - if (this->validate_configuration () == -1) - return -1; - else - return result; -} - -int -TAO_ECG_Mcast_Gateway::init (const char * address_server_arg, - const Attributes & attr) -{ - this->address_server_arg_.set (address_server_arg); - - this->address_server_type_ = attr.address_server_type; - this->handler_type_ = attr.handler_type; - this->service_type_ = attr.service_type; - this->ttl_value_ = attr.ttl_value; - this->nic_.set (attr.nic.c_str ()); - this->ip_multicast_loop_ = attr.ip_multicast_loop; - this->non_blocking_ = attr.non_blocking; - - return this->validate_configuration (); -} - -int -TAO_ECG_Mcast_Gateway::init ( - const RtecEventChannelAdmin::ConsumerQOS & consumer_qos, - const char * address_server_arg, - const Attributes & attributes) -{ - this->consumer_qos_ = consumer_qos; - return this->init (address_server_arg, - attributes); -} - -int -TAO_ECG_Mcast_Gateway::validate_configuration (void) -{ - if ((this->handler_type_ == ECG_HANDLER_BASIC - || this->handler_type_ == ECG_HANDLER_UDP) - && this->service_type_ != ECG_MCAST_SENDER - && this->address_server_type_ != ECG_ADDRESS_SERVER_BASIC) - { - ACE_DEBUG ((LM_ERROR, - "Configurations for mcast handler and " - "address server do not match.\n")); - return -1; - } - - // Currently all Address Server implementations require an - // initialization string. If we ever add a new Address Server - // implementation, which does not, we'll have to remove this check. - if (this->address_server_arg_.length () == 0) - { - ACE_DEBUG ((LM_ERROR, - "Address server initializaton " - "argument not specified.\n")); - return -1; - } - - if (this->ip_multicast_loop_ != 0 - && this->ip_multicast_loop_ != 1) - { - ACE_DEBUG ((LM_ERROR, - "IP MULTICAST LOOP option must have a boolean value.\n")); - return -1; - } - - if (this->non_blocking_ != 0 - && this->non_blocking_ != 1) - { - ACE_DEBUG ((LM_ERROR, - "NON BLOCKING flag must have a boolean value.\n")); - return -1; - } - - return 0; -} - -TAO_ECG_Refcounted_Endpoint -TAO_ECG_Mcast_Gateway::init_endpoint (void) -{ - TAO_ECG_UDP_Out_Endpoint* endpoint = 0; - TAO_ECG_Refcounted_Endpoint refendpoint; - - // Try to allocate a new endpoint from the heap - ACE_NEW_NORETURN (endpoint, - TAO_ECG_UDP_Out_Endpoint); - - if (endpoint != 0) - { - refendpoint.reset (endpoint); - } - else - { - return TAO_ECG_Refcounted_Endpoint (); - } - - ACE_SOCK_Dgram& dgram = refendpoint->dgram (); - - if (dgram.open (ACE_Addr::sap_any) == -1) - { - ACE_ERROR ((LM_ERROR, - "Cannot open dgram " - "for sending mcast messages.\n")); - return TAO_ECG_Refcounted_Endpoint (); - } - - if (this->nic_.length () != 0) - { - dgram.set_nic (this->nic_.c_str ()); - } - - if (this->ttl_value_ > 0) - { - if (dgram.ACE_SOCK::set_option (IPPROTO_IP, - IP_MULTICAST_TTL, - &this->ttl_value_, - sizeof (this->ttl_value_)) - == -1) - { - ACE_ERROR ((LM_ERROR, - "Error setting TTL option on dgram " - "for sending mcast messages.\n")); - return TAO_ECG_Refcounted_Endpoint (); - } - } - - if (dgram.ACE_SOCK::set_option (IPPROTO_IP, - IP_MULTICAST_LOOP, - &this->ip_multicast_loop_, - sizeof (this->ip_multicast_loop_)) == -1) - { - ACE_ERROR ((LM_ERROR, - "Error setting MULTICAST_LOOP option " - "on dgram for sending mcast messages.\n")); - return TAO_ECG_Refcounted_Endpoint (); - } - - if (this->non_blocking_ - && dgram.enable(ACE_NONBLOCK) == -1) - { - ACE_ERROR ((LM_ERROR, - "Error setting NON BLOCKING option.\n")); - return TAO_ECG_Refcounted_Endpoint (); - } - - return refendpoint; -} - -PortableServer::ServantBase * -TAO_ECG_Mcast_Gateway::init_address_server (void) -{ - const char * address_server_arg = - (this->address_server_arg_.length ()) - ? this->address_server_arg_.c_str () : 0; - - if (this->address_server_type_ == ECG_ADDRESS_SERVER_BASIC) - { - TAO_EC_Servant_Var<TAO_ECG_Simple_Address_Server> impl = - TAO_ECG_Simple_Address_Server::create (); - if (!impl.in ()) - return 0; - - if (impl->init (address_server_arg) == -1) - { - return 0; - } - return impl._retn (); - } - - else if (this->address_server_type_ == ECG_ADDRESS_SERVER_SOURCE) - { - TAO_EC_Servant_Var<TAO_ECG_Complex_Address_Server> impl = - TAO_ECG_Complex_Address_Server::create (1); - if (!impl.in ()) - return 0; - - if (impl->init (address_server_arg) == -1) - { - return 0; - } - return impl._retn (); - } - - else if (this->address_server_type_ == ECG_ADDRESS_SERVER_TYPE) - { - TAO_EC_Servant_Var<TAO_ECG_Complex_Address_Server> impl = - TAO_ECG_Complex_Address_Server::create (0); - if (!impl.in ()) - return 0; - - if (impl->init (address_server_arg) == -1) - { - return 0; - } - return impl._retn (); - } - - else - { - ACE_ERROR ((LM_ERROR, - "Cannot create address server: " - "unknown address server type specified.\n")); - return 0; - } -} - -TAO_ECG_Refcounted_Handler -TAO_ECG_Mcast_Gateway::init_handler (TAO_ECG_Dgram_Handler *receiver, - RtecEventChannelAdmin::EventChannel_ptr ec, - ACE_Reactor *reactor - ACE_ENV_ARG_DECL) -{ - TAO_ECG_Refcounted_Handler handler; - - const char * nic = - (this->nic_.length ()) ? this->nic_.c_str () : 0; - const char * address_server_arg = - (this->address_server_arg_.length ()) - ? this->address_server_arg_.c_str () : 0; - - if (this->handler_type_ == ECG_HANDLER_BASIC) - { - TAO_ECG_Simple_Mcast_EH * h = 0; - ACE_NEW_RETURN (h, - TAO_ECG_Simple_Mcast_EH (receiver), - handler); - handler.reset (h); - - h->reactor (reactor); - if (h->open (address_server_arg, nic) != 0) - return TAO_ECG_Refcounted_Handler (); - } - - else if (this->handler_type_ == ECG_HANDLER_COMPLEX) - { - TAO_ECG_Mcast_EH * h = 0; - ACE_NEW_RETURN (h, - TAO_ECG_Mcast_EH (receiver, nic), - handler); - handler.reset (h); - - h->reactor (reactor); - - h->open (ec ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (TAO_ECG_Refcounted_Handler ()); - } - - else if (this->handler_type_ == ECG_HANDLER_UDP) - { - TAO_ECG_UDP_EH * h = 0; - ACE_NEW_RETURN (h, - TAO_ECG_UDP_EH (receiver), - handler); - handler.reset (h); - h->reactor (reactor); - - ACE_INET_Addr ipaddr; - if (ipaddr.set (address_server_arg) != 0) - { - ACE_ERROR ((LM_ERROR, - "ERROR using address server argument " - "in ACE_INET_Addr.set ().\n")); - return TAO_ECG_Refcounted_Handler (); - } - if (h->open (ipaddr) != 0) - return TAO_ECG_Refcounted_Handler (); - } - - else - { - ACE_ERROR ((LM_ERROR, - "Cannot create handler: unknown " - "handler type specified.\n")); - return handler; - } - - return handler; -} - -TAO_EC_Servant_Var<TAO_ECG_UDP_Sender> -TAO_ECG_Mcast_Gateway::init_sender ( - RtecEventChannelAdmin::EventChannel_ptr ec, - RtecUDPAdmin::AddrServer_ptr address_server, - TAO_ECG_Refcounted_Endpoint endpoint_rptr - ACE_ENV_ARG_DECL) -{ - TAO_EC_Servant_Var<TAO_ECG_UDP_Sender> - sender (TAO_ECG_UDP_Sender::create ()); - if (!sender.in ()) - return sender; - - sender->init (ec, - address_server, - endpoint_rptr - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (TAO_EC_Servant_Var<TAO_ECG_UDP_Sender> ()); - - TAO_EC_Auto_Command<UDP_Sender_Shutdown> sender_shutdown; - sender_shutdown.set_command (UDP_Sender_Shutdown (sender)); - - if (this->consumer_qos_.dependencies.length () > 0) - { - // Client supplied consumer qos. Use it. - this->consumer_qos_.is_gateway = 1; - sender->connect (this->consumer_qos_ ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (TAO_EC_Servant_Var<TAO_ECG_UDP_Sender> ()); - } - else - { - // Client did not specify anything - subscribe to all events. - ACE_ConsumerQOS_Factory consumer_qos_factory; - consumer_qos_factory.start_disjunction_group (1); - consumer_qos_factory.insert (ACE_ES_EVENT_SOURCE_ANY, - ACE_ES_EVENT_ANY, - 0); - RtecEventChannelAdmin::ConsumerQOS & qos = - const_cast<RtecEventChannelAdmin::ConsumerQOS &> (consumer_qos_factory.get_ConsumerQOS ()); - qos.is_gateway = 1; - - sender->connect (qos ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (TAO_EC_Servant_Var<TAO_ECG_UDP_Sender> ()); - } - - sender_shutdown.disallow_command (); - return sender; -} - -TAO_EC_Servant_Var<TAO_ECG_UDP_Receiver> -TAO_ECG_Mcast_Gateway::init_receiver ( - RtecEventChannelAdmin::EventChannel_ptr ec, - RtecUDPAdmin::AddrServer_ptr address_server, - TAO_ECG_Refcounted_Endpoint endpoint_rptr - ACE_ENV_ARG_DECL) -{ - TAO_EC_Servant_Var<TAO_ECG_UDP_Receiver> - receiver (TAO_ECG_UDP_Receiver::create ()); - if (!receiver.in ()) - return receiver; - - receiver->init (ec, - endpoint_rptr, - address_server - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (TAO_EC_Servant_Var<TAO_ECG_UDP_Receiver> ()); - - TAO_EC_Auto_Command<UDP_Receiver_Shutdown> receiver_shutdown; - receiver_shutdown.set_command (UDP_Receiver_Shutdown (receiver)); - - ACE_SupplierQOS_Factory supplier_qos_factory; - supplier_qos_factory.insert (ACE_ES_EVENT_SOURCE_ANY, - ACE_ES_EVENT_ANY, - 0, 1); - RtecEventChannelAdmin::SupplierQOS & qos = - const_cast<RtecEventChannelAdmin::SupplierQOS &> (supplier_qos_factory.get_SupplierQOS ()); - qos.is_gateway = 1; - - receiver->connect (qos ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (TAO_EC_Servant_Var<TAO_ECG_UDP_Receiver> ()); - - receiver_shutdown.disallow_command (); - return receiver; -} - -void -TAO_ECG_Mcast_Gateway::verify_args (CORBA::ORB_ptr orb, - RtecEventChannelAdmin::EventChannel_ptr ec - ACE_ENV_ARG_DECL) -{ - if (CORBA::is_nil (ec)) - { - ACE_ERROR ((LM_ERROR, - "Nil event channel argument passed to " - "TAO_ECG_Mcast_Gateway::run().\n")); - ACE_THROW (CORBA::INTERNAL ()); - } - if (CORBA::is_nil (orb)) - { - ACE_ERROR ((LM_ERROR, - "Nil orb argument passed to " - "TAO_ECG_Mcast_Gateway::run().\n")); - ACE_THROW (CORBA::INTERNAL ()); - } -} - -void -TAO_ECG_Mcast_Gateway::run (CORBA::ORB_ptr orb, - RtecEventChannelAdmin::EventChannel_ptr ec - ACE_ENV_ARG_DECL) -{ - // Verify args. - this->verify_args (orb, ec ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // Auto-cleanup objects. - TAO_EC_Object_Deactivator address_server_deactivator; - TAO_EC_Auto_Command<UDP_Sender_Shutdown> sender_shutdown; - TAO_EC_Auto_Command<UDP_Receiver_Shutdown> receiver_shutdown; - - // Set up address server. - PortableServer::ServantBase_var address_server_servant = - this->init_address_server (); - if (!address_server_servant.in ()) - { - ACE_DEBUG ((LM_ERROR, - "Unable to create address server.\n")); - ACE_THROW (CORBA::INTERNAL ()); - } - - RtecUDPAdmin::AddrServer_var address_server; - - PortableServer::POA_var poa = - address_server_servant->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - activate (address_server, - poa.in (), - address_server_servant.in (), - address_server_deactivator - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - TAO_ECG_Refcounted_Endpoint endpoint_rptr; - TAO_EC_Servant_Var<TAO_ECG_UDP_Sender> sender; - - // Set up event sender. - if (this->service_type_ == ECG_MCAST_SENDER - || this->service_type_ == ECG_MCAST_TWO_WAY) - { - endpoint_rptr = this->init_endpoint (); - if (endpoint_rptr.get () == 0) - { - ACE_THROW (CORBA::INTERNAL ()); - } - - sender = this->init_sender (ec, - address_server.in (), - endpoint_rptr - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - if (!sender.in ()) - { - ACE_THROW (CORBA::INTERNAL ()); - } - - sender_shutdown.set_command (UDP_Sender_Shutdown (sender)); - } - - // Set up event receiver. - TAO_EC_Servant_Var<TAO_ECG_UDP_Receiver> receiver; - if (this->service_type_ == ECG_MCAST_RECEIVER - || this->service_type_ == ECG_MCAST_TWO_WAY) - { - ACE_Reactor *reactor = orb->orb_core ()->reactor (); - - receiver = this->init_receiver (ec, - address_server.in (), - endpoint_rptr - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - if (!receiver.in ()) - { - ACE_THROW (CORBA::INTERNAL ()); - } - - receiver_shutdown.set_command (UDP_Receiver_Shutdown (receiver)); - - TAO_ECG_Refcounted_Handler - handler_rptr (this->init_handler (receiver.in (), - ec, - reactor - ACE_ENV_ARG_PARAMETER)); - ACE_CHECK; - if (handler_rptr.get () == 0) - { - ACE_THROW (CORBA::INTERNAL ()); - } - receiver->set_handler_shutdown (handler_rptr); - } - - // Everything went ok - disable auto-cleanup. - address_server_deactivator.disallow_deactivation (); - receiver_shutdown.disallow_command (); - sender_shutdown.disallow_command (); -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -// **************************************************************** - -ACE_STATIC_SVC_DEFINE (TAO_ECG_Mcast_Gateway, - ACE_TEXT ("ECG_Mcast_Gateway"), - ACE_SVC_OBJ_T, - &ACE_SVC_NAME (TAO_ECG_Mcast_Gateway), - ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, - 0) -ACE_FACTORY_DEFINE (TAO_RTEvent_Serv, TAO_ECG_Mcast_Gateway) diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_Gateway.h b/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_Gateway.h deleted file mode 100644 index 827d6ae20ac..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_Gateway.h +++ /dev/null @@ -1,290 +0,0 @@ -// -*- C++ -*- - -/** - * @file ECG_Mcast_Gateway.h - * - * $Id$ - * - * @author Marina Spivak (marina@atdesk.com) - */ - -#ifndef TAO_ECG_MCAST_GATEWAY_H -#define TAO_ECG_MCAST_GATEWAY_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/ECG_UDP_Sender.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/Event/ECG_Defaults.h" -#include /**/ "orbsvcs/Event/event_serv_export.h" -#include "orbsvcs/Event/ECG_UDP_Receiver.h" -#include "orbsvcs/Event/ECG_UDP_Out_Endpoint.h" -#include "ace/Service_Object.h" -#include "ace/Service_Config.h" -#include "ace/SString.h" -#include "ace/os_include/os_stdint.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -class ACE_Event_Handler; -ACE_END_VERSIONED_NAMESPACE_DECL - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_ECG_Mcast_Gateway - * - * @brief Implement the builder for setting up Event Channel multicast - * gateway. - * NOT THREAD-SAFE. - * - * This class simplifies creation of federated Event Channels by - * presenting a simple unified interface for creating and configuring - * all components needed to federate an Event Channel. - * Configuration options are described below. - * - * NOTE: This class does not own any of the components it creates and - * its lifetime is independent of theirs. This class acts purely as a - * wrapper facade for creating and wiring appropriate components - * together. - * - * @todo This class is an ACE_Service_Object, but the only reason for - * it is the need for easy configuration using files. Since - * ACE_Service_Object provides much more than that, we should look - * into replacing it with a more lightweight utility that would serve - * our needs. - * - * CONFIGURATION OPTIONS - * There are two ways to use this class: - * 1) Use service config file to specify configuration options (which - * are described below), and use service configurator to obtain a - * an instance of configured TAO_ECG_Mcast_Gateway in your program. (See - * TAO/orbsvcs/tests/Event/Mcast/Common and - * TAO/orbsvcs/tests/Event/Mcast/Simple for an example.) - * - * Service config file options: - * - * -ECGService <service> - * Valid values: sender, receiver, two_way - * Specifies whether this gateway should act as a multicast sender of - * the events or multicast receiver, or both. - * - * -ECGAddressServer <server_type> - * Valid values: basic, source, type - * Specifies what implementation of the address server should be used - * by the gateway. basic - the same multicast address is returned for - * all event headers. source - multicast addresses are returned based - * on the event source, according to the mapping provided at - * initialization. type - multicast addresses are returned based - * on the event type, according to the mapping provided at - * initialization. - * - * -ECGAddressServerArg <arg> - * Valid value: arg is a string, whose format requirements are - * specific to the implementation of address server used. - * Arg is not interpreted by the gateway, but simply passed to the - * address server specified by -ECGAddressServer during initialization. - * THIS OPTION MUST ALWAYS BE SPECIFIED BY THE USER (there is no - * default value for it) - * - * -ECGHandler <handler_type> - * Valid values: basic, complex, udp - * Specifies what implementation of event handler should be used if - * gateway is acting as events receiver. basic - a simple event - * handler listening on a single mcast address. complex - - * event handler listening on multiple mcast addresses based on - * events of interest to consumers. udp - similar to basic handler, - * except listens on udp address as opposed to a multicast group. - * - * -ECGTTL <ttl> - * Valid values: a number > 0 - * IP_Multicast time to live value that should be set on a sending socket. - * This option matters only if the gateway is acting as a sender of - * mcast messages. - * - * -ECGNIC <nic> - * Valid values: name of the network interface - * This interface is used for sending and/or receiving multicast messages. - * - * -ECGNonBlocking - * Boolean flag to configure if the socket is in blocking or - * non-blocking code. The default is non-blocking. - * NOTE: Certain device drivers block the process if the physical - * link fails. - * - * - * 2) Create an instance of TAO_ECG_Mcast_Gateway in your code, on the stack or - * dynamically, and use init () method to configure it. No - * configuration files involved. See service config options above for the - * description of configurable options, and init() method below for how - * to specify them. - * - * - * Default configuration values (for either use case) can be found in - * ECG_Defaults.h - */ -class TAO_RTEvent_Serv_Export TAO_ECG_Mcast_Gateway - : public ACE_Service_Object -{ -public: - - /// The Service_Object entry points. - //@{ - virtual int init (int argc, ACE_TCHAR* argv[]); - virtual int fini (void); - //@} - - /// Helper function to register the Gateway into the service - /// configurator. - static int init_svcs (void); - - /// Constructor. - TAO_ECG_Mcast_Gateway (void); - - /// Values for some configuration parameters to init (). - //@{ - enum Service_Type {ECG_MCAST_SENDER, - ECG_MCAST_RECEIVER, - ECG_MCAST_TWO_WAY}; - - enum Address_Server_Type {ECG_ADDRESS_SERVER_BASIC, - ECG_ADDRESS_SERVER_SOURCE, - ECG_ADDRESS_SERVER_TYPE}; - - enum Handler_Type {ECG_HANDLER_BASIC, - ECG_HANDLER_COMPLEX, - ECG_HANDLER_UDP}; - //@} - - /** - * @struct Attributes - * - * @brief Helper class to initialize a TAO_ECG_Mcast_Gateway. - * - * The TAO_ECG_Mcast_Gateway class has several properties that can - * be configured at initialization time, with default values. The - * canonical trick of using a constructor or init() method with - * multiple arguments does not work because to change the last - * argument the application developer needs to know all the other - * defaults. - * - * Instead we define a helper class that initializes all the fields - * to reasonable defaults. The application only sets the fields - * that it is interested into, if new fields are added applications - * do not need to change. - * - * With a little trickery we can even eliminate named temporaries: - * - * TAO_ECG_Mcast_Gateway gw;<BR> - * gw.init(TAO_ECG_Mcast_Gateway::Attributes().set_foo(x).set_bar(y)); - * - * but we are not implementing that one (detecting errors is too - * hard without exceptions and ACE+TAO are somewhat shy of - * exceptions at this point.) - */ - struct TAO_RTEvent_Serv_Export Attributes - { - Attributes (void); - - Address_Server_Type address_server_type; - Handler_Type handler_type; - Service_Type service_type; - u_char ttl_value; - ACE_CString nic; - int ip_multicast_loop; - int non_blocking; - }; - - /// Configure TAO_ECG_Mcast_Gateway programatically. This method should - /// be used when NOT using service configurator to obtain/configure - /// TAO_ECG_Mcast_Gateway. See class documentation above for more - /// info. - int init (const char * address_server_arg, - const Attributes & attributes = Attributes()); - - /// Same as the method above, but also gives the client an opportunity to - /// specify consumer qos, i.e., which EC traffic should get multicasted. - /* - * By default, multicast sender subscribes to all events in the - * Event Channel, i.e., all events pushed to the EC get multicasted - * (as long as their ttl is > 0). This method allows clients to - * specify a more restrictive qos, hence limiting which EC traffic - * gets multicasted. - */ - int init (const RtecEventChannelAdmin::ConsumerQOS & consumer_qos, - const char * address_server_arg, - const Attributes & attributes = Attributes()); - - /// The main method - create, configure and run federation - /// components according to the specified configuration. - void run (CORBA::ORB_ptr orb, - RtecEventChannelAdmin::EventChannel_ptr ec - ACE_ENV_ARG_DECL); - -private: - - /// Helpers. - //@{ - /// Check that arguments to run() are not nil. - void verify_args (CORBA::ORB_ptr orb, - RtecEventChannelAdmin::EventChannel_ptr ec - ACE_ENV_ARG_DECL); - - /// Verifies configuration values specified through init() make sense. - int validate_configuration (void); - //@} - - /// Allocate and initialize appropriate objects. - //@{ - PortableServer::ServantBase * - init_address_server (void); - - TAO_EC_Servant_Var<TAO_ECG_UDP_Sender> - init_sender (RtecEventChannelAdmin::EventChannel_ptr ec, - RtecUDPAdmin::AddrServer_ptr address_server, - TAO_ECG_Refcounted_Endpoint endpoint_rptr - ACE_ENV_ARG_DECL); - - TAO_EC_Servant_Var<TAO_ECG_UDP_Receiver> - init_receiver (RtecEventChannelAdmin::EventChannel_ptr ec, - RtecUDPAdmin::AddrServer_ptr address_server, - TAO_ECG_Refcounted_Endpoint endpoint_rptr - ACE_ENV_ARG_DECL); - - TAO_ECG_Refcounted_Endpoint init_endpoint (void); - - TAO_ECG_Refcounted_Handler - init_handler (TAO_ECG_Dgram_Handler *recv, - RtecEventChannelAdmin::EventChannel_ptr ec, - ACE_Reactor * reactor - ACE_ENV_ARG_DECL); - //@} - - /// Flags controlling configuration. - //@{ - Service_Type service_type_; - Handler_Type handler_type_; - Address_Server_Type address_server_type_; - ACE_CString address_server_arg_; - u_char ttl_value_; - ACE_CString nic_; - int ip_multicast_loop_; - int non_blocking_; - - RtecEventChannelAdmin::ConsumerQOS consumer_qos_; - //@} -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/ECG_Mcast_Gateway.i" -#endif /* __ACE_INLINE__ */ - -ACE_STATIC_SVC_DECLARE (TAO_ECG_Mcast_Gateway) -ACE_FACTORY_DECLARE (TAO_RTEvent_Serv, TAO_ECG_Mcast_Gateway) - -#include /**/ "ace/post.h" -#endif /* TAO_ECG_MCAST_GATEWAY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_Gateway.i b/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_Gateway.i deleted file mode 100644 index 8e126abb9b6..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_Gateway.i +++ /dev/null @@ -1,34 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_ECG_Mcast_Gateway::TAO_ECG_Mcast_Gateway (void) - : service_type_ (TAO_ECG_DEFAULT_SERVICE) - , handler_type_ (TAO_ECG_DEFAULT_HANDLER) - , address_server_type_ (TAO_ECG_DEFAULT_ADDRESS_SERVER) - , address_server_arg_ ((const char *) TAO_ECG_DEFAULT_ADDRESS_SERVER_ARG) - , ttl_value_ (TAO_ECG_DEFAULT_TTL) - , nic_ (static_cast<const char *> (TAO_ECG_DEFAULT_NIC)) - , ip_multicast_loop_ (TAO_ECG_DEFAULT_IP_MULTICAST_LOOP) - , non_blocking_ (TAO_ECG_DEFAULT_NON_BLOCKING) - , consumer_qos_ () -{ - this->consumer_qos_.dependencies.length (0); -} - -ACE_INLINE -TAO_ECG_Mcast_Gateway::Attributes::Attributes (void) - : address_server_type (TAO_ECG_DEFAULT_ADDRESS_SERVER) - , handler_type (TAO_ECG_DEFAULT_HANDLER) - , service_type (TAO_ECG_DEFAULT_SERVICE) - , ttl_value (TAO_ECG_DEFAULT_TTL) - , nic (static_cast<const char *> (TAO_ECG_DEFAULT_NIC)) - , ip_multicast_loop (TAO_ECG_DEFAULT_IP_MULTICAST_LOOP) - , non_blocking (TAO_ECG_DEFAULT_NON_BLOCKING) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Reactive_ConsumerEC_Control.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_Reactive_ConsumerEC_Control.cpp deleted file mode 100644 index 0906d59820f..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Reactive_ConsumerEC_Control.cpp +++ /dev/null @@ -1,253 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Gateway_IIOP.h" -#include "orbsvcs/Event/ECG_Reactive_ConsumerEC_Control.h" -#include "tao/Messaging/Messaging.h" -#include "tao/ORB_Core.h" - -#include "ace/Reactor.h" - -ACE_RCSID(Event, ECG_Reactive_ConsumerEventChannelControl, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_ECG_Reactive_ConsumerEC_Control:: - TAO_ECG_Reactive_ConsumerEC_Control (const ACE_Time_Value &rate, - const ACE_Time_Value &timeout, - TAO_EC_Gateway_IIOP* gateway, - CORBA::ORB_ptr orb) - : rate_ (rate), - timeout_ (timeout), - adapter_ (this), - gateway_ (gateway), - orb_ (CORBA::ORB::_duplicate (orb)) -#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 - , timer_id_ (-1) -#endif /* TAO_HAS_CORBA_MESSAGING != 0*/ -{ - this->reactor_ = - this->orb_->orb_core ()->reactor (); -} - -TAO_ECG_Reactive_ConsumerEC_Control::~TAO_ECG_Reactive_ConsumerEC_Control (void) -{ -} - -void -TAO_ECG_Reactive_ConsumerEC_Control::query_eventchannel ( - ACE_ENV_SINGLE_ARG_DECL) -{ - ACE_TRY - { - CORBA::Boolean disconnected; - CORBA::Boolean non_existent = - gateway_->consumer_ec_non_existent (disconnected - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (non_existent && !disconnected) - { - this->event_channel_not_exist (gateway_ ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCH (CORBA::OBJECT_NOT_EXIST, ex) - { - this->event_channel_not_exist (gateway_ ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCH (CORBA::TRANSIENT, transient) - { - // This is TAO's minor code for a failed connection, we may - // want to be more lenient in the future.. - // if (transient.minor () == 0x54410085) - this->event_channel_not_exist (gateway_ ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore all exceptions - } - ACE_ENDTRY; -} - -void -TAO_ECG_Reactive_ConsumerEC_Control::handle_timeout ( - const ACE_Time_Value &, - const void *) -{ - // NOTE, setting RELATIVE_RT_TIMEOUT_POLICY for the duration of - // query_eventchannel () below has greater impact than desired. For - // example, while we are pinging ec here, a nested upcall, - // which requires making remote calls may come into the ORB. Those - // remote calls will be carried out with with - // RELATIVE_RT_TIMEOUT_POLICY set here in effect. - - // @@ TODO: should use Guard to set and reset policies. - ACE_TRY_NEW_ENV - { - // Query the state of the Current object *before* we initiate - // the iteration... - CORBA::PolicyTypeSeq types; - CORBA::PolicyList_var policies = - this->policy_current_->get_policy_overrides (types - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Change the timeout - this->policy_current_->set_policy_overrides (this->policy_list_, - CORBA::ADD_OVERRIDE - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Query the state of the consumers... - this->query_eventchannel (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - this->policy_current_->set_policy_overrides (policies.in (), - CORBA::SET_OVERRIDE - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - for (CORBA::ULong i = 0; i != policies->length (); ++i) - { - policies[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCHANY - { - // Ignore all exceptions - } - ACE_ENDTRY; -} - -int -TAO_ECG_Reactive_ConsumerEC_Control::activate (void) -{ -#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 - ACE_TRY_NEW_ENV - { - // Get the PolicyCurrent object - CORBA::Object_var tmp = - this->orb_->resolve_initial_references ("PolicyCurrent" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - this->policy_current_ = - CORBA::PolicyCurrent::_narrow (tmp.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Timeout for polling state (default = 10 msec) - TimeBase::TimeT timeout = timeout_.usec() * 10; - CORBA::Any any; - any <<= timeout; - - this->policy_list_.length (1); - this->policy_list_[0] = - this->orb_->create_policy ( - Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE, - any - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Only schedule the timer, when the rate is not zero - if (this->rate_ != ACE_Time_Value::zero) - { - // Schedule the timer after these policies has been set, because the - // handle_timeout uses these policies, if done in front, the channel - // can crash when the timeout expires before initiazation is ready. - timer_id_ = this->reactor_->schedule_timer (&this->adapter_, - 0, - this->rate_, - this->rate_); - if (timer_id_ == -1) - return -1; - } - } - ACE_CATCHANY - { - return -1; - } - ACE_ENDTRY; -#endif /* TAO_HAS_CORBA_MESSAGING */ - - return 0; -} - -int -TAO_ECG_Reactive_ConsumerEC_Control::shutdown (void) -{ - int r = 0; - -#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 - r = this->reactor_->cancel_timer (timer_id_); -#endif /* TAO_HAS_CORBA_MESSAGING */ - - this->adapter_.reactor (0); - return r; -} - -void -TAO_ECG_Reactive_ConsumerEC_Control::event_channel_not_exist ( - TAO_EC_Gateway_IIOP* gateway - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - ACE_DEBUG ((LM_DEBUG, - "EC_Reactive_ConsumerControl(%P|%t) - " - "channel %x does not exists\n")); - gateway->cleanup_consumer_ec (); - - gateway->cleanup_consumer_proxies (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "TAO_EC_Reactive_ConsumerControl::event_channel_not_exist"); - // Ignore all exceptions.. - } - ACE_ENDTRY; -} - -void -TAO_ECG_Reactive_ConsumerEC_Control::system_exception ( - TAO_EC_Gateway_IIOP* gateway, - CORBA::SystemException & /* exception */ - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - gateway->cleanup_consumer_ec (); - - gateway->cleanup_consumer_proxies (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - } - ACE_CATCHANY - { - // Ignore all exceptions.. - } - ACE_ENDTRY; -} - -// **************************************************************** - -TAO_ECG_Reactive_ConsumerEC_Control_Adapter::TAO_ECG_Reactive_ConsumerEC_Control_Adapter ( - TAO_ECG_Reactive_ConsumerEC_Control *adaptee) - : adaptee_ (adaptee) -{ -} - -int -TAO_ECG_Reactive_ConsumerEC_Control_Adapter::handle_timeout ( - const ACE_Time_Value &tv, - const void *arg) -{ - this->adaptee_->handle_timeout (tv, arg); - return 0; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Reactive_ConsumerEC_Control.h b/TAO/orbsvcs/orbsvcs/Event/ECG_Reactive_ConsumerEC_Control.h deleted file mode 100644 index e7ccad73c2a..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Reactive_ConsumerEC_Control.h +++ /dev/null @@ -1,133 +0,0 @@ -// -*- C++ -*- - -/** - * @file ECG_Reactive_ConsumerEC_Control.h - * - * $Id$ - * - * @author Johnny Willemsen (jwillemsen@remedy.nl) - * - */ - -#ifndef TAO_ECG_REACTIVE_CONSUMEREC_CONTROL_H -#define TAO_ECG_REACTIVE_CONSUMEREC_CONTROL_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/ECG_ConsumerEC_Control.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/ORB.h" -#include "tao/PolicyC.h" - -#include "ace/Event_Handler.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_ECG_Reactive_ConsumerEC_Control; -class TAO_EC_Gateway_IIOP; - -/** - * @class TAO_ECG_Reactive_ConsumerEC_Control_Adapter - * - * @brief Forwards timeout events to the Reactive ConsumerControl - * - * The Reactive ConsumerControl strategy uses the reactor to - * periodically wakeup and verify the state of the consumers - * registered with the Event Channel. - */ -class TAO_RTEvent_Serv_Export TAO_ECG_Reactive_ConsumerEC_Control_Adapter - : public ACE_Event_Handler -{ -public: - /// Constructor - TAO_ECG_Reactive_ConsumerEC_Control_Adapter (TAO_ECG_Reactive_ConsumerEC_Control *adaptee); - - // = Documented in ACE_Event_Handler. - virtual int handle_timeout (const ACE_Time_Value &tv, - const void *arg = 0); - -private: - /// The adapted object - TAO_ECG_Reactive_ConsumerEC_Control *adaptee_; -}; - -/** - * @class TAO_ECG_Reactive_ConsumerEC_Control - * - * @brief Consumer event channel control - * - * Defines the interface for the consumer event channel control strategy. - * This strategy handles misbehaving or failing consumer event channels. - */ -class TAO_RTEvent_Serv_Export TAO_ECG_Reactive_ConsumerEC_Control - : public TAO_ECG_ConsumerEC_Control -{ -public: - /// Constructor. It does not assume ownership of the @a event_channel - /// parameter. - TAO_ECG_Reactive_ConsumerEC_Control (const ACE_Time_Value &rate, - const ACE_Time_Value &timeout, - TAO_EC_Gateway_IIOP* gateway, - CORBA::ORB_ptr orb); - - /// Destructor. - virtual ~TAO_ECG_Reactive_ConsumerEC_Control (void); - - /// Receive the timeout from the adapter - void handle_timeout (const ACE_Time_Value &tv, - const void* arg); - - // = Documented in TAO_EC_ConsumerControl - virtual int activate (void); - virtual int shutdown (void); - virtual void event_channel_not_exist (TAO_EC_Gateway_IIOP *gateway - ACE_ENV_ARG_DECL_NOT_USED); - virtual void system_exception (TAO_EC_Gateway_IIOP *gateway, - CORBA::SystemException & - ACE_ENV_ARG_DECL_NOT_USED); - -private: - /// Check if the consumers still exists. It is a helper method for - /// handle_timeout() to isolate the exceptions. - void query_eventchannel (ACE_ENV_SINGLE_ARG_DECL); - -private: - /// The polling rate - ACE_Time_Value rate_; - - /// The polling timeout - ACE_Time_Value timeout_; - - /// The Adapter for the reactor events - TAO_ECG_Reactive_ConsumerEC_Control_Adapter adapter_; - - /// The gateway - TAO_EC_Gateway_IIOP* gateway_; - - /// The ORB - CORBA::ORB_var orb_; - - /// To control the timeout policy in the thread - CORBA::PolicyCurrent_var policy_current_; - - /// Precomputed policy list to the set timeout. - CORBA::PolicyList policy_list_; - - /// The ORB reactor - ACE_Reactor *reactor_; - -#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 - /// The timer id - long timer_id_; -#endif /* TAO_HAS_CORBA_MESSAGING */ -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* TAO_ECG_REACTIVE_CONSUMEREC_CONTROL_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Reconnect_ConsumerEC_Control.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_Reconnect_ConsumerEC_Control.cpp deleted file mode 100644 index 2e14b4da681..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Reconnect_ConsumerEC_Control.cpp +++ /dev/null @@ -1,319 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Gateway_IIOP.h" -#include "orbsvcs/Event/ECG_Reconnect_ConsumerEC_Control.h" -#include "tao/Messaging/Messaging.h" -#include "tao/ORB_Core.h" -#include "ace/Reactor.h" - -ACE_RCSID(Event, ECG_Reconnect_ConsumerEventChannelControl, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_ECG_Reconnect_ConsumerEC_Control:: - TAO_ECG_Reconnect_ConsumerEC_Control (const ACE_Time_Value &rate, - const ACE_Time_Value &timeout, - TAO_EC_Gateway_IIOP* gateway, - CORBA::ORB_ptr orb) - : rate_ (rate), - timeout_ (timeout), - adapter_ (this), - gateway_ (gateway), - orb_ (CORBA::ORB::_duplicate (orb)), - is_consumer_ec_connected_ (1) -#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 - , timer_id_ (-1) -#endif /* TAO_HAS_CORBA_MESSAGING != 0*/ -{ - this->reactor_ = - this->orb_->orb_core ()->reactor (); -} - -TAO_ECG_Reconnect_ConsumerEC_Control::~TAO_ECG_Reconnect_ConsumerEC_Control (void) -{ -} - -void -TAO_ECG_Reconnect_ConsumerEC_Control::try_reconnect ( - ACE_ENV_SINGLE_ARG_DECL) -{ - ACE_TRY - { - CORBA::Boolean disconnected; - CORBA::Boolean non_existent = - gateway_->consumer_ec_non_existent (disconnected - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (!non_existent) - { - this->reconnect(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCHANY - { - // Ignore all exceptions - } - ACE_ENDTRY; -} - -void -TAO_ECG_Reconnect_ConsumerEC_Control::reconnect ( - ACE_ENV_SINGLE_ARG_DECL) -{ - ACE_TRY - { - is_consumer_ec_connected_ = 1; - - gateway_->reconnect_consumer_ec(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore all exceptions - } - ACE_ENDTRY; -} - -void -TAO_ECG_Reconnect_ConsumerEC_Control::query_eventchannel ( - ACE_ENV_SINGLE_ARG_DECL) -{ - ACE_TRY - { - if (is_consumer_ec_connected_ == 1) - { - CORBA::Boolean disconnected; - CORBA::Boolean non_existent = - gateway_->consumer_ec_non_existent (disconnected - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (non_existent && !disconnected) - { - this->event_channel_not_exist (gateway_ ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - else - { - this->try_reconnect(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCH (CORBA::OBJECT_NOT_EXIST, ex) - { - this->event_channel_not_exist (gateway_ ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCH (CORBA::TRANSIENT, transient) - { - // This is TAO's minor code for a failed connection, we may - // want to be more lenient in the future.. - // if (transient.minor () == 0x54410085) - this->event_channel_not_exist (gateway_ ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore all exceptions - } - ACE_ENDTRY; -} - -void -TAO_ECG_Reconnect_ConsumerEC_Control::handle_timeout ( - const ACE_Time_Value &, - const void *) -{ - // NOTE, setting RELATIVE_RT_TIMEOUT_POLICY for the duration of - // query_eventchannel () below has greater impact than desired. For - // example, while we are pinging consumers here, a nested upcall, - // which requires making remote calls may come into the ORB. Those - // remote calls will be carried out with with - // RELATIVE_RT_TIMEOUT_POLICY set here in effect. - // @@ TODO: should use Guard to set and reset policies. - ACE_TRY_NEW_ENV - { - // Query the state of the Current object *before* we initiate - // the iteration... - CORBA::PolicyTypeSeq types; - CORBA::PolicyList_var policies = - this->policy_current_->get_policy_overrides (types - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Change the timeout - this->policy_current_->set_policy_overrides (this->policy_list_, - CORBA::ADD_OVERRIDE - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Query the state of the consumers... - this->query_eventchannel (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - this->policy_current_->set_policy_overrides (policies.in (), - CORBA::SET_OVERRIDE - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - for (CORBA::ULong i = 0; i != policies->length (); ++i) - { - policies[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCHANY - { - // Ignore all exceptions - } - ACE_ENDTRY; -} - -int -TAO_ECG_Reconnect_ConsumerEC_Control::activate (void) -{ -#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 - ACE_TRY_NEW_ENV - { - // Get the PolicyCurrent object - CORBA::Object_var tmp = - this->orb_->resolve_initial_references ("PolicyCurrent" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - this->policy_current_ = - CORBA::PolicyCurrent::_narrow (tmp.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Timeout for polling state (default = 10 msec) - TimeBase::TimeT timeout = timeout_.usec() * 10; - CORBA::Any any; - any <<= timeout; - - this->policy_list_.length (1); - this->policy_list_[0] = - this->orb_->create_policy ( - Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE, - any - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Only schedule the timer, when the rate is not zero - if (this->rate_ != ACE_Time_Value::zero) - { - // Schedule the timer after these policies has been set, because the - // handle_timeout uses these policies, if done in front, the channel - // can crash when the timeout expires before initiazation is ready. - timer_id_ = this->reactor_->schedule_timer (&this->adapter_, - 0, - this->rate_, - this->rate_); - if (timer_id_ == -1) - return -1; - } - } - ACE_CATCHANY - { - return -1; - } - ACE_ENDTRY; -#endif /* TAO_HAS_CORBA_MESSAGING */ - - return 0; -} - -int -TAO_ECG_Reconnect_ConsumerEC_Control::shutdown (void) -{ - int r = 0; - -#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 - r = this->reactor_->cancel_timer (timer_id_); -#endif /* TAO_HAS_CORBA_MESSAGING */ - - this->adapter_.reactor (0); - return r; -} - -void -TAO_ECG_Reconnect_ConsumerEC_Control::event_channel_not_exist ( - TAO_EC_Gateway_IIOP* gateway - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - //ACE_DEBUG ((LM_DEBUG, - // "ECG_Reconnect_ConsumerControl(%P|%t) - " - // "channel %x does not exists\n")); - is_consumer_ec_connected_ = 0; - - gateway->suspend_supplier_ec (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - gateway->cleanup_consumer_proxies (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "TAO_EC_Reconnect_ConsumerControl::event_channel_not_exist"); - // Ignore all exceptions.. - } - ACE_ENDTRY; -} - -void -TAO_ECG_Reconnect_ConsumerEC_Control::system_exception ( - TAO_EC_Gateway_IIOP* gateway, - CORBA::SystemException & /* exception */ - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - // The current implementation is very strict, and kicks out a - // client on the first system exception. We may - // want to be more lenient in the future, for example, - // this is TAO's minor code for a failed connection. - // - // if (CORBA::TRANSIENT::_narrow (&exception) != 0 - // && exception->minor () == 0x54410085) - // return; - - // Anything else is serious, including timeouts... - //ACE_DEBUG ((LM_DEBUG, - // "ECG_Reconnect_ConsumerControl(%P|%t) - " - // "channel %x does not exists system except\n")); - is_consumer_ec_connected_ = 0; - - gateway->suspend_supplier_ec (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - gateway->cleanup_consumer_proxies (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore all exceptions.. - } - ACE_ENDTRY; -} - -// **************************************************************** - -TAO_ECG_Reconnect_ConsumerEC_Control_Adapter::TAO_ECG_Reconnect_ConsumerEC_Control_Adapter ( - TAO_ECG_Reconnect_ConsumerEC_Control *adaptee) - : adaptee_ (adaptee) -{ -} - -int -TAO_ECG_Reconnect_ConsumerEC_Control_Adapter::handle_timeout ( - const ACE_Time_Value &tv, - const void *arg) -{ - this->adaptee_->handle_timeout (tv, arg); - return 0; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Reconnect_ConsumerEC_Control.h b/TAO/orbsvcs/orbsvcs/Event/ECG_Reconnect_ConsumerEC_Control.h deleted file mode 100644 index b1f4a6c2987..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Reconnect_ConsumerEC_Control.h +++ /dev/null @@ -1,147 +0,0 @@ -// -*- C++ -*- - -/** - * @file ECG_Reconnect_ConsumerEC_Control.h - * - * $Id$ - * - * @author Johnny Willemsen (jwillemsen@remedy.nl) - * - */ - -#ifndef TAO_ECG_RECONNECT_CONSUMEREC_CONTROL_H -#define TAO_ECG_RECONNECT_CONSUMEREC_CONTROL_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/ECG_ConsumerEC_Control.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/ORB.h" -#include "tao/PolicyC.h" - -#include "ace/Event_Handler.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_ECG_Reconnect_ConsumerEC_Control; -class TAO_EC_Gateway_IIOP; - -/** - * @class TAO_ECG_Reconnect_ConsumerEC_Control_Adapter - * - * @brief Forwards timeout events to the Reconnect ConsumerControl - * - * The Reconnect ConsumerControl strategy uses the reactor to - * periodically wakeup and verify the state of the consumers - * registered with the Event Channel. - */ -class TAO_RTEvent_Serv_Export TAO_ECG_Reconnect_ConsumerEC_Control_Adapter - : public ACE_Event_Handler -{ -public: - /// Constructor - TAO_ECG_Reconnect_ConsumerEC_Control_Adapter (TAO_ECG_Reconnect_ConsumerEC_Control *adaptee); - - // = Documented in ACE_Event_Handler. - virtual int handle_timeout (const ACE_Time_Value &tv, - const void *arg = 0); - -private: - /// The adapted object - TAO_ECG_Reconnect_ConsumerEC_Control *adaptee_; -}; - -/** - * @class TAO_ECG_Reconnect_ConsumerEC_Control - * - * @brief Consumer event channel control - * - * Defines the interface for the consumer event channel control strategy. - * This strategy handles misbehaving or failing consumer event channels. - * - * This control tries to reconnect to the consumer ec incase of a connection - * loss and then does a reconnect when the connection is back again. When also - * a restart of the consumer ec must be handled correctly, then the consumer - * ec must use a persistent IOR. - */ -class TAO_RTEvent_Serv_Export TAO_ECG_Reconnect_ConsumerEC_Control - : public TAO_ECG_ConsumerEC_Control -{ -public: - /// Constructor. It does not assume ownership of the @a event_channel - /// parameter. - TAO_ECG_Reconnect_ConsumerEC_Control (const ACE_Time_Value &rate, - const ACE_Time_Value &timeout, - TAO_EC_Gateway_IIOP* gateway, - CORBA::ORB_ptr orb); - - /// Destructor. - virtual ~TAO_ECG_Reconnect_ConsumerEC_Control (void); - - /// Receive the timeout from the adapter - void handle_timeout (const ACE_Time_Value &tv, - const void* arg); - - // = Documented in TAO_EC_ConsumerControl - virtual int activate (void); - virtual int shutdown (void); - virtual void event_channel_not_exist (TAO_EC_Gateway_IIOP *gateway - ACE_ENV_ARG_DECL_NOT_USED); - virtual void system_exception (TAO_EC_Gateway_IIOP *gateway, - CORBA::SystemException & - ACE_ENV_ARG_DECL_NOT_USED); - -private: - /// Check if the consumers still exists. It is a helper method for - /// handle_timeout() to isolate the exceptions. - void query_eventchannel (ACE_ENV_SINGLE_ARG_DECL); - - /// Look if we can reconnect again. - void try_reconnect (ACE_ENV_SINGLE_ARG_DECL); - - /// Reconnect to the consumer ec. - void reconnect (ACE_ENV_SINGLE_ARG_DECL); - -private: - /// The polling rate - ACE_Time_Value rate_; - - /// The polling timeout - ACE_Time_Value timeout_; - - /// The Adapter for the reactor events - TAO_ECG_Reconnect_ConsumerEC_Control_Adapter adapter_; - - /// The gateway - TAO_EC_Gateway_IIOP* gateway_; - - /// The ORB - CORBA::ORB_var orb_; - - /// To control the timeout policy in the thread - CORBA::PolicyCurrent_var policy_current_; - - /// Precomputed policy list to the set timeout. - CORBA::PolicyList policy_list_; - - /// The ORB reactor - ACE_Reactor *reactor_; - - /// Do we have a connection to the consumer ec - int is_consumer_ec_connected_; - -#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 - /// The timer id - long timer_id_; -#endif /* TAO_HAS_CORBA_MESSAGING */ -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* TAO_ECG_RECONNECT_CONSUMEREC_CONTROL_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.cpp deleted file mode 100644 index 064d5c35183..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/ECG_Simple_Address_Server.h" - -#if !defined(__ACE_INLINE__) -#include "orbsvcs/Event/ECG_Simple_Address_Server.i" -#endif /* __ACE_INLINE__ */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_ECG_Simple_Address_Server::TAO_ECG_Simple_Address_Server (void) -{ -} - -TAO_ECG_Simple_Address_Server::~TAO_ECG_Simple_Address_Server (void) -{ -} - -int -TAO_ECG_Simple_Address_Server::init (const char *mcast_addr) -{ - return this->addr_.set (mcast_addr); -} - -void -TAO_ECG_Simple_Address_Server::get_addr ( - const RtecEventComm::EventHeader& /*header*/, - RtecUDPAdmin::UDP_Addr_out addr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - // unsigned long - addr.ipaddr = this->addr_.get_ip_address (); - // unsigned short - addr.port = this->addr_.get_port_number (); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.h b/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.h deleted file mode 100644 index 4c0cb219ccc..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.h +++ /dev/null @@ -1,69 +0,0 @@ -// -*- C++ -*- - -/** - * @file ECG_Simple_Address_Server.h - * - * $Id$ - * - * @author Marina Spivak (marina@atdesk.com) - * - */ - -#ifndef TAO_ECG_SIMPLE_ADDRESS_SERVER_H -#define TAO_ECG_SIMPLE_ADDRESS_SERVER_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/RtecUDPAdminS.h" -#include "orbsvcs/Event/EC_Lifetime_Utils_T.h" -#include "ace/INET_Addr.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_ECG_Simple_Address_Server - * - * @brief Basic implementation of RtecUDPAdmin idl interface. - * - * This simple server always returns multicast address it was - * initialized with, regardless of the header. - */ -class TAO_RTEvent_Serv_Export TAO_ECG_Simple_Address_Server : - public virtual POA_RtecUDPAdmin::AddrServer -{ -public: - - /// Create a new TAO_ECG_Simple_Address_Server object. - /// (Constructor access is restricted to insure that all - /// TAO_ECG_Simple_Address_Server objects are heap-allocated.) - static TAO_EC_Servant_Var<TAO_ECG_Simple_Address_Server> create (void); - - /// Destructor - virtual ~TAO_ECG_Simple_Address_Server (void); - - int init (const char *arg); - - // = The RtecUDPAdmin::AddrServer methods - virtual void get_addr (const RtecEventComm::EventHeader& header, - RtecUDPAdmin::UDP_Addr_out addr - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - -protected: - - /// Constructor (protected). Clients can create new - /// TAO_ECG_Simple_Address_Server objects using the static create() - /// method. - TAO_ECG_Simple_Address_Server (void); - -private: - ACE_INET_Addr addr_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined(__ACE_INLINE__) -#include "orbsvcs/Event/ECG_Simple_Address_Server.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* TAO_ECG_SIMPLE_ADDRESS_SERVER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.i b/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.i deleted file mode 100644 index 0aa18cada97..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.i +++ /dev/null @@ -1,17 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE TAO_EC_Servant_Var<TAO_ECG_Simple_Address_Server> -TAO_ECG_Simple_Address_Server::create (void) -{ - TAO_EC_Servant_Var<TAO_ECG_Simple_Address_Server> s; - ACE_NEW_RETURN (s, - TAO_ECG_Simple_Address_Server, - s); - return s; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Mcast_EH.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Mcast_EH.cpp deleted file mode 100644 index fa40043a50f..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Mcast_EH.cpp +++ /dev/null @@ -1,98 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/ECG_Simple_Mcast_EH.h" -#include "ace/Log_Msg.h" -#include "ace/Reactor.h" -#include "ace/os_include/os_fcntl.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_ECG_Simple_Mcast_EH::TAO_ECG_Simple_Mcast_EH (TAO_ECG_Dgram_Handler *recv) - : receiver_ (recv) -{ - ACE_ASSERT (this->receiver_); -} - -TAO_ECG_Simple_Mcast_EH::~TAO_ECG_Simple_Mcast_EH (void) -{ -} - -int -TAO_ECG_Simple_Mcast_EH::open (const char * mcast_addr, - const ACE_TCHAR *net_if) -{ - // Check that we haven't been closed already. - if (!this->receiver_) - return -1; - - if (mcast_addr == 0) - return -1; - - ACE_INET_Addr mcast_group; - if (mcast_group.set (mcast_addr) != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to open mcast handler: " - "error using specified address %s " - "in ACE_INET.set ().\n", - mcast_addr), - -1); - - if (this->dgram_.subscribe (mcast_group, 1, net_if) != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to open mcast handler: error " - "subscribing to %s\n", - mcast_addr), - -1); - - (void) dgram_.enable(ACE_NONBLOCK); - - if (!this->reactor () - || 0 != this->reactor ()->register_handler (this->dgram_.get_handle (), - this, - ACE_Event_Handler::READ_MASK)) - { - this->dgram_.close (); - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot register handler with reactor.\n"), - -1); - } - - return 0; -} - -int -TAO_ECG_Simple_Mcast_EH::shutdown (void) -{ - // Already shut down. - if (!this->receiver_) - return -1; - - int result = 0; - if (this->reactor ()) - { - result = this->reactor ()->remove_handler (this->dgram_.get_handle (), - ACE_Event_Handler::READ_MASK); - } - if (result != 0) - ACE_ERROR ((LM_ERROR, - "Unable to deregister handler from reactor " - "on shutdown.\n")); - - result = this->dgram_.close (); - if (result != 0) - ACE_ERROR ((LM_ERROR, - "Unable to close mcast receiving dgram " - "on shutdown.\n")); - - this->receiver_ = 0; - - return result; -} - -int -TAO_ECG_Simple_Mcast_EH::handle_input (ACE_HANDLE /* fd */) -{ - return this->receiver_->handle_input (this->dgram_); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Mcast_EH.h b/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Mcast_EH.h deleted file mode 100644 index d15ff0c82c6..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Mcast_EH.h +++ /dev/null @@ -1,96 +0,0 @@ -// -*- C++ -*- - -/** - * @file ECG_Simple_Mcast_EH.h - * - * $Id$ - * - * @author Marina Spivak <marina@atdesk.com> - * - */ -#ifndef TAO_ECG_SIMPLE_MCAST_EH_H -#define TAO_ECG_SIMPLE_MCAST_EH_H -#include /**/ "ace/pre.h" - -#include "ace/Event_Handler.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include /**/ "orbsvcs/Event/event_serv_export.h" -#include "orbsvcs/Event/ECG_Adapters.h" -#include "ace/SOCK_Dgram_Mcast.h" - - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_ECG_Simple_Mcast_EH - * - * @brief Simple Event Handler for mcast messages. Listens for - * messages on a single mcast group. Useful in environments - * where event traffic is not separated into different groups. - * Calls handle_input (ACE_SOCK_Dgram_Mcast dgram) on a specified - * TAO_ECG_Dgram_Handler to inform it about message arrival. - * - * NOT THREAD-SAFE. - */ -class TAO_RTEvent_Serv_Export TAO_ECG_Simple_Mcast_EH - : public ACE_Event_Handler - , public TAO_ECG_Handler_Shutdown -{ -public: - - /// Initialization and termination methods. - //@{ - /// Constructor. - /// Messages received by this EH will be forwarded to the <recv>. - /* - * See comments for <receiver_> data member on why raw pointer is - * used for the <recv> argument. - */ - TAO_ECG_Simple_Mcast_EH (TAO_ECG_Dgram_Handler *recv); - - /// Destructor. - virtual ~TAO_ECG_Simple_Mcast_EH (void); - - /// Join the specified multicast group and register itself with the - /// reactor. - /// To insure proper resource clean up, if open () is successful, - /// the user MUST call shutdown () when handler is no longer needed - /// (and its reactor still exists). - int open (const char * mcast_addr, - const ACE_TCHAR *net_if = 0); - - /// TAO_ECG_Handler_Shutdown method. - /// Unsubscribe from the reactor and close the datagram. - virtual int shutdown (void); - //@} - - /// Main method - reactor callback. Notify <receiver_> that - /// <dgram_> is ready for reading. - virtual int handle_input (ACE_HANDLE fd); - -private: - - // Socket on which we listen for messages. - ACE_SOCK_Dgram_Mcast dgram_; - - /// We callback to this object when a message arrives. - /* - * We can keep a raw pointer to the receiver (even though it may - * be a refcounted object) because receiver guarantees - * to notify us (by calling shutdown ()) before going away. - * - * We have to use raw pointer instead of a refcounting mechanism - * here to avoid a circular refcounting dependency between - * receiver and handler. - */ - TAO_ECG_Dgram_Handler* receiver_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* TAO_ECG_SIMPLE_Mcast_EH_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_EH.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_EH.cpp deleted file mode 100644 index 257a8ff2c3b..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_EH.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/ECG_UDP_EH.h" -#include "ace/Reactor.h" -#include "ace/INET_Addr.h" - -#if !defined(__ACE_INLINE__) -#include "orbsvcs/Event/ECG_UDP_EH.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, ECG_UDP_EH, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_ECG_UDP_EH::TAO_ECG_UDP_EH (TAO_ECG_Dgram_Handler *recv) - : receiver_ (recv) -{ - ACE_ASSERT (this->receiver_); -} - -TAO_ECG_UDP_EH::~TAO_ECG_UDP_EH (void) -{ -} - -int -TAO_ECG_UDP_EH::open (const ACE_INET_Addr& ipaddr, - int reuse_addr) -{ - // Check that we haven't been closed already. - if (!this->receiver_) - return -1; - - if (this->dgram_.open (ipaddr, PF_INET, 0, reuse_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to open udp handler: " - "error opening receiving dgram.\n"), - -1); - - if (!this->reactor () - || 0 != this->reactor ()->register_handler (this->dgram_.get_handle (), - this, - ACE_Event_Handler::READ_MASK)) - { - this->dgram_.close (); - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot register handler with reactor.\n"), - -1); - } - - return 0; -} - -int -TAO_ECG_UDP_EH::shutdown (void) -{ - // Already shut down. - if (!this->receiver_) - return -1; - - int result = 0; - if (this->reactor ()) - { - result = this->reactor ()->remove_handler (this->dgram_.get_handle (), - ACE_Event_Handler::READ_MASK); - } - if (result != 0) - ACE_ERROR ((LM_ERROR, - "Unable to deregister handler from reactor " - "on shutdown.\n")); - - result = this->dgram_.close (); - if (result != 0) - ACE_ERROR ((LM_ERROR, - "Unable to close receiving dgram on shutdown.\n")); - - this->receiver_ = 0; - - return result; -} - -int -TAO_ECG_UDP_EH::handle_input (ACE_HANDLE) -{ - return this->receiver_->handle_input (this->dgram_); -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -// **************************************************************** diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_EH.h b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_EH.h deleted file mode 100644 index b87d4d9c745..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_EH.h +++ /dev/null @@ -1,110 +0,0 @@ -// -*- C++ -*- - -/** - * @file ECG_UDP_EH.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * @author Marina Spivak (marina@atdesk.com) - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_ECG_UDP_EH_H -#define TAO_ECG_UDP_EH_H -#include /**/ "ace/pre.h" - -#include "ace/Event_Handler.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include /**/ "orbsvcs/Event/event_serv_export.h" -#include "orbsvcs/Event/ECG_Adapters.h" -#include "ace/SOCK_Dgram.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_ECG_UDP_Receiver; - -/** - * @class TAO_ECG_UDP_EH - * - * @brief Event Handler for UDP messages. - * - * Listens for messages on a UDP socket. When there is a message, - * calls handle_input () on a specified TAO_ECG_Dgram_Handler to - * inform it about message arrival. - * - * NOT THREAD-SAFE. - */ -class TAO_RTEvent_Serv_Export TAO_ECG_UDP_EH : - public ACE_Event_Handler -, public TAO_ECG_Handler_Shutdown -{ -public: - - /// Initialization and termination methods. - //@{ - /// Constructor. - /// Messages received by this EH will be forwarded to the <recv>. - /* - * See comments for <receiver_> data member on why raw pointer is - * used for the <recv> argument. - */ - TAO_ECG_UDP_EH (TAO_ECG_Dgram_Handler *recv); - - /// Destructor. - virtual ~TAO_ECG_UDP_EH (void); - - /// Open the datagram and register itself with this->reactor(). - /// To insure proper resource clean up, if open () is successful, - /// the user MUST call shutdown () when handler is no longer needed - /// (and its reactor still exists). - int open (const ACE_INET_Addr& ipaddr, - int reuse_addr = 0); - - /// TAO_ECG_Handler_Shutdown method. - /// Unsubscribe from the reactor and close the datagram. - virtual int shutdown (void); - //@} - - /// Main method - reactor callback. Notify <receiver_> that - /// <dgram_> is ready for reading. - virtual int handle_input (ACE_HANDLE fd); - - /** - * Obtain the dgram, this is one of those "controlled violations of - * type safety", allowing the user to setup options and gain access - * to low-level features. - */ - ACE_SOCK_Dgram &dgram (void); - -private: - - /// The datagram used to receive the data. - ACE_SOCK_Dgram dgram_; - - /// We callback to this object when a message arrives. - /* - * We can keep a raw pointer to the receiver (even though it may - * be a refcounted object) because receiver guarantees - * to notify us (by calling shutdown ()) before going away. - * - * We have to use raw pointer instead of a refcounting mechanism - * here to avoid a circular refcounting dependency between - * receiver and handler. - */ - TAO_ECG_Dgram_Handler* receiver_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined(__ACE_INLINE__) -#include "orbsvcs/Event/ECG_UDP_EH.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* TAO_ECG_UDP_EH_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_EH.i b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_EH.i deleted file mode 100644 index d84f70937b8..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_EH.i +++ /dev/null @@ -1,13 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ACE_SOCK_Dgram& -TAO_ECG_UDP_EH::dgram (void) -{ - return this->dgram_; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Out_Endpoint.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Out_Endpoint.cpp deleted file mode 100644 index 8b6fb71a6fe..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Out_Endpoint.cpp +++ /dev/null @@ -1,83 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/ECG_UDP_Out_Endpoint.h" -#include "ace/INET_Addr.h" -#include "ace/Sock_Connect.h" - -#if !defined(__ACE_INLINE__) -#include "orbsvcs/Event/ECG_UDP_Out_Endpoint.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, ECG_UDP_Out_Endpoint, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_ECG_UDP_Out_Endpoint::~TAO_ECG_UDP_Out_Endpoint (void) -{ - this->dgram_.close (); - - delete [] this->ifs_; -} - -CORBA::Boolean -TAO_ECG_UDP_Out_Endpoint::is_loopback (const ACE_INET_Addr& from) -{ - if (this->port_number_ == 0) - { - // Cache the port number... - ACE_INET_Addr local_addr; - if (this->dgram ().get_local_addr (local_addr) == -1) - return false; - this->port_number_ = local_addr.get_port_number (); - } - - // Most of the time the port number is enough to determine if the - // message is remote, only when the local port number and the remote - // port number match we have to look at the local ip addresses. - if (from.get_port_number () != this->port_number_) - return false; - - if (this->ifs_ == 0) - { - ACE::get_ip_interfaces (this->if_count_, this->ifs_); - } - - for (ACE_INET_Addr* i = this->ifs_; - i != this->ifs_ + this->if_count_; - ++i) - { - if ((*i).get_ip_address () == from.get_ip_address ()) - return true; - } - return false; -} - -TAO_ECG_UDP_Out_Endpoint& -TAO_ECG_UDP_Out_Endpoint::operator= (const TAO_ECG_UDP_Out_Endpoint& rhs) -{ - if (this != &rhs) - { - this->request_id_generator_ = rhs.request_id_generator_; - this->dgram_ = rhs.dgram_; - this->port_number_ = rhs.port_number_; - this->if_count_ = rhs.if_count_; - - delete [] this->ifs_; - this->ifs_ = 0; - - if (this->if_count_ != 0) - { - ACE_NEW_RETURN (this->ifs_, - ACE_INET_Addr [this->if_count_], - *this); - for(size_t i = 0; i < this->if_count_; ++i) - { - this->ifs_[i] = rhs.ifs_[i]; - } - } - } - - return *this; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Out_Endpoint.h b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Out_Endpoint.h deleted file mode 100644 index a967401e6e6..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Out_Endpoint.h +++ /dev/null @@ -1,108 +0,0 @@ -// -*- C++ -*- - -/** - * @file ECG_UDP_Out_Endpoint.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * @author Marina Spivak (marina@atdesk.com) - */ - -#ifndef TAO_ECG_UDP_OUT_ENDPOINT_H -#define TAO_ECG_UDP_OUT_ENDPOINT_H - -#include /**/ "ace/pre.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/Basic_Types.h" -#include "tao/orbconf.h" - -#include "ace/Refcounted_Auto_Ptr.h" -#include "ace/SOCK_Dgram.h" -#include "ace/Atomic_Op.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -class ACE_INET_Addr; -ACE_END_VERSIONED_NAMESPACE_DECL - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_ECG_UDP_Out_Endpoint - * - * @brief Maintains information about an outgoing endpoint. - * - * UDP senders can share a single endpoint to send UDP packets, - * but there is more state associated with this endpoint than its - * datagram SAP; for instance we need to keep track of the request - * id. - */ -class TAO_RTEvent_Serv_Export TAO_ECG_UDP_Out_Endpoint -{ -public: - /// Constructor - TAO_ECG_UDP_Out_Endpoint (void); - - /// Constructor - ~TAO_ECG_UDP_Out_Endpoint (void); - - /// Copy Constructor - TAO_ECG_UDP_Out_Endpoint (const TAO_ECG_UDP_Out_Endpoint& rhs); - - /// Assignment operator - TAO_ECG_UDP_Out_Endpoint& operator= (const TAO_ECG_UDP_Out_Endpoint& rhs); - - /// Obtain the datagram associated with this endpoint. Clients of - /// this class must open, and register (if necessary) this datagram. - ACE_SOCK_Dgram& dgram (void); - - /// Obtain the next request id. - CORBA::ULong next_request_id (void); - - /// The endpoint can detect if a data-gram was sent by itself, this - /// is useful to ignore or remove messages sent by the same process. - CORBA::Boolean is_loopback (const ACE_INET_Addr& from); - -private: - /// The request id.... - ACE_Atomic_Op<TAO_SYNCH_MUTEX,CORBA::ULong> request_id_generator_; - - /// The datagram.... - ACE_SOCK_Dgram dgram_; - - /// Cache the port-number so we can quickly determine if an event is - /// coming from another endpoint. - u_short port_number_; - - /// Keep the list of local interfaces, needed for the is_loopback - /// method. - size_t if_count_; - ACE_INET_Addr* ifs_; -}; - -/** - * @typedef TAO_ECG_Refcounted_Endpoint - * - * @brief Reference counted pointer to TAO_ECG_UDP_Out_Endpoint - * - * Instances of TAO_ECG_UDP_Out_Endpoint are used by multiple objects - * in the Event Channel gateways, the endpoints are reference counted - * to manage their lifetime automatically. - */ -typedef ACE_Refcounted_Auto_Ptr<TAO_ECG_UDP_Out_Endpoint,ACE_Null_Mutex> TAO_ECG_Refcounted_Endpoint; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined(__ACE_INLINE__) -#include "orbsvcs/Event/ECG_UDP_Out_Endpoint.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* TAO_ECG_UDP_OUT_ENDPOINT_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Out_Endpoint.i b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Out_Endpoint.i deleted file mode 100644 index 9f8fd0df5f3..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Out_Endpoint.i +++ /dev/null @@ -1,37 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_ECG_UDP_Out_Endpoint::TAO_ECG_UDP_Out_Endpoint (void) - : port_number_ (0), - if_count_ (0), - ifs_ (0) -{ -} - -ACE_INLINE -TAO_ECG_UDP_Out_Endpoint::TAO_ECG_UDP_Out_Endpoint ( - const TAO_ECG_UDP_Out_Endpoint& rhs) - : port_number_ (0), - if_count_ (0), - ifs_ (0) -{ - *this = rhs; -} - -ACE_INLINE ACE_SOCK_Dgram& -TAO_ECG_UDP_Out_Endpoint::dgram (void) -{ - return this->dgram_; -} - -ACE_INLINE CORBA::ULong -TAO_ECG_UDP_Out_Endpoint::next_request_id (void) -{ - return this->request_id_generator_++; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.cpp deleted file mode 100644 index 1a492f72d66..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.cpp +++ /dev/null @@ -1,250 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/ECG_UDP_Receiver.h" -#include "orbsvcs/Event_Utilities.h" -#include "ace/SString.h" - -#if !defined(__ACE_INLINE__) -#include "orbsvcs/Event/ECG_UDP_Receiver.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (Event, - ECG_UDP_Receiver, - "$Id$") - - -// **************************************************************** - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_ECG_UDP_Receiver::~TAO_ECG_UDP_Receiver (void) -{ - this->consumer_proxy_ = - RtecEventChannelAdmin::ProxyPushConsumer::_nil (); - - if (this->handler_rptr_.get ()) - this->handler_rptr_->shutdown (); -} - -void -TAO_ECG_UDP_Receiver::init (RtecEventChannelAdmin::EventChannel_ptr lcl_ec, - TAO_ECG_Refcounted_Endpoint ignore_from, - RtecUDPAdmin::AddrServer_ptr addr_server - ACE_ENV_ARG_DECL) -{ - // Verify arguments. - // <addr_server> is allowed to be nil. But then, if get_addr () method - // is invoked, it throws an exception. - if (CORBA::is_nil (lcl_ec)) - { - ACE_ERROR ((LM_ERROR, - "TAO_ECG_UDP_Receiver::init(): " - "<lcl_ec> argument is nil.\n")); - ACE_THROW (CORBA::INTERNAL ()); - } - - this->cdr_receiver_.init (ignore_from); - - this->lcl_ec_ = - RtecEventChannelAdmin::EventChannel::_duplicate (lcl_ec); - - this->addr_server_ = - RtecUDPAdmin::AddrServer::_duplicate (addr_server); -} - -void -TAO_ECG_UDP_Receiver::connect (const RtecEventChannelAdmin::SupplierQOS& pub - ACE_ENV_ARG_DECL) -{ - if (CORBA::is_nil (this->lcl_ec_.in ())) - { - ACE_ERROR ((LM_ERROR, - "Error initializing TAO_ECG_UDP_Receiver: " - "init() hasn't been called before connect().\n")); - ACE_THROW (CORBA::INTERNAL ()); - } - - if (pub.publications.length () == 0) - { - ACE_ERROR ((LM_ERROR, - "TAO_ECG_UDP_Receiver::connect(): " - "0-length publications argument.\n")); - ACE_THROW (CORBA::INTERNAL ()); - } - - if (CORBA::is_nil (this->consumer_proxy_.in ())) - { - this->new_connect (pub ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - else - { - this->reconnect (pub ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } -} - -void -TAO_ECG_UDP_Receiver::new_connect (const RtecEventChannelAdmin::SupplierQOS& pub - ACE_ENV_ARG_DECL) -{ - // Activate with poa. - RtecEventComm::PushSupplier_var supplier_ref; - PortableServer::POA_var poa = this->_default_POA (); - - TAO_EC_Object_Deactivator deactivator; - activate (supplier_ref, - poa.in (), - this, - deactivator - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // Connect as a supplier to the local EC. - RtecEventChannelAdmin::SupplierAdmin_var supplier_admin = - this->lcl_ec_->for_suppliers (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - RtecEventChannelAdmin::ProxyPushConsumer_var proxy = - supplier_admin->obtain_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - ECG_Receiver_Auto_Proxy_Disconnect new_proxy_disconnect (proxy.in ()); - - proxy->connect_push_supplier (supplier_ref.in (), - pub - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // Update resource managers. - this->consumer_proxy_ = proxy._retn (); - this->auto_proxy_disconnect_.set_command (new_proxy_disconnect); - this->set_deactivator (deactivator); -} - -void -TAO_ECG_UDP_Receiver::reconnect (const RtecEventChannelAdmin::SupplierQOS& pub - ACE_ENV_ARG_DECL) -{ - // Obtain our object reference from the POA. - RtecEventComm::PushSupplier_var supplier_ref; - PortableServer::POA_var poa = this->_default_POA (); - - CORBA::Object_var obj = poa->servant_to_reference (this ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - supplier_ref = - RtecEventComm::PushSupplier::_narrow (obj.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (CORBA::is_nil (supplier_ref.in ())) - { - ACE_THROW (CORBA::INTERNAL ()); - } - - // Reconnect. - this->consumer_proxy_->connect_push_supplier (supplier_ref.in (), - pub - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_ECG_UDP_Receiver::disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - // Prevent attempts to disconnect. - this->auto_proxy_disconnect_.disallow_command (); - - this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -void -TAO_ECG_UDP_Receiver::shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) -{ - if (this->handler_rptr_.get ()) - this->handler_rptr_->shutdown (); - TAO_ECG_Refcounted_Handler empty_handler_rptr; - this->handler_rptr_ = empty_handler_rptr; - - this->consumer_proxy_ = - RtecEventChannelAdmin::ProxyPushConsumer::_nil (); - - this->auto_proxy_disconnect_.execute (); - - this->deactivator_.deactivate (); - - this->cdr_receiver_.shutdown (); -} - -// Helper class for using <cdr_receiver_>. -class TAO_ECG_Event_CDR_Decoder: public TAO_ECG_CDR_Processor -{ -public: - virtual int decode (TAO_InputCDR &cdr); - - RtecEventComm::EventSet events; -}; - -int -TAO_ECG_Event_CDR_Decoder::decode (TAO_InputCDR &cdr) -{ - if (!(cdr >> this->events)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Error decoding events cdr.\n"), - -1); - } - return 0; -} - -int -TAO_ECG_UDP_Receiver::handle_input (ACE_SOCK_Dgram& dgram) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - // Make sure we are connected to the Event Channel before proceeding - // any further. - if (CORBA::is_nil (this->consumer_proxy_.in ())) - { - ACE_ERROR ((LM_ERROR, - "TAO_ECG_UDP_Receiver::handle_input() " - "called but the Receiver is not connected " - "to an event channel. Shutting down the Receiver.\n")); - this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - return 0; - } - - // Receive data. - TAO_ECG_Event_CDR_Decoder cdr_decoder; - int result = this->cdr_receiver_.handle_input (dgram, &cdr_decoder); - - if (result == 0) - // No data to act on. - { - return 0; - } - if (result == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Error receiving multicasted events.\n"), - 0); - } - - this->consumer_proxy_->push (cdr_decoder.events ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - - ACE_CATCHANY - { - ACE_DEBUG ((LM_ERROR, - "Caught and swallowed EXCEPTION in " - "ECG_UDP_Receiver::handle_input: %s\n", - ACE_ANY_EXCEPTION._info ().c_str ())); - } - ACE_ENDTRY; - return 0; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.h b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.h deleted file mode 100644 index 3b5a4f686dc..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.h +++ /dev/null @@ -1,239 +0,0 @@ -// -*- C++ -*- - -/** - * @file ECG_UDP_Receiver.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * @author Marina Spivak (marina@atdesk.com) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - * - * Define helper classes to propagate events between ECs using - * either UDP or multicast. - * The architecture is a bit complicated and deserves some - * explanation: sending the events over UDP (or mcast) is easy, a - * Consumer (TAO_ECG_UDP_Sender) subscribes for a certain set of - * events, its push() method marshalls the event set into a CDR - * stream that is sent using an ACE_SOCK_Dgram. The subscription - * set and IP address can be configured. - * Another helper class (TAO_ECG_UDP_Receiver) acts as a supplier of - * events; it receives a callback when an event is available on an - * ACE_SOCK_Dgram, it demarshalls the event and pushes it to the - * EC. Two ACE_Event_Handler classes are provided that can forward - * the events to this Supplier: TAO_ECG_Mcast_EH can receive events - * from a multicast group; TAO_ECG_UDP_EH can receive events from a - * regular UDP socket. - * - * @todo The class makes an extra copy of the events, we need to - * investigate if closer collaboration with its collocated EC could - * be used to remove that copy. - */ - -#ifndef TAO_ECG_UDP_RECEIVER_H -#define TAO_ECG_UDP_RECEIVER_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/RtecUDPAdminS.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/RtecEventChannelAdminS.h" -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#include "orbsvcs/Event/ECG_Adapters.h" -#include "orbsvcs/Event/EC_Lifetime_Utils.h" -#include "orbsvcs/Event/EC_Lifetime_Utils_T.h" -#include "orbsvcs/Event/ECG_CDR_Message_Receiver.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -class ACE_Reactor; -ACE_END_VERSIONED_NAMESPACE_DECL - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_ECG_UDP_Out_Endpoint; - -/** - * @class TAO_ECG_UDP_Receiver_Disconnect_Command - * - * @brief Disconnects supplier represented by @a proxy from the Event Channel. - * - * Utility class for use as a template argument to TAO_EC_Auto_Command. - * TAO_EC_Auto_Command<TAO_ECG_UDP_Receiver_Disconnect_Command> manages - * supplier connection to the Event Channel, automatically disconnecting from - * @a proxy in its destructor, if necessary. - */ -class TAO_RTEvent_Serv_Export TAO_ECG_UDP_Receiver_Disconnect_Command -{ -public: - TAO_ECG_UDP_Receiver_Disconnect_Command (void); - TAO_ECG_UDP_Receiver_Disconnect_Command ( - RtecEventChannelAdmin::ProxyPushConsumer_ptr proxy); - - TAO_ECG_UDP_Receiver_Disconnect_Command ( - const TAO_ECG_UDP_Receiver_Disconnect_Command & rhs); - - TAO_ECG_UDP_Receiver_Disconnect_Command & - operator= (const TAO_ECG_UDP_Receiver_Disconnect_Command & rhs); - - void execute (ACE_ENV_SINGLE_ARG_DECL); - -private: - - RtecEventChannelAdmin::ProxyPushConsumer_var proxy_; -}; - -/** - * @class TAO_ECG_UDP_Receiver - * - * @brief Receive events from UDP or Multicast and push them to a - * "local" EC. - * NOT THREAD-SAFE. - * - * This class connects as a supplier to an EventChannel, and supplies - * to it all events it receives via UDP or Multicast. - */ -class TAO_RTEvent_Serv_Export TAO_ECG_UDP_Receiver : - public virtual POA_RtecEventComm::PushSupplier - , public virtual TAO_EC_Deactivated_Object - , public virtual TAO_ECG_Dgram_Handler -{ -public: - - /// Initialization and termination methods. - //@{ - - /// Create a new TAO_ECG_UDP_Receiver object. - /// (Constructor access is restricted to insure that all - /// TAO_ECG_UDP_Receiver objects are heap-allocated.) - static TAO_EC_Servant_Var<TAO_ECG_UDP_Receiver> create (CORBA::Boolean perform_crc = 0); - - ~TAO_ECG_UDP_Receiver (void); - - /** - * @param lcl_ec Event Channel to which we will act as a supplier of events. - * @param ignore_from Endpoint used to remove events generated by - * the same process. - * @param addr_server Address server used to obtain mapping of event type - * to multicast group. - * To insure proper resource clean up, if init () is successful, - * shutdown () must be called when the receiver is no longer needed. - * This is done by disconnect_push_supplier() method. If - * disconnect_push_supplier() will not be called, it is the - * responsibility of the user. - * Furthermore, if shutdown() is not explicitly called by - * either disconnect_push_supplier () or the user, the receiver - * will clean up the resources in its destructor, however, certain - * entities involved in cleanup must still exist at that point, - * e.g., POA. - */ - void init (RtecEventChannelAdmin::EventChannel_ptr lcl_ec, - TAO_ECG_Refcounted_Endpoint ignore_from, - RtecUDPAdmin::AddrServer_ptr addr_server - ACE_ENV_ARG_DECL); - - /// Connect or reconnect to the EC with the given publications. - /** - * @note If we are already connected to EC and a reconnection is - * necessary, the EC must have reconnects enabled in order for this - * method to succeed. - */ - void connect (const RtecEventChannelAdmin::SupplierQOS& pub - ACE_ENV_ARG_DECL); - - /// Set the handler we must notify when shutdown occurs. (This is - /// the handler that alerts us when data is available on udp/mcast socket.) - /// Shutdown notification gives the handler an opportunity to properly clean - /// up resources. - void set_handler_shutdown (TAO_ECG_Refcounted_Handler handler_shutdown_rptr); - - /// Deactivate from POA and disconnect from EC, if necessary. Shut - /// down all receiver components. - /** - * If this class is used with refcounting, calling this method may - * result in decrementing of the reference count (due to - * deactivation) and deletion of the object. - */ - void shutdown (ACE_ENV_SINGLE_ARG_DECL); - //@} - - /// Accessor. - /// Call the RtecUDPAdmin::AddrServer::get_addr. Throws exception - /// if nill Address Server was specified in init (). - void get_addr (const RtecEventComm::EventHeader& header, - RtecUDPAdmin::UDP_Addr_out addr - ACE_ENV_ARG_DECL); - - /// The PushSupplier idl method. - /// Invokes shutdown (), which may result in the object being deleted, if - /// refcounting is used to manage its lifetime. - virtual void disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// TAO_ECG_Dgram_Handler method. - /** - * UDP/Multicast Event_Handlers call this method when data is - * available at the socket - the <dgram> is ready for reading. - * Data is read from the socket, and, if complete message is - * received, the event is pushed to the local Event Channel. - */ - virtual int handle_input (ACE_SOCK_Dgram& dgram); - -protected: - - /// Constructor (protected). Clients can create new - /// TAO_ECG_UDP_Receiver objects using the static create() method. - TAO_ECG_UDP_Receiver (CORBA::Boolean perform_crc = 0); - -private: - - /// Helpers for the connect() method. - //@{ - // Establishes connection to the Event Channel for the first time. - void new_connect (const RtecEventChannelAdmin::SupplierQOS& pub - ACE_ENV_ARG_DECL); - - // Updates existing connection to the Event Channel. - void reconnect (const RtecEventChannelAdmin::SupplierQOS& pub - ACE_ENV_ARG_DECL); - //@} - - /// Event Channel to which we act as a supplier. - RtecEventChannelAdmin::EventChannel_var lcl_ec_; - - /// The server used to map event types to multicast groups. - RtecUDPAdmin::AddrServer_var addr_server_; - - /// Proxy used to supply events to the Event Channel. - RtecEventChannelAdmin::ProxyPushConsumer_var consumer_proxy_; - - /// Helper for reading incoming UDP/Multicast messages. It assembles - /// message fragments and provides access to a cdr stream once the - /// complete message has been received. - TAO_ECG_CDR_Message_Receiver cdr_receiver_; - - /// Handler we must notify when shutdown occurs, so it has an - /// opportunity to clean up resources. - TAO_ECG_Refcounted_Handler handler_rptr_; - - typedef TAO_EC_Auto_Command<TAO_ECG_UDP_Receiver_Disconnect_Command> - ECG_Receiver_Auto_Proxy_Disconnect; - /// Manages our connection to Consumer Proxy. - ECG_Receiver_Auto_Proxy_Disconnect auto_proxy_disconnect_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined(__ACE_INLINE__) -#include "orbsvcs/Event/ECG_UDP_Receiver.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* TAO_ECG_UDP_RECEIVER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.i b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.i deleted file mode 100644 index 47eb3d83958..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.i +++ /dev/null @@ -1,106 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_ECG_UDP_Receiver_Disconnect_Command:: -TAO_ECG_UDP_Receiver_Disconnect_Command (void) - : proxy_ () -{ -} - -ACE_INLINE -TAO_ECG_UDP_Receiver_Disconnect_Command:: -TAO_ECG_UDP_Receiver_Disconnect_Command ( - RtecEventChannelAdmin::ProxyPushConsumer_ptr proxy) - : proxy_ (RtecEventChannelAdmin::ProxyPushConsumer::_duplicate (proxy)) -{ -} - -ACE_INLINE -TAO_ECG_UDP_Receiver_Disconnect_Command:: -TAO_ECG_UDP_Receiver_Disconnect_Command ( - const TAO_ECG_UDP_Receiver_Disconnect_Command & rhs) - : proxy_ (RtecEventChannelAdmin::ProxyPushConsumer::_duplicate - (rhs.proxy_.in ())) -{ -} - -ACE_INLINE -TAO_ECG_UDP_Receiver_Disconnect_Command & -TAO_ECG_UDP_Receiver_Disconnect_Command::operator= ( - const TAO_ECG_UDP_Receiver_Disconnect_Command & rhs) -{ - this->proxy_ = - RtecEventChannelAdmin::ProxyPushConsumer::_duplicate (rhs.proxy_.in ()); - - return *this; -} - -ACE_INLINE void -TAO_ECG_UDP_Receiver_Disconnect_Command:: -execute (ACE_ENV_SINGLE_ARG_DECL) -{ - if (CORBA::is_nil (this->proxy_.in ())) - // We are not connected. - return; - - RtecEventChannelAdmin::ProxyPushConsumer_var release_proxy = - this->proxy_._retn (); - - release_proxy->disconnect_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; -} - -//*************************************************************************** - -ACE_INLINE -TAO_ECG_UDP_Receiver::TAO_ECG_UDP_Receiver (CORBA::Boolean perform_crc) - : lcl_ec_ () - , addr_server_ () - , consumer_proxy_ () - , cdr_receiver_ (perform_crc) - , handler_rptr_ () - , auto_proxy_disconnect_ () -{ -} - -ACE_INLINE TAO_EC_Servant_Var<TAO_ECG_UDP_Receiver> -TAO_ECG_UDP_Receiver::create (CORBA::Boolean perform_crc) -{ - TAO_EC_Servant_Var<TAO_ECG_UDP_Receiver> r; - ACE_NEW_RETURN (r, - TAO_ECG_UDP_Receiver (perform_crc), - r); - return r; -} - -ACE_INLINE void -TAO_ECG_UDP_Receiver::set_handler_shutdown ( - TAO_ECG_Refcounted_Handler handler_shutdown_rptr) -{ - this->handler_rptr_ = handler_shutdown_rptr; -} - -ACE_INLINE void -TAO_ECG_UDP_Receiver::get_addr (const RtecEventComm::EventHeader& header, - RtecUDPAdmin::UDP_Addr_out addr - ACE_ENV_ARG_DECL) -{ - if (CORBA::is_nil (this->addr_server_.in ())) - { - ACE_ERROR ((LM_ERROR, - "TAO_ECG_UDP_Receiver::get_addr() called but " - "nil Address Server was supplied during " - "initialization through init().\n")); - - ACE_THROW (CORBA::INTERNAL ()); - } - - this->addr_server_->get_addr (header, addr - ACE_ENV_ARG_PARAMETER); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Sender.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Sender.cpp deleted file mode 100644 index 2cfc4b5f35f..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Sender.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/** - * @file ECG_UDP_Sender.cpp - * - * $Id$ - * - * @author Carlos O'Ryan <coryan@uci.edu> - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - * - */ - -#include "orbsvcs/Event/ECG_UDP_Sender.h" -#include "orbsvcs/Event_Utilities.h" -#include "tao/CDR.h" - -#if !defined(__ACE_INLINE__) -#include "orbsvcs/Event/ECG_UDP_Sender.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (Event, - ECG_UDP_Sender, - "$Id$") - -// **************************************************************** - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_ECG_UDP_Sender::~TAO_ECG_UDP_Sender (void) -{ -} - -void -TAO_ECG_UDP_Sender::init (RtecEventChannelAdmin::EventChannel_ptr lcl_ec, - RtecUDPAdmin::AddrServer_ptr addr_server, - TAO_ECG_Refcounted_Endpoint endpoint_rptr - ACE_ENV_ARG_DECL) -{ - if (CORBA::is_nil (lcl_ec)) - { - ACE_ERROR ((LM_ERROR, "TAO_ECG_UDP_Sender::init(): " - "<lcl_ec> argument is nil.")); - ACE_THROW (CORBA::INTERNAL ()); - } - - if (CORBA::is_nil (addr_server)) - { - ACE_ERROR ((LM_ERROR, "TAO_ECG_UDP_Sender::init(): " - "address server argument is nil.")); - ACE_THROW (CORBA::INTERNAL ()); - } - - this->cdr_sender_.init (endpoint_rptr ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->lcl_ec_ = - RtecEventChannelAdmin::EventChannel::_duplicate (lcl_ec); - - this->addr_server_ = - RtecUDPAdmin::AddrServer::_duplicate (addr_server); -} - -void -TAO_ECG_UDP_Sender::connect (const RtecEventChannelAdmin::ConsumerQOS& sub - ACE_ENV_ARG_DECL) -{ - if (CORBA::is_nil (this->lcl_ec_.in ())) - { - ACE_ERROR ((LM_ERROR, "Error initializing TAO_ECG_UDP_Sender: " - "init() has not been called before connect().")); - ACE_THROW (CORBA::INTERNAL ()); - } - - if (sub.dependencies.length () == 0) - { - ACE_ERROR ((LM_ERROR, "TAO_ECG_UDP_Sender::connect(): " - "0-length subscriptions argument.")); - ACE_THROW (CORBA::INTERNAL ()); - } - - if (CORBA::is_nil (this->supplier_proxy_.in ())) - { - this->new_connect (sub ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - else - { - this->reconnect (sub ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } -} - -void -TAO_ECG_UDP_Sender::new_connect (const RtecEventChannelAdmin::ConsumerQOS& sub - ACE_ENV_ARG_DECL) -{ - // Activate with poa. - RtecEventComm::PushConsumer_var consumer_ref; - PortableServer::POA_var poa = this->_default_POA (); - - TAO_EC_Object_Deactivator deactivator; - activate (consumer_ref, - poa.in (), - this, - deactivator - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // Connect as a consumer to the local EC. - RtecEventChannelAdmin::ConsumerAdmin_var consumer_admin = - this->lcl_ec_->for_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - RtecEventChannelAdmin::ProxyPushSupplier_var proxy = - consumer_admin->obtain_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - ECG_Sender_Auto_Proxy_Disconnect new_proxy_disconnect (proxy.in ()); - - proxy->connect_push_consumer (consumer_ref.in (), - sub - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // Update resource managers. - this->supplier_proxy_ = proxy._retn (); - this->auto_proxy_disconnect_.set_command (new_proxy_disconnect); - this->set_deactivator (deactivator); -} - -void -TAO_ECG_UDP_Sender::reconnect (const RtecEventChannelAdmin::ConsumerQOS& sub - ACE_ENV_ARG_DECL) -{ - // Obtain our object reference from the POA. - RtecEventComm::PushConsumer_var consumer_ref; - PortableServer::POA_var poa = this->_default_POA (); - - CORBA::Object_var obj = poa->servant_to_reference (this ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - consumer_ref = - RtecEventComm::PushConsumer::_narrow (obj.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (CORBA::is_nil (consumer_ref.in ())) - { - ACE_THROW (CORBA::INTERNAL ()); - } - - // Reconnect. - this->supplier_proxy_->connect_push_consumer (consumer_ref.in (), - sub - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_ECG_UDP_Sender::disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - // Prevent attempts to disconnect. - this->auto_proxy_disconnect_.disallow_command (); - - this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -void -TAO_ECG_UDP_Sender::shutdown (ACE_ENV_SINGLE_ARG_DECL) -{ - this->supplier_proxy_ = - RtecEventChannelAdmin::ProxyPushSupplier::_nil (); - - this->auto_proxy_disconnect_.execute (); - - this->addr_server_ = RtecUDPAdmin::AddrServer::_nil (); - this->lcl_ec_ = RtecEventChannelAdmin::EventChannel::_nil (); - - this->deactivator_.deactivate (); - this->cdr_sender_.shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_ECG_UDP_Sender::push (const RtecEventComm::EventSet &events - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - if (events.length () == 0) - { - // ACE_DEBUG ((EC_FORMAT (DEBUG, - // "Nothing to multicast: " - // "0-length EventSet."))); - return; - } - - // Send each event in a separate message. - // @@ TODO It is interesting to group events destined to the - // same mcast group in a single message. - for (u_int i = 0; i < events.length (); ++i) - { - // To avoid loops we keep a TTL field on the events and skip the - // events with TTL <= 0 - if (events[i].header.ttl <= 0) - continue; - - const RtecEventComm::Event& e = events[i]; - - // We need to modify the TTL field, but copying the entire event - // would be wasteful; instead we create a new header and only - // modify the header portion. - RtecEventComm::EventHeader header = e.header; - header.ttl--; - - // Start building the message - TAO_OutputCDR cdr; - - // Marshal as if it was a sequence of one element, notice how we - // marshal a modified version of the header, but the payload is - // marshal without any extra copies. - cdr.write_ulong (1); - if (!(cdr << header) - || !(cdr << e.data)) - ACE_THROW (CORBA::MARSHAL ()); - - // Grab the right mcast group for this event... - RtecUDPAdmin::UDP_Addr udp_addr; - this->addr_server_->get_addr (header, udp_addr ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - ACE_INET_Addr inet_addr (udp_addr.port, - udp_addr.ipaddr); - - this->cdr_sender_.send_message (cdr, inet_addr ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Sender.h b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Sender.h deleted file mode 100644 index 6210db74d1d..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Sender.h +++ /dev/null @@ -1,230 +0,0 @@ -// -*- C++ -*- - -/** - * @file ECG_UDP_Sender.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * @author Marina Spivak (marina@atdesk.com) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - * - * Define helper classes to propagate events between ECs using - * either UDP or multicast. - * The architecture is a bit complicated and deserves some - * explanation: sending the events over UDP (or mcast) is easy, a - * Consumer (TAO_ECG_UDP_Sender) subscribes for a certain set of - * events, its push() method marshalls the event set into a CDR - * stream that is sent using an ACE_SOCK_Dgram. The subscription - * set and IP address can be configured. - * Another helper class (TAO_ECG_UDP_Receiver) acts as a supplier of - * events; it receives a callback when an event is available on an - * ACE_SOCK_Dgram, it demarshalls the event and pushes it to the - * EC. Two ACE_Event_Handler classes are provided that can forward - * the events to this Supplier: TAO_ECG_Mcast_EH can receive events - * from a multicast group; TAO_ECG_UDP_EH can receive events from a - * regular UDP socket. - * - * @todo The class makes an extra copy of the events, we need to - * investigate if closer collaboration with its collocated EC could - * be used to remove that copy. - * - */ - -#ifndef TAO_ECG_UDP_SENDER_H -#define TAO_ECG_UDP_SENDER_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/RtecUDPAdminS.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include /**/ "orbsvcs/Event/event_serv_export.h" -#include "orbsvcs/RtecEventChannelAdminS.h" - -#include "orbsvcs/Event/EC_Lifetime_Utils.h" -#include "orbsvcs/Event/EC_Lifetime_Utils_T.h" -#include "orbsvcs/Event/ECG_CDR_Message_Sender.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -class ACE_SOCK_Dgram; -ACE_END_VERSIONED_NAMESPACE_DECL - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_ECG_UDP_Out_Endpoint; - -/** - * @class TAO_ECG_UDP_Sender_Disconnect_Command - * - * @brief Disconnects consumer represented by @a proxy from the Event Channel. - * - * Utility class for use as a template argument to TAO_EC_Auto_Command. - * TAO_EC_Auto_Command<TAO_ECG_UDP_Sender_Disconnect_Command> manages - * consumer connection to the Event Channel, automatically disconnecting from - * @a proxy in its destructor, if necessary. - */ -class TAO_RTEvent_Serv_Export TAO_ECG_UDP_Sender_Disconnect_Command -{ -public: - TAO_ECG_UDP_Sender_Disconnect_Command (void); - TAO_ECG_UDP_Sender_Disconnect_Command ( - RtecEventChannelAdmin::ProxyPushSupplier_ptr proxy); - - TAO_ECG_UDP_Sender_Disconnect_Command ( - const TAO_ECG_UDP_Sender_Disconnect_Command & rhs); - - TAO_ECG_UDP_Sender_Disconnect_Command & - operator= (const TAO_ECG_UDP_Sender_Disconnect_Command & rhs); - - void execute (ACE_ENV_SINGLE_ARG_DECL); - -private: - - RtecEventChannelAdmin::ProxyPushSupplier_var proxy_; -}; - - -/** - * @class TAO_ECG_UDP_Sender - * - * @brief Send events received from a "local" EC using UDP. - * NOT THREAD-SAFE. - * This class connect as a consumer to an EventChannel - * and forwards the events it receives from that EC using UDP. - * - */ -class TAO_RTEvent_Serv_Export TAO_ECG_UDP_Sender : - public virtual POA_RtecEventComm::PushConsumer, - public TAO_EC_Deactivated_Object -{ -public: - - /// Initialization and termination methods. - //@{ - - /// Create a new TAO_ECG_UDP_Sender object. - /// (Constructor access is restricted to insure that all - /// TAO_ECG_UDP_Sender objects are heap-allocated.) - static TAO_EC_Servant_Var<TAO_ECG_UDP_Sender> create (CORBA::Boolean crc = 0); - - ~TAO_ECG_UDP_Sender (void); - - /** - * @param lcl_ec Event Channel to which we will act as a consumer of events. - * @param addr_server Address server used to obtain event type to - * multicast group mapping. - * @param endpoint_rptr Endpoint for sending udp/multicast messages. - * Endpoint's dgram must be open! - * - * To insure proper resource clean up, if init () is successful, - * shutdown () must be called when the sender is no longer needed. - * This is done by disconnect_push_consumer() method. If - * disconnect_push_consumer() will not be called, it is the - * responsibility of the user. - * Furthermore, if shutdown() is not explicitly called by - * either disconnect_push_consumer () or the user, the sender - * will clean up the resources in its destructor, however, certain - * entities involved in cleanup must still exist at that point, - * e.g., POA. - */ - void init (RtecEventChannelAdmin::EventChannel_ptr lcl_ec, - RtecUDPAdmin::AddrServer_ptr addr_server, - TAO_ECG_Refcounted_Endpoint endpoint_rptr - ACE_ENV_ARG_DECL); - - /// Connect or reconnect to the EC with the given subscriptions. - /** - * NOTE: if we are already connected to EC and a reconnection is - * necessary, the EC must have reconnects enabled in order for this - * method to succeed. - */ - void connect (const RtecEventChannelAdmin::ConsumerQOS &sub - ACE_ENV_ARG_DECL); - - /// Deactivate from POA and disconnect from EC, if necessary. Shut - /// down all sender components. - /** - * Calling this method may result in decrementing of the reference - * count (due to deactivation) and deletion of the object. - */ - void shutdown (ACE_ENV_SINGLE_ARG_DECL); - //@} - - /// Accessors. - //@{ - /** - * The sender may need to fragment the message, otherwise the - * network may drop the packets. - * Setting the MTU can fail if the value is too small (at least the - * header + 8 bytes must fit). - */ - int mtu (CORBA::ULong mtu); - CORBA::ULong mtu (void) const; - - /// Get the local endpoint used to send the events. - int get_local_addr (ACE_INET_Addr& addr); - //@} - - /// The PushConsumer methods. - //@{ - /// Invokes shutdown (), which may result in the object being deleted, if - /// refcounting is used to manage its lifetime. - virtual void disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - virtual void push (const RtecEventComm::EventSet &events - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - //@} - -protected: - - /// Constructor (protected). Clients can create new - /// TAO_ECG_UDP_Sender objects using the static create() method. - TAO_ECG_UDP_Sender (CORBA::Boolean crc = 0); - -private: - - /// Helpers for the connect() method. - //@{ - // Establishes connection to the Event Channel for the first time. - void new_connect (const RtecEventChannelAdmin::ConsumerQOS& sub - ACE_ENV_ARG_DECL); - - // Updates existing connection to the Event Channel. - void reconnect (const RtecEventChannelAdmin::ConsumerQOS& sub - ACE_ENV_ARG_DECL); - //@} - - /// Proxy used to receive events from the Event Channel. - RtecEventChannelAdmin::ProxyPushSupplier_var supplier_proxy_; - - /// Event Channel to which we act as a consumer. - RtecEventChannelAdmin::EventChannel_var lcl_ec_; - - /// We query this object to determine where the events should be sent. - RtecUDPAdmin::AddrServer_var addr_server_; - - /// Helper for fragmenting and sending cdr-encoded events using udp. - TAO_ECG_CDR_Message_Sender cdr_sender_; - - typedef TAO_EC_Auto_Command<TAO_ECG_UDP_Sender_Disconnect_Command> - ECG_Sender_Auto_Proxy_Disconnect; - /// Manages our connection to Supplier Proxy. - ECG_Sender_Auto_Proxy_Disconnect auto_proxy_disconnect_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined(__ACE_INLINE__) -#include "orbsvcs/Event/ECG_UDP_Sender.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* TAO_ECG_UDP_SENDER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Sender.inl b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Sender.inl deleted file mode 100644 index c58a7a81ca8..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Sender.inl +++ /dev/null @@ -1,96 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/Null_Mutex.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE TAO_EC_Servant_Var<TAO_ECG_UDP_Sender> -TAO_ECG_UDP_Sender::create (CORBA::Boolean crc) -{ - TAO_EC_Servant_Var<TAO_ECG_UDP_Sender> s; - ACE_NEW_RETURN (s, - TAO_ECG_UDP_Sender (crc), - s); - return s; -} - -ACE_INLINE -TAO_ECG_UDP_Sender::TAO_ECG_UDP_Sender (CORBA::Boolean crc) - : supplier_proxy_ () - , lcl_ec_ () - , addr_server_ () - , cdr_sender_ (crc) - , auto_proxy_disconnect_ () -{ -} - -ACE_INLINE CORBA::ULong -TAO_ECG_UDP_Sender::mtu (void) const -{ - return this->cdr_sender_.mtu (); -} - -ACE_INLINE int -TAO_ECG_UDP_Sender::mtu (CORBA::ULong new_mtu) -{ - return this->cdr_sender_.mtu (new_mtu); -} - -ACE_INLINE int -TAO_ECG_UDP_Sender::get_local_addr (ACE_INET_Addr& addr) -{ - return this->cdr_sender_.get_local_addr (addr); -} -//*************************************************************************** - -ACE_INLINE -TAO_ECG_UDP_Sender_Disconnect_Command:: -TAO_ECG_UDP_Sender_Disconnect_Command (void) - : proxy_ () -{ -} - -ACE_INLINE -TAO_ECG_UDP_Sender_Disconnect_Command:: -TAO_ECG_UDP_Sender_Disconnect_Command ( - RtecEventChannelAdmin::ProxyPushSupplier_ptr proxy) - : proxy_ (RtecEventChannelAdmin::ProxyPushSupplier::_duplicate (proxy)) -{ -} - -ACE_INLINE -TAO_ECG_UDP_Sender_Disconnect_Command:: -TAO_ECG_UDP_Sender_Disconnect_Command ( - const TAO_ECG_UDP_Sender_Disconnect_Command & rhs) - : proxy_ (RtecEventChannelAdmin::ProxyPushSupplier::_duplicate - (rhs.proxy_.in ())) -{ -} - -ACE_INLINE TAO_ECG_UDP_Sender_Disconnect_Command & -TAO_ECG_UDP_Sender_Disconnect_Command::operator= ( - const TAO_ECG_UDP_Sender_Disconnect_Command & rhs) -{ - this->proxy_ = - RtecEventChannelAdmin::ProxyPushSupplier::_duplicate (rhs.proxy_.in ()); - - return *this; -} - -ACE_INLINE void -TAO_ECG_UDP_Sender_Disconnect_Command::execute (ACE_ENV_SINGLE_ARG_DECL) -{ - if (CORBA::is_nil (this->proxy_.in ())) - // We are not connected. - return; - - RtecEventChannelAdmin::ProxyPushSupplier_var release_proxy = - this->proxy_._retn (); - - release_proxy->disconnect_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_And_Filter.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_And_Filter.cpp deleted file mode 100644 index 715979d31a9..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_And_Filter.cpp +++ /dev/null @@ -1,170 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_And_Filter.h" - -ACE_RCSID(Event, EC_And_Filter, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_And_Filter::TAO_EC_And_Filter (TAO_EC_Filter* children[], - size_t n) - : children_ (children), - n_ (n) -{ - ChildrenIterator end = this->end (); - for (ChildrenIterator i = this->begin (); - i != end; - ++i) - { - this->adopt_child (*i); - } -} - -TAO_EC_And_Filter::~TAO_EC_And_Filter (void) -{ - TAO_EC_Filter** end = this->children_ + this->n_; - for (TAO_EC_Filter** i = this->children_; - i != end; - ++i) - { - delete *i; - *i = 0; - } - delete[] this->children_; - this->children_ = 0; - this->n_ = 0; -} - -TAO_EC_Filter::ChildrenIterator -TAO_EC_And_Filter::begin (void) const -{ - return this->children_; -} - -TAO_EC_Filter::ChildrenIterator -TAO_EC_And_Filter::end (void) const -{ - return this->children_ + this->n_; -} - -int -TAO_EC_And_Filter::size (void) const -{ - return static_cast<CORBA::ULong> (this->n_); -} - -int -TAO_EC_And_Filter::filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - ChildrenIterator end = this->end (); - for (ChildrenIterator i = this->begin (); i != end; ++i) - { - int n = (*i)->filter (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - if (n == 0) - return 0; - } - - // All children accepted the event, push up... - if (this->parent () != 0) - { - this->parent ()->push (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - } - - return 1; -} - -int -TAO_EC_And_Filter::filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - ChildrenIterator end = this->end (); - for (ChildrenIterator i = this->begin (); i != end; ++i) - { - int n = (*i)->filter_nocopy (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - if (n == 0) - return 0; - } - - // All children accepted the event, push up... - if (this->parent () != 0) - { - this->parent ()->push (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - } - - return 1; -} - -void -TAO_EC_And_Filter::push (const RtecEventComm::EventSet&, - TAO_EC_QOS_Info& - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_And_Filter::push_nocopy (RtecEventComm::EventSet&, - TAO_EC_QOS_Info& - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_And_Filter::clear (void) -{ - ChildrenIterator end = this->end (); - for (ChildrenIterator i = this->begin (); - i != end; - ++i) - { - (*i)->clear (); - } -} - -CORBA::ULong -TAO_EC_And_Filter::max_event_size (void) const -{ - CORBA::ULong n = 0; - ChildrenIterator end = this->end (); - for (ChildrenIterator i = this->begin (); - i != end; - ++i) - { - CORBA::ULong c = (*i)->max_event_size (); - if (n < c) - n = c; - } - return n; -} - -int -TAO_EC_And_Filter::can_match ( - const RtecEventComm::EventHeader& header) const -{ - ChildrenIterator end = this->end (); - for (ChildrenIterator i = this->begin (); - i != end; - ++i) - { - if ((*i)->can_match (header) == 0) - return 0; - } - return 1; -} - -int -TAO_EC_And_Filter::add_dependencies ( - const RtecEventComm::EventHeader&, - const TAO_EC_QOS_Info& - ACE_ENV_ARG_DECL_NOT_USED) -{ - return 0; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_And_Filter.h b/TAO/orbsvcs/orbsvcs/Event/EC_And_Filter.h deleted file mode 100644 index 67c9614af70..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_And_Filter.h +++ /dev/null @@ -1,89 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_And_Filter.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_AND_FILTER_H -#define TAO_EC_AND_FILTER_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Filter.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_And_Filter - * - * @brief The 'logical and' filter. - * - * This filter has a set of children (fixed at creation time), - * only if all the children accept an event it does so too. - * - * <H2>Memory Management</H2> - * It assumes ownership of the children. - */ -class TAO_RTEvent_Serv_Export TAO_EC_And_Filter : public TAO_EC_Filter -{ -public: - /// Constructor. It assumes ownership of both the array and the - /// children. - TAO_EC_And_Filter (TAO_EC_Filter* children[], - size_t n); - - /// Destructor - virtual ~TAO_EC_And_Filter (void); - - // = The TAO_EC_Filter methods, please check the documentation in - // TAO_EC_Filter. - virtual ChildrenIterator begin (void) const; - virtual ChildrenIterator end (void) const; - virtual int size (void) const; - virtual int filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual int filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void clear (void); - virtual CORBA::ULong max_event_size (void) const; - virtual int can_match (const RtecEventComm::EventHeader& header) const; - virtual int add_dependencies (const RtecEventComm::EventHeader& header, - const TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL); - -private: - TAO_EC_And_Filter (const TAO_EC_And_Filter&); - TAO_EC_And_Filter& operator= (const TAO_EC_And_Filter&); - -private: - /// The children - TAO_EC_Filter** children_; - - /// The number of children. - size_t n_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* TAO_EC_AND_FILTER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Basic_Factory.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Basic_Factory.cpp deleted file mode 100644 index e9bc5dcb730..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Basic_Factory.cpp +++ /dev/null @@ -1,262 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Basic_Factory.h" -#include "orbsvcs/Event/EC_Reactive_Dispatching.h" -#include "orbsvcs/Event/EC_Basic_Filter_Builder.h" -#include "orbsvcs/Event/EC_Trivial_Supplier_Filter.h" -#include "orbsvcs/Event/EC_ConsumerAdmin.h" -#include "orbsvcs/Event/EC_SupplierAdmin.h" -#include "orbsvcs/Event/EC_Default_ProxyConsumer.h" -#include "orbsvcs/Event/EC_Default_ProxySupplier.h" -#include "orbsvcs/Event/EC_ObserverStrategy.h" -#include "orbsvcs/Event/EC_Null_Scheduling.h" -#include "orbsvcs/Event/EC_Reactive_Timeout_Generator.h" -#include "orbsvcs/Event/EC_Reactive_ConsumerControl.h" -#include "orbsvcs/Event/EC_Reactive_SupplierControl.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" // @@ MSVC 6 bug - -#include "orbsvcs/ESF/ESF_Proxy_List.h" -#include "orbsvcs/ESF/ESF_Delayed_Changes.h" - -#include "tao/ORB_Core.h" - -ACE_RCSID (Event, - EC_Basic_Factory, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Basic_Factory::TAO_EC_Basic_Factory (void) -{ -} - -TAO_EC_Basic_Factory::~TAO_EC_Basic_Factory (void) -{ -} - -TAO_EC_Dispatching* -TAO_EC_Basic_Factory::create_dispatching (TAO_EC_Event_Channel_Base *) -{ - return new TAO_EC_Reactive_Dispatching (); -} - -void -TAO_EC_Basic_Factory::destroy_dispatching (TAO_EC_Dispatching *x) -{ - delete x; -} - -TAO_EC_Filter_Builder* -TAO_EC_Basic_Factory::create_filter_builder (TAO_EC_Event_Channel_Base *ec) -{ - return new TAO_EC_Basic_Filter_Builder (ec); -} - -void -TAO_EC_Basic_Factory::destroy_filter_builder (TAO_EC_Filter_Builder *x) -{ - delete x; -} - -TAO_EC_Supplier_Filter_Builder* -TAO_EC_Basic_Factory::create_supplier_filter_builder (TAO_EC_Event_Channel_Base *ec) -{ - return new TAO_EC_Trivial_Supplier_Filter_Builder (ec); -} - -void -TAO_EC_Basic_Factory::destroy_supplier_filter_builder (TAO_EC_Supplier_Filter_Builder *x) -{ - delete x; -} - -TAO_EC_ConsumerAdmin* -TAO_EC_Basic_Factory::create_consumer_admin (TAO_EC_Event_Channel_Base *ec) -{ - return new TAO_EC_ConsumerAdmin (ec); -} - -void -TAO_EC_Basic_Factory::destroy_consumer_admin (TAO_EC_ConsumerAdmin *x) -{ - delete x; -} - -TAO_EC_SupplierAdmin* -TAO_EC_Basic_Factory::create_supplier_admin (TAO_EC_Event_Channel_Base *ec) -{ - return new TAO_EC_SupplierAdmin (ec); -} - -void -TAO_EC_Basic_Factory::destroy_supplier_admin (TAO_EC_SupplierAdmin *x) -{ - delete x; -} - -TAO_EC_ProxyPushSupplier* -TAO_EC_Basic_Factory::create_proxy_push_supplier (TAO_EC_Event_Channel_Base *ec) -{ - return new TAO_EC_Default_ProxyPushSupplier (ec, TAO_EC_DEFAULT_CONSUMER_VALIDATE_CONNECTION); -} - -void -TAO_EC_Basic_Factory::destroy_proxy_push_supplier (TAO_EC_ProxyPushSupplier *x) -{ - delete x; -} - -TAO_EC_ProxyPushConsumer* -TAO_EC_Basic_Factory::create_proxy_push_consumer (TAO_EC_Event_Channel_Base *ec) -{ - return new TAO_EC_Default_ProxyPushConsumer (ec); -} - -void -TAO_EC_Basic_Factory::destroy_proxy_push_consumer (TAO_EC_ProxyPushConsumer *x) -{ - delete x; -} - -TAO_EC_Timeout_Generator* -TAO_EC_Basic_Factory::create_timeout_generator (TAO_EC_Event_Channel_Base *) -{ - int argc = 0; - char **argv = 0; - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, ""); - ACE_Reactor *reactor = orb->orb_core ()->reactor (); - return new TAO_EC_Reactive_Timeout_Generator (reactor); -} - -void -TAO_EC_Basic_Factory::destroy_timeout_generator (TAO_EC_Timeout_Generator *x) -{ - delete x; -} - -TAO_EC_ObserverStrategy* -TAO_EC_Basic_Factory::create_observer_strategy (TAO_EC_Event_Channel_Base *ec) -{ - ACE_Lock* lock; - ACE_NEW_RETURN (lock, ACE_Lock_Adapter<TAO_SYNCH_MUTEX>, 0); - return new TAO_EC_Basic_ObserverStrategy (ec, lock); -} - -void -TAO_EC_Basic_Factory::destroy_observer_strategy (TAO_EC_ObserverStrategy *x) -{ - delete x; -} - -TAO_EC_Scheduling_Strategy* -TAO_EC_Basic_Factory::create_scheduling_strategy (TAO_EC_Event_Channel_Base*) -{ - return new TAO_EC_Null_Scheduling; -} - -void -TAO_EC_Basic_Factory::destroy_scheduling_strategy (TAO_EC_Scheduling_Strategy* x) -{ - delete x; -} - -TAO_EC_ProxyPushConsumer_Collection* -TAO_EC_Basic_Factory::create_proxy_push_consumer_collection (TAO_EC_Event_Channel_Base *) -{ - // This typedef is a workaround for a SunCC 4.2 bug - typedef TAO_ESF_Proxy_List<TAO_EC_ProxyPushConsumer>::Iterator TAO_EC_Consumer_List_Iterator; - return new TAO_ESF_Delayed_Changes<TAO_EC_ProxyPushConsumer, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushConsumer>, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushConsumer>::Iterator, - ACE_SYNCH> (); -} - -void -TAO_EC_Basic_Factory::destroy_proxy_push_consumer_collection (TAO_EC_ProxyPushConsumer_Collection *x) -{ - delete x; -} - -TAO_EC_ProxyPushSupplier_Collection* -TAO_EC_Basic_Factory::create_proxy_push_supplier_collection (TAO_EC_Event_Channel_Base *) -{ - // This typedef is a workaround for a SunCC 4.2 bug - typedef TAO_ESF_Proxy_List<TAO_EC_ProxyPushSupplier>::Iterator TAO_EC_Supplier_List_Iterator; - return new TAO_ESF_Delayed_Changes<TAO_EC_ProxyPushSupplier, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushSupplier>, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushSupplier>::Iterator, - ACE_SYNCH> (); -} - -void -TAO_EC_Basic_Factory::destroy_proxy_push_supplier_collection (TAO_EC_ProxyPushSupplier_Collection *x) -{ - delete x; -} - -ACE_Lock* -TAO_EC_Basic_Factory::create_consumer_lock (void) -{ - return new ACE_Lock_Adapter<TAO_SYNCH_MUTEX> (); -} - -void -TAO_EC_Basic_Factory::destroy_consumer_lock (ACE_Lock* x) -{ - delete x; -} - -ACE_Lock* -TAO_EC_Basic_Factory::create_supplier_lock (void) -{ - return new ACE_Lock_Adapter<TAO_SYNCH_RECURSIVE_MUTEX> (); -} - -void -TAO_EC_Basic_Factory::destroy_supplier_lock (ACE_Lock* x) -{ - delete x; -} - -TAO_EC_ConsumerControl* -TAO_EC_Basic_Factory::create_consumer_control (TAO_EC_Event_Channel_Base* ec) -{ - int argc = 0; - char **argv = 0; - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, ""); - // Hard-coded rate to 10 times a second - ACE_Time_Value rate (0, 100000); - // Hard-coded polling-timeout to 10 msec - ACE_Time_Value timeout (0, TAO_EC_DEFAULT_CONSUMER_CONTROL_TIMEOUT); - return new TAO_EC_Reactive_ConsumerControl (rate, timeout, ec, orb.in ()); -} - -void -TAO_EC_Basic_Factory::destroy_consumer_control (TAO_EC_ConsumerControl* x) -{ - delete x; -} - -TAO_EC_SupplierControl* -TAO_EC_Basic_Factory::create_supplier_control (TAO_EC_Event_Channel_Base* ec) -{ - int argc = 0; - char **argv = 0; - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, ""); - // Hard-coded rate to 10 times a second - ACE_Time_Value rate (0, 100000); - // Hard-coded polling-timeout to 10 msec - ACE_Time_Value timeout (0, TAO_EC_DEFAULT_SUPPLIER_CONTROL_TIMEOUT); - return new TAO_EC_Reactive_SupplierControl (rate, timeout, ec, orb.in ()); -} - -void -TAO_EC_Basic_Factory::destroy_supplier_control (TAO_EC_SupplierControl* x) -{ - delete x; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Basic_Factory.h b/TAO/orbsvcs/orbsvcs/Event/EC_Basic_Factory.h deleted file mode 100644 index aa942b26492..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Basic_Factory.h +++ /dev/null @@ -1,120 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Basic_Factory.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_BASIC_FACTORY_H -#define TAO_EC_BASIC_FACTORY_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Factory.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Basic_Factory - * - * @brief The factory for a simple event channel. - * - * An slightly more advanced configuration than the - * EC_Null_Factory, this class configure an event channel that can - * support filtering and correlation. Still dispatching is not - * prioritized and all the filtering is done at the consumer level. - * A fixed POA is used for servant activation. - * This object creates a single instance of the Supplier - * - */ -class TAO_RTEvent_Serv_Export TAO_EC_Basic_Factory : public TAO_EC_Factory -{ -public: - /// Constructor - TAO_EC_Basic_Factory (void); - - /// destructor... - virtual ~TAO_EC_Basic_Factory (void); - - // = The EC_Factory methods - virtual TAO_EC_Dispatching* - create_dispatching (TAO_EC_Event_Channel_Base*); - virtual void - destroy_dispatching (TAO_EC_Dispatching*); - virtual TAO_EC_Filter_Builder* - create_filter_builder (TAO_EC_Event_Channel_Base*); - virtual void - destroy_filter_builder (TAO_EC_Filter_Builder*); - virtual TAO_EC_Supplier_Filter_Builder* - create_supplier_filter_builder (TAO_EC_Event_Channel_Base*); - virtual void - destroy_supplier_filter_builder (TAO_EC_Supplier_Filter_Builder*); - virtual TAO_EC_ConsumerAdmin* - create_consumer_admin (TAO_EC_Event_Channel_Base*); - virtual void - destroy_consumer_admin (TAO_EC_ConsumerAdmin*); - virtual TAO_EC_SupplierAdmin* - create_supplier_admin (TAO_EC_Event_Channel_Base*); - virtual void - destroy_supplier_admin (TAO_EC_SupplierAdmin*); - virtual TAO_EC_ProxyPushSupplier* - create_proxy_push_supplier (TAO_EC_Event_Channel_Base*); - virtual void - destroy_proxy_push_supplier (TAO_EC_ProxyPushSupplier*); - virtual TAO_EC_ProxyPushConsumer* - create_proxy_push_consumer (TAO_EC_Event_Channel_Base*); - virtual void - destroy_proxy_push_consumer (TAO_EC_ProxyPushConsumer*); - virtual TAO_EC_Timeout_Generator* - create_timeout_generator (TAO_EC_Event_Channel_Base*); - virtual void - destroy_timeout_generator (TAO_EC_Timeout_Generator*); - virtual TAO_EC_ObserverStrategy* - create_observer_strategy (TAO_EC_Event_Channel_Base*); - virtual void - destroy_observer_strategy (TAO_EC_ObserverStrategy*); - virtual TAO_EC_Scheduling_Strategy* - create_scheduling_strategy (TAO_EC_Event_Channel_Base*); - virtual void - destroy_scheduling_strategy (TAO_EC_Scheduling_Strategy*); - virtual TAO_EC_ProxyPushConsumer_Collection* - create_proxy_push_consumer_collection (TAO_EC_Event_Channel_Base*); - virtual void - destroy_proxy_push_consumer_collection (TAO_EC_ProxyPushConsumer_Collection*); - virtual TAO_EC_ProxyPushSupplier_Collection* - create_proxy_push_supplier_collection (TAO_EC_Event_Channel_Base*); - virtual void - destroy_proxy_push_supplier_collection (TAO_EC_ProxyPushSupplier_Collection*); - - virtual ACE_Lock* create_consumer_lock (void); - virtual void destroy_consumer_lock (ACE_Lock*); - virtual ACE_Lock* create_supplier_lock (void); - virtual void destroy_supplier_lock (ACE_Lock*); - - virtual TAO_EC_ConsumerControl* - create_consumer_control (TAO_EC_Event_Channel_Base*); - virtual void - destroy_consumer_control (TAO_EC_ConsumerControl*); - virtual TAO_EC_SupplierControl* - create_supplier_control (TAO_EC_Event_Channel_Base*); - virtual void - destroy_supplier_control (TAO_EC_SupplierControl*); -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_BASIC_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Basic_Filter_Builder.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Basic_Filter_Builder.cpp deleted file mode 100644 index e8149330316..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Basic_Filter_Builder.cpp +++ /dev/null @@ -1,203 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event_Service_Constants.h" -#include "orbsvcs/Event/EC_Basic_Filter_Builder.h" -#include "orbsvcs/Event/EC_Type_Filter.h" -#include "orbsvcs/Event/EC_Conjunction_Filter.h" -#include "orbsvcs/Event/EC_Disjunction_Filter.h" -#include "orbsvcs/Event/EC_And_Filter.h" -#include "orbsvcs/Event/EC_Negation_Filter.h" -#include "orbsvcs/Event/EC_Bitmask_Filter.h" -#include "orbsvcs/Event/EC_Masked_Type_Filter.h" -#include "orbsvcs/Event/EC_Timeout_Filter.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Basic_Filter_Builder.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, EC_Basic_Filter_Builder, "$Id$") - - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Basic_Filter_Builder::~TAO_EC_Basic_Filter_Builder (void) -{ -} - -TAO_EC_Filter* -TAO_EC_Basic_Filter_Builder::build ( - TAO_EC_ProxyPushSupplier *supplier, - RtecEventChannelAdmin::ConsumerQOS& qos - ACE_ENV_ARG_DECL_NOT_USED) const -{ - CORBA::ULong pos = 0; - return this->recursive_build (supplier, qos, pos); -} - -TAO_EC_Filter* -TAO_EC_Basic_Filter_Builder:: recursive_build ( - TAO_EC_ProxyPushSupplier *supplier, - RtecEventChannelAdmin::ConsumerQOS& qos, - CORBA::ULong& pos) const -{ - CORBA::ULong l = qos.dependencies.length (); - if (pos == l) - return 0; - - const RtecEventComm::Event& e = qos.dependencies[pos].event; - if (e.header.type == ACE_ES_CONJUNCTION_DESIGNATOR) - { - pos++; // Consume the designator - CORBA::ULong n = this->count_children (qos, pos); - - TAO_EC_Filter** children; - ACE_NEW_RETURN (children, TAO_EC_Filter*[n], 0); - CORBA::ULong i = 0; - for (; i != n; ++i) - { - children[i] = this->recursive_build (supplier, qos, pos); - } - return new TAO_EC_Conjunction_Filter (children, n); - } - else if (e.header.type == ACE_ES_DISJUNCTION_DESIGNATOR) - { - pos++; // Consume the designator - CORBA::ULong n = this->count_children (qos, pos); - - TAO_EC_Filter** children; - ACE_NEW_RETURN (children, TAO_EC_Filter*[n], 0); - CORBA::ULong i = 0; - for (; i != n; ++i) - { - children[i] = this->recursive_build (supplier, qos, pos); - } - return new TAO_EC_Disjunction_Filter (children, n); - } - else if (e.header.type == ACE_ES_LOGICAL_AND_DESIGNATOR) - { - pos++; // Consume the designator - CORBA::ULong n = this->count_children (qos, pos); - - TAO_EC_Filter** children; - ACE_NEW_RETURN (children, TAO_EC_Filter*[n], 0); - CORBA::ULong i = 0; - for (; i != n; ++i) - { - children[i] = this->recursive_build (supplier, qos, pos); - } - return new TAO_EC_And_Filter (children, n); - } - else if (e.header.type == ACE_ES_NEGATION_DESIGNATOR) - { - pos++; // Consume the designator - - TAO_EC_Filter *child = - this->recursive_build (supplier, qos, pos); - return new TAO_EC_Negation_Filter (child); - } - else if (e.header.type == ACE_ES_BITMASK_DESIGNATOR) - { - pos++; // COnsumer the designator - - if (pos == qos.dependencies.length ()) - return 0; - CORBA::ULong source_mask = qos.dependencies[pos].event.header.source; - CORBA::ULong type_mask = qos.dependencies[pos].event.header.type; - pos++; - - TAO_EC_Filter *child = - this->recursive_build (supplier, qos, pos); - return new TAO_EC_Bitmask_Filter (source_mask, - type_mask, - child); - } - else if (e.header.type == ACE_ES_MASKED_TYPE_DESIGNATOR) - { - pos++; // Consume the designator - - if (pos == qos.dependencies.length ()) - return 0; - CORBA::ULong source_mask = qos.dependencies[pos].event.header.source; - CORBA::ULong type_mask = qos.dependencies[pos].event.header.type; - pos++; - - if (pos == qos.dependencies.length ()) - return 0; - CORBA::ULong source_value = qos.dependencies[pos].event.header.source; - CORBA::ULong type_value = qos.dependencies[pos].event.header.type; - pos++; - - return new TAO_EC_Masked_Type_Filter (source_mask, - type_mask, - source_value, - type_value); - } - else if (e.header.type == ACE_ES_NULL_DESIGNATOR) - { - pos++; // Consume the designator - - return new TAO_EC_Null_Filter (); - } - else if (e.header.type == ACE_ES_EVENT_TIMEOUT - || e.header.type == ACE_ES_EVENT_INTERVAL_TIMEOUT - || e.header.type == ACE_ES_EVENT_DEADLINE_TIMEOUT) - { - pos++; // Consume the designator - TAO_EC_QOS_Info qos_info; - return new TAO_EC_Timeout_Filter (this->event_channel_, - supplier, - qos_info, - e.header.type, - e.header.creation_time); - } - pos++; // Consume the event - return new TAO_EC_Type_Filter (e.header); -} - -CORBA::ULong -TAO_EC_Basic_Filter_Builder:: - count_children (RtecEventChannelAdmin::ConsumerQOS& qos, - CORBA::ULong pos) const -{ - CORBA::ULong l = qos.dependencies.length (); - CORBA::ULong i; - int count = 0; - for (i = pos; i != l; ++i) - { - const RtecEventComm::Event& e = qos.dependencies[i].event; - if (e.header.type == ACE_ES_CONJUNCTION_DESIGNATOR - || e.header.type == ACE_ES_DISJUNCTION_DESIGNATOR - || e.header.type == ACE_ES_LOGICAL_AND_DESIGNATOR) - // We won't let these be nested by the basic filter builder. - // Assume these are the end of the group - break; - else if (e.header.type == ACE_ES_BITMASK_DESIGNATOR) - // These take up an extra element - i++; - else if (e.header.type == ACE_ES_MASKED_TYPE_DESIGNATOR) - // These take up two extra elements - i += 2; - else if (e.header.type == ACE_ES_NEGATION_DESIGNATOR) { - // These enclose another filter. - // Lets try to figure out how many elements the enclosed - // filter takes up (but don't count it in the group). - // Only allow basic filter types and bitmasks within - // a negation (when it is nested within a group). - // This is isn't perfect, but its about the best we can - // do without prefixes. - i++; - switch (qos.dependencies[i].event.header.type) { - case ACE_ES_BITMASK_DESIGNATOR: - i++; - break; - case ACE_ES_MASKED_TYPE_DESIGNATOR: - i += 2; - break; - } - } - count++; - } - return count; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Basic_Filter_Builder.h b/TAO/orbsvcs/orbsvcs/Event/EC_Basic_Filter_Builder.h deleted file mode 100644 index f6627fc35c5..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Basic_Filter_Builder.h +++ /dev/null @@ -1,81 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Basic_Filter_Builder.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_BASIC_FILTER_BUILDER_H -#define TAO_EC_BASIC_FILTER_BUILDER_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Filter_Builder.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Filter; -class TAO_EC_Event_Channel_Base; - -/** - * @class TAO_EC_Basic_Filter_Builder - * - * @brief Implement a builder for the fundamental filters. - * - * The basic filtering mechanisms in the Event channel - * (source/type based filtering + disjunctions, conjunctions, logical ands, - * negations, and bitmasks) are constructed using this class. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Basic_Filter_Builder : public TAO_EC_Filter_Builder -{ -public: - /// constructor. - TAO_EC_Basic_Filter_Builder (TAO_EC_Event_Channel_Base* ec); - - /// destructor... - virtual ~TAO_EC_Basic_Filter_Builder (void); - - // = The TAO_EC_Filter_Builder methods... - TAO_EC_Filter* build (TAO_EC_ProxyPushSupplier *supplier, - RtecEventChannelAdmin::ConsumerQOS& qos - ACE_ENV_ARG_DECL) const; - -private: - /// Recursively build the filter tree. - TAO_EC_Filter* recursive_build (TAO_EC_ProxyPushSupplier *supplier, - RtecEventChannelAdmin::ConsumerQOS& qos, - CORBA::ULong& pos) const; - - /// Count the number of children of the current node, i.e. until a - /// conjunction, disjunction, logical and, bitmask, or negation occurs. - CORBA::ULong count_children (RtecEventChannelAdmin::ConsumerQOS& qos, - CORBA::ULong pos) const; - -private: - /// The event channel. - TAO_EC_Event_Channel_Base* event_channel_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Basic_Filter_Builder.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_BASIC_FILTER_BUILDER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Basic_Filter_Builder.i b/TAO/orbsvcs/orbsvcs/Event/EC_Basic_Filter_Builder.i deleted file mode 100644 index ebf53c20045..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Basic_Filter_Builder.i +++ /dev/null @@ -1,14 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_Basic_Filter_Builder:: - TAO_EC_Basic_Filter_Builder (TAO_EC_Event_Channel_Base *ec) - : event_channel_ (ec) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Bitmask_Filter.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Bitmask_Filter.cpp deleted file mode 100644 index 7701ba4d1d1..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Bitmask_Filter.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Bitmask_Filter.h" - -ACE_RCSID(Event, EC_Bitmask_Filter, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Bitmask_Filter::TAO_EC_Bitmask_Filter (CORBA::ULong source_mask, - CORBA::ULong type_mask, - TAO_EC_Filter* child) - : source_mask_ (source_mask), - type_mask_ (type_mask), - child_ (child) -{ - this->adopt_child (this->child_); -} - -TAO_EC_Bitmask_Filter::~TAO_EC_Bitmask_Filter (void) -{ - delete this->child_; -} - -TAO_EC_Filter::ChildrenIterator -TAO_EC_Bitmask_Filter::begin (void) const -{ - return const_cast<TAO_EC_Filter**> (&this->child_); -} - -TAO_EC_Filter::ChildrenIterator -TAO_EC_Bitmask_Filter::end (void) const -{ - return const_cast<TAO_EC_Filter**> (&this->child_) + 1; -} - -int -TAO_EC_Bitmask_Filter::size (void) const -{ - return 1; -} - -int -TAO_EC_Bitmask_Filter::filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - if (event.length () != 1) - return 0; - - if ((event[0].header.type & this->type_mask_) == 0 - || (event[0].header.source & this->source_mask_) == 0) - return 0; - - return this->child_->filter (event, qos_info ACE_ENV_ARG_PARAMETER); -} - -int -TAO_EC_Bitmask_Filter::filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - if (event.length () != 1) - return 0; - - if ((event[0].header.type & this->type_mask_) == 0 - || (event[0].header.source & this->source_mask_) == 0) - return 0; - - return this->child_->filter_nocopy (event, qos_info ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Bitmask_Filter::push (const RtecEventComm::EventSet &event, - TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL) -{ - if (this->parent () != 0) - this->parent ()->push (event, qos_info ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Bitmask_Filter::push_nocopy (RtecEventComm::EventSet &event, - TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL) -{ - if (this->parent () != 0) - this->parent ()->push_nocopy (event, qos_info ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Bitmask_Filter::clear (void) -{ - this->child_->clear (); -} - -CORBA::ULong -TAO_EC_Bitmask_Filter::max_event_size (void) const -{ - return this->child_->max_event_size (); -} - -int -TAO_EC_Bitmask_Filter::can_match ( - const RtecEventComm::EventHeader& header) const -{ - if ((header.type & this->type_mask_) == 0 - || (header.source & this->source_mask_) == 0) - return 0; - - return this->child_->can_match (header); -} - -int -TAO_EC_Bitmask_Filter::add_dependencies ( - const RtecEventComm::EventHeader&, - const TAO_EC_QOS_Info & - ACE_ENV_ARG_DECL_NOT_USED) -{ - return 0; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Bitmask_Filter.h b/TAO/orbsvcs/orbsvcs/Event/EC_Bitmask_Filter.h deleted file mode 100644 index bc2a3469d00..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Bitmask_Filter.h +++ /dev/null @@ -1,107 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Bitmask_Filter.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_BITMASK_FILTER_H -#define TAO_EC_BITMASK_FILTER_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Filter.h" -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Bitmask_Filter - * - * @brief The bitmask filter. - * - * This filter quickly rejects events that do not match a given - * bitmask. - * If the event is not rejected based on the mask then the child - * is consulted to finally accept or reject the event. - * When composed with the Null_Filter it accepts any events that - * satisfy: - * (event.header.type & type_mask) != 0 - * && (event.header.type & source_mask) != 0 - * - * <H2>Memory Management</H2> - * It assumes ownership of the child. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Bitmask_Filter : public TAO_EC_Filter -{ -public: - /** - * Constructor. - * Events that do not satisfy: - * - * (e.header.source & source_mask) != 0 && - * (e.header.type & type_mask) != 0 - * - * are immediately rejected, other events are recursively tested - * using the child node. - * It assumes ownership of the child. - */ - TAO_EC_Bitmask_Filter (CORBA::ULong source_mask, - CORBA::ULong type_mask, - TAO_EC_Filter* child); - - /// Destructor - virtual ~TAO_EC_Bitmask_Filter (void); - - // = The TAO_EC_Filter methods, please check the documentation in - // TAO_EC_Filter. - virtual ChildrenIterator begin (void) const; - virtual ChildrenIterator end (void) const; - virtual int size (void) const; - virtual int filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual int filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void clear (void); - virtual CORBA::ULong max_event_size (void) const; - virtual int can_match (const RtecEventComm::EventHeader& header) const; - virtual int add_dependencies (const RtecEventComm::EventHeader& header, - const TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL); - -private: - TAO_EC_Bitmask_Filter (const TAO_EC_Bitmask_Filter&); - TAO_EC_Bitmask_Filter& operator= (const TAO_EC_Bitmask_Filter&); - -private: - /// The bitmasks - CORBA::ULong source_mask_; - CORBA::ULong type_mask_; - - /// The children - TAO_EC_Filter* child_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* TAO_EC_BITMASK_FILTER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Busy_Lock.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Busy_Lock.cpp deleted file mode 100644 index f2cce60ee21..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Busy_Lock.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// $Id$ - -#ifndef TAO_EC_BUSY_LOCK_CPP -#define TAO_EC_BUSY_LOCK_CPP - -#include "orbsvcs/Event/EC_Busy_Lock.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Busy_Lock.i" -#endif /* __ACE_INLINE__ */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -template<class T> -int TAO_EC_Busy_Lock_Adapter<T>::remove (void) -{ - return 0; -} - -template<class T> -int TAO_EC_Busy_Lock_Adapter<T>::acquire (void) -{ - return this->adaptee_->busy (); -} - -template<class T> -int TAO_EC_Busy_Lock_Adapter<T>::tryacquire (void) -{ - return this->adaptee_->busy (); -} - -template<class T> -int TAO_EC_Busy_Lock_Adapter<T>::release (void) -{ - return this->adaptee_->idle (); -} - -template<class T> -int TAO_EC_Busy_Lock_Adapter<T>::acquire_read (void) -{ - return this->adaptee_->busy (); -} - -template<class T> -int TAO_EC_Busy_Lock_Adapter<T>::acquire_write (void) -{ - return this->adaptee_->busy (); -} - -template<class T> -int TAO_EC_Busy_Lock_Adapter<T>::tryacquire_read (void) -{ - return this->adaptee_->busy (); -} - -template<class T> -int TAO_EC_Busy_Lock_Adapter<T>::tryacquire_write (void) -{ - return this->adaptee_->busy (); -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -#endif /* TAO_EC_BUSY_LOCK_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Busy_Lock.h b/TAO/orbsvcs/orbsvcs/Event/EC_Busy_Lock.h deleted file mode 100644 index 1640d5b8bf2..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Busy_Lock.h +++ /dev/null @@ -1,66 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Busy_Lock.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_BUSY_LOCK_H -#define TAO_EC_BUSY_LOCK_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -template<class Adaptee> -class TAO_EC_Busy_Lock_Adapter -{ -public: - /// Constructor - TAO_EC_Busy_Lock_Adapter (Adaptee* adaptee); - - // = The ACE_Lock methods, please check $ACE_ROOT/ace/Synch.h for - // details. - - int remove (void); - int acquire (void); - int tryacquire (void); - int release (void); - int acquire_read (void); - int acquire_write (void); - int tryacquire_read (void); - int tryacquire_write (void); - -private: - Adaptee* adaptee_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Busy_Lock.i" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "orbsvcs/Event/EC_Busy_Lock.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("EC_Busy_Lock.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* TAO_EC_BUSY_LOCK_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Busy_Lock.i b/TAO/orbsvcs/orbsvcs/Event/EC_Busy_Lock.i deleted file mode 100644 index 670ad09dd63..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Busy_Lock.i +++ /dev/null @@ -1,13 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -template<class T> ACE_INLINE -TAO_EC_Busy_Lock_Adapter<T>::TAO_EC_Busy_Lock_Adapter (T* adaptee) - : adaptee_ (adaptee) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Channel_Destroyer.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Channel_Destroyer.cpp deleted file mode 100644 index 3759342a5e9..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Channel_Destroyer.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @file EC_Channel_Destroyer.cpp - * - * $Id$ - * - * @author Marina Spivak <marina@atdesk.com> - */ - -#include "orbsvcs/Event/EC_Channel_Destroyer.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -void -TAO_EC_Channel_Destroyer_Functor::operator() ( - TAO_EC_Event_Channel_Base * event_channel) - ACE_THROW_SPEC (()) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - event_channel->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHALL - { - } - ACE_ENDTRY; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Channel_Destroyer.h b/TAO/orbsvcs/orbsvcs/Event/EC_Channel_Destroyer.h deleted file mode 100644 index 4b18ad808fd..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Channel_Destroyer.h +++ /dev/null @@ -1,46 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Channel_Destroyer.h - * - * @author Marina Spivak <marina@atdesk.com> - * - * $Id$ - */ -#ifndef EC_CHANNEL_DESTROYER__H_ -#define EC_CHANNEL_DESTROYER__H_ - -#include /**/ "orbsvcs/Event/event_serv_export.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "ace/Auto_Functor.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @struct TAO_EC_Channel_Destroyer_Functor - * - * @brief Implements a functor for the TAO_EC_Channel_Destroyer class. - */ -struct TAO_RTEvent_Serv_Export TAO_EC_Channel_Destroyer_Functor -{ - typedef TAO_EC_Event_Channel_Base * argument; - - /// Destroy @c event_channel - void operator() (TAO_EC_Event_Channel_Base * event_channel) - ACE_THROW_SPEC (()); -}; - -/** - * @class TAO_EC_Channel_Destroyer - * - * @brief Helper class to destroy event channel. - * - */ -typedef ACE_Utils::Auto_Functor< - TAO_EC_Event_Channel_Base, - TAO_EC_Channel_Destroyer_Functor> - TAO_EC_Channel_Destroyer; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#endif // EC_CHANNEL_DESTROYER__H_ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Conjunction_Filter.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Conjunction_Filter.cpp deleted file mode 100644 index e8fae3ae659..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Conjunction_Filter.cpp +++ /dev/null @@ -1,209 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Conjunction_Filter.h" - -ACE_RCSID(Event, EC_Conjunction_Filter, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -const int bits_per_word = sizeof(TAO_EC_Conjunction_Filter::Word) * CHAR_BIT; - -TAO_EC_Conjunction_Filter:: - TAO_EC_Conjunction_Filter (TAO_EC_Filter* children[], - size_t n) - : children_ (children), - n_ (n) -{ - ChildrenIterator end = this->end (); - for (ChildrenIterator i = this->begin (); - i != end; - ++i) - { - this->adopt_child (*i); - } - - this->nwords_ = this->n_ / bits_per_word + 1; - ACE_NEW (this->bitvec_, Word[this->nwords_]); - - this->clear (); -} - -TAO_EC_Conjunction_Filter::~TAO_EC_Conjunction_Filter (void) -{ - TAO_EC_Filter** end = this->children_ + this->n_; - for (TAO_EC_Filter** i = this->children_; - i != end; - ++i) - { - delete *i; - *i = 0; - } - delete[] this->children_; - this->children_ = 0; - this->n_ = 0; - - delete[] this->bitvec_; - this->bitvec_ = 0; -} - -int -TAO_EC_Conjunction_Filter::all_received (void) const -{ - Word* i = this->bitvec_; - for (; - i != this->bitvec_ + this->nwords_; - ++i) - { - if (*i != static_cast<Word> (~0)) - return 0; - } - return 1; -} - -TAO_EC_Filter::ChildrenIterator -TAO_EC_Conjunction_Filter::begin (void) const -{ - return this->children_; -} - -TAO_EC_Filter::ChildrenIterator -TAO_EC_Conjunction_Filter::end (void) const -{ - return this->children_ + this->n_; -} - -int -TAO_EC_Conjunction_Filter::size (void) const -{ - return static_cast<int> (this->n_); -} - -int -TAO_EC_Conjunction_Filter::filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - ChildrenIterator end = this->end (); - for (this->current_child_ = this->begin (); - this->current_child_ != end; - ++this->current_child_) - { - int n = (*this->current_child_)->filter (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - if (n != 0) - return n; - } - return 0; -} - -int -TAO_EC_Conjunction_Filter::filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - ChildrenIterator end = this->end (); - for (ChildrenIterator i = this->begin (); - i != end; - ++i) - { - int n = (*i)->filter_nocopy (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - if (n != 0) - return n; - } - return 0; -} - -void -TAO_EC_Conjunction_Filter::push (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - CORBA::Long pos = this->current_child_ - this->begin (); - int w = pos / bits_per_word; - int b = pos % bits_per_word; - if (ACE_BIT_ENABLED (this->bitvec_[w], 1<<b)) - return; - ACE_SET_BITS (this->bitvec_[w], 1<<b); - CORBA::ULong n = event.length (); - CORBA::ULong l = this->event_.length (); - this->event_.length (l + n); - for (CORBA::ULong i = 0; i != n; ++i) - { - this->event_[l + i] = event[i]; - } - if (this->all_received () && this->parent () != 0) - this->parent ()->push_nocopy (this->event_, qos_info ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Conjunction_Filter::push_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - this->push (event, qos_info ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Conjunction_Filter::clear (void) -{ - ChildrenIterator end = this->end (); - for (ChildrenIterator i = this->begin (); - i != end; - ++i) - { - (*i)->clear (); - } - Word* j = this->bitvec_; - for (; - j != this->bitvec_ + this->nwords_ - 1; - ++j) - { - *j = 0; - } - int b = static_cast<int> (this->n_ % bits_per_word); - Word last = ~0 << b; - *j = last; - - this->event_.length (0); -} - -CORBA::ULong -TAO_EC_Conjunction_Filter::max_event_size (void) const -{ - CORBA::ULong n = 0; - ChildrenIterator end = this->end (); - for (ChildrenIterator i = this->begin (); - i != end; - ++i) - { - n += (*i)->max_event_size (); - } - return n; -} - -int -TAO_EC_Conjunction_Filter::can_match ( - const RtecEventComm::EventHeader& header) const -{ - ChildrenIterator end = this->end (); - for (ChildrenIterator i = this->begin (); - i != end; - ++i) - { - if ((*i)->can_match (header) != 0) - return 1; - } - return 0; -} - -int -TAO_EC_Conjunction_Filter::add_dependencies ( - const RtecEventComm::EventHeader&, - const TAO_EC_QOS_Info& - ACE_ENV_ARG_DECL_NOT_USED) -{ - return 0; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Conjunction_Filter.h b/TAO/orbsvcs/orbsvcs/Event/EC_Conjunction_Filter.h deleted file mode 100644 index e50d6b37867..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Conjunction_Filter.h +++ /dev/null @@ -1,113 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Conjunction_Filter.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_CONJUNCTION_FILTER_H -#define TAO_EC_CONJUNCTION_FILTER_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Filter.h" -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Conjunction_Filter - * - * @brief The conjunction filter. - * - * This filter waits until each one of its children has accepted - * at least one event. Only in that case it accepts and publishes - * the sequence formed by all the children events. - * - * <H2>Memory Management</H2> - * It assumes ownership of the children. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Conjunction_Filter : public TAO_EC_Filter -{ -public: - /// Constructor. It assumes ownership of both the array and the - /// children. - TAO_EC_Conjunction_Filter (TAO_EC_Filter* children[], - size_t n); - - /// Destructor - virtual ~TAO_EC_Conjunction_Filter (void); - - // = The TAO_EC_Filter methods, please check the documentation in - // TAO_EC_Filter. - virtual ChildrenIterator begin (void) const; - virtual ChildrenIterator end (void) const; - virtual int size (void) const; - virtual int filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual int filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void clear (void); - virtual CORBA::ULong max_event_size (void) const; - virtual int can_match (const RtecEventComm::EventHeader& header) const; - virtual int add_dependencies (const RtecEventComm::EventHeader& header, - const TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL); - - typedef unsigned int Word; - -private: - /// Determine if all the children have received their events. - int all_received (void) const; - - TAO_EC_Conjunction_Filter (const TAO_EC_Conjunction_Filter&); - TAO_EC_Conjunction_Filter& operator= (const TAO_EC_Conjunction_Filter&); - -private: - /// The children - TAO_EC_Filter** children_; - - /// The number of children. - size_t n_; - - /// The event we send up (once all the children have pushed theirs). - RtecEventComm::EventSet event_; - - /** - * The number of words in the bit vector - */ - size_t nwords_; - - /** - * The bit vector to keep track of the children that have received - * their events. - */ - Word* bitvec_; - - /// The current child in the iteration, used in the push() method... - ChildrenIterator current_child_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* TAO_EC_CONJUNCTION_FILTER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp deleted file mode 100644 index 73bf25fff47..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_ConsumerAdmin.h" -#include "orbsvcs/Event/EC_ProxySupplier.h" -#include "orbsvcs/Event/EC_ProxyConsumer.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "orbsvcs/ESF/ESF_Peer_Workers.h" -#include "orbsvcs/ESF/ESF_Peer_Admin.h" -#include "orbsvcs/ESF/ESF_Shutdown_Proxy.h" - -ACE_RCSID (Event, - EC_ConsumerAdmin, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_ConsumerAdmin::TAO_EC_ConsumerAdmin (TAO_EC_Event_Channel_Base *ec) - : TAO_ESF_Peer_Admin<TAO_EC_Event_Channel_Base,TAO_EC_ProxyPushSupplier,RtecEventChannelAdmin::ProxyPushSupplier,TAO_EC_ProxyPushConsumer> (ec) -{ - this->default_POA_ = - this->event_channel_->consumer_poa (); -} - -TAO_EC_ConsumerAdmin::~TAO_EC_ConsumerAdmin (void) -{ -} - -RtecEventChannelAdmin::ProxyPushSupplier_ptr -TAO_EC_ConsumerAdmin::obtain_push_supplier (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->obtain (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -PortableServer::POA_ptr -TAO_EC_ConsumerAdmin::_default_POA (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) -{ - return PortableServer::POA::_duplicate (this->default_POA_.in ()); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h deleted file mode 100644 index 60e45de355a..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h +++ /dev/null @@ -1,81 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_ConsumerAdmin.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_CONSUMERADMIN_H -#define TAO_EC_CONSUMERADMIN_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_ProxySupplier.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/ESF/ESF_Peer_Admin.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Event_Channel_Base; -class TAO_EC_ProxyPushConsumer; - -/** - * @class TAO_EC_ConsumerAdmin - * - * @brief Implements the ConsumerAdmin interface, i.e. the factory for - * TAO_EC_ProxyPushSupplier objects. - * - * <H2> Memory Management</H2> - * It does not assume ownership of the TAO_EC_Event_Channel_Base object; - * but it *does* assume ownership of the TAO_EC_ProxyPushSupplier_Set - * object. - * - * <H2>Locking</H2> - * No provisions for locking, access must be serialized externally. - */ -class TAO_RTEvent_Serv_Export TAO_EC_ConsumerAdmin - : public POA_RtecEventChannelAdmin::ConsumerAdmin - , public TAO_ESF_Peer_Admin<TAO_EC_Event_Channel_Base,TAO_EC_ProxyPushSupplier,RtecEventChannelAdmin::ProxyPushSupplier,TAO_EC_ProxyPushConsumer> -{ -public: - /** - * Constructor. Builds one using the @a event_channel argument. - * In any case it assumes ownership. - */ - TAO_EC_ConsumerAdmin (TAO_EC_Event_Channel_Base* event_channel); - - /// Destructor... - virtual ~TAO_EC_ConsumerAdmin (void); - - // = The RtecEventChannelAdmin::ConsumerAdmin methods... - virtual RtecEventChannelAdmin::ProxyPushSupplier_ptr - obtain_push_supplier (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)); - - // = The PortableServer::ServantBase methods - virtual PortableServer::POA_ptr _default_POA (ACE_ENV_SINGLE_ARG_DECL); - -private: - /// Store the default POA. - PortableServer::POA_var default_POA_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_CONSUMERADMIN_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerControl.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerControl.cpp deleted file mode 100644 index 007d90bd404..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerControl.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_ConsumerControl.h" - -ACE_RCSID(Event, EC_ConsumerControl, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_ConsumerControl::TAO_EC_ConsumerControl (void) -{ -} - -TAO_EC_ConsumerControl::~TAO_EC_ConsumerControl (void) -{ -} - -int -TAO_EC_ConsumerControl::activate (void) -{ - return 0; -} - -int -TAO_EC_ConsumerControl::shutdown (void) -{ - return 0; -} - -void -TAO_EC_ConsumerControl::consumer_not_exist (TAO_EC_ProxyPushSupplier * - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_ConsumerControl::system_exception (TAO_EC_ProxyPushSupplier *, - CORBA::SystemException & - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerControl.h b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerControl.h deleted file mode 100644 index 281fe09f0d3..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerControl.h +++ /dev/null @@ -1,83 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_ConsumerControl.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_CONSUMERCONTROL_H -#define TAO_EC_CONSUMERCONTROL_H - -#include /**/ "ace/pre.h" -#include "ace/CORBA_macros.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/orbconf.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Event_Channel_Base; -class TAO_EC_ProxyPushSupplier; - -namespace CORBA -{ - class Environment; - class SystemException; -} - -/** - * @class TAO_EC_ConsumerControl - * - * @brief ConsumerControl - * - * Defines the interface for the consumer control strategy. - * This strategy handles misbehaving or failing consumers. - */ -class TAO_RTEvent_Serv_Export TAO_EC_ConsumerControl -{ -public: - /// Constructor. - TAO_EC_ConsumerControl (void); - - /// Destructor. - virtual ~TAO_EC_ConsumerControl (void); - - /// Activate any internal threads or timers used to poll the state of - /// the consumers - virtual int activate (void); - virtual int shutdown (void); - - /** - * When pushing an event to the consumer a CORBA::OBJECT_NOT_EXIST - * exception was raised. The only interpretation is that the object - * has been destroyed. The strategy has to (at the very least), - * reclaim all the resources attached to that object. - */ - virtual void consumer_not_exist (TAO_EC_ProxyPushSupplier *proxy - ACE_ENV_ARG_DECL); - - /// Some system exception was raised while trying to contact the - /// consumer - virtual void system_exception (TAO_EC_ProxyPushSupplier *proxy, - CORBA::SystemException & - ACE_ENV_ARG_DECL); -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_CONSUMERCONTROL_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Default_Factory.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Default_Factory.cpp deleted file mode 100644 index c10cfbbb4cd..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Default_Factory.cpp +++ /dev/null @@ -1,1003 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Default_Factory.h" -#include "orbsvcs/Event/EC_Reactive_Dispatching.h" -#include "orbsvcs/Event/EC_MT_Dispatching.h" -#include "orbsvcs/Event/EC_Basic_Filter_Builder.h" -#include "orbsvcs/Event/EC_Prefix_Filter_Builder.h" -#include "orbsvcs/Event/EC_ConsumerAdmin.h" -#include "orbsvcs/Event/EC_SupplierAdmin.h" -#include "orbsvcs/Event/EC_Default_ProxyConsumer.h" -#include "orbsvcs/Event/EC_Default_ProxySupplier.h" -#include "orbsvcs/Event/EC_Trivial_Supplier_Filter.h" -#include "orbsvcs/Event/EC_Per_Supplier_Filter.h" -#include "orbsvcs/Event/EC_ObserverStrategy.h" -#include "orbsvcs/Event/EC_Null_Scheduling.h" -#include "orbsvcs/Event/EC_Group_Scheduling.h" -#include "orbsvcs/Event/EC_Reactive_Timeout_Generator.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "orbsvcs/Event/EC_Reactive_ConsumerControl.h" -#include "orbsvcs/Event/EC_Reactive_SupplierControl.h" - -#include "orbsvcs/ESF/ESF_Proxy_List.h" -#include "orbsvcs/ESF/ESF_Proxy_RB_Tree.h" -#include "orbsvcs/ESF/ESF_Immediate_Changes.h" -#include "orbsvcs/ESF/ESF_Copy_On_Read.h" -#include "orbsvcs/ESF/ESF_Copy_On_Write.h" -#include "orbsvcs/ESF/ESF_Delayed_Changes.h" -#include "orbsvcs/ESF/ESF_Delayed_Command.h" - -#include "tao/ORB_Core.h" - -#include "ace/Arg_Shifter.h" -#include "ace/Sched_Params.h" -#include "ace/OS_NS_strings.h" -#include "ace/Dynamic_Service.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Default_Factory.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, EC_Default_Factory, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Default_Factory::~TAO_EC_Default_Factory (void) -{ -} - -int -TAO_EC_Default_Factory::init_svcs (void) -{ - TAO_EC_Simple_Queue_Full_Action::init_svcs(); - return ACE_Service_Config::static_svcs ()-> - insert (&ace_svc_desc_TAO_EC_Default_Factory); -} - -void -TAO_EC_Default_Factory::unsupported_option_value (const char * option_name, - const char * option_value) -{ - ACE_ERROR ((LM_ERROR, - "EC_Default_Factory - " - "Unsupported <%s> option value: <%s>. " - "Ignoring this option - using defaults instead.\n", - option_name, - option_value)); -} - -int -TAO_EC_Default_Factory::init (int argc, ACE_TCHAR* argv[]) -{ - ACE_Arg_Shifter arg_shifter (argc, argv); - - int priority = - (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) + - ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; - this->dispatching_threads_priority_ = - ACE_Sched_Params::next_priority (ACE_SCHED_FIFO, priority); - - while (arg_shifter.is_anything_left ()) - { - const ACE_TCHAR *arg = arg_shifter.get_current (); - - if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECDispatching")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("reactive")) == 0) - this->dispatching_ = 0; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("mt")) == 0) - this->dispatching_ = 1; - else - this->unsupported_option_value ("-ECDispatching", opt); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECDispatchingThreads")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - this->dispatching_threads_ = ACE_OS::atoi (opt); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECFiltering")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("null")) == 0) - this->filtering_ = 0; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("basic")) == 0) - this->filtering_ = 1; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("prefix")) == 0) - this->filtering_ = 2; - else - this->unsupported_option_value ("-ECFiltering", opt); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECSupplierFilter")) == 0 - // @@ TODO remove, only for backwards compatibility - || ACE_OS::strcasecmp (arg, ACE_TEXT("-ECSupplierFiltering")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("null")) == 0) - this->supplier_filtering_ = 0; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("per-supplier")) == 0) - this->supplier_filtering_ = 1; - else - this->unsupported_option_value ("-ECSupplierFilter", opt); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECTimeout")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("reactive")) == 0) - this->timeout_ = 0; - else - this->unsupported_option_value ("-ECTimeout", opt); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECObserver")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("null")) == 0) - this->observer_ = 0; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("basic")) == 0) - this->observer_ = 1; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("reactive")) == 0) - this->observer_ = 2; - else - this->unsupported_option_value ("-ECObserver", opt); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECScheduling")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("null")) == 0) - this->scheduling_ = 0; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("group")) == 0) - this->scheduling_ = 1; - else - this->unsupported_option_value ("-ECScheduling", opt); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECProxyPushConsumerCollection")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR *current_arg = arg_shifter.get_current (); - ACE_TCHAR *opt = ACE_OS::strdup (current_arg); - int collection_type = 0; - int synch_type = 0; - int iteration_type = 0; - - ACE_TCHAR* aux; - for (ACE_TCHAR* arg = ACE_OS::strtok_r (opt, ACE_TEXT(":"), &aux); - arg != 0; - arg = ACE_OS::strtok_r (0, ACE_TEXT(":"), &aux)) - { - if (ACE_OS::strcasecmp (arg, ACE_TEXT("mt")) == 0) - synch_type = 0; - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("st")) == 0) - synch_type = 1; - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("list")) == 0) - collection_type = 0; - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("rb_tree")) == 0) - collection_type = 1; - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("immediate")) == 0) - iteration_type = 0; - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("copy_on_read")) == 0) - iteration_type = 1; - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("copy_on_write")) == 0) - iteration_type = 2; - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("delayed")) == 0) - iteration_type = 3; - else - ACE_ERROR ((LM_ERROR, - "EC_Default_Factory - " - "Unknown consumer collection modifier <%s>.\n", arg)); - } - ACE_OS::free (opt); - this->consumer_collection_ = - (synch_type << 8) |(collection_type << 4) | iteration_type; - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECProxyPushSupplierCollection")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* current_arg = arg_shifter.get_current(); - ACE_TCHAR* opt = ACE_OS::strdup(current_arg); - int collection_type = 0; - int synch_type = 0; - int iteration_type = 0; - - ACE_TCHAR* aux; - for (ACE_TCHAR* arg = ACE_OS::strtok_r (opt, ACE_TEXT(":"), &aux); - arg != 0; - arg = ACE_OS::strtok_r (0, ACE_TEXT(":"), &aux)) - { - if (ACE_OS::strcasecmp (arg, ACE_TEXT("mt")) == 0) - synch_type = 0; - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("st")) == 0) - synch_type = 1; - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("list")) == 0) - collection_type = 0; - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("rb_tree")) == 0) - collection_type = 1; - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("immediate")) == 0) - iteration_type = 0; - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("copy_on_read")) == 0) - iteration_type = 1; - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("copy_on_write")) == 0) - iteration_type = 2; - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("delayed")) == 0) - iteration_type = 3; - else - ACE_ERROR ((LM_ERROR, - "EC_Default_Factory - " - "Unknown supplier collection modifier <%s>.\n", arg)); - } - ACE_OS::free(opt); - this->supplier_collection_ = - (synch_type << 8) | (collection_type << 4) | iteration_type; - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECProxyConsumerLock")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("null")) == 0) - this->consumer_lock_ = 0; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("thread")) == 0) - this->consumer_lock_ = 1; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("recursive")) == 0) - this->consumer_lock_ = 2; - else - this->unsupported_option_value ("-ECProxyConsumerLock", opt); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECProxySupplierLock")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("null")) == 0) - this->supplier_lock_ = 0; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("thread")) == 0) - this->supplier_lock_ = 1; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("recursive")) == 0) - this->supplier_lock_ = 2; - else - this->unsupported_option_value ("-ECProxySupplierLock", opt); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECUseORBId")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - // Save argument for later use - this->orbid_ = ACE_TEXT_ALWAYS_CHAR(arg_shifter.get_current ()); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECConsumerControl")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("null")) == 0) - this->consumer_control_ = 0; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("reactive")) == 0) - this->consumer_control_ = 1; - else - this->unsupported_option_value ("-ECConsumerControl", opt); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECSupplierControl")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("null")) == 0) - this->supplier_control_ = 0; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("reactive")) == 0) - this->supplier_control_ = 1; - else - this->unsupported_option_value ("-ECSupplierControl", opt); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECConsumerControlPeriod")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - this->consumer_control_period_ = ACE_OS::atoi (opt); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECSupplierControlPeriod")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - this->supplier_control_period_ = ACE_OS::atoi (opt); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECConsumerControlTimeout")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - unsigned long timeout = ACE_OS::strtoul(opt, 0, 10); - this->consumer_control_timeout_.usec(timeout); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECSupplierControlTimeout")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - unsigned long timeout = ACE_OS::strtoul(opt, 0, 10); - this->supplier_control_timeout_.usec(timeout); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECConsumerValidateConnection")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - this->consumer_validate_connection_ = ACE_OS::atoi (opt); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECPushSupplierSet")) == 0) - { - ACE_ERROR ((LM_ERROR, - "EC_Default_Factory - " - "obsolete option <%s>, ignored\n", arg)); - arg_shifter.consume_arg (); - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECQueueFullServiceObject")) == 0) - { - arg_shifter.consume_arg (); - if (arg_shifter.is_parameter_next ()) - { - const char* opt = arg_shifter.get_current (); - this->queue_full_service_object_name_.set(opt); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECConsumerAdminLock")) == 0) - { - ACE_ERROR ((LM_ERROR, - "EC_Default_Factory - " - "obsolete option <%s>, ignored\n", arg)); - arg_shifter.consume_arg (); - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECSupplierAdminLock")) == 0) - { - ACE_ERROR ((LM_ERROR, - "EC_Default_Factory - " - "obsolete option <%s>, ignored\n", arg)); - arg_shifter.consume_arg (); - } - - else if (ACE_OS::strncmp (arg, ACE_TEXT("-EC"), 3) == 0) - { - arg_shifter.consume_arg (); - ACE_ERROR ((LM_ERROR, - "EC_Default_Factory - " - "unknown option <%s>\n", - arg)); - } - else - { - arg_shifter.consume_arg (); - ACE_DEBUG ((LM_DEBUG, - "EC_Default_Factory - " - "ignoring option <%s>\n", - arg)); - } - } - return 0; -} - -int -TAO_EC_Default_Factory::fini (void) -{ - return 0; -} - -// **************************************************************** - -TAO_EC_Queue_Full_Service_Object* -TAO_EC_Default_Factory::find_service_object (const char* wanted, - const char* fallback) -{ - TAO_EC_Queue_Full_Service_Object* so = 0; - so = ACE_Dynamic_Service<TAO_EC_Queue_Full_Service_Object>::instance (wanted); - if (so != 0) - return so; - - ACE_ERROR ((LM_ERROR, - "EC (%P|%t) EC_Default_Factory::create_dispatching " - "unable to find queue full service object '%s'; " - "using '%s' instead\n", - wanted, - fallback)); - - so = ACE_Dynamic_Service<TAO_EC_Queue_Full_Service_Object>::instance (fallback); - if (so != 0) - return so; - - ACE_ERROR ((LM_ERROR, - "EC (%P|%t) EC_Default_Factory::create_dispatching " - "unable find default queue full service object '%s'; " - "aborting.\n", - fallback)); - ACE_OS::abort (); - return 0; // superfluous return to de-warn; we should never reach here -} - -TAO_EC_Dispatching* -TAO_EC_Default_Factory::create_dispatching (TAO_EC_Event_Channel_Base *) -{ - if (this->dispatching_ == 0) - return new TAO_EC_Reactive_Dispatching (); - else if (this->dispatching_ == 1) - { - TAO_EC_Queue_Full_Service_Object* so = - this->find_service_object (this->queue_full_service_object_name_.fast_rep(), - TAO_EC_DEFAULT_QUEUE_FULL_SERVICE_OBJECT_NAME); - return new TAO_EC_MT_Dispatching (this->dispatching_threads_, - this->dispatching_threads_flags_, - this->dispatching_threads_priority_, - this->dispatching_threads_force_active_, - so); - } - return 0; -} - -void -TAO_EC_Default_Factory::destroy_dispatching (TAO_EC_Dispatching *x) -{ - delete x; -} - -TAO_EC_Filter_Builder* -TAO_EC_Default_Factory::create_filter_builder (TAO_EC_Event_Channel_Base *ec) -{ - if (this->filtering_ == 0) - return new TAO_EC_Null_Filter_Builder (); - else if (this->filtering_ == 1) - return new TAO_EC_Basic_Filter_Builder (ec); - else if (this->filtering_ == 2) - return new TAO_EC_Prefix_Filter_Builder (ec); - return 0; -} - -void -TAO_EC_Default_Factory::destroy_filter_builder (TAO_EC_Filter_Builder *x) -{ - delete x; -} - -TAO_EC_Supplier_Filter_Builder* -TAO_EC_Default_Factory::create_supplier_filter_builder (TAO_EC_Event_Channel_Base *ec) -{ - if (this->supplier_filtering_ == 0) - return new TAO_EC_Trivial_Supplier_Filter_Builder (ec); - else if (this->supplier_filtering_ == 1) - return new TAO_EC_Per_Supplier_Filter_Builder (ec); - return 0; -} - -void -TAO_EC_Default_Factory::destroy_supplier_filter_builder (TAO_EC_Supplier_Filter_Builder *x) -{ - delete x; -} - -TAO_EC_ConsumerAdmin* -TAO_EC_Default_Factory::create_consumer_admin (TAO_EC_Event_Channel_Base *ec) -{ - return new TAO_EC_ConsumerAdmin (ec); -} - -void -TAO_EC_Default_Factory::destroy_consumer_admin (TAO_EC_ConsumerAdmin *x) -{ - delete x; -} - -TAO_EC_SupplierAdmin* -TAO_EC_Default_Factory::create_supplier_admin (TAO_EC_Event_Channel_Base *ec) -{ - return new TAO_EC_SupplierAdmin (ec); -} - -void -TAO_EC_Default_Factory::destroy_supplier_admin (TAO_EC_SupplierAdmin *x) -{ - delete x; -} - -TAO_EC_ProxyPushSupplier* -TAO_EC_Default_Factory::create_proxy_push_supplier (TAO_EC_Event_Channel_Base *ec) -{ - return new TAO_EC_Default_ProxyPushSupplier (ec, consumer_validate_connection_); -} - -void -TAO_EC_Default_Factory::destroy_proxy_push_supplier (TAO_EC_ProxyPushSupplier *x) -{ - delete x; -} - -TAO_EC_ProxyPushConsumer* -TAO_EC_Default_Factory::create_proxy_push_consumer (TAO_EC_Event_Channel_Base *ec) -{ - return new TAO_EC_Default_ProxyPushConsumer (ec); -} - -void -TAO_EC_Default_Factory::destroy_proxy_push_consumer (TAO_EC_ProxyPushConsumer *x) -{ - delete x; -} - -TAO_EC_Timeout_Generator* -TAO_EC_Default_Factory::create_timeout_generator (TAO_EC_Event_Channel_Base *) -{ - if (this->timeout_ == 0) - { - int argc = 0; - char **argv = 0; - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, this->orbid_.c_str ()); - - ACE_Reactor *reactor = orb->orb_core ()->reactor (); - return new TAO_EC_Reactive_Timeout_Generator (reactor); - } -#if 0 - else if (this->timeout_ == 1) - { - } -#endif - return 0; -} - -void -TAO_EC_Default_Factory::destroy_timeout_generator (TAO_EC_Timeout_Generator *x) -{ - delete x; -} - -TAO_EC_ObserverStrategy* -TAO_EC_Default_Factory::create_observer_strategy (TAO_EC_Event_Channel_Base *ec) -{ - if (this->observer_ == 0) - return new TAO_EC_Null_ObserverStrategy; - else if (this->observer_ == 1) - { - // @@ The lock should also be under control of the user... - ACE_Lock* lock = 0; - ACE_NEW_RETURN (lock, ACE_Lock_Adapter<TAO_SYNCH_MUTEX>, 0); - return new TAO_EC_Basic_ObserverStrategy (ec, lock); - } - else if (this->observer_ == 2) - { - // @@ The lock should also be under control of the user... - ACE_Lock* lock = 0; - ACE_NEW_RETURN (lock, ACE_Lock_Adapter<TAO_SYNCH_MUTEX>, 0); - return new TAO_EC_Reactive_ObserverStrategy (ec, lock); - } - return 0; -} - -void -TAO_EC_Default_Factory::destroy_observer_strategy (TAO_EC_ObserverStrategy *x) -{ - delete x; -} - -TAO_EC_Scheduling_Strategy* -TAO_EC_Default_Factory::create_scheduling_strategy (TAO_EC_Event_Channel_Base*) -{ - if (this->scheduling_ == 0) - return new TAO_EC_Null_Scheduling; - else if (this->scheduling_ == 1) - return new TAO_EC_Group_Scheduling; - return 0; -} - -void -TAO_EC_Default_Factory::destroy_scheduling_strategy (TAO_EC_Scheduling_Strategy* x) -{ - delete x; -} - -// These typedefs workaround a SunCC 4.2 bug -typedef - TAO_ESF_Proxy_List<TAO_EC_ProxyPushConsumer>::Iterator - TAO_EC_Consumer_List_Iterator; -typedef - TAO_ESF_Proxy_RB_Tree<TAO_EC_ProxyPushConsumer>::Iterator - TAO_EC_Consumer_RB_Tree_Iterator; -typedef - TAO_ESF_Proxy_List<TAO_EC_ProxyPushSupplier>::Iterator - TAO_EC_Supplier_List_Iterator; -typedef - TAO_ESF_Proxy_RB_Tree<TAO_EC_ProxyPushSupplier>::Iterator - TAO_EC_Supplier_RB_Tree_Iterator; - - -TAO_EC_ProxyPushConsumer_Collection* -TAO_EC_Default_Factory::create_proxy_push_consumer_collection (TAO_EC_Event_Channel_Base *) -{ - if (this->consumer_collection_ == 0x000) - return new TAO_ESF_Immediate_Changes<TAO_EC_ProxyPushConsumer, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushConsumer>, - TAO_EC_Consumer_List_Iterator, - TAO_SYNCH_MUTEX> (); - else if (this->consumer_collection_ == 0x001) - return new TAO_ESF_Copy_On_Read<TAO_EC_ProxyPushConsumer, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushConsumer>, - TAO_EC_Consumer_List_Iterator, - TAO_SYNCH_MUTEX> (); - else if (this->consumer_collection_ == 0x002) - return new TAO_ESF_Copy_On_Write<TAO_EC_ProxyPushConsumer, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushConsumer>, - TAO_EC_Consumer_List_Iterator, - ACE_SYNCH> (); - else if (this->consumer_collection_ == 0x003) - return new TAO_ESF_Delayed_Changes<TAO_EC_ProxyPushConsumer, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushConsumer>, - TAO_EC_Consumer_List_Iterator, - ACE_SYNCH> (); - else if (this->consumer_collection_ == 0x010) - return new TAO_ESF_Immediate_Changes<TAO_EC_ProxyPushConsumer, - TAO_ESF_Proxy_RB_Tree<TAO_EC_ProxyPushConsumer>, - TAO_EC_Consumer_RB_Tree_Iterator, - TAO_SYNCH_MUTEX> (); - else if (this->consumer_collection_ == 0x011) - return new TAO_ESF_Copy_On_Read<TAO_EC_ProxyPushConsumer, - TAO_ESF_Proxy_RB_Tree<TAO_EC_ProxyPushConsumer>, - TAO_EC_Consumer_RB_Tree_Iterator, - TAO_SYNCH_MUTEX> (); - else if (this->consumer_collection_ == 0x012) - return new TAO_ESF_Copy_On_Write<TAO_EC_ProxyPushConsumer, - TAO_ESF_Proxy_RB_Tree<TAO_EC_ProxyPushConsumer>, - TAO_EC_Consumer_RB_Tree_Iterator, - ACE_SYNCH> (); - else if (this->consumer_collection_ == 0x013) - return new TAO_ESF_Delayed_Changes<TAO_EC_ProxyPushConsumer, - TAO_ESF_Proxy_RB_Tree<TAO_EC_ProxyPushConsumer>, - TAO_EC_Consumer_RB_Tree_Iterator, - ACE_SYNCH> (); - else if (this->consumer_collection_ == 0x100) - return new TAO_ESF_Immediate_Changes<TAO_EC_ProxyPushConsumer, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushConsumer>, - TAO_EC_Consumer_List_Iterator, - ACE_Null_Mutex> (); - else if (this->consumer_collection_ == 0x101) - return new TAO_ESF_Copy_On_Read<TAO_EC_ProxyPushConsumer, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushConsumer>, - TAO_EC_Consumer_List_Iterator, - ACE_Null_Mutex> (); - else if (this->consumer_collection_ == 0x102) - return new TAO_ESF_Copy_On_Write<TAO_EC_ProxyPushConsumer, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushConsumer>, - TAO_EC_Consumer_List_Iterator, - ACE_NULL_SYNCH> (); - else if (this->consumer_collection_ == 0x103) - return new TAO_ESF_Delayed_Changes<TAO_EC_ProxyPushConsumer, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushConsumer>, - TAO_EC_Consumer_List_Iterator, - ACE_NULL_SYNCH> (); - else if (this->consumer_collection_ == 0x110) - return new TAO_ESF_Immediate_Changes<TAO_EC_ProxyPushConsumer, - TAO_ESF_Proxy_RB_Tree<TAO_EC_ProxyPushConsumer>, - TAO_EC_Consumer_RB_Tree_Iterator, - ACE_Null_Mutex> (); - else if (this->consumer_collection_ == 0x111) - return new TAO_ESF_Copy_On_Read<TAO_EC_ProxyPushConsumer, - TAO_ESF_Proxy_RB_Tree<TAO_EC_ProxyPushConsumer>, - TAO_EC_Consumer_RB_Tree_Iterator, - ACE_Null_Mutex> (); - else if (this->consumer_collection_ == 0x112) - return new TAO_ESF_Copy_On_Write<TAO_EC_ProxyPushConsumer, - TAO_ESF_Proxy_RB_Tree<TAO_EC_ProxyPushConsumer>, - TAO_EC_Consumer_RB_Tree_Iterator, - ACE_NULL_SYNCH> (); - else if (this->consumer_collection_ == 0x113) - return new TAO_ESF_Delayed_Changes<TAO_EC_ProxyPushConsumer, - TAO_ESF_Proxy_RB_Tree<TAO_EC_ProxyPushConsumer>, - TAO_EC_Consumer_RB_Tree_Iterator, - ACE_NULL_SYNCH> (); - - return 0; -} - -void -TAO_EC_Default_Factory::destroy_proxy_push_consumer_collection (TAO_EC_ProxyPushConsumer_Collection *x) -{ - delete x; -} - -TAO_EC_ProxyPushSupplier_Collection* -TAO_EC_Default_Factory::create_proxy_push_supplier_collection (TAO_EC_Event_Channel_Base *) -{ - if (this->supplier_collection_ == 0x000) - return new TAO_ESF_Immediate_Changes<TAO_EC_ProxyPushSupplier, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushSupplier>, - TAO_EC_Supplier_List_Iterator, - TAO_SYNCH_MUTEX> (); - else if (this->supplier_collection_ == 0x001) - return new TAO_ESF_Copy_On_Read<TAO_EC_ProxyPushSupplier, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushSupplier>, - TAO_EC_Supplier_List_Iterator, - TAO_SYNCH_MUTEX> (); - else if (this->supplier_collection_ == 0x002) - return new TAO_ESF_Copy_On_Write<TAO_EC_ProxyPushSupplier, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushSupplier>, - TAO_EC_Supplier_List_Iterator, - ACE_SYNCH> (); - else if (this->supplier_collection_ == 0x003) - return new TAO_ESF_Delayed_Changes<TAO_EC_ProxyPushSupplier, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushSupplier>, - TAO_EC_Supplier_List_Iterator, - ACE_SYNCH> (); - else if (this->supplier_collection_ == 0x010) - return new TAO_ESF_Immediate_Changes<TAO_EC_ProxyPushSupplier, - TAO_ESF_Proxy_RB_Tree<TAO_EC_ProxyPushSupplier>, - TAO_EC_Supplier_RB_Tree_Iterator, - TAO_SYNCH_MUTEX> (); - else if (this->supplier_collection_ == 0x011) - return new TAO_ESF_Copy_On_Read<TAO_EC_ProxyPushSupplier, - TAO_ESF_Proxy_RB_Tree<TAO_EC_ProxyPushSupplier>, - TAO_EC_Supplier_RB_Tree_Iterator, - TAO_SYNCH_MUTEX> (); - else if (this->supplier_collection_ == 0x012) - return new TAO_ESF_Copy_On_Write<TAO_EC_ProxyPushSupplier, - TAO_ESF_Proxy_RB_Tree<TAO_EC_ProxyPushSupplier>, - TAO_EC_Supplier_RB_Tree_Iterator, - ACE_SYNCH> (); - else if (this->supplier_collection_ == 0x013) - return new TAO_ESF_Delayed_Changes<TAO_EC_ProxyPushSupplier, - TAO_ESF_Proxy_RB_Tree<TAO_EC_ProxyPushSupplier>, - TAO_EC_Supplier_RB_Tree_Iterator, - ACE_SYNCH> (); - else if (this->supplier_collection_ == 0x100) - return new TAO_ESF_Immediate_Changes<TAO_EC_ProxyPushSupplier, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushSupplier>, - TAO_EC_Supplier_List_Iterator, - ACE_Null_Mutex> (); - else if (this->supplier_collection_ == 0x101) - return new TAO_ESF_Copy_On_Read<TAO_EC_ProxyPushSupplier, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushSupplier>, - TAO_EC_Supplier_List_Iterator, - ACE_Null_Mutex> (); - else if (this->supplier_collection_ == 0x102) - return new TAO_ESF_Copy_On_Write<TAO_EC_ProxyPushSupplier, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushSupplier>, - TAO_EC_Supplier_List_Iterator, - ACE_NULL_SYNCH> (); - else if (this->supplier_collection_ == 0x103) - return new TAO_ESF_Delayed_Changes<TAO_EC_ProxyPushSupplier, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushSupplier>, - TAO_EC_Supplier_List_Iterator, - ACE_NULL_SYNCH> (); - else if (this->supplier_collection_ == 0x110) - return new TAO_ESF_Immediate_Changes<TAO_EC_ProxyPushSupplier, - TAO_ESF_Proxy_RB_Tree<TAO_EC_ProxyPushSupplier>, - TAO_EC_Supplier_RB_Tree_Iterator, - ACE_Null_Mutex> (); - else if (this->supplier_collection_ == 0x111) - return new TAO_ESF_Copy_On_Read<TAO_EC_ProxyPushSupplier, - TAO_ESF_Proxy_RB_Tree<TAO_EC_ProxyPushSupplier>, - TAO_EC_Supplier_RB_Tree_Iterator, - ACE_Null_Mutex> (); - else if (this->supplier_collection_ == 0x112) - return new TAO_ESF_Copy_On_Write<TAO_EC_ProxyPushSupplier, - TAO_ESF_Proxy_RB_Tree<TAO_EC_ProxyPushSupplier>, - TAO_EC_Supplier_RB_Tree_Iterator, - ACE_NULL_SYNCH> (); - else if (this->supplier_collection_ == 0x113) - return new TAO_ESF_Delayed_Changes<TAO_EC_ProxyPushSupplier, - TAO_ESF_Proxy_RB_Tree<TAO_EC_ProxyPushSupplier>, - TAO_EC_Supplier_RB_Tree_Iterator, - ACE_NULL_SYNCH> (); - - return 0; -} - -void -TAO_EC_Default_Factory::destroy_proxy_push_supplier_collection (TAO_EC_ProxyPushSupplier_Collection *x) -{ - delete x; -} - -ACE_Lock* -TAO_EC_Default_Factory::create_consumer_lock (void) -{ - if (this->consumer_lock_ == 0) - return new ACE_Lock_Adapter<ACE_Null_Mutex>; - else if (this->consumer_lock_ == 1) - return new ACE_Lock_Adapter<TAO_SYNCH_MUTEX> (); - else if (this->consumer_lock_ == 2) - return new ACE_Lock_Adapter<TAO_SYNCH_RECURSIVE_MUTEX> (); - return 0; -} - -void -TAO_EC_Default_Factory::destroy_consumer_lock (ACE_Lock* x) -{ - delete x; -} - -ACE_Lock* -TAO_EC_Default_Factory::create_supplier_lock (void) -{ - if (this->supplier_lock_ == 0) - return new ACE_Lock_Adapter<ACE_Null_Mutex>; - else if (this->supplier_lock_ == 1) - return new ACE_Lock_Adapter<TAO_SYNCH_MUTEX> (); - else if (this->supplier_lock_ == 2) - return new ACE_Lock_Adapter<TAO_SYNCH_RECURSIVE_MUTEX> (); - return 0; -} - -void -TAO_EC_Default_Factory::destroy_supplier_lock (ACE_Lock* x) -{ - delete x; -} - -TAO_EC_ConsumerControl* -TAO_EC_Default_Factory::create_consumer_control (TAO_EC_Event_Channel_Base* ec) -{ - if (this->consumer_control_ == 0) - return new TAO_EC_ConsumerControl (); - else if (this->consumer_control_ == 1) - { - int argc = 0; - char **argv = 0; - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, this->orbid_.c_str ()); - - ACE_Time_Value rate (0, this->consumer_control_period_); - return new TAO_EC_Reactive_ConsumerControl (rate, consumer_control_timeout_, ec, orb.in ()); - } - return 0; -} - -void -TAO_EC_Default_Factory::destroy_consumer_control (TAO_EC_ConsumerControl* x) -{ - delete x; -} - -TAO_EC_SupplierControl* -TAO_EC_Default_Factory::create_supplier_control (TAO_EC_Event_Channel_Base* ec) -{ - if (this->supplier_control_ == 0) - return new TAO_EC_SupplierControl (); - else if (this->supplier_control_ == 1) - { - int argc = 0; - char **argv = 0; - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, this->orbid_.c_str ()); - - ACE_Time_Value rate (0, this->supplier_control_period_); - return new TAO_EC_Reactive_SupplierControl (rate, supplier_control_timeout_, ec, orb.in ()); - } - return 0; -} - -void -TAO_EC_Default_Factory::destroy_supplier_control (TAO_EC_SupplierControl* x) -{ - delete x; -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -// **************************************************************** - -ACE_STATIC_SVC_DEFINE (TAO_EC_Default_Factory, - ACE_TEXT ("EC_Factory"), - ACE_SVC_OBJ_T, - &ACE_SVC_NAME (TAO_EC_Default_Factory), - ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, - 0) -ACE_FACTORY_DEFINE (TAO_RTEvent_Serv, TAO_EC_Default_Factory) diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Default_Factory.h b/TAO/orbsvcs/orbsvcs/Event/EC_Default_Factory.h deleted file mode 100644 index a5bce5d5df3..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Default_Factory.h +++ /dev/null @@ -1,201 +0,0 @@ -/* -*- C++ -*- */ -/** - * @file EC_Default_Factory.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_DEFAULT_FACTORY_H -#define TAO_EC_DEFAULT_FACTORY_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Factory.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/Event/EC_Defaults.h" - -#include "ace/Service_Config.h" -#include "ace/SString.h" -#include "ace/Time_Value.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Queue_Full_Service_Object; - -/** - * @class TAO_EC_Default_Factory - * - * @brief A generic factory for EC experimentation. - * - * This class allows the user to experiment with different EC - * configurations. Using a command-line like interface the user - * can specify which strategies will this factory generate. - * Since the class can be dynamically loaded the strategies can be - * set in the service configurator file. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Default_Factory : public TAO_EC_Factory -{ -public: - /// Constructor - TAO_EC_Default_Factory (void); - - /// destructor... - virtual ~TAO_EC_Default_Factory (void); - - /// Helper function to register the default factory into the service - /// configurator. - static int init_svcs (void); - - // = The Service_Object entry points - virtual int init (int argc, ACE_TCHAR* argv[]); - virtual int fini (void); - - // = The EC_Factory methods - virtual TAO_EC_Dispatching* - create_dispatching (TAO_EC_Event_Channel_Base*); - virtual void - destroy_dispatching (TAO_EC_Dispatching*); - virtual TAO_EC_Filter_Builder* - create_filter_builder (TAO_EC_Event_Channel_Base*); - virtual void - destroy_filter_builder (TAO_EC_Filter_Builder*); - virtual TAO_EC_Supplier_Filter_Builder* - create_supplier_filter_builder (TAO_EC_Event_Channel_Base*); - virtual void - destroy_supplier_filter_builder (TAO_EC_Supplier_Filter_Builder*); - virtual TAO_EC_ConsumerAdmin* - create_consumer_admin (TAO_EC_Event_Channel_Base*); - virtual void - destroy_consumer_admin (TAO_EC_ConsumerAdmin*); - virtual TAO_EC_SupplierAdmin* - create_supplier_admin (TAO_EC_Event_Channel_Base*); - virtual void - destroy_supplier_admin (TAO_EC_SupplierAdmin*); - virtual TAO_EC_ProxyPushSupplier* - create_proxy_push_supplier (TAO_EC_Event_Channel_Base*); - virtual void - destroy_proxy_push_supplier (TAO_EC_ProxyPushSupplier*); - virtual TAO_EC_ProxyPushConsumer* - create_proxy_push_consumer (TAO_EC_Event_Channel_Base*); - virtual void - destroy_proxy_push_consumer (TAO_EC_ProxyPushConsumer*); - virtual TAO_EC_Timeout_Generator* - create_timeout_generator (TAO_EC_Event_Channel_Base*); - virtual void - destroy_timeout_generator (TAO_EC_Timeout_Generator*); - virtual TAO_EC_ObserverStrategy* - create_observer_strategy (TAO_EC_Event_Channel_Base*); - virtual void - destroy_observer_strategy (TAO_EC_ObserverStrategy*); - virtual TAO_EC_Scheduling_Strategy* - create_scheduling_strategy (TAO_EC_Event_Channel_Base*); - virtual void - destroy_scheduling_strategy (TAO_EC_Scheduling_Strategy*); - virtual TAO_EC_ProxyPushConsumer_Collection* - create_proxy_push_consumer_collection (TAO_EC_Event_Channel_Base*); - virtual void - destroy_proxy_push_consumer_collection (TAO_EC_ProxyPushConsumer_Collection*); - virtual TAO_EC_ProxyPushSupplier_Collection* - create_proxy_push_supplier_collection (TAO_EC_Event_Channel_Base*); - virtual void - destroy_proxy_push_supplier_collection (TAO_EC_ProxyPushSupplier_Collection*); - - virtual ACE_Lock* create_consumer_lock (void); - virtual void destroy_consumer_lock (ACE_Lock*); - virtual ACE_Lock* create_supplier_lock (void); - virtual void destroy_supplier_lock (ACE_Lock*); - - virtual TAO_EC_ConsumerControl* - create_consumer_control (TAO_EC_Event_Channel_Base*); - virtual void - destroy_consumer_control (TAO_EC_ConsumerControl*); - virtual TAO_EC_SupplierControl* - create_supplier_control (TAO_EC_Event_Channel_Base*); - virtual void - destroy_supplier_control (TAO_EC_SupplierControl*); - - /// Accessors to consumer collection flags - int consumer_collection (void) const; - - /// Accessors to supplier collection flags - int supplier_collection (void) const; - - /// Accessors to supplier filtering flags - int supplier_filtering (void) const; - - /// Accessor to ORBid - const ACE_CString& orb_id (void) const; -protected: - - /// Helper for agrument parsing. Prints out an error message about - /// unsupported option value. - void unsupported_option_value (const char * option_name, - const char * option_value); - -protected: - /// Several flags to control the kind of object created. - int dispatching_; - int filtering_; - int supplier_filtering_; - int timeout_; - int observer_; - int scheduling_; - int consumer_collection_; - int supplier_collection_; - int consumer_lock_; - int supplier_lock_; - - /// The MT dispatching priority has several arguments that could be - /// controlled here... - int dispatching_threads_; - int dispatching_threads_flags_; - int dispatching_threads_priority_; - int dispatching_threads_force_active_; - ACE_CString queue_full_service_object_name_; - TAO_EC_Queue_Full_Service_Object* find_service_object (const char* wanted, - const char* fallback); - - /// Use this ORB to locate global resources. - ACE_CString orbid_; - - /// The consumer and supplier control policies. - int consumer_control_; - int supplier_control_; - - /// The consumer and supplier control periods in usecs - int consumer_control_period_; - int supplier_control_period_; - - /// The consumer control timeout in usecs - ACE_Time_Value consumer_control_timeout_; - - /// The supplier control timeout in usecs - ACE_Time_Value supplier_control_timeout_; - - /// Validate the connection to consumer on connect - int consumer_validate_connection_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Default_Factory.i" -#endif /* __ACE_INLINE__ */ - -ACE_STATIC_SVC_DECLARE (TAO_EC_Default_Factory) -ACE_FACTORY_DECLARE (TAO_RTEvent_Serv, TAO_EC_Default_Factory) - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_DEFAULT_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Default_Factory.i b/TAO/orbsvcs/orbsvcs/Event/EC_Default_Factory.i deleted file mode 100644 index 2564cd3b0c5..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Default_Factory.i +++ /dev/null @@ -1,59 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_Default_Factory::TAO_EC_Default_Factory (void) - : dispatching_ (TAO_EC_DEFAULT_DISPATCHING), - filtering_ (TAO_EC_DEFAULT_CONSUMER_FILTER), - supplier_filtering_ (TAO_EC_DEFAULT_SUPPLIER_FILTER), - timeout_ (TAO_EC_DEFAULT_TIMEOUT), - observer_ (TAO_EC_DEFAULT_OBSERVER), - scheduling_ (TAO_EC_DEFAULT_SCHEDULING), - consumer_collection_ (TAO_EC_DEFAULT_CONSUMER_COLLECTION), - supplier_collection_ (TAO_EC_DEFAULT_SUPPLIER_COLLECTION), - consumer_lock_ (TAO_EC_DEFAULT_CONSUMER_LOCK), - supplier_lock_ (TAO_EC_DEFAULT_SUPPLIER_LOCK), - dispatching_threads_ (TAO_EC_DEFAULT_DISPATCHING_THREADS), - dispatching_threads_flags_ (TAO_EC_DEFAULT_DISPATCHING_THREADS_FLAGS), - dispatching_threads_priority_ (TAO_EC_DEFAULT_DISPATCHING_THREADS_PRIORITY), - dispatching_threads_force_active_ (TAO_EC_DEFAULT_DISPATCHING_THREADS_FORCE_ACTIVE), - queue_full_service_object_name_ (TAO_EC_DEFAULT_QUEUE_FULL_SERVICE_OBJECT_NAME), - orbid_ (TAO_EC_DEFAULT_ORB_ID), - consumer_control_ (TAO_EC_DEFAULT_CONSUMER_CONTROL), - supplier_control_ (TAO_EC_DEFAULT_SUPPLIER_CONTROL), - consumer_control_period_ (TAO_EC_DEFAULT_CONSUMER_CONTROL_PERIOD), - supplier_control_period_ (TAO_EC_DEFAULT_SUPPLIER_CONTROL_PERIOD), - consumer_control_timeout_ (0, TAO_EC_DEFAULT_CONSUMER_CONTROL_TIMEOUT), - supplier_control_timeout_ (0, TAO_EC_DEFAULT_SUPPLIER_CONTROL_TIMEOUT), - consumer_validate_connection_ (TAO_EC_DEFAULT_CONSUMER_VALIDATE_CONNECTION) -{ -} - -ACE_INLINE int -TAO_EC_Default_Factory::consumer_collection (void) const -{ - return this->consumer_collection_; -} - -ACE_INLINE int -TAO_EC_Default_Factory::supplier_collection (void) const -{ - return this->supplier_collection_; -} - -ACE_INLINE int -TAO_EC_Default_Factory::supplier_filtering (void) const -{ - return this->supplier_filtering_; -} - -ACE_INLINE const ACE_CString& -TAO_EC_Default_Factory::orb_id (void) const -{ - return this->orbid_; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Default_ProxyConsumer.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Default_ProxyConsumer.cpp deleted file mode 100644 index e3bca47a2d0..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Default_ProxyConsumer.cpp +++ /dev/null @@ -1,192 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Default_ProxyConsumer.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "orbsvcs/Event/EC_Supplier_Filter_Builder.h" -#include "orbsvcs/Event/EC_Supplier_Filter.h" -#include "ace/Synch_T.h" - -ACE_RCSID(Event, EC_Default_ProxyConsumer, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -typedef ACE_Reverse_Lock<ACE_Lock> TAO_EC_Unlock; - -TAO_EC_Default_ProxyPushConsumer:: - TAO_EC_Default_ProxyPushConsumer (TAO_EC_Event_Channel_Base* ec) - : TAO_EC_ProxyPushConsumer (ec) -{ -} - -TAO_EC_Default_ProxyPushConsumer::~TAO_EC_Default_ProxyPushConsumer (void) -{ -} - -void -TAO_EC_Default_ProxyPushConsumer::connect_push_supplier ( - RtecEventComm::PushSupplier_ptr push_supplier, - const RtecEventChannelAdmin::SupplierQOS& qos - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - RtecEventChannelAdmin::AlreadyConnected)) -{ - { - ACE_GUARD_THROW_EX ( - ACE_Lock, ace_mon, *this->lock_, - CORBA::INTERNAL ()); - // @@ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ()); - ACE_CHECK; - - if (this->is_connected_i ()) - { - if (this->event_channel_->supplier_reconnect () == 0) - ACE_THROW (RtecEventChannelAdmin::AlreadyConnected ()); - - // Re-connections are allowed, go ahead and disconnect the - // consumer... - this->cleanup_i (); - - // @@ Please read the comments in EC_ProxySuppliers about - // possible race conditions in this area... - TAO_EC_Unlock reverse_lock (*this->lock_); - - { - ACE_GUARD_THROW_EX ( - TAO_EC_Unlock, ace_mon, reverse_lock, - CORBA::INTERNAL ()); - // @@ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ()); - ACE_CHECK; - - this->event_channel_->reconnected (this ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - - // A separate thread could have connected siomultaneously, - // this is probably an application error, handle it as - // gracefully as possible - if (this->is_connected_i ()) - return; // @@ Should we throw - } - - this->supplier_ = - RtecEventComm::PushSupplier::_duplicate (push_supplier); - this->connected_ = 1; - this->qos_ = qos; - -#if TAO_EC_ENABLE_DEBUG_MESSAGES - ACE_DEBUG ((LM_DEBUG, - "Building filter for supplier <%x>.\n", - this)); -#endif /* TAO_EC_ENABLED_DEBUG_MESSAGES */ - this->filter_ = - this->event_channel_->supplier_filter_builder ()->create (this->qos_); - this->filter_->bind (this); - } - - // Notify the event channel... - this->event_channel_->connected (this ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Default_ProxyPushConsumer::push (const RtecEventComm::EventSet& event - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - TAO_EC_ProxyPushConsumer_Guard ace_mon (this->lock_, - this->refcount_, - this->event_channel_, - this); - if (!ace_mon.locked ()) - return; - - ace_mon.filter->push (event, this - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_EC_Default_ProxyPushConsumer::disconnect_push_consumer ( - ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - RtecEventComm::PushSupplier_var supplier; - int connected = 0; - - { - ACE_GUARD_THROW_EX ( - ACE_Lock, ace_mon, *this->lock_, - CORBA::INTERNAL ()); - // @@ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ()); - ACE_CHECK; - - connected = this->is_connected_i (); - supplier = this->supplier_._retn (); - this->connected_ = 0; - - if (connected) - this->cleanup_i (); - } - - // Notify the event channel... - this->event_channel_->disconnected (this ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (CORBA::is_nil (supplier.in ())) - { - return; - } - - if (this->event_channel_->disconnect_callbacks ()) - { - ACE_TRY - { - supplier->disconnect_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore exceptions, we must isolate other clients from - // failures on this one. - } - ACE_ENDTRY; - } -} - -PortableServer::POA_ptr -TAO_EC_Default_ProxyPushConsumer::_default_POA (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) -{ - return PortableServer::POA::_duplicate (this->default_POA_.in ()); -} - -void -TAO_EC_Default_ProxyPushConsumer::_add_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) -{ - this->_incr_refcnt (); -} - -void -TAO_EC_Default_ProxyPushConsumer::_remove_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) -{ - this->_decr_refcnt (); -} - -void -TAO_EC_Default_ProxyPushConsumer::activate ( - RtecEventChannelAdmin::ProxyPushConsumer_ptr &proxy - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - proxy = this->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; -} - -PortableServer::ObjectId -TAO_EC_Default_ProxyPushConsumer::object_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - PortableServer::ObjectId_var result = - this->default_POA_->servant_to_id (this ACE_ENV_ARG_PARAMETER); - return result.in (); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Default_ProxyConsumer.h b/TAO/orbsvcs/orbsvcs/Event/EC_Default_ProxyConsumer.h deleted file mode 100644 index e08d7d4c092..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Default_ProxyConsumer.h +++ /dev/null @@ -1,85 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Default_ProxyConsumer.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * @author Marina Spivak (marina@atdesk.com) - * @author Jason Smith (jason@atdesk.com) - * - */ - -#ifndef TAO_EC_DEFAULT_PROXYCONSUMER_H -#define TAO_EC_DEFAULT_PROXYCONSUMER_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/RtecEventChannelAdminS.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/Event/EC_ProxyConsumer.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Event_Channel_Base; -class TAO_EC_ProxyPushSupplier; -class TAO_EC_Supplier_Filter; - -/** - * @class TAO_EC_Default_ProxyPushConsumer - * - * @brief implements RtecEventChannelAdmin::ProxyPushConsumer interface. - * - */ -class TAO_RTEvent_Serv_Export TAO_EC_Default_ProxyPushConsumer : - public POA_RtecEventChannelAdmin::ProxyPushConsumer, - public TAO_EC_ProxyPushConsumer -{ -public: - - /// Constructor... - TAO_EC_Default_ProxyPushConsumer (TAO_EC_Event_Channel_Base* event_channel); - - /// Destructor... - virtual ~TAO_EC_Default_ProxyPushConsumer (void); - - virtual void activate ( - RtecEventChannelAdmin::ProxyPushConsumer_ptr &proxy - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - // = The RtecEventChannelAdmin::ProxyPushConsumer methods... - virtual void connect_push_supplier ( - RtecEventComm::PushSupplier_ptr push_supplier, - const RtecEventChannelAdmin::SupplierQOS& qos - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - RtecEventChannelAdmin::AlreadyConnected)); - virtual void push (const RtecEventComm::EventSet& event - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - virtual void disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - // = The Servant methods - virtual PortableServer::POA_ptr _default_POA (ACE_ENV_SINGLE_ARG_DECL); - virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL); - virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL); - -private: - - virtual PortableServer::ObjectId - object_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_DEFAULT_PROXYCONSUMER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Default_ProxySupplier.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Default_ProxySupplier.cpp deleted file mode 100644 index a431afb219f..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Default_ProxySupplier.cpp +++ /dev/null @@ -1,228 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Default_ProxySupplier.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "orbsvcs/Event/EC_Filter_Builder.h" - -#include "ace/Reverse_Lock_T.h" - -ACE_RCSID (Event, - EC_ProxySupplier, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -typedef ACE_Reverse_Lock<ACE_Lock> TAO_EC_Unlock; - -TAO_EC_Default_ProxyPushSupplier::TAO_EC_Default_ProxyPushSupplier ( - TAO_EC_Event_Channel_Base* ec, - int validate_connection) - : TAO_EC_ProxyPushSupplier (ec, validate_connection) -{ -} - -TAO_EC_Default_ProxyPushSupplier::~TAO_EC_Default_ProxyPushSupplier (void) -{ -} - -void -TAO_EC_Default_ProxyPushSupplier::connect_push_consumer ( - RtecEventComm::PushConsumer_ptr push_consumer, - const RtecEventChannelAdmin::ConsumerQOS& qos - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - RtecEventChannelAdmin::AlreadyConnected, - RtecEventChannelAdmin::TypeError)) -{ - // Nil PushConsumers are illegal - if (CORBA::is_nil (push_consumer)) - ACE_THROW (CORBA::BAD_PARAM ()); - - { - ACE_GUARD_THROW_EX ( - ACE_Lock, ace_mon, *this->lock_, - CORBA::INTERNAL ()); - // @@ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ()); - ACE_CHECK; - - if (this->is_connected_i ()) - { - if (this->event_channel_->consumer_reconnect () == 0) - ACE_THROW (RtecEventChannelAdmin::AlreadyConnected ()); - - // Re-connections are allowed.... - this->cleanup_i (); - - this->consumer_ = - RtecEventComm::PushConsumer::_duplicate (push_consumer); - this->qos_ = qos; - this->child_ = - this->event_channel_->filter_builder ()->build (this, - this->qos_ - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->adopt_child (this->child_); - - TAO_EC_Unlock reverse_lock (*this->lock_); - - { - ACE_GUARD_THROW_EX ( - TAO_EC_Unlock, ace_mon, reverse_lock, - CORBA::INTERNAL ()); - // @@ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ()); - ACE_CHECK; - - this->event_channel_->reconnected (this ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - - // A separate thread could have connected simultaneously, - // this is probably an application error, handle it as - // gracefully as possible - if (this->is_connected_i ()) - return; // @@ Should we throw - } - -#if (TAO_HAS_CORBA_MESSAGING == 1) - if ( consumer_validate_connection_ == 1 ) - { - // Validate connection during connect. - CORBA::PolicyList_var unused; - int status = push_consumer->_validate_connection (unused - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -#if TAO_EC_ENABLE_DEBUG_MESSAGES - ACE_DEBUG ((LM_DEBUG, "Validated connection to PushConsumer on connect. Status[%d]\n", status)); -#else - ACE_UNUSED_ARG(status); -#endif /* TAO_EC_ENABLED_DEBUG_MESSAGES */ - } -#endif /* TAO_HAS_CORBA_MESSAGING == 1 */ - - this->consumer_ = - RtecEventComm::PushConsumer::_duplicate (push_consumer); - this->qos_ = qos; - -#if TAO_EC_ENABLE_DEBUG_MESSAGES - ACE_DEBUG ((LM_DEBUG, - "Building filters for consumer <%x>.\n", - this)); -#endif /* TAO_EC_ENABLED_DEBUG_MESSAGES */ - this->child_ = - this->event_channel_->filter_builder ()->build (this, - this->qos_ - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->adopt_child (this->child_); - } - - // Notify the event channel... - this->event_channel_->connected (this ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Default_ProxyPushSupplier::disconnect_push_supplier ( - ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - RtecEventComm::PushConsumer_var consumer; - int connected = 0; - - { - ACE_GUARD_THROW_EX ( - ACE_Lock, ace_mon, *this->lock_, - CORBA::INTERNAL ()); - // @@ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ()); - ACE_CHECK; - - connected = this->is_connected_i (); - consumer = this->consumer_._retn (); - - if (connected) - this->cleanup_i (); - } - - // Notify the event channel.... - this->event_channel_->disconnected (this ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (!connected) - { - return; - } - - if (this->event_channel_->disconnect_callbacks ()) - { - ACE_TRY - { - consumer->disconnect_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore exceptions, we must isolate other clients from - // problems on this one. - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "ProxySupplier::disconnect_push_supplier"); - } - ACE_ENDTRY; - } -} - -void -TAO_EC_Default_ProxyPushSupplier::suspend_connection (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->suspend_connection_locked (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_EC_Default_ProxyPushSupplier::resume_connection (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->resume_connection_locked (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; -} - -PortableServer::POA_ptr -TAO_EC_Default_ProxyPushSupplier::_default_POA (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) -{ - return PortableServer::POA::_duplicate (this->default_POA_.in ()); -} - -void -TAO_EC_Default_ProxyPushSupplier::_add_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) -{ - this->_incr_refcnt (); -} - -void -TAO_EC_Default_ProxyPushSupplier::_remove_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) -{ - this->_decr_refcnt (); -} - -void -TAO_EC_Default_ProxyPushSupplier::activate ( - RtecEventChannelAdmin::ProxyPushSupplier_ptr &proxy - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - proxy = this->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; -} - -PortableServer::ObjectId -TAO_EC_Default_ProxyPushSupplier::object_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - PortableServer::ObjectId_var result = - this->default_POA_->servant_to_id (this ACE_ENV_ARG_PARAMETER); - - return result.in (); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Default_ProxySupplier.h b/TAO/orbsvcs/orbsvcs/Event/EC_Default_ProxySupplier.h deleted file mode 100644 index ae59254ea93..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Default_ProxySupplier.h +++ /dev/null @@ -1,82 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Default_ProxySupplier.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * @author Marina Spivak (marina@atdesk.com) - * @author Jason Smith (jason@atdesk.com) - */ - -#ifndef TAO_DEFAULT_EC_PROXYSUPPLIER_H -#define TAO_DEFAULT_EC_PROXYSUPPLIER_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/RtecEventChannelAdminS.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/Event/EC_ProxySupplier.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Default_ProxyPushSupplier - * - * @brief Implement the ReliableEventChannelAdmin::ProxyPushSupplier - * interface - */ -class TAO_RTEvent_Serv_Export TAO_EC_Default_ProxyPushSupplier - : public POA_RtecEventChannelAdmin::ProxyPushSupplier, - public TAO_EC_ProxyPushSupplier -{ -public: - - /// Constructor... - TAO_EC_Default_ProxyPushSupplier (TAO_EC_Event_Channel_Base* event_channel, int validate_connection); - - /// Destructor... - virtual ~TAO_EC_Default_ProxyPushSupplier (void); - - void activate ( - RtecEventChannelAdmin::ProxyPushSupplier_ptr &proxy - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// IDL methods. - virtual void connect_push_consumer ( - RtecEventComm::PushConsumer_ptr push_consumer, - const RtecEventChannelAdmin::ConsumerQOS &qos - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - RtecEventChannelAdmin::AlreadyConnected, - RtecEventChannelAdmin::TypeError)); - virtual void disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - virtual void suspend_connection (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - virtual void resume_connection (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - // = The Servant methods - virtual PortableServer::POA_ptr _default_POA (ACE_ENV_SINGLE_ARG_DECL); - virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL); - virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL); - -private: - - virtual PortableServer::ObjectId - object_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_DEFAULT_PROXYSUPPLIER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Defaults.h b/TAO/orbsvcs/orbsvcs/Event/EC_Defaults.h deleted file mode 100644 index bcabf232a45..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Defaults.h +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- C++ -*- */ -/** - * @file EC_Defaults.h - * - * $Id$ - * - * In this file we set the compile time defaults for the event - * channel. - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_DEFAULTS_H -#define TAO_EC_DEFAULTS_H - -#include /**/ "ace/pre.h" - -#ifndef TAO_EC_ENABLE_DEBUG_MESSAGES -#define TAO_EC_ENABLE_DEBUG_MESSAGES 0 -#endif /* TAO_EC_ENABLE_DEBUG_MESSAGES */ - -// Any of the definitions below can be overriden in the config.h file -// or the compilation line. - -// Control consumer and supplier reconnections -#ifndef TAO_EC_DEFAULT_CONSUMER_RECONNECT -# define TAO_EC_DEFAULT_CONSUMER_RECONNECT 0 -#endif /* TAO_EC_DEFAULT_CONSUMER_RECONNECT */ - -#ifndef TAO_EC_DEFAULT_SUPPLIER_RECONNECT -#define TAO_EC_DEFAULT_SUPPLIER_RECONNECT 0 -#endif /* TAO_EC_DEFAULT_SUPPLIER_RECONNECT */ - -// Control callbacks when proxies are disconnected -#ifndef TAO_EC_DEFAULT_DISCONNECT_CALLBACKS -# define TAO_EC_DEFAULT_DISCONNECT_CALLBACKS 0 -#endif /* TAO_EC_DEFAULT_DISCONNECT_CALLBACKS */ - -// The defaults for the default factory. -// The TAO_EC_Default_Factory is a run-time configurable factory for -// the event channel. Using the service configurator the user can -// specify what strategies should the factory produce. -// This macros control the default values for those strategies. -// -#ifndef TAO_EC_DEFAULT_DISPATCHING -# define TAO_EC_DEFAULT_DISPATCHING 0 /* reactive */ -#endif /* TAO_EC_DEFAULT_DISPATCHING */ - -#ifndef TAO_EC_DEFAULT_CONSUMER_FILTER -# define TAO_EC_DEFAULT_CONSUMER_FILTER 1 /* type, disj. conj. timers */ -#endif /* TAO_EC_DEFAULT_CONSUMER_FILTER */ - -#ifndef TAO_EC_DEFAULT_SUPPLIER_FILTER -# define TAO_EC_DEFAULT_SUPPLIER_FILTER 1 /* per supplier */ -#endif /* TAO_EC_DEFAULT_SUPPLIER_FILTER */ - -#ifndef TAO_EC_DEFAULT_TIMEOUT -# define TAO_EC_DEFAULT_TIMEOUT 0 /* reactive */ -#endif /* TAO_EC_DEFAULT_TIMEOUT */ - -#ifndef TAO_EC_DEFAULT_OBSERVER -# define TAO_EC_DEFAULT_OBSERVER 0 /* null */ -#endif /* TAO_EC_DEFAULT_OBSERVER */ - -#ifndef TAO_EC_DEFAULT_SCHEDULING -# define TAO_EC_DEFAULT_SCHEDULING 0 /* null */ -#endif /* TAO_EC_DEFAULT_SCHEDULING */ - -#ifndef TAO_EC_DEFAULT_CONSUMER_COLLECTION -# define TAO_EC_DEFAULT_CONSUMER_COLLECTION 0x001 /* copy-on-read MT-safe */ -#endif /* TAO_EC_DEFAULT_CONSUMER_COLLECTION */ - -#ifndef TAO_EC_DEFAULT_SUPPLIER_COLLECTION -# define TAO_EC_DEFAULT_SUPPLIER_COLLECTION 0x001 /* copy-on-read MT-safe */ -#endif /* TAO_EC_DEFAULT_SUPPLIER_COLLECTION */ - -#ifndef TAO_EC_DEFAULT_CONSUMER_LOCK -# define TAO_EC_DEFAULT_CONSUMER_LOCK 1 /* thread */ -#endif /* TAO_EC_DEFAULT_CONSUMER_LOCK */ - -#ifndef TAO_EC_DEFAULT_SUPPLIER_LOCK -# define TAO_EC_DEFAULT_SUPPLIER_LOCK 1 /* thread */ -#endif /* TAO_EC_DEFAULT_SUPPLIER_LOCK */ - -#ifndef TAO_EC_DEFAULT_DISPATCHING_THREADS -# define TAO_EC_DEFAULT_DISPATCHING_THREADS 1 /* */ -#endif /* TAO_EC_DEFAULT_DISPATCHING_THREADS */ - -#ifndef TAO_EC_DEFAULT_DISPATCHING_THREADS_FLAGS -# define TAO_EC_DEFAULT_DISPATCHING_THREADS_FLAGS THR_NEW_LWP|THR_SCHED_FIFO -#endif /* TAO_EC_DEFAULT_DISPATCHING_THREADS */ - -#ifndef TAO_EC_DEFAULT_DISPATCHING_THREADS_PRIORITY -# define TAO_EC_DEFAULT_DISPATCHING_THREADS_PRIORITY 0 /* */ -#endif /* TAO_EC_DEFAULT_DISPATCHING_THREADS_PRIORITY */ - -#ifndef TAO_EC_DEFAULT_DISPATCHING_THREADS_FORCE_ACTIVE -# define TAO_EC_DEFAULT_DISPATCHING_THREADS_FORCE_ACTIVE 1 -#endif /* TAO_EC_DEFAULT_DISPATCHING_THREADS_FORCE_ACTIVE */ - -#ifndef TAO_EC_DEFAULT_ORB_ID -# define TAO_EC_DEFAULT_ORB_ID "" /* */ -#endif /* TAO_EC_DEFAULT_ORB_ID */ - -#ifndef TAO_EC_DEFAULT_CONSUMER_CONTROL -# define TAO_EC_DEFAULT_CONSUMER_CONTROL 0 /* null */ -#endif /* TAO_EC_DEFAULT_CONSUMER_CONTROL */ - -#ifndef TAO_EC_DEFAULT_SUPPLIER_CONTROL -# define TAO_EC_DEFAULT_SUPPLIER_CONTROL 0 /* null */ -#endif /* TAO_EC_DEFAULT_SUPPLIER_CONTROL */ - -#ifndef TAO_EC_DEFAULT_CONSUMER_CONTROL_PERIOD -# define TAO_EC_DEFAULT_CONSUMER_CONTROL_PERIOD 5000000 /* usecs */ -#endif /* TAO_EC_DEFAULT_CONSUMER_CONTROL_PERIOD */ - -#ifndef TAO_EC_DEFAULT_SUPPLIER_CONTROL_PERIOD -# define TAO_EC_DEFAULT_SUPPLIER_CONTROL_PERIOD 5000000 /* usecs */ -#endif /* TAO_EC_DEFAULT_SUPPLIER_CONTROL_PERIOD */ - -#ifndef TAO_EC_DEFAULT_QUEUE_FULL_SERVICE_OBJECT_NAME -# define TAO_EC_DEFAULT_QUEUE_FULL_SERVICE_OBJECT_NAME "EC_QueueFullSimpleActions" -#endif /* TAO_EC_DEFAULT_QUEUE_FULL_SERVICE_OBJECT_NAME */ - -#ifndef TAO_EC_DEFAULT_CONSUMER_CONTROL_TIMEOUT -# define TAO_EC_DEFAULT_CONSUMER_CONTROL_TIMEOUT 10000 /* usecs */ -#endif /* TAO_EC_DEFAULT_CONSUMER_CONTROL_TIMEOUT */ - -#ifndef TAO_EC_DEFAULT_SUPPLIER_CONTROL_TIMEOUT -# define TAO_EC_DEFAULT_SUPPLIER_CONTROL_TIMEOUT 10000 /* usecs */ -#endif /* TAO_EC_DEFAULT_SUPPLIER_CONTROL_TIMEOUT */ - -#ifndef TAO_EC_DEFAULT_CONSUMER_VALIDATE_CONNECTION -# define TAO_EC_DEFAULT_CONSUMER_VALIDATE_CONNECTION 0 /* no validation */ -#endif /* TAO_EC_DEFAULT_CONSUMER_VALIDATE_CONNECTION */ - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_DEFAULTS_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Disjunction_Filter.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Disjunction_Filter.cpp deleted file mode 100644 index 9016401e2f4..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Disjunction_Filter.cpp +++ /dev/null @@ -1,163 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Disjunction_Filter.h" - -ACE_RCSID(Event, EC_Disjunction_Filter, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Disjunction_Filter:: - TAO_EC_Disjunction_Filter (TAO_EC_Filter* children[], - size_t n) - : children_ (children), - n_ (n) -{ - ChildrenIterator end = this->end (); - for (ChildrenIterator i = this->begin (); - i != end; - ++i) - { - this->adopt_child (*i); - } -} - -TAO_EC_Disjunction_Filter::~TAO_EC_Disjunction_Filter (void) -{ - TAO_EC_Filter** end = this->children_ + this->n_; - for (TAO_EC_Filter** i = this->children_; - i != end; - ++i) - { - delete *i; - *i = 0; - } - delete[] this->children_; - this->children_ = 0; - this->n_ = 0; -} - -TAO_EC_Filter::ChildrenIterator -TAO_EC_Disjunction_Filter::begin (void) const -{ - return this->children_; -} - -TAO_EC_Filter::ChildrenIterator -TAO_EC_Disjunction_Filter::end (void) const -{ - return this->children_ + this->n_; -} - -int -TAO_EC_Disjunction_Filter::size (void) const -{ - return static_cast<int> (this->n_); -} - -int -TAO_EC_Disjunction_Filter::filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - ChildrenIterator end = this->end (); - for (ChildrenIterator i = this->begin (); - i != end; - ++i) - { - int n = (*i)->filter (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - if (n != 0) - return n; - } - return 0; -} - -int -TAO_EC_Disjunction_Filter::filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - ChildrenIterator end = this->end (); - for (ChildrenIterator i = this->begin (); - i != end; - ++i) - { - int n = (*i)->filter (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - if (n != 0) - return n; - } - return 0; -} - -void -TAO_EC_Disjunction_Filter::push (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - if (this->parent () != 0) - this->parent ()->push (event, qos_info ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Disjunction_Filter::push_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - if (this->parent () != 0) - this->parent ()->push_nocopy (event, qos_info ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Disjunction_Filter::clear (void) -{ - ChildrenIterator end = this->end (); - for (ChildrenIterator i = this->begin (); - i != end; - ++i) - { - (*i)->clear (); - } -} - -CORBA::ULong -TAO_EC_Disjunction_Filter::max_event_size (void) const -{ - CORBA::ULong n = 0; - ChildrenIterator end = this->end (); - for (ChildrenIterator i = this->begin (); - i != end; - ++i) - { - CORBA::ULong m = (*i)->max_event_size (); - if (n < m) - n = m; - } - return n; -} - -int -TAO_EC_Disjunction_Filter::can_match ( - const RtecEventComm::EventHeader& header) const -{ - ChildrenIterator end = this->end (); - for (ChildrenIterator i = this->begin (); - i != end; - ++i) - { - if ((*i)->can_match (header) != 0) - return 1; - } - return 0; -} - -int -TAO_EC_Disjunction_Filter::add_dependencies ( - const RtecEventComm::EventHeader&, - const TAO_EC_QOS_Info & - ACE_ENV_ARG_DECL_NOT_USED) -{ - return 0; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Disjunction_Filter.h b/TAO/orbsvcs/orbsvcs/Event/EC_Disjunction_Filter.h deleted file mode 100644 index 06585acb46d..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Disjunction_Filter.h +++ /dev/null @@ -1,90 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Disjunction_Filter.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_DISJUNCTION_FILTER_H -#define TAO_EC_DISJUNCTION_FILTER_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Filter.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Disjunction_Filter - * - * @brief The disjunction filter. - * - * This filter has a set of children (fixed at creation time), if - * any of the children accepts an event then it also does. - * - * <H2>Memory Management</H2> - * It assumes ownership of the children. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Disjunction_Filter : public TAO_EC_Filter -{ -public: - /// Constructor. It assumes ownership of both the array and the - /// children. - TAO_EC_Disjunction_Filter (TAO_EC_Filter* children[], - size_t n); - - /// Destructor - virtual ~TAO_EC_Disjunction_Filter (void); - - - // = The TAO_EC_Filter methods, please check the documentation in - // TAO_EC_Filter. - virtual ChildrenIterator begin (void) const; - virtual ChildrenIterator end (void) const; - virtual int size (void) const; - virtual int filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual int filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void clear (void); - virtual CORBA::ULong max_event_size (void) const; - virtual int can_match (const RtecEventComm::EventHeader& header) const; - virtual int add_dependencies (const RtecEventComm::EventHeader& header, - const TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL); - -private: - TAO_EC_Disjunction_Filter (const TAO_EC_Disjunction_Filter&); - TAO_EC_Disjunction_Filter& operator= (const TAO_EC_Disjunction_Filter&); - -private: - /// The children - TAO_EC_Filter** children_; - - /// The number of children. - size_t n_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* TAO_EC_DISJUNCTION_FILTER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching.cpp deleted file mode 100644 index 4e2ead6d6e1..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching.cpp +++ /dev/null @@ -1,14 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Dispatching.h" -#include "orbsvcs/Event/EC_ProxySupplier.h" - -ACE_RCSID(Event, EC_Dispatching, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Dispatching::~TAO_EC_Dispatching (void) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching.h b/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching.h deleted file mode 100644 index 14fc0cc7860..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching.h +++ /dev/null @@ -1,84 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Dispatching.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_DISPATCHING_H -#define TAO_EC_DISPATCHING_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/RtecEventCommC.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_QOS_Info; -class TAO_EC_ProxyPushSupplier; - -/** - * @class TAO_EC_Dispatching - * - * @brief Abstract base class for the dispatching strategies. - * - * The dispatching strategies. - * The EC may be configured with different dispatching strategies, - * for instance, it can use a pool of threads to dispatch the - * events, or a set of queues with threads at different priorities - * for each queue or can simply push the event to the consumer in - * FIFO order. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Dispatching -{ -public: - /// Destructor... - virtual ~TAO_EC_Dispatching (void); - - /// Initialize all the data structures, activate any internal threads, - /// etc. - virtual void activate (void) = 0; - - /** - * Deactivate any internal threads and cleanup internal data - * structures, it should only return once the threads have finished - * their jobs. - */ - virtual void shutdown (void) = 0; - - /** - * The consumer represented by @a proxy should receive @a event. - * It can use the information in @a qos_info to determine the event - * priority (among other things). - */ - virtual void push (TAO_EC_ProxyPushSupplier *proxy, - RtecEventComm::PushConsumer_ptr consumer, - const RtecEventComm::EventSet &event, - TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0; - virtual void push_nocopy (TAO_EC_ProxyPushSupplier *proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet &event, - TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_DISPATCHING_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching_Task.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching_Task.cpp deleted file mode 100644 index 93b6952aa8d..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching_Task.cpp +++ /dev/null @@ -1,210 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Dispatching_Task.h" -#include "orbsvcs/Event/EC_ProxySupplier.h" -#include "orbsvcs/Event/EC_Defaults.h" - -#include "tao/ORB_Constants.h" -#include "ace/OS_NS_errno.h" -#include "ace/OS_NS_strings.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Dispatching_Task.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (Event, - EC_Dispatching, - "$Id$") - - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Simple_Queue_Full_Action::TAO_EC_Simple_Queue_Full_Action (void) - : queue_full_action_return_value_ (WAIT_TO_EMPTY) -{ -} - -/// Helper function to register the default action into the service -/// configurator. -int -TAO_EC_Simple_Queue_Full_Action::init_svcs (void) -{ - return ACE_Service_Config::static_svcs ()-> - insert (&ace_svc_desc_TAO_EC_Simple_Queue_Full_Action); -} - -int -TAO_EC_Simple_Queue_Full_Action::init (int argc, char* argv[]) -{ - // Here we look at the args and set an internal flag indicating whether - // the default action should be to wait for the queue to not be full - // or whether it should be to silently discard the event. - - // @@ This should use the arg shifter stuff, but let's keep it simple to - // start. - - do { - if (argc == 0) - break; - - if (ACE_OS::strcasecmp ("wait", argv[0]) == 0) - this->queue_full_action_return_value_ = WAIT_TO_EMPTY; - else if (ACE_OS::strcasecmp ("discard", argv[0]) == 0) - this->queue_full_action_return_value_ = SILENTLY_DISCARD; -#if 0 - else - ; - // probably ought to print an error message here -#endif - } while (0); - - return 0; -} - -int -TAO_EC_Simple_Queue_Full_Action::fini (void) -{ - return 0; -} - -int -TAO_EC_Simple_Queue_Full_Action::queue_full_action (TAO_EC_Dispatching_Task * /*task*/, - TAO_EC_ProxyPushSupplier * /*proxy*/, - RtecEventComm::PushConsumer_ptr /*consumer*/, - RtecEventComm::EventSet& /*event*/ - ACE_ENV_ARG_DECL_NOT_USED) -{ - return this->queue_full_action_return_value_; -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -ACE_STATIC_SVC_DEFINE (TAO_EC_Simple_Queue_Full_Action, - ACE_TEXT (TAO_EC_DEFAULT_QUEUE_FULL_SERVICE_OBJECT_NAME), - ACE_SVC_OBJ_T, - &ACE_SVC_NAME (TAO_EC_Simple_Queue_Full_Action), - ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, - 0) -ACE_FACTORY_DEFINE (TAO_RTEvent_Serv, TAO_EC_Simple_Queue_Full_Action) - - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL -int -TAO_EC_Queue::is_full_i (void) -{ - return static_cast<size_t> (this->cur_count_) > this->high_water_mark_; -} - -// **************************************************************** - -int -TAO_EC_Dispatching_Task::svc (void) -{ - int done = 0; - while (!done) - { - ACE_TRY_NEW_ENV - { - ACE_Message_Block *mb = 0; - if (this->getq (mb) == -1) - if (ACE_OS::last_error () == ESHUTDOWN) - return 0; - else - ACE_ERROR ((LM_ERROR, - "EC (%P|%t) getq error in Dispatching Queue\n")); - - TAO_EC_Dispatch_Command *command = - dynamic_cast<TAO_EC_Dispatch_Command*> (mb); - - if (command == 0) - { - ACE_Message_Block::release (mb); - continue; - } - - int result = command->execute (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_Message_Block::release (mb); - - if (result == -1) - done = 1; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "EC (%P|%t) exception in dispatching queue"); - } - ACE_ENDTRY; - } - return 0; -} - -void -TAO_EC_Dispatching_Task::push (TAO_EC_ProxyPushSupplier *proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet& event - ACE_ENV_ARG_DECL) -{ - if (this->msg_queue()->is_full ()) - { - int action = - this->queue_full_service_object_->queue_full_action (this, proxy, - consumer, event - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (action == TAO_EC_Queue_Full_Service_Object::SILENTLY_DISCARD) - return; - // if action == WAIT_TO_EMPTY then we just go ahead and queue it - } - - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - void* buf = this->allocator_->malloc (sizeof (TAO_EC_Push_Command)); - - if (buf == 0) - ACE_THROW (CORBA::NO_MEMORY (TAO::VMCID, - CORBA::COMPLETED_NO)); - - ACE_Message_Block *mb = - new (buf) TAO_EC_Push_Command (proxy, - consumer, - event, - this->data_block_.duplicate (), - this->allocator_); - this->putq (mb); -} - -// **************************************************************** - -TAO_EC_Dispatch_Command::~TAO_EC_Dispatch_Command (void) -{ -} - -// **************************************************************** - -int -TAO_EC_Shutdown_Task_Command::execute (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) -{ - return -1; -} - -// **************************************************************** - -TAO_EC_Push_Command::~TAO_EC_Push_Command (void) -{ - this->proxy_->_decr_refcnt (); -} - -int -TAO_EC_Push_Command::execute (ACE_ENV_SINGLE_ARG_DECL) -{ - this->proxy_->push_to_consumer (this->consumer_.in (), - this->event_ - ACE_ENV_ARG_PARAMETER); - return 0; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching_Task.h b/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching_Task.h deleted file mode 100644 index 7aaedd68071..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching_Task.h +++ /dev/null @@ -1,199 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Dispatching_Task.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_DISPATCHING_TASK_H -#define TAO_EC_DISPATCHING_TASK_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_ProxySupplier.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/RtecEventCommC.h" -#include /**/ "orbsvcs/Event/event_serv_export.h" -#include "ace/Task.h" -#include "ace/Message_Block.h" -#include "ace/Lock_Adapter_T.h" -#include "ace/Service_Config.h" -#include "ace/Global_Macros.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward decl -class TAO_EC_Dispatching_Task; - -class TAO_RTEvent_Serv_Export TAO_EC_Queue_Full_Service_Object : public ACE_Service_Object -{ -public: - enum QueueFullActionReturnValue - { - WAIT_TO_EMPTY = 0, - SILENTLY_DISCARD = -1 - }; - - // Called when - virtual int queue_full_action (TAO_EC_Dispatching_Task *task, - TAO_EC_ProxyPushSupplier *proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet& event - ACE_ENV_ARG_DECL) = 0; -}; - -class TAO_RTEvent_Serv_Export TAO_EC_Simple_Queue_Full_Action : - public TAO_EC_Queue_Full_Service_Object -{ -public: - TAO_EC_Simple_Queue_Full_Action (); - - /// Helper function to register the default action into the service - /// configurator. - static int init_svcs (void); - - // = The Service_Object entry points - virtual int init (int argc, char* argv[]); - virtual int fini (void); - - virtual int queue_full_action (TAO_EC_Dispatching_Task *task, - TAO_EC_ProxyPushSupplier *proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet& event - ACE_ENV_ARG_DECL); - -protected: - int queue_full_action_return_value_; -}; - -class TAO_RTEvent_Serv_Export TAO_EC_Queue : public ACE_Message_Queue<ACE_SYNCH> -{ -public: - TAO_EC_Queue (size_t high_water_mark = ACE_Message_Queue_Base::DEFAULT_HWM, - size_t low_water_mark = ACE_Message_Queue_Base::DEFAULT_LWM, - ACE_Notification_Strategy * = 0); - -protected: - // = Override the default definition in the Message_Queue, to count - // the number of messages (and not their size). - virtual int is_full_i (void); -}; - -/** - * @class TAO_EC_Dispatching_Task - * - * @brief Implement the dispatching queues for FIFO and Priority - * dispatching. - * - */ -class TAO_RTEvent_Serv_Export TAO_EC_Dispatching_Task : public ACE_Task<ACE_SYNCH> -{ -public: - /// Constructor - TAO_EC_Dispatching_Task (ACE_Thread_Manager* thr_manager = 0, TAO_EC_Queue_Full_Service_Object* queue_full_service_object = 0); - - /// Process the events in the queue. - virtual int svc (void); - - virtual void push (TAO_EC_ProxyPushSupplier *proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet& event - ACE_ENV_ARG_DECL); - -private: - /// An per-task allocator - ACE_Allocator *allocator_; - - /// Helper data structure to minimize memory allocations... - ACE_Locked_Data_Block<ACE_Lock_Adapter<TAO_SYNCH_MUTEX> > data_block_; - - /// The queue - TAO_EC_Queue the_queue_; - - TAO_EC_Queue_Full_Service_Object* queue_full_service_object_; -}; - -// **************************************************************** - -class TAO_RTEvent_Serv_Export TAO_EC_Dispatch_Command : public ACE_Message_Block -{ -public: - /// Constructor, it will allocate its own data block - TAO_EC_Dispatch_Command (ACE_Allocator *mb_allocator = 0); - - /// Constructor, it assumes ownership of the data block - TAO_EC_Dispatch_Command (ACE_Data_Block*, - ACE_Allocator *mb_allocator = 0); - - /// Destructor - virtual ~TAO_EC_Dispatch_Command (void); - - /// Command callback - virtual int execute (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) = 0; -}; - -// **************************************************************** - -class TAO_RTEvent_Serv_Export TAO_EC_Shutdown_Task_Command : public TAO_EC_Dispatch_Command -{ -public: - /// Constructor - TAO_EC_Shutdown_Task_Command (ACE_Allocator *mb_allocator = 0); - - /// Command callback - virtual int execute (ACE_ENV_SINGLE_ARG_DECL_NOT_USED); -}; - -// **************************************************************** - -class TAO_RTEvent_Serv_Export TAO_EC_Push_Command : public TAO_EC_Dispatch_Command -{ -public: - /// Constructor - TAO_EC_Push_Command (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet& event, - ACE_Data_Block* data_block, - ACE_Allocator *mb_allocator); - - /// Destructor - virtual ~TAO_EC_Push_Command (void); - - /// Command callback - virtual int execute (ACE_ENV_SINGLE_ARG_DECL_NOT_USED); - -private: - /// The proxy - TAO_EC_ProxyPushSupplier* proxy_; - - /// The consumer connected to the proxy when the event was pushed. - RtecEventComm::PushConsumer_var consumer_; - - /// The event - RtecEventComm::EventSet event_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Dispatching_Task.i" -#endif /* __ACE_INLINE__ */ - -ACE_STATIC_SVC_DECLARE (TAO_EC_Simple_Queue_Full_Action) -ACE_FACTORY_DECLARE (TAO_RTEvent_Serv, TAO_EC_Simple_Queue_Full_Action) - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_DISPATCHING_TASK_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching_Task.i b/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching_Task.i deleted file mode 100644 index 37930e408fe..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching_Task.i +++ /dev/null @@ -1,95 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_Queue:: - TAO_EC_Queue (size_t high_water_mark, - size_t low_water_mark, - ACE_Notification_Strategy *ns) - : ACE_Message_Queue<ACE_SYNCH> (high_water_mark, - low_water_mark, - ns) -{ -} - -/// @todo The high water mark and low water mark shouldn't be -/// hardcoded, check http://deuce.doc.wustl.edu/bugzilla/show_bug.cgi?id=565 -#ifndef TAO_EC_QUEUE_HWM -#define TAO_EC_QUEUE_HWM 16384 -//#define TAO_EC_QUEUE_HWM 2 -#endif - -#ifndef TAO_EC_QUEUE_LWM -#define TAO_EC_QUEUE_LWM 16 -//#define TAO_EC_QUEUE_LWM 1 -#endif - -ACE_INLINE -TAO_EC_Dispatching_Task:: -TAO_EC_Dispatching_Task (ACE_Thread_Manager* thr_manager, TAO_EC_Queue_Full_Service_Object* so) - : ACE_Task<ACE_SYNCH> (thr_manager), - allocator_ (0), - the_queue_ (TAO_EC_QUEUE_HWM, TAO_EC_QUEUE_LWM), - queue_full_service_object_ (so) -{ - this->msg_queue (&this->the_queue_); -} - -// **************************************************************** - -ACE_INLINE -TAO_EC_Dispatch_Command::TAO_EC_Dispatch_Command (ACE_Allocator *mb_allocator) - : ACE_Message_Block (mb_allocator) -{ -} - -ACE_INLINE -TAO_EC_Dispatch_Command::TAO_EC_Dispatch_Command (ACE_Data_Block *data_block, - ACE_Allocator *mb_allocator) - : ACE_Message_Block (data_block, - 0, - mb_allocator) -{ -} - -// **************************************************************** - -ACE_INLINE -TAO_EC_Shutdown_Task_Command:: - TAO_EC_Shutdown_Task_Command (ACE_Allocator *mb_allocator) - : TAO_EC_Dispatch_Command (mb_allocator) -{ -} - -// **************************************************************** - -ACE_INLINE -TAO_EC_Push_Command::TAO_EC_Push_Command ( - TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet& event, - ACE_Data_Block* data_block, - ACE_Allocator *mb_allocator) - : TAO_EC_Dispatch_Command (data_block, mb_allocator), - proxy_ (proxy), - consumer_ (RtecEventComm::PushConsumer::_duplicate (consumer)) - -{ - // - // Efficient copy, steal the buffer from <event> - // We cannot do this on the initialization because get_buffer() - // could get called first, effectively setting maximum() and - // length() to 0! - // - CORBA::ULong maximum = event.maximum (); - CORBA::ULong length = event.length (); - RtecEventComm::Event* buffer = event.get_buffer (1); - event_.replace (maximum, length, buffer, 1); - - this->proxy_->_incr_refcnt (); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.cpp deleted file mode 100644 index b35602065d0..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Event_Channel.h" -#include "orbsvcs/Event/EC_Default_Factory.h" -#include "ace/Dynamic_Service.h" - -ACE_RCSID(Event, EC_Event_Channel, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Event_Channel:: -TAO_EC_Event_Channel (const TAO_EC_Event_Channel_Attributes& attr, - TAO_EC_Factory* factory, - int own_factory) - : TAO_EC_Event_Channel_Base (attr, factory, own_factory) -{ - if (this->factory () == 0) - { - this->factory ( - ACE_Dynamic_Service<TAO_EC_Factory>::instance ("EC_Factory"), - 0); - - if (this->factory () == 0) - { - TAO_EC_Factory *f = 0; - ACE_NEW (f, - TAO_EC_Default_Factory); - this->factory (f, 1); - } - } - this->scheduler_ = - CORBA::Object::_duplicate (attr.scheduler); - - this->create_strategies (); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.h b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.h deleted file mode 100644 index a2aa9b95643..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.h +++ /dev/null @@ -1,62 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Event_Channel.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * @author Marina Spivak (marina@atdesk.com) - * @author Jason Smith (jason@atdesk.com) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_EVENT_CHANNEL_H -#define TAO_EC_EVENT_CHANNEL_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Event_Channel_Base.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Event_Channel - * - * @brief The RtecEventChannelAdmin::EventChannel implementation. - * - * This class is the Mediator between all the classes in the EC - * implementation, its main task is to redirect the messages to - * the right components, to hold and manage the lifetime of the - * long lived objects (Timer_Module, SupplierAdmin, - * ConsumerAdmin and Dispatching) and to provide a simpler - * interface to the EC_Factory. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Event_Channel : - public TAO_EC_Event_Channel_Base -{ -public: - /** - * constructor - * If @a own_factory is not 0 it assumes ownership of the factory. - * If the @a factory is nil it uses the Service_Configurator to load - * the Factory, if not found it uses TAO_EC_Default_Factory - */ - TAO_EC_Event_Channel (const TAO_EC_Event_Channel_Attributes& attributes, - TAO_EC_Factory* factory = 0, - int own_factory = 0); -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_EVENT_CHANNEL_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel_Base.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel_Base.cpp deleted file mode 100644 index cdb208fbb4a..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel_Base.cpp +++ /dev/null @@ -1,353 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "orbsvcs/Event/EC_Dispatching.h" -#include "orbsvcs/Event/EC_ConsumerAdmin.h" -#include "orbsvcs/Event/EC_SupplierAdmin.h" -#include "orbsvcs/Event/EC_Timeout_Generator.h" -#include "orbsvcs/Event/EC_ObserverStrategy.h" -#include "orbsvcs/Event/EC_ConsumerControl.h" -#include "orbsvcs/Event/EC_SupplierControl.h" -#include "ace/Dynamic_Service.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Event_Channel_Base.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, EC_Event_Channel_Base, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Event_Channel_Base:: -TAO_EC_Event_Channel_Base (const TAO_EC_Event_Channel_Attributes& attr, - TAO_EC_Factory* factory, - int own_factory) - : supplier_poa_ (PortableServer::POA::_duplicate (attr.supplier_poa)), - consumer_poa_ (PortableServer::POA::_duplicate (attr.consumer_poa)), - factory_ (factory), - own_factory_ (own_factory), - dispatching_ (0), - filter_builder_ (0), - supplier_filter_builder_ (0), - consumer_admin_ (0), - supplier_admin_ (0), - timeout_generator_ (0), - observer_strategy_ (0), - scheduling_strategy_(0), - consumer_reconnect_ (attr.consumer_reconnect), - supplier_reconnect_ (attr.supplier_reconnect), - disconnect_callbacks_ (attr.disconnect_callbacks), - consumer_control_ (0), - supplier_control_ (0), - status_ (EC_S_IDLE) -{ - this->scheduler_ = - CORBA::Object::_duplicate (attr.scheduler); -} - -TAO_EC_Event_Channel_Base::~TAO_EC_Event_Channel_Base (void) -{ - // Destroy Strategies in the reverse order of creation, they - // refere to each other during destruction and thus need to be - // cleaned up properly. - this->factory_->destroy_supplier_control (this->supplier_control_); - this->supplier_control_ = 0; - this->factory_->destroy_consumer_control (this->consumer_control_); - this->consumer_control_ = 0; - - this->factory_->destroy_scheduling_strategy (this->scheduling_strategy_); - this->scheduling_strategy_ = 0; - - this->factory_->destroy_observer_strategy (this->observer_strategy_); - this->observer_strategy_ = 0; - - this->factory_->destroy_timeout_generator (this->timeout_generator_); - this->timeout_generator_ = 0; - - this->factory_->destroy_supplier_admin (this->supplier_admin_); - this->supplier_admin_ = 0; - this->factory_->destroy_consumer_admin (this->consumer_admin_); - this->consumer_admin_ = 0; - - this->factory_->destroy_supplier_filter_builder (this->supplier_filter_builder_); - this->supplier_filter_builder_ = 0; - - this->factory_->destroy_filter_builder (this->filter_builder_); - this->filter_builder_ = 0; - - this->factory_->destroy_dispatching (this->dispatching_); - this->dispatching_ = 0; - - this->factory (0, 0); -} - -void -TAO_EC_Event_Channel_Base::create_strategies (void) -{ - this->dispatching_ = - this->factory_->create_dispatching (this); - this->filter_builder_ = - this->factory_->create_filter_builder (this); - this->supplier_filter_builder_ = - this->factory_->create_supplier_filter_builder (this); - this->consumer_admin_ = - this->factory_->create_consumer_admin (this); - this->supplier_admin_ = - this->factory_->create_supplier_admin (this); - this->timeout_generator_ = - this->factory_->create_timeout_generator (this); - this->observer_strategy_ = - this->factory_->create_observer_strategy (this); - - this->scheduling_strategy_ = - this->factory_->create_scheduling_strategy (this); - - this->consumer_control_ = - this->factory_->create_consumer_control (this); - this->supplier_control_ = - this->factory_->create_supplier_control (this); -} - -void -TAO_EC_Event_Channel_Base::activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) -{ - { - // First check if the EC is idle, if it is not then we need to - // return right away... - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_); - if (this->status_ != EC_S_IDLE) - return; - this->status_ = EC_S_ACTIVATING; - } - this->dispatching_->activate (); - this->timeout_generator_->activate (); - this->consumer_control_->activate (); - this->supplier_control_->activate (); - { - // Only when all the operations complete successfully we can mark - // the EC as active... - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_); - ACE_ASSERT (this->status_ == EC_S_ACTIVATING); - this->status_ = EC_S_ACTIVE; - } -} - -void -TAO_EC_Event_Channel_Base::shutdown (ACE_ENV_SINGLE_ARG_DECL) -{ - { - // First check if the EC is already active, if it is not then we - // need to return right away... - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_); - if (this->status_ != EC_S_ACTIVE) - return; - this->status_ = EC_S_DESTROYING; - } - this->dispatching_->shutdown (); - this->timeout_generator_->shutdown (); - this->supplier_control_->shutdown (); - this->consumer_control_->shutdown (); - - this->deactivate_supplier_admin (); - this->deactivate_consumer_admin (); - - this->supplier_admin_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - this->consumer_admin_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - { - // Wait until all the shutdown() operations return before marking - // the EC as destroyed... - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_); - ACE_ASSERT (this->status_ == EC_S_DESTROYING); - this->status_ = EC_S_DESTROYED; - } -} - -void -TAO_EC_Event_Channel_Base::deactivate_supplier_admin (void) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - PortableServer::POA_var supplier_poa = - this->supplier_admin_->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - PortableServer::ObjectId_var supplier_id = - supplier_poa->servant_to_id (this->supplier_admin_ ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - supplier_poa->deactivate_object (supplier_id.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // The deactivation can throw... - } - ACE_ENDTRY; -} - -void -TAO_EC_Event_Channel_Base::deactivate_consumer_admin (void) -{ - ACE_TRY_NEW_ENV - { - PortableServer::POA_var consumer_poa = - this->consumer_admin_->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - PortableServer::ObjectId_var consumer_id = - consumer_poa->servant_to_id (this->consumer_admin_ ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - consumer_poa->deactivate_object (consumer_id.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // The deactivation can throw... - } - ACE_ENDTRY; -} - -void -TAO_EC_Event_Channel_Base::connected (TAO_EC_ProxyPushConsumer* consumer - ACE_ENV_ARG_DECL) -{ - this->consumer_admin_->peer_connected (consumer ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - this->supplier_admin_->connected (consumer ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - this->observer_strategy_->connected (consumer ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_EC_Event_Channel_Base::reconnected (TAO_EC_ProxyPushConsumer* consumer - ACE_ENV_ARG_DECL) -{ - this->consumer_admin_->peer_reconnected (consumer ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - this->supplier_admin_->reconnected (consumer ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - this->observer_strategy_->connected (consumer ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_EC_Event_Channel_Base::disconnected (TAO_EC_ProxyPushConsumer* consumer - ACE_ENV_ARG_DECL) -{ - this->consumer_admin_->peer_disconnected (consumer ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - this->supplier_admin_->disconnected (consumer ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - this->observer_strategy_->disconnected (consumer ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_EC_Event_Channel_Base::connected (TAO_EC_ProxyPushSupplier* supplier - ACE_ENV_ARG_DECL) -{ - this->supplier_admin_->peer_connected (supplier ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - this->consumer_admin_->connected (supplier ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - this->observer_strategy_->connected (supplier ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_EC_Event_Channel_Base::reconnected (TAO_EC_ProxyPushSupplier* supplier - ACE_ENV_ARG_DECL) -{ - this->supplier_admin_->peer_reconnected (supplier ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - this->consumer_admin_->reconnected (supplier ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - this->observer_strategy_->connected (supplier ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_EC_Event_Channel_Base::disconnected (TAO_EC_ProxyPushSupplier* supplier - ACE_ENV_ARG_DECL) -{ - this->supplier_admin_->peer_disconnected (supplier ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - this->consumer_admin_->disconnected (supplier ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - this->observer_strategy_->disconnected (supplier ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -RtecEventChannelAdmin::ConsumerAdmin_ptr -TAO_EC_Event_Channel_Base::for_consumers (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->consumer_admin_->_this (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -RtecEventChannelAdmin::SupplierAdmin_ptr -TAO_EC_Event_Channel_Base::for_suppliers (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->supplier_admin_->_this (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -void -TAO_EC_Event_Channel_Base::destroy (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -RtecEventChannelAdmin::Observer_Handle -TAO_EC_Event_Channel_Base::append_observer ( - RtecEventChannelAdmin::Observer_ptr observer - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR, - RtecEventChannelAdmin::EventChannel::CANT_APPEND_OBSERVER)) -{ - return this->observer_strategy_->append_observer (observer - ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Event_Channel_Base::remove_observer ( - RtecEventChannelAdmin::Observer_Handle handle - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR, - RtecEventChannelAdmin::EventChannel::CANT_REMOVE_OBSERVER)) -{ - this->observer_strategy_->remove_observer (handle - ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Event_Channel_Base::for_each_consumer ( - TAO_ESF_Worker<TAO_EC_ProxyPushSupplier> *worker - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->consumer_admin_->for_each (worker - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_EC_Event_Channel_Base::for_each_supplier ( - TAO_ESF_Worker<TAO_EC_ProxyPushConsumer> *worker - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->supplier_admin_->for_each (worker - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel_Base.h b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel_Base.h deleted file mode 100644 index b42632c4c43..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel_Base.h +++ /dev/null @@ -1,377 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Event_Channel_Base.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * @author Marina Spivak (marina@atdesk.com) - * @author Jason Smith (jason@atdesk.com) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_EVENT_CHANNEL_BASE_H -#define TAO_EC_EVENT_CHANNEL_BASE_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Factory.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/Event/EC_Defaults.h" - -#include "orbsvcs/RtecEventChannelAdminS.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -template<class> class TAO_ESF_Worker; - -/** - * @class TAO_EC_Event_Channel_Attributes - * - * @brief Defines the construction time attributes for the Event - * Channel. - * - * The event channel implementation is controlled by two - * mechanisms: - * The EC_Factory that provides the strategies for the EC - * implementation. - * The EC attributes that define constants and values required - * by the EC construction. - * This class encapsulates those constants and values, providing - * an easy mechanism to extend the attributes without requiring - * changes in the EC constructor. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Event_Channel_Attributes -{ -public: - /** - * The basic constructor. - * The attributes listed as arguments are *required* by the EC, and - * no appropiate defaults are available for them. - */ - TAO_EC_Event_Channel_Attributes (PortableServer::POA_ptr supplier_poa, - PortableServer::POA_ptr consumer_poa); - - // Most fields are public, there is no need to protect them, in fact - // the user should be able to set any values she wants. - - /// Can consumers or suppliers invoke connect_push_* multiple times? - int consumer_reconnect; - int supplier_reconnect; - - /** - * It not zero the event channel will send disconnect callbacks when - * a disconnect method is called on a Proxy. In other words, if a - * consumer calls disconnect_push_supplier() on its proxy the EC - * will invoke disconnect_push_consumer() on the consumer. A - * similar thing is done for suppliers. - * It is a matter of debate what the spec requires for the regular - * event service. - */ - int disconnect_callbacks; - - /** - * The scheduling service that we will use with this event channel. - * Notice that this is optional and will only take effect if the EC - * is configured with the right filtering strategies. - */ - CORBA::Object_ptr scheduler; - -private: - /// Only the EC can read the private fields. - friend class TAO_EC_Event_Channel_Base; - - /// The POAs - PortableServer::POA_ptr supplier_poa; - PortableServer::POA_ptr consumer_poa; -}; - -/** - * @class TAO_EC_Event_Channel_Base - * - * @brief The RtecEventChannelAdmin::EventChannel implementation. - * - * This class is the Mediator between all the classes in the EC - * implementation, its main task is to redirect the messages to - * the right components, to hold and manage the lifetime of the - * long lived objects (Timer_Module, SupplierAdmin, - * ConsumerAdmin and Dispatching) and to provide a simpler - * interface to the EC_Factory. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Event_Channel_Base - : public POA_RtecEventChannelAdmin::EventChannel -{ -public: - /// destructor - virtual ~TAO_EC_Event_Channel_Base (void); - - /// Start the internal threads (if any), etc. - /// After this call the EC can be used. - virtual void activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); - - /// Shutdown any internal threads, cleanup all the internal - /// structures, flush all the messages, etc. - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); - - virtual void for_each_consumer ( - TAO_ESF_Worker<TAO_EC_ProxyPushSupplier> *worker - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void for_each_supplier ( - TAO_ESF_Worker<TAO_EC_ProxyPushConsumer> *worker - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Access the dispatching module.... - TAO_EC_Dispatching* dispatching (void) const; - - /// Access the filter builder.... - TAO_EC_Filter_Builder* filter_builder (void) const; - - /// Access the filter builder.... - TAO_EC_Supplier_Filter_Builder* supplier_filter_builder (void) const; - - /// Access the consumer admin implementation, useful for controlling - /// the activation... - TAO_EC_ConsumerAdmin* consumer_admin (void) const; - - /// Access the supplier admin implementation, useful for controlling - /// the activation... - TAO_EC_SupplierAdmin* supplier_admin (void) const; - - /// Access the timer module... - TAO_EC_Timeout_Generator* timeout_generator (void) const; - - /// Access the scheduling strategy - TAO_EC_Scheduling_Strategy* scheduling_strategy (void) const; - - /// Access the client control strategies. - TAO_EC_ConsumerControl *consumer_control (void) const; - TAO_EC_SupplierControl *supplier_control (void) const; - - // = The factory methods, they delegate on the EC_Factory. - /// Create and destroy a ProxyPushSupplier - void create_proxy (TAO_EC_ProxyPushSupplier*&); - void destroy_proxy (TAO_EC_ProxyPushSupplier*); - - /// Create and destroy a ProxyPushConsumer - void create_proxy (TAO_EC_ProxyPushConsumer*&); - void destroy_proxy (TAO_EC_ProxyPushConsumer*); - - - /// Create and destroy a the collections used to store - /// ProxyPushSuppliers - void create_proxy_collection (TAO_EC_ProxyPushSupplier_Collection*&); - void destroy_proxy_collection (TAO_EC_ProxyPushSupplier_Collection*); - - - /// Create and destroy a the collections used to store - /// ProxyPushConsumers - void create_proxy_collection (TAO_EC_ProxyPushConsumer_Collection*&); - void destroy_proxy_collection (TAO_EC_ProxyPushConsumer_Collection*); - - /// Access the supplier and consumer POAs from the factory. - PortableServer::POA_ptr supplier_poa (void); - PortableServer::POA_ptr consumer_poa (void); - - /// Locking strategies for the ProxyPushConsumer and - /// ProxyPushSupplier objects - ACE_Lock* create_consumer_lock (void); - void destroy_consumer_lock (ACE_Lock*); - ACE_Lock* create_supplier_lock (void); - void destroy_supplier_lock (ACE_Lock*); - - /// Used to inform the EC that a Consumer has connected or - /// disconnected from it. - virtual void connected (TAO_EC_ProxyPushConsumer* - ACE_ENV_ARG_DECL_NOT_USED); - virtual void reconnected (TAO_EC_ProxyPushConsumer* - ACE_ENV_ARG_DECL_NOT_USED); - virtual void disconnected (TAO_EC_ProxyPushConsumer* - ACE_ENV_ARG_DECL_NOT_USED); - - /// Used to inform the EC that a Supplier has connected or - /// disconnected from it. - virtual void connected (TAO_EC_ProxyPushSupplier* - ACE_ENV_ARG_DECL_NOT_USED); - virtual void reconnected (TAO_EC_ProxyPushSupplier* - ACE_ENV_ARG_DECL_NOT_USED); - virtual void disconnected (TAO_EC_ProxyPushSupplier* - ACE_ENV_ARG_DECL_NOT_USED); - - // Simple flags to control the EC behavior, set by the application - // at construction time. - - /// Can the consumers reconnect to the EC? - int consumer_reconnect (void) const; - - /// Can the suppliers reconnect to the EC? - int supplier_reconnect (void) const; - - /// Should we send callback disconnect messages when a proxy is - /// disconnected by the client - int disconnect_callbacks (void) const; - - /// Obtain the scheduler, the user must release - CORBA::Object_ptr scheduler (void); - - // = The RtecEventChannelAdmin::EventChannel methods... - /// The default implementation is: - /// this->consumer_admin ()->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - virtual RtecEventChannelAdmin::ConsumerAdmin_ptr - for_consumers (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// The default implementation is: - /// this->supplier_admin ()->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - virtual RtecEventChannelAdmin::SupplierAdmin_ptr - for_suppliers (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Commit suicide. - virtual void destroy (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual RtecEventChannelAdmin::Observer_Handle - append_observer (RtecEventChannelAdmin::Observer_ptr - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR, - RtecEventChannelAdmin::EventChannel::CANT_APPEND_OBSERVER)); - virtual void - remove_observer (RtecEventChannelAdmin::Observer_Handle - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR, - RtecEventChannelAdmin::EventChannel::CANT_REMOVE_OBSERVER)); - - /// Return 1 if the event channel is already destroyed. - int destroyed (void); - -protected: - /** - * Constructor - * If @a own_factory is not 0 it assumes ownership of the factory. - * If the @a factory is nil it uses the Service_Configurator to load - * the Factory, if not found it uses TAO_EC_Default_Resource_Factory - */ - TAO_EC_Event_Channel_Base (const TAO_EC_Event_Channel_Attributes& attributes, - TAO_EC_Factory* factory = 0, - int own_factory = 0); - - /** - * Get the factory. - */ - TAO_EC_Factory * factory (void) const; - - /** - * Set the factory, if @a own_factory is not 0 it assumes ownership of the - * factory. - */ - void factory (TAO_EC_Factory* factory, - int own_factory = 0); - - /** - * Create all strategies - */ - void create_strategies (void); - - /// Helpers. Deactivate admins from their POAs, ignoring any CORBA - /// exceptions. - //@{ - void deactivate_supplier_admin (void); - void deactivate_consumer_admin (void); - //@} - - /// The POAs used to activate "supplier-side" and "consumer-side" - /// objects. - PortableServer::POA_var supplier_poa_; - PortableServer::POA_var consumer_poa_; - - /** - * This is the abstract factory that creates all the objects that - * compose an event channel, the event channel simply acts as a - * Mediator among them. - */ - TAO_EC_Factory *factory_; - - /// Flag that indicates if we own the factory. - int own_factory_; - - /// The dispatching "module" - TAO_EC_Dispatching *dispatching_; - - /// The filter builder - TAO_EC_Filter_Builder *filter_builder_; - - /// The filter builder for suppliers - TAO_EC_Supplier_Filter_Builder *supplier_filter_builder_; - - /// The ConsumerAdmin implementation - TAO_EC_ConsumerAdmin *consumer_admin_; - - /// The SupplierAdmin implementation - TAO_EC_SupplierAdmin *supplier_admin_; - - /// The timeout generator - TAO_EC_Timeout_Generator *timeout_generator_; - - /// The observer strategy - TAO_EC_ObserverStrategy *observer_strategy_; - - /// The scheduler (may be nil) - CORBA::Object_var scheduler_; - - /// The scheduling strategy - TAO_EC_Scheduling_Strategy *scheduling_strategy_; - - /// Consumer reconnection flags - int consumer_reconnect_; - - /// Supplier reconnection flags - int supplier_reconnect_; - - /// If not zero we send callbacks when a proxy is disconnected - int disconnect_callbacks_; - - /// Strategies to disconnect misbehaving or destroyed consumers - TAO_EC_ConsumerControl *consumer_control_; - - /// Strategies to disconnect misbehaving or destroyed suppliers - TAO_EC_SupplierControl *supplier_control_; - - /// Mutex to protect the internal state - TAO_SYNCH_MUTEX mutex_; - - /// Flag to track the status of the event channel - enum { - EC_S_IDLE - , EC_S_ACTIVATING - , EC_S_ACTIVE - , EC_S_DESTROYING - , EC_S_DESTROYED - }; - int status_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Event_Channel_Base.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_EVENT_CHANNEL_BASE_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel_Base.i b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel_Base.i deleted file mode 100644 index 1883f84ef11..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel_Base.i +++ /dev/null @@ -1,206 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_Event_Channel_Attributes:: -TAO_EC_Event_Channel_Attributes (PortableServer::POA_ptr s_poa, - PortableServer::POA_ptr c_poa) - : consumer_reconnect (TAO_EC_DEFAULT_CONSUMER_RECONNECT), - supplier_reconnect (TAO_EC_DEFAULT_SUPPLIER_RECONNECT), - disconnect_callbacks (TAO_EC_DEFAULT_DISCONNECT_CALLBACKS), - scheduler (CORBA::Object::_nil ()), - supplier_poa (s_poa), - consumer_poa (c_poa) -{ -} - -ACE_INLINE TAO_EC_Factory* -TAO_EC_Event_Channel_Base::factory (void) const -{ - return this->factory_; -} - -ACE_INLINE void -TAO_EC_Event_Channel_Base::factory (TAO_EC_Factory* factory, - int own_factory) -{ - if (this->own_factory_) - delete this->factory_; - - this->factory_ = factory; - this->own_factory_ = own_factory; -} - -ACE_INLINE TAO_EC_Dispatching* -TAO_EC_Event_Channel_Base::dispatching (void) const -{ - return this->dispatching_; -} - -ACE_INLINE TAO_EC_Filter_Builder* -TAO_EC_Event_Channel_Base::filter_builder (void) const -{ - return this->filter_builder_; -} - -ACE_INLINE TAO_EC_Supplier_Filter_Builder* -TAO_EC_Event_Channel_Base::supplier_filter_builder (void) const -{ - return this->supplier_filter_builder_; -} - -ACE_INLINE TAO_EC_ConsumerAdmin* -TAO_EC_Event_Channel_Base::consumer_admin (void) const -{ - return this->consumer_admin_; -} - -ACE_INLINE TAO_EC_SupplierAdmin* -TAO_EC_Event_Channel_Base::supplier_admin (void) const -{ - return this->supplier_admin_; -} - -ACE_INLINE TAO_EC_Timeout_Generator* -TAO_EC_Event_Channel_Base::timeout_generator (void) const -{ - return this->timeout_generator_; -} - -ACE_INLINE TAO_EC_Scheduling_Strategy* -TAO_EC_Event_Channel_Base::scheduling_strategy (void) const -{ - return this->scheduling_strategy_; -} - -ACE_INLINE TAO_EC_ConsumerControl* -TAO_EC_Event_Channel_Base::consumer_control (void) const -{ - return this->consumer_control_; -} - -ACE_INLINE TAO_EC_SupplierControl* -TAO_EC_Event_Channel_Base::supplier_control (void) const -{ - return this->supplier_control_; -} - -ACE_INLINE void -TAO_EC_Event_Channel_Base::create_proxy (TAO_EC_ProxyPushSupplier*& x) -{ - x = this->factory_->create_proxy_push_supplier (this); -} - -ACE_INLINE void -TAO_EC_Event_Channel_Base::destroy_proxy (TAO_EC_ProxyPushSupplier* supplier) -{ - this->factory_->destroy_proxy_push_supplier (supplier); -} - -ACE_INLINE void -TAO_EC_Event_Channel_Base::create_proxy (TAO_EC_ProxyPushConsumer*& x) -{ - x = this->factory_->create_proxy_push_consumer (this); -} - -ACE_INLINE void -TAO_EC_Event_Channel_Base::destroy_proxy (TAO_EC_ProxyPushConsumer* consumer) -{ - this->factory_->destroy_proxy_push_consumer (consumer); -} - -ACE_INLINE void -TAO_EC_Event_Channel_Base::create_proxy_collection (TAO_EC_ProxyPushConsumer_Collection*& x) -{ - x = this->factory_->create_proxy_push_consumer_collection (this); -} - -ACE_INLINE void -TAO_EC_Event_Channel_Base::destroy_proxy_collection (TAO_EC_ProxyPushConsumer_Collection* x) -{ - this->factory_->destroy_proxy_push_consumer_collection (x); -} - -ACE_INLINE void -TAO_EC_Event_Channel_Base::create_proxy_collection (TAO_EC_ProxyPushSupplier_Collection*& x) -{ - x = this->factory_->create_proxy_push_supplier_collection (this); -} - -ACE_INLINE void -TAO_EC_Event_Channel_Base::destroy_proxy_collection (TAO_EC_ProxyPushSupplier_Collection* x) -{ - this->factory_->destroy_proxy_push_supplier_collection (x); -} - -ACE_INLINE PortableServer::POA_ptr -TAO_EC_Event_Channel_Base::supplier_poa (void) -{ - return PortableServer::POA::_duplicate (this->supplier_poa_.in ()); -} - -ACE_INLINE PortableServer::POA_ptr -TAO_EC_Event_Channel_Base::consumer_poa (void) -{ - return PortableServer::POA::_duplicate (this->consumer_poa_.in ()); -} - -ACE_INLINE ACE_Lock* -TAO_EC_Event_Channel_Base::create_consumer_lock (void) -{ - return this->factory_->create_consumer_lock (); -} - -ACE_INLINE void -TAO_EC_Event_Channel_Base::destroy_consumer_lock (ACE_Lock* x) -{ - this->factory_->destroy_consumer_lock (x); -} - -ACE_INLINE ACE_Lock* -TAO_EC_Event_Channel_Base::create_supplier_lock (void) -{ - return this->factory_->create_supplier_lock (); -} - -ACE_INLINE void -TAO_EC_Event_Channel_Base::destroy_supplier_lock (ACE_Lock* x) -{ - this->factory_->destroy_supplier_lock (x); -} - -ACE_INLINE int -TAO_EC_Event_Channel_Base::consumer_reconnect (void) const -{ - return this->consumer_reconnect_; -} - -ACE_INLINE int -TAO_EC_Event_Channel_Base::supplier_reconnect (void) const -{ - return this->supplier_reconnect_; -} - -ACE_INLINE int -TAO_EC_Event_Channel_Base::disconnect_callbacks (void) const -{ - return this->disconnect_callbacks_; -} - -ACE_INLINE CORBA::Object_ptr -TAO_EC_Event_Channel_Base::scheduler (void) -{ - return CORBA::Object::_duplicate (this->scheduler_.in ()); -} - -ACE_INLINE int -TAO_EC_Event_Channel_Base::destroyed (void) -{ - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->mutex_, 0); - return (this->status_ == EC_S_DESTROYED); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Factory.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Factory.cpp deleted file mode 100644 index 0612521f408..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Factory.cpp +++ /dev/null @@ -1,14 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Factory.h" -#include "ace/Dynamic_Service.h" - -ACE_RCSID(Event, EC_Factory, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Factory::~TAO_EC_Factory (void) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Factory.h b/TAO/orbsvcs/orbsvcs/Event/EC_Factory.h deleted file mode 100644 index a3cd903d4f4..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Factory.h +++ /dev/null @@ -1,169 +0,0 @@ -// -*- C++ -*- -/** - * @file EC_Factory.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_FACTORY_H -#define TAO_EC_FACTORY_H - -#include /**/ "ace/pre.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/Versioned_Namespace.h" - -#include "ace/Service_Object.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -class ACE_Lock; -ACE_END_VERSIONED_NAMESPACE_DECL - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Event_Channel_Base; - -class TAO_EC_Dispatching; -class TAO_EC_Filter_Builder; -class TAO_EC_Supplier_Filter_Builder; -class TAO_EC_ConsumerAdmin; -class TAO_EC_SupplierAdmin; -class TAO_EC_ProxyPushConsumer; -class TAO_EC_ProxyPushSupplier; -class TAO_EC_ObserverStrategy; -template<class PROXY> class TAO_ESF_Proxy_Collection; -class TAO_EC_Timeout_Generator; -class TAO_EC_Scheduling_Strategy; -class TAO_EC_ConsumerControl; -class TAO_EC_SupplierControl; - -typedef TAO_ESF_Proxy_Collection<TAO_EC_ProxyPushConsumer> TAO_EC_ProxyPushConsumer_Collection; -typedef TAO_ESF_Proxy_Collection<TAO_EC_ProxyPushSupplier> TAO_EC_ProxyPushSupplier_Collection; - -/** - * @class TAO_EC_Factory - * - * @brief Abstract base class for the Event Channel components. - * - * Defines the EC_Factory interface. - * - * <H2>Memory Management</H2> - * The objects it creates are owned by this class, the client must - * invoke the corresponding destroy() method to release them. - * Some implementations may require a different instance for the - * EC_Factory for each instance of Event_Channel. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Factory : public ACE_Service_Object -{ -public: - /// destructor... - virtual ~TAO_EC_Factory (void); - - /// Create and destroy the dispatching module. - virtual TAO_EC_Dispatching* - create_dispatching (TAO_EC_Event_Channel_Base*) = 0; - virtual void - destroy_dispatching (TAO_EC_Dispatching*) = 0; - - /// Create and destroy the filter builder. - virtual TAO_EC_Filter_Builder* - create_filter_builder (TAO_EC_Event_Channel_Base*) = 0; - virtual void - destroy_filter_builder (TAO_EC_Filter_Builder*) = 0; - - /// Create and destroy the filter builder. - virtual TAO_EC_Supplier_Filter_Builder* - create_supplier_filter_builder (TAO_EC_Event_Channel_Base*) = 0; - virtual void - destroy_supplier_filter_builder (TAO_EC_Supplier_Filter_Builder*) = 0; - - /// Create and destroy the consumer admin implementation. - virtual TAO_EC_ConsumerAdmin* - create_consumer_admin (TAO_EC_Event_Channel_Base*) = 0; - virtual void - destroy_consumer_admin (TAO_EC_ConsumerAdmin*) = 0; - - /// Create and destroy the supplier admin implementation. - virtual TAO_EC_SupplierAdmin* - create_supplier_admin (TAO_EC_Event_Channel_Base*) = 0; - virtual void - destroy_supplier_admin (TAO_EC_SupplierAdmin*) = 0; - - /// Create and destroy a ProxyPushSupplier - virtual TAO_EC_ProxyPushSupplier* - create_proxy_push_supplier (TAO_EC_Event_Channel_Base*) = 0; - virtual void - destroy_proxy_push_supplier (TAO_EC_ProxyPushSupplier*) = 0; - - /// Create and destroy a ProxyPushConsumer - virtual TAO_EC_ProxyPushConsumer* - create_proxy_push_consumer (TAO_EC_Event_Channel_Base*) = 0; - virtual void - destroy_proxy_push_consumer (TAO_EC_ProxyPushConsumer*) = 0; - - /// Create and destroy the timer module. - virtual TAO_EC_Timeout_Generator* - create_timeout_generator (TAO_EC_Event_Channel_Base*) = 0; - virtual void - destroy_timeout_generator (TAO_EC_Timeout_Generator*) = 0; - - /// Create and destroy the observer strategy. - virtual TAO_EC_ObserverStrategy* - create_observer_strategy (TAO_EC_Event_Channel_Base*) = 0; - virtual void - destroy_observer_strategy (TAO_EC_ObserverStrategy*) = 0; - - /// Create and destroy the observer strategy. - virtual TAO_EC_Scheduling_Strategy* - create_scheduling_strategy (TAO_EC_Event_Channel_Base*) = 0; - virtual void - destroy_scheduling_strategy (TAO_EC_Scheduling_Strategy*) = 0; - - /// Create and destroy a collection of TAO_EC_ProxyPushConsumers - virtual TAO_EC_ProxyPushConsumer_Collection* - create_proxy_push_consumer_collection (TAO_EC_Event_Channel_Base*) = 0; - virtual void - destroy_proxy_push_consumer_collection (TAO_EC_ProxyPushConsumer_Collection*) = 0; - - /// Create and destroy a collection of TAO_EC_ProxyPushSuppliers - virtual TAO_EC_ProxyPushSupplier_Collection* - create_proxy_push_supplier_collection (TAO_EC_Event_Channel_Base*) = 0; - virtual void - destroy_proxy_push_supplier_collection (TAO_EC_ProxyPushSupplier_Collection*) = 0; - - /// Create and destroy the locking strategies for both - /// ProxyPushConsumers and ProxyPushSuppliers - virtual ACE_Lock* create_consumer_lock (void) = 0; - virtual void destroy_consumer_lock (ACE_Lock*) = 0; - virtual ACE_Lock* create_supplier_lock (void) = 0; - virtual void destroy_supplier_lock (ACE_Lock*) = 0; - - /// The ConsumerControl and SupplierControl strategies are used to - /// discard non-existent consumers and suppliers - virtual TAO_EC_ConsumerControl* - create_consumer_control (TAO_EC_Event_Channel_Base*) = 0; - virtual void - destroy_consumer_control (TAO_EC_ConsumerControl*) = 0; - virtual TAO_EC_SupplierControl* - create_supplier_control (TAO_EC_Event_Channel_Base*) = 0; - virtual void - destroy_supplier_control (TAO_EC_SupplierControl*) = 0; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Filter.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Filter.cpp deleted file mode 100644 index 55f0de96038..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Filter.cpp +++ /dev/null @@ -1,130 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Filter.h" -#include "orbsvcs/Event/EC_QOS_Info.h" - -#include "tao/ORB_Constants.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Filter.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (Event, - EC_Filter, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Filter::~TAO_EC_Filter (void) -{ -} - -void -TAO_EC_Filter::adopt_child (TAO_EC_Filter* child) -{ - child->parent_ = this; -} - -TAO_EC_Filter::ChildrenIterator -TAO_EC_Filter::begin (void) const -{ - return 0; -} - -TAO_EC_Filter::ChildrenIterator -TAO_EC_Filter::end (void) const -{ - return 0; -} - -int -TAO_EC_Filter::size (void) const -{ - return 0; -} - -void -TAO_EC_Filter::get_qos_info (TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - ACE_UNUSED_ARG (qos_info); - ACE_THROW (CORBA::NO_IMPLEMENT (TAO::VMCID, - CORBA::COMPLETED_NO)); -} - -// **************************************************************** - -int -TAO_EC_Null_Filter::filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - // This is a leaf, no need to query any children, and we accept all - // events, so push it. - this->push (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - return 1; -} - -int -TAO_EC_Null_Filter::filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - // This is a leaf, no need to query any children, and we accept all - // events, so push it. - this->push_nocopy (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - return 1; -} - -void -TAO_EC_Null_Filter::push (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - if (this->parent () != 0) - this->parent ()->push (event, qos_info ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Null_Filter::push_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - if (this->parent () != 0) - this->parent ()->push_nocopy (event, qos_info ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Null_Filter::clear (void) -{ - // do nothing -} - -CORBA::ULong -TAO_EC_Null_Filter::max_event_size (void) const -{ - // @@ Is there a better way to express this? - return 0; -} - -int -TAO_EC_Null_Filter::can_match (const RtecEventComm::EventHeader&) const -{ - // @@ This method should be correctly so we can implement null - // filtering at the consumers but real filtering on the suppliers. - return 1; -} - -int -TAO_EC_Null_Filter::add_dependencies ( - const RtecEventComm::EventHeader &, - const TAO_EC_QOS_Info & - ACE_ENV_ARG_DECL_NOT_USED) - -{ - return 0; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Filter.h b/TAO/orbsvcs/orbsvcs/Event/EC_Filter.h deleted file mode 100644 index d092917ab4e..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Filter.h +++ /dev/null @@ -1,225 +0,0 @@ -// -*- C++ -*- -/** - * @file EC_Filter.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_FILTER_H -#define TAO_EC_FILTER_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/RtecEventCommC.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_QOS_Info; - -/** - * @class TAO_EC_Filter - * - * @brief Abstract base class for the filter hierarchy. - * - * The per-consumer filtering mechanisms. - * The EC needs to filter data passed to the consumers, so it can - * correctly satisfy its subscription requirements. - * This filtering can include correlations, sequences, timeouts, - * etc. each consumer can request different filtering criteria. - * Different filtering objects are associated with each consumer, - * the filters are organized in a hierarchical structure, - * corresponding to the subscription "expression" that the events - * must satisfy. - * The hierarchy is constructed using the "Builder" pattern. - * - * <H2>Memory Management</H2> - * It does *not* assume ownership of its parent. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Filter -{ -public: - /// constructor... - TAO_EC_Filter (void); - - /// destructor... - virtual ~TAO_EC_Filter (void); - - /// Obtain the parent of this filter. - TAO_EC_Filter* parent (void) const; - - /// Become the parent of @a child. - void adopt_child (TAO_EC_Filter* child); - - /// Matches two event headers. - /// @todo Should we strategize the algorithm used to match headers? - static int matches (const RtecEventComm::EventHeader& rhs, - const RtecEventComm::EventHeader& lhs); - - typedef TAO_EC_Filter* value_type; - typedef TAO_EC_Filter* const const_value_type; - typedef const_value_type* ChildrenIterator; - - /** - * STL-like iterators - * Filters follow the Composite pattern. All filters expose the same - * interface as if they all had children, but for simple filters the - * iterators return an empty range. - */ - virtual ChildrenIterator begin (void) const; - virtual ChildrenIterator end (void) const; - virtual int size (void) const; - - /** - * Filter this event, returns 1 if the event is accepted, 0 - * otherwise. - * Notice that there are two versions of the method, if the event is - * not const then filter can take ownership of the event. - * - * @attention There seems to be a disparity in interfaces: Supplier - * always push event sets of size 1 to the EC_ProxyPushSupplier, and - * EC_Filters do not implement handling of sets of more than 1 - * event. Then, why is this not enforced by the interface by having - * EC_ProxyPushSupplier take an event rather than a set? - */ - virtual int filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) = 0; - virtual int filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) = 0; - - /** - * This is called by the children when they accept an event and - * which to pass it up. - * Notice that there are two versions of the method, if the event is - * not const then filter can take ownership of the event. - */ - virtual void push (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) = 0; - virtual void push_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) = 0; - - /// Clear any saved state, must reset and assume no events have been - /// received. - virtual void clear (void) = 0; - - /// Returns the maximum size of the events pushed by this filter. - virtual CORBA::ULong max_event_size (void) const = 0; - - /** - * Returns 0 if an event with that header could never be accepted. - * This can used by the suppliers to filter out consumers that - * couldn't possibly be interested in their events. - * The rt_info and - */ - virtual int can_match (const RtecEventComm::EventHeader& header) const = 0; - - /** - * This is used for computing the scheduling dependencies: - * - * Leaf filters check if the header could be matched, similar to the - * can_match() method; if it does they return 1, and 0 otherwise. - * Intermediate nodes always return 0. - * - * This is used to build precise dependencies between the suppliers - * and the leaf of the filters that accept that event. Notice that - * only the nodes doing scheduling recurse through the list, so in - * configurations that do no require scheduling the recursion stops - * fairly soon. - */ - virtual int add_dependencies (const RtecEventComm::EventHeader& header, - const TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) = 0; - - /** - * Obtain the QOS information for this filter, the default - * implementation returns an invalid QOS. Only the filters that - * support scheduling information implement this method. - * @return Returns 0 on success and -1 on failure - */ - virtual void get_qos_info (TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - -private: - /// The parent... - TAO_EC_Filter* parent_; -}; - -// **************************************************************** - -/** - * @class TAO_EC_Null_Filter - * - * @brief A null filter - * - * This filter accepts any kind of event, it is useful for the - * implementation: - * a) Consumers that accept all events - * b) Consumers that trust the filtering done at the Supplier - * layer. - * c) Event Channels that don't do filtering (such as CosEC - * backends) - */ -class TAO_RTEvent_Serv_Export TAO_EC_Null_Filter : public TAO_EC_Filter -{ -public: - /// Constructor. - TAO_EC_Null_Filter (void); - - // = The TAO_EC_Filter methods, please check the documentation in - // TAO_EC_Filter. - virtual int filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual int filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void clear (void); - virtual CORBA::ULong max_event_size (void) const; - virtual int can_match (const RtecEventComm::EventHeader& header) const; - virtual int add_dependencies (const RtecEventComm::EventHeader& header, - const TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL); -}; - -// **************************************************************** - -// @@ Add more types of filters like: -// - Events in a sequence. -// - Events in a sequence with timeouts. -// - Conjunction with timeout [as opposed to disjunction of -// conjunction and a timeout] -// - etc. - -// **************************************************************** - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Filter.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_FILTER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Filter.i b/TAO/orbsvcs/orbsvcs/Event/EC_Filter.i deleted file mode 100644 index a5b9e121522..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Filter.i +++ /dev/null @@ -1,45 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_Filter::TAO_EC_Filter (void) - : parent_ (0) -{ -} - -ACE_INLINE TAO_EC_Filter* -TAO_EC_Filter::parent (void) const -{ - return this->parent_; -} - -ACE_INLINE int -TAO_EC_Filter::matches (const RtecEventComm::EventHeader& rhs, - const RtecEventComm::EventHeader& lhs) -{ - if ((rhs.source == 0 && rhs.type == 0) - || (lhs.source == 0 && lhs.type == 0)) - return 1; - - if (rhs.source == 0 || lhs.source == 0) - return rhs.type == lhs.type; - - if (rhs.type == 0 || lhs.type == 0) - return rhs.source == lhs.source; - - return (rhs.type == lhs.type && rhs.source == lhs.source); -} - -// **************************************************************** - -ACE_INLINE -TAO_EC_Null_Filter::TAO_EC_Null_Filter (void) -{ -} - -// **************************************************************** - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Filter_Builder.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Filter_Builder.cpp deleted file mode 100644 index 07934456276..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Filter_Builder.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Filter_Builder.h" -#include "orbsvcs/Event/EC_Filter.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Filter_Builder.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, EC_Filter_Builder, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Filter_Builder::~TAO_EC_Filter_Builder (void) -{ -} - -// **************************************************************** - -TAO_EC_Null_Filter_Builder::~TAO_EC_Null_Filter_Builder (void) -{ -} - -TAO_EC_Filter* -TAO_EC_Null_Filter_Builder::build ( - TAO_EC_ProxyPushSupplier *, - RtecEventChannelAdmin::ConsumerQOS& - ACE_ENV_ARG_DECL_NOT_USED) const -{ - return new TAO_EC_Null_Filter; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Filter_Builder.h b/TAO/orbsvcs/orbsvcs/Event/EC_Filter_Builder.h deleted file mode 100644 index 5d639e8d7e0..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Filter_Builder.h +++ /dev/null @@ -1,92 +0,0 @@ -// -*- C++ -*- -/** - * @file EC_Filter_Builder.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_FILTER_BUILDER_H -#define TAO_EC_FILTER_BUILDER_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/RtecEventChannelAdminC.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Filter; -class TAO_EC_ProxyPushSupplier; - -/** - * @class TAO_EC_Filter_Builder - * - * @brief Abstract base class for the filter builders. - * - * The creation of a filter hierarchy is controlled by a - * Filter_Builder. The relationship between TAO_EC_Filter and - * TAO_EC_Filter_Builder follows the "Builder Pattern" (Gamma et - * al.) - */ -class TAO_RTEvent_Serv_Export TAO_EC_Filter_Builder -{ -public: - /// destructor... - virtual ~TAO_EC_Filter_Builder (void); - - /// Create the filter, the caller must assume ownership of the filter - /// returned. - virtual TAO_EC_Filter* - build (TAO_EC_ProxyPushSupplier *supplier, - RtecEventChannelAdmin::ConsumerQOS& qos - ACE_ENV_ARG_DECL) const = 0; - -}; - -// **************************************************************** - -/** - * @class TAO_EC_Null_Filter_Builder - * - * @brief A simple implementation of the filter builder. - * - * Simply creates a Null_Filter in every case. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Null_Filter_Builder : public TAO_EC_Filter_Builder -{ -public: - /// constructor. - TAO_EC_Null_Filter_Builder (void); - - /// destructor... - virtual ~TAO_EC_Null_Filter_Builder (void); - - // = The TAO_EC_Filter_Builder methods... - TAO_EC_Filter* build (TAO_EC_ProxyPushSupplier *supplier, - RtecEventChannelAdmin::ConsumerQOS& qos - ACE_ENV_ARG_DECL) const; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -// **************************************************************** - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Filter_Builder.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_FILTER_BUILDER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Filter_Builder.i b/TAO/orbsvcs/orbsvcs/Event/EC_Filter_Builder.i deleted file mode 100644 index 89d32fe656e..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Filter_Builder.i +++ /dev/null @@ -1,12 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_Null_Filter_Builder::TAO_EC_Null_Filter_Builder (void) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Gateway.cpp deleted file mode 100644 index 8addbb46165..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Gateway.h" - -ACE_RCSID (Event, - EC_Gateway, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Gateway::TAO_EC_Gateway (void) - : handle_ (0) -{ -} - -TAO_EC_Gateway::~TAO_EC_Gateway (void) -{ -} - -void -TAO_EC_Gateway::observer_handle (RtecEventChannelAdmin::Observer_Handle h) -{ - this->handle_ = h; -} - -RtecEventChannelAdmin::Observer_Handle -TAO_EC_Gateway::observer_handle (void) const -{ - return this->handle_; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway.h b/TAO/orbsvcs/orbsvcs/Event/EC_Gateway.h deleted file mode 100644 index 965e6a9daf6..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway.h +++ /dev/null @@ -1,71 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Gateway.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_GATEWAY_H -#define TAO_EC_GATEWAY_H - -#include /**/ "ace/pre.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#include "orbsvcs/RtecEventChannelAdminS.h" -#include "orbsvcs/RtecEventCommS.h" - - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Gateway - * - * @brief Event Channel Gateway - * - * There are several ways to connect several EC together, for - * instance: - * + A single class can use normal IIOP and connect to one EC as - * a supplier and to another EC as a consumer. - * + A class connects as a consumer and transmit the events using - * multicast, another class receives the multicast messages and - * transform them back into a push() call. - * This is an abstract class to represent all the different - * strategies for EC distribution. - * - */ -class TAO_RTEvent_Serv_Export TAO_EC_Gateway - : public POA_RtecEventChannelAdmin::Observer -{ -public: - /// Default constructor. - TAO_EC_Gateway (void); - - /// Destructor - virtual ~TAO_EC_Gateway (void); - - /// The gateway must disconnect from all the relevant event channels, - /// or any other communication media (such as multicast groups). - virtual void close (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) = 0; - - /// Obtain and modify the observer handle. - void observer_handle (RtecEventChannelAdmin::Observer_Handle h); - RtecEventChannelAdmin::Observer_Handle observer_handle (void) const; - -private: - RtecEventChannelAdmin::Observer_Handle handle_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_EC_GATEWAY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_IIOP.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_IIOP.cpp deleted file mode 100644 index cf58d8cbd06..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_IIOP.cpp +++ /dev/null @@ -1,715 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Gateway_IIOP.h" -#include "orbsvcs/Event/ECG_Defaults.h" -#include "orbsvcs/Event_Utilities.h" -#include "orbsvcs/Time_Utilities.h" - -#include "orbsvcs/Event/EC_Gateway_IIOP_Factory.h" -#include "orbsvcs/Event/ECG_ConsumerEC_Control.h" - -#include "ace/Dynamic_Service.h" - -ACE_RCSID (Event, - EC_Gateway_IIOP, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Gateway_IIOP::TAO_EC_Gateway_IIOP (void) - : busy_count_ (0), - update_posted_ (0), - cleanup_posted_ (0), - supplier_ec_suspended_ (0), - supplier_info_ (0), - consumer_info_ (0), - consumer_ (this), - consumer_is_active_ (0), - supplier_ (this), - supplier_is_active_ (0), - ec_control_ (0), - factory_ (0), - use_ttl_ (1), - use_consumer_proxy_map_ (1) -{ - if (this->factory_ == 0) - { - this->factory_ = - ACE_Dynamic_Service<TAO_EC_Gateway_IIOP_Factory>::instance ("EC_Gateway_IIOP_Factory"); - - if (this->factory_ == 0) - { - TAO_EC_Gateway_IIOP_Factory *f = 0; - ACE_NEW (f, - TAO_EC_Gateway_IIOP_Factory); - this->factory_ = f; - } - } - - if (this->factory_ != 0) - { - this->use_ttl_ = this->factory_->use_ttl(); - this->use_consumer_proxy_map_ = this->factory_->use_consumer_proxy_map(); - } -} - -TAO_EC_Gateway_IIOP::~TAO_EC_Gateway_IIOP (void) -{ - delete ec_control_; - ec_control_ = 0; -} - -int -TAO_EC_Gateway_IIOP::init (RtecEventChannelAdmin::EventChannel_ptr supplier_ec, - RtecEventChannelAdmin::EventChannel_ptr consumer_ec - ACE_ENV_ARG_DECL) -{ - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, -1); - - return this->init_i (supplier_ec, consumer_ec ACE_ENV_ARG_PARAMETER); -} - -int -TAO_EC_Gateway_IIOP::init_i (RtecEventChannelAdmin::EventChannel_ptr supplier_ec, - RtecEventChannelAdmin::EventChannel_ptr consumer_ec - ACE_ENV_ARG_DECL_NOT_USED) -{ - if (CORBA::is_nil (this->supplier_ec_.in ()) && CORBA::is_nil (this->consumer_ec_.in ())) - { - this->supplier_ec_ = - RtecEventChannelAdmin::EventChannel::_duplicate (supplier_ec); - this->consumer_ec_ = - RtecEventChannelAdmin::EventChannel::_duplicate (consumer_ec); - - if (ec_control_ == 0) - { - ec_control_ = factory_->create_consumerec_control(this); - ec_control_->activate(); - } - - return 0; - } - else - ACE_ERROR_RETURN ((LM_ERROR, - "TAO_EC_Gateway_IIOP - init_i " - "Supplier and consumer event channel reference " - "should be nil.\n"), -1); -} - -void -TAO_EC_Gateway_IIOP::close (ACE_ENV_SINGLE_ARG_DECL) -{ - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - - this->close_i (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -void -TAO_EC_Gateway_IIOP::cleanup_consumer_proxies (ACE_ENV_SINGLE_ARG_DECL) -{ - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - - // In case we are still pushing, don't cleanup the proxies - if (this->busy_count_ != 0) - { - this->cleanup_posted_ = 1; - return; - } - - this->cleanup_consumer_proxies_i (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -void -TAO_EC_Gateway_IIOP::close_i (ACE_ENV_SINGLE_ARG_DECL) -{ - // ACE_DEBUG ((LM_DEBUG, "ECG (%t) Closing gateway\n")); - this->disconnect_consumer_proxies_i (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - this->disconnect_supplier_proxy_i (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_EC_Gateway_IIOP::disconnect_consumer_proxies_i (ACE_ENV_SINGLE_ARG_DECL) -{ - if (this->consumer_proxy_map_.current_size () > 0) - { - for (Consumer_Map_Iterator j = this->consumer_proxy_map_.begin (); - j != this->consumer_proxy_map_.end (); - ++j) - { - RtecEventComm::PushConsumer_ptr consumer = (*j).int_id_; - if (CORBA::is_nil (consumer)) - continue; - ACE_TRY - { - consumer->disconnect_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - } - ACE_ENDTRY; - CORBA::release (consumer); - } - // Remove all the elements on the map. Calling close() does not - // work because the map is left in an inconsistent state. - this->consumer_proxy_map_.open (); - } - - if (!CORBA::is_nil (this->default_consumer_proxy_.in ())) - { - this->default_consumer_proxy_->disconnect_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - this->default_consumer_proxy_ = - RtecEventChannelAdmin::ProxyPushConsumer::_nil (); - } -} - -void -TAO_EC_Gateway_IIOP::disconnect_supplier_proxy_i (ACE_ENV_SINGLE_ARG_DECL) -{ - if (!CORBA::is_nil (this->supplier_proxy_.in ())) - { - this->supplier_proxy_->disconnect_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - this->supplier_proxy_ = - RtecEventChannelAdmin::ProxyPushSupplier::_nil (); - } -} - -void -TAO_EC_Gateway_IIOP::reconnect_consumer_ec(ACE_ENV_SINGLE_ARG_DECL) -{ - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - - if (this->busy_count_ != 0) - { - this->update_posted_ = 1; - return; - } - - this->update_consumer_i (c_qos_ ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Gateway_IIOP::update_consumer ( - const RtecEventChannelAdmin::ConsumerQOS& c_qos - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - if (c_qos.dependencies.length () == 0) - return; - - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - - this->c_qos_ = c_qos; - - if (this->busy_count_ != 0) - { - this->update_posted_ = 1; - return; - } - - this->update_consumer_i (c_qos ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Gateway_IIOP::cleanup_consumer_proxies_i (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) -{ - if (this->consumer_proxy_map_.current_size () > 0) - { - for (Consumer_Map_Iterator j = this->consumer_proxy_map_.begin (); - j != this->consumer_proxy_map_.end (); - ++j) - { - RtecEventComm::PushConsumer_ptr consumer = (*j).int_id_; - if (CORBA::is_nil (consumer)) - continue; - - CORBA::release (consumer); - } - // Remove all the elements on the map. Calling close() does not - // work because the map is left in an inconsistent state. - this->consumer_proxy_map_.open (); - } - - if (!CORBA::is_nil (this->default_consumer_proxy_.in ())) - { - this->default_consumer_proxy_ = - RtecEventChannelAdmin::ProxyPushConsumer::_nil (); - } -} - -void -TAO_EC_Gateway_IIOP::update_consumer_i ( - const RtecEventChannelAdmin::ConsumerQOS& c_qos - ACE_ENV_ARG_DECL) -{ - this->close_i (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - if (CORBA::is_nil (this->consumer_ec_.in ()) - || CORBA::is_nil (this->supplier_ec_.in ())) - return; - - // ACE_DEBUG ((LM_DEBUG, "ECG (%t) update_consumer_i \n")); - - this->open_i (c_qos ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_EC_Gateway_IIOP::open_i ( - const RtecEventChannelAdmin::ConsumerQOS& c_qos - ACE_ENV_ARG_DECL) -{ - // = Connect as a supplier to the consumer EC - RtecEventChannelAdmin::SupplierAdmin_var supplier_admin = - this->consumer_ec_->for_suppliers (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - RtecEventChannelAdmin::ConsumerQOS sub = c_qos; - sub.is_gateway = 1; - - // Change the RT_Info in the consumer QoS. - // On the same loop we discover the subscriptions by event source, - // and fill the consumer proxy map if we have to use this map. - for (CORBA::ULong i = 0; i < sub.dependencies.length (); ++i) - { - sub.dependencies[i].rt_info = this->supplier_info_; - - RtecEventChannelAdmin::ProxyPushConsumer_ptr proxy = 0; - const RtecEventComm::EventHeader &h = - sub.dependencies[i].event.header; - - RtecEventComm::EventSourceID sid = h.source; - - //ACE_DEBUG ((LM_DEBUG, - // "ECG (%t) trying (%d,%d)\n", - // sid, h.type)); - - // Skip all subscriptions that do not require an specific source - // id or skip all subscriptions when we don't need to use the consumer - // proxy map. - if (sid == ACE_ES_EVENT_SOURCE_ANY || this->use_consumer_proxy_map_ == 0) - continue; - - // Skip all the magic event types. - if (ACE_ES_EVENT_ANY < h.type && h.type < ACE_ES_EVENT_UNDEFINED) - continue; - - if (this->consumer_proxy_map_.find (sid, proxy) == -1) - { - //ACE_DEBUG ((LM_DEBUG, - // "ECG (%t) binding source %d\n", - // sid)); - proxy = supplier_admin->obtain_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - this->consumer_proxy_map_.bind (sid, proxy); - } - } - //ACE_DEBUG ((LM_DEBUG, - // "ECG (%t) consumer map computed (%d entries)\n", - // this->consumer_proxy_map_.current_size ())); - - if (this->consumer_proxy_map_.current_size () > 0) - { - this->supplier_is_active_ = 1; - - // Obtain a reference to our supplier personality... - RtecEventComm::PushSupplier_var supplier_ref = - this->supplier_._this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - // For each subscription by source build the set of publications - // (they may several, by type, for instance) and connect to the - // consumer proxy. - for (Consumer_Map_Iterator j = this->consumer_proxy_map_.begin (); - j != this->consumer_proxy_map_.end (); - ++j) - { - RtecEventChannelAdmin::SupplierQOS pub; - pub.publications.length (sub.dependencies.length () + 1); - pub.is_gateway = 1; - - int c = 0; - - RtecEventComm::EventSourceID sid = (*j).ext_id_; - for (CORBA::ULong k = 0; k < sub.dependencies.length (); ++k) - { - const RtecEventComm::EventHeader& h = - sub.dependencies[k].event.header; - if (h.source != sid - || (ACE_ES_EVENT_ANY < h.type - && h.type < ACE_ES_EVENT_UNDEFINED)) - continue; - pub.publications[c].event.header = h; - pub.publications[c].dependency_info.dependency_type = - RtecBase::TWO_WAY_CALL; - pub.publications[c].dependency_info.number_of_calls = 1; - pub.publications[c].dependency_info.rt_info = this->consumer_info_; - c++; - } - //ACE_DEBUG ((LM_DEBUG, - // "ECG (%t) supplier id %d has %d elements\n", - // sid, c)); - if (c == 0) - continue; - - pub.publications.length (c); - - // ACE_DEBUG ((LM_DEBUG, "ECG (%P|%t) Gateway/Supplier ")); - // ACE_SupplierQOS_Factory::debug (pub); - (*j).int_id_->connect_push_supplier (supplier_ref.in (), - pub - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - } - - // Also build the subscriptions that are *not* by source when we use the - // consumer proxy map, and all subscriptions when we don't use the map and - // then connect to the default consumer proxy. - RtecEventChannelAdmin::SupplierQOS pub; - pub.publications.length (sub.dependencies.length () + 1); - pub.is_gateway = 1; - int c = 0; - for (CORBA::ULong k = 0; k < sub.dependencies.length (); ++k) - { - const RtecEventComm::EventHeader& h = - sub.dependencies[k].event.header; - RtecEventComm::EventSourceID sid = h.source; - - // Skip all subscriptions with a specific source when we use the map - if (sid != ACE_ES_EVENT_SOURCE_ANY && this->use_consumer_proxy_map_ == 1) - continue; - - // Skip all the magic event types. - if (ACE_ES_EVENT_ANY < h.type && h.type < ACE_ES_EVENT_UNDEFINED) - continue; - - pub.publications[c].event.header = h; - pub.publications[c].event.header.creation_time = ORBSVCS_Time::zero (); - pub.publications[c].dependency_info.dependency_type = - RtecBase::TWO_WAY_CALL; - pub.publications[c].dependency_info.number_of_calls = 1; - pub.publications[c].dependency_info.rt_info = this->consumer_info_; - c++; - } - - if (c > 0) - { - this->supplier_is_active_ = 1; - - // Obtain a reference to our supplier personality... - RtecEventComm::PushSupplier_var supplier_ref = - this->supplier_._this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - // Obtain the consumer.... - this->default_consumer_proxy_ = - supplier_admin->obtain_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - pub.publications.length (c); - // ACE_DEBUG ((LM_DEBUG, "ECG (%t) Gateway/Supplier ")); - // ACE_SupplierQOS_Factory::debug (pub); - this->default_consumer_proxy_->connect_push_supplier (supplier_ref.in (), - pub - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - - RtecEventChannelAdmin::ConsumerAdmin_var consumer_admin = - this->supplier_ec_->for_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - this->supplier_proxy_ = - consumer_admin->obtain_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - this->consumer_is_active_ = 1; - RtecEventComm::PushConsumer_var consumer_ref = - this->consumer_._this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - // ACE_DEBUG ((LM_DEBUG, "ECG (%P|%t) Gateway/Consumer ")); - // ACE_ConsumerQOS_Factory::debug (sub); - - this->supplier_proxy_->connect_push_consumer (consumer_ref.in (), - sub - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_EC_Gateway_IIOP::update_supplier ( - const RtecEventChannelAdmin::SupplierQOS& - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - // Do nothing... -} - -void -TAO_EC_Gateway_IIOP::disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) -{ - // ACE_DEBUG ((LM_DEBUG, - // "ECG (%t): Supplier-consumer received " - // "disconnect from channel.\n")); -} - -void -TAO_EC_Gateway_IIOP::disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) -{ - // ACE_DEBUG ((LM_DEBUG, - // "ECG (%t): Supplier received " - // "disconnect from channel.\n")); -} - -void -TAO_EC_Gateway_IIOP::push (const RtecEventComm::EventSet &events - ACE_ENV_ARG_DECL) -{ - // ACE_DEBUG ((LM_DEBUG, "TAO_EC_Gateway_IIOP::push (%P|%t) - \n")); - - if (events.length () == 0) - { - // ACE_DEBUG ((LM_DEBUG, "no events\n")); - return; - } - - { - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - - this->busy_count_++; - } - - // ACE_DEBUG ((LM_DEBUG, "ECG: %d event(s)\n", events.length ())); - - // @@ TODO, there is an extra data copy here, we should do the event - // modification without it and only compact the necessary events. - RtecEventComm::EventSet out (1); - out.length (1); - for (CORBA::ULong i = 0; i < events.length (); ++i) - { - if (this->use_ttl_ == 1) - { - if (events[i].header.ttl == 0) - continue; - } - - RtecEventChannelAdmin::ProxyPushConsumer_ptr proxy = 0; - RtecEventComm::EventSourceID sid = events[i].header.source; - if (sid == ACE_ES_EVENT_SOURCE_ANY || this->use_consumer_proxy_map_ == 0 - || this->consumer_proxy_map_.find (sid, proxy) == -1) - { - // If the source is not in our map or we should not use the map then - // use the default consumer proxy. - proxy = this->default_consumer_proxy_.in (); - } - - if (CORBA::is_nil (proxy)) - continue; - - out[0] = events[i]; - - if (this->use_ttl_ == 1) - out[0].header.ttl--; - - // ACE_DEBUG ((LM_DEBUG, "ECG: event sent to proxy\n")); - this->push_to_consumer(proxy, out ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - - { - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - - this->busy_count_--; - - if (this->busy_count_ == 0 && this->cleanup_posted_ != 0) - { - this->cleanup_posted_ = 0; - this->cleanup_consumer_proxies_i (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - } - - if (this->busy_count_ == 0 && this->update_posted_ != 0) - { - this->update_posted_ = 0; - this->update_consumer_i (this->c_qos_ ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - } -} - -void -TAO_EC_Gateway_IIOP::push_to_consumer ( - RtecEventChannelAdmin::ProxyPushConsumer_ptr consumer, - const RtecEventComm::EventSet& event - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - consumer->push (event ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCH (CORBA::OBJECT_NOT_EXIST, not_used) - { - ec_control_->event_channel_not_exist (this ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCH (CORBA::SystemException, sysex) - { - ec_control_->system_exception (this, - sysex - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Shouldn't happen. - } - ACE_ENDTRY; -} - -int -TAO_EC_Gateway_IIOP::shutdown (ACE_ENV_SINGLE_ARG_DECL) -{ - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, -1); - - ec_control_->shutdown(); - - this->close_i (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - - if (this->supplier_is_active_) - { - PortableServer::POA_var poa = - this->supplier_._default_POA (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - PortableServer::ObjectId_var id = - poa->servant_to_id (&this->supplier_ ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - poa->deactivate_object (id.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->supplier_is_active_ = 0; - } - - if (this->consumer_is_active_) - { - PortableServer::POA_var poa = - this->consumer_._default_POA (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - PortableServer::ObjectId_var id = - poa->servant_to_id (&this->consumer_ ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - poa->deactivate_object (id.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->consumer_is_active_ = 0; - } - - this->cleanup_consumer_ec_i (); - this->cleanup_supplier_ec_i (); - - return 0; -} - -int -TAO_EC_Gateway_IIOP::cleanup_consumer_ec (void) -{ - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, -1); - - this->cleanup_consumer_ec_i (); - - return 0; -} - -int -TAO_EC_Gateway_IIOP::cleanup_supplier_ec (void) -{ - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, -1); - - this->cleanup_supplier_ec_i (); - - return 0; -} - -void -TAO_EC_Gateway_IIOP::cleanup_consumer_ec_i (void) -{ - this->consumer_ec_ = - RtecEventChannelAdmin::EventChannel::_nil (); -} - -void -TAO_EC_Gateway_IIOP::cleanup_supplier_ec_i (void) -{ - this->supplier_ec_ = - RtecEventChannelAdmin::EventChannel::_nil (); -} - -CORBA::Boolean -TAO_EC_Gateway_IIOP::is_consumer_ec_connected_i (void) const -{ - return !CORBA::is_nil (this->consumer_ec_.in ()); -} - -CORBA::Boolean -TAO_EC_Gateway_IIOP::consumer_ec_non_existent ( - CORBA::Boolean_out disconnected - ACE_ENV_ARG_DECL) -{ - CORBA::Object_var consumer_ec; - { - ACE_GUARD_THROW_EX ( - TAO_SYNCH_MUTEX, ace_mon, this->lock_, - CORBA::INTERNAL ()); - ACE_CHECK_RETURN (0); - - disconnected = 0; - if (this->is_consumer_ec_connected_i () == 0) - { - disconnected = 1; - return 0; - } - - consumer_ec = CORBA::Object::_duplicate (this->consumer_ec_.in ()); - } - -#if (TAO_HAS_MINIMUM_CORBA == 0) - return consumer_ec->_non_existent (ACE_ENV_SINGLE_ARG_PARAMETER); -#else - return 0; -#endif /* TAO_HAS_MINIMUM_CORBA */ -} - -void -TAO_EC_Gateway_IIOP::suspend_supplier_ec (ACE_ENV_SINGLE_ARG_DECL) -{ - if (!CORBA::is_nil (this->supplier_proxy_.in ()) && supplier_ec_suspended_ == 0) - { - this->supplier_proxy_->suspend_connection (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - supplier_ec_suspended_ = 1; - } -} - -void -TAO_EC_Gateway_IIOP::resume_supplier_ec (ACE_ENV_SINGLE_ARG_DECL) -{ - if (!CORBA::is_nil (this->supplier_proxy_.in ()) && supplier_ec_suspended_ == 1) - { - this->supplier_proxy_->resume_connection (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - supplier_ec_suspended_ = 0; - } -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_IIOP.h b/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_IIOP.h deleted file mode 100644 index 6f957042c3a..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_IIOP.h +++ /dev/null @@ -1,255 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Gateway_IIOP.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * @author Johnny Willemsen (jwillemsen@remedy.nl) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_GATEWAY_IIOP_H -#define TAO_EC_GATEWAY_IIOP_H - -#include /**/ "ace/pre.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" -#include "orbsvcs/Event/EC_Gateway.h" - -#include "orbsvcs/RtecEventChannelAdminS.h" -#include "orbsvcs/RtecEventCommS.h" -#include "orbsvcs/Channel_Clients_T.h" - -#include "ace/Map_Manager.h" -#include "ace/Null_Mutex.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_ECG_ConsumerEC_Control; -class TAO_EC_Gateway_IIOP_Factory; - -/** - * @class TAO_EC_Gateway_IIOP - * - * @brief Event Channel Gateway using IIOP. - * - * This class mediates among two event channels, it connects as a consumer of - * events with a remote event channel, and as a supplier of events with the - * local EC. As a consumer it gives a QoS designed to only accept the events - * in which *local* consumers are interested. Eventually the local EC should - * create this object and compute its QoS in an automated manner; but this - * requires some way to filter out the peers registered as consumers, - * otherwise we will get loops in the QoS graph. - * It uses exactly the same set of events in the publications list - * when connected as a supplier. - * - * @note - * An alternative implementation would be to register with the - * remote EC as a supplier, and then filter on the remote EC, but - * one of the objectives is to minimize network traffic. - * On the other hand the events will be pushed to remote consumers, - * event though they will be dropped upon receipt (due to the TTL - * field); IMHO this is another suggestion that the EC needs to know - * (somehow) which consumers are truly its peers in disguise. - * - * @todo: The class makes an extra copy of the events, we need to - * investigate if closer collaboration with its collocated EC could - * be used to remove that copy. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Gateway_IIOP : public TAO_EC_Gateway -{ -public: - TAO_EC_Gateway_IIOP (void); - virtual ~TAO_EC_Gateway_IIOP (void); - - /** - * To do its job this class requires to know the local and remote ECs it will - * connect to. - * @return 0 in case of success, -1 in case of failure - */ - int init (RtecEventChannelAdmin::EventChannel_ptr supplier_ec, - RtecEventChannelAdmin::EventChannel_ptr consumer_ec - ACE_ENV_ARG_DECL); - - /// The channel is disconnecting. - void disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); - - /// The channel is disconnecting. - void disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); - - /// This is the consumer side behavior, it pushes the events to the - /// local event channel. - void push (const RtecEventComm::EventSet &events - ACE_ENV_ARG_DECL_WITH_DEFAULTS); - - /// Disconnect and shutdown the gateway - int shutdown (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); - - // The following methods are documented in the base class. - virtual void close (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); - virtual void update_consumer (const RtecEventChannelAdmin::ConsumerQOS& sub - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - virtual void update_supplier (const RtecEventChannelAdmin::SupplierQOS& pub - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - // Let the gateway reconnect itself to the consumer ec given exisiting QoS - void reconnect_consumer_ec(ACE_ENV_SINGLE_ARG_DECL); - - /// Check whether the consumer event channel is non existent or not - CORBA::Boolean consumer_ec_non_existent (CORBA::Boolean_out disconnected - ACE_ENV_ARG_DECL); - - /** - * Cleanup all consumer proxies we have without trying to tell the - * consumer that we are going to disconnect. This can be used to cleanup - * the consumer proxy administration in case we know that the consumers - * are all unreachable. - */ - void cleanup_consumer_proxies (ACE_ENV_SINGLE_ARG_DECL); - - /// Cleanup the connection to the consumer ec. Doesn't call anything on the - /// ec again, just set the object to nil - int cleanup_consumer_ec (void); - - /// Cleanup the connection to the supplier ec. Doesn't call anything on the - /// ec again, just set the object to nil - int cleanup_supplier_ec (void); - - /// Suspend the connection to the supplier ec - void suspend_supplier_ec (ACE_ENV_SINGLE_ARG_DECL); - - /// Resume the connection to the supplier ec - void resume_supplier_ec (ACE_ENV_SINGLE_ARG_DECL); - -private: - void close_i (ACE_ENV_SINGLE_ARG_DECL); - - /// Disconnect the supplier proxy - void disconnect_supplier_proxy_i (ACE_ENV_SINGLE_ARG_DECL); - - /// Disconnect all consumer proxies - void disconnect_consumer_proxies_i (ACE_ENV_SINGLE_ARG_DECL); - - /// Remove all consumer proxies without calling disconnect on them - void cleanup_consumer_proxies_i (ACE_ENV_SINGLE_ARG_DECL); - - void update_consumer_i (const RtecEventChannelAdmin::ConsumerQOS& sub - ACE_ENV_ARG_DECL); - - /// Create all connections to consumer ec and to supplier ec. - void open_i (const RtecEventChannelAdmin::ConsumerQOS& sub - ACE_ENV_ARG_DECL); - - /// Helper method to see if consumer ec is connected - CORBA::Boolean is_consumer_ec_connected_i (void) const; - - /// Push the @a event to the @a consumer. - void push_to_consumer (RtecEventChannelAdmin::ProxyPushConsumer_ptr consumer, - const RtecEventComm::EventSet& event ACE_ENV_ARG_DECL); - - void cleanup_consumer_ec_i (void); - - void cleanup_supplier_ec_i (void); - -protected: - /// Do the real work in init() - int init_i (RtecEventChannelAdmin::EventChannel_ptr supplier_ec, - RtecEventChannelAdmin::EventChannel_ptr consumer_ec - ACE_ENV_ARG_DECL); - -protected: - /// Lock to synchronize internal changes - TAO_SYNCH_MUTEX lock_; - - /// How many threads are running push() we cannot make changes until - /// that reaches 0 - CORBA::ULong busy_count_; - - /** - * An update_consumer() message arrived *while* we were doing a - * push() the modification is stored, if multiple update_consumer messages - * arrive only the last one is executed. - */ - int update_posted_; - RtecEventChannelAdmin::ConsumerQOS c_qos_; - - /** - * We have a cleanup outstanding and must wait doing cleanup until all pushes - * are ready. - */ - int cleanup_posted_; - - /** - * Is the supplier ec suspended? - */ - int supplier_ec_suspended_; - - /// The event channel acting as supplier for this gateway so we can reconnect - /// when the list changes. - RtecEventChannelAdmin::EventChannel_var supplier_ec_; - - /// The event channel acting as consumer of this gateway - RtecEventChannelAdmin::EventChannel_var consumer_ec_; - - /// Our RT_Infos for the event channel that is the supplier. - RtecBase::handle_t supplier_info_; - /// Our RT_Infos for the event channel that is the consumer. - RtecBase::handle_t consumer_info_; - - /// Our consumer personality.... - ACE_PushConsumer_Adapter<TAO_EC_Gateway_IIOP> consumer_; - - /// If it is not 0 then we must deactivate the consumer - int consumer_is_active_; - - /// Our supplier personality.... - ACE_PushSupplier_Adapter<TAO_EC_Gateway_IIOP> supplier_; - - /// If it is not 0 then we must deactivate the supplier - int supplier_is_active_; - - // We use a different Consumer_Proxy - typedef ACE_Map_Manager<RtecEventComm::EventSourceID,RtecEventChannelAdmin::ProxyPushConsumer_ptr,ACE_Null_Mutex> Consumer_Map; - typedef ACE_Map_Iterator<RtecEventComm::EventSourceID,RtecEventChannelAdmin::ProxyPushConsumer_ptr,ACE_Null_Mutex> Consumer_Map_Iterator; - - /// We talk to the EC (as a supplier) using either an per-supplier - /// proxy or a generic proxy for the type only subscriptions. We push the - /// events to these proxies - Consumer_Map consumer_proxy_map_; - RtecEventChannelAdmin::ProxyPushConsumer_var default_consumer_proxy_; - - /// We talk to the EC (as a consumer) using this proxy. We receive the events - /// from these proxy - RtecEventChannelAdmin::ProxyPushSupplier_var supplier_proxy_; - - /// The consumer ec control which controls the behaviour in case of a - /// misbehaving consumer ec - TAO_ECG_ConsumerEC_Control* ec_control_; - - /// The Gateway IIOP Factory for all the settings - TAO_EC_Gateway_IIOP_Factory* factory_; - - /// If 1, we use the TTL flags, if 0, we just ignore TTL - int use_ttl_; - - /// The flag for using the consumer proxy map. With 1 the consumer proxy map - /// is used, meaning that for each unique source id we use a different - /// proxy push consumer, if 0, we only use one proxy push consumer (the - /// default) for all source ids. - int use_consumer_proxy_map_; - -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_EC_GATEWAY_IIOP_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_IIOP_Factory.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_IIOP_Factory.cpp deleted file mode 100644 index ec6b0f935ca..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_IIOP_Factory.cpp +++ /dev/null @@ -1,212 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Gateway_IIOP_Factory.h" -#include "orbsvcs/Event/ECG_Defaults.h" -#include "orbsvcs/Event_Utilities.h" -#include "orbsvcs/Time_Utilities.h" - -#include "ace/Dynamic_Service.h" -#include "ace/Arg_Shifter.h" - -#include "orbsvcs/Event/ECG_ConsumerEC_Control.h" -#include "orbsvcs/Event/ECG_Reactive_ConsumerEC_Control.h" -#include "orbsvcs/Event/ECG_Reconnect_ConsumerEC_Control.h" -#include "orbsvcs/Event/EC_Gateway_IIOP.h" -#include "ace/OS_NS_strings.h" - -#if !defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Gateway_IIOP_Factory.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (Event, - EC_Gateway_IIOP_Factory, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -int -TAO_EC_Gateway_IIOP_Factory::init_svcs (void) -{ - return ACE_Service_Config::static_svcs ()-> - insert (&ace_svc_desc_TAO_EC_Gateway_IIOP_Factory); -} - -TAO_EC_Gateway_IIOP_Factory::TAO_EC_Gateway_IIOP_Factory (void) - : orbid_ (TAO_ECG_DEFAULT_IIOP_ORB_ID), - consumer_ec_control_ (TAO_ECG_DEFAULT_IIOP_CONSUMEREC_CONTROL), - consumer_ec_control_period_ (TAO_ECG_DEFAULT_IIOP_CONSUMEREC_CONTROL_PERIOD), - consumer_ec_control_timeout_ (TAO_ECG_DEFAULT_IIOP_CONSUMEREC_CONTROL_TIMEOUT), - use_ttl_ (TAO_ECG_DEFAULT_IIOP_USE_TTL), - use_consumer_proxy_map_ (TAO_ECG_DEFAULT_IIOP_USE_CONSUMER_PROXY_MAP) -{ -} - -TAO_EC_Gateway_IIOP_Factory::~TAO_EC_Gateway_IIOP_Factory (void) -{ -} - -int -TAO_EC_Gateway_IIOP_Factory::fini (void) -{ - return 0; -} - -int -TAO_EC_Gateway_IIOP_Factory::init (int argc, char* argv[]) -{ - int result = 0; - - ACE_Arg_Shifter arg_shifter (argc, argv); - - while (arg_shifter.is_anything_left ()) - { - const char *arg = arg_shifter.get_current (); - - if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECGIIOPConsumerECControl")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("null")) == 0) - this->consumer_ec_control_ = 0; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("reactive")) == 0) - this->consumer_ec_control_ = 1; - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("reconnect")) == 0) - this->consumer_ec_control_ = 2; - else - this->unsupported_option_value ("-ECGIIOPConsumerECControl", opt); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECGIIOPConsumerECControlPeriod")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - this->consumer_ec_control_period_ = ACE_OS::atoi (opt); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECGIIOPConsumerECControlTimeout")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - unsigned long timeout = ACE_OS::strtoul(opt, 0, 10); - this->consumer_ec_control_timeout_.usec(timeout); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECGIIOPUseORBId")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - // Save argument for later use - this->orbid_ = ACE_TEXT_ALWAYS_CHAR(arg_shifter.get_current ()); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECGIIOPUseTTL")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - this->use_ttl_ = ACE_OS::atoi (opt); - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECGIIOPUseConsumerProxyMap")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - this->use_consumer_proxy_map_ = ACE_OS::atoi (opt); - arg_shifter.consume_arg (); - } - } - - else - { - arg_shifter.ignore_arg (); - ACE_DEBUG ((LM_WARNING, - "Ignoring <%s> option " - "during initialization.\n", - arg)); - result = -1; - } - } - - return result; -} - -void -TAO_EC_Gateway_IIOP_Factory::unsupported_option_value (const char * option_name, - const char * option_value) -{ - ACE_ERROR ((LM_ERROR, - "EC_Gateway_IIOP_Factory -" - "Unsupported <%s> option value: <%s>. " - "Ignoring this option - using defaults instead.\n", - option_name, - option_value)); -} - -TAO_ECG_ConsumerEC_Control* -TAO_EC_Gateway_IIOP_Factory::create_consumerec_control (TAO_EC_Gateway_IIOP* gateway) -{ - if (this->consumer_ec_control_ == 0) - return new TAO_ECG_ConsumerEC_Control (); - else if (this->consumer_ec_control_ == 1) - { - int argc = 0; - char **argv = 0; - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, this->orbid_.c_str ()); - ACE_Time_Value rate (0, this->consumer_ec_control_period_); - return new TAO_ECG_Reactive_ConsumerEC_Control (rate, consumer_ec_control_timeout_, gateway, orb.in ()); - } - else if (this->consumer_ec_control_ == 2) - { - int argc = 0; - char **argv = 0; - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, this->orbid_.c_str ()); - ACE_Time_Value rate (0, this->consumer_ec_control_period_); - return new TAO_ECG_Reconnect_ConsumerEC_Control (rate, consumer_ec_control_timeout_, gateway, orb.in ()); - } - return 0; -} - -void -TAO_EC_Gateway_IIOP_Factory::destroy_consumerec_control ( - TAO_ECG_ConsumerEC_Control* x) -{ - delete x; -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -ACE_STATIC_SVC_DEFINE (TAO_EC_Gateway_IIOP_Factory, - ACE_TEXT ("EC_Gateway_IIOP_Factory"), - ACE_SVC_OBJ_T, - &ACE_SVC_NAME (TAO_EC_Gateway_IIOP_Factory), - ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, - 0) -ACE_FACTORY_DEFINE (TAO_RTEvent_Serv, TAO_EC_Gateway_IIOP_Factory) diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_IIOP_Factory.h b/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_IIOP_Factory.h deleted file mode 100644 index 2a1c30a10a0..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_IIOP_Factory.h +++ /dev/null @@ -1,115 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Gateway_IIOP_Factory.h - * - * $Id$ - * - * @author Johnny Willemsen (jwillemsen@remedy.nl) - * - */ - -#ifndef TAO_EC_GATEWAY_IIOP_FACTORY_H -#define TAO_EC_GATEWAY_IIOP_FACTORY_H - -#include /**/ "ace/pre.h" -#include "ace/Service_Config.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Time_Value.h" -#include "ace/Service_Object.h" -#include "ace/SString.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#include "tao/Versioned_Namespace.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_ECG_ConsumerEC_Control; -class TAO_EC_Gateway_IIOP; - -/** - * @class TAO_EC_Gateway_IIOP_Factory - * - * @brief Factory for the EC_Gateway_IIOP settings - * - * Default configuration values can be found in ECG_Defaults.h - */ -class TAO_RTEvent_Serv_Export TAO_EC_Gateway_IIOP_Factory - : public ACE_Service_Object -{ -public: - TAO_EC_Gateway_IIOP_Factory (void); - virtual ~TAO_EC_Gateway_IIOP_Factory (void); - - /// The Service_Object entry points. - //@{ - virtual int init (int argc, char* argv[]); - virtual int fini (void); - //@} - - /// Helper function to register the Gateway into the service - /// configurator. - static int init_svcs (void); - - /// Create the consumer event channel control. - TAO_ECG_ConsumerEC_Control * - create_consumerec_control (TAO_EC_Gateway_IIOP* gateway); - - /// Destroy consumer event channel control. - void destroy_consumerec_control (TAO_ECG_ConsumerEC_Control* x); - - /// Accessors to use_ttl flag - int use_ttl (void) const; - - /// Accessors to use_consumer_proxy_map flag - int use_consumer_proxy_map (void) const; - -private: - /// Helper for agrument parsing. Prints out an error message about - /// unsupported option value. - void unsupported_option_value (const char * option_name, - const char * option_value); - -protected: - /// Use this ORB to locate global resources. - ACE_CString orbid_; - - /// The control policy for the consumer event channel - int consumer_ec_control_; - - /// The consumer event channel control periods in usecs - int consumer_ec_control_period_; - - /// The control timeout in usecs for the consumer event channel - ACE_Time_Value consumer_ec_control_timeout_; - - /// If 1, we use the TTL flags, if 0, we just ignore TTL. - /// @note When this flag is set to 0, make sure that no recursive structures - /// exists in the gateway setup for the same source/type combination, else - /// one event will flow continuosly through all gateways. - int use_ttl_; - - /// The flag for using the consumer proxy map. With 1 the consumer proxy map - /// is used, meaning that for each unique source id we use a different - /// proxy push consumer, if 0, we only use one proxy push consumer for all - /// source ids. - int use_consumer_proxy_map_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -ACE_STATIC_SVC_DECLARE (TAO_EC_Gateway_IIOP_Factory) -ACE_FACTORY_DECLARE (TAO_RTEvent_Serv, TAO_EC_Gateway_IIOP_Factory) - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Gateway_IIOP_Factory.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_GATEWAY_IIOP_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_IIOP_Factory.i b/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_IIOP_Factory.i deleted file mode 100644 index 45dbd3f9d3f..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_IIOP_Factory.i +++ /dev/null @@ -1,19 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -TAO_EC_Gateway_IIOP_Factory::use_ttl (void) const -{ - return this->use_ttl_; -} - -ACE_INLINE int -TAO_EC_Gateway_IIOP_Factory::use_consumer_proxy_map (void) const -{ - return this->use_consumer_proxy_map_; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_Sched.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_Sched.cpp deleted file mode 100644 index 1b1a0d4479e..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_Sched.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Gateway_Sched.h" -#include "orbsvcs/Time_Utilities.h" - -ACE_RCSID (Event, - EC_Gateway_sched, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Gateway_Sched::TAO_EC_Gateway_Sched (void) - : TAO_EC_Gateway_IIOP () -{ -} - -TAO_EC_Gateway_Sched::~TAO_EC_Gateway_Sched (void) -{ -} - -void -TAO_EC_Gateway_Sched::init (RtecEventChannelAdmin::EventChannel_ptr supplier_ec, - RtecEventChannelAdmin::EventChannel_ptr consumer_ec, - RtecScheduler::Scheduler_ptr supplier_sched, - RtecScheduler::Scheduler_ptr consumer_sched, - const char* consumer_name, - const char* supplier_name - ACE_ENV_ARG_DECL) -{ - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - - this->init_i (supplier_ec, consumer_ec ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // @@ Should we throw a system exception here? - if (CORBA::is_nil (supplier_sched) - || CORBA::is_nil (consumer_sched) - || consumer_name == 0 - || supplier_name == 0) - ACE_THROW (CORBA::BAD_PARAM ()); - - this->supplier_info_ = - supplier_sched->create (supplier_name ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // @@ TODO Many things are hard-coded in the RT_Info here. - - // The worst case execution time is far less than 500 usecs, but - // that is a safe estimate.... - ACE_Time_Value tv (0, 500); - TimeBase::TimeT time; - ORBSVCS_Time::Time_Value_to_TimeT (time, tv); - supplier_sched->set (this->supplier_info_, - RtecScheduler::VERY_HIGH_CRITICALITY, - time, time, time, - 25000 * 10, - RtecScheduler::VERY_LOW_IMPORTANCE, - time, - 0, - RtecScheduler::OPERATION - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->consumer_info_ = - consumer_sched->create (consumer_name ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - tv = ACE_Time_Value (0, 500); - ORBSVCS_Time::Time_Value_to_TimeT (time, tv); - consumer_sched->set (this->consumer_info_, - RtecScheduler::VERY_HIGH_CRITICALITY, - time, time, time, - 25000 * 10, - RtecScheduler::VERY_LOW_IMPORTANCE, - time, - 1, - RtecScheduler::REMOTE_DEPENDANT - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_Sched.h b/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_Sched.h deleted file mode 100644 index 5267546de17..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_Sched.h +++ /dev/null @@ -1,59 +0,0 @@ -// -*- C++ -*- -/** - * @file EC_Gateway_Sched.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - * - * - */ - -#ifndef TAO_EC_GATEWAY_SCHED_H -#define TAO_EC_GATEWAY_SCHED_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Gateway_IIOP.h" -#include "orbsvcs/RtecSchedulerC.h" -#include "orbsvcs/Event/sched_event_export.h" - -// **************************************************************** - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Gateway_Sched - * - * @brief Extend the EC_Gateway_IIOP interface to support scheduling. - */ -class TAO_RTSchedEvent_Export TAO_EC_Gateway_Sched : public TAO_EC_Gateway_IIOP -{ -public: - TAO_EC_Gateway_Sched (void); - ~TAO_EC_Gateway_Sched (void); - - /** - * To do its job this class requires to know the local and remote - * ECs it will connect to; furthermore it also requires to build - * RT_Infos for the local and remote schedulers. - * @todo part of the RT_Info is hardcoded, we need to make it - * parametric. - */ - void init (RtecEventChannelAdmin::EventChannel_ptr supplier_ec, - RtecEventChannelAdmin::EventChannel_ptr consumer_ec, - RtecScheduler::Scheduler_ptr supplier_sched, - RtecScheduler::Scheduler_ptr consumer_sched, - const char* consumer_name, - const char* supplier_name - ACE_ENV_ARG_DECL); -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_EC_GATEWAY_SCHED_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Group_Scheduling.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Group_Scheduling.cpp deleted file mode 100644 index 9e39ef1f631..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Group_Scheduling.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Group_Scheduling.h" -#include "orbsvcs/Event/EC_QOS_Info.h" -#include "orbsvcs/Event/EC_Supplier_Filter.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Group_Scheduling.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, EC_Group_Scheduling, "$Id$") - -void -TAO_EC_Group_Scheduling::add_proxy_supplier_dependencies ( - TAO_EC_ProxyPushSupplier *, - TAO_EC_ProxyPushConsumer * - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_Group_Scheduling::schedule_event (const RtecEventComm::EventSet &event, - TAO_EC_ProxyPushConsumer *, - TAO_EC_Supplier_Filter *filter - ACE_ENV_ARG_DECL) -{ - TAO_EC_QOS_Info event_info; - // @@ yuck... - filter->push_scheduled_event (const_cast<RtecEventComm::EventSet&> (event), - event_info - ACE_ENV_ARG_PARAMETER); -} diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Group_Scheduling.h b/TAO/orbsvcs/orbsvcs/Event/EC_Group_Scheduling.h deleted file mode 100644 index 1a9b35f07e2..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Group_Scheduling.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- C++ -*- */ -/** - * @file EC_Group_Scheduling.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_GROUP_SCHEDULING_H -#define TAO_EC_GROUP_SCHEDULING_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Scheduling_Strategy.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -/** - * @class TAO_EC_Group_Scheduling - * - * @brief A scheduling strategy that preserves event groups. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Group_Scheduling : public TAO_EC_Scheduling_Strategy -{ -public: - /// Constructor. - TAO_EC_Group_Scheduling (void); - - // Read EC_Scheduling_Strategy.h for more details - virtual void add_proxy_supplier_dependencies ( - TAO_EC_ProxyPushSupplier *supplier, - TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL); - virtual void schedule_event (const RtecEventComm::EventSet &event, - TAO_EC_ProxyPushConsumer *consumer, - TAO_EC_Supplier_Filter *filter - ACE_ENV_ARG_DECL); - -private: - TAO_EC_Group_Scheduling (const TAO_EC_Group_Scheduling&); - TAO_EC_Group_Scheduling& operator= (const TAO_EC_Group_Scheduling&); -}; - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Group_Scheduling.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* TAO_EC_GROUP_SCHEDULING_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Group_Scheduling.inl b/TAO/orbsvcs/orbsvcs/Event/EC_Group_Scheduling.inl deleted file mode 100644 index e918d295929..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Group_Scheduling.inl +++ /dev/null @@ -1,7 +0,0 @@ -// $Id$ - -ACE_INLINE -TAO_EC_Group_Scheduling::TAO_EC_Group_Scheduling (void) -{ -} - diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Dispatching.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Dispatching.cpp deleted file mode 100644 index 206d87f18a2..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Dispatching.cpp +++ /dev/null @@ -1,210 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Kokyu_Dispatching.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "orbsvcs/Event/EC_ProxySupplier.h" -#include "orbsvcs/Event/EC_QOS_Info.h" - -#include "orbsvcs/Event_Service_Constants.h" -#include "orbsvcs/RtecSchedulerC.h" -#include "tao/ORB_Constants.h" - -#include "ace/Sched_Params.h" -#include "ace/Malloc_Allocator.h" - -#include "Kokyu/Kokyu.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Kokyu_Dispatching.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (Event, - EC_Kokyu_Dispatching, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Kokyu_Dispatching::TAO_EC_Kokyu_Dispatching (TAO_EC_Event_Channel_Base *ec, int sched_policy, int sched_scope) - :allocator_ (0), - dispatcher_ (0), - lanes_setup_ (0), - disp_sched_policy_ (sched_policy), - disp_sched_scope_ (sched_scope) -{ - CORBA::Object_var tmp = ec->scheduler (); - this->scheduler_ = RtecScheduler::Scheduler::_narrow (tmp.in ()); - - //@@VS - need to revisit this - should be some other allocator - if (this->allocator_ == 0) - { - this->allocator_ = ACE_Allocator::instance (); - } -} - -void -TAO_EC_Kokyu_Dispatching::activate (void) -{ - if (!lanes_setup_) - setup_lanes (); - - this->dispatcher_->activate (); - - //ACE_DEBUG ((LM_DEBUG, "Kokyu dispatcher activated\n")); -} - -void -TAO_EC_Kokyu_Dispatching::setup_lanes (void) -{ - ACE_DECLARE_NEW_CORBA_ENV; - // Query the scheduler togetConfig_Infos - RtecScheduler::Config_Info_Set_var configs; - ACE_TRY - { - this->scheduler_->get_config_infos(configs.out()); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore exceptions.. - } - ACE_ENDTRY; - - //might be no Config_Infos in the set (if none passed to scheduler_) - - // Convert RtecScheduler::Config_Info_Set to Kokyu::ConfigInfoSet - // OK to assume exact correspondence betwen Config_Info and ConfigInfo? - Kokyu::ConfigInfoSet kconfigs(configs->length()); - for(CORBA::ULong i=0; i<configs->length(); ++i) { - kconfigs[i].preemption_priority_ = configs[i].preemption_priority; - kconfigs[i].thread_priority_ = configs[i].thread_priority; - switch (configs[i].dispatching_type) { - case RtecScheduler::STATIC_DISPATCHING: - kconfigs[i].dispatching_type_ = Kokyu::FIFO_DISPATCHING; - break; - case RtecScheduler::DEADLINE_DISPATCHING: - kconfigs[i].dispatching_type_ = Kokyu::DEADLINE_DISPATCHING; - break; - case RtecScheduler::LAXITY_DISPATCHING: - kconfigs[i].dispatching_type_ = Kokyu::LAXITY_DISPATCHING; - break; - } - } - - Kokyu::Dispatcher_Attributes attrs; - attrs.config_info_set_ = kconfigs; - attrs.sched_policy (disp_sched_policy_); - attrs.sched_scope (disp_sched_scope_); - - // Create Kokyu::Dispatcher using factory - Kokyu::Dispatcher_Auto_Ptr - tmp(Kokyu::Dispatcher_Factory::create_dispatcher(attrs)); - this->dispatcher_ = tmp; - this->lanes_setup_ = 1; - - //ACE_DEBUG ((LM_DEBUG, "Kokyu dispatcher setup\n")); -} - -void -TAO_EC_Kokyu_Dispatching::shutdown (void) -{ - this->dispatcher_->shutdown(); -} - -void -TAO_EC_Kokyu_Dispatching::push (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - RtecEventComm::EventSet event_copy = event; - this->push_nocopy (proxy, consumer, event_copy, qos_info ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Kokyu_Dispatching::push_nocopy (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - if (this->dispatcher_.get () == 0) - this->setup_lanes (); - - void* buf = - this->allocator_->malloc (sizeof (TAO_EC_Kokyu_Push_Command )); - - if (buf == 0) - ACE_THROW (CORBA::NO_MEMORY (TAO::VMCID, - CORBA::COMPLETED_NO)); - - // Create Dispatch_Command - TAO_EC_Kokyu_Push_Command *cmd = - new (buf) TAO_EC_Kokyu_Push_Command (proxy, - consumer, - event, this->allocator_); - - /* - TAO_EC_Kokyu_Push_Command *cmd = - new TAO_EC_Kokyu_Push_Command (proxy, - consumer, - event, 0); - */ - - // Convert TAO_EC_QOS_Info to QoSDescriptor - RtecScheduler::RT_Info *rt_info = - this->scheduler_->get(qos_info.rt_info); - - Kokyu::QoSDescriptor qosd; - qosd.preemption_priority_ = rt_info->preemption_priority; - qosd.deadline_ = rt_info->period; - ORBSVCS_Time::TimeT_to_Time_Value (qosd.execution_time_, - rt_info->worst_case_execution_time); - - this->dispatcher_->dispatch(cmd,qosd); -} - -// **************************************************************** - -TAO_EC_Kokyu_Shutdown_Command::~TAO_EC_Kokyu_Shutdown_Command(void) -{ -} - -int -TAO_EC_Kokyu_Shutdown_Command::execute(void) -{ - return -1; -} - -// **************************************************************** - -TAO_EC_Kokyu_Push_Command::~TAO_EC_Kokyu_Push_Command(void) -{ - this->proxy_->_decr_refcnt (); -} - -int -TAO_EC_Kokyu_Push_Command::execute () -{ - ACE_DECLARE_NEW_CORBA_ENV; - - ACE_TRY - { - //ACE_DEBUG ((LM_DEBUG, - // "(%t) Command object executed.\n")); - - this->proxy_->push_to_consumer (this->consumer_.in (), - this->event_ - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - return -1; - } - ACE_ENDTRY; - - return 0; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Dispatching.h b/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Dispatching.h deleted file mode 100644 index d9079a271ac..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Dispatching.h +++ /dev/null @@ -1,147 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Kokyu_Dispatching.h - * - * $Id$ - * - * @author Bryan Thrall (thrall@cs.wustl.edu) - * - * Based on previous work by Carlos O'Ryan (coryan@cs.wustl.edu) and - * Tim Harrison (harrison@cs.wustl.edu) and other members of the DOC group. - * More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_KOKYU_DISPATCHING_H -#define TAO_EC_KOKYU_DISPATCHING_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Dispatching.h" -#include "orbsvcs/Event/EC_ProxySupplier.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/RtecSchedulerC.h" -#include "orbsvcs/Event/rtkokyu_event_export.h" - -#include "ace/Thread_Manager.h" - -#include "Kokyu/Kokyu.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Event_Channel_Base; - -/** - * @class TAO_EC_Kokyu_Dispatching - * - * @brief Dispatching strategy that minimizes priority inversion. - * - * This strategy uses multiple queues, each serviced by a thread - * at different priority. This minimizes priority inversion - * because the consumers at higher priority are serviced before - * consumers at lower priority. - * It is more flexible than using the supplier thread to dispatch - * because it allows high-priority suppliers to push events to - * low-priority consumers (and vice-versa). - * It also isolates the supplier threads from the time spent on - * upcalls to the consumer objects, making the system easier to - * analyze and schedule. - */ -class TAO_RTKokyuEvent_Export TAO_EC_Kokyu_Dispatching : public TAO_EC_Dispatching -{ -public: - /// The scheduler is used to find the range of priorities and similar - /// info. - TAO_EC_Kokyu_Dispatching (TAO_EC_Event_Channel_Base* ec, - int sched_policy, - int sched_scope); - - // = The EC_Dispatching methods. - virtual void activate (void); - virtual void shutdown (void); - virtual void push (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push_nocopy (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - -private: - ACE_Allocator *allocator_; - - void setup_lanes (void); - - /// The dispatcher - Kokyu::Dispatcher_Auto_Ptr dispatcher_; - - /// The scheduler - RtecScheduler::Scheduler_var scheduler_; - - int lanes_setup_; - int disp_sched_policy_; - int disp_sched_scope_; -}; - -// **************************************************************** - -class TAO_RTKokyuEvent_Export TAO_EC_Kokyu_Shutdown_Command : public Kokyu::Dispatch_Command -{ -public: - /// Constructor - TAO_EC_Kokyu_Shutdown_Command (ACE_Allocator *allocator); - - /// Command callback - virtual int execute (void); - -protected: - //Protected so can't be put on stack; must be dynamically allocated - virtual ~TAO_EC_Kokyu_Shutdown_Command (void); - -}; - -// **************************************************************** - -class TAO_RTKokyuEvent_Export TAO_EC_Kokyu_Push_Command : public Kokyu::Dispatch_Command -{ -public: - /// Constructor - TAO_EC_Kokyu_Push_Command (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet& event, - ACE_Allocator* allocator); - - /// Command callback - virtual int execute (void); - -protected: - //Protected so can't be put on stack; must be dynamically allocated - virtual ~TAO_EC_Kokyu_Push_Command (void); - -private: - /// The proxy - TAO_EC_ProxyPushSupplier* proxy_; - - /// The consumer connected to the proxy when the event was pushed. - RtecEventComm::PushConsumer_var consumer_; - - /// The event - RtecEventComm::EventSet event_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Kokyu_Dispatching.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* TAO_EC_KOKYU_DISPATCHING_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Dispatching.i b/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Dispatching.i deleted file mode 100644 index 0c116874fad..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Dispatching.i +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -// **************************************************************** - -ACE_INLINE -TAO_EC_Kokyu_Shutdown_Command:: -TAO_EC_Kokyu_Shutdown_Command (ACE_Allocator*) - : Kokyu::Dispatch_Command () -{ -} - -// **************************************************************** - -ACE_INLINE -TAO_EC_Kokyu_Push_Command::TAO_EC_Kokyu_Push_Command ( - TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet& event, - ACE_Allocator* allocator) - : Kokyu::Dispatch_Command (0,allocator), - proxy_ (proxy), - consumer_ (RtecEventComm::PushConsumer::_duplicate (consumer)) -{ - // - // Efficient copy, steal the buffer from <event> - // We cannot do this on the initialization because get_buffer() - // could get called first, effectively setting maximum() and - // length() to 0! - // - CORBA::ULong maximum = event.maximum (); - CORBA::ULong length = event.length (); - RtecEventComm::Event* buffer = event.get_buffer (1); - event_.replace (maximum, length, buffer, 1); - - this->proxy_->_incr_refcnt (); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Factory.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Factory.cpp deleted file mode 100644 index 2df728b8920..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Factory.cpp +++ /dev/null @@ -1,272 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Kokyu_Factory.h" -#include "orbsvcs/Event/EC_Kokyu_Dispatching.h" -#include "orbsvcs/Event/EC_Kokyu_Scheduling.h" -#include "orbsvcs/Event/EC_Kokyu_Filter_Builder.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "orbsvcs/RtecSchedulerC.h" - -#include "ace/Arg_Shifter.h" -#include "ace/Sched_Params.h" -#include "ace/OS_NS_strings.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Kokyu_Factory.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (Event, - EC_Kokyu_Factory, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Kokyu_Factory::~TAO_EC_Kokyu_Factory (void) -{ -} - -int -TAO_EC_Kokyu_Factory::init_svcs (void) -{ - return ACE_Service_Config::static_svcs ()-> - insert (&ace_svc_desc_TAO_EC_Kokyu_Factory); -} - -int -TAO_EC_Kokyu_Factory::init (int argc, ACE_TCHAR* argv[]) -{ - ACE_Arg_Shifter arg_shifter (argc, argv); - - while (arg_shifter.is_anything_left ()) - { - const ACE_TCHAR* arg = arg_shifter.get_current (); - - if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECDispatching")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("reactive")) == 0) - { - this->dispatching_ = 0; - } - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("mt")) == 0) - { - this->dispatching_ = 1; - } - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("kokyu")) == 0) - { - this->dispatching_ = 2; - } - else - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT("EC_Kokyu_Factory - ") - ACE_TEXT("unsupported dispatching <%s>\n"), - opt)); - } - arg_shifter.consume_arg (); - } - //if Kokyu dispatching - look for sched policy - if (this->dispatching_ == 2) - { - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("SCHED_FIFO")) == 0) - { - this->disp_sched_policy_ = ACE_SCHED_FIFO; - } - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("SCHED_RR")) == 0) - { - this->disp_sched_policy_ = ACE_SCHED_RR; - } - else - { - this->disp_sched_policy_ = ACE_SCHED_OTHER; - } - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("SYSTEM")) == 0) - { - this->disp_sched_scope_ = ACE_SCOPE_THREAD; - } - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("PROCESS")) == 0) - { - this->disp_sched_scope_ = ACE_SCOPE_PROCESS; - } - arg_shifter.consume_arg (); - } - } - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECFiltering")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("null")) == 0) - { - this->filtering_ = 0; - } - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("basic")) == 0) - { - this->filtering_ = 1; - } - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("prefix")) == 0) - { - this->filtering_ = 2; - } - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("kokyu")) == 0) - { - this->filtering_ = 3; - } - else - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT("EC_Kokyu_Factory - ") - ACE_TEXT("unsupported filtering <%s>\n"), - opt)); - } - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECTimeout")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("reactive")) == 0) - { - this->timeout_ = 0; - } -#if 0 - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("kokyu")) == 0) - { - this->timeout_ = 1; - } -#endif /* 0 */ - else - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT("EC_Kokyu_Factory - ") - ACE_TEXT("unsupported timeout <%s>\n"), - opt)); - } - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECScheduling")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("null")) == 0) - { - this->scheduling_ = 0; - } - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("group")) == 0) - { - this->scheduling_ = 1; - } - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("kokyu")) == 0) - { - this->scheduling_ = 2; - } - else - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT("EC_Kokyu_Factory - ") - ACE_TEXT("unsupported scheduling <%s>\n"), - opt)); - } - arg_shifter.consume_arg (); - } - } - - else - { - arg_shifter.ignore_arg (); - } - } - return this->TAO_EC_Default_Factory::init (argc, argv); -} - -int -TAO_EC_Kokyu_Factory::fini (void) -{ - return 0; -} - -// **************************************************************** - -TAO_EC_Dispatching* -TAO_EC_Kokyu_Factory::create_dispatching (TAO_EC_Event_Channel_Base *ec) -{ - if (this->dispatching_ == 2) - return new TAO_EC_Kokyu_Dispatching (ec, - this->disp_sched_policy_, - this->disp_sched_scope_); - return this->TAO_EC_Default_Factory::create_dispatching (ec); -} - -TAO_EC_Filter_Builder* -TAO_EC_Kokyu_Factory::create_filter_builder (TAO_EC_Event_Channel_Base *ec) -{ - if (this->filtering_ == 3) - return new TAO_EC_Kokyu_Filter_Builder (ec); - - return this->TAO_EC_Default_Factory::create_filter_builder (ec); -} - - -TAO_EC_Timeout_Generator* -TAO_EC_Kokyu_Factory::create_timeout_generator (TAO_EC_Event_Channel_Base *ec) -{ -#if 0 - if (this->timeout_ == 1) - { - //Kokyu timeout generator? - } -#endif - return this->TAO_EC_Default_Factory::create_timeout_generator (ec); -} - -TAO_EC_Scheduling_Strategy* -TAO_EC_Kokyu_Factory::create_scheduling_strategy (TAO_EC_Event_Channel_Base* ec) -{ - if (this->scheduling_ == 2) - { - CORBA::Object_var tmp = ec->scheduler (); - RtecScheduler::Scheduler_var scheduler = - RtecScheduler::Scheduler::_narrow (tmp.in ()); - return new TAO_EC_Kokyu_Scheduling (scheduler.in ()); - } - return this->TAO_EC_Default_Factory::create_scheduling_strategy (ec); -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -// **************************************************************** - -ACE_STATIC_SVC_DEFINE (TAO_EC_Kokyu_Factory, - ACE_TEXT ("EC_Factory"), - ACE_SVC_OBJ_T, - &ACE_SVC_NAME (TAO_EC_Kokyu_Factory), - ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, - 0) -ACE_FACTORY_DEFINE (TAO_RTKokyuEvent, TAO_EC_Kokyu_Factory) diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Factory.h b/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Factory.h deleted file mode 100644 index 4e2f413ca42..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Factory.h +++ /dev/null @@ -1,78 +0,0 @@ -// -*- C++ -*- -/** - * @file EC_Kokyu_Factory.h - * - * $Id$ - * - * @author Bryan Thrall (thrall@cs.wustl.edu) - * - * Based on previous work by Carlos O'Ryan (coryan@cs.wustl.edu), Tim - * Harrison (harrison@cs.wustl.edu), Chris Gill (cdgill@cs.wustl.edu) - * and other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_KOKYU_FACTORY_H -#define TAO_EC_KOKYU_FACTORY_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Default_Factory.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/Event/rtkokyu_event_export.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Kokyu_Factory - * - * @brief Extend the default factory to support scheduling - * - */ -class TAO_RTKokyuEvent_Export TAO_EC_Kokyu_Factory : public TAO_EC_Default_Factory -{ -public: - /// Constructor - TAO_EC_Kokyu_Factory (void); - - /// Helper function to register the Kokyu factory into the service - /// configurator. - static int init_svcs (void); - - /// destructor... - virtual ~TAO_EC_Kokyu_Factory (void); - - // = The Service_Object entry points - virtual int init (int argc, ACE_TCHAR* argv[]); - virtual int fini (void); - - // = The EC_Factory methods - virtual TAO_EC_Dispatching* - create_dispatching (TAO_EC_Event_Channel_Base*); - virtual TAO_EC_Filter_Builder* - create_filter_builder (TAO_EC_Event_Channel_Base*); - virtual TAO_EC_Timeout_Generator* - create_timeout_generator (TAO_EC_Event_Channel_Base*); - virtual TAO_EC_Scheduling_Strategy* - create_scheduling_strategy (TAO_EC_Event_Channel_Base*); - -private: - int disp_sched_policy_; - int disp_sched_scope_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Kokyu_Factory.i" -#endif /* __ACE_INLINE__ */ - -ACE_STATIC_SVC_DECLARE (TAO_EC_Kokyu_Factory) -ACE_FACTORY_DECLARE (TAO_RTKokyuEvent, TAO_EC_Kokyu_Factory) - -#include /**/ "ace/post.h" -#endif /* TAO_EC_KOKYU_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Factory.i b/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Factory.i deleted file mode 100644 index 7119373733f..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Factory.i +++ /dev/null @@ -1,15 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_Kokyu_Factory::TAO_EC_Kokyu_Factory (void) - : TAO_EC_Default_Factory (), - disp_sched_policy_ (ACE_SCHED_FIFO), - disp_sched_scope_ (ACE_SCOPE_THREAD) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Filter.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Filter.cpp deleted file mode 100644 index ab2015ea52d..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Filter.cpp +++ /dev/null @@ -1,313 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Kokyu_Filter.h" -#include "orbsvcs/Event/EC_QOS_Info.h" -#include "ace/Log_Msg.h" - -ACE_RCSID(Event, EC_Kokyu_Filter, "$Id$") - -TAO_EC_Kokyu_Filter:: - TAO_EC_Kokyu_Filter (const char* name, - RtecScheduler::handle_t rt_info, - RtecScheduler::Scheduler_ptr scheduler, - TAO_EC_Filter* body, - RtecScheduler::handle_t body_info, - RtecScheduler::handle_t parent_info, - RtecScheduler::Info_Type_t info_type) - - : rt_info_ (rt_info), - rt_info_computed_ (0), - name_ (name), - scheduler_ (RtecScheduler::Scheduler::_duplicate (scheduler)), - body_ (body), - body_info_ (body_info), - parent_info_ (parent_info), - info_type_ (info_type) -{ - this->adopt_child (this->body_); - -#if 1 //by VS -this->rt_info_computed_ = 1; -#endif -} - -TAO_EC_Kokyu_Filter::~TAO_EC_Kokyu_Filter (void) -{ - delete this->body_; -} - -TAO_EC_Filter::ChildrenIterator -TAO_EC_Kokyu_Filter::begin (void) const -{ - return this->body_->begin (); -} - -TAO_EC_Filter::ChildrenIterator -TAO_EC_Kokyu_Filter::end (void) const -{ - return this->body_->end (); -} - -int -TAO_EC_Kokyu_Filter::size (void) const -{ - return this->body_->size (); -} - -int -TAO_EC_Kokyu_Filter::filter (const RtecEventComm::EventSet &event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - return this->body_->filter (event, qos_info ACE_ENV_ARG_PARAMETER); -} - -int -TAO_EC_Kokyu_Filter::filter_nocopy (RtecEventComm::EventSet &event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - return this->body_->filter_nocopy (event, qos_info ACE_ENV_ARG_PARAMETER); -} - -// This is private, so we can make it inline in the .cpp file... -void -TAO_EC_Kokyu_Filter::compute_qos_info (TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - this->init_rt_info (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - qos_info.rt_info = this->rt_info_; - switch (this->info_type_) - { - default: - case RtecScheduler::DISJUNCTION: - break; - - case RtecScheduler::CONJUNCTION: - case RtecScheduler::OPERATION: - { - RtecScheduler::OS_Priority os_priority; - RtecScheduler::Preemption_Subpriority_t p_subpriority; - RtecScheduler::Preemption_Priority_t p_priority; - this->scheduler_->priority (this->rt_info_, - os_priority, - p_subpriority, - p_priority - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - qos_info.preemption_priority = p_priority; - } - } -} - -void -TAO_EC_Kokyu_Filter::push (const RtecEventComm::EventSet &event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - if (this->parent () != 0) - { - this->compute_qos_info (qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->parent ()->push (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } -} - -void -TAO_EC_Kokyu_Filter::push_nocopy (RtecEventComm::EventSet &event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - if (this->parent () != 0) - { - this->compute_qos_info (qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->parent ()->push_nocopy (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } -} - -void -TAO_EC_Kokyu_Filter::clear (void) -{ - this->body_->clear (); -} - -CORBA::ULong -TAO_EC_Kokyu_Filter::max_event_size (void) const -{ - return this->body_->max_event_size (); -} - -int -TAO_EC_Kokyu_Filter::can_match (const RtecEventComm::EventHeader& header) const -{ - return this->body_->can_match (header); -} - -/* - Kokyu_Filter - | - |body - | - Con/DisjunctionFilter - | - |children - |* - Kokyu_Filter - | - |body - | - Type_Filter - -The entire hierarchy will have the same rt_info as the root. Only the root -rt_info will be part of the dependency graph in the scheduler. The root -rt_info will have a dependency on the consumer rt_info. - -<--- shows dependency (oneway) - -supplier1<-----| - con/disj_rt_info<-------consumer_rt_info -supplier2<-----| -*/ - -int -TAO_EC_Kokyu_Filter::add_dependencies (const RtecEventComm::EventHeader& header, - const TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL) -{ -#ifdef EC_KOKYU_LOGGING - ACE_DEBUG ((LM_DEBUG, "Entering EC_Kokyu_Filter::add_dependencies\n")); -#endif - this->init_rt_info (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - -#ifdef EC_KOKYU_LOGGING - ACE_DEBUG ((LM_DEBUG, - "this->rt_info_ = %d, header.type = %d, qos_info.rt_info = %d\n", - this->rt_info_, header.type, qos_info.rt_info)); -#endif - - //this call the add_dependencies() on con/disjunction filter - int matches = this->body_->add_dependencies (header, - qos_info - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - if (matches != 0) - { -#ifdef EC_KOKYU_LOGGING - ACE_DEBUG ((LM_DEBUG, "Kokyu_Filter::matches != 0\n")); -#endif - this->scheduler_->add_dependency (this->rt_info_, qos_info.rt_info, 1, - RtecBase::ONE_WAY_CALL - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - RtecScheduler::RT_Info_var info = - this->scheduler_->get (qos_info.rt_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - ACE_DEBUG ((LM_DEBUG, "[%s][%d] ----> [%s][%d]\n", - this->name_.c_str (), - this->rt_info_, - info->entry_point.in (), - qos_info.rt_info)); - } - else - { -#ifdef EC_KOKYU_LOGGING - ACE_DEBUG ((LM_DEBUG, "Kokyu_Filter::matches == 0\n")); -#endif - } - -#ifdef EC_KOKYU_LOGGING - ACE_DEBUG ((LM_DEBUG, "about to iterate thru children\n")); -#endif - ChildrenIterator end = this->end (); - for (ChildrenIterator i = this->begin (); i != end; ++i) - { - (*i)->add_dependencies (header, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - } -#ifdef EC_KOKYU_LOGGING - ACE_DEBUG ((LM_DEBUG, "Exiting EC_Kokyu_Filter: add_dependencies\n")); -#endif - return 0; -} - -void -TAO_EC_Kokyu_Filter::get_qos_info (TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - this->init_rt_info (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - qos_info.rt_info = this->rt_info_; -} - -void -TAO_EC_Kokyu_Filter::init_rt_info (ACE_ENV_SINGLE_ARG_DECL) -{ - if (this->rt_info_computed_) - return; - -#if 1 //ifdef'ed from 1 to 0 by VS - - // Provide dummy values the scheduler will compute them based on the - // dependencies and the fact that this is a DISJUNCTION. - this->scheduler_->set (this->rt_info_, - RtecScheduler::VERY_LOW_CRITICALITY, - 0, // worst_cast_execution_time - 0, // typical_cast_execution_time - 0, // cached_cast_execution_time - 0, // period - RtecScheduler::VERY_LOW_IMPORTANCE, - 0, // quantum - 0, // threads - this->info_type_ - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -#endif //ifdef'ed by VS - -#if 0 //ifdef changed from 1 to 0 by VS - if (this->body_info_ != this->rt_info_) - { - this->scheduler_->add_dependency (this->rt_info_, - this->body_info_, - 1, - RtecBase::TWO_WAY_CALL - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - RtecScheduler::RT_Info_var info = - this->scheduler_->get (this->body_info_ ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - ACE_DEBUG ((LM_DEBUG, "[%s] ----> [%s]\n", - info->entry_point.in (), - this->name_.c_str ())); - } -#endif /* 0 */ - -#if 0 //ifdef changed from 1 to 0 by VS - this->scheduler_->add_dependency (this->parent_info_, - this->rt_info_, - 1, - RtecBase::TWO_WAY_CALL - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - RtecScheduler::RT_Info_var info = - this->scheduler_->get (this->parent_info_ ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - ACE_DEBUG ((LM_DEBUG, "[%s] ----> [%s]\n", - this->name_.c_str (), - info->entry_point.in ())); -#endif /* 0 */ - - this->rt_info_computed_ = 1; -} diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Filter.h b/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Filter.h deleted file mode 100644 index 09f521997d4..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Filter.h +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- C++ -*- */ -/** - * @file EC_Kokyu_Filter.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_KOKYU_FILTER_H -#define TAO_EC_KOKYU_FILTER_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Filter.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/RtecSchedulerC.h" -#include "orbsvcs/Event/rtkokyu_event_export.h" -#include "ace/SString.h" - -//#define EC_KOKYU_LOGGING - -/** - * @class TAO_EC_Kokyu_Filter - * - * @brief Decorate a filter with scheduling information - * - * This filter decorates a regular filter with scheduling - * information. It creates a new RT_Info entry for the filter and - * it adds the dependencies between the filter and any childrens - * it may have. - * - * <H2>Memory Management</H2> - * It assumes ownership of the children. - */ -class TAO_RTKokyuEvent_Export TAO_EC_Kokyu_Filter : public TAO_EC_Filter -{ -public: - /** - * Constructor. - * It assumes ownership of the @a body, makes a copy of the other - * parameters - */ - TAO_EC_Kokyu_Filter (const char* name, - RtecScheduler::handle_t rt_info, - RtecScheduler::Scheduler_ptr scheduler, - TAO_EC_Filter* body, - RtecScheduler::handle_t body_info, - RtecScheduler::handle_t parent_info, - RtecScheduler::Info_Type_t info_type); - - /// Destructor - virtual ~TAO_EC_Kokyu_Filter (void); - - // = The TAO_EC_Filter methods, please check the documentation in - // TAO_EC_Filter. - virtual ChildrenIterator begin (void) const; - virtual ChildrenIterator end (void) const; - virtual int size (void) const; - virtual int filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual int filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void clear (void); - virtual CORBA::ULong max_event_size (void) const; - virtual int can_match (const RtecEventComm::EventHeader& header) const; - virtual int add_dependencies (const RtecEventComm::EventHeader& header, - const TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL); - virtual void get_qos_info (TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - -private: - TAO_EC_Kokyu_Filter (const TAO_EC_Kokyu_Filter&); - TAO_EC_Kokyu_Filter& operator= (const TAO_EC_Kokyu_Filter&); - - /// Initialize our RT_Info handle and dependencies - void init_rt_info (ACE_ENV_SINGLE_ARG_DECL); - - /// Compute a new qos_info to push up. - void compute_qos_info (TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - -private: - /// The RT_Info handle for this object - RtecScheduler::handle_t rt_info_; - - /// Has the Scheduler been updated? - int rt_info_computed_; - - /// Our operation name - ACE_CString name_; - - /// The scheduler we are going to use - RtecScheduler::Scheduler_var scheduler_; - - /// The implementation - TAO_EC_Filter* body_; - - /// The RT_Info handle for the body - RtecScheduler::handle_t body_info_; - - /// The RT_Info handle for the parent - RtecScheduler::handle_t parent_info_; - - /// Required for the scheduling service - RtecScheduler::Info_Type_t info_type_; -}; - -#include /**/ "ace/post.h" -#endif /* TAO_EC_KOKYU_FILTER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Filter_Builder.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Filter_Builder.cpp deleted file mode 100644 index a522ce4d5ac..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Filter_Builder.cpp +++ /dev/null @@ -1,513 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Kokyu_Filter.h" -#include "orbsvcs/Event_Service_Constants.h" -#include "orbsvcs/Event/EC_Kokyu_Filter_Builder.h" -#include "orbsvcs/Event/EC_Type_Filter.h" -#include "orbsvcs/Event/EC_Conjunction_Filter.h" -#include "orbsvcs/Event/EC_Disjunction_Filter.h" -#include "orbsvcs/Event/EC_Timeout_Filter.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "ace/OS_NS_stdio.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Kokyu_Filter_Builder.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (Event, - EC_Kokyu_Filter_Builder, - "$Id$") - -const char* designator (long dsgn) -{ - switch(dsgn) - { - case ACE_ES_GLOBAL_DESIGNATOR: return "GLOBAL"; - case ACE_ES_CONJUNCTION_DESIGNATOR: return "CONJ"; - case ACE_ES_DISJUNCTION_DESIGNATOR: return "DISJ"; - case ACE_ES_NEGATION_DESIGNATOR: return "NEG"; - case ACE_ES_LOGICAL_AND_DESIGNATOR: return "LOG_AND"; - case ACE_ES_BITMASK_DESIGNATOR: return "BITMASK"; - case ACE_ES_MASKED_TYPE_DESIGNATOR: return "MASKED_TYPE"; - case ACE_ES_NULL_DESIGNATOR: return "NULL"; - } - - return "---"; -} - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Kokyu_Filter_Builder::~TAO_EC_Kokyu_Filter_Builder (void) -{ -} - -TAO_EC_Filter* -TAO_EC_Kokyu_Filter_Builder::build ( - TAO_EC_ProxyPushSupplier *supplier, - RtecEventChannelAdmin::ConsumerQOS& qos - ACE_ENV_ARG_DECL) const -{ - CORBA::ULong i=0,found=0; - CORBA::ULong pos = 0; - CORBA::Long npos = -1; - int establish_final_consumer_dependency=0; - - CORBA::Object_var tmp = - this->event_channel_->scheduler (); - - RtecScheduler::Scheduler_var scheduler = - RtecScheduler::Scheduler::_narrow (tmp.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - -#ifdef EC_KOKYU_LOGGING - for (i=0; i<qos.dependencies.length (); ++i) - { - ACE_DEBUG ((LM_DEBUG, - "consumerqos[%d] event.header.type = %s," - "rt_info = %d\n", - i, - designator (qos.dependencies[i].event.header.type), - qos.dependencies[i].rt_info)); - } -#endif - - //find the first entry which is not a designator. We are going to - //assume that this entry will have the rt_info of the connecting - //consumer (ProxyPushSupplier), which is passed into this function. - for (i=0; !found && i<qos.dependencies.length (); ++i) - { - switch (qos.dependencies[i].event.header.type) - { - case ACE_ES_CONJUNCTION_DESIGNATOR: - case ACE_ES_DISJUNCTION_DESIGNATOR: - case ACE_ES_NEGATION_DESIGNATOR: - case ACE_ES_LOGICAL_AND_DESIGNATOR: - case ACE_ES_BITMASK_DESIGNATOR: - case ACE_ES_MASKED_TYPE_DESIGNATOR: - case ACE_ES_NULL_DESIGNATOR: - establish_final_consumer_dependency = 1; - continue; - - case ACE_ES_GLOBAL_DESIGNATOR: - case ACE_ES_EVENT_TIMEOUT: - case ACE_ES_EVENT_INTERVAL_TIMEOUT: - case ACE_ES_EVENT_DEADLINE_TIMEOUT: - continue; - - default: - npos = i; - found = 1; - break; - } - } - - ACE_CString final_consumer_rep_name; - RtecScheduler::handle_t h_final_consumer_rt_info = 0; - RtecScheduler::handle_t h_final_consumer_rep_rt_info = 0; - -#ifdef EC_KOKYU_LOGGING - ACE_DEBUG ((LM_DEBUG, "consumer rt_info found in consumerqos[%d] \n", npos)); -#endif - - if (npos >= 0 && establish_final_consumer_dependency == 1) - { - //Hopefully this will have the final consumer's rt_info - h_final_consumer_rt_info = qos.dependencies[npos].rt_info; - -#ifdef EC_KOKYU_LOGGING - ACE_DEBUG ((LM_DEBUG, "about to get rt_info = %d\n", - h_final_consumer_rep_rt_info)); -#endif - - RtecScheduler::RT_Info_var final_consumer_rt_info = - scheduler->get ( h_final_consumer_rt_info - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - final_consumer_rep_name = final_consumer_rt_info->entry_point.in (); - final_consumer_rep_name += "#rep"; - -#ifdef EC_KOKYU_LOGGING - ACE_DEBUG ((LM_DEBUG, "about to create consumer rep %s\n", - final_consumer_rep_name.c_str ())); -#endif - - //create an rt_info corresponding to this rep. - h_final_consumer_rep_rt_info = - scheduler->create (final_consumer_rep_name.c_str () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); -#ifdef EC_KOKYU_LOGGING - ACE_DEBUG ((LM_DEBUG, "consumer rep created\n")); -#endif - - } - - //We are passing the final consumer as the parent. The final - //consumer is the one which is connecting to the ProxyPushSupplier - //passed in to this function. - - TAO_EC_Filter* filter = - this->recursive_build (supplier, qos, pos, - scheduler.in (), - h_final_consumer_rep_rt_info //parent_info - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - -#ifdef EC_KOKYU_LOGGING - ACE_DEBUG ((LM_DEBUG, - "Filter_Builder::Verifying whether root filter" - " dependency can be established\n")); -#endif - - if (npos >= 0 && establish_final_consumer_dependency == 1) - { -#ifdef EC_KOKYU_LOGGING - ACE_DEBUG ((LM_DEBUG, - "Filter_Builder::root filter dependency " - "can be established\n")); -#endif - TAO_EC_Kokyu_Filter* kokyu_filter = - dynamic_cast<TAO_EC_Kokyu_Filter*> (filter); - - //add the dependency between the root in the filter hierarchy and - //the final consumer - TAO_EC_QOS_Info qos_info; - kokyu_filter->get_qos_info (qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - scheduler->add_dependency (h_final_consumer_rt_info, - qos_info.rt_info, - 1, - RtecBase::ONE_WAY_CALL - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - } - return filter; -} - -TAO_EC_Filter* -TAO_EC_Kokyu_Filter_Builder::recursive_build ( - TAO_EC_ProxyPushSupplier *supplier, - RtecEventChannelAdmin::ConsumerQOS& qos, - CORBA::ULong& pos, - RtecScheduler::Scheduler_ptr scheduler, - RtecScheduler::handle_t parent_info - ACE_ENV_ARG_DECL) const -{ - const RtecEventComm::Event& e = qos.dependencies[pos].event; - -#ifdef EC_KOKYU_LOGGING - ACE_DEBUG ((LM_DEBUG, "Filter_Builder::In recursive build\n")); -#endif - - if (e.header.type == ACE_ES_CONJUNCTION_DESIGNATOR) - { -#ifdef EC_KOKYU_LOGGING - ACE_DEBUG ((LM_DEBUG, "Filter_Builder::Conjuction designator\n")); -#endif - CORBA::ULong npos = pos; - ACE_CString name; - this->recursive_name (qos, npos, - scheduler, name - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - pos++; // Consume the designator - - CORBA::ULong n = this->count_children (qos, pos); - - RtecBase::handle_t conj_rt_info = parent_info; - - TAO_EC_Filter** children; - ACE_NEW_RETURN (children, TAO_EC_Filter*[n], 0); - for (CORBA::ULong i = 0; i != n; ++i) - { - children[i] = this->recursive_build (supplier, qos, pos, - scheduler, - conj_rt_info - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - } - - TAO_EC_Kokyu_Filter *filter; - ACE_NEW_RETURN (filter, - TAO_EC_Kokyu_Filter (name.c_str (), - conj_rt_info, - scheduler, - new TAO_EC_Conjunction_Filter(children, - n), - conj_rt_info, - conj_rt_info, - RtecScheduler::CONJUNCTION), - 0); - TAO_EC_QOS_Info qos_info; - filter->get_qos_info (qos_info ACE_ENV_ARG_PARAMETER); - // @@ - ACE_CHECK_RETURN (0); - return filter; - } - - else if (e.header.type == ACE_ES_DISJUNCTION_DESIGNATOR) - { -#ifdef EC_KOKYU_LOGGING - ACE_DEBUG ((LM_DEBUG, "Filter_Builder::Disjunction designator\n")); -#endif - CORBA::ULong npos = pos; - ACE_CString name; - this->recursive_name (qos, npos, - scheduler, name - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - pos++; // Consume the designator - - RtecBase::handle_t disj_rt_info = parent_info; - - CORBA::ULong n = this->count_children (qos, pos); - - TAO_EC_Filter** children; - ACE_NEW_RETURN (children, TAO_EC_Filter*[n], 0); - for (CORBA::ULong i = 0; i != n; ++i) - { - children[i] = this->recursive_build (supplier, qos, pos, - scheduler, - disj_rt_info - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - } - TAO_EC_Kokyu_Filter *filter; - ACE_NEW_RETURN (filter, - TAO_EC_Kokyu_Filter (name.c_str (), - disj_rt_info, - scheduler, - new TAO_EC_Disjunction_Filter (children, - n), - disj_rt_info, - disj_rt_info, - RtecScheduler::DISJUNCTION), - 0); - - TAO_EC_QOS_Info qos_info; - filter->get_qos_info (qos_info ACE_ENV_ARG_PARAMETER); - // @@ - ACE_CHECK_RETURN (0); - return filter; - } - else if (e.header.type == ACE_ES_EVENT_TIMEOUT - || e.header.type == ACE_ES_EVENT_INTERVAL_TIMEOUT - || e.header.type == ACE_ES_EVENT_DEADLINE_TIMEOUT) - { -#ifdef EC_KOKYU_LOGGING - ACE_DEBUG ((LM_DEBUG, "Filter_Builder::Timeout designator\n")); -#endif - // @@ We need a unique name for each timeout, assigned by the - // application? - char buf[64]; - - //get the rt_info for the timer consumer - RtecBase::handle_t h_consumer_rt_info = qos.dependencies[pos].rt_info; - - //build a unique name using the cosumer_rt_info - ACE_OS::sprintf (buf, "TIMEOUT:%umsec:%d", - static_cast<u_int> ((e.header.creation_time / 10000)), - h_consumer_rt_info); - ACE_CString name = buf; - - TAO_EC_QOS_Info qos_info; - qos_info.rt_info = - scheduler->create (name.c_str () ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - // Convert the time to the proper units.... - RtecScheduler::Period_t period = - static_cast<RtecScheduler::Period_t> (e.header.creation_time); - -#if 1 //by VS original code replaced with this - RtecScheduler::RT_Info* consumer_rt_info_ptr; - - consumer_rt_info_ptr = scheduler->get (h_consumer_rt_info); - scheduler->set (qos_info.rt_info, - consumer_rt_info_ptr->criticality, - 0, // worst_cast_execution_time - 0, // typical_cast_execution_time - 0, // cached_cast_execution_time - period, - consumer_rt_info_ptr->importance, - 0, // quantum - 1, // threads - RtecScheduler::OPERATION - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - scheduler->add_dependency (qos_info.rt_info, - h_consumer_rt_info, - 1, - RtecBase::TWO_WAY_CALL - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); -#endif //by VS - - pos++; - return new TAO_EC_Timeout_Filter (this->event_channel_, - supplier, - qos_info, - e.header.type, - e.header.creation_time); - } - -#if 1 //added by VS - else if (e.header.type == ACE_ES_GLOBAL_DESIGNATOR) - { - pos++; - return this->recursive_build (supplier, qos, pos, - scheduler, - parent_info - ACE_ENV_ARG_PARAMETER); - } - else - { -#ifdef EC_KOKYU_LOGGING - ACE_DEBUG ((LM_DEBUG, - "Kokyu_Filter_Builder::No designator for this entry. " - "Must be a body\n")); -#endif - } -#endif - - //probably because of a global designator, the parent_info could be 0. - if (parent_info == 0) - { - //In this case, the parent_info is the same as the one supplied - //in the consumer qos. - parent_info = qos.dependencies[pos].rt_info; - } - - RtecScheduler::RT_Info_var info = - scheduler->get (parent_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - ACE_CString name = info->entry_point.in (); - - pos++; - TAO_EC_Kokyu_Filter *filter; - ACE_NEW_RETURN (filter, - TAO_EC_Kokyu_Filter (name.c_str (), - parent_info, - scheduler, - new TAO_EC_Type_Filter (e.header), - parent_info, - parent_info, - RtecScheduler::OPERATION), - 0); - - TAO_EC_QOS_Info qos_info; - filter->get_qos_info (qos_info ACE_ENV_ARG_PARAMETER); - // @@ - ACE_CHECK_RETURN (0); - return filter; -} - -void -TAO_EC_Kokyu_Filter_Builder:: recursive_name ( - RtecEventChannelAdmin::ConsumerQOS& qos, - CORBA::ULong& pos, - RtecScheduler::Scheduler_ptr scheduler, - ACE_CString& name - ACE_ENV_ARG_DECL) const -{ - const RtecEventComm::Event& e = qos.dependencies[pos].event; - - if (e.header.type == ACE_ES_CONJUNCTION_DESIGNATOR) - { - pos++; // Consume the designator - CORBA::ULong n = this->count_children (qos, pos); - - for (CORBA::ULong i = 0; i != n; ++i) - { - ACE_CString child_name; - this->recursive_name (qos, pos, - scheduler, - child_name - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (i == 0) - name += "("; - else - name += "&&"; - name += child_name; - } - name += ")"; - return; - } - - else if (e.header.type == ACE_ES_DISJUNCTION_DESIGNATOR) - { - pos++; // Consume the designator - CORBA::ULong n = this->count_children (qos, pos); - - for (CORBA::ULong i = 0; i != n; ++i) - { - ACE_CString child_name; - - this->recursive_name (qos, pos, - scheduler, - child_name - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (i == 0) - name += "("; - else - name += "||"; - name += child_name; - } - name += ")"; - return; - } - - else if (e.header.type == ACE_ES_EVENT_TIMEOUT - || e.header.type == ACE_ES_EVENT_INTERVAL_TIMEOUT - || e.header.type == ACE_ES_EVENT_DEADLINE_TIMEOUT) - { - pos++; - - char buf[64]; - ACE_OS::sprintf (buf, "TIMEOUT:%umsec", - static_cast<u_int> ((e.header.creation_time / 10000))); - name = buf; - - return; - } - - RtecScheduler::handle_t body_info = qos.dependencies[pos].rt_info; - - RtecScheduler::RT_Info_var info = - scheduler->get (body_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - name = info->entry_point.in (); - name += "#rep"; - - pos++; -} - -CORBA::ULong -TAO_EC_Kokyu_Filter_Builder:: - count_children (RtecEventChannelAdmin::ConsumerQOS& qos, - CORBA::ULong pos) const -{ - CORBA::ULong l = qos.dependencies.length (); - CORBA::ULong i; - for (i = pos; i != l; ++i) - { - const RtecEventComm::Event& e = qos.dependencies[i].event; - if (e.header.type == ACE_ES_CONJUNCTION_DESIGNATOR - || e.header.type == ACE_ES_DISJUNCTION_DESIGNATOR) - break; - } - return i - 1; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Filter_Builder.h b/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Filter_Builder.h deleted file mode 100644 index 83ac33a6456..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Filter_Builder.h +++ /dev/null @@ -1,89 +0,0 @@ -// -*- C++ -*- -/** - * @file EC_Kokyu_Filter_Builder.h - * - * $Id$ - * - * @author Bryan Thrall (thrall@cs.wustl.edu) - * - * Based on previous work by Carlos O'Ryan (coryan@cs.wustl.edu) and - * Tim Harrison (harrison@cs.wustl.edu) and other members of the DOC group. - * More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_KOKYU_FILTER_BUILDER_H -#define TAO_EC_KOKYU_FILTER_BUILDER_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Filter_Builder.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/Event/rtkokyu_event_export.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Filter; -class TAO_EC_Event_Channel_Base; - -/** - * @class TAO_EC_Kokyu_Filter_Builder - * - * @brief Implement a builder for the fundamental filters. - * - * The sched filtering mechanisms in the Event channel - * (source/type based filtering + disjunctions and conjunctions) - * are constructed using this class. - */ -class TAO_RTKokyuEvent_Export TAO_EC_Kokyu_Filter_Builder : public TAO_EC_Filter_Builder -{ -public: - /// constructor. - TAO_EC_Kokyu_Filter_Builder (TAO_EC_Event_Channel_Base* ec); - - /// destructor... - virtual ~TAO_EC_Kokyu_Filter_Builder (void); - - // = The TAO_EC_Filter_Builder methods... - TAO_EC_Filter* build (TAO_EC_ProxyPushSupplier *supplier, - RtecEventChannelAdmin::ConsumerQOS& qos - ACE_ENV_ARG_DECL) const; - -private: - /// Recursively build the filter tree. - TAO_EC_Filter* recursive_build (TAO_EC_ProxyPushSupplier *supplier, - RtecEventChannelAdmin::ConsumerQOS& qos, - CORBA::ULong& pos, - RtecScheduler::Scheduler_ptr scheduler, - RtecScheduler::handle_t parent_info - ACE_ENV_ARG_DECL) const; - - /// Build the name recursively... - void recursive_name (RtecEventChannelAdmin::ConsumerQOS& qos, - CORBA::ULong& pos, - RtecScheduler::Scheduler_ptr scheduler, - ACE_CString &name - ACE_ENV_ARG_DECL) const; - - /// Count the number of children of the current node, i.e. until a - /// conjunction or disjunction starts. - CORBA::ULong count_children (RtecEventChannelAdmin::ConsumerQOS& qos, - CORBA::ULong pos) const; - -private: - /// The event channel. - TAO_EC_Event_Channel_Base* event_channel_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Kokyu_Filter_Builder.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* TAO_EC_KOKYU_FILTER_BUILDER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Filter_Builder.i b/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Filter_Builder.i deleted file mode 100644 index 8e0cd624a7e..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Filter_Builder.i +++ /dev/null @@ -1,15 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_Kokyu_Filter_Builder:: - TAO_EC_Kokyu_Filter_Builder (TAO_EC_Event_Channel_Base *ec) - : event_channel_ (ec) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Scheduling.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Scheduling.cpp deleted file mode 100644 index 979cd0913fa..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Scheduling.cpp +++ /dev/null @@ -1,99 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Kokyu_Scheduling.h" -#include "orbsvcs/Event/EC_QOS_Info.h" -#include "orbsvcs/Event/EC_ProxyConsumer.h" -#include "orbsvcs/Event/EC_ProxySupplier.h" -#include "orbsvcs/Event/EC_Supplier_Filter.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Kokyu_Scheduling.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, EC_Kokyu_Scheduling, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Kokyu_Scheduling::~TAO_EC_Kokyu_Scheduling (void) -{ -} - -void -TAO_EC_Kokyu_Scheduling::add_proxy_supplier_dependencies ( - TAO_EC_ProxyPushSupplier *supplier, - TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL) -{ - const RtecEventChannelAdmin::SupplierQOS& qos = - consumer->publications (); - - for (CORBA::ULong i = 0; i < qos.publications.length (); ++i) - { - const RtecEventComm::EventHeader &header = - qos.publications[i].event.header; - TAO_EC_QOS_Info qos_info; - qos_info.rt_info = qos.publications[i].dependency_info.rt_info; - - RtecScheduler::OS_Priority os_priority; - RtecScheduler::Preemption_Subpriority_t p_subpriority; - RtecScheduler::Preemption_Priority_t p_priority; - this->scheduler_->priority (qos_info.rt_info, - os_priority, - p_subpriority, - p_priority - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - qos_info.preemption_priority = p_priority; - - supplier->add_dependencies (header, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } -} - -void -TAO_EC_Kokyu_Scheduling::schedule_event (const RtecEventComm::EventSet &event, - TAO_EC_ProxyPushConsumer *consumer, - TAO_EC_Supplier_Filter *filter - ACE_ENV_ARG_DECL) -{ - RtecEventChannelAdmin::SupplierQOS qos = - consumer->publications (); - - for (CORBA::ULong j = 0; j != event.length (); ++j) - { - const RtecEventComm::Event& e = event[j]; - RtecEventComm::Event* buffer = - const_cast<RtecEventComm::Event*> (&e); - RtecEventComm::EventSet single_event (1, 1, buffer, 0); - - TAO_EC_QOS_Info qos_info; - - for (CORBA::ULong i = 0; i != qos.publications.length (); ++i) - { - const RtecEventComm::EventHeader &qos_header = - qos.publications[i].event.header; - - if (TAO_EC_Filter::matches (e.header, qos_header) == 0) - continue; - - qos_info.rt_info = qos.publications[i].dependency_info.rt_info; - - RtecScheduler::OS_Priority os_priority; - RtecScheduler::Preemption_Subpriority_t p_subpriority; - RtecScheduler::Preemption_Priority_t p_priority; - this->scheduler_->priority (qos_info.rt_info, - os_priority, - p_subpriority, - p_priority - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - qos_info.preemption_priority = p_priority; - } - - filter->push_scheduled_event (single_event, qos_info - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Scheduling.h b/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Scheduling.h deleted file mode 100644 index 105241d217a..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Scheduling.h +++ /dev/null @@ -1,77 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Kokyu_Scheduling.h - * - * $Id$ - * - * @author Bryan Thrall (thrall@cs.wustl.edu) - * - * Based on previous work by Carlos O'Ryan (coryan@cs.wustl.edu) and - * Tim Harrison (harrison@cs.wustl.edu) and other members of the DOC group. - * More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_KOKYU_SCHEDULING_H -#define TAO_EC_KOKYU_SCHEDULING_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Scheduling_Strategy.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/RtecSchedulerC.h" -#include "orbsvcs/Event/rtkokyu_event_export.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Kokyu_Scheduling - * - * @brief A scheduling strategy that uses TAO's real-time scheduler - * - * This implementation of the Scheduling_Strategy uses TAO's - * real-time scheduler. - */ -class TAO_RTKokyuEvent_Export TAO_EC_Kokyu_Scheduling : public TAO_EC_Scheduling_Strategy -{ -public: - /// Constructor. - TAO_EC_Kokyu_Scheduling (RtecScheduler::Scheduler_ptr scheduler); - - /// Destructor - virtual ~TAO_EC_Kokyu_Scheduling (void); - - virtual void add_proxy_supplier_dependencies ( - TAO_EC_ProxyPushSupplier *supplier, - TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL); - virtual void schedule_event (const RtecEventComm::EventSet &event, - TAO_EC_ProxyPushConsumer *consumer, - TAO_EC_Supplier_Filter *filter - ACE_ENV_ARG_DECL); - -private: - TAO_EC_Kokyu_Scheduling (const TAO_EC_Kokyu_Scheduling&); - TAO_EC_Kokyu_Scheduling& operator= (const TAO_EC_Kokyu_Scheduling&); - - /// Initialize our RT_Info handle and dependencies - void init_rt_info (ACE_ENV_SINGLE_ARG_DECL); - -private: - /// The scheduler we are going to use - RtecScheduler::Scheduler_var scheduler_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Kokyu_Scheduling.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* TAO_EC_KOKYU_SCHEDULING_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Scheduling.i b/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Scheduling.i deleted file mode 100644 index 1afeb35fa05..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Scheduling.i +++ /dev/null @@ -1,14 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_Kokyu_Scheduling::TAO_EC_Kokyu_Scheduling ( - RtecScheduler::Scheduler_ptr scheduler) - : scheduler_ (RtecScheduler::Scheduler::_duplicate (scheduler)) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Lifetime_Utils.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Lifetime_Utils.cpp deleted file mode 100644 index 9750da7a5d7..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Lifetime_Utils.cpp +++ /dev/null @@ -1,7 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Lifetime_Utils.h" - -#if !defined(__ACE_INLINE__) -#include "orbsvcs/Event/EC_Lifetime_Utils.i" -#endif /* __ACE_INLINE__ */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Lifetime_Utils.h b/TAO/orbsvcs/orbsvcs/Event/EC_Lifetime_Utils.h deleted file mode 100644 index d34ce3ab484..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Lifetime_Utils.h +++ /dev/null @@ -1,217 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Lifetime_Utils.h - * - * $Id$ - * - * @author Jody Hagins (jody@atdesk.com) - * @author Marina Spivak (marina@atdesk.com) - * - * This file is a temporary place for general CORBA application - * utility classes. These classes will be moved out from the EC - * library and into TAO or will be replaced by other TAO classes with - * similar functionality. - */ - -#ifndef TAO_EC_LIFETIME_UTILS_H -#define TAO_EC_LIFETIME_UTILS_H -#include /**/ "ace/pre.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" -#include "orbsvcs/RtecEventChannelAdminC.h" -#include "tao/PortableServer/PortableServer.h" -#include "tao/ORB.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Object_Deactivator - * - * @brief Utility for deactivating servants from POA. - * - * Maintains state necessary to deactivate a servant from POA. - * Can be told to deactivate a servant explicitly or can do so - * automagically, in its destructor. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Object_Deactivator -{ -public: - /// Default constructor. Deactivation info can be supplied later - /// through set_values (). - TAO_EC_Object_Deactivator (void); - - /// Constructor. Set @a id which will be deactivated from @ poa in - /// the deactivator's destructor, unless deactivate () or - /// disallow_deactivation () are invoked before the destruction. - TAO_EC_Object_Deactivator (PortableServer::POA_ptr poa, - PortableServer::ObjectId const & id); - - /// Destructor. Deactivates id_ from poa_ if those values have - /// been set, and neither deactivate() nor disallow_deactivation() - /// have been invoked. - ~TAO_EC_Object_Deactivator (void); - - /// Set <id> which will be deactivated from <poa> in - /// the deactivator's destructor, unless deactivate () or - /// disallow_deactivation () are invoked before the destruction. - void set_values (PortableServer::POA_ptr poa, - PortableServer::ObjectId const & id); - - /// Take on the state of @a deactivator. @a deactivator loses its state. - void set_values (TAO_EC_Object_Deactivator & deactivator); - - /// Explicitly enable deactivation to happen in destructor or when - /// deactivate() is called. - void allow_deactivation (void); - - /// Explicitly disable deactivation from happening in destructor or - /// when deactivate() is called. - void disallow_deactivation (void); - - /// Perform deactivation now if <poa_> and <id_> values have been set, and - /// deactivation hasn't happened yet nor has it been explicitly - /// disallowed. CORBA exceptions occurring during deactivation are - /// not propagated. Deactivation will NOT happen in the destructor. - void deactivate (void); - - /// Accessor for the POA used in deactivation. - PortableServer::POA_var poa (void) const; - -private: - - /// Disallow. - //@{ - TAO_EC_Object_Deactivator (const TAO_EC_Object_Deactivator &rhs); - TAO_EC_Object_Deactivator& operator= (const TAO_EC_Object_Deactivator &rhs); - //@} - - /// POA from which the object will be deactivated. - PortableServer::POA_var poa_; - - /// ObjectId of the object to be deactivated. - PortableServer::ObjectId id_; - - /// Flag indicating whether deactivation will be attempted. - /// The flag is set to false if <poa_> and <id_> haven't been set - /// yet, or if deactivation already happened, or if - /// disallow_deactivation () method is invoked. - int deactivate_; -}; - -//*************************************************************************** - -/** - * @class TAO_EC_Deactivated_Object - * - * @brief Object deactivation utility (mix-in) class. - * - * Maintains state necessary to deactivate object inheriting from this - * class from POA. The state can be set using set_deactivator() - * method. Then, the object can deactivate itself by doing - * this->deactivator_.deactivate () - * - * NOTE: deactivation does NOT happen automatically, and must be - * explicitly initiated as described above. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Deactivated_Object -{ -public: - - /// Set deactivation state to that specified by the @a deactivator - /// argument. - void set_deactivator (TAO_EC_Object_Deactivator & deactivator); - -protected: - - TAO_EC_Deactivated_Object (void); - ~TAO_EC_Deactivated_Object (void); - - /// Utility for deactivating ourselves from POA. - TAO_EC_Object_Deactivator deactivator_; -}; - -//*************************************************************************** - -/** - * @class TAO_EC_ORB_Holder - * - * @brief Utility for automatically destroying the ORB. - * - * Holds a reference to an ORB, and calls destroy() on it in the - * destructor. - */ -class TAO_RTEvent_Serv_Export TAO_EC_ORB_Holder -{ -public: - /// Constructor. No-op. - TAO_EC_ORB_Holder (void); - - /// Destructor. If holding an ORB, destroy it. - ~TAO_EC_ORB_Holder (void); - - /// Set the ORB to be destroyed in destructor to <orb_var>. If - /// TAO_EC_ORB_Holder already held an orb prior to invocation of - /// this method, that orb is NOT destroyed. - void init (CORBA::ORB_var orb_var); - -private: - - /// Disallow. - //@{ - TAO_EC_ORB_Holder & operator= (const TAO_EC_ORB_Holder &rhs); - TAO_EC_ORB_Holder(const TAO_EC_ORB_Holder &rhs); - //@} - - /// ORB to be destroyed. - CORBA::ORB_var orb_; -}; - -//*************************************************************************** - -/** - * @class TAO_EC_Event_Channel_Holder - * - * @brief Utility for automatically destroying the Event Channel. - * - * Holds a reference to an Event Channel, and calls destroy() on it in the - * destructor. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Event_Channel_Holder -{ -public: - /// Constructor. No-op. - TAO_EC_Event_Channel_Holder (void); - - /// Destructor. If holding an Event Channel, destroy it. - ~TAO_EC_Event_Channel_Holder (void); - - /// Set the Event Channel to be destroyed in destructor to @a ec_var. If - /// TAO_EC_Event_Channel_Holder already held an Event Channel prior - /// to invocation of this method, that Event Channel is NOT destroyed. - void init (RtecEventChannelAdmin::EventChannel_var ec_var); - -private: - - /// Disallow. - //@{ - TAO_EC_Event_Channel_Holder & operator= (const TAO_EC_Event_Channel_Holder &rhs); - TAO_EC_Event_Channel_Holder(const TAO_EC_Event_Channel_Holder &rhs); - //@} - - /// EC to be destroyed. - RtecEventChannelAdmin::EventChannel_var ec_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Lifetime_Utils.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* TAO_EC_LIFETIME_UTILS_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Lifetime_Utils.i b/TAO/orbsvcs/orbsvcs/Event/EC_Lifetime_Utils.i deleted file mode 100644 index 2884f04108d..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Lifetime_Utils.i +++ /dev/null @@ -1,179 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_Object_Deactivator::TAO_EC_Object_Deactivator (void) - : poa_ () - , id_ () - , deactivate_ (0) -{ -} - -ACE_INLINE -TAO_EC_Object_Deactivator::TAO_EC_Object_Deactivator ( - PortableServer::POA_ptr poa, - PortableServer::ObjectId const & id) - : poa_ (PortableServer::POA::_duplicate (poa)) - , id_ (id) - , deactivate_ (1) -{ -} - -ACE_INLINE void -TAO_EC_Object_Deactivator::deactivate (void) -{ - if (this->deactivate_ && !CORBA::is_nil (this->poa_.in ())) - { - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - this->deactivate_ = 0; - this->poa_->deactivate_object (id_ ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // The deactivation can throw... - } - ACE_ENDTRY; - } -} - -ACE_INLINE -TAO_EC_Object_Deactivator::~TAO_EC_Object_Deactivator (void) -{ - this->deactivate (); -} - -ACE_INLINE PortableServer::POA_var -TAO_EC_Object_Deactivator::poa (void) const -{ - return this->poa_; -} - -ACE_INLINE void -TAO_EC_Object_Deactivator::allow_deactivation (void) -{ - this->deactivate_ = 1; -} - -ACE_INLINE void -TAO_EC_Object_Deactivator::disallow_deactivation (void) -{ - this->deactivate_ = 0; -} - -ACE_INLINE void -TAO_EC_Object_Deactivator::set_values (PortableServer::POA_ptr poa, - PortableServer::ObjectId const & id) -{ - this->poa_ = PortableServer::POA::_duplicate (poa); - this->id_ = id; - this->deactivate_ = 1; -} - -ACE_INLINE void -TAO_EC_Object_Deactivator::set_values (TAO_EC_Object_Deactivator & deactivator) -{ - if (this == &deactivator) - return; - - this->poa_ = deactivator.poa_._retn (); - this->id_ = deactivator.id_; - this->deactivate_ = deactivator.deactivate_; - deactivator.deactivate_ = 0; -} - -// **************************************************************** - -ACE_INLINE -TAO_EC_Deactivated_Object::TAO_EC_Deactivated_Object (void) - : deactivator_ () -{ -} - -ACE_INLINE -TAO_EC_Deactivated_Object::~TAO_EC_Deactivated_Object (void) -{ - // Prevent automatic deactivation in deactivator's destructor. - this->deactivator_.disallow_deactivation (); -} - -ACE_INLINE void -TAO_EC_Deactivated_Object::set_deactivator ( - TAO_EC_Object_Deactivator & deactivator) -{ - this->deactivator_.set_values (deactivator); -} - -// **************************************************************** - -ACE_INLINE -TAO_EC_ORB_Holder::TAO_EC_ORB_Holder (void) - : orb_ () -{ -} - -ACE_INLINE -TAO_EC_ORB_Holder::~TAO_EC_ORB_Holder (void) -{ - if (!CORBA::is_nil (this->orb_.in ())) - { - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - this->orb_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore. - } - ACE_ENDTRY; - } -} - -ACE_INLINE void -TAO_EC_ORB_Holder::init (CORBA::ORB_var orb_var) -{ - this->orb_ = orb_var; -} - -// **************************************************************** - -ACE_INLINE -TAO_EC_Event_Channel_Holder::TAO_EC_Event_Channel_Holder (void) - : ec_ () -{ -} - -ACE_INLINE -TAO_EC_Event_Channel_Holder::~TAO_EC_Event_Channel_Holder (void) -{ - if (!CORBA::is_nil (this->ec_.in ())) - { - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - this->ec_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore. - } - ACE_ENDTRY; - } -} - -ACE_INLINE void -TAO_EC_Event_Channel_Holder::init ( - RtecEventChannelAdmin::EventChannel_var ec_var) -{ - this->ec_ = ec_var; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Lifetime_Utils_T.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Lifetime_Utils_T.cpp deleted file mode 100644 index 8a8d4934d40..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Lifetime_Utils_T.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// $Id$ - -#ifndef TAO_EC_LIFETIME_UTILS_T_CPP -#define TAO_EC_LIFETIME_UTILS_T_CPP - -#include "orbsvcs/Event/EC_Lifetime_Utils_T.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Lifetime_Utils_T.i" -#endif /* __ACE_INLINE__ */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -template <typename T> -void -activate (T & obj_ref, - PortableServer::POA_ptr poa, - PortableServer::ServantBase * servant, - TAO_EC_Object_Deactivator & suggested_object_deactivator - ACE_ENV_ARG_DECL) -{ - // Activate the servant into the POA. - PortableServer::ObjectId_var obj_id = - poa->activate_object (servant - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - suggested_object_deactivator.set_values (poa, obj_id.in ()); - - // Get the object reference of the activated object. - CORBA::Object_var obj = - poa->id_to_reference (obj_id.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // Don't try to use T::_obj_type::_narrow, some compilers don't like it so - // do this in two steps - typedef typename T::_obj_type my_object_type; - - obj_ref = - my_object_type::_narrow (obj.in() ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (CORBA::is_nil (obj_ref.in ())) - { - ACE_THROW (CORBA::INTERNAL ()); - } -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -#endif /* TAO_EC_LIFETIME_UTILS_T_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Lifetime_Utils_T.h b/TAO/orbsvcs/orbsvcs/Event/EC_Lifetime_Utils_T.h deleted file mode 100644 index 85b98439126..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Lifetime_Utils_T.h +++ /dev/null @@ -1,203 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Lifetime_Utils_T.h - * - * $Id$ - * - * @author Jody Hagins (jody@atdesk.com) - * @author Marina Spivak (marina@atdesk.com) - * - * This file is a temporary place for general CORBA application - * utility classes. These classes will be moved out from the EC - * library and into TAO or will be replaced by other TAO classes with - * similar functionality. - */ - -#ifndef TAO_EC_LIFETIME_UTILS_T_H -#define TAO_EC_LIFETIME_UTILS_T_H - -#include "orbsvcs/Event/EC_Lifetime_Utils.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @brief Helper for activating objects. - * Activates @a servant with @a poa and returns the object reference via - * @a obj_ref. If @a object_deactivator != 0, it is populated with info - * necessary to deactivate the @a servant from @a poa. - */ -template <typename T> -void activate (T & obj_ref, - PortableServer::POA_ptr poa, - PortableServer::ServantBase * servant, - TAO_EC_Object_Deactivator & object_deactivator - ACE_ENV_ARG_DECL); - - -//*************************************************************************** - -/** - * @class TAO_EC_Auto_Command<COMMAND> - * - * @brief Utility class which executes COMMAND in its destructor. - * - * Template argument requirements: - * - * Has void execute (ACE_ENV_SINGLE_ARG_DECL); method which - * can throw ONLY CORBA exceptions. - * Has default and copy constructors. - * - */ -template <class T> -class TAO_EC_Auto_Command -{ -public: - TAO_EC_Auto_Command (void); - TAO_EC_Auto_Command (const T & command); - ~TAO_EC_Auto_Command (void); - void set_command (const T & command); - void set_command (TAO_EC_Auto_Command<T> & auto_command); - void execute (void); - void allow_command (void); - void disallow_command (void); - -private: - - TAO_EC_Auto_Command (const TAO_EC_Auto_Command &); - TAO_EC_Auto_Command & operator= (const TAO_EC_Auto_Command &); - - T command_; - int allow_command_; -}; - - -//*************************************************************************** - -template <class T> -class TAO_EC_Shutdown_Command -{ -public: - TAO_EC_Shutdown_Command (void); - TAO_EC_Shutdown_Command (T target); - void execute (ACE_ENV_SINGLE_ARG_DECL); - -private: - - T target_; -}; - -//*************************************************************************** - -/** - * @class Servant_Var - * - * @brief Provides a type safe counted reference to servants. - */ -template <class T> -class TAO_EC_Servant_Var -{ -public: - //! Constructor. Assumes ownership of \c p. - TAO_EC_Servant_Var(T * p = 0); - - //! Copy constructor. Adds reference to \c rhs. - TAO_EC_Servant_Var(TAO_EC_Servant_Var<T> const & rhs); - - //! Assignment operator. Adds reference to \c rhs. - TAO_EC_Servant_Var<T> & operator=(TAO_EC_Servant_Var<T> const & rhs); - - //! Destructor. Removes a reference from the underlying object, - //! possibly destroying it. - ~TAO_EC_Servant_Var(); - - //! Assignment operator. Assumes ownership of \c p. - TAO_EC_Servant_Var<T> & operator=(T * p); - -# if !defined(ACE_LACKS_MEMBER_TEMPLATES) - //! Template member constructor from a pointer that will implicitly - //! cast to type T. Assumes ownership of \c p. - //! This constructor allows constructs such as: - //! Servant_Base<Base> p(new Derived); - template <class Y> - TAO_EC_Servant_Var(Y * p); - - //! Template member copy constructor from a TAO_EC_Servant_Var<Y>, where - //! Y can be implicitly cast to type T. - template <class Y> - TAO_EC_Servant_Var(TAO_EC_Servant_Var<Y> const & rhs); - - //! Template member assignment operator from a TAO_EC_Servant_Var<Y>, where - //! Y can be implicitly cast to type T. - template <class Y> - TAO_EC_Servant_Var<T> & operator=(TAO_EC_Servant_Var<Y> const & rhs); - - //! Template member assignment operator from a pointer to Y, where Y - //! can be implicitly cast to type T. - template <class Y> - TAO_EC_Servant_Var<T> & operator=(Y * p); -# endif /* ACE_LACKS_MEMBER_TEMPLATES */ - - //! Smart pointer operator-> provides access to the underlying object. - T const * operator->() const; - - //! Smart pointer operator-> provides access to the underlying object. - T * operator->(); - - //! Dereference the underlying object. - T const & operator*() const; - - //! Dereference the underlying object. - T & operator*(); - - //! Return a void pointer to the underlying object. This allows - //! it to be used in conditional code and tested against 0. - operator void const * () const; - - //! As an IN parameter. - T * in() const; - - //! As an INOUT parameter. - T *& inout(); - - //! As an OUT parameter. - T *& out(); - - // Return a pointer to the underlying object, and this counted - // reference will no longer own the object. - T * _retn(); - -private: - T * ptr_; -}; - -//! Compare two TAO_EC_Servant_Vars for equivalence. -template <class X, class Y> -bool operator==(TAO_EC_Servant_Var<X> const & x, - TAO_EC_Servant_Var<Y> const & y); - -//! Compare two TAO_EC_Servant_Vars for non-equivalence. -template <class X, class Y> -bool operator!=(TAO_EC_Servant_Var<X> const & x, - TAO_EC_Servant_Var<Y> const & y); - - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Lifetime_Utils_T.i" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "orbsvcs/Event/EC_Lifetime_Utils_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("EC_Lifetime_Utils_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#endif /* EC_LIFETIME_UTILS_T_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Lifetime_Utils_T.i b/TAO/orbsvcs/orbsvcs/Event/EC_Lifetime_Utils_T.i deleted file mode 100644 index e93998fee0f..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Lifetime_Utils_T.i +++ /dev/null @@ -1,340 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -template <class T> -ACE_INLINE -TAO_EC_Auto_Command<T>::TAO_EC_Auto_Command (void) - : command_ () - , allow_command_ (0) -{ -} - -template <class T> -ACE_INLINE -TAO_EC_Auto_Command<T>::TAO_EC_Auto_Command (const T & command) - : command_ (command) - , allow_command_ (1) -{ -} - -template <class T> -ACE_INLINE -TAO_EC_Auto_Command<T>::~TAO_EC_Auto_Command (void) -{ - this->execute (); -} - -template <class T> -ACE_INLINE void -TAO_EC_Auto_Command<T>::set_command (const T & command) -{ - this->command_ = command; - this->allow_command_ = 1; -} - -template <class T> -ACE_INLINE void -TAO_EC_Auto_Command<T>::set_command (TAO_EC_Auto_Command<T> & auto_command) -{ - if (this == &auto_command) - return; - - this->command_ = auto_command.command_; - this->allow_command_ = auto_command.allow_command_; - auto_command.allow_command_ = 0; -} - -template <class T> -ACE_INLINE void -TAO_EC_Auto_Command<T>::execute (void) -{ - if (this->allow_command_) - { - this->allow_command_ = 0; - - ACE_TRY_NEW_ENV - { - this->command_.execute (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // ignore. - } - ACE_ENDTRY; - } -} - -template <class T> -ACE_INLINE void -TAO_EC_Auto_Command<T>::allow_command (void) -{ - this->allow_command_ = 1; -} - -template <class T> -ACE_INLINE void -TAO_EC_Auto_Command<T>::disallow_command (void) -{ - this->allow_command_ = 0; -} - - -//*************************************************************************** - -template <class T> -ACE_INLINE -TAO_EC_Shutdown_Command<T>::TAO_EC_Shutdown_Command (void) - : target_ () -{ -} - -template <class T> -ACE_INLINE -TAO_EC_Shutdown_Command<T>::TAO_EC_Shutdown_Command (T target) - : target_ (target) -{ -} - -template <class T> -ACE_INLINE void -TAO_EC_Shutdown_Command<T>::execute (ACE_ENV_SINGLE_ARG_DECL) -{ - if (this->target_.in ()) - { - this->target_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - } -} - -//*************************************************************************** - - -TAO_END_VERSIONED_NAMESPACE_DECL - -// Life would be much easier if _add_ref() and _remove_ref() -// had throw specs of "throw ()" - -#include <algorithm> - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -template <class T> -ACE_INLINE TAO_EC_Servant_Var<T>:: -TAO_EC_Servant_Var(T * p) - : ptr_(p) -{ -} - -// If _add_ref throws, this object will not be completely constructed -// so the destructor will not be called. -template <class T> -ACE_INLINE TAO_EC_Servant_Var<T>:: -TAO_EC_Servant_Var(TAO_EC_Servant_Var<T> const & rhs) - : ptr_(rhs.ptr_) -{ - if (ptr_) - { - ACE_TRY_NEW_ENV - { - ptr_->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHALL - { - ACE_RE_THROW; - } - ACE_ENDTRY; - } -} - -template <class T> -ACE_INLINE TAO_EC_Servant_Var<T> & TAO_EC_Servant_Var<T>:: -operator=(TAO_EC_Servant_Var<T> const & rhs) -{ - TAO_EC_Servant_Var<T> tmp(rhs); - - // std::swap(tmp.ptr_, ptr_); - T * swap_temp = tmp.ptr_; - tmp.ptr_ = ptr_; - ptr_ = swap_temp; - - return *this; -} - -template <class T> -ACE_INLINE TAO_EC_Servant_Var<T> & TAO_EC_Servant_Var<T>:: -operator=(T * p) -{ - TAO_EC_Servant_Var<T> tmp(p); - - // std::swap(tmp.ptr_, ptr_); - T * swap_temp = tmp.ptr_; - tmp.ptr_ = ptr_; - ptr_ = swap_temp; - - return *this; -} - -template <class T> -ACE_INLINE TAO_EC_Servant_Var<T>:: -~TAO_EC_Servant_Var() -{ - // Unfortunately, there is no throw spec on _remove_ref, so we - // can't assume that it will not throw. If it does, then we are in - // trouble. In any event, we can't let the exception escape our - // destructor. - if (ptr_ != 0) - { - ACE_TRY_NEW_ENV - { - ptr_->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHALL - { - } - ACE_ENDTRY; - } -} - -#if !defined(ACE_LACKS_MEMBER_TEMPLATES) -template <class T> template <class Y> -ACE_INLINE TAO_EC_Servant_Var<T>:: -TAO_EC_Servant_Var(Y * p) - : ptr_(p) -{ -} - -template <class T> template <class Y> -ACE_INLINE TAO_EC_Servant_Var<T>:: -TAO_EC_Servant_Var(TAO_EC_Servant_Var<Y> const & rhs) - : ptr_(rhs.in()) -{ - if (ptr_) - { - ptr_->_add_ref(); - } -} - -template <class T> template <class Y> -ACE_INLINE TAO_EC_Servant_Var<T> & TAO_EC_Servant_Var<T>:: -operator=(TAO_EC_Servant_Var<Y> const & rhs) -{ - TAO_EC_Servant_Var<T> tmp(rhs); - - // std::swap(tmp.ptr_, ptr_); - T * swap_temp = tmp.ptr_; - tmp.ptr_ = ptr_; - ptr_ = swap_temp; - - return *this; -} - -template <class T> template <class Y> -ACE_INLINE TAO_EC_Servant_Var<T> & TAO_EC_Servant_Var<T>:: -operator=(Y * p) -{ - TAO_EC_Servant_Var<T> tmp(p); - - // std::swap(tmp.ptr_, ptr_); - T * swap_temp = tmp.ptr_; - tmp.ptr_ = ptr_; - ptr_ = swap_temp; - - return *this; -} -#endif /* ACE_LACKS_MEMBER_TEMPLATES */ - -template <class T> -ACE_INLINE T const * TAO_EC_Servant_Var<T>:: -operator->() const -{ - return ptr_; -} - -template <class T> -ACE_INLINE T * TAO_EC_Servant_Var<T>:: -operator->() -{ - return ptr_; -} - -template <class T> -ACE_INLINE T const & TAO_EC_Servant_Var<T>:: -operator*() const -{ - return *ptr_; -} - -template <class T> -ACE_INLINE T & TAO_EC_Servant_Var<T>:: -operator*() -{ - return *ptr_; -} - -template <class T> -ACE_INLINE TAO_EC_Servant_Var<T>:: -operator void const * () const -{ - return ptr_; -} - -template <class T> -ACE_INLINE T * TAO_EC_Servant_Var<T>:: -in() const -{ - return ptr_; -} - -template <class T> -ACE_INLINE T *& TAO_EC_Servant_Var<T>:: -inout() -{ - return ptr_; -} - -template <class T> -ACE_INLINE T *& TAO_EC_Servant_Var<T>:: -out() -{ - TAO_EC_Servant_Var<T> tmp; - - // std::swap(tmp.ptr_, ptr_); - T * swap_temp = tmp.ptr_; - tmp.ptr_ = ptr_; - ptr_ = swap_temp; - - return ptr_; -} - -template <class T> -ACE_INLINE T * TAO_EC_Servant_Var<T>:: -_retn() -{ - T * rval = ptr_; - ptr_ = 0; - return rval; -} - -template <class X, class Y> -ACE_INLINE bool -operator==(TAO_EC_Servant_Var<X> const & x, - TAO_EC_Servant_Var<Y> const & y) -{ - return x.in() == y.in(); -} - -template <class X, class Y> -ACE_INLINE bool -operator!=(TAO_EC_Servant_Var<X> const & x, - TAO_EC_Servant_Var<Y> const & y) -{ - return x.in() != y.in(); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_MT_Dispatching.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_MT_Dispatching.cpp deleted file mode 100644 index 096ae4c3ba0..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_MT_Dispatching.cpp +++ /dev/null @@ -1,92 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_MT_Dispatching.h" - -ACE_RCSID(Event, EC_MT_Dispatching, "$Id$") - - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_MT_Dispatching::TAO_EC_MT_Dispatching (int nthreads, - int thread_creation_flags, - int thread_priority, - int force_activate, - TAO_EC_Queue_Full_Service_Object* service_object) - : nthreads_ (nthreads), - thread_creation_flags_ (thread_creation_flags), - thread_priority_ (thread_priority), - force_activate_ (force_activate), - active_ (0), - queue_full_service_object_ (service_object) -{ - this->task_.open (&this->thread_manager_); -} - -void -TAO_EC_MT_Dispatching::activate (void) -{ - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - - if (this->active_ != 0) - return; - - this->active_ = 1; - - if (this->task_.activate (this->thread_creation_flags_, - this->nthreads_, - 1, - this->thread_priority_) == -1) - { - if (this->force_activate_ != 0) - { - ACE_DEBUG ((LM_DEBUG, - "EC (%P|%t) activating dispatching queue at" - " default priority\n")); - if (this->task_.activate (THR_BOUND, this->nthreads_) == -1) - ACE_ERROR ((LM_ERROR, - "EC (%P|%t) cannot activate dispatching queue.\n")); - } - } -} - -void -TAO_EC_MT_Dispatching::shutdown (void) -{ - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - - if (this->active_ == 0) - return; - - for (int i = 0; i < this->nthreads_; ++i) - { - this->task_.putq (new TAO_EC_Shutdown_Task_Command); - } - this->thread_manager_.wait (); -} - -void -TAO_EC_MT_Dispatching::push (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - RtecEventComm::EventSet event_copy = event; - this->push_nocopy (proxy, consumer, event_copy, qos_info ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_MT_Dispatching::push_nocopy (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& - ACE_ENV_ARG_DECL) -{ - // Double checked locking.... - if (this->active_ == 0) - this->activate (); - - this->task_.push (proxy, consumer, event ACE_ENV_ARG_PARAMETER); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_MT_Dispatching.h b/TAO/orbsvcs/orbsvcs/Event/EC_MT_Dispatching.h deleted file mode 100644 index b38b5a160fd..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_MT_Dispatching.h +++ /dev/null @@ -1,98 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_MT_Dispatching.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_MT_DISPATCHING_H -#define TAO_EC_MT_DISPATCHING_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Dispatching.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/Event/EC_Dispatching_Task.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_MT_Dispatching - * - * @brief Dispatching strategy that minimizes mt inversion. - * - * This strategy uses a single queue, serviced by one or more - * threads. It's main purpose is to decouple the suppliers from - * the client execution time, specially in the collocated case. - */ -class TAO_RTEvent_Serv_Export TAO_EC_MT_Dispatching : public TAO_EC_Dispatching -{ -public: - /// Constructor - /// It will create @a nthreads servicing threads... - TAO_EC_MT_Dispatching (int nthreads, - int thread_creation_flags, - int thread_priority, - int force_activate, - TAO_EC_Queue_Full_Service_Object* queue_full_service_object_name); - - // = The EC_Dispatching methods. - virtual void activate (void); - virtual void shutdown (void); - virtual void push (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push_nocopy (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - -private: - /// Use our own thread manager. - ACE_Thread_Manager thread_manager_; - - /// The number of active tasks - int nthreads_; - - /// The flags (THR_BOUND, THR_NEW_LWP, etc.) used to create the - /// dispatching threads. - int thread_creation_flags_; - - /// The priority of the dispatching threads. - int thread_priority_; - - /// If activation at the requested priority fails then we fallback on - /// the defaults for thread activation. - int force_activate_; - - /// The dispatching task - TAO_EC_Dispatching_Task task_; - - /// Synchronize access to internal data - TAO_SYNCH_MUTEX lock_; - - /// Are the threads running? - int active_; - - /// Service Object information - TAO_EC_Queue_Full_Service_Object* queue_full_service_object_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* TAO_EC_MT_DISPATCHING_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Masked_Type_Filter.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Masked_Type_Filter.cpp deleted file mode 100644 index 0ab3197ef29..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Masked_Type_Filter.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Masked_Type_Filter.h" - -ACE_RCSID(Event, EC_Masked_Type_Filter, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Masked_Type_Filter:: - TAO_EC_Masked_Type_Filter (CORBA::ULong source_mask, - CORBA::ULong type_mask, - CORBA::ULong source_value, - CORBA::ULong type_value) - : source_mask_ (source_mask), - type_mask_ (type_mask), - source_value_ (source_value), - type_value_ (type_value) -{ -} - -TAO_EC_Masked_Type_Filter::~TAO_EC_Masked_Type_Filter (void) -{ -} - -TAO_EC_Filter::ChildrenIterator -TAO_EC_Masked_Type_Filter::begin (void) const -{ - return 0; -} - -TAO_EC_Filter::ChildrenIterator -TAO_EC_Masked_Type_Filter::end (void) const -{ - return 0; -} - -int -TAO_EC_Masked_Type_Filter::size (void) const -{ - return 0; -} - -int -TAO_EC_Masked_Type_Filter::filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - if (event.length () != 1) - return 0; - - if ((event[0].header.type & this->type_mask_) != this->type_value_ - || (event[0].header.source & this->source_mask_) != this->source_value_) - return 0; - - if (this->parent () != 0) - { - this->parent ()->push (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - } - return 1; -} - -int -TAO_EC_Masked_Type_Filter::filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - if (event.length () != 1) - return 0; - - if ((event[0].header.type & this->type_mask_) != this->type_value_ - || (event[0].header.source & this->source_mask_) != this->source_value_) - return 0; - - if (this->parent () != 0) - { - this->parent ()->push_nocopy (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - } - return 1; -} - -void -TAO_EC_Masked_Type_Filter::push (const RtecEventComm::EventSet &, - TAO_EC_QOS_Info & - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_Masked_Type_Filter::push_nocopy (RtecEventComm::EventSet &, - TAO_EC_QOS_Info & - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_Masked_Type_Filter::clear (void) -{ -} - -CORBA::ULong -TAO_EC_Masked_Type_Filter::max_event_size (void) const -{ - return 1; -} - -int -TAO_EC_Masked_Type_Filter::can_match ( - const RtecEventComm::EventHeader& header) const -{ - if ((header.type & this->type_mask_) == this->type_value_ - && (header.source & this->source_mask_) == this->source_value_) - return 1; - - return 0; -} - -int -TAO_EC_Masked_Type_Filter::add_dependencies ( - const RtecEventComm::EventHeader&, - const TAO_EC_QOS_Info & - ACE_ENV_ARG_DECL_NOT_USED) -{ - return 0; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Masked_Type_Filter.h b/TAO/orbsvcs/orbsvcs/Event/EC_Masked_Type_Filter.h deleted file mode 100644 index 97a83d622ea..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Masked_Type_Filter.h +++ /dev/null @@ -1,93 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Masked_Type_Filter.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_MASKED_TYPE_FILTER_H -#define TAO_EC_MASKED_TYPE_FILTER_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Filter.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Masked_Type_Filter - * - * @brief A masked type filter. - * - * This filter only accepts events whose type and/or source have - * a given value when a bitmask is applied to them. - * In short the filter checks that: - * (event.header.type & type_mask) == type_value - * and that: - * (event.header.source & source_mask) == source_value - */ -class TAO_RTEvent_Serv_Export TAO_EC_Masked_Type_Filter : public TAO_EC_Filter -{ -public: - /// Constructor. - TAO_EC_Masked_Type_Filter (CORBA::ULong source_mask, - CORBA::ULong type_mask, - CORBA::ULong source_value, - CORBA::ULong type_value); - - /// Destructor - virtual ~TAO_EC_Masked_Type_Filter (void); - - // = The TAO_EC_Filter methods, please check the documentation in - // TAO_EC_Filter. - virtual ChildrenIterator begin (void) const; - virtual ChildrenIterator end (void) const; - virtual int size (void) const; - virtual int filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual int filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void clear (void); - virtual CORBA::ULong max_event_size (void) const; - virtual int can_match (const RtecEventComm::EventHeader& header) const; - virtual int add_dependencies (const RtecEventComm::EventHeader& header, - const TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL); - -private: - TAO_EC_Masked_Type_Filter (const TAO_EC_Masked_Type_Filter&); - TAO_EC_Masked_Type_Filter& operator= (const TAO_EC_Masked_Type_Filter&); - -private: - /// The bitmasks - CORBA::ULong source_mask_; - CORBA::ULong type_mask_; - - /// The values - CORBA::ULong source_value_; - CORBA::ULong type_value_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* TAO_EC_MASKED_TYPE_FILTER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Negation_Filter.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Negation_Filter.cpp deleted file mode 100644 index 204685379ac..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Negation_Filter.cpp +++ /dev/null @@ -1,114 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Negation_Filter.h" - -ACE_RCSID(Event, EC_Negation_Filter, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Negation_Filter::TAO_EC_Negation_Filter (TAO_EC_Filter* child) - : child_ (child) -{ - this->adopt_child (this->child_); -} - -TAO_EC_Negation_Filter::~TAO_EC_Negation_Filter (void) -{ - delete this->child_; -} - -TAO_EC_Filter::ChildrenIterator -TAO_EC_Negation_Filter::begin (void) const -{ - return const_cast<TAO_EC_Filter**> (&this->child_); -} - -TAO_EC_Filter::ChildrenIterator -TAO_EC_Negation_Filter::end (void) const -{ - return const_cast<TAO_EC_Filter**> (&this->child_) + 1; -} - -int -TAO_EC_Negation_Filter::size (void) const -{ - return 1; -} - -int -TAO_EC_Negation_Filter::filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - int n = - this->child_->filter (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - if (this->parent () != 0 && n == 0) - { - this->parent ()->push (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - return 1; - } - return 0; -} - -int -TAO_EC_Negation_Filter::filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - int n = - this->child_->filter_nocopy (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - if (this->parent () != 0 && n == 0) - { - this->parent ()->push_nocopy (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - return 1; - } - return 0; -} - -void -TAO_EC_Negation_Filter::push (const RtecEventComm::EventSet&, - TAO_EC_QOS_Info& - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_Negation_Filter::push_nocopy (RtecEventComm::EventSet&, - TAO_EC_QOS_Info& - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_Negation_Filter::clear (void) -{ - this->child_->clear (); -} - -CORBA::ULong -TAO_EC_Negation_Filter::max_event_size (void) const -{ - return this->child_->max_event_size (); -} - -int -TAO_EC_Negation_Filter::can_match ( - const RtecEventComm::EventHeader& header) const -{ - return !this->child_->can_match (header); -} - -int -TAO_EC_Negation_Filter::add_dependencies ( - const RtecEventComm::EventHeader&, - const TAO_EC_QOS_Info & - ACE_ENV_ARG_DECL_NOT_USED) -{ - return 0; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Negation_Filter.h b/TAO/orbsvcs/orbsvcs/Event/EC_Negation_Filter.h deleted file mode 100644 index f4f141f0e27..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Negation_Filter.h +++ /dev/null @@ -1,86 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Negation_Filter.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_NEGATION_FILTER_H -#define TAO_EC_NEGATION_FILTER_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Filter.h" -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Negation_Filter - * - * @brief The negation filter. - * - * This filter accepts all the events rejected by its child, and - * rejects any events accepted by the child. - * - * <H2>Memory Management</H2> - * It assumes ownership of its child. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Negation_Filter : public TAO_EC_Filter -{ -public: - /// Constructor. It assumes ownership of the child. - TAO_EC_Negation_Filter (TAO_EC_Filter* child); - - /// Destructor - virtual ~TAO_EC_Negation_Filter (void); - - - // = The TAO_EC_Filter methods, please check the documentation in - // TAO_EC_Filter. - virtual ChildrenIterator begin (void) const; - virtual ChildrenIterator end (void) const; - virtual int size (void) const; - virtual int filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual int filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void clear (void); - virtual CORBA::ULong max_event_size (void) const; - virtual int can_match (const RtecEventComm::EventHeader& header) const; - virtual int add_dependencies (const RtecEventComm::EventHeader& header, - const TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL); - -private: - TAO_EC_Negation_Filter (const TAO_EC_Negation_Filter&); - TAO_EC_Negation_Filter& operator= (const TAO_EC_Negation_Filter&); - -private: - /// The child - TAO_EC_Filter* child_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* TAO_EC_NEGATION_FILTER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Null_Factory.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Null_Factory.cpp deleted file mode 100644 index 5b829d361c6..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Null_Factory.cpp +++ /dev/null @@ -1,241 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Null_Factory.h" -#include "orbsvcs/Event/EC_Reactive_Dispatching.h" -#include "orbsvcs/Event/EC_Filter_Builder.h" -#include "orbsvcs/Event/EC_Trivial_Supplier_Filter.h" -#include "orbsvcs/Event/EC_ConsumerAdmin.h" -#include "orbsvcs/Event/EC_SupplierAdmin.h" -#include "orbsvcs/Event/EC_Default_ProxyConsumer.h" -#include "orbsvcs/Event/EC_Default_ProxySupplier.h" -#include "orbsvcs/Event/EC_ObserverStrategy.h" -#include "orbsvcs/Event/EC_Null_Scheduling.h" -#include "orbsvcs/Event/EC_Reactive_Timeout_Generator.h" -#include "orbsvcs/Event/EC_ConsumerControl.h" -#include "orbsvcs/Event/EC_SupplierControl.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" // @@ MSVC 6 bug -#include "orbsvcs/ESF/ESF_Proxy_List.h" -#include "orbsvcs/ESF/ESF_Immediate_Changes.h" - -#include "tao/ORB_Core.h" - -ACE_RCSID(Event, EC_Null_Factory, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Null_Factory::TAO_EC_Null_Factory (void) -{ -} - -TAO_EC_Null_Factory::~TAO_EC_Null_Factory (void) -{ -} - -TAO_EC_Dispatching* -TAO_EC_Null_Factory::create_dispatching (TAO_EC_Event_Channel_Base *) -{ - return new TAO_EC_Reactive_Dispatching (); -} - -void -TAO_EC_Null_Factory::destroy_dispatching (TAO_EC_Dispatching *x) -{ - delete x; -} - -TAO_EC_Filter_Builder* -TAO_EC_Null_Factory::create_filter_builder (TAO_EC_Event_Channel_Base *) -{ - return new TAO_EC_Null_Filter_Builder; -} - -void -TAO_EC_Null_Factory::destroy_filter_builder (TAO_EC_Filter_Builder *x) -{ - delete x; -} - -TAO_EC_Supplier_Filter_Builder* -TAO_EC_Null_Factory::create_supplier_filter_builder (TAO_EC_Event_Channel_Base *ec) -{ - return new TAO_EC_Trivial_Supplier_Filter_Builder (ec); -} - -void -TAO_EC_Null_Factory::destroy_supplier_filter_builder (TAO_EC_Supplier_Filter_Builder *x) -{ - delete x; -} - -TAO_EC_ConsumerAdmin* -TAO_EC_Null_Factory::create_consumer_admin (TAO_EC_Event_Channel_Base *ec) -{ - return new TAO_EC_ConsumerAdmin (ec); -} - -void -TAO_EC_Null_Factory::destroy_consumer_admin (TAO_EC_ConsumerAdmin *x) -{ - delete x; -} - -TAO_EC_SupplierAdmin* -TAO_EC_Null_Factory::create_supplier_admin (TAO_EC_Event_Channel_Base *ec) -{ - return new TAO_EC_SupplierAdmin (ec); -} - -void -TAO_EC_Null_Factory::destroy_supplier_admin (TAO_EC_SupplierAdmin *x) -{ - delete x; -} - -TAO_EC_ProxyPushSupplier* -TAO_EC_Null_Factory::create_proxy_push_supplier (TAO_EC_Event_Channel_Base *ec) -{ - return new TAO_EC_Default_ProxyPushSupplier (ec, TAO_EC_DEFAULT_CONSUMER_VALIDATE_CONNECTION); -} - -void -TAO_EC_Null_Factory::destroy_proxy_push_supplier (TAO_EC_ProxyPushSupplier *x) -{ - delete x; -} - -TAO_EC_ProxyPushConsumer* -TAO_EC_Null_Factory::create_proxy_push_consumer (TAO_EC_Event_Channel_Base *ec) -{ - return new TAO_EC_Default_ProxyPushConsumer (ec); -} - -void -TAO_EC_Null_Factory::destroy_proxy_push_consumer (TAO_EC_ProxyPushConsumer *x) -{ - delete x; -} - -TAO_EC_Timeout_Generator* -TAO_EC_Null_Factory::create_timeout_generator (TAO_EC_Event_Channel_Base *) -{ - int argc = 0; - char **argv = 0; - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, ""); - ACE_Reactor *reactor = orb->orb_core ()->reactor (); - return new TAO_EC_Reactive_Timeout_Generator (reactor); -} - -void -TAO_EC_Null_Factory::destroy_timeout_generator (TAO_EC_Timeout_Generator *x) -{ - delete x; -} - -TAO_EC_ObserverStrategy* -TAO_EC_Null_Factory::create_observer_strategy (TAO_EC_Event_Channel_Base *) -{ - return new TAO_EC_Null_ObserverStrategy; -} - -void -TAO_EC_Null_Factory::destroy_observer_strategy (TAO_EC_ObserverStrategy *x) -{ - delete x; -} - -TAO_EC_Scheduling_Strategy* -TAO_EC_Null_Factory::create_scheduling_strategy (TAO_EC_Event_Channel_Base*) -{ - return new TAO_EC_Null_Scheduling; -} - -void -TAO_EC_Null_Factory::destroy_scheduling_strategy (TAO_EC_Scheduling_Strategy* x) -{ - delete x; -} - -TAO_EC_ProxyPushConsumer_Collection* -TAO_EC_Null_Factory::create_proxy_push_consumer_collection (TAO_EC_Event_Channel_Base *) -{ - // This typedef is a workaround for a SunCC 4.2 bug - typedef TAO_ESF_Proxy_List<TAO_EC_ProxyPushConsumer>::Iterator TAO_EC_Consumer_List_Iterator; - return new TAO_ESF_Immediate_Changes<TAO_EC_ProxyPushConsumer, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushConsumer>, - TAO_EC_Consumer_List_Iterator, - ACE_Null_Mutex> (); -} - -void -TAO_EC_Null_Factory::destroy_proxy_push_consumer_collection (TAO_EC_ProxyPushConsumer_Collection *x) -{ - delete x; -} - -TAO_EC_ProxyPushSupplier_Collection* -TAO_EC_Null_Factory::create_proxy_push_supplier_collection (TAO_EC_Event_Channel_Base *) -{ - // This typedef is a workaround for a SunCC 4.2 bug - typedef TAO_ESF_Proxy_List<TAO_EC_ProxyPushSupplier>::Iterator TAO_EC_Supplier_List_Iterator; - return new TAO_ESF_Immediate_Changes<TAO_EC_ProxyPushSupplier, - TAO_ESF_Proxy_List<TAO_EC_ProxyPushSupplier>, - TAO_EC_Supplier_List_Iterator, - ACE_Null_Mutex> (); -} - -void -TAO_EC_Null_Factory::destroy_proxy_push_supplier_collection (TAO_EC_ProxyPushSupplier_Collection *x) -{ - delete x; -} - -ACE_Lock* -TAO_EC_Null_Factory::create_consumer_lock (void) -{ - return new ACE_Lock_Adapter<ACE_Null_Mutex> (); -} - -void -TAO_EC_Null_Factory::destroy_consumer_lock (ACE_Lock* x) -{ - delete x; -} - -ACE_Lock* -TAO_EC_Null_Factory::create_supplier_lock (void) -{ - return new ACE_Lock_Adapter<ACE_Null_Mutex> (); -} - -void -TAO_EC_Null_Factory::destroy_supplier_lock (ACE_Lock* x) -{ - delete x; -} - -TAO_EC_ConsumerControl* -TAO_EC_Null_Factory::create_consumer_control (TAO_EC_Event_Channel_Base*) -{ - return new TAO_EC_ConsumerControl (); -} - -void -TAO_EC_Null_Factory::destroy_consumer_control (TAO_EC_ConsumerControl* x) -{ - delete x; -} - -TAO_EC_SupplierControl* -TAO_EC_Null_Factory::create_supplier_control (TAO_EC_Event_Channel_Base*) -{ - return new TAO_EC_SupplierControl (); -} - -void -TAO_EC_Null_Factory::destroy_supplier_control (TAO_EC_SupplierControl* x) -{ - delete x; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Null_Factory.h b/TAO/orbsvcs/orbsvcs/Event/EC_Null_Factory.h deleted file mode 100644 index ca583ca5d13..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Null_Factory.h +++ /dev/null @@ -1,116 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Null_Factory.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_NULL_FACTORY_H -#define TAO_EC_NULL_FACTORY_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Factory.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Null_Factory - * - * @brief The factory for a simple event channel. - * - * The simplest configuration for an event channel does no - * filtering and uses reactive dispatching. This class is used to - * configure such an event channel. - * A fixed POA is used for servant activation. - * This object creates a single instance of the Supplier - */ -class TAO_RTEvent_Serv_Export TAO_EC_Null_Factory : public TAO_EC_Factory -{ -public: - /// Constructor - TAO_EC_Null_Factory (void); - - /// destructor... - virtual ~TAO_EC_Null_Factory (void); - - // = The EC_Factory methods - virtual TAO_EC_Dispatching* - create_dispatching (TAO_EC_Event_Channel_Base*); - virtual void - destroy_dispatching (TAO_EC_Dispatching*); - virtual TAO_EC_Filter_Builder* - create_filter_builder (TAO_EC_Event_Channel_Base*); - virtual void - destroy_filter_builder (TAO_EC_Filter_Builder*); - virtual TAO_EC_Supplier_Filter_Builder* - create_supplier_filter_builder (TAO_EC_Event_Channel_Base*); - virtual void - destroy_supplier_filter_builder (TAO_EC_Supplier_Filter_Builder*); - virtual TAO_EC_ConsumerAdmin* - create_consumer_admin (TAO_EC_Event_Channel_Base*); - virtual void - destroy_consumer_admin (TAO_EC_ConsumerAdmin*); - virtual TAO_EC_SupplierAdmin* - create_supplier_admin (TAO_EC_Event_Channel_Base*); - virtual void - destroy_supplier_admin (TAO_EC_SupplierAdmin*); - virtual TAO_EC_ProxyPushSupplier* - create_proxy_push_supplier (TAO_EC_Event_Channel_Base*); - virtual void - destroy_proxy_push_supplier (TAO_EC_ProxyPushSupplier*); - virtual TAO_EC_ProxyPushConsumer* - create_proxy_push_consumer (TAO_EC_Event_Channel_Base*); - virtual void - destroy_proxy_push_consumer (TAO_EC_ProxyPushConsumer*); - virtual TAO_EC_Timeout_Generator* - create_timeout_generator (TAO_EC_Event_Channel_Base*); - virtual void - destroy_timeout_generator (TAO_EC_Timeout_Generator*); - virtual TAO_EC_ObserverStrategy* - create_observer_strategy (TAO_EC_Event_Channel_Base*); - virtual void - destroy_observer_strategy (TAO_EC_ObserverStrategy*); - virtual TAO_EC_Scheduling_Strategy* - create_scheduling_strategy (TAO_EC_Event_Channel_Base*); - virtual void - destroy_scheduling_strategy (TAO_EC_Scheduling_Strategy*); - virtual TAO_EC_ProxyPushConsumer_Collection* - create_proxy_push_consumer_collection (TAO_EC_Event_Channel_Base*); - virtual void - destroy_proxy_push_consumer_collection (TAO_EC_ProxyPushConsumer_Collection*); - virtual TAO_EC_ProxyPushSupplier_Collection* - create_proxy_push_supplier_collection (TAO_EC_Event_Channel_Base*); - virtual void - destroy_proxy_push_supplier_collection (TAO_EC_ProxyPushSupplier_Collection*); - - virtual ACE_Lock* create_consumer_lock (void); - virtual void destroy_consumer_lock (ACE_Lock*); - virtual ACE_Lock* create_supplier_lock (void); - virtual void destroy_supplier_lock (ACE_Lock*); - - virtual TAO_EC_ConsumerControl* - create_consumer_control (TAO_EC_Event_Channel_Base*); - virtual void - destroy_consumer_control (TAO_EC_ConsumerControl*); - virtual TAO_EC_SupplierControl* - create_supplier_control (TAO_EC_Event_Channel_Base*); - virtual void - destroy_supplier_control (TAO_EC_SupplierControl*); -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* TAO_EC_NULL_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Null_Scheduling.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Null_Scheduling.cpp deleted file mode 100644 index e17a6de3910..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Null_Scheduling.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Null_Scheduling.h" -#include "orbsvcs/Event/EC_QOS_Info.h" -#include "orbsvcs/Event/EC_Supplier_Filter.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Null_Scheduling.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, EC_Null_Scheduling, "$Id$") - -void -TAO_EC_Null_Scheduling::add_proxy_supplier_dependencies ( - TAO_EC_ProxyPushSupplier *, - TAO_EC_ProxyPushConsumer * - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_Null_Scheduling::schedule_event (const RtecEventComm::EventSet &event, - TAO_EC_ProxyPushConsumer *, - TAO_EC_Supplier_Filter *filter - ACE_ENV_ARG_DECL) -{ - for (CORBA::ULong j = 0; j < event.length (); ++j) - { - const RtecEventComm::Event& e = event[j]; - RtecEventComm::Event* buffer = - const_cast<RtecEventComm::Event*> (&e); - RtecEventComm::EventSet single_event (1, 1, buffer, 0); - - TAO_EC_QOS_Info event_info; - filter->push_scheduled_event (single_event, event_info - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } -} diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Null_Scheduling.h b/TAO/orbsvcs/orbsvcs/Event/EC_Null_Scheduling.h deleted file mode 100644 index 90857214aeb..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Null_Scheduling.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- C++ -*- */ -/** - * @file EC_Null_Scheduling.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_NULL_SCHEDULING_H -#define TAO_EC_NULL_SCHEDULING_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Scheduling_Strategy.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -/** - * @class TAO_EC_Null_Scheduling - * - * @brief A scheduling strategy that separates event groups and - * delivers one event at a time. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Null_Scheduling - : public TAO_EC_Scheduling_Strategy -{ -public: - /// Constructor. - TAO_EC_Null_Scheduling (void); - - // Read EC_Scheduling_Strategy.h for more details - virtual void add_proxy_supplier_dependencies ( - TAO_EC_ProxyPushSupplier *supplier, - TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL); - virtual void schedule_event (const RtecEventComm::EventSet &event, - TAO_EC_ProxyPushConsumer *consumer, - TAO_EC_Supplier_Filter *filter - ACE_ENV_ARG_DECL); - -private: - TAO_EC_Null_Scheduling (const TAO_EC_Null_Scheduling&); - TAO_EC_Null_Scheduling& operator= (const TAO_EC_Null_Scheduling&); -}; - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Null_Scheduling.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_NULL_SCHEDULING_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Null_Scheduling.i b/TAO/orbsvcs/orbsvcs/Event/EC_Null_Scheduling.i deleted file mode 100644 index 60c72cb9e56..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Null_Scheduling.i +++ /dev/null @@ -1,7 +0,0 @@ -// $Id$ - -ACE_INLINE -TAO_EC_Null_Scheduling::TAO_EC_Null_Scheduling (void) -{ -} - diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ObserverStrategy.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ObserverStrategy.cpp deleted file mode 100644 index e5c5a9bc11d..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ObserverStrategy.cpp +++ /dev/null @@ -1,516 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_ObserverStrategy.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "orbsvcs/Event/EC_ProxySupplier.h" -#include "orbsvcs/Event/EC_ProxyConsumer.h" -#include "orbsvcs/Event/EC_ConsumerAdmin.h" -#include "orbsvcs/Event/EC_SupplierAdmin.h" -#include "orbsvcs/Event_Service_Constants.h" -#include "ace/Auto_Ptr.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_ObserverStrategy.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, EC_ObserverStrategy, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_ObserverStrategy::~TAO_EC_ObserverStrategy (void) -{ -} - -// **************************************************************** - -RtecEventChannelAdmin::Observer_Handle -TAO_EC_Null_ObserverStrategy::append_observer ( - RtecEventChannelAdmin::Observer_ptr - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR, - RtecEventChannelAdmin::EventChannel::CANT_APPEND_OBSERVER)) -{ - ACE_THROW_RETURN ( - RtecEventChannelAdmin::EventChannel::CANT_APPEND_OBSERVER(), - 0); -} - -void -TAO_EC_Null_ObserverStrategy::remove_observer ( - RtecEventChannelAdmin::Observer_Handle - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR, - RtecEventChannelAdmin::EventChannel::CANT_REMOVE_OBSERVER)) -{ - ACE_THROW (RtecEventChannelAdmin::EventChannel::CANT_REMOVE_OBSERVER()); -} - -void -TAO_EC_Null_ObserverStrategy::connected (TAO_EC_ProxyPushConsumer* - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_Null_ObserverStrategy::disconnected (TAO_EC_ProxyPushConsumer* - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_Null_ObserverStrategy::connected (TAO_EC_ProxyPushSupplier* - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_Null_ObserverStrategy::disconnected (TAO_EC_ProxyPushSupplier* - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -// **************************************************************** - -TAO_EC_Basic_ObserverStrategy::~TAO_EC_Basic_ObserverStrategy (void) -{ - delete this->lock_; - this->lock_ = 0; -} - -RtecEventChannelAdmin::Observer_Handle -TAO_EC_Basic_ObserverStrategy::append_observer ( - RtecEventChannelAdmin::Observer_ptr obs - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR, - RtecEventChannelAdmin::EventChannel::CANT_APPEND_OBSERVER)) -{ - { - ACE_GUARD_THROW_EX ( - ACE_Lock, ace_mon, *this->lock_, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR()); - ACE_CHECK_RETURN (0); - - this->handle_generator_++; - Observer_Entry entry (this->handle_generator_, - RtecEventChannelAdmin::Observer::_duplicate (obs)); - - if (this->observers_.bind (entry.handle, entry) == -1) - ACE_THROW_RETURN ( - RtecEventChannelAdmin::EventChannel::CANT_APPEND_OBSERVER(), - 0); - } - - RtecEventChannelAdmin::ConsumerQOS c_qos; - this->fill_qos (c_qos ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - obs->update_consumer (c_qos ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - RtecEventChannelAdmin::SupplierQOS s_qos; - this->fill_qos (s_qos ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - obs->update_supplier (s_qos ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - return this->handle_generator_; -} - - -void -TAO_EC_Basic_ObserverStrategy::remove_observer ( - RtecEventChannelAdmin::Observer_Handle handle - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR, - RtecEventChannelAdmin::EventChannel::CANT_REMOVE_OBSERVER)) -{ - ACE_GUARD_THROW_EX (ACE_Lock, ace_mon, *this->lock_, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR()); - ACE_CHECK; - - if (this->observers_.unbind (handle) == -1) - ACE_THROW ( - RtecEventChannelAdmin::EventChannel::CANT_REMOVE_OBSERVER()); -} - -int -TAO_EC_Basic_ObserverStrategy::create_observer_list ( - RtecEventChannelAdmin::Observer_var *&lst - ACE_ENV_ARG_DECL) -{ - ACE_GUARD_THROW_EX (ACE_Lock, ace_mon, *this->lock_, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR()); - ACE_CHECK_RETURN (0); - - int size = static_cast<int> (this->observers_.current_size ()); - RtecEventChannelAdmin::Observer_var *tmp; - ACE_NEW_RETURN (tmp, - RtecEventChannelAdmin::Observer_var[size], - 0); - ACE_Auto_Basic_Array_Ptr<RtecEventChannelAdmin::Observer_var> copy (tmp); - - Observer_Map_Iterator end = this->observers_.end (); - int j = 0; - for (Observer_Map_Iterator i = this->observers_.begin (); - i != end; - ++i) - { - Observer_Entry& entry = (*i).int_id_; - copy[j++] = - RtecEventChannelAdmin::Observer::_duplicate (entry.observer.in ()); - } - - lst = copy.release (); - return size; -} - -void -TAO_EC_Basic_ObserverStrategy::connected ( - TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL) -{ - this->supplier_qos_update (consumer ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_EC_Basic_ObserverStrategy::disconnected ( - TAO_EC_ProxyPushConsumer* consumer - ACE_ENV_ARG_DECL) -{ - this->supplier_qos_update (consumer ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_EC_Basic_ObserverStrategy::supplier_qos_update ( - TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL) -{ - if (consumer->publications ().is_gateway) - return; - - RtecEventChannelAdmin::SupplierQOS s_qos; - this->fill_qos (s_qos ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - RtecEventChannelAdmin::Observer_var *tmp = 0; - int size = this->create_observer_list (tmp ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - ACE_Auto_Basic_Array_Ptr<RtecEventChannelAdmin::Observer_var> copy (tmp); - - for (int i = 0; i != size; ++i) - { - ACE_TRY - { - copy[i]->update_supplier (s_qos ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore exceptions, we must isolate other observers from - // failures on this one. - } - ACE_ENDTRY; - } -} - -void -TAO_EC_Basic_ObserverStrategy::connected ( - TAO_EC_ProxyPushSupplier* supplier - ACE_ENV_ARG_DECL) -{ - this->consumer_qos_update (supplier ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_EC_Basic_ObserverStrategy::disconnected ( - TAO_EC_ProxyPushSupplier* supplier - ACE_ENV_ARG_DECL) -{ - this->consumer_qos_update (supplier ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_EC_Basic_ObserverStrategy::consumer_qos_update ( - TAO_EC_ProxyPushSupplier *supplier - ACE_ENV_ARG_DECL) -{ - if (supplier->subscriptions ().is_gateway) - return; - - RtecEventChannelAdmin::ConsumerQOS c_qos; - this->fill_qos (c_qos ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - RtecEventChannelAdmin::Observer_var *tmp = 0; - int size = this->create_observer_list (tmp ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - ACE_Auto_Basic_Array_Ptr<RtecEventChannelAdmin::Observer_var> copy (tmp); - - for (int i = 0; i != size; ++i) - { - ACE_TRY - { - copy[i]->update_consumer (c_qos ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore exceptions, we must isolate other observers from - // failures on this one. - } - ACE_ENDTRY; - } -} - -void -TAO_EC_Basic_ObserverStrategy::fill_qos ( - RtecEventChannelAdmin::ConsumerQOS &qos - ACE_ENV_ARG_DECL) -{ - Headers headers; - - TAO_EC_Accumulate_Supplier_Headers worker (headers); - this->event_channel_->for_each_consumer (&worker - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - RtecEventChannelAdmin::DependencySet& dep = qos.dependencies; - - dep.length (static_cast<CORBA::ULong> (headers.current_size () + 1)); - - dep[0].event.header.type = ACE_ES_DISJUNCTION_DESIGNATOR; - dep[0].event.header.source = static_cast<CORBA::ULong> (headers.current_size ()); - dep[0].event.header.creation_time = ORBSVCS_Time::zero (); - dep[0].rt_info = 0; - - CORBA::ULong count = 1; - for (HeadersIterator i = headers.begin (); i != headers.end (); ++i) - { - dep[count++].event.header = (*i).key (); - } -} - -void -TAO_EC_Basic_ObserverStrategy::fill_qos ( - RtecEventChannelAdmin::SupplierQOS &qos - ACE_ENV_ARG_DECL) -{ - Headers headers; - - TAO_EC_Accumulate_Consumer_Headers worker (headers); - this->event_channel_->for_each_supplier (&worker - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - qos.publications.length (static_cast<CORBA::ULong> (headers.current_size ())); - - CORBA::ULong count = 0; - for (HeadersIterator i = headers.begin (); i != headers.end (); ++i) - { - qos.publications[count++].event.header = (*i).key (); - } -} - - -// **************************************************************** - -TAO_EC_Reactive_ObserverStrategy::~TAO_EC_Reactive_ObserverStrategy (void) -{ -} - -void -TAO_EC_Reactive_ObserverStrategy::supplier_qos_update ( - TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL) -{ - if (consumer->publications ().is_gateway) - return; - - RtecEventChannelAdmin::SupplierQOS s_qos; - this->fill_qos (s_qos ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - Observer_Map copy; - this->create_observer_map (copy ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - Observer_Map_Iterator end = copy.end (); - for (Observer_Map_Iterator i = copy.begin (); - i != end; - ++i) - { - Observer_Entry& entry = (*i).int_id_; - ACE_TRY - { - entry.observer->update_supplier (s_qos ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCH (CORBA::OBJECT_NOT_EXIST, ex) - { - // Exception occured while updating observer, so remove it from the - // observer list - this->observer_not_exists (entry ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCH (CORBA::TRANSIENT, transient) - { - // Exception occured while updating observer, so remove it from the - // observer list - this->observer_not_exists (entry ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore all exceptions - } - ACE_ENDTRY; - } -} - -void -TAO_EC_Reactive_ObserverStrategy::consumer_qos_update ( - TAO_EC_ProxyPushSupplier *supplier - ACE_ENV_ARG_DECL) -{ - if (supplier->subscriptions ().is_gateway) - return; - - RtecEventChannelAdmin::ConsumerQOS c_qos; - this->fill_qos (c_qos ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - Observer_Map copy; - this->create_observer_map (copy ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - Observer_Map_Iterator end = copy.end (); - for (Observer_Map_Iterator i = copy.begin (); - i != end; - ++i) - { - Observer_Entry& entry = (*i).int_id_; - ACE_TRY - { - entry.observer->update_consumer (c_qos ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCH (CORBA::OBJECT_NOT_EXIST, ex) - { - // Exception occured while updating observer, so remove it from the - // observer list - this->observer_not_exists (entry ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCH (CORBA::TRANSIENT, transient) - { - // Exception occured while updating observer, so remove it from the - // observer list - this->observer_not_exists (entry ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore all exceptions - } - ACE_ENDTRY; - } -} - -int -TAO_EC_Reactive_ObserverStrategy::create_observer_map (Observer_Map &map - ACE_ENV_ARG_DECL) -{ - ACE_GUARD_THROW_EX (ACE_Lock, ace_mon, *this->lock_, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR()); - ACE_CHECK_RETURN (0); - - Observer_Map_Iterator end = this->observers_.end (); - for (Observer_Map_Iterator i = this->observers_.begin (); - i != end; - ++i) - { - Observer_Entry& entry = (*i).int_id_; - Observer_Entry copy (entry.handle, - RtecEventChannelAdmin::Observer::_duplicate (entry.observer.in ())); - if (map.bind (copy.handle, copy) == -1) - { - map.unbind_all(); - return 0; - } - } - - return map.current_size(); -} - -void -TAO_EC_Reactive_ObserverStrategy::observer_not_exists (Observer_Entry& observer - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - this->remove_observer(observer.handle ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore exceptions - } - ACE_ENDTRY; -} - -// **************************************************************** - -void -TAO_EC_Accumulate_Supplier_Headers::work (TAO_EC_ProxyPushSupplier *supplier - ACE_ENV_ARG_DECL_NOT_USED) -{ - const RtecEventChannelAdmin::ConsumerQOS& sub = - supplier->subscriptions (); - if (sub.is_gateway) - return; - for (CORBA::ULong j = 0; j < sub.dependencies.length (); ++j) - { - const RtecEventComm::Event& event = - sub.dependencies[j].event; - RtecEventComm::EventType type = event.header.type; - - if (0 < type && type < ACE_ES_EVENT_UNDEFINED) - continue; - this->headers_.insert (event.header, 1); - } -} - -// **************************************************************** - -void -TAO_EC_Accumulate_Consumer_Headers::work (TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL_NOT_USED) -{ - const RtecEventChannelAdmin::SupplierQOS& pub = - consumer->publications (); - if (pub.is_gateway) - return; - for (CORBA::ULong j = 0; j < pub.publications.length (); ++j) - { - const RtecEventComm::Event& event = - pub.publications[j].event; - RtecEventComm::EventType type = event.header.type; - - if (0 < type && type < ACE_ES_EVENT_UNDEFINED) - continue; - this->headers_.insert (event.header, 1); - } -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ObserverStrategy.h b/TAO/orbsvcs/orbsvcs/Event/EC_ObserverStrategy.h deleted file mode 100644 index 55b8874db7c..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ObserverStrategy.h +++ /dev/null @@ -1,362 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_ObserverStrategy.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * @author Johnny Willemsen (jwillemsen@remedy.nl) - * @author Kees van Marle (kvmarle@remedy.nl) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_OBSERVERSTRATEGY_H -#define TAO_EC_OBSERVERSTRATEGY_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/ESF/ESF_Worker.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Null_Mutex.h" -#include "ace/RB_Tree.h" -#include "ace/Map_Manager.h" - -#include "orbsvcs/RtecEventChannelAdminC.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -class ACE_Lock; -ACE_END_VERSIONED_NAMESPACE_DECL - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Event_Channel_Base; -class TAO_EC_ProxyPushConsumer; -class TAO_EC_ProxyPushSupplier; - -/** - * @class TAO_EC_ObserverStrategy - * - * @brief The strategy to handle observers for the Event Channel subscriptions - * and publication. - * - * The Event Channel supports Observers for the set of subscriptions and - * publications. This is used to implement federations of event channels, - * either through UDP (multicast and unicast) and/or regular CORBA calls. - * This behavior of the EC is strategized to avoid overhead when no gateways - * are needed. - */ -class TAO_RTEvent_Serv_Export TAO_EC_ObserverStrategy -{ -public: - /// Destructor - virtual ~TAO_EC_ObserverStrategy (void); - - /// The basic methods to support the EC strategies. - virtual RtecEventChannelAdmin::Observer_Handle - append_observer (RtecEventChannelAdmin::Observer_ptr - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR, - RtecEventChannelAdmin::EventChannel::CANT_APPEND_OBSERVER)) - = 0; - virtual void remove_observer ( - RtecEventChannelAdmin::Observer_Handle - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR, - RtecEventChannelAdmin::EventChannel::CANT_REMOVE_OBSERVER)) - = 0; - - /// Used by the EC to inform the ObserverStrategy that a Consumer has - /// connected or disconnected from it. - virtual void connected (TAO_EC_ProxyPushConsumer* - ACE_ENV_ARG_DECL_NOT_USED) = 0; - virtual void disconnected (TAO_EC_ProxyPushConsumer* - ACE_ENV_ARG_DECL_NOT_USED) = 0; - - /// Used by the EC to inform the ObserverStrategy that a Supplier has - /// connected or disconnected from it. - virtual void connected (TAO_EC_ProxyPushSupplier* - ACE_ENV_ARG_DECL_NOT_USED) = 0; - virtual void disconnected (TAO_EC_ProxyPushSupplier* - ACE_ENV_ARG_DECL_NOT_USED) = 0; -}; - -// **************************************************************** - -/** - * @class TAO_EC_Null_ObserverStrategy - * - * @brief A null observer strategy. - * - * This class keeps no information and simply ignores the messages - * from the EC. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Null_ObserverStrategy : public TAO_EC_ObserverStrategy -{ -public: - /// Constructor - TAO_EC_Null_ObserverStrategy (void); - - // = The TAO_EC_ObserverStrategy methods. - virtual RtecEventChannelAdmin::Observer_Handle - append_observer (RtecEventChannelAdmin::Observer_ptr - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR, - RtecEventChannelAdmin::EventChannel::CANT_APPEND_OBSERVER)); - virtual void remove_observer ( - RtecEventChannelAdmin::Observer_Handle - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR, - RtecEventChannelAdmin::EventChannel::CANT_REMOVE_OBSERVER)); - virtual void connected (TAO_EC_ProxyPushConsumer* - ACE_ENV_ARG_DECL_NOT_USED); - virtual void disconnected (TAO_EC_ProxyPushConsumer* - ACE_ENV_ARG_DECL_NOT_USED); - virtual void connected (TAO_EC_ProxyPushSupplier* - ACE_ENV_ARG_DECL_NOT_USED); - virtual void disconnected (TAO_EC_ProxyPushSupplier* - ACE_ENV_ARG_DECL_NOT_USED); -}; - -// **************************************************************** - -/** - * @class TAO_EC_Basic_ObserverStrategy - * - * @brief A simple observer strategy. - * - * This class simply keeps the information about the current list - * of observers, whenever the list of consumers and/or suppliers - * changes in queries the EC, computes the global subscription - * and/or publication list and sends the update message to all the - * observers. - * - * <H2>Memory Management</H2> - * It assumes ownership of the @a lock, but not of the - * Event_Channel. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Basic_ObserverStrategy : - public TAO_EC_ObserverStrategy -{ -public: - /// Constructor - TAO_EC_Basic_ObserverStrategy (TAO_EC_Event_Channel_Base* ec, - ACE_Lock* lock); - - /// Destructor - virtual ~TAO_EC_Basic_ObserverStrategy (void); - - // = The TAO_EC_ObserverStrategy methods. - virtual RtecEventChannelAdmin::Observer_Handle - append_observer (RtecEventChannelAdmin::Observer_ptr - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR, - RtecEventChannelAdmin::EventChannel::CANT_APPEND_OBSERVER)); - virtual void remove_observer ( - RtecEventChannelAdmin::Observer_Handle - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR, - RtecEventChannelAdmin::EventChannel::CANT_REMOVE_OBSERVER)); - virtual void connected (TAO_EC_ProxyPushConsumer* - ACE_ENV_ARG_DECL_NOT_USED); - virtual void disconnected (TAO_EC_ProxyPushConsumer* - ACE_ENV_ARG_DECL_NOT_USED); - virtual void connected (TAO_EC_ProxyPushSupplier* - ACE_ENV_ARG_DECL_NOT_USED); - virtual void disconnected (TAO_EC_ProxyPushSupplier* - ACE_ENV_ARG_DECL_NOT_USED); - - /** - * @struct Observer_Entry - * - * @brief The data kept for each observer. - * - * The observer and its handle are kept in a simple structure. - * In the future this structure could contain QoS information, - * such as: - * + how often do we update the observer? - * + When was the last update. - * + Does it want to receive all changes? - */ - struct Observer_Entry - { - Observer_Entry (void); - Observer_Entry (RtecEventChannelAdmin::Observer_Handle h, - RtecEventChannelAdmin::Observer_ptr o); - - /// The handle - RtecEventChannelAdmin::Observer_Handle handle; - - /// The observer - RtecEventChannelAdmin::Observer_var observer; - }; - - struct Header_Compare - { - int operator () (const RtecEventComm::EventHeader& lhs, - const RtecEventComm::EventHeader& rhs) const; - }; - - typedef ACE_Map_Manager<RtecEventChannelAdmin::Observer_Handle,Observer_Entry,ACE_Null_Mutex> Observer_Map; - typedef ACE_Map_Iterator<RtecEventChannelAdmin::Observer_Handle,Observer_Entry,ACE_Null_Mutex> Observer_Map_Iterator; - - - typedef ACE_RB_Tree<RtecEventComm::EventHeader,int,Header_Compare,ACE_Null_Mutex> Headers; - typedef ACE_RB_Tree_Iterator<RtecEventComm::EventHeader,int,Header_Compare,ACE_Null_Mutex> HeadersIterator; - -protected: - /// Helpers. - //@{ - /// Recompute EC consumer subscriptions and send them out to all observers. - virtual void consumer_qos_update (TAO_EC_ProxyPushSupplier *supplier - ACE_ENV_ARG_DECL); - - /// Recompute EC supplier publications and send them out to all observers. - virtual void supplier_qos_update (TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL); - - /// Compute consumer QOS. - void fill_qos (RtecEventChannelAdmin::ConsumerQOS &qos - ACE_ENV_ARG_DECL); - /// Compute supplier QOS. - void fill_qos (RtecEventChannelAdmin::SupplierQOS &qos - ACE_ENV_ARG_DECL); - - /// Copies all current observers into an array and passes it - /// back to the caller through @a lst. Returns the size of the array. - int create_observer_list (RtecEventChannelAdmin::Observer_var *&lst - ACE_ENV_ARG_DECL); - //@} - -protected: - /// The event channel. - TAO_EC_Event_Channel_Base* event_channel_; - - /// The lock - ACE_Lock* lock_; - - /// The handles are generated in sequential order, but are opaque to - /// the client. - RtecEventChannelAdmin::Observer_Handle handle_generator_; - - /// Keep the set of Observers - Observer_Map observers_; -}; - -// **************************************************************** - -/** - * @class TAO_EC_Reactive_ObserverStrategy - * - * @brief A reactive observer strategy. - * - * This class simply keeps the information about the current list - * of observers, whenever the list of consumers and/or suppliers - * changes in queries the EC, computes the global subscription - * and/or publication list and sends the update message to all the - * observers. When an observer isn't reachable it is removed from - * the observer list. - * - * <H2>Memory Management</H2> - * It assumes ownership of the <lock>, but not of the - * Event_Channel. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Reactive_ObserverStrategy : - public TAO_EC_Basic_ObserverStrategy -{ -public: - /// Constructor - TAO_EC_Reactive_ObserverStrategy (TAO_EC_Event_Channel_Base* ec, - ACE_Lock* lock); - - /// Destructor - virtual ~TAO_EC_Reactive_ObserverStrategy (void); - -protected: - /// Helpers. - //@{ - /// Recompute EC consumer subscriptions and send them out to all observers. - virtual void consumer_qos_update (TAO_EC_ProxyPushSupplier *supplier - ACE_ENV_ARG_DECL); - - /// Recompute EC supplier publications and send them out to all observers. - virtual void supplier_qos_update (TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL); - - /** - * Copies all current observers into a map and passes it - * back to the caller through @a map. - * @return Returns the size of the map. - */ - int create_observer_map (Observer_Map &map - ACE_ENV_ARG_DECL); - - /// The observer doesn't exist anymore - void observer_not_exists (Observer_Entry& observer - ACE_ENV_ARG_DECL); - //@} -}; - -// **************************************************************** - -class TAO_EC_Accumulate_Supplier_Headers : - public TAO_ESF_Worker<TAO_EC_ProxyPushSupplier> -{ -public: - /// Constructor - TAO_EC_Accumulate_Supplier_Headers (TAO_EC_Basic_ObserverStrategy::Headers &headers); - - virtual void work (TAO_EC_ProxyPushSupplier *supplier - ACE_ENV_ARG_DECL); - -private: - TAO_EC_Basic_ObserverStrategy::Headers &headers_; -}; - -// **************************************************************** - -class TAO_EC_Accumulate_Consumer_Headers : - public TAO_ESF_Worker<TAO_EC_ProxyPushConsumer> -{ -public: - /// Constructor - TAO_EC_Accumulate_Consumer_Headers (TAO_EC_Basic_ObserverStrategy::Headers &headers); - - virtual void work (TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL); - -private: - TAO_EC_Basic_ObserverStrategy::Headers &headers_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_ObserverStrategy.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_OBSERVERSTRATEGY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ObserverStrategy.i b/TAO/orbsvcs/orbsvcs/Event/EC_ObserverStrategy.i deleted file mode 100644 index 231db3f9417..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ObserverStrategy.i +++ /dev/null @@ -1,81 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_Null_ObserverStrategy::TAO_EC_Null_ObserverStrategy (void) -{ -} - -// **************************************************************** - -ACE_INLINE -TAO_EC_Basic_ObserverStrategy::Observer_Entry::Observer_Entry (void) - : handle (0) -{ -} - -ACE_INLINE -TAO_EC_Basic_ObserverStrategy::Observer_Entry:: - Observer_Entry (RtecEventChannelAdmin::Observer_Handle h, - RtecEventChannelAdmin::Observer_ptr o) - : handle (h), - observer (o) -{ -} - -// **************************************************************** - -ACE_INLINE int -TAO_EC_Basic_ObserverStrategy::Header_Compare:: - operator () (const RtecEventComm::EventHeader& lhs, - const RtecEventComm::EventHeader& rhs) const -{ - if (lhs.source == rhs.source) - return lhs.type < rhs.type; - return lhs.source < rhs.source; -} - -// **************************************************************** - -ACE_INLINE -TAO_EC_Basic_ObserverStrategy:: - TAO_EC_Basic_ObserverStrategy (TAO_EC_Event_Channel_Base* ec, - ACE_Lock* lock) - : event_channel_ (ec), - lock_ (lock), - handle_generator_ (1) -{ -} - -// **************************************************************** - -ACE_INLINE -TAO_EC_Reactive_ObserverStrategy:: - TAO_EC_Reactive_ObserverStrategy (TAO_EC_Event_Channel_Base* ec, - ACE_Lock* lock) - : TAO_EC_Basic_ObserverStrategy (ec, lock) -{ -} - -// **************************************************************** - -ACE_INLINE -TAO_EC_Accumulate_Supplier_Headers:: - TAO_EC_Accumulate_Supplier_Headers (TAO_EC_Basic_ObserverStrategy::Headers &h) - : headers_ (h) -{ -} - -// **************************************************************** - -ACE_INLINE -TAO_EC_Accumulate_Consumer_Headers:: - TAO_EC_Accumulate_Consumer_Headers (TAO_EC_Basic_ObserverStrategy::Headers &h) - : headers_ (h) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Per_Supplier_Filter.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Per_Supplier_Filter.cpp deleted file mode 100644 index fe0ed5c6cc8..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Per_Supplier_Filter.cpp +++ /dev/null @@ -1,213 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Per_Supplier_Filter.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "orbsvcs/Event/EC_ProxySupplier.h" -#include "orbsvcs/Event/EC_ProxyConsumer.h" -#include "orbsvcs/Event/EC_Scheduling_Strategy.h" -#include "orbsvcs/Event/EC_QOS_Info.h" - -#include "orbsvcs/ESF/ESF_Proxy_Collection.h" - -#include "orbsvcs/Event_Service_Constants.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Per_Supplier_Filter.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, EC_Per_Supplier_Filter, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Per_Supplier_Filter:: - TAO_EC_Per_Supplier_Filter (TAO_EC_Event_Channel_Base* ec) - : event_channel_ (ec), - consumer_ (0), - refcnt_ (1) -{ - this->event_channel_->create_proxy_collection (this->collection_); -} - -TAO_EC_Per_Supplier_Filter::~TAO_EC_Per_Supplier_Filter (void) -{ - this->event_channel_->destroy_proxy_collection (this->collection_); - this->collection_ = 0; -} - -void -TAO_EC_Per_Supplier_Filter::bind (TAO_EC_ProxyPushConsumer* consumer) -{ - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - - if (this->consumer_ != 0) - return; - - this->consumer_ = consumer; -} - -void -TAO_EC_Per_Supplier_Filter::unbind (TAO_EC_ProxyPushConsumer* consumer) -{ - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - - if (this->consumer_ == 0 || this->consumer_ != consumer) - return; - - this->consumer_ = 0; - - ACE_TRY_NEW_ENV - { - this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // @@ Ignore exceptions - } - ACE_ENDTRY; -} - -void -TAO_EC_Per_Supplier_Filter::connected (TAO_EC_ProxyPushSupplier* supplier - ACE_ENV_ARG_DECL) -{ - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - - if (this->consumer_ == 0) - return; - - const RtecEventChannelAdmin::SupplierQOS& pub = - this->consumer_->publications_i (); - - for (CORBA::ULong j = 0; j < pub.publications.length (); ++j) - { - const RtecEventComm::Event& event = - pub.publications[j].event; - -#if TAO_EC_ENABLE_DEBUG_MESSAGES - ACE_DEBUG ((LM_DEBUG, "Connecting consumer <%x> to <%x>, " - "trying event <%d:%d> ", - supplier, this, - event.header.source, event.header.type)); -#endif /* TAO_EC_ENABLED_DEBUG_MESSAGES */ - if (supplier->can_match (event.header)) - { -#if TAO_EC_ENABLE_DEBUG_MESSAGES - ACE_DEBUG ((LM_DEBUG, " matched\n")); -#endif /* TAO_EC_ENABLED_DEBUG_MESSAGES */ - this->collection_->connected (supplier ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - return; - } -#if TAO_EC_ENABLE_DEBUG_MESSAGES - ACE_DEBUG ((LM_DEBUG, " not matched\n")); -#endif /* TAO_EC_ENABLED_DEBUG_MESSAGES */ - } -} - -void -TAO_EC_Per_Supplier_Filter::reconnected (TAO_EC_ProxyPushSupplier* supplier - ACE_ENV_ARG_DECL) -{ - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - - if (this->consumer_ == 0) - return; - - const RtecEventChannelAdmin::SupplierQOS& pub = - this->consumer_->publications_i (); - - for (CORBA::ULong j = 0; j < pub.publications.length (); ++j) - { - const RtecEventComm::Event& event = - pub.publications[j].event; - - // ACE_DEBUG ((LM_DEBUG, "Trying %d:%d in %x\n", - // event.header.source, event.header.type, - // this)); - if (supplier->can_match (event.header)) - { - // ACE_DEBUG ((LM_DEBUG, " matched %x\n", supplier)); - this->collection_->connected (supplier ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - return; - } - } - this->collection_->disconnected (supplier ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Per_Supplier_Filter::disconnected (TAO_EC_ProxyPushSupplier* supplier - ACE_ENV_ARG_DECL) -{ - this->collection_->disconnected (supplier ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Per_Supplier_Filter::shutdown (ACE_ENV_SINGLE_ARG_DECL) -{ - this->collection_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -void -TAO_EC_Per_Supplier_Filter::push (const RtecEventComm::EventSet& event, - TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL) -{ - TAO_EC_Scheduling_Strategy* scheduling_strategy = - this->event_channel_->scheduling_strategy (); - scheduling_strategy->schedule_event (event, - consumer, - this - ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Per_Supplier_Filter::push_scheduled_event (RtecEventComm::EventSet &event, - const TAO_EC_QOS_Info &event_info - ACE_ENV_ARG_DECL) -{ - TAO_EC_Filter_Worker worker (event, event_info); - this->collection_->for_each (&worker ACE_ENV_ARG_PARAMETER); -} - -CORBA::ULong -TAO_EC_Per_Supplier_Filter::_incr_refcnt (void) -{ - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); - - this->refcnt_++; - return this->refcnt_; -} - -CORBA::ULong -TAO_EC_Per_Supplier_Filter::_decr_refcnt (void) -{ - { - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); - - this->refcnt_--; - if (this->refcnt_ != 0) - return this->refcnt_; - } - this->event_channel_->supplier_filter_builder ()->destroy (this); - return 0; -} - -// **************************************************************** - -TAO_EC_Supplier_Filter* -TAO_EC_Per_Supplier_Filter_Builder::create ( - RtecEventChannelAdmin::SupplierQOS&) -{ - return new TAO_EC_Per_Supplier_Filter (this->event_channel_); -} - -void -TAO_EC_Per_Supplier_Filter_Builder::destroy ( - TAO_EC_Supplier_Filter* x) -{ - delete x; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Per_Supplier_Filter.h b/TAO/orbsvcs/orbsvcs/Event/EC_Per_Supplier_Filter.h deleted file mode 100644 index 868c15d4e00..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Per_Supplier_Filter.h +++ /dev/null @@ -1,122 +0,0 @@ -// -*- C++ -*- -/** - * @file EC_Per_Supplier_Filter.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_PER_SUPPLIER_FILTER_H -#define TAO_EC_PER_SUPPLIER_FILTER_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Supplier_Filter.h" -#include "orbsvcs/Event/EC_Supplier_Filter_Builder.h" -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -template<class PROXY> class TAO_ESF_Proxy_Collection; -class TAO_EC_Event_Channel_Base; - -/** - * @class TAO_EC_Per_Supplier_Filter - * - * @brief Filter the events on each supplier. - * - * This is a filtering strategy for the suppliers. In this - * particular case we keep a collection of the consumers that - * could potentially be interested in any event generated by a - * particular supplier. - * This minimizes the amount of consumers touched by the EC when - * dispatching an event. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Per_Supplier_Filter : public TAO_EC_Supplier_Filter -{ -public: - /// Constructor - TAO_EC_Per_Supplier_Filter (TAO_EC_Event_Channel_Base* ec); - - /// Destructor - virtual ~TAO_EC_Per_Supplier_Filter (void); - - // = The TAO_EC_Supplier_Filter methods. - virtual void bind (TAO_EC_ProxyPushConsumer* consumer); - virtual void unbind (TAO_EC_ProxyPushConsumer* consumer); - virtual void connected (TAO_EC_ProxyPushSupplier* supplier - ACE_ENV_ARG_DECL); - virtual void reconnected (TAO_EC_ProxyPushSupplier* supplier - ACE_ENV_ARG_DECL); - virtual void disconnected (TAO_EC_ProxyPushSupplier* supplier - ACE_ENV_ARG_DECL); - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL); - virtual void push (const RtecEventComm::EventSet& event, - TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL_NOT_USED); - virtual void push_scheduled_event (RtecEventComm::EventSet &event, - const TAO_EC_QOS_Info &event_info - ACE_ENV_ARG_DECL); - virtual CORBA::ULong _decr_refcnt (void); - virtual CORBA::ULong _incr_refcnt (void); - -private: - /// The event channel, used to locate the set of consumers. - TAO_EC_Event_Channel_Base *event_channel_; - - /// The proxy for the supplier we are bound to. - TAO_EC_ProxyPushConsumer* consumer_; - - /// Keep the collection of proxies for the consumers that may be - /// interested in our events. - TAO_ESF_Proxy_Collection<TAO_EC_ProxyPushSupplier>* collection_; - - /// Reference counting - CORBA::ULong refcnt_; - - /// Locking - TAO_SYNCH_MUTEX lock_; -}; - -// **************************************************************** - -/** - * @class TAO_EC_Per_Supplier_Filter_Builder - * - * @brief Create Per_Supplier_Filter objects - * - */ -class TAO_RTEvent_Serv_Export TAO_EC_Per_Supplier_Filter_Builder : public TAO_EC_Supplier_Filter_Builder -{ -public: - /// constructor.... - TAO_EC_Per_Supplier_Filter_Builder (TAO_EC_Event_Channel_Base* ec); - - // = The TAO_EC_Supplier_Filter_Builder methods... - virtual TAO_EC_Supplier_Filter* - create (RtecEventChannelAdmin::SupplierQOS& qos); - virtual void - destroy (TAO_EC_Supplier_Filter *filter); - -private: - /// The event channel - TAO_EC_Event_Channel_Base* event_channel_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Per_Supplier_Filter.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* TAO_EC_PER_SUPPLIER_FILTER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Per_Supplier_Filter.i b/TAO/orbsvcs/orbsvcs/Event/EC_Per_Supplier_Filter.i deleted file mode 100644 index 4c950811fcc..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Per_Supplier_Filter.i +++ /dev/null @@ -1,14 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_Per_Supplier_Filter_Builder:: -TAO_EC_Per_Supplier_Filter_Builder (TAO_EC_Event_Channel_Base* ec) - : event_channel_ (ec) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Prefix_Filter_Builder.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Prefix_Filter_Builder.cpp deleted file mode 100644 index 61b79c68726..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Prefix_Filter_Builder.cpp +++ /dev/null @@ -1,158 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event_Service_Constants.h" -#include "orbsvcs/Event/EC_Prefix_Filter_Builder.h" -#include "orbsvcs/Event/EC_Type_Filter.h" -#include "orbsvcs/Event/EC_Conjunction_Filter.h" -#include "orbsvcs/Event/EC_Disjunction_Filter.h" -#include "orbsvcs/Event/EC_And_Filter.h" -#include "orbsvcs/Event/EC_Negation_Filter.h" -#include "orbsvcs/Event/EC_Bitmask_Filter.h" -#include "orbsvcs/Event/EC_Masked_Type_Filter.h" -#include "orbsvcs/Event/EC_Timeout_Filter.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Prefix_Filter_Builder.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, EC_Prefix_Filter_Builder, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Prefix_Filter_Builder::~TAO_EC_Prefix_Filter_Builder (void) -{ -} - -TAO_EC_Filter* -TAO_EC_Prefix_Filter_Builder::build ( - TAO_EC_ProxyPushSupplier *supplier, - RtecEventChannelAdmin::ConsumerQOS& qos - ACE_ENV_ARG_DECL_NOT_USED) const -{ - CORBA::ULong pos = 0; - return this->recursive_build (supplier, qos, pos); -} - -TAO_EC_Filter* -TAO_EC_Prefix_Filter_Builder:: recursive_build ( - TAO_EC_ProxyPushSupplier *supplier, - RtecEventChannelAdmin::ConsumerQOS& qos, - CORBA::ULong& pos) const -{ - CORBA::ULong l = qos.dependencies.length (); - if (pos == l) - return 0; - - const RtecEventComm::Event& e = qos.dependencies[pos].event; - if (e.header.type == ACE_ES_CONJUNCTION_DESIGNATOR) - { - pos++; // Consume the designator - CORBA::ULong n = e.header.source; - - TAO_EC_Filter** children; - ACE_NEW_RETURN (children, TAO_EC_Filter*[n], 0); - CORBA::ULong i = 0; - for (; i != n; ++i) - { - children[i] = this->recursive_build (supplier, qos, pos); - } - return new TAO_EC_Conjunction_Filter (children, n); - } - else if (e.header.type == ACE_ES_DISJUNCTION_DESIGNATOR) - { - pos++; // Consume the designator - CORBA::ULong n = e.header.source; - - TAO_EC_Filter** children; - ACE_NEW_RETURN (children, TAO_EC_Filter*[n], 0); - CORBA::ULong i = 0; - for (; i != n; ++i) - { - children[i] = this->recursive_build (supplier, qos, pos); - } - return new TAO_EC_Disjunction_Filter (children, n); - } - - else if (e.header.type == ACE_ES_LOGICAL_AND_DESIGNATOR) - { - pos++; // Consume the designator - CORBA::ULong n = e.header.source; - - TAO_EC_Filter** children; - ACE_NEW_RETURN (children, TAO_EC_Filter*[n], 0); - CORBA::ULong i = 0; - for (; i != n; ++i) - { - children[i] = this->recursive_build (supplier, qos, pos); - } - return new TAO_EC_And_Filter (children, n); - } - - else if (e.header.type == ACE_ES_NEGATION_DESIGNATOR) - { - pos++; // Consume the designator - - TAO_EC_Filter *child = - this->recursive_build (supplier, qos, pos); - return new TAO_EC_Negation_Filter (child); - } - else if (e.header.type == ACE_ES_BITMASK_DESIGNATOR) - { - pos++; // COnsumer the designator - - if (pos == qos.dependencies.length ()) - return 0; - CORBA::ULong source_mask = qos.dependencies[pos].event.header.source; - CORBA::ULong type_mask = qos.dependencies[pos].event.header.type; - pos++; - - TAO_EC_Filter *child = - this->recursive_build (supplier, qos, pos); - return new TAO_EC_Bitmask_Filter (source_mask, - type_mask, - child); - } - else if (e.header.type == ACE_ES_MASKED_TYPE_DESIGNATOR) - { - pos++; // Consume the designator - - if (pos == qos.dependencies.length ()) - return 0; - CORBA::ULong source_mask = qos.dependencies[pos].event.header.source; - CORBA::ULong type_mask = qos.dependencies[pos].event.header.type; - pos++; - - if (pos == qos.dependencies.length ()) - return 0; - CORBA::ULong source_value = qos.dependencies[pos].event.header.source; - CORBA::ULong type_value = qos.dependencies[pos].event.header.type; - pos++; - - return new TAO_EC_Masked_Type_Filter (source_mask, - type_mask, - source_value, - type_value); - } - else if (e.header.type == ACE_ES_NULL_DESIGNATOR) - { - pos++; // Consume the designator - - return new TAO_EC_Null_Filter (); - } - else if (e.header.type == ACE_ES_EVENT_TIMEOUT - || e.header.type == ACE_ES_EVENT_INTERVAL_TIMEOUT - || e.header.type == ACE_ES_EVENT_DEADLINE_TIMEOUT) - { - pos++; // Consume the designator - TAO_EC_QOS_Info qos_info; - return new TAO_EC_Timeout_Filter (this->event_channel_, - supplier, - qos_info, - e.header.type, - e.header.creation_time); - } - pos++; // Consume the event - return new TAO_EC_Type_Filter (e.header); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Prefix_Filter_Builder.h b/TAO/orbsvcs/orbsvcs/Event/EC_Prefix_Filter_Builder.h deleted file mode 100644 index 7938278e895..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Prefix_Filter_Builder.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- C++ -*- */ -/** - * @file EC_Prefix_Filter_Builder.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_PREFIX_FILTER_BUILDER_H -#define TAO_EC_PREFIX_FILTER_BUILDER_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Filter_Builder.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Filter; -class TAO_EC_Event_Channel_Base; - -/** - * @class TAO_EC_Prefix_Filter_Builder - * - * @brief Implement a builder for the fundamental filters. - * - * The prefix filtering mechanisms in the Event channel - * (source/type based filtering + disjunctions and conjunctions) - * are constructed using this class. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Prefix_Filter_Builder : public TAO_EC_Filter_Builder -{ -public: - /// constructor. - TAO_EC_Prefix_Filter_Builder (TAO_EC_Event_Channel_Base* ec); - - /// destructor... - virtual ~TAO_EC_Prefix_Filter_Builder (void); - - // = The TAO_EC_Filter_Builder methods... - TAO_EC_Filter* build (TAO_EC_ProxyPushSupplier *supplier, - RtecEventChannelAdmin::ConsumerQOS& qos - ACE_ENV_ARG_DECL) const; - -private: - /// Recursively build the filter tree. - TAO_EC_Filter* recursive_build (TAO_EC_ProxyPushSupplier *supplier, - RtecEventChannelAdmin::ConsumerQOS& qos, - CORBA::ULong& pos) const; - -private: - /// The event channel. - TAO_EC_Event_Channel_Base* event_channel_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Prefix_Filter_Builder.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* TAO_EC_PREFIX_FILTER_BUILDER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Prefix_Filter_Builder.i b/TAO/orbsvcs/orbsvcs/Event/EC_Prefix_Filter_Builder.i deleted file mode 100644 index c4ddf4074b0..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Prefix_Filter_Builder.i +++ /dev/null @@ -1,14 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_Prefix_Filter_Builder:: - TAO_EC_Prefix_Filter_Builder (TAO_EC_Event_Channel_Base *ec) - : event_channel_ (ec) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Priority_Dispatching.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Priority_Dispatching.cpp deleted file mode 100644 index 1e41905c0ca..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Priority_Dispatching.cpp +++ /dev/null @@ -1,141 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Priority_Dispatching.h" -#include "orbsvcs/Event/EC_Dispatching_Task.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "orbsvcs/Event/EC_QOS_Info.h" - -#include "orbsvcs/Event_Service_Constants.h" -#include "orbsvcs/RtecSchedulerC.h" - -#include "ace/Sched_Params.h" - -ACE_RCSID(Event, EC_Priority_Dispatching, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Priority_Dispatching::TAO_EC_Priority_Dispatching (TAO_EC_Event_Channel_Base *ec) - : ntasks_ (0), - tasks_ (0) -{ - CORBA::Object_var tmp = ec->scheduler (); - this->scheduler_ = RtecScheduler::Scheduler::_narrow (tmp.in ()); -} - -void -TAO_EC_Priority_Dispatching::activate (void) -{ - if (this->tasks_ != 0) - return; - - // @@ Query the scheduler to obtain this.... - this->ntasks_ = ACE_Scheduler_MAX_PRIORITIES; - ACE_NEW (this->tasks_, TAO_EC_Dispatching_Task*[this->ntasks_]); - - // @@ Query the scheduler to obtain the priorities! - int priority = - (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) + - ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; - priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO, priority); - - ACE_DECLARE_NEW_CORBA_ENV; - for (int i = 0; i < this->ntasks_; ++i) - { - ACE_TRY - { - RtecScheduler::Period_t period = - ACE_CU64_TO_CU32 (ACE_Scheduler_Rates[i]); - char buf[128]; - ACE_OS::sprintf (buf, "Dispatching_Task-%d.us", period); - - RtecScheduler::handle_t rt_info = - this->scheduler_->create (buf ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - this->scheduler_->set (rt_info, - RtecScheduler::VERY_LOW_CRITICALITY, - 0, // worst_cast_execution_time - 0, // typical_cast_execution_time - 0, // cached_cast_execution_time - period, - RtecScheduler::VERY_LOW_IMPORTANCE, - 0, // quantum - 1, // threads - RtecScheduler::OPERATION - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore exceptions.. - } - ACE_ENDTRY; - - ACE_NEW (this->tasks_[i], - TAO_EC_Dispatching_Task (&this->thread_manager_)); - - // @@ Query the scheduler to obtain the priority... - long flags = THR_BOUND | THR_SCHED_FIFO; - if (this->tasks_[i]->activate (flags, 1, 1, priority) == -1) - { - flags = THR_BOUND; - priority = ACE_Sched_Params::priority_min (ACE_SCHED_OTHER, - ACE_SCOPE_THREAD); - if (this->tasks_[i]->activate (flags, 1, 1, priority) == -1) - ACE_ERROR ((LM_ERROR, - "EC (%P|%t) cannot activate queue %d", i)); - } - } -} - -void -TAO_EC_Priority_Dispatching::shutdown (void) -{ - if (this->tasks_ == 0) - return; - - for (int i = 0; i < this->ntasks_; ++i) - this->tasks_[i]->putq (new TAO_EC_Shutdown_Task_Command); - - this->thread_manager_.wait (); - - for (int j = 0; j < this->ntasks_; ++j) - delete this->tasks_[j]; - - delete[] this->tasks_; - this->tasks_ = 0; -} - -void -TAO_EC_Priority_Dispatching::push (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - RtecEventComm::EventSet event_copy = event; - this->push_nocopy (proxy, consumer, event_copy, qos_info ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Priority_Dispatching::push_nocopy (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - if (this->tasks_ == 0) - this->activate (); - - int i = qos_info.preemption_priority; - if (i < 0 || i >= this->ntasks_) - { - // @@ Throw something? - i = 0; - } - - - this->tasks_[i]->push (proxy, consumer, event ACE_ENV_ARG_PARAMETER); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Priority_Dispatching.h b/TAO/orbsvcs/orbsvcs/Event/EC_Priority_Dispatching.h deleted file mode 100644 index ebbb6cd6085..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Priority_Dispatching.h +++ /dev/null @@ -1,90 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Priority_Dispatching.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_PRIORITY_DISPATCHING_H -#define TAO_EC_PRIORITY_DISPATCHING_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Dispatching.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/RtecSchedulerC.h" -#include "orbsvcs/Event/sched_event_export.h" - -#include "ace/Thread_Manager.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Dispatching_Task; -class TAO_EC_Event_Channel_Base; - -/** - * @class TAO_EC_Priority_Dispatching - * - * @brief Dispatching strategy that minimizes priority inversion. - * - * This strategy uses multiple queues, each serviced by a thread - * at different priority. This minimizes priority inversion - * because the consumers at higher priority are serviced before - * consumers at lower priority. - * It is more flexible than using the supplier thread to dispatch - * because it allows high-priority suppliers to push events to - * low-priority consumers (and vice-versa). - * It also isolates the supplier threads from the time spent on - * upcalls to the consumer objects, making the system easier to - * analyze and schedule. - */ -class TAO_RTSchedEvent_Export TAO_EC_Priority_Dispatching : public TAO_EC_Dispatching -{ -public: - /// The scheduler is used to find the range of priorities and similar - /// info. - TAO_EC_Priority_Dispatching (TAO_EC_Event_Channel_Base* ec); - - // = The EC_Dispatching methods. - virtual void activate (void); - virtual void shutdown (void); - virtual void push (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push_nocopy (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - -private: - /// Use our own thread manager. - ACE_Thread_Manager thread_manager_; - - /// The number of active tasks - int ntasks_; - - /// The tasks.. - TAO_EC_Dispatching_Task** tasks_; - - /// The scheduler - RtecScheduler::Scheduler_var scheduler_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* TAO_EC_PRIORITY_DISPATCHING_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Priority_Scheduling.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Priority_Scheduling.cpp deleted file mode 100644 index 0bf92510d54..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Priority_Scheduling.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Priority_Scheduling.h" -#include "orbsvcs/Event/EC_QOS_Info.h" -#include "orbsvcs/Event/EC_ProxyConsumer.h" -#include "orbsvcs/Event/EC_ProxySupplier.h" -#include "orbsvcs/Event/EC_Supplier_Filter.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Priority_Scheduling.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, EC_Priority_Scheduling, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Priority_Scheduling::~TAO_EC_Priority_Scheduling (void) -{ -} - -void -TAO_EC_Priority_Scheduling::add_proxy_supplier_dependencies ( - TAO_EC_ProxyPushSupplier *supplier, - TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL) -{ - ACE_DEBUG ((LM_DEBUG, "add_proxy_supplier_dependencies - %x %x\n", - supplier, consumer)); - const RtecEventChannelAdmin::SupplierQOS& qos = - consumer->publications (); - for (CORBA::ULong i = 0; i < qos.publications.length (); ++i) - { - const RtecEventComm::EventHeader &header = - qos.publications[i].event.header; - TAO_EC_QOS_Info qos_info; - qos_info.rt_info = qos.publications[i].dependency_info.rt_info; - - RtecScheduler::OS_Priority os_priority; - RtecScheduler::Preemption_Subpriority_t p_subpriority; - RtecScheduler::Preemption_Priority_t p_priority; - this->scheduler_->priority (qos_info.rt_info, - os_priority, - p_subpriority, - p_priority - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - qos_info.preemption_priority = p_priority; - - supplier->add_dependencies (header, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } -} - -void -TAO_EC_Priority_Scheduling::schedule_event (const RtecEventComm::EventSet &event, - TAO_EC_ProxyPushConsumer *consumer, - TAO_EC_Supplier_Filter *filter - ACE_ENV_ARG_DECL) -{ - RtecEventChannelAdmin::SupplierQOS qos = - consumer->publications (); - - for (CORBA::ULong j = 0; j != event.length (); ++j) - { - const RtecEventComm::Event& e = event[j]; - RtecEventComm::Event* buffer = - const_cast<RtecEventComm::Event*> (&e); - RtecEventComm::EventSet single_event (1, 1, buffer, 0); - - TAO_EC_QOS_Info qos_info; - - for (CORBA::ULong i = 0; i != qos.publications.length (); ++i) - { - const RtecEventComm::EventHeader &qos_header = - qos.publications[i].event.header; - - if (TAO_EC_Filter::matches (e.header, qos_header) == 0) - continue; - - qos_info.rt_info = qos.publications[i].dependency_info.rt_info; - - RtecScheduler::OS_Priority os_priority; - RtecScheduler::Preemption_Subpriority_t p_subpriority; - RtecScheduler::Preemption_Priority_t p_priority; - this->scheduler_->priority (qos_info.rt_info, - os_priority, - p_subpriority, - p_priority - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - qos_info.preemption_priority = p_priority; - } - - filter->push_scheduled_event (single_event, qos_info - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Priority_Scheduling.h b/TAO/orbsvcs/orbsvcs/Event/EC_Priority_Scheduling.h deleted file mode 100644 index ef5be319f06..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Priority_Scheduling.h +++ /dev/null @@ -1,76 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Priority_Scheduling.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_PRIORITY_SCHEDULING_H -#define TAO_EC_PRIORITY_SCHEDULING_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Scheduling_Strategy.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/RtecSchedulerC.h" -#include "orbsvcs/Event/sched_event_export.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Priority_Scheduling - * - * @brief A scheduling strategy that uses TAO's real-time scheduler - * - * This implementation of the Scheduling_Strategy uses TAO's - * real-time scheduler. - */ -class TAO_RTSchedEvent_Export TAO_EC_Priority_Scheduling : public TAO_EC_Scheduling_Strategy -{ -public: - /// Constructor. - TAO_EC_Priority_Scheduling (RtecScheduler::Scheduler_ptr scheduler); - - /// Destructor - virtual ~TAO_EC_Priority_Scheduling (void); - - virtual void add_proxy_supplier_dependencies ( - TAO_EC_ProxyPushSupplier *supplier, - TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL); - virtual void schedule_event (const RtecEventComm::EventSet &event, - TAO_EC_ProxyPushConsumer *consumer, - TAO_EC_Supplier_Filter *filter - ACE_ENV_ARG_DECL); - -private: - TAO_EC_Priority_Scheduling (const TAO_EC_Priority_Scheduling&); - TAO_EC_Priority_Scheduling& operator= (const TAO_EC_Priority_Scheduling&); - - /// Initialize our RT_Info handle and dependencies - void init_rt_info (ACE_ENV_SINGLE_ARG_DECL); - -private: - /// The scheduler we are going to use - RtecScheduler::Scheduler_var scheduler_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Priority_Scheduling.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* TAO_EC_PRIORITY_SCHEDULING_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Priority_Scheduling.i b/TAO/orbsvcs/orbsvcs/Event/EC_Priority_Scheduling.i deleted file mode 100644 index 2de353d965e..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Priority_Scheduling.i +++ /dev/null @@ -1,14 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_Priority_Scheduling::TAO_EC_Priority_Scheduling ( - RtecScheduler::Scheduler_ptr scheduler) - : scheduler_ (RtecScheduler::Scheduler::_duplicate (scheduler)) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp deleted file mode 100644 index f16960141c1..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp +++ /dev/null @@ -1,310 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_ProxyConsumer.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "orbsvcs/Event/EC_Supplier_Filter.h" -#include "orbsvcs/Event/EC_Supplier_Filter_Builder.h" - -#include "ace/Reverse_Lock_T.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_ProxyConsumer.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (Event, - EC_ProxyConsumer, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -typedef ACE_Reverse_Lock<ACE_Lock> TAO_EC_Unlock; - -TAO_EC_ProxyPushConsumer:: - TAO_EC_ProxyPushConsumer (TAO_EC_Event_Channel_Base* ec) - : event_channel_ (ec), - refcount_ (1), - connected_ (0), - filter_ (0) -{ - this->lock_ = - this->event_channel_->create_consumer_lock (); - - this->default_POA_ = - this->event_channel_->consumer_poa (); - - this->qos_.is_gateway = 0; -} - -TAO_EC_ProxyPushConsumer::~TAO_EC_ProxyPushConsumer (void) -{ - this->event_channel_->destroy_consumer_lock (this->lock_); - this->cleanup_i (); -} - - -CORBA::Boolean -TAO_EC_ProxyPushConsumer::supplier_non_existent ( - CORBA::Boolean_out disconnected - ACE_ENV_ARG_DECL) -{ - CORBA::Object_var supplier; - { - ACE_GUARD_THROW_EX ( - ACE_Lock, ace_mon, *this->lock_, - CORBA::INTERNAL ()); - ACE_CHECK_RETURN (0); - - disconnected = 0; - if (this->is_connected_i () == 0) - { - disconnected = 1; - return 0; - } - if (CORBA::is_nil (this->supplier_.in ())) - { - return 0; - } - supplier = CORBA::Object::_duplicate (this->supplier_.in ()); - } - -#if (TAO_HAS_MINIMUM_CORBA == 0) - return supplier->_non_existent (ACE_ENV_SINGLE_ARG_PARAMETER); -#else - return 0; -#endif /* TAO_HAS_MINIMUM_CORBA */ -} - -void -TAO_EC_ProxyPushConsumer::connected (TAO_EC_ProxyPushSupplier* supplier - ACE_ENV_ARG_DECL) -{ - TAO_EC_ProxyPushConsumer_Guard ace_mon (this->lock_, - this->refcount_, - this->event_channel_, - this); - if (!ace_mon.locked ()) - return; - - ace_mon.filter->connected (supplier ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_ProxyPushConsumer::reconnected (TAO_EC_ProxyPushSupplier* supplier - ACE_ENV_ARG_DECL) -{ - TAO_EC_ProxyPushConsumer_Guard ace_mon (this->lock_, - this->refcount_, - this->event_channel_, - this); - if (!ace_mon.locked ()) - return; - - ace_mon.filter->reconnected (supplier ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_ProxyPushConsumer::disconnected (TAO_EC_ProxyPushSupplier* supplier - ACE_ENV_ARG_DECL) -{ - TAO_EC_ProxyPushConsumer_Guard ace_mon (this->lock_, - this->refcount_, - this->event_channel_, - this); - if (!ace_mon.locked ()) - return; - - ace_mon.filter->disconnected (supplier ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_ProxyPushConsumer::connected (TAO_EC_ProxyPushConsumer* - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_ProxyPushConsumer::reconnected (TAO_EC_ProxyPushConsumer* - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_ProxyPushConsumer::disconnected (TAO_EC_ProxyPushConsumer* - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_ProxyPushConsumer::shutdown_hook (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_ProxyPushConsumer::shutdown (ACE_ENV_SINGLE_ARG_DECL) -{ - RtecEventComm::PushSupplier_var supplier; - - { - ACE_GUARD_THROW_EX ( - ACE_Lock, ace_mon, *this->lock_, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ()); - ACE_CHECK; - - supplier = this->supplier_._retn (); - this->connected_ = 0; - - this->shutdown_hook (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - if (this->filter_ != 0) - { - this->filter_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - this->cleanup_i (); - } - } - - this->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - if (CORBA::is_nil (supplier.in ())) - return; - - ACE_TRY - { - supplier->disconnect_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore exceptions, we must isolate other clients from - // failures on this one. - } - ACE_ENDTRY; -} - -void -TAO_EC_ProxyPushConsumer::cleanup_i (void) -{ - this->supplier_ = - RtecEventComm::PushSupplier::_nil (); - this->connected_ = 0; - - if (this->filter_ != 0) - { - this->filter_->unbind (this); - this->filter_->_decr_refcnt (); - this->filter_ = 0; - } -} - -void -TAO_EC_ProxyPushConsumer::deactivate (ACE_ENV_SINGLE_ARG_DECL) -{ - ACE_TRY - { - PortableServer::ObjectId id = - this->object_id (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - this->default_POA_->deactivate_object (id ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Exceptions here should not be propagated. They usually - // indicate that an object is beign disconnected twice, or some - // race condition, but not a fault that the user needs to know - // about. - } - ACE_ENDTRY; -} - -CORBA::ULong -TAO_EC_ProxyPushConsumer::_incr_refcnt (void) -{ - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0); - return this->refcount_++; -} - -void -TAO_EC_ProxyPushConsumer::refcount_zero_hook (void) -{ - // Use the event channel - this->event_channel_->destroy_proxy (this); -} - -CORBA::ULong -TAO_EC_ProxyPushConsumer::_decr_refcnt (void) -{ - { - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0); - this->refcount_--; - if (this->refcount_ != 0) - return this->refcount_; - } - - this->refcount_zero_hook (); - return 0; -} - - -// **************************************************************** - -TAO_EC_ProxyPushConsumer_Guard:: - TAO_EC_ProxyPushConsumer_Guard (ACE_Lock *lock, - CORBA::ULong &refcount, - TAO_EC_Event_Channel_Base *ec, - TAO_EC_ProxyPushConsumer *proxy) - : lock_ (lock), - refcount_ (refcount), - event_channel_ (ec), - proxy_ (proxy), - locked_ (0) -{ - ACE_Guard<ACE_Lock> ace_mon (*this->lock_); - // If the guard fails there is not much we can do, raising an - // exception is wrong, the client has *no* way to handle that kind - // of error. Even worse, there is no exception to raise in that - // case. - // @@ Returning something won't work either, the error should be - // logged though! - - if (proxy->is_connected_i () == 0) - return; - - this->filter = this->proxy_->filter_i (); - this->filter->_incr_refcnt (); - - this->locked_ = 1; - this->refcount_++; -} - -TAO_EC_ProxyPushConsumer_Guard:: - ~TAO_EC_ProxyPushConsumer_Guard (void) -{ - // This access is safe because guard objects are created on the - // stack, only one thread has access to them - if (!this->locked_) - return; - - { - ACE_Guard<ACE_Lock> ace_mon (*this->lock_); - // If the guard fails there is not much we can do, raising an - // exception is wrong, the client has *no* way to handle that kind - // of error. Even worse, there is no exception to raise in that - // case. - // @@ Returning something won't work either, the error should be - // logged though! - - this->filter->_decr_refcnt (); - - this->refcount_--; - if (this->refcount_ != 0) - return; - } - - this->proxy_->refcount_zero_hook (); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h deleted file mode 100644 index e70e0ee6ca2..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h +++ /dev/null @@ -1,238 +0,0 @@ -// -*- C++ -*- -/** - * @file EC_ProxyConsumer.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_PROXYCONSUMER_H -#define TAO_EC_PROXYCONSUMER_H - -#include /**/ "ace/pre.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#include "orbsvcs/RtecEventChannelAdminS.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Event_Channel_Base; -class TAO_EC_ProxyPushSupplier; -class TAO_EC_Supplier_Filter; - -/** - * @class TAO_EC_ProxyPushConsumer - * - * @brief ProxyPushConsumer - * - * Implement the RtecEventChannelAdmin::ProxyPushConsumer interface, - * remember that this class is used to communicate with a - * PushSupplier, so, in effect, this is the ambassador for a - * supplier inside the event channel. - * - * <H2>Memory Management</H2> - * It makes a copy of the SupplierQOS and the supplier object - * reference. - * It uses bind/unbind to control the lifetime of the - * Supplier_Filter object. - * The object commits suicide when disconnect_push_consumer() is - * called. - * - * <H2>Locking</H2> - * No provisions for locking, access must be serialized - * externally. - */ -class TAO_RTEvent_Serv_Export TAO_EC_ProxyPushConsumer -{ -public: - typedef RtecEventChannelAdmin::ProxyPushConsumer Interface; - typedef RtecEventChannelAdmin::ProxyPushConsumer_var _var_type; - typedef RtecEventChannelAdmin::ProxyPushConsumer_ptr _ptr_type; - - /// constructor... - TAO_EC_ProxyPushConsumer (TAO_EC_Event_Channel_Base* event_channel); - - /// destructor... - virtual ~TAO_EC_ProxyPushConsumer (void); - - /// Activate in the POA - virtual void activate ( - RtecEventChannelAdmin::ProxyPushConsumer_ptr &proxy - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) = 0; - - /// Deactivate from the POA - virtual void deactivate (ACE_ENV_SINGLE_ARG_DECL); - - /// Disconnect this from - virtual void disconnect_push_consumer ( - ACE_ENV_SINGLE_ARG_DECL) = 0; - - /// Return 0 if no supplier is connected... - CORBA::Boolean is_connected (void) const; - - /// Return the consumer object reference. It returns nil() if it has - /// not connected yet. - RtecEventComm::PushSupplier_ptr supplier (void) const; - - /// The QoS (subscription) used to connect to the EC. - const RtecEventChannelAdmin::SupplierQOS& publications (void) const; - - /** - * Invoke the _non_existent() pseudo-operation on the supplier. If - * it is disconnected then it returns true and sets the - * <disconnected> flag. - */ - CORBA::Boolean supplier_non_existent (CORBA::Boolean_out disconnected - ACE_ENV_ARG_DECL); - - /// Concrete implementations can use this methods to keep track of - /// the consumers interested in this events. - virtual void connected (TAO_EC_ProxyPushSupplier* supplier - ACE_ENV_ARG_DECL); - virtual void reconnected (TAO_EC_ProxyPushSupplier* supplier - ACE_ENV_ARG_DECL); - virtual void disconnected (TAO_EC_ProxyPushSupplier* supplier - ACE_ENV_ARG_DECL); - - /// Usually implemented as no-ops, but some configurations may - /// require this methods. - virtual void connected (TAO_EC_ProxyPushConsumer* consumer - ACE_ENV_ARG_DECL); - virtual void reconnected (TAO_EC_ProxyPushConsumer* consumer - ACE_ENV_ARG_DECL); - virtual void disconnected (TAO_EC_ProxyPushConsumer* consumer - ACE_ENV_ARG_DECL); - - /// The event channel is shutting down - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED); - - /// The QoS (subscription) used to connect to the EC, assumes the - /// locks are held, use with care! - const RtecEventChannelAdmin::SupplierQOS& publications_i (void) const; - - /// Increment and decrement the reference count. - CORBA::ULong _incr_refcnt (void); - CORBA::ULong _decr_refcnt (void); - - -protected: - /// Set the supplier, used by some implementations to change the - /// policies used when invoking operations on the supplier. - void supplier (RtecEventComm::PushSupplier_ptr supplier); - void supplier_i (RtecEventComm::PushSupplier_ptr supplier); - - friend class TAO_EC_ProxyPushConsumer_Guard; - // The guard needs access to the following protected methods. - - /// The private version (without locking) of is_connected(). - CORBA::Boolean is_connected_i (void) const; - - /// Return the current filter, assumes the locks are held. - TAO_EC_Supplier_Filter *filter_i (void) const; - - /// Release the filter and the supplier - void cleanup_i (void); - - /// The supplier admin, used for activation and memory managment. - TAO_EC_Event_Channel_Base* event_channel_; - - /// The locking strategy. - ACE_Lock* lock_; - - /// The reference count. - CORBA::ULong refcount_; - - /// The supplier.... - RtecEventComm::PushSupplier_var supplier_; - - /// If the flag is not zero then we are connected, notice that the - /// supplier can be nil. - int connected_; - - /// The publication and QoS information... - RtecEventChannelAdmin::SupplierQOS qos_; - - /// Store the default POA. - PortableServer::POA_var default_POA_; - - /// The strategy to do filtering close to the supplier - TAO_EC_Supplier_Filter* filter_; - -private: - /// Template method hooks. - virtual void shutdown_hook (ACE_ENV_SINGLE_ARG_DECL); - virtual void refcount_zero_hook (void); - - virtual PortableServer::ObjectId - object_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) = 0; -}; - -// **************************************************************** - -/** - * @class TAO_EC_ProxyPushConsumer_Guard - * - * @brief A Guard for the ProxyPushConsumer reference count - * - * This is a helper class used in the implementation of - * ProxyPushConumer. It provides a Guard mechanism to increment - * the reference count on the proxy and its filter, eliminating - * the need to hold mutexes during long operations. - */ -class TAO_RTEvent_Serv_Export TAO_EC_ProxyPushConsumer_Guard -{ -public: - /// Constructor - TAO_EC_ProxyPushConsumer_Guard (ACE_Lock *lock, - CORBA::ULong &refcount, - TAO_EC_Event_Channel_Base *ec, - TAO_EC_ProxyPushConsumer *proxy); - - /// Destructor - ~TAO_EC_ProxyPushConsumer_Guard (void); - - /// Returns 1 if the reference count successfully acquired - int locked (void) const; - - TAO_EC_Supplier_Filter *filter; - -private: - /// The lock used to protect the reference count - ACE_Lock *lock_; - - /// The reference count - CORBA::ULong &refcount_; - - /// The event channel used to destroy the proxy - TAO_EC_Event_Channel_Base *event_channel_; - - /// The proxy whose lifetime is controlled by the reference count - TAO_EC_ProxyPushConsumer *proxy_; - - /// This flag is set to 1 if the reference count was successfully - /// acquired. - int locked_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_ProxyConsumer.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_PROXYCONSUMER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.i b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.i deleted file mode 100644 index 44ef91ef2e7..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.i +++ /dev/null @@ -1,71 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE CORBA::Boolean -TAO_EC_ProxyPushConsumer::is_connected_i (void) const -{ - return this->connected_; -} - -ACE_INLINE CORBA::Boolean -TAO_EC_ProxyPushConsumer::is_connected (void) const -{ - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0); - - return this->is_connected_i (); -} - -ACE_INLINE RtecEventComm::PushSupplier_ptr -TAO_EC_ProxyPushConsumer::supplier (void) const -{ - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0); - return RtecEventComm::PushSupplier::_duplicate (this->supplier_.in ()); -} - -ACE_INLINE void -TAO_EC_ProxyPushConsumer::supplier_i (RtecEventComm::PushSupplier_ptr supplier) -{ - this->supplier_ = supplier; -} - -ACE_INLINE void -TAO_EC_ProxyPushConsumer::supplier (RtecEventComm::PushSupplier_ptr supplier) -{ - ACE_GUARD (ACE_Lock, ace_mon, *this->lock_); - - this->supplier_i (supplier); -} - -ACE_INLINE const RtecEventChannelAdmin::SupplierQOS& -TAO_EC_ProxyPushConsumer::publications (void) const -{ - // @@ TODO There should some way to signal errors here. - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, this->qos_); - - return this->qos_; -} - -ACE_INLINE const RtecEventChannelAdmin::SupplierQOS& -TAO_EC_ProxyPushConsumer::publications_i (void) const -{ - return this->qos_; -} - -ACE_INLINE TAO_EC_Supplier_Filter * -TAO_EC_ProxyPushConsumer::filter_i (void) const -{ - return this->filter_; -} - -// **************************************************************** - -ACE_INLINE int -TAO_EC_ProxyPushConsumer_Guard::locked (void) const -{ - return this->locked_; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp deleted file mode 100644 index 37204dcf67b..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp +++ /dev/null @@ -1,535 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_ProxySupplier.h" -#include "orbsvcs/Event/EC_Dispatching.h" -#include "orbsvcs/Event/EC_Filter_Builder.h" -#include "orbsvcs/Event/EC_QOS_Info.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "orbsvcs/Event/EC_Scheduling_Strategy.h" -#include "orbsvcs/Event/EC_ConsumerControl.h" -#include "orbsvcs/Event/EC_SupplierAdmin.h" -#include "orbsvcs/ESF/ESF_RefCount_Guard.h" -#include "orbsvcs/ESF/ESF_Proxy_RefCount_Guard.h" - -#include "ace/Reverse_Lock_T.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_ProxySupplier.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (Event, - EC_ProxySupplier, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -typedef ACE_Reverse_Lock<ACE_Lock> TAO_EC_Unlock; - -TAO_EC_ProxyPushSupplier::TAO_EC_ProxyPushSupplier (TAO_EC_Event_Channel_Base* ec, int validate_connection) - : event_channel_ (ec), - refcount_ (1), - suspended_ (0), - child_ (0), - consumer_validate_connection_(validate_connection) -{ - this->lock_ = - this->event_channel_->create_supplier_lock (); - - this->default_POA_ = - this->event_channel_->supplier_poa (); -} - -TAO_EC_ProxyPushSupplier::~TAO_EC_ProxyPushSupplier (void) -{ - this->event_channel_->destroy_supplier_lock (this->lock_); - this->cleanup_i (); -} - -void -TAO_EC_ProxyPushSupplier::connected (TAO_EC_ProxyPushConsumer* consumer - ACE_ENV_ARG_DECL) -{ - TAO_EC_Scheduling_Strategy *s = - this->event_channel_->scheduling_strategy (); - - s->add_proxy_supplier_dependencies (this, - consumer - ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_ProxyPushSupplier::reconnected (TAO_EC_ProxyPushConsumer* consumer - ACE_ENV_ARG_DECL) -{ - TAO_EC_Scheduling_Strategy *s = - this->event_channel_->scheduling_strategy (); - - s->add_proxy_supplier_dependencies (this, - consumer - ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_ProxyPushSupplier::disconnected (TAO_EC_ProxyPushConsumer* - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_ProxyPushSupplier::connected (TAO_EC_ProxyPushSupplier* - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_ProxyPushSupplier::reconnected (TAO_EC_ProxyPushSupplier* - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_ProxyPushSupplier::disconnected (TAO_EC_ProxyPushSupplier* - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_ProxyPushSupplier::shutdown (ACE_ENV_SINGLE_ARG_DECL) -{ - // Save the consumer we where connected to, we need to send a - // disconnect message to it. - RtecEventComm::PushConsumer_var consumer; - - { - ACE_GUARD_THROW_EX ( - ACE_Lock, ace_mon, *this->lock_, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ()); - ACE_CHECK; - - int connected = this->is_connected_i (); - - consumer = this->consumer_._retn (); - - if (connected) - this->cleanup_i (); - } - - this->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - if (CORBA::is_nil (consumer.in ())) - return; - - ACE_TRY - { - consumer->disconnect_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore exceptions, we must isolate other clients from - // problems on this one. - } - ACE_ENDTRY; -} - -void -TAO_EC_ProxyPushSupplier::cleanup_i (void) -{ - this->consumer_ = - RtecEventComm::PushConsumer::_nil (); - - // @@ Why don't we have a destroy() method in the - // filter_builder? - delete this->child_; - this->child_ = 0; -} - -void -TAO_EC_ProxyPushSupplier::deactivate (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (()) -{ - ACE_TRY - { - PortableServer::ObjectId id = - this->object_id (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - this->default_POA_->deactivate_object (id ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Exceptions here should not be propagated. They usually - // indicate that an object is beign disconnected twice, or some - // race condition, but not a fault that the user needs to know - // about. - } - ACE_ENDTRY; -} - -CORBA::ULong -TAO_EC_ProxyPushSupplier::_incr_refcnt (void) -{ - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0); - return this->refcount_++; -} - -void -TAO_EC_ProxyPushSupplier::refcount_zero_hook (void) -{ - // Use the event channel - this->event_channel_->destroy_proxy (this); -} - -CORBA::ULong -TAO_EC_ProxyPushSupplier::_decr_refcnt (void) -{ - { - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0); - this->refcount_--; - if (this->refcount_ != 0) - return this->refcount_; - } - - this->refcount_zero_hook (); - return 0; -} - -typedef TAO_ESF_Proxy_RefCount_Guard<TAO_EC_Event_Channel_Base,TAO_EC_ProxyPushSupplier> Destroy_Guard; - -int -TAO_EC_ProxyPushSupplier::filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - Destroy_Guard auto_destroy (this->refcount_, - this->event_channel_, - this); - - int result = 0; - { - ACE_GUARD_THROW_EX ( - ACE_Lock, ace_mon, *this->lock_, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ()); - ACE_CHECK_RETURN (0); - - if (this->is_connected_i () == 0) - return 0; - - result = - this->child_->filter (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - } - return result; -} - -int -TAO_EC_ProxyPushSupplier::filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - Destroy_Guard auto_destroy (this->refcount_, - this->event_channel_, - this); - - int result = 0; - { - ACE_GUARD_THROW_EX ( - ACE_Lock, ace_mon, *this->lock_, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ()); - ACE_CHECK_RETURN (0); - - if (this->is_connected_i () == 0) - return 0; - - result = - this->child_->filter_nocopy (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - } - return result; -} - -void -TAO_EC_ProxyPushSupplier::push (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - // The mutex is already held by the caller (usually the filter() - // method) - if (this->is_connected_i () == 0) - return; // TAO_THROW (RtecEventComm::Disconnected ());???? - - if (this->suspended_ != 0) - return; - - TAO_ESF_RefCount_Guard<CORBA::ULong> ace_mon (this->refcount_); - // The guard will decrement the reference count, notice that the - // reference count can become 0, but this is not the right spot to - // check for that and destroy the object. - // If we did so then we would destroy the object, and consequently - // the mutex, but the mutex is used later when the stack unwinds and - // the filter() method tries to destroy the mutex (that originally - // acquired the mutex in the first place). - // So the correct thing to do is to just decrement the reference - // count and let the filter() method do the destruction. - - RtecEventComm::PushConsumer_var consumer = - RtecEventComm::PushConsumer::_duplicate (this->consumer_.in ()); - - this->pre_dispatch_hook (const_cast<RtecEventComm::EventSet&> (event) - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - { - // We have to release the lock to avoid dead-locks. - TAO_EC_Unlock reverse_lock (*this->lock_); - - ACE_GUARD_THROW_EX (TAO_EC_Unlock, ace_mon, reverse_lock, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ()); - ACE_CHECK; - - this->event_channel_->dispatching ()->push (this, - consumer.in (), - event, - qos_info - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - - if (this->child_ != 0) - this->child_->clear (); -} - -void -TAO_EC_ProxyPushSupplier::pre_dispatch_hook (RtecEventComm::EventSet& - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_ProxyPushSupplier::push_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - // The mutex is already held by the caller (usually the filter() - // method) - if (this->is_connected_i () == 0) - return; // TAO_THROW (RtecEventComm::Disconnected ());???? - - if (this->suspended_ != 0) - return; - - TAO_ESF_RefCount_Guard<CORBA::ULong> ace_mon (this->refcount_); - // The guard will decrement the reference count, notice that the - // reference count can become 0, but this is not the right spot to - // check for that and destroy the object. - // If we did so then we would destroy the object, and consequently - // the mutex, but the mutex is used later when the stack unwinds and - // the filter() method tries to destroy the mutex (that originally - // acquired the mutex in the first place). - // So the correct thing to do is to just decrement the reference - // count and let the filter() method do the destruction. - - RtecEventComm::PushConsumer_var consumer = - RtecEventComm::PushConsumer::_duplicate (this->consumer_.in ()); - - this->pre_dispatch_hook (event ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - { - TAO_EC_Unlock reverse_lock (*this->lock_); - - ACE_GUARD_THROW_EX (TAO_EC_Unlock, ace_mon, reverse_lock, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ()); - ACE_CHECK; - - this->event_channel_->dispatching ()->push_nocopy (this, - consumer.in (), - event, - qos_info - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - - if (this->child_ != 0) - this->child_->clear (); -} - -void -TAO_EC_ProxyPushSupplier::push_to_consumer ( - RtecEventComm::PushConsumer_ptr consumer, - const RtecEventComm::EventSet& event - ACE_ENV_ARG_DECL) -{ - { - ACE_GUARD_THROW_EX ( - ACE_Lock, ace_mon, *this->lock_, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ()); - ACE_CHECK; - - if (this->is_connected_i () == 0) - return; // ACE_THROW (RtecEventComm::Disconnected ());???? - - if (this->suspended_ != 0) - return; - } - - ACE_TRY - { - consumer->push (event ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCH (CORBA::OBJECT_NOT_EXIST, not_used) - { - // Do not report errors for old consumers - // NOTE: The comparison below is not completely correct, it - // could be that the remote consumer and the local consumer are - // in fact the same object, but represented by different objects - // references. Unfortunately this is not a good spot to invoke - // _is_equivalent(), and that may not give us the desired answer - // anyway. - if (consumer == this->consumer_.in ()) - { - TAO_EC_ConsumerControl *control = - this->event_channel_->consumer_control (); - - control->consumer_not_exist (this ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCH (CORBA::SystemException, sysex) - { - // Do not report errors for old consumers - // NOTE: The comparison below is not completely correct, it - // could be that the remote consumer and the local consumer are - // in fact the same object, but represented by different objects - // references. Unfortunately this is not a good spot to invoke - // _is_equivalent(), and that may not give us the desired answer - // anyway. - if (consumer == this->consumer_.in ()) - { - TAO_EC_ConsumerControl *control = - this->event_channel_->consumer_control (); - - control->system_exception (this, - sysex - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCHANY - { - // Shouldn't happen, but does not hurt - } - ACE_ENDTRY; -} - -void -TAO_EC_ProxyPushSupplier::reactive_push_to_consumer ( - RtecEventComm::PushConsumer_ptr consumer, - const RtecEventComm::EventSet& event - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - consumer->push (event ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCH (CORBA::OBJECT_NOT_EXIST, not_used) - { - TAO_EC_ConsumerControl *control = - this->event_channel_->consumer_control (); - - control->consumer_not_exist (this ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - ACE_CATCH (CORBA::SystemException, sysex) - { - TAO_EC_ConsumerControl *control = - this->event_channel_->consumer_control (); - - control->system_exception (this, - sysex - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - ACE_CATCHANY - { - // Shouldn't happen - } - ACE_ENDTRY; -} - -CORBA::Boolean -TAO_EC_ProxyPushSupplier::consumer_non_existent ( - CORBA::Boolean_out disconnected - ACE_ENV_ARG_DECL) -{ - CORBA::Object_var consumer; - { - ACE_GUARD_THROW_EX ( - ACE_Lock, ace_mon, *this->lock_, - CORBA::INTERNAL ()); - ACE_CHECK_RETURN (0); - - disconnected = 0; - if (this->is_connected_i () == 0) - { - disconnected = 1; - return 0; - } - - consumer = CORBA::Object::_duplicate (this->consumer_.in ()); - } - -#if (TAO_HAS_MINIMUM_CORBA == 0) - return consumer->_non_existent (ACE_ENV_SINGLE_ARG_PARAMETER); -#else - return 0; -#endif /* TAO_HAS_MINIMUM_CORBA */ -} - -void -TAO_EC_ProxyPushSupplier::clear (void) -{ - ACE_GUARD (ACE_Lock, ace_mon, *this->lock_); - - this->child_->clear (); -} - -CORBA::ULong -TAO_EC_ProxyPushSupplier::max_event_size (void) const -{ - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0); - - return this->child_->max_event_size (); -} - -int -TAO_EC_ProxyPushSupplier::can_match ( - const RtecEventComm::EventHeader &header) const -{ - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0); - - if (this->is_connected_i () == 0) - return 0; - - return this->child_->can_match (header); -} - -int -TAO_EC_ProxyPushSupplier::add_dependencies ( - const RtecEventComm::EventHeader &header, - const TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL) -{ - ACE_GUARD_THROW_EX ( - ACE_Lock, ace_mon, *this->lock_, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ()); - ACE_CHECK_RETURN (0); - - return this->child_->add_dependencies (header, - qos_info - ACE_ENV_ARG_PARAMETER); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h deleted file mode 100644 index bb14e56895b..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h +++ /dev/null @@ -1,231 +0,0 @@ -// -*- C++ -*- -/** - * @file EC_ProxySupplier.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_PROXYSUPPLIER_H -#define TAO_EC_PROXYSUPPLIER_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/RtecEventChannelAdminS.h" - -#include "orbsvcs/Event/EC_Filter.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Event_Channel_Base; -class TAO_EC_ProxyPushConsumer; - -/** - * @class TAO_EC_ProxyPushSupplier - * - * @brief ProxyPushSupplier - * - * Implement the RtecEventChannelAdmin::ProxyPushSupplier interface, - * remember that this class is used to communicate with a - * PushConsumer, so, in effect, this is the ambassador for a - * consumer inside the event channel. - * - * <H2>Memory Management</H2> - * It does not assume ownership of the TAO_EC_Dispatching object. - * It makes a copy of the ConsumerQOS and the consumer object - * reference. - * - * <H2>Locking</H2> - * Locking is strategized, the event channel acts as a factory for - * the locking strategies. - * - * @todo We don't need to provide a trivial filter, the object itself - * could short-circuit the filter() ---> push() cycle when the EC - * is properly configured, we need to explore this... - */ -class TAO_RTEvent_Serv_Export TAO_EC_ProxyPushSupplier : public TAO_EC_Filter -{ -public: - typedef RtecEventChannelAdmin::ProxyPushSupplier Interface; - typedef RtecEventChannelAdmin::ProxyPushSupplier_var _var_type; - typedef RtecEventChannelAdmin::ProxyPushSupplier_ptr _ptr_type; - - /// Constructor... - TAO_EC_ProxyPushSupplier (TAO_EC_Event_Channel_Base* event_channel, int validate_connection); - - /// Destructor... - virtual ~TAO_EC_ProxyPushSupplier (void); - - /// Activate in the POA - virtual void activate ( - RtecEventChannelAdmin::ProxyPushSupplier_ptr &proxy - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) = 0; - - /// Deactivate from the POA - virtual void deactivate (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (()); - - /// Disconnect this from - virtual void disconnect_push_supplier ( - ACE_ENV_SINGLE_ARG_DECL) = 0; - - /// Return 0 if no consumer is connected... - CORBA::Boolean is_connected (void) const; - - /// Return 1 if it is suspended. - CORBA::Boolean is_suspended (void) const; - - /** - * Return the consumer object reference. It returns nil() if it has - * not connected yet. - */ - RtecEventComm::PushConsumer_ptr consumer (void) const; - - /// The QoS (subscription) used to connect to the EC. - const RtecEventChannelAdmin::ConsumerQOS& subscriptions (void) const; - - /// Concrete implementations can use this methods to keep track of - /// the suppliers that publish its events. - virtual void connected (TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL); - virtual void reconnected (TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL); - virtual void disconnected (TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL); - - /// Usually implemented as no-ops, but some configurations may - /// require this methods. - virtual void connected (TAO_EC_ProxyPushSupplier *supplier - ACE_ENV_ARG_DECL); - virtual void reconnected (TAO_EC_ProxyPushSupplier *supplier - ACE_ENV_ARG_DECL); - virtual void disconnected (TAO_EC_ProxyPushSupplier *supplier - ACE_ENV_ARG_DECL); - - /// The event channel is shutting down - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL); - - /// Pushes to the consumer, verifies that it is connected and that it - /// is not suspended. - /** - * These methods take @a consumer argument because during the time - * the filters have been processing the event, this proxy's consumer - * may have changed. - */ - void push_to_consumer (RtecEventComm::PushConsumer_ptr consumer, - const RtecEventComm::EventSet &event - ACE_ENV_ARG_DECL); - void reactive_push_to_consumer (RtecEventComm::PushConsumer_ptr consumer, - const RtecEventComm::EventSet &event - ACE_ENV_ARG_DECL); - - /** - * Invoke the _non_existent() pseudo-operation on the consumer. If - * it is disconnected then it returns true and sets the - * <disconnected> flag. - */ - CORBA::Boolean consumer_non_existent (CORBA::Boolean_out disconnected - ACE_ENV_ARG_DECL); - - /// Increment and decrement the reference count. - CORBA::ULong _incr_refcnt (void); - CORBA::ULong _decr_refcnt (void); - - // = The TAO_EC_Filter methods, only push() is implemented... - virtual int filter (const RtecEventComm::EventSet &event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual int filter_nocopy (RtecEventComm::EventSet &event, - TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL); - virtual void push (const RtecEventComm::EventSet &event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push_nocopy (RtecEventComm::EventSet &event, - TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL); - virtual void clear (void); - virtual CORBA::ULong max_event_size (void) const; - virtual int can_match (const RtecEventComm::EventHeader &header) const; - virtual int add_dependencies (const RtecEventComm::EventHeader &header, - const TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL); - -protected: - /// Set the consumer, used by some implementations to change the - /// policies used when invoking operations on the consumer. - void consumer (RtecEventComm::PushConsumer_ptr consumer); - void consumer_i (RtecEventComm::PushConsumer_ptr consumer); - - void suspend_connection_i (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - void resume_connection_i (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - void suspend_connection_locked (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - void resume_connection_locked (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// The private version (without locking) of is_connected(). - CORBA::Boolean is_connected_i (void) const; - - /// Release the child and the consumer - void cleanup_i (void); - - /// The Event Channel that owns this object. - TAO_EC_Event_Channel_Base* event_channel_; - - /// The locking strategy. - ACE_Lock* lock_; - - /// The reference count. - CORBA::ULong refcount_; - - /// The consumer.... - RtecEventComm::PushConsumer_var consumer_; - - /// Is this consumer suspended? - CORBA::Boolean suspended_; - - /// The subscription and QoS information... - RtecEventChannelAdmin::ConsumerQOS qos_; - - /// Store the default POA. - PortableServer::POA_var default_POA_; - - /// The filter object - TAO_EC_Filter* child_; - - /// Validate the connection to consumer on connect - int consumer_validate_connection_; -private: - - /// Template method hooks. - virtual void refcount_zero_hook (void); - virtual void pre_dispatch_hook (RtecEventComm::EventSet& - ACE_ENV_ARG_DECL); - virtual PortableServer::ObjectId - object_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) = 0; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_ProxySupplier.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_PROXYSUPPLIER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.i b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.i deleted file mode 100644 index c64085ea2e1..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.i +++ /dev/null @@ -1,99 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -TAO_EC_ProxyPushSupplier::suspend_connection_i (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->suspended_ = 1; -} - -ACE_INLINE void -TAO_EC_ProxyPushSupplier::suspend_connection_locked (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - ACE_GUARD_THROW_EX ( - ACE_Lock, ace_mon, *this->lock_, - CORBA::INTERNAL ()); - // @@ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ()); - ACE_CHECK; - - this->suspend_connection_i (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -ACE_INLINE void -TAO_EC_ProxyPushSupplier::resume_connection_i (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->suspended_ = 0; -} - -ACE_INLINE void -TAO_EC_ProxyPushSupplier::resume_connection_locked (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - ACE_GUARD_THROW_EX ( - ACE_Lock, ace_mon, *this->lock_, - CORBA::INTERNAL ()); - // @@ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ()); - ACE_CHECK; - - this->resume_connection_i (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -ACE_INLINE CORBA::Boolean -TAO_EC_ProxyPushSupplier::is_connected_i (void) const -{ - return !CORBA::is_nil (this->consumer_.in ()); -} - -ACE_INLINE CORBA::Boolean -TAO_EC_ProxyPushSupplier::is_connected (void) const -{ - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0); - - return this->is_connected_i (); -} - -ACE_INLINE CORBA::Boolean -TAO_EC_ProxyPushSupplier::is_suspended (void) const -{ - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0); - - return this->suspended_; -} - -ACE_INLINE RtecEventComm::PushConsumer_ptr -TAO_EC_ProxyPushSupplier::consumer (void) const -{ - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0); - return RtecEventComm::PushConsumer::_duplicate (this->consumer_.in ()); -} - -ACE_INLINE void -TAO_EC_ProxyPushSupplier::consumer_i (RtecEventComm::PushConsumer_ptr consumer) -{ - this->consumer_ = consumer; -} - -ACE_INLINE void -TAO_EC_ProxyPushSupplier::consumer (RtecEventComm::PushConsumer_ptr consumer) -{ - ACE_GUARD (ACE_Lock, ace_mon, *this->lock_); - - this->consumer_i (consumer); -} - -ACE_INLINE const RtecEventChannelAdmin::ConsumerQOS& -TAO_EC_ProxyPushSupplier::subscriptions (void) const -{ - // @@ TODO There should be a better way to signal errors here. - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, this->qos_); - - return this->qos_; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Proxy_Disconnector.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Proxy_Disconnector.cpp deleted file mode 100644 index 557a2b4f708..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Proxy_Disconnector.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @file EC_Proxy_Disconnector.cpp - * - * $Id$ - * - * @author Carlos O'Ryan <coryan@atdesk.com> - */ - -#include "orbsvcs/Event/EC_Proxy_Disconnector.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -void -TAO_EC_Supplier_Proxy_Disconnect_Functor::operator() ( - RtecEventComm::PushSupplier_ptr supplier) - ACE_THROW_SPEC (()) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - supplier->disconnect_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHALL - { - } - ACE_ENDTRY; -} - -void -TAO_EC_Consumer_Proxy_Disconnect_Functor::operator() ( - RtecEventComm::PushConsumer_ptr consumer) - ACE_THROW_SPEC (()) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - consumer->disconnect_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHALL - { - } - ACE_ENDTRY; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Proxy_Disconnector.h b/TAO/orbsvcs/orbsvcs/Event/EC_Proxy_Disconnector.h deleted file mode 100644 index 8aeda423586..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Proxy_Disconnector.h +++ /dev/null @@ -1,76 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Proxy_Disconnector.h - * - * @author Carlos O'Ryan <coryan@atdesk.com> - * - * $Id$ - */ -#ifndef EC_PROXY_DISCONNECTOR__H_ -#define EC_PROXY_DISCONNECTOR__H_ - -#include /**/ "orbsvcs/Event/event_serv_export.h" -#include "orbsvcs/RtecEventCommC.h" -#include "ace/Auto_Functor.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @struct TAO_EC_Supplier_Proxy_Disconnect_Functor - * - * @brief Implements a functor for the TAO_EC_Supplier_Proxy_Disconnector class. - */ -struct TAO_RTEvent_Serv_Export TAO_EC_Supplier_Proxy_Disconnect_Functor -{ - typedef RtecEventComm::PushSupplier_ptr argument; - - /// Disconnect from @c supplier - void operator() (RtecEventComm::PushSupplier_ptr supplier) - ACE_THROW_SPEC (()); -}; - -/** - * @class TAO_EC_Supplier_Proxy_Disconnector - * - * @brief Helper class to disconnect a PushConsumer from the event - * channel. - * - */ -typedef ACE_Utils::Auto_Functor< - RtecEventComm::PushSupplier, - TAO_EC_Supplier_Proxy_Disconnect_Functor> - TAO_EC_Supplier_Proxy_Disconnector; - - - -/** - * @struct TAO_EC_Consumer_Proxy_Disconnect_Functor - * - * @brief Implements a functor for the TAO_EC_Consumer_Proxy_Disconnector class. - */ -struct TAO_RTEvent_Serv_Export TAO_EC_Consumer_Proxy_Disconnect_Functor -{ - typedef RtecEventComm::PushConsumer_ptr argument; - - /// Disconnect from @c consumer - void operator() (RtecEventComm::PushConsumer_ptr consumer) - ACE_THROW_SPEC (()); -}; - -/** - * @class TAO_EC_Consumer_Proxy_Disconnector - * - * @brief Helper class to disconnect a PushSupplier from the event - * channel. - * - */ -typedef ACE_Utils::Auto_Functor< - RtecEventComm::PushConsumer, - TAO_EC_Consumer_Proxy_Disconnect_Functor> - TAO_EC_Consumer_Proxy_Disconnector; - - -TAO_END_VERSIONED_NAMESPACE_DECL - -#endif // EC_PROXY_DISCONNECTOR__H_ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_QOS_Info.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_QOS_Info.cpp deleted file mode 100644 index 4680bda962f..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_QOS_Info.cpp +++ /dev/null @@ -1,9 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_QOS_Info.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_QOS_Info.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, EC_QOS_Info, "$Id$") diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_QOS_Info.h b/TAO/orbsvcs/orbsvcs/Event/EC_QOS_Info.h deleted file mode 100644 index 88c9387e382..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_QOS_Info.h +++ /dev/null @@ -1,70 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_QOS_Info.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_QOS_INFO_H -#define TAO_EC_QOS_INFO_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/RtecBaseC.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_QOS_Info - * - * @brief A representation of QoS information for the event channel - * filters. - * - * Filters compute QOS information for real-time dispatching, this - * class encapsulates that information. - * This first implementation is just a place-holder. - */ -class TAO_RTEvent_Serv_Export TAO_EC_QOS_Info -{ -public: - /// Constructor - TAO_EC_QOS_Info (void); - - /// Copy constructor, it does the obvious thing, but if it is not - /// here the HP/aCC compiler breaks. - TAO_EC_QOS_Info (const TAO_EC_QOS_Info &rhs); - - RtecBase::handle_t rt_info; - RtecBase::Preemption_Priority_t preemption_priority; - - /** - * Timer ids propagate their identity using this field, notice that - * they cannot use the event type because there could be multiple - * timeouts for the same consumer. - */ - long timer_id_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_QOS_Info.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_EVENT_CHANNEL_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_QOS_Info.i b/TAO/orbsvcs/orbsvcs/Event/EC_QOS_Info.i deleted file mode 100644 index eab42f031bc..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_QOS_Info.i +++ /dev/null @@ -1,23 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_QOS_Info::TAO_EC_QOS_Info (void) - : rt_info (-1), - preemption_priority (0), - timer_id_ (-1) -{ -} - -ACE_INLINE -TAO_EC_QOS_Info::TAO_EC_QOS_Info (const TAO_EC_QOS_Info &rhs) - : rt_info (rhs.rt_info), - preemption_priority (rhs.preemption_priority), - timer_id_ (rhs.timer_id_) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_RTCORBA_Dispatching.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_RTCORBA_Dispatching.cpp deleted file mode 100644 index f57b86ae813..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_RTCORBA_Dispatching.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_RTCORBA_Dispatching.h" -#include "tao/RTCORBA/Priority_Mapping.h" - -ACE_RCSID(Event, EC_RTCORBA_Dispatching, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_RTCORBA_Dispatching:: - TAO_EC_RTCORBA_Dispatching (const RTCORBA::ThreadpoolLanes &lanes, - RTCORBA::PriorityMapping *mapping, - RTCORBA::Current_ptr current) - : lanes_ (lanes) - , priority_mapping_ (mapping) - , current_ (RTCORBA::Current::_duplicate (current)) -{ - CORBA::ULong number_lanes = this->lanes_.length (); - ACE_NEW (this->tasks_, TAO_EC_Dispatching_Task[number_lanes]); - for (CORBA::ULong i = 0; i != this->lanes_.length (); ++i) - this->tasks_[i].thr_mgr (&this->thread_manager_); -} - -TAO_EC_RTCORBA_Dispatching::~TAO_EC_RTCORBA_Dispatching (void) -{ - delete[] this->tasks_; -} - -void -TAO_EC_RTCORBA_Dispatching::activate (void) -{ - for (CORBA::ULong i = 0; i != this->lanes_.length (); ++i) - { - CORBA::ULong nthreads = this->lanes_[i].static_threads; - if (nthreads == 0) - { - nthreads = 1; - } - RTCORBA::Priority corba_priority = this->lanes_[i].lane_priority; - RTCORBA::NativePriority native_priority; - if (this->priority_mapping_->to_native (corba_priority, - native_priority) != 0) - { - this->tasks_[i].activate ( - THR_SCHED_FIFO | THR_NEW_LWP | THR_JOINABLE, - nthreads, 0, - native_priority); - } - } -} - -void -TAO_EC_RTCORBA_Dispatching::shutdown (void) -{ - for (CORBA::ULong i = 0; i != this->lanes_.length (); ++i) - { - int nthreads = - this->thread_manager_.num_threads_in_task (&this->tasks_[i]); - if (nthreads <= 0) - continue; - for (int j = 0; j != nthreads; ++j) - { - this->tasks_[i].putq (new TAO_EC_Shutdown_Task_Command); - } - } - this->thread_manager_.wait (); -} - -void -TAO_EC_RTCORBA_Dispatching::push (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - RtecEventComm::EventSet event_copy = event; - this->push_nocopy (proxy, consumer, event_copy, qos_info ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_RTCORBA_Dispatching::push_nocopy (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& - ACE_ENV_ARG_DECL) -{ - RTCORBA::Priority current_priority = - this->current_->the_priority (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - for (CORBA::ULong i = 0; i != this->lanes_.length (); ++i) - { - if (this->lanes_[i].lane_priority != current_priority) - continue; - - // @@ If there were no threads available we may need to create - // some... - - this->tasks_[i].push (proxy, consumer, event - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - break; - } -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_RTCORBA_Dispatching.h b/TAO/orbsvcs/orbsvcs/Event/EC_RTCORBA_Dispatching.h deleted file mode 100644 index cb6e87fdad2..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_RTCORBA_Dispatching.h +++ /dev/null @@ -1,82 +0,0 @@ -// -*- C++ -*- -/** - * @file EC_RTCORBA_Dispatching.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_RTCORBA_DISPATCHING_H -#define TAO_EC_RTCORBA_DISPATCHING_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/rtcorba_event_export.h" -#include "orbsvcs/Event/EC_Dispatching.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/Event/EC_Dispatching_Task.h" -#include "tao/RTCORBA/RTCORBA.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_RTCORBA_Dispatching - * - * @brief RTCORBA-based dispatching strategy - * - */ -class TAO_RTCORBAEvent_Export TAO_EC_RTCORBA_Dispatching : public TAO_EC_Dispatching -{ -public: - /// Constructor - TAO_EC_RTCORBA_Dispatching (const RTCORBA::ThreadpoolLanes &lanes, - RTCORBA::PriorityMapping *mapping, - RTCORBA::Current_ptr current); - - /// Destructor - ~TAO_EC_RTCORBA_Dispatching (void); - - // = The EC_Dispatching methods. - virtual void activate (void); - virtual void shutdown (void); - virtual void push (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push_nocopy (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - -private: - /// The thread pools... - RTCORBA::ThreadpoolLanes lanes_; - - /// Used to map between CORBA and native priorities - RTCORBA::PriorityMapping *priority_mapping_; - - /// Used to get the current RTCORBA priority - RTCORBA::Current_var current_; - - /// Use our own thread manager. - ACE_Thread_Manager thread_manager_; - - /// The dispatching task(s), one per lane - TAO_EC_Dispatching_Task *tasks_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* TAO_EC_RTCORBA_DISPATCHING_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_RTCORBA_Factory.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_RTCORBA_Factory.cpp deleted file mode 100644 index 087ffc53b03..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_RTCORBA_Factory.cpp +++ /dev/null @@ -1,276 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_RTCORBA_Dispatching.h" -#include "orbsvcs/Event/EC_RTCORBA_Factory.h" - -#include "tao/RTCORBA/Priority_Mapping_Manager.h" - -ACE_RCSID(Event, EC_RTCORBA_Factory, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_RTCORBA_Factory:: - TAO_EC_RTCORBA_Factory (TAO_EC_Factory *body, - const RTCORBA::ThreadpoolLanes &lanes) - : body_ (body) - , lanes_ (lanes) -{ -} - -TAO_EC_RTCORBA_Factory::~TAO_EC_RTCORBA_Factory (void) -{ -} - - -int -TAO_EC_RTCORBA_Factory::init (int argc, char* argv[]) -{ - return this->body_->init (argc, argv); -} - -int -TAO_EC_RTCORBA_Factory::fini (void) -{ - return this->body_->fini (); -} - -// **************************************************************** - -TAO_EC_Dispatching* -TAO_EC_RTCORBA_Factory::create_dispatching (TAO_EC_Event_Channel_Base *) -{ - TAO_EC_Dispatching *dispatching = 0; - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - // @@ The ORBId could be important!!! - int argc = 0; - CORBA::ORB_var orb = - CORBA::ORB_init (argc, 0, "" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var obj = - orb->resolve_initial_references ("PriorityMappingManager" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - RTCORBA::PriorityMappingManager_var priority_mapping_manager = - RTCORBA::PriorityMappingManager::_narrow (obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - RTCORBA::PriorityMapping *priority_mapping = - priority_mapping_manager->mapping (); - - obj = - orb->resolve_initial_references ("RTCurrent" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - RTCORBA::Current_var current = - RTCORBA::Current::_narrow (obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_NEW_RETURN (dispatching, - TAO_EC_RTCORBA_Dispatching (this->lanes_, - priority_mapping, - current.in ()), - 0); - } - ACE_CATCHANY - { - } - ACE_ENDTRY; - - return dispatching; -} - -void -TAO_EC_RTCORBA_Factory::destroy_dispatching (TAO_EC_Dispatching *x) -{ - this->body_->destroy_dispatching (x); -} - -TAO_EC_Filter_Builder* -TAO_EC_RTCORBA_Factory::create_filter_builder (TAO_EC_Event_Channel_Base *ec) -{ - return this->body_->create_filter_builder (ec); -} - -void -TAO_EC_RTCORBA_Factory::destroy_filter_builder (TAO_EC_Filter_Builder *x) -{ - this->body_->destroy_filter_builder (x); -} - -TAO_EC_Supplier_Filter_Builder* -TAO_EC_RTCORBA_Factory::create_supplier_filter_builder (TAO_EC_Event_Channel_Base *ec) -{ - return this->body_->create_supplier_filter_builder (ec); -} - -void -TAO_EC_RTCORBA_Factory::destroy_supplier_filter_builder (TAO_EC_Supplier_Filter_Builder *x) -{ - this->body_->destroy_supplier_filter_builder (x); -} - -TAO_EC_ConsumerAdmin* -TAO_EC_RTCORBA_Factory::create_consumer_admin (TAO_EC_Event_Channel_Base *ec) -{ - return this->body_->create_consumer_admin (ec); -} - -void -TAO_EC_RTCORBA_Factory::destroy_consumer_admin (TAO_EC_ConsumerAdmin *x) -{ - this->body_->destroy_consumer_admin (x); -} - -TAO_EC_SupplierAdmin* -TAO_EC_RTCORBA_Factory::create_supplier_admin (TAO_EC_Event_Channel_Base *ec) -{ - return this->body_->create_supplier_admin (ec); -} - -void -TAO_EC_RTCORBA_Factory::destroy_supplier_admin (TAO_EC_SupplierAdmin *x) -{ - this->body_->destroy_supplier_admin (x); -} - -TAO_EC_ProxyPushSupplier* -TAO_EC_RTCORBA_Factory::create_proxy_push_supplier (TAO_EC_Event_Channel_Base *ec) -{ - return this->body_->create_proxy_push_supplier (ec); -} - -void -TAO_EC_RTCORBA_Factory::destroy_proxy_push_supplier (TAO_EC_ProxyPushSupplier *x) -{ - this->body_->destroy_proxy_push_supplier (x); -} - -TAO_EC_ProxyPushConsumer* -TAO_EC_RTCORBA_Factory::create_proxy_push_consumer (TAO_EC_Event_Channel_Base *ec) -{ - return this->body_->create_proxy_push_consumer (ec); -} - -void -TAO_EC_RTCORBA_Factory::destroy_proxy_push_consumer (TAO_EC_ProxyPushConsumer *x) -{ - this->body_->destroy_proxy_push_consumer (x); -} - -TAO_EC_Timeout_Generator* -TAO_EC_RTCORBA_Factory::create_timeout_generator (TAO_EC_Event_Channel_Base *ec) -{ - return this->body_->create_timeout_generator (ec); -} - -void -TAO_EC_RTCORBA_Factory::destroy_timeout_generator (TAO_EC_Timeout_Generator *x) -{ - this->body_->destroy_timeout_generator (x); -} - -TAO_EC_ObserverStrategy* -TAO_EC_RTCORBA_Factory::create_observer_strategy (TAO_EC_Event_Channel_Base *ec) -{ - return this->body_->create_observer_strategy (ec); -} - -void -TAO_EC_RTCORBA_Factory::destroy_observer_strategy (TAO_EC_ObserverStrategy *x) -{ - this->body_->destroy_observer_strategy (x); -} - -TAO_EC_Scheduling_Strategy* -TAO_EC_RTCORBA_Factory::create_scheduling_strategy (TAO_EC_Event_Channel_Base *ec) -{ - return this->body_->create_scheduling_strategy (ec); -} - -void -TAO_EC_RTCORBA_Factory::destroy_scheduling_strategy (TAO_EC_Scheduling_Strategy* x) -{ - this->body_->destroy_scheduling_strategy (x); -} - -TAO_EC_ProxyPushConsumer_Collection* -TAO_EC_RTCORBA_Factory::create_proxy_push_consumer_collection (TAO_EC_Event_Channel_Base *ec) -{ - return this->body_->create_proxy_push_consumer_collection (ec); -} - -void -TAO_EC_RTCORBA_Factory::destroy_proxy_push_consumer_collection (TAO_EC_ProxyPushConsumer_Collection *x) -{ - this->body_->destroy_proxy_push_consumer_collection (x); -} - -TAO_EC_ProxyPushSupplier_Collection* -TAO_EC_RTCORBA_Factory::create_proxy_push_supplier_collection (TAO_EC_Event_Channel_Base *ec) -{ - return this->body_->create_proxy_push_supplier_collection (ec); -} - -void -TAO_EC_RTCORBA_Factory::destroy_proxy_push_supplier_collection (TAO_EC_ProxyPushSupplier_Collection *x) -{ - this->body_->destroy_proxy_push_supplier_collection (x); -} - -ACE_Lock* -TAO_EC_RTCORBA_Factory::create_consumer_lock (void) -{ - return this->body_->create_consumer_lock (); -} - -void -TAO_EC_RTCORBA_Factory::destroy_consumer_lock (ACE_Lock* x) -{ - this->body_->destroy_consumer_lock (x); -} - -ACE_Lock* -TAO_EC_RTCORBA_Factory::create_supplier_lock (void) -{ - return this->body_->create_supplier_lock (); -} - -void -TAO_EC_RTCORBA_Factory::destroy_supplier_lock (ACE_Lock* x) -{ - this->body_->destroy_supplier_lock (x); -} - -TAO_EC_ConsumerControl* -TAO_EC_RTCORBA_Factory::create_consumer_control (TAO_EC_Event_Channel_Base* ec) -{ - return this->body_->create_consumer_control (ec); -} - -void -TAO_EC_RTCORBA_Factory::destroy_consumer_control (TAO_EC_ConsumerControl* x) -{ - this->body_->destroy_consumer_control (x); -} - -TAO_EC_SupplierControl* -TAO_EC_RTCORBA_Factory::create_supplier_control (TAO_EC_Event_Channel_Base* ec) -{ - return this->body_->create_supplier_control (ec); -} - -void -TAO_EC_RTCORBA_Factory::destroy_supplier_control (TAO_EC_SupplierControl* x) -{ - this->body_->destroy_supplier_control (x); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_RTCORBA_Factory.h b/TAO/orbsvcs/orbsvcs/Event/EC_RTCORBA_Factory.h deleted file mode 100644 index a76bc59f73d..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_RTCORBA_Factory.h +++ /dev/null @@ -1,123 +0,0 @@ -// -*- C++ -*- -/** - * @file EC_RTCORBA_Factory.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_RTCORBA_FACTORY_H -#define TAO_EC_RTCORBA_FACTORY_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/rtcorba_event_export.h" -#include "orbsvcs/Event/EC_Factory.h" -#include "tao/RTCORBA/RTCORBA.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_RTCORBA_Factory - * - * @brief Decorate an EC_Factory to use the EC_RTCORBA_Dispatching - * module. - */ -class TAO_RTCORBAEvent_Export TAO_EC_RTCORBA_Factory : public TAO_EC_Factory -{ -public: - /// Constructor - /** - * @param body The decorated factory. - */ - TAO_EC_RTCORBA_Factory (TAO_EC_Factory *body, - const RTCORBA::ThreadpoolLanes &lanes); - - /// destructor... - virtual ~TAO_EC_RTCORBA_Factory (void); - - // Decorated methods... - virtual int init (int argc, char* argv[]); - virtual int fini (void); - virtual TAO_EC_Dispatching* - create_dispatching (TAO_EC_Event_Channel_Base*); - virtual void - destroy_dispatching (TAO_EC_Dispatching*) ; - virtual TAO_EC_Filter_Builder* - create_filter_builder (TAO_EC_Event_Channel_Base*) ; - virtual void - destroy_filter_builder (TAO_EC_Filter_Builder*); - virtual TAO_EC_Supplier_Filter_Builder* - create_supplier_filter_builder (TAO_EC_Event_Channel_Base*) ; - virtual void - destroy_supplier_filter_builder (TAO_EC_Supplier_Filter_Builder*); - virtual TAO_EC_ConsumerAdmin* - create_consumer_admin (TAO_EC_Event_Channel_Base*) ; - virtual void - destroy_consumer_admin (TAO_EC_ConsumerAdmin*); - virtual TAO_EC_SupplierAdmin* - create_supplier_admin (TAO_EC_Event_Channel_Base*) ; - virtual void - destroy_supplier_admin (TAO_EC_SupplierAdmin*); - virtual TAO_EC_ProxyPushSupplier* - create_proxy_push_supplier (TAO_EC_Event_Channel_Base*); - virtual void - destroy_proxy_push_supplier (TAO_EC_ProxyPushSupplier*); - virtual TAO_EC_ProxyPushConsumer* - create_proxy_push_consumer (TAO_EC_Event_Channel_Base*); - virtual void - destroy_proxy_push_consumer (TAO_EC_ProxyPushConsumer*); - virtual TAO_EC_Timeout_Generator* - create_timeout_generator (TAO_EC_Event_Channel_Base*) ; - virtual void - destroy_timeout_generator (TAO_EC_Timeout_Generator*); - virtual TAO_EC_ObserverStrategy* - create_observer_strategy (TAO_EC_Event_Channel_Base*); - virtual void - destroy_observer_strategy (TAO_EC_ObserverStrategy*); - virtual TAO_EC_Scheduling_Strategy* - create_scheduling_strategy (TAO_EC_Event_Channel_Base*); - virtual void - destroy_scheduling_strategy (TAO_EC_Scheduling_Strategy*); - virtual TAO_EC_ProxyPushConsumer_Collection* - create_proxy_push_consumer_collection (TAO_EC_Event_Channel_Base*); - virtual void - destroy_proxy_push_consumer_collection (TAO_EC_ProxyPushConsumer_Collection*); - virtual TAO_EC_ProxyPushSupplier_Collection* - create_proxy_push_supplier_collection (TAO_EC_Event_Channel_Base*); - virtual void - destroy_proxy_push_supplier_collection (TAO_EC_ProxyPushSupplier_Collection*); - virtual ACE_Lock* create_consumer_lock (void); - virtual void destroy_consumer_lock (ACE_Lock*); - virtual ACE_Lock* create_supplier_lock (void); - virtual void destroy_supplier_lock (ACE_Lock*); - virtual TAO_EC_ConsumerControl* - create_consumer_control (TAO_EC_Event_Channel_Base*); - virtual void - destroy_consumer_control (TAO_EC_ConsumerControl*); - virtual TAO_EC_SupplierControl* - create_supplier_control (TAO_EC_Event_Channel_Base*); - virtual void - destroy_supplier_control (TAO_EC_SupplierControl*); - -protected: - /// The decorated factory - TAO_EC_Factory *body_; - - /// Configure the thread pool lanes. - RTCORBA::ThreadpoolLanes lanes_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* TAO_EC_RTCORBA_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_ConsumerControl.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_ConsumerControl.cpp deleted file mode 100644 index a8aafe81f0b..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_ConsumerControl.cpp +++ /dev/null @@ -1,276 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_ConsumerAdmin.h" -#include "orbsvcs/Event/EC_Reactive_ConsumerControl.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "orbsvcs/Event/EC_ProxySupplier.h" -#include "orbsvcs/Event/EC_ProxyConsumer.h" // @@ MSVC 6 bug - -#include "tao/Messaging/Messaging.h" -#include "tao/ORB_Core.h" - -#include "ace/Reactor.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Reactive_ConsumerControl.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, EC_Reactive_ConsumerControl, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Reactive_ConsumerControl:: - TAO_EC_Reactive_ConsumerControl (const ACE_Time_Value &rate, - const ACE_Time_Value &timeout, - TAO_EC_Event_Channel_Base *ec, - CORBA::ORB_ptr orb) - : rate_ (rate), - timeout_ (timeout), - adapter_ (this), - event_channel_ (ec), - orb_ (CORBA::ORB::_duplicate (orb)) -#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 - , timer_id_ (-1) -#endif /* TAO_HAS_CORBA_MESSAGING != 0*/ -{ - this->reactor_ = - this->orb_->orb_core ()->reactor (); -} - -TAO_EC_Reactive_ConsumerControl::~TAO_EC_Reactive_ConsumerControl (void) -{ -} - -void -TAO_EC_Reactive_ConsumerControl::query_consumers ( - ACE_ENV_SINGLE_ARG_DECL) -{ - TAO_EC_Ping_Consumer worker (this); - this->event_channel_->for_each_consumer (&worker - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_EC_Reactive_ConsumerControl::handle_timeout ( - const ACE_Time_Value &, - const void *) -{ - // NOTE, setting RELATIVE_RT_TIMEOUT_POLICY for the duration of - // query_consumers () below has greater impact than desired. For - // example, while we are pinging consumers here, a nested upcall, - // which requires making remote calls may come into the ORB. Those - // remote calls will be carried out with with - // RELATIVE_RT_TIMEOUT_POLICY set here in effect. - - // @@ TODO: should use Guard to set and reset policies. - ACE_TRY_NEW_ENV - { - // Query the state of the Current object *before* we initiate - // the iteration... - CORBA::PolicyTypeSeq types; - CORBA::PolicyList_var policies = - this->policy_current_->get_policy_overrides (types - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Change the timeout - this->policy_current_->set_policy_overrides (this->policy_list_, - CORBA::ADD_OVERRIDE - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Query the state of the consumers... - this->query_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - this->policy_current_->set_policy_overrides (policies.in (), - CORBA::SET_OVERRIDE - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - for (CORBA::ULong i = 0; i != policies->length (); ++i) - { - policies[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCHANY - { - // Ignore all exceptions - } - ACE_ENDTRY; -} - -int -TAO_EC_Reactive_ConsumerControl::activate (void) -{ -#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 - ACE_TRY_NEW_ENV - { - // Get the PolicyCurrent object - CORBA::Object_var tmp = - this->orb_->resolve_initial_references ("PolicyCurrent" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - this->policy_current_ = - CORBA::PolicyCurrent::_narrow (tmp.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Timeout for polling state (default = 10 msec) - TimeBase::TimeT timeout = timeout_.usec() * 10; - CORBA::Any any; - any <<= timeout; - - this->policy_list_.length (1); - this->policy_list_[0] = - this->orb_->create_policy ( - Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE, - any - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Only schedule the timer, when the rate is not zero - if (this->rate_ != ACE_Time_Value::zero) - { - // Schedule the timer after these policies has been set, because the - // handle_timeout uses these policies, if done in front, the channel - // can crash when the timeout expires before initiazation is ready. - timer_id_ = this->reactor_->schedule_timer (&this->adapter_, - 0, - this->rate_, - this->rate_); - if (timer_id_ == -1) - return -1; - } - } - ACE_CATCHANY - { - return -1; - } - ACE_ENDTRY; -#endif /* TAO_HAS_CORBA_MESSAGING */ - - return 0; -} - -int -TAO_EC_Reactive_ConsumerControl::shutdown (void) -{ - int r = 0; - -#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 - r = this->reactor_->cancel_timer (timer_id_); -#endif /* TAO_HAS_CORBA_MESSAGING */ - this->adapter_.reactor (0); - return r; -} - -void -TAO_EC_Reactive_ConsumerControl::consumer_not_exist ( - TAO_EC_ProxyPushSupplier *proxy - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - //ACE_DEBUG ((LM_DEBUG, - // "EC_Reactive_ConsumerControl(%P|%t) - " - // "Consumer %x does not exists\n", long(proxy))); - proxy->disconnect_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Reactive_ConsumerControl::consumer_not_exist"); - // Ignore all exceptions.. - } - ACE_ENDTRY; -} - -void -TAO_EC_Reactive_ConsumerControl::system_exception ( - TAO_EC_ProxyPushSupplier *proxy, - CORBA::SystemException & /* exception */ - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - // The current implementation is very strict, and kicks out a - // client on the first system exception. We may - // want to be more lenient in the future, for example, - // this is TAO's minor code for a failed connection. - // - // if (CORBA::TRANSIENT::_narrow (&exception) != 0 - // && exception->minor () == 0x54410085) - // return; - - // Anything else is serious, including timeouts... - proxy->disconnect_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore all exceptions.. - } - ACE_ENDTRY; -} - -// **************************************************************** - -TAO_EC_ConsumerControl_Adapter::TAO_EC_ConsumerControl_Adapter ( - TAO_EC_Reactive_ConsumerControl *adaptee) - : adaptee_ (adaptee) -{ -} - -int -TAO_EC_ConsumerControl_Adapter::handle_timeout ( - const ACE_Time_Value &tv, - const void *arg) -{ - this->adaptee_->handle_timeout (tv, arg); - return 0; -} - -// **************************************************************** - -void -TAO_EC_Ping_Consumer::work (TAO_EC_ProxyPushSupplier *supplier - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - CORBA::Boolean disconnected; - CORBA::Boolean non_existent = - supplier->consumer_non_existent (disconnected - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (non_existent && !disconnected) - { - this->control_->consumer_not_exist (supplier ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCH (CORBA::OBJECT_NOT_EXIST, ex) - { - this->control_->consumer_not_exist (supplier ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCH (CORBA::TRANSIENT, transient) - { - // This is TAO's minor code for a failed connection, we may - // want to be more lenient in the future.. - // if (transient.minor () == 0x54410085) - this->control_->consumer_not_exist (supplier ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore all exceptions - } - ACE_ENDTRY; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_ConsumerControl.h b/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_ConsumerControl.h deleted file mode 100644 index d6e8cf176d5..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_ConsumerControl.h +++ /dev/null @@ -1,155 +0,0 @@ -// -*- C++ -*- -/** - * @file EC_Reactive_ConsumerControl.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_REACTIVE_CONSUMERCONTROL_H -#define TAO_EC_REACTIVE_CONSUMERCONTROL_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_ConsumerControl.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/ESF/ESF_Worker.h" - -#include "tao/ORB.h" -#include "tao/PolicyC.h" - -#include "ace/Event_Handler.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Event_Channel_Base; - -class TAO_EC_Reactive_ConsumerControl; - -/** - * @class TAO_EC_ConsumerControl_Adapter - * - * @brief Forwards timeout events to the Reactive ConsumerControl - * - * The Reactive ConsumerControl strategy uses the reactor to - * periodically wakeup and verify the state of the consumers - * registered with the Event Channel. - */ -class TAO_RTEvent_Serv_Export TAO_EC_ConsumerControl_Adapter : public ACE_Event_Handler -{ -public: - /// Constructor - TAO_EC_ConsumerControl_Adapter (TAO_EC_Reactive_ConsumerControl *adaptee); - - // = Documented in ACE_Event_Handler. - virtual int handle_timeout (const ACE_Time_Value &tv, - const void *arg = 0); - -private: - /// The adapted object - TAO_EC_Reactive_ConsumerControl *adaptee_; -}; - -/** - * @class TAO_EC_Reactive_ConsumerControl - * - * @brief ConsumerControl - * - * Defines the interface for the consumer control strategy. - * This strategy handles misbehaving or failing consumers. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Reactive_ConsumerControl : public TAO_EC_ConsumerControl -{ -public: - /// Constructor. It does not assume ownership of the @a event_channel - /// parameter. - TAO_EC_Reactive_ConsumerControl (const ACE_Time_Value &rate, - const ACE_Time_Value &timeout, - TAO_EC_Event_Channel_Base *event_channel, - CORBA::ORB_ptr orb); - - /// Destructor. - virtual ~TAO_EC_Reactive_ConsumerControl (void); - - /// Receive the timeout from the adapter - void handle_timeout (const ACE_Time_Value &tv, - const void* arg); - - // = Documented in TAO_EC_ConsumerControl - virtual int activate (void); - virtual int shutdown (void); - virtual void consumer_not_exist (TAO_EC_ProxyPushSupplier *proxy - ACE_ENV_ARG_DECL_NOT_USED); - virtual void system_exception (TAO_EC_ProxyPushSupplier *proxy, - CORBA::SystemException & - ACE_ENV_ARG_DECL_NOT_USED); - -private: - /// Check if the consumers still exists. It is a helper method for - /// handle_timeout() to isolate the exceptions. - void query_consumers (ACE_ENV_SINGLE_ARG_DECL); - -private: - /// The polling rate - ACE_Time_Value rate_; - - /// The polling timeout - ACE_Time_Value timeout_; - - /// The Adapter for the reactor events - TAO_EC_ConsumerControl_Adapter adapter_; - - /// The event channel - TAO_EC_Event_Channel_Base *event_channel_; - - /// The ORB - CORBA::ORB_var orb_; - - /// To control the timeout policy in the thread - CORBA::PolicyCurrent_var policy_current_; - - /// Precomputed policy list to the set timeout. - CORBA::PolicyList policy_list_; - - /// The ORB reactor - ACE_Reactor *reactor_; - -#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 - /// The timer id - long timer_id_; -#endif /* TAO_HAS_CORBA_MESSAGING */ -}; - -// **************************************************************** - -class TAO_EC_Ping_Consumer : public TAO_ESF_Worker<TAO_EC_ProxyPushSupplier> -{ -public: - TAO_EC_Ping_Consumer (TAO_EC_ConsumerControl *control); - - virtual void work (TAO_EC_ProxyPushSupplier *supplier - ACE_ENV_ARG_DECL); - -private: - TAO_EC_ConsumerControl *control_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Reactive_ConsumerControl.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_CONSUMERCONTROL_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_ConsumerControl.i b/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_ConsumerControl.i deleted file mode 100644 index d365ca2ae4d..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_ConsumerControl.i +++ /dev/null @@ -1,13 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_Ping_Consumer::TAO_EC_Ping_Consumer (TAO_EC_ConsumerControl *control) - : control_ (control) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_Dispatching.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_Dispatching.cpp deleted file mode 100644 index eb7b1bd5b7d..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_Dispatching.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Reactive_Dispatching.h" -#include "orbsvcs/Event/EC_ProxySupplier.h" - -ACE_RCSID(Event, EC_Reactive_Dispatching, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Reactive_Dispatching::TAO_EC_Reactive_Dispatching (void) - : TAO_EC_Dispatching () -{ -} - -void -TAO_EC_Reactive_Dispatching::activate (void) -{ -} - -void -TAO_EC_Reactive_Dispatching::shutdown (void) -{ -} - -void -TAO_EC_Reactive_Dispatching::push (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& - ACE_ENV_ARG_DECL) -{ - proxy->reactive_push_to_consumer (consumer, event ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Reactive_Dispatching::push_nocopy (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& - ACE_ENV_ARG_DECL) -{ - proxy->reactive_push_to_consumer (consumer, event ACE_ENV_ARG_PARAMETER); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_Dispatching.h b/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_Dispatching.h deleted file mode 100644 index 0ef3be3bedb..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_Dispatching.h +++ /dev/null @@ -1,65 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Reactive_Dispatching.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_REACTIVE_DISPATCHING_H -#define TAO_EC_REACTIVE_DISPATCHING_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Dispatching.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Reactive_Dispatching - * - * @brief Dispatch using the caller thread. - * - * The events are dispatched in FIFO ordering, using the invoking - * thread to push the event to the consumer. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Reactive_Dispatching : public TAO_EC_Dispatching -{ -public: - /// The scheduler is used to find the range of priorities and similar - /// info. - TAO_EC_Reactive_Dispatching (void); - - // = The EC_Dispatching methods. - virtual void activate (void); - virtual void shutdown (void); - virtual void push (TAO_EC_ProxyPushSupplier *proxy, - RtecEventComm::PushConsumer_ptr consumer, - const RtecEventComm::EventSet &event, - TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL_WITH_DEFAULTS); - virtual void push_nocopy (TAO_EC_ProxyPushSupplier *proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet &event, - TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL_WITH_DEFAULTS); -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_REACTIVE_DISPATCHING_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_SupplierControl.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_SupplierControl.cpp deleted file mode 100644 index 10cdcd05bdb..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_SupplierControl.cpp +++ /dev/null @@ -1,266 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_SupplierAdmin.h" -#include "orbsvcs/Event/EC_Reactive_SupplierControl.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "orbsvcs/Event/EC_ProxyConsumer.h" -#include "orbsvcs/Event/EC_ProxySupplier.h" // @@ MSVC 6 bug - -#include "tao/Messaging/Messaging.h" -#include "tao/ORB_Core.h" - -#include "ace/Reactor.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Reactive_SupplierControl.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, EC_Reactive_SupplierControl, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Reactive_SupplierControl:: - TAO_EC_Reactive_SupplierControl (const ACE_Time_Value &rate, - const ACE_Time_Value &timeout, - TAO_EC_Event_Channel_Base *ec, - CORBA::ORB_ptr orb) - : rate_ (rate), - timeout_ (timeout), - adapter_ (this), - event_channel_ (ec), - orb_ (CORBA::ORB::_duplicate (orb)) -#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 - , timer_id_ (-1) -#endif /* TAO_HAS_CORBA_MESSAGING != 0*/ -{ - this->reactor_ = - this->orb_->orb_core ()->reactor (); -} - -TAO_EC_Reactive_SupplierControl::~TAO_EC_Reactive_SupplierControl (void) -{ -} - -void -TAO_EC_Reactive_SupplierControl::query_suppliers ( - ACE_ENV_SINGLE_ARG_DECL) -{ - TAO_EC_Ping_Supplier worker (this); - this->event_channel_->for_each_supplier (&worker - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_EC_Reactive_SupplierControl::handle_timeout ( - const ACE_Time_Value &, - const void *) -{ - ACE_TRY_NEW_ENV - { - // Query the state of the Current object *before* we initiate - // the iteration... - CORBA::PolicyTypeSeq types; - CORBA::PolicyList_var policies = - this->policy_current_->get_policy_overrides (types - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Change the timeout - this->policy_current_->set_policy_overrides (this->policy_list_, - CORBA::ADD_OVERRIDE - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Query the state of the suppliers... - this->query_suppliers (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - this->policy_current_->set_policy_overrides (policies.in (), - CORBA::SET_OVERRIDE - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - for (CORBA::ULong i = 0; i != policies->length (); ++i) - { - policies[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCHANY - { - // Ignore all exceptions - } - ACE_ENDTRY; -} - -int -TAO_EC_Reactive_SupplierControl::activate (void) -{ -#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 - ACE_TRY_NEW_ENV - { - // Get the PolicyCurrent object - CORBA::Object_var tmp = - this->orb_->resolve_initial_references ("PolicyCurrent" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - this->policy_current_ = - CORBA::PolicyCurrent::_narrow (tmp.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Timeout for polling state (default = 10 msec) - TimeBase::TimeT timeout = timeout_.usec() * 10; - CORBA::Any any; - any <<= timeout; - - this->policy_list_.length (1); - this->policy_list_[0] = - this->orb_->create_policy ( - Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE, - any - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Only schedule the timer, when the rate is not zero - if (this->rate_ != ACE_Time_Value::zero) - { - // Schedule the timer after these policies has been set, because the - // handle_timeout uses these policies, if done in front, the channel - // can crash when the timeout expires before initiazation is ready. - timer_id_ = this->reactor_->schedule_timer (&this->adapter_, - 0, - this->rate_, - this->rate_); - if (timer_id_ == -1) - return -1; - } - } - ACE_CATCHANY - { - return -1; - } - ACE_ENDTRY; -#endif /* TAO_HAS_CORBA_MESSAGING */ - - return 0; -} - -int -TAO_EC_Reactive_SupplierControl::shutdown (void) -{ - int r = 0; - -#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 - r = this->reactor_->cancel_timer (timer_id_); -#endif /* TAO_HAS_CORBA_MESSAGING */ - this->adapter_.reactor (0); - return r; -} - -void -TAO_EC_Reactive_SupplierControl::supplier_not_exist ( - TAO_EC_ProxyPushConsumer *proxy - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - //ACE_DEBUG ((LM_DEBUG, - // "EC_Reactive_SupplierControl(%P|%t) - " - // "Consumer %x does not exists\n", long(proxy))); - proxy->disconnect_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore all exceptions.. - } - ACE_ENDTRY; -} - -void -TAO_EC_Reactive_SupplierControl::system_exception ( - TAO_EC_ProxyPushConsumer *proxy, - CORBA::SystemException & /* exception */ - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - // The current implementation is very strict, and kicks out a - // client on the first system exception. We may - // want to be more lenient in the future, for example, - // this is TAO's minor code for a failed connection. - // - // if (CORBA::TRANSIENT::_narrow (&exception) != 0 - // && exception->minor () == 0x54410085) - // return; - - // Anything else is serious, including timeouts... - proxy->disconnect_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore all exceptions.. - } - ACE_ENDTRY; -} - -// **************************************************************** - -TAO_EC_SupplierControl_Adapter::TAO_EC_SupplierControl_Adapter ( - TAO_EC_Reactive_SupplierControl *adaptee) - : adaptee_ (adaptee) -{ -} - -int -TAO_EC_SupplierControl_Adapter::handle_timeout ( - const ACE_Time_Value &tv, - const void *arg) -{ - this->adaptee_->handle_timeout (tv, arg); - return 0; -} - -// **************************************************************** - -void -TAO_EC_Ping_Supplier::work (TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - CORBA::Boolean disconnected; - CORBA::Boolean non_existent = - consumer->supplier_non_existent (disconnected - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (non_existent && !disconnected) - { - this->control_->supplier_not_exist (consumer ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCH (CORBA::OBJECT_NOT_EXIST, ex) - { - this->control_->supplier_not_exist (consumer ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCH (CORBA::TRANSIENT, transient) - { - // This is TAO's minor code for a failed connection, we may - // want to be more lenient in the future.. - // if (transient.minor () == 0x54410085) - this->control_->supplier_not_exist (consumer ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore all exceptions - } - ACE_ENDTRY; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_SupplierControl.h b/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_SupplierControl.h deleted file mode 100644 index 141ddf9668c..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_SupplierControl.h +++ /dev/null @@ -1,166 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Reactive_SupplierControl.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_REACTIVE_SUPPLIERCONTROL_H -#define TAO_EC_REACTIVE_SUPPLIERCONTROL_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_SupplierControl.h" - -#include "orbsvcs/ESF/ESF_Worker.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/ORB.h" -#include "tao/PolicyC.h" - -#include "ace/Event_Handler.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Event_Channel_Base; - -class TAO_EC_Reactive_SupplierControl; - -/** - * @class TAO_EC_SupplierControl_Adapter - * - * @brief Forwards timeout events to the Reactive SupplierControl - * - * The Reactive SupplierControl strategy uses the reactor to - * periodically wakeup and verify the state of the suppliers - * registered with the Event Channel. - * - * @todo Marina Spivak made the following observation: these classes - * and implementation seem nearly identical to those in - * EC_Reactive_ConsumerControl.* The only differences are using - * consumer_admin collection vs supplier_admin, and calling - * disconnect_push_consumer vs disconnect_push_supplier ... Seems - * like it may be a good idea to change some naming and templatize... - * @todo The same templates should be used for the Notification and - * COS Event services. - * - */ -class TAO_RTEvent_Serv_Export TAO_EC_SupplierControl_Adapter : public ACE_Event_Handler -{ -public: - /// Constructor - TAO_EC_SupplierControl_Adapter (TAO_EC_Reactive_SupplierControl *adaptee); - - // = Documented in ACE_Event_Handler. - virtual int handle_timeout (const ACE_Time_Value &tv, - const void *arg = 0); - -private: - /// The adapted object - TAO_EC_Reactive_SupplierControl *adaptee_; -}; - -/** - * @class TAO_EC_Reactive_SupplierControl - * - * @brief SupplierControl - * - * Defines the interface for the supplier control strategy. - * This strategy handles misbehaving or failing suppliers. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Reactive_SupplierControl : public TAO_EC_SupplierControl -{ -public: - /// Constructor. It does not assume ownership of the @a event_channel - /// parameter. - TAO_EC_Reactive_SupplierControl (const ACE_Time_Value &rate, - const ACE_Time_Value &timeout, - TAO_EC_Event_Channel_Base *event_channel, - CORBA::ORB_ptr orb); - - /// Destructor. - virtual ~TAO_EC_Reactive_SupplierControl (void); - - /// Receive the timeout from the adapter - void handle_timeout (const ACE_Time_Value &tv, - const void* arg); - - // = Documented in TAO_EC_SupplierControl - virtual int activate (void); - virtual int shutdown (void); - virtual void supplier_not_exist (TAO_EC_ProxyPushConsumer *proxy - ACE_ENV_ARG_DECL_NOT_USED); - virtual void system_exception (TAO_EC_ProxyPushConsumer *proxy, - CORBA::SystemException & - ACE_ENV_ARG_DECL_NOT_USED); - -private: - /// Check if the suppliers still exists. It is a helper method for - /// handle_timeout() to isolate the exceptions. - void query_suppliers (ACE_ENV_SINGLE_ARG_DECL); - -private: - /// The polling rate - ACE_Time_Value rate_; - - /// The polling timeout - ACE_Time_Value timeout_; - - /// The Adapter for the reactor events - TAO_EC_SupplierControl_Adapter adapter_; - - /// The event channel - TAO_EC_Event_Channel_Base *event_channel_; - - /// The ORB - CORBA::ORB_var orb_; - - /// To control the timeout policy in the thread - CORBA::PolicyCurrent_var policy_current_; - - /// Precomputed policy list to the set timeout. - CORBA::PolicyList policy_list_; - - /// The ORB reactor - ACE_Reactor *reactor_; - -#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 - /// The timer id - long timer_id_; -#endif /* TAO_HAS_CORBA_MESSAGING */ -}; - -// **************************************************************** - -class TAO_EC_Ping_Supplier : public TAO_ESF_Worker<TAO_EC_ProxyPushConsumer> -{ -public: - TAO_EC_Ping_Supplier (TAO_EC_SupplierControl *control); - - virtual void work (TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL); - -private: - TAO_EC_SupplierControl *control_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Reactive_SupplierControl.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_SUPPLIERCONTROL_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_SupplierControl.i b/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_SupplierControl.i deleted file mode 100644 index 3ffaf226464..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_SupplierControl.i +++ /dev/null @@ -1,13 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_Ping_Supplier::TAO_EC_Ping_Supplier (TAO_EC_SupplierControl *control) - : control_ (control) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_Timeout_Generator.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_Timeout_Generator.cpp deleted file mode 100644 index fbdfb022768..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_Timeout_Generator.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Reactive_Timeout_Generator.h" -#include "ace/Reactor.h" - -ACE_RCSID (Event, - EC_Reactive_Timeout_Generator, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Reactive_Timeout_Generator:: - TAO_EC_Reactive_Timeout_Generator (ACE_Reactor *reactor) - : reactor_ (reactor) -{ -} - -TAO_EC_Reactive_Timeout_Generator::~TAO_EC_Reactive_Timeout_Generator (void) -{ -} - -void -TAO_EC_Reactive_Timeout_Generator::activate (void) -{ -} - -void -TAO_EC_Reactive_Timeout_Generator::shutdown (void) -{ - this->reactor_->cancel_timer (&this->event_handler_); - this->event_handler_.reactor (0); -} - -int -TAO_EC_Reactive_Timeout_Generator::schedule_timer ( - TAO_EC_Timeout_Filter* filter, - const ACE_Time_Value& delta, - const ACE_Time_Value& interval) -{ - return this->reactor_->schedule_timer (&this->event_handler_, - static_cast<void*> (filter), - delta, - interval); -} - -int -TAO_EC_Reactive_Timeout_Generator::cancel_timer ( - const TAO_EC_QOS_Info&, - int id) -{ - const void *vp; - - return this->reactor_->cancel_timer (id, &vp); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_Timeout_Generator.h b/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_Timeout_Generator.h deleted file mode 100644 index 8ab4d18da31..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Reactive_Timeout_Generator.h +++ /dev/null @@ -1,70 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Reactive_Timeout_Generator.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_REACTIVE_TIMEOUT_GENERATOR_H -#define TAO_EC_REACTIVE_TIMEOUT_GENERATOR_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Timeout_Generator.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Reactive_Timeout_Generator - * - * @brief A simple implementation of the Timeout_Generator based on the - * Reactor. - * - * Implements the Timeout_Generator using an ACE_Reactor. Usually - * the same reactor that is used by the ORB where the EC runs. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Reactive_Timeout_Generator - : public TAO_EC_Timeout_Generator -{ -public: - /// Constructor. - /// If <reactor> is 0 then we use the reactor in the ORB singleton. - TAO_EC_Reactive_Timeout_Generator (ACE_Reactor *reactor = 0); - - /// destructor - virtual ~TAO_EC_Reactive_Timeout_Generator (void); - - // = The TAO_EC_Timeout_Generator methods. - virtual void activate (void); - virtual void shutdown (void); - virtual int schedule_timer (TAO_EC_Timeout_Filter* filter, - const ACE_Time_Value& delta, - const ACE_Time_Value& interval); - virtual int cancel_timer (const TAO_EC_QOS_Info& info, - int id); - -private: - /// The reactor - ACE_Reactor *reactor_; - - /// An adapter to receive the timeout events. - TAO_EC_Timeout_Adapter event_handler_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_REACTIVE_TIMEOUT_GENERATOR_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Factory.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Factory.cpp deleted file mode 100644 index 66c4afcc9ac..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Factory.cpp +++ /dev/null @@ -1,225 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Sched_Factory.h" -#include "orbsvcs/Event/EC_Priority_Dispatching.h" -#include "orbsvcs/Event/EC_Priority_Scheduling.h" -#include "orbsvcs/Event/EC_Sched_Filter_Builder.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "orbsvcs/RtecSchedulerC.h" - -#include "ace/Arg_Shifter.h" -#include "ace/Sched_Params.h" -#include "ace/OS_NS_strings.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Sched_Factory.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, EC_Sched_Factory, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Sched_Factory::~TAO_EC_Sched_Factory (void) -{ -} - -int -TAO_EC_Sched_Factory::init (int argc, ACE_TCHAR* argv[]) -{ - ACE_Arg_Shifter arg_shifter (argc, argv); - - while (arg_shifter.is_anything_left ()) - { - const ACE_TCHAR* arg = arg_shifter.get_current (); - - if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECDispatching")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("reactive")) == 0) - { - this->dispatching_ = 0; - } - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("mt")) == 0) - { - this->dispatching_ = 1; - } - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("priority")) == 0) - { - this->dispatching_ = 2; - } - else - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT("EC_Sched_Factory - ") - ACE_TEXT("unsupported dispatching <%s>\n"), - opt)); - } - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECFiltering")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("null")) == 0) - { - this->filtering_ = 0; - } - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("basic")) == 0) - { - this->filtering_ = 1; - } - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("prefix")) == 0) - { - this->filtering_ = 2; - } - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("priority")) == 0) - { - this->filtering_ = 3; - } - else - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT("EC_Sched_Factory - ") - ACE_TEXT("unsupported filtering <%s>\n"), - opt)); - } - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECTimeout")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("reactive")) == 0) - { - this->timeout_ = 0; - } -#if 0 - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("priority")) == 0) - { - this->timeout_ = 1; - } -#endif /* 0 */ - else - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT("EC_Sched_Factory - ") - ACE_TEXT("unsupported timeout <%s>\n"), - opt)); - } - arg_shifter.consume_arg (); - } - } - - else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECScheduling")) == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - const ACE_TCHAR* opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, ACE_TEXT("null")) == 0) - { - this->scheduling_ = 0; - } - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("group")) == 0) - { - this->scheduling_ = 1; - } - else if (ACE_OS::strcasecmp (opt, ACE_TEXT("priority")) == 0) - { - this->scheduling_ = 2; - } - else - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT("EC_Sched_Factory - ") - ACE_TEXT("unsupported scheduling <%s>\n"), - opt)); - } - arg_shifter.consume_arg (); - } - } - - else - { - arg_shifter.ignore_arg (); - } - } - return this->TAO_EC_Default_Factory::init (argc, argv); -} - -int -TAO_EC_Sched_Factory::fini (void) -{ - return 0; -} - -// **************************************************************** - -TAO_EC_Dispatching* -TAO_EC_Sched_Factory::create_dispatching (TAO_EC_Event_Channel_Base *ec) -{ - if (this->dispatching_ == 2) - return new TAO_EC_Priority_Dispatching (ec); - return this->TAO_EC_Default_Factory::create_dispatching (ec); -} - -TAO_EC_Filter_Builder* -TAO_EC_Sched_Factory::create_filter_builder (TAO_EC_Event_Channel_Base *ec) -{ - if (this->filtering_ == 3) - return new TAO_EC_Sched_Filter_Builder (ec); - - return this->TAO_EC_Default_Factory::create_filter_builder (ec); -} - - -TAO_EC_Timeout_Generator* -TAO_EC_Sched_Factory::create_timeout_generator (TAO_EC_Event_Channel_Base *ec) -{ -#if 0 - if (this->timeout_ == 1) - { - } -#endif - return this->TAO_EC_Default_Factory::create_timeout_generator (ec); -} - -TAO_EC_Scheduling_Strategy* -TAO_EC_Sched_Factory::create_scheduling_strategy (TAO_EC_Event_Channel_Base* ec) -{ - if (this->scheduling_ == 2) - { - CORBA::Object_var tmp = ec->scheduler (); - RtecScheduler::Scheduler_var scheduler = - RtecScheduler::Scheduler::_narrow (tmp.in ()); - return new TAO_EC_Priority_Scheduling (scheduler.in ()); - } - return this->TAO_EC_Sched_Factory::create_scheduling_strategy (ec); -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -// **************************************************************** - -ACE_STATIC_SVC_DEFINE (TAO_EC_Sched_Factory, - ACE_TEXT ("EC_Factory"), - ACE_SVC_OBJ_T, - &ACE_SVC_NAME (TAO_EC_Sched_Factory), - ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, - 0) -ACE_FACTORY_DEFINE (TAO_RTSchedEvent, TAO_EC_Sched_Factory) diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Factory.h b/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Factory.h deleted file mode 100644 index b7b82d791fc..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Factory.h +++ /dev/null @@ -1,71 +0,0 @@ -// -*- C++ -*- -/** - * @file EC_Sched_Factory.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_SCHED_FACTORY_H -#define TAO_EC_SCHED_FACTORY_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Default_Factory.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/Event/sched_event_export.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Sched_Factory - * - * @brief Extend the default factory to support scheduling - * - */ -class TAO_RTSchedEvent_Export TAO_EC_Sched_Factory : public TAO_EC_Default_Factory -{ -public: - /// Constructor - TAO_EC_Sched_Factory (void); - - /// destructor... - virtual ~TAO_EC_Sched_Factory (void); - - // = The Service_Object entry points - virtual int init (int argc, ACE_TCHAR* argv[]); - virtual int fini (void); - - // = The EC_Factory methods - virtual TAO_EC_Dispatching* - create_dispatching (TAO_EC_Event_Channel_Base*); - virtual TAO_EC_Filter_Builder* - create_filter_builder (TAO_EC_Event_Channel_Base*); - virtual TAO_EC_Timeout_Generator* - create_timeout_generator (TAO_EC_Event_Channel_Base*); - virtual TAO_EC_Scheduling_Strategy* - create_scheduling_strategy (TAO_EC_Event_Channel_Base*); - -private: -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Sched_Factory.i" -#endif /* __ACE_INLINE__ */ - -ACE_STATIC_SVC_DECLARE (TAO_EC_Sched_Factory) -ACE_FACTORY_DECLARE (TAO_RTSchedEvent, TAO_EC_Sched_Factory) - -#include /**/ "ace/post.h" -#endif /* TAO_EC_SCHED_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Factory.i b/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Factory.i deleted file mode 100644 index 84cbe2d4a4d..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Factory.i +++ /dev/null @@ -1,13 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_Sched_Factory::TAO_EC_Sched_Factory (void) - : TAO_EC_Default_Factory () -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Filter.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Filter.cpp deleted file mode 100644 index 3eb8e03e214..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Filter.cpp +++ /dev/null @@ -1,283 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Sched_Filter.h" -#include "orbsvcs/Event/EC_QOS_Info.h" -#include "ace/Log_Msg.h" - -ACE_RCSID(Event, EC_Sched_Filter, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Sched_Filter:: - TAO_EC_Sched_Filter (const char* name, - RtecScheduler::handle_t rt_info, - RtecScheduler::Scheduler_ptr scheduler, - TAO_EC_Filter* body, - RtecScheduler::handle_t body_info, - RtecScheduler::handle_t parent_info, - RtecScheduler::Info_Type_t info_type) - - : rt_info_ (rt_info), - rt_info_computed_ (0), - name_ (name), - scheduler_ (RtecScheduler::Scheduler::_duplicate (scheduler)), - body_ (body), - body_info_ (body_info), - parent_info_ (parent_info), - info_type_ (info_type) -{ - this->adopt_child (this->body_); -} - -TAO_EC_Sched_Filter::~TAO_EC_Sched_Filter (void) -{ - delete this->body_; -} - -TAO_EC_Filter::ChildrenIterator -TAO_EC_Sched_Filter::begin (void) const -{ - return this->body_->begin (); -} - -TAO_EC_Filter::ChildrenIterator -TAO_EC_Sched_Filter::end (void) const -{ - return this->body_->end (); -} - -int -TAO_EC_Sched_Filter::size (void) const -{ - return this->body_->size (); -} - -int -TAO_EC_Sched_Filter::filter (const RtecEventComm::EventSet &event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - return this->body_->filter (event, qos_info ACE_ENV_ARG_PARAMETER); -} - -int -TAO_EC_Sched_Filter::filter_nocopy (RtecEventComm::EventSet &event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - return this->body_->filter_nocopy (event, qos_info ACE_ENV_ARG_PARAMETER); -} - -// This is private, so we can make it inline in the .cpp file... -void -TAO_EC_Sched_Filter::compute_qos_info (TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - this->init_rt_info (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - qos_info.rt_info = this->rt_info_; - switch (this->info_type_) - { - default: - case RtecScheduler::DISJUNCTION: - break; - - case RtecScheduler::CONJUNCTION: - case RtecScheduler::OPERATION: - { - RtecScheduler::OS_Priority os_priority; - RtecScheduler::Preemption_Subpriority_t p_subpriority; - RtecScheduler::Preemption_Priority_t p_priority; - this->scheduler_->priority (this->rt_info_, - os_priority, - p_subpriority, - p_priority - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - qos_info.preemption_priority = p_priority; - } - } -} - -void -TAO_EC_Sched_Filter::push (const RtecEventComm::EventSet &event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - if (this->parent () != 0) - { - this->compute_qos_info (qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->parent ()->push (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } -} - -void -TAO_EC_Sched_Filter::push_nocopy (RtecEventComm::EventSet &event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - if (this->parent () != 0) - { - this->compute_qos_info (qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->parent ()->push_nocopy (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } -} - -void -TAO_EC_Sched_Filter::clear (void) -{ - this->body_->clear (); -} - -CORBA::ULong -TAO_EC_Sched_Filter::max_event_size (void) const -{ - return this->body_->max_event_size (); -} - -int -TAO_EC_Sched_Filter::can_match (const RtecEventComm::EventHeader& header) const -{ - return this->body_->can_match (header); -} - -int -TAO_EC_Sched_Filter::add_dependencies (const RtecEventComm::EventHeader& header, - const TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL) -{ - this->init_rt_info (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - int matches = this->body_->add_dependencies (header, - qos_info - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - if (matches != 0) - { - this->scheduler_->add_dependency (this->rt_info_, qos_info.rt_info, 1, - RtecBase::TWO_WAY_CALL - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - RtecScheduler::RT_Info_var info = - this->scheduler_->get (qos_info.rt_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - ACE_DEBUG ((LM_DEBUG, "[%s] ----> [%s]\n", - this->name_.c_str (), - info->entry_point.in ())); - } - - ChildrenIterator end = this->end (); - for (ChildrenIterator i = this->begin (); i != end; ++i) - { - (*i)->add_dependencies (header, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - } - return 0; -} - -void -TAO_EC_Sched_Filter::get_qos_info (TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - this->init_rt_info (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - qos_info.rt_info = this->rt_info_; -} - -void -TAO_EC_Sched_Filter::init_rt_info (ACE_ENV_SINGLE_ARG_DECL) -{ - if (this->rt_info_computed_) - return; - - // Provide dummy values the scheduler will compute them based on the - // dependencies and the fact that this is a DISJUNCTION. - this->scheduler_->set (this->rt_info_, - RtecScheduler::VERY_LOW_CRITICALITY, - 0, // worst_cast_execution_time - 0, // typical_cast_execution_time - 0, // cached_cast_execution_time - 0, // period - RtecScheduler::VERY_LOW_IMPORTANCE, - 0, // quantum - 0, // threads - this->info_type_ - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - -#if 0 - ChildrenIterator end = this->end (); - for (ChildrenIterator i = this->begin (); i != end; ++i) - { - TAO_EC_Filter* filter = *i; - - TAO_EC_QOS_Info child; - filter->get_qos_info (child ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->scheduler_->add_dependency (this->rt_info_, - child.rt_info, 1, - RtecBase::TWO_WAY_CALL - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - RtecScheduler::RT_Info_var info = - this->scheduler_->get (child.rt_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - ACE_DEBUG ((LM_DEBUG, "[%s] ----> [%s]\n", - info->entry_point.in (), - this->name_.c_str ())); - - } -#endif /* 0 */ - -#if 1 - if (this->body_info_ != this->rt_info_) - { - this->scheduler_->add_dependency (this->rt_info_, - this->body_info_, - 1, - RtecBase::TWO_WAY_CALL - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - RtecScheduler::RT_Info_var info = - this->scheduler_->get (this->body_info_ ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - ACE_DEBUG ((LM_DEBUG, "[%s] ----> [%s]\n", - info->entry_point.in (), - this->name_.c_str ())); - } -#endif /* 0 */ - -#if 1 - this->scheduler_->add_dependency (this->parent_info_, - this->rt_info_, - 1, - RtecBase::TWO_WAY_CALL - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - RtecScheduler::RT_Info_var info = - this->scheduler_->get (this->parent_info_ ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - ACE_DEBUG ((LM_DEBUG, "[%s] ----> [%s]\n", - this->name_.c_str (), - info->entry_point.in ())); -#endif /* 0 */ - - this->rt_info_computed_ = 1; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Filter.h b/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Filter.h deleted file mode 100644 index 5645a6eac92..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Filter.h +++ /dev/null @@ -1,129 +0,0 @@ -// -*- C++ -*- -/** - * @file EC_Sched_Filter.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_SCHED_FILTER_H -#define TAO_EC_SCHED_FILTER_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Filter.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/RtecSchedulerC.h" -#include "orbsvcs/Event/sched_event_export.h" -#include "ace/SString.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Sched_Filter - * - * @brief Decorate a filter with scheduling information - * - * This filter decorates a regular filter with scheduling - * information. It creates a new RT_Info entry for the filter and - * it adds the dependencies between the filter and any childrens - * it may have. - * - * <H2>Memory Management</H2> - * It assumes ownership of the children. - */ -class TAO_RTSchedEvent_Export TAO_EC_Sched_Filter : public TAO_EC_Filter -{ -public: - /** - * Constructor. - * It assumes ownership of the <body>, makes a copy of the other - * parameters - */ - TAO_EC_Sched_Filter (const char* name, - RtecScheduler::handle_t rt_info, - RtecScheduler::Scheduler_ptr scheduler, - TAO_EC_Filter* body, - RtecScheduler::handle_t body_info, - RtecScheduler::handle_t parent_info, - RtecScheduler::Info_Type_t info_type); - - /// Destructor - virtual ~TAO_EC_Sched_Filter (void); - - // = The TAO_EC_Filter methods, please check the documentation in - // TAO_EC_Filter. - virtual ChildrenIterator begin (void) const; - virtual ChildrenIterator end (void) const; - virtual int size (void) const; - virtual int filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual int filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void clear (void); - virtual CORBA::ULong max_event_size (void) const; - virtual int can_match (const RtecEventComm::EventHeader& header) const; - virtual int add_dependencies (const RtecEventComm::EventHeader& header, - const TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL); - virtual void get_qos_info (TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - -private: - TAO_EC_Sched_Filter (const TAO_EC_Sched_Filter&); - TAO_EC_Sched_Filter& operator= (const TAO_EC_Sched_Filter&); - - /// Initialize our RT_Info handle and dependencies - void init_rt_info (ACE_ENV_SINGLE_ARG_DECL); - - /// Compute a new qos_info to push up. - void compute_qos_info (TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - -private: - /// The RT_Info handle for this object - RtecScheduler::handle_t rt_info_; - - /// Has the Scheduler been updated? - int rt_info_computed_; - - /// Our operation name - ACE_CString name_; - - /// The scheduler we are going to use - RtecScheduler::Scheduler_var scheduler_; - - /// The implementation - TAO_EC_Filter* body_; - - /// The RT_Info handle for the body - RtecScheduler::handle_t body_info_; - - /// The RT_Info handle for the parent - RtecScheduler::handle_t parent_info_; - - /// Required for the scheduling service - RtecScheduler::Info_Type_t info_type_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* TAO_EC_SCHED_FILTER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Filter_Builder.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Filter_Builder.cpp deleted file mode 100644 index 95ef9e1886e..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Filter_Builder.cpp +++ /dev/null @@ -1,335 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Sched_Filter.h" -#include "orbsvcs/Event_Service_Constants.h" -#include "orbsvcs/Event/EC_Sched_Filter_Builder.h" -#include "orbsvcs/Event/EC_Type_Filter.h" -#include "orbsvcs/Event/EC_Conjunction_Filter.h" -#include "orbsvcs/Event/EC_Disjunction_Filter.h" -#include "orbsvcs/Event/EC_Timeout_Filter.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "ace/OS_NS_stdio.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Sched_Filter_Builder.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, EC_Sched_Filter_Builder, "$Id$") - - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Sched_Filter_Builder::~TAO_EC_Sched_Filter_Builder (void) -{ -} - -TAO_EC_Filter* -TAO_EC_Sched_Filter_Builder::build ( - TAO_EC_ProxyPushSupplier *supplier, - RtecEventChannelAdmin::ConsumerQOS& qos - ACE_ENV_ARG_DECL) const -{ - CORBA::ULong pos = 0; - CORBA::Object_var tmp = - this->event_channel_->scheduler (); - - RtecScheduler::Scheduler_var scheduler = - RtecScheduler::Scheduler::_narrow (tmp.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - // @@ How do we figure out which parent??? - RtecScheduler::handle_t parent_info = - scheduler->lookup ("Dispatching_Task-250000.us" ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - return this->recursive_build (supplier, qos, pos, - scheduler.in (), - parent_info - ACE_ENV_ARG_PARAMETER); -} - -TAO_EC_Filter* -TAO_EC_Sched_Filter_Builder::recursive_build ( - TAO_EC_ProxyPushSupplier *supplier, - RtecEventChannelAdmin::ConsumerQOS& qos, - CORBA::ULong& pos, - RtecScheduler::Scheduler_ptr scheduler, - RtecScheduler::handle_t parent_info - ACE_ENV_ARG_DECL) const -{ - const RtecEventComm::Event& e = qos.dependencies[pos].event; - - if (e.header.type == ACE_ES_CONJUNCTION_DESIGNATOR) - { - CORBA::ULong npos = pos; - ACE_CString name; - this->recursive_name (qos, npos, - scheduler, name - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - RtecScheduler::handle_t rt_info = - scheduler->create (name.c_str () ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - pos++; // Consume the designator - CORBA::ULong n = this->count_children (qos, pos); - - TAO_EC_Filter** children; - ACE_NEW_RETURN (children, TAO_EC_Filter*[n], 0); - for (CORBA::ULong i = 0; i != n; ++i) - { - children[i] = this->recursive_build (supplier, qos, pos, - scheduler, - rt_info - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - } - - TAO_EC_Sched_Filter *filter; - ACE_NEW_RETURN (filter, - TAO_EC_Sched_Filter (name.c_str (), - rt_info, - scheduler, - new TAO_EC_Conjunction_Filter(children, - n), - rt_info, - parent_info, - RtecScheduler::CONJUNCTION), - 0); - TAO_EC_QOS_Info qos_info; - filter->get_qos_info (qos_info ACE_ENV_ARG_PARAMETER); - // @@ - ACE_CHECK_RETURN (0); - return filter; - } - - else if (e.header.type == ACE_ES_DISJUNCTION_DESIGNATOR) - { - CORBA::ULong npos = pos; - ACE_CString name; - this->recursive_name (qos, npos, - scheduler, name - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - RtecScheduler::handle_t rt_info = - scheduler->create (name.c_str () ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - pos++; // Consume the designator - CORBA::ULong n = this->count_children (qos, pos); - - TAO_EC_Filter** children; - ACE_NEW_RETURN (children, TAO_EC_Filter*[n], 0); - for (CORBA::ULong i = 0; i != n; ++i) - { - children[i] = this->recursive_build (supplier, qos, pos, - scheduler, - rt_info - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - } - TAO_EC_Sched_Filter *filter; - ACE_NEW_RETURN (filter, - TAO_EC_Sched_Filter (name.c_str (), - rt_info, - scheduler, - new TAO_EC_Disjunction_Filter (children, - n), - rt_info, - parent_info, - RtecScheduler::DISJUNCTION), - 0); - - TAO_EC_QOS_Info qos_info; - filter->get_qos_info (qos_info ACE_ENV_ARG_PARAMETER); - // @@ - ACE_CHECK_RETURN (0); - return filter; - } - - else if (e.header.type == ACE_ES_EVENT_TIMEOUT - || e.header.type == ACE_ES_EVENT_INTERVAL_TIMEOUT - || e.header.type == ACE_ES_EVENT_DEADLINE_TIMEOUT) - { - pos++; - - // @@ We need a unique name for each timeout, assigned by the - // application? - char buf[64]; - ACE_OS::sprintf (buf, "TIMEOUT:%u", - static_cast<u_int> ((e.header.creation_time / 10000))); - ACE_CString name = buf; - - TAO_EC_QOS_Info qos_info; - qos_info.rt_info = - scheduler->create (name.c_str () ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - // Convert the time to the proper units.... - RtecScheduler::Period_t period = - static_cast<RtecScheduler::Period_t> (e.header.creation_time / 10); - - scheduler->set (qos_info.rt_info, - RtecScheduler::VERY_LOW_CRITICALITY, - 0, // worst_cast_execution_time - 0, // typical_cast_execution_time - 0, // cached_cast_execution_time - period, - RtecScheduler::VERY_LOW_IMPORTANCE, - 0, // quantum - 1, // threads - RtecScheduler::OPERATION - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - scheduler->add_dependency (qos_info.rt_info, - parent_info, - 1, - RtecBase::TWO_WAY_CALL - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - return new TAO_EC_Timeout_Filter (this->event_channel_, - supplier, - qos_info, - e.header.type, - e.header.creation_time); - } - - RtecScheduler::handle_t body_info = qos.dependencies[pos].rt_info; - - RtecScheduler::RT_Info_var info = - scheduler->get (body_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - ACE_CString name = info->entry_point.in (); - name += "#rep"; - - RtecScheduler::handle_t rt_info = - scheduler->create (name.c_str () ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - pos++; - TAO_EC_Sched_Filter *filter; - ACE_NEW_RETURN (filter, - TAO_EC_Sched_Filter (name.c_str (), - rt_info, - scheduler, - new TAO_EC_Type_Filter (e.header), - body_info, - parent_info, - RtecScheduler::OPERATION), - 0); - - TAO_EC_QOS_Info qos_info; - filter->get_qos_info (qos_info ACE_ENV_ARG_PARAMETER); - // @@ - ACE_CHECK_RETURN (0); - return filter; -} - -void -TAO_EC_Sched_Filter_Builder:: recursive_name ( - RtecEventChannelAdmin::ConsumerQOS& qos, - CORBA::ULong& pos, - RtecScheduler::Scheduler_ptr scheduler, - ACE_CString& name - ACE_ENV_ARG_DECL) const -{ - const RtecEventComm::Event& e = qos.dependencies[pos].event; - - if (e.header.type == ACE_ES_CONJUNCTION_DESIGNATOR) - { - pos++; // Consume the designator - CORBA::ULong n = this->count_children (qos, pos); - - for (CORBA::ULong i = 0; i != n; ++i) - { - ACE_CString child_name; - this->recursive_name (qos, pos, - scheduler, - child_name - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (i == 0) - name += "("; - else - name += "&&"; - name += child_name; - } - name += ")"; - return; - } - - else if (e.header.type == ACE_ES_DISJUNCTION_DESIGNATOR) - { - pos++; // Consume the designator - CORBA::ULong n = this->count_children (qos, pos); - - for (CORBA::ULong i = 0; i != n; ++i) - { - ACE_CString child_name; - - this->recursive_name (qos, pos, - scheduler, - child_name - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (i == 0) - name += "("; - else - name += "||"; - name += child_name; - } - name += ")"; - return; - } - - else if (e.header.type == ACE_ES_EVENT_TIMEOUT - || e.header.type == ACE_ES_EVENT_INTERVAL_TIMEOUT - || e.header.type == ACE_ES_EVENT_DEADLINE_TIMEOUT) - { - pos++; - - char buf[64]; - ACE_OS::sprintf (buf, "TIMEOUT:%u", - static_cast<u_int> ((e.header.creation_time / 10000))); - name = buf; - - return; - } - - RtecScheduler::handle_t body_info = qos.dependencies[pos].rt_info; - - RtecScheduler::RT_Info_var info = - scheduler->get (body_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - name = info->entry_point.in (); - name += "#rep"; - - pos++; -} - -CORBA::ULong -TAO_EC_Sched_Filter_Builder:: - count_children (RtecEventChannelAdmin::ConsumerQOS& qos, - CORBA::ULong pos) const -{ - CORBA::ULong l = qos.dependencies.length (); - CORBA::ULong i; - for (i = pos; i != l; ++i) - { - const RtecEventComm::Event& e = qos.dependencies[i].event; - if (e.header.type == ACE_ES_CONJUNCTION_DESIGNATOR - || e.header.type == ACE_ES_DISJUNCTION_DESIGNATOR) - break; - } - return i - 1; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Filter_Builder.h b/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Filter_Builder.h deleted file mode 100644 index c649518ecbe..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Filter_Builder.h +++ /dev/null @@ -1,89 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Sched_Filter_Builder.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_SCHED_FILTER_BUILDER_H -#define TAO_EC_SCHED_FILTER_BUILDER_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Filter_Builder.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/Event/sched_event_export.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Filter; -class TAO_EC_Event_Channel_Base; - -/** - * @class TAO_EC_Sched_Filter_Builder - * - * @brief Implement a builder for the fundamental filters. - * - * The sched filtering mechanisms in the Event channel - * (source/type based filtering + disjunctions and conjunctions) - * are constructed using this class. - */ -class TAO_RTSchedEvent_Export TAO_EC_Sched_Filter_Builder : public TAO_EC_Filter_Builder -{ -public: - /// constructor. - TAO_EC_Sched_Filter_Builder (TAO_EC_Event_Channel_Base* ec); - - /// destructor... - virtual ~TAO_EC_Sched_Filter_Builder (void); - - // = The TAO_EC_Filter_Builder methods... - TAO_EC_Filter* build (TAO_EC_ProxyPushSupplier *supplier, - RtecEventChannelAdmin::ConsumerQOS& qos - ACE_ENV_ARG_DECL) const; - -private: - /// Recursively build the filter tree. - TAO_EC_Filter* recursive_build (TAO_EC_ProxyPushSupplier *supplier, - RtecEventChannelAdmin::ConsumerQOS& qos, - CORBA::ULong& pos, - RtecScheduler::Scheduler_ptr scheduler, - RtecScheduler::handle_t parent_info - ACE_ENV_ARG_DECL) const; - - /// Build the name recursively... - void recursive_name (RtecEventChannelAdmin::ConsumerQOS& qos, - CORBA::ULong& pos, - RtecScheduler::Scheduler_ptr scheduler, - ACE_CString &name - ACE_ENV_ARG_DECL) const; - - /// Count the number of children of the current node, i.e. until a - /// conjunction or disjunction starts. - CORBA::ULong count_children (RtecEventChannelAdmin::ConsumerQOS& qos, - CORBA::ULong pos) const; - -private: - /// The event channel. - TAO_EC_Event_Channel_Base* event_channel_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Sched_Filter_Builder.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* TAO_EC_SCHED_FILTER_BUILDER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Filter_Builder.i b/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Filter_Builder.i deleted file mode 100644 index a00dfd725c5..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Sched_Filter_Builder.i +++ /dev/null @@ -1,14 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_Sched_Filter_Builder:: - TAO_EC_Sched_Filter_Builder (TAO_EC_Event_Channel_Base *ec) - : event_channel_ (ec) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Scheduling_Strategy.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Scheduling_Strategy.cpp deleted file mode 100644 index 76be60d02ec..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Scheduling_Strategy.cpp +++ /dev/null @@ -1,14 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Scheduling_Strategy.h" -#include "orbsvcs/Event/EC_QOS_Info.h" - -ACE_RCSID(Event, EC_Scheduling_Strategy, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Scheduling_Strategy::~TAO_EC_Scheduling_Strategy (void) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Scheduling_Strategy.h b/TAO/orbsvcs/orbsvcs/Event/EC_Scheduling_Strategy.h deleted file mode 100644 index 08d3a6bf5c2..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Scheduling_Strategy.h +++ /dev/null @@ -1,73 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Scheduling_Strategy.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_SCHEDULING_STRATEGY_H -#define TAO_EC_SCHEDULING_STRATEGY_H - -#include /**/ "ace/pre.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#include "orbsvcs/RtecBaseC.h" -#include "orbsvcs/RtecEventCommC.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_ProxyPushConsumer; -class TAO_EC_ProxyPushSupplier; -class TAO_EC_Supplier_Filter; -class TAO_EC_QOS_Info; - -/** - * @class TAO_EC_Scheduling_Strategy - * - * @brief Define the interface for the scheduling strategy - * - * The scheduling strategy controls the actions that the event - * channel must take to update the dependency information in the - * scheduler and to query the scheduler for the priority of each - * event pushed by a supplier. - * The base - */ -class TAO_RTEvent_Serv_Export TAO_EC_Scheduling_Strategy -{ -public: - /// Destructor - virtual ~TAO_EC_Scheduling_Strategy (void); - - /// Add all the dependencies between @a supplier and @a consumer - virtual void add_proxy_supplier_dependencies ( - TAO_EC_ProxyPushSupplier *supplier, - TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL) = 0; - - /// Schedule an event set and deliver them to the filter in the - /// desired order and grouping. - virtual void schedule_event (const RtecEventComm::EventSet &event, - TAO_EC_ProxyPushConsumer *consumer, - TAO_EC_Supplier_Filter *filter - ACE_ENV_ARG_DECL) = 0; - -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_SCHEDULING_STRATEGY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp deleted file mode 100644 index fb555cf3e95..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_SupplierAdmin.h" -#include "orbsvcs/Event/EC_ProxyConsumer.h" -#include "orbsvcs/Event/EC_ProxySupplier.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "orbsvcs/ESF/ESF_Peer_Workers.h" -#include "orbsvcs/ESF/ESF_Peer_Admin.h" -#include "orbsvcs/ESF/ESF_Shutdown_Proxy.h" - -ACE_RCSID(Event, EC_SupplierAdmin, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_SupplierAdmin::TAO_EC_SupplierAdmin (TAO_EC_Event_Channel_Base *ec) - : TAO_ESF_Peer_Admin<TAO_EC_Event_Channel_Base,TAO_EC_ProxyPushConsumer,RtecEventChannelAdmin::ProxyPushConsumer,TAO_EC_ProxyPushSupplier> (ec) -{ - this->default_POA_ = - this->event_channel_->supplier_poa (); -} - -TAO_EC_SupplierAdmin::~TAO_EC_SupplierAdmin (void) -{ -} - -RtecEventChannelAdmin::ProxyPushConsumer_ptr -TAO_EC_SupplierAdmin::obtain_push_consumer (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->obtain (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -PortableServer::POA_ptr -TAO_EC_SupplierAdmin::_default_POA (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) -{ - return PortableServer::POA::_duplicate (this->default_POA_.in ()); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h deleted file mode 100644 index 44e9edb8dc9..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h +++ /dev/null @@ -1,73 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_SupplierAdmin.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_SUPPLIERADMIN_H -#define TAO_EC_SUPPLIERADMIN_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_ProxyConsumer.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/ESF/ESF_Peer_Admin.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Event_Channel_Base; -class TAO_EC_ProxyPushSupplier; - -/** - * @class TAO_EC_SupplierAdmin - * - * @brief Implement the RtecEventChannelAdmin::SupplierAdmin interface. - * - * - * <H2>Memory Management</H2> - * It does not assume ownership of the TAO_EC_Event_Channel_Base object - */ -class TAO_RTEvent_Serv_Export TAO_EC_SupplierAdmin - : public POA_RtecEventChannelAdmin::SupplierAdmin - , public TAO_ESF_Peer_Admin<TAO_EC_Event_Channel_Base,TAO_EC_ProxyPushConsumer,RtecEventChannelAdmin::ProxyPushConsumer,TAO_EC_ProxyPushSupplier> -{ -public: - /// constructor... - TAO_EC_SupplierAdmin (TAO_EC_Event_Channel_Base* event_channel); - - /// destructor... - virtual ~TAO_EC_SupplierAdmin (void); - - // = The RtecEventChannelAdmin::SupplierAdmin methods... - virtual RtecEventChannelAdmin::ProxyPushConsumer_ptr - obtain_push_consumer (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)); - - // = The PortableServer::ServantBase methods - virtual PortableServer::POA_ptr _default_POA (ACE_ENV_SINGLE_ARG_DECL); - -private: - /// Store the default POA. - PortableServer::POA_var default_POA_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_SUPPLIERADMIN_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierControl.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierControl.cpp deleted file mode 100644 index 7d73bfbaf53..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierControl.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_SupplierControl.h" - -ACE_RCSID(Event, EC_SupplierControl, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_SupplierControl::TAO_EC_SupplierControl (void) -{ -} - -TAO_EC_SupplierControl::~TAO_EC_SupplierControl (void) -{ -} - -int -TAO_EC_SupplierControl::activate (void) -{ - return 0; -} - -int -TAO_EC_SupplierControl::shutdown (void) -{ - return 0; -} - -void -TAO_EC_SupplierControl::supplier_not_exist (TAO_EC_ProxyPushConsumer * - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_SupplierControl::system_exception (TAO_EC_ProxyPushConsumer *, - CORBA::SystemException & - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierControl.h b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierControl.h deleted file mode 100644 index e4247d13b5b..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierControl.h +++ /dev/null @@ -1,81 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_SupplierControl.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_SUPPLIERCONTROL_H -#define TAO_EC_SUPPLIERCONTROL_H - -#include /**/ "ace/pre.h" -#include "ace/CORBA_macros.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#include "tao/Versioned_Namespace.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_ProxyPushConsumer; - -namespace CORBA -{ - class Environment; - class SystemException; -} - -/** - * @class TAO_EC_SupplierControl - * - * @brief SupplierControl - * - * Defines the interface for the supplier control strategy. - * This strategy handles misbehaving or failing suppliers. - */ -class TAO_RTEvent_Serv_Export TAO_EC_SupplierControl -{ -public: - /// Constructor. - TAO_EC_SupplierControl (void); - - /// Destructor. - virtual ~TAO_EC_SupplierControl (void); - - /// Activate any internal threads or timers used to poll the state of - /// the suppliers - virtual int activate (void); - virtual int shutdown (void); - - /** - * Invoked by helper classes when they detect that a supplier does - * not exists (i.e. _non_existent() returns true and/or the - * CORBA::OBJECT_NOT_EXIST exception has been raised). - */ - virtual void supplier_not_exist (TAO_EC_ProxyPushConsumer *proxy - ACE_ENV_ARG_DECL_NOT_USED); - - /// Some system exception was raised while trying to contact the - /// supplier - virtual void system_exception (TAO_EC_ProxyPushConsumer * proxy, - CORBA::SystemException & - ACE_ENV_ARG_DECL_NOT_USED); -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_SUPPLIERCONTROL_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Supplier_Filter.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Supplier_Filter.cpp deleted file mode 100644 index 1f424fd0575..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Supplier_Filter.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Supplier_Filter.h" -#include "orbsvcs/Event/EC_ProxySupplier.h" -#include "orbsvcs/Event/EC_QOS_Info.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Supplier_Filter.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, EC_Supplier_Filter, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Supplier_Filter::~TAO_EC_Supplier_Filter (void) -{ -} - -// **************************************************************** - -void -TAO_EC_Filter_Worker::work (TAO_EC_ProxyPushSupplier *supplier - ACE_ENV_ARG_DECL) -{ - TAO_EC_QOS_Info qos_info = this->event_info_; - supplier->filter (this->event_, qos_info ACE_ENV_ARG_PARAMETER); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Supplier_Filter.h b/TAO/orbsvcs/orbsvcs/Event/EC_Supplier_Filter.h deleted file mode 100644 index 898fdc45e02..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Supplier_Filter.h +++ /dev/null @@ -1,151 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Supplier_Filter.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_SUPPLIER_FILTER_H -#define TAO_EC_SUPPLIER_FILTER_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/RtecEventCommC.h" -#include "orbsvcs/ESF/ESF_Worker.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_ProxyPushSupplier; -class TAO_EC_ProxyPushConsumer; -class TAO_EC_QOS_Info; - -/** - * @class TAO_EC_Supplier_Filter - * - * @brief The strategy to filter close to the supplier. - * - * After an event is received by the a ProxyPushConsumer it must - * be dispatched to the right set of ProxyPushSuppliers; - * determining this set is the task of this class. - * Notice that this is in fact a filter, and enforces (in part) - * the subscriptions and publications of the Event Service - * clients. - * Several implementations are possible: - * - Each ProxyPushConsumer keeps a list of ProxyPushSuppliers, - * using the subscriptions and publications to find potential - * matches. - * - Each ProxyPushConsumer keeps several such lists, indexed by - * event type and/or source, this has the advantage of further - * minimizing the set of ProxyPushSuppliers invoked. - * - A single list of consumers is kept (global for the event - * channel), such a list results is faster updates and requires - * an smaller memory footprint. - * - Multiple global lists are kept, indexed by type and/or - * source, this is a tradeoff between the solutions above. - * - No list is kept, the events are sent to the consumers which - * must filter out what they want, this is good when no - * filtering is wanted or when the amount of filtering is coarse - * i.e. each event goes to a large subset of the - * ProxyPushSuppliers. - * Different applications will require to use different - * implementations of this class; as usual the EC_Factory will - * create the right instance. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Supplier_Filter -{ -public: - /// Destructor - virtual ~TAO_EC_Supplier_Filter (void); - - /** - * Whenever a ProxyPushConsumer is initialized it calls this method - * to inform the Supplier_Filter of its identity. - * Strategies that do not keep ProxyPushConsumer specific - * information, or that are shared between multiple - * ProxyPushConsumers can ignore this message. - */ - virtual void bind (TAO_EC_ProxyPushConsumer* consumer) = 0; - - /** - * Wheneve a ProxyPushConsumer is about to be destroyed it calls - * this method to inform the Supplier_Filter that it should - * release any resources related to it. - * Supplier_Filter strategies that are bound to a particular - * ProxyConsumer can use this opportunity to destroy themselves; - * filter strategies that do not keep ProxyPushConsumer specific - * information can simply ignore the message. - */ - virtual void unbind (TAO_EC_ProxyPushConsumer* consumer) = 0; - - /// Concrete implementations can use this methods to keep track of - /// the consumers interested in this events. - virtual void connected (TAO_EC_ProxyPushSupplier *supplier - ACE_ENV_ARG_DECL) = 0; - virtual void reconnected (TAO_EC_ProxyPushSupplier *supplier - ACE_ENV_ARG_DECL) = 0; - virtual void disconnected (TAO_EC_ProxyPushSupplier *supplier - ACE_ENV_ARG_DECL) = 0; - - /// The event channel is shutting down. - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL) = 0; - - /// The ProxyPushConsumer delegates on this class to actually send - /// the event. - virtual void push (const RtecEventComm::EventSet &event, - TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL) = 0; - - /// Events are first scheduled by the TAO_EC_Scheduling_Strategy, - /// and then pushed through this class again. - virtual void push_scheduled_event (RtecEventComm::EventSet &event, - const TAO_EC_QOS_Info &event_info - ACE_ENV_ARG_DECL) = 0; - - /// Increment and decrement the reference count, locking must be - /// provided by the user. - virtual CORBA::ULong _incr_refcnt (void) = 0; - virtual CORBA::ULong _decr_refcnt (void) = 0; -}; - -// **************************************************************** - -class TAO_EC_Filter_Worker : public TAO_ESF_Worker<TAO_EC_ProxyPushSupplier> -{ -public: - TAO_EC_Filter_Worker (RtecEventComm::EventSet &event, - const TAO_EC_QOS_Info &event_info); - - virtual void work (TAO_EC_ProxyPushSupplier *supplier - ACE_ENV_ARG_DECL); - -private: - /// The event we push on each case, use a reference to avoid copies. - RtecEventComm::EventSet &event_; - - /// The QoS info propagated on each event. - const TAO_EC_QOS_Info &event_info_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Supplier_Filter.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_SUPPLIER_FILTER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Supplier_Filter.i b/TAO/orbsvcs/orbsvcs/Event/EC_Supplier_Filter.i deleted file mode 100644 index 9b09afb3d74..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Supplier_Filter.i +++ /dev/null @@ -1,15 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_Filter_Worker::TAO_EC_Filter_Worker (RtecEventComm::EventSet &event, - const TAO_EC_QOS_Info &event_info) - : event_ (event), - event_info_ (event_info) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Supplier_Filter_Builder.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Supplier_Filter_Builder.cpp deleted file mode 100644 index 63203a004fa..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Supplier_Filter_Builder.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Supplier_Filter_Builder.h" - -ACE_RCSID(Event, EC_Supplier_Filter_Builder, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Supplier_Filter_Builder::~TAO_EC_Supplier_Filter_Builder (void) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Supplier_Filter_Builder.h b/TAO/orbsvcs/orbsvcs/Event/EC_Supplier_Filter_Builder.h deleted file mode 100644 index d81cab67d94..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Supplier_Filter_Builder.h +++ /dev/null @@ -1,67 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Supplier_Filter_Builder.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_SUPPLIER_FILTER_BUILDER_H -#define TAO_EC_SUPPLIER_FILTER_BUILDER_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/RtecEventChannelAdminC.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Supplier_Filter; -class TAO_EC_ProxyPushConsumer; - -/** - * @class TAO_EC_Supplier_Filter_Builder - * - * @brief Abstract base class for the supplier filter builders. - * - * The creation of the right filter for each supplier controlled - * by a Supplier_Filter_Builder. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Supplier_Filter_Builder -{ -public: - /// Destructor... - virtual ~TAO_EC_Supplier_Filter_Builder (void); - - /** - * Create the filter. The consumer is bound to the returned - * Supplier_Filter, it must be unbound upon destruction and/or - * disconnection. - */ - virtual TAO_EC_Supplier_Filter* - create (RtecEventChannelAdmin::SupplierQOS& qos) = 0; - - /// The user is returning the filter for destruction/recycling. - virtual void - destroy (TAO_EC_Supplier_Filter *filter) = 0; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -// **************************************************************** - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_FILTER_BUILDER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Dispatching.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Dispatching.cpp deleted file mode 100644 index 1b06a04dca7..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Dispatching.cpp +++ /dev/null @@ -1,198 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_TPC_Dispatching.h" -#include "orbsvcs/Event/EC_Defaults.h" - -#include <ace/Dynamic_Service.h> - -ACE_RCSID(Event, EC_TPC_Dispatching, "$Id$") - -#if !defined(TAO_EC_TPC_DISPATCHING_DEFAULT_MAP_SIZE) -#define TAO_EC_TPC_DISPATCHING_DEFAULT_MAP_SIZE 32 -#endif - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -extern unsigned long EC_TPC_debug_level; - -TAO_EC_TPC_Dispatching::TAO_EC_TPC_Dispatching (TAO_EC_Queue_Full_Service_Object* so) - : consumer_task_map_(TAO_EC_TPC_DISPATCHING_DEFAULT_MAP_SIZE) - , queue_full_service_object_(so) -{ - ACE_ASSERT (this->queue_full_service_object_ != 0); -} - -TAO_EC_TPC_Dispatching::~TAO_EC_TPC_Dispatching () -{ - // No other dispatching strategy has a DTOR body. I can only - // assume that it's guaranteed that shutdown() is called before - // the DTOR, so the tear-down logic needs to go in the shutdown, - // and the DTOR need not call shutdown. -} - -int -TAO_EC_TPC_Dispatching::add_consumer (RtecEventComm::PushConsumer_ptr consumer - ACE_ENV_ARG_DECL_NOT_USED) -{ - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); - - // Duplicate the pointer and hold it safely - RtecEventComm::PushConsumer_var pc = - RtecEventComm::PushConsumer::_duplicate(consumer); - - if (EC_TPC_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "EC (%P|%t) TPC_Dispatching::add_consumer(%@)\n", pc.in())); - - TAO_EC_Dispatching_Task* dtask = - new TAO_EC_TPC_Dispatching_Task (&this->thread_manager_, - this->queue_full_service_object_); - - if (EC_TPC_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "EC (%P|%t) TPC_Dispatching::add_consumer(%@): new task %@\n", pc.in(), dtask)); - - if ((dtask->activate (TAO_EC_DEFAULT_DISPATCHING_THREADS_FLAGS, - 1, // we only want one thread to dispatch to a consumer - 1, // magic number?? - TAO_EC_DEFAULT_DISPATCHING_THREADS_PRIORITY)) == -1) - { - ACE_DEBUG ((LM_WARNING, - "EC (%P|%t): TPC_Dispatching::add_consumer unable to activate" - " dispatching task for consumer (%@)\n", - consumer)); - delete dtask; - return -1; - } - - int bindresult = - this->consumer_task_map_.bind (RtecEventComm::PushConsumer::_duplicate(pc.in()), - dtask); - const char* explanation = 0; - if (bindresult == -1) - explanation = "general failure"; - else if (bindresult == 1) - explanation = "entry already exists"; - - if (explanation != 0) - { - ACE_DEBUG ((LM_WARNING, - "EC (%P|%t): TPC_Dispatching::add_consumer failed to bind consumer (%@)" - " and dispatch task in map (%s): %p\n", - consumer, explanation)); - dtask->putq (new TAO_EC_Shutdown_Task_Command); - dtask->wait (); - delete dtask; - return -1; - } - - return 0; -} - -int -TAO_EC_TPC_Dispatching::remove_consumer (RtecEventComm::PushConsumer_ptr consumer - ACE_ENV_ARG_DECL_NOT_USED) -{ - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); - - TAO_EC_Dispatching_Task* dtask = 0; - - if (this->consumer_task_map_.find (consumer, dtask) == -1) - { - ACE_DEBUG ((LM_WARNING, - "EC (%P|%t): TPC_Dispatching::remove_consumer failed to" - " find consumer (%@) in map\n", consumer)); - return -1; - } - - // Must have found it...first try to unbind - if (this->consumer_task_map_.unbind (consumer) == -1) - { - ACE_DEBUG ((LM_WARNING, - "EC (%P|%t): TPC_Dispatching::remove_consumer failed to" - " unbind consumer (%@) and task in map\n", consumer)); - return -1; - } - - dtask->putq (new TAO_EC_Shutdown_Task_Command); - CORBA::release (consumer); // This matches the _duplicate in add_consumer - return 0; -} - -void -TAO_EC_TPC_Dispatching::activate (void) -{ -} - -void -TAO_EC_TPC_Dispatching::shutdown (void) -{ - ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->lock_); - - // The MT_Dispatching strategy sends a TAO_EC_Shutdown_Task_Command - // to the dispatching task. Is that what we should do here? - MAPTYPE::ITERATOR iter = this->consumer_task_map_.begin (); - while (! iter.done()) - { - MAPTYPE::ENTRY* entry = 0; - if (! iter.next(entry)) - continue; - - entry->int_id_->putq (new TAO_EC_Shutdown_Task_Command); - iter.advance (); - } - - this->thread_manager_.wait (); // Wait for the threads to terminate - - // Now iterate again and call CORBA::release on the ext_id; - // we don't have to delete int_id_ b/c that happens in its close() method. - iter = this->consumer_task_map_.begin (); - while (! iter.done()) - { - MAPTYPE::ENTRY* entry = 0; - if (! iter.next(entry)) - continue; - - CORBA::release (entry->ext_id_); - iter.advance (); - } - - this->consumer_task_map_.unbind_all (); -} - -void -TAO_EC_TPC_Dispatching::push (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - RtecEventComm::EventSet event_copy = event; - this->push_nocopy (proxy, consumer, event_copy, qos_info ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_TPC_Dispatching::push_nocopy (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& - ACE_ENV_ARG_DECL) -{ - if (EC_TPC_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "EC (%P|%t) TPC_Dispatching::push_nocopy(supplier=%@,consumer=%@)\n", proxy, consumer)); - - ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->lock_); - TAO_EC_Dispatching_Task* dtask; - - if (this->consumer_task_map_.find (consumer, dtask) == -1) - { - ACE_DEBUG ((LM_WARNING, - "EC (%P|%t): TPC_Dispatching::push_nocopy failed to" - " find consumer (%@) in map\n", consumer)); - } - else - { - dtask->push (proxy, consumer, event ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Dispatching.h b/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Dispatching.h deleted file mode 100644 index b8c7ea49cd3..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Dispatching.h +++ /dev/null @@ -1,85 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_TPC_Dispatching.h - * - * $Id$ - * - * @author Chris Cleeland <cleeland at ociweb.com> - * - */ - -#ifndef TAO_EC_TPC_DISPATCHING_H -#define TAO_EC_TPC_DISPATCHING_H -#include /**/ "ace/pre.h" - -#include "ace/Hash_Map_Manager_T.h" -#include "ace/Null_Mutex.h" - -#include "orbsvcs/Event/EC_Dispatching.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/Event/EC_TPC_Dispatching_Task.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Event_Channel_Base; - -/** - * @class TAO_EC_TPC_Dispatching - * - * @brief Dispatching strategy that isolates deliveries to a consumer from any other. - * - * This strategy uses a thread per consumer, and was specifically designed to - * isolate the effects of an ill-behaved consumer from affecting other consumers. - */ -class TAO_RTEvent_Serv_Export TAO_EC_TPC_Dispatching : public TAO_EC_Dispatching -{ -public: - TAO_EC_TPC_Dispatching (TAO_EC_Queue_Full_Service_Object* so); - ~TAO_EC_TPC_Dispatching (); - - // = The EC_Dispatching methods. - virtual void activate (void); - virtual void shutdown (void); - virtual void push (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push_nocopy (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - - int add_consumer (RtecEventComm::PushConsumer_ptr consumer ACE_ENV_ARG_DECL); - int remove_consumer (RtecEventComm::PushConsumer_ptr consumer ACE_ENV_ARG_DECL); - -private: - // Use our own thread manager - ACE_Thread_Manager thread_manager_; - - typedef ACE_Hash_Map_Manager_Ex<RtecEventComm::PushConsumer_ptr,TAO_EC_Dispatching_Task*,ACE_Pointer_Hash<RtecEventComm::PushConsumer_ptr>,ACE_Equal_To<RtecEventComm::PushConsumer_ptr>,ACE_Null_Mutex> MAPTYPE; - - // Tweak the default size of this map by #defining - // TAO_EC_TPC_DISPATCHING_DEFAULT_MAP_SIZE - MAPTYPE consumer_task_map_; - - // Lock for modifying the map. It's not enough to have a lock only - // on the map, because we have to hold the map constant while doing - // multiple distinct map manipulations, such as in remove_consumer(). - ACE_SYNCH_MUTEX lock_; - - // Service object information - TAO_EC_Queue_Full_Service_Object* queue_full_service_object_; // @@ who will release? - // @@ check to see how the factory gets released... -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* TAO_EC_TPC_DISPATCHING_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Dispatching_Task.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Dispatching_Task.cpp deleted file mode 100644 index f70fb6aeac9..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Dispatching_Task.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_TPC_Dispatching_Task.h" - - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_TPC_Dispatching_Task::TAO_EC_TPC_Dispatching_Task -(ACE_Thread_Manager* thr_mgr, - TAO_EC_Queue_Full_Service_Object* so) - : TAO_EC_Dispatching_Task (thr_mgr, so) -{ -} - -int -TAO_EC_TPC_Dispatching_Task::close (u_long /* flags */) -{ - delete this; - return 0; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Dispatching_Task.h b/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Dispatching_Task.h deleted file mode 100644 index ff92abce00b..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Dispatching_Task.h +++ /dev/null @@ -1,34 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_TPC_Dispatching_Task.h - * - * $Id$ - * - * @author Chris Cleeland <cleeland at ociweb.com> - */ - -#ifndef TAO_EC_TPC_DISPATCHING_TASK_H -#define TAO_EC_TPC_DISPATCHING_TASK_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Dispatching_Task.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_RTEvent_Serv_Export TAO_EC_TPC_Dispatching_Task : public TAO_EC_Dispatching_Task -{ -public: - /// Constructor - TAO_EC_TPC_Dispatching_Task (ACE_Thread_Manager* thr_mgr, TAO_EC_Queue_Full_Service_Object* so); - virtual int close (u_long flags = 0); -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* TAO_EC_TPC_DISPATCHING_TASK_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Factory.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Factory.cpp deleted file mode 100644 index c8e822ed5b9..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Factory.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_TPC_Factory.h" - -#include "orbsvcs/Event/EC_TPC_Dispatching.h" -#include "orbsvcs/Event/EC_TPC_ProxySupplier.h" -#include "orbsvcs/Event/EC_TPC_ProxyConsumer.h" - -#include "tao/ORB_Core.h" - -#include "ace/Arg_Shifter.h" -#include "ace/Sched_Params.h" -#include "ace/OS_NS_strings.h" - -ACE_RCSID(Event, EC_TPC_Factory, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -unsigned long EC_TPC_debug_level; - -TAO_EC_TPC_Factory::TAO_EC_TPC_Factory (void) -{ - EC_TPC_debug_level = 0; -} - -TAO_EC_TPC_Factory::~TAO_EC_TPC_Factory (void) -{ -} - -int -TAO_EC_TPC_Factory::init_svcs (void) -{ - TAO_EC_Simple_Queue_Full_Action::init_svcs(); - return ACE_Service_Config::static_svcs ()-> - insert (&ace_svc_desc_TAO_EC_TPC_Factory); -} - -int -TAO_EC_TPC_Factory::init (int argc, char* argv[]) -{ - ACE_Arg_Shifter arg_shifter (argc, argv); - - while (arg_shifter.is_anything_left ()) - { - const char *arg = arg_shifter.get_current (); - - if (ACE_OS::strcasecmp (arg, "-ECDispatching") == 0) - { - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next ()) - { - // Here we print out a message indicating that this - // option isn't valid with this factory and that it's - // being ignored. - - ACE_DEBUG ((LM_ERROR, - "EC_TPC_Factory - " - "-ECDispatching not supported with TPC_Factory; ignoring the option and using thread-per-consumer dispatch strategy\n")); - arg_shifter.consume_arg (); - } - } - if (ACE_OS::strcasecmp (arg, "-ECTPCDebug") == 0) - { - arg_shifter.consume_arg (); - ++EC_TPC_debug_level; - } - else - { - arg_shifter.ignore_arg (); - } - - } - - return TAO_EC_Default_Factory::init (argc, argv); -} - -// **************************************************************** - -TAO_EC_Dispatching* -TAO_EC_TPC_Factory::create_dispatching (TAO_EC_Event_Channel_Base *) -{ - if (EC_TPC_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "EC (%P|%t) EC_TPC_Factory::create_dispatching\n")); - - TAO_EC_Queue_Full_Service_Object* so = - this->find_service_object (this->queue_full_service_object_name_.fast_rep(), - TAO_EC_DEFAULT_QUEUE_FULL_SERVICE_OBJECT_NAME); - - return new TAO_EC_TPC_Dispatching (so); -} - - -TAO_EC_ProxyPushSupplier* -TAO_EC_TPC_Factory::create_proxy_push_supplier (TAO_EC_Event_Channel_Base *ec) -{ - if (EC_TPC_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "EC (%P|%t) EC_TPC_Factory::create_proxy_push_supplier\n")); - return new TAO_EC_TPC_ProxyPushSupplier (ec, this->consumer_validate_connection_); -} - - -TAO_EC_ProxyPushConsumer* -TAO_EC_TPC_Factory::create_proxy_push_consumer (TAO_EC_Event_Channel_Base *ec) -{ - if (EC_TPC_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "EC (%P|%t) EC_TPC_Factory::create_proxy_push_consumer\n")); - return new TAO_EC_TPC_ProxyPushConsumer (ec); -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -// **************************************************************** - -ACE_STATIC_SVC_DEFINE (TAO_EC_TPC_Factory, - ACE_TEXT ("EC_Factory"), - ACE_SVC_OBJ_T, - &ACE_SVC_NAME (TAO_EC_TPC_Factory), - ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, - 0) -ACE_FACTORY_DEFINE (TAO_RTEvent_Serv, TAO_EC_TPC_Factory) - -// **************************************************************** - diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Factory.h b/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Factory.h deleted file mode 100644 index c65e5be61cc..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Factory.h +++ /dev/null @@ -1,67 +0,0 @@ -// -*- C++ -*- -/** - * @file EC_TPC_Factory.h - * - * $Id$ - * - */ - -#ifndef TAO_EC_TPC_FACTORY_H -#define TAO_EC_TPC_FACTORY_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Default_Factory.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_TPC_Factory - * - * @brief A generic factory for EC experimentation. - * - * This class allows the user to experiment with different EC - * configurations. Using a command-line like interface the user - * can specify which strategies will this factory generate. - * Since the class can be dynamically loaded the strategies can be - * set in the service configurator file. - */ -class TAO_RTEvent_Serv_Export TAO_EC_TPC_Factory : public TAO_EC_Default_Factory -{ -public: - /// Constructor - TAO_EC_TPC_Factory (void); - - /// destructor... - virtual ~TAO_EC_TPC_Factory (void); - - /// Helper function to register the default factory into the service - /// configurator. - static int init_svcs (void); - - // = The Service_Object entry points - virtual int init (int argc, char* argv[]); - - // = The EC_Factory methods - virtual TAO_EC_Dispatching* - create_dispatching (TAO_EC_Event_Channel_Base*); - - virtual TAO_EC_ProxyPushSupplier* - create_proxy_push_supplier (TAO_EC_Event_Channel_Base*); - - virtual TAO_EC_ProxyPushConsumer* - create_proxy_push_consumer (TAO_EC_Event_Channel_Base*); -}; - -extern unsigned long EC_TPC_debug_level; - -TAO_END_VERSIONED_NAMESPACE_DECL - -ACE_STATIC_SVC_DECLARE (TAO_EC_TPC_Factory) -ACE_FACTORY_DECLARE (TAO_RTEvent_Serv, TAO_EC_TPC_Factory) - -#include /**/ "ace/post.h" -#endif /* TAO_EC_TPC_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_ProxyConsumer.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_TPC_ProxyConsumer.cpp deleted file mode 100644 index 6a7cc347cb1..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_ProxyConsumer.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_TPC_ProxyConsumer.h" - -ACE_RCSID(Event, EC_TPC_ProxyConsumer, "$Id$") - -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "orbsvcs/Event/EC_TPC_Dispatching.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -extern unsigned long EC_TPC_debug_level; - -TAO_EC_TPC_ProxyPushConsumer::TAO_EC_TPC_ProxyPushConsumer (TAO_EC_Event_Channel_Base* ec) -: TAO_EC_Default_ProxyPushConsumer (ec) -{ -} - -TAO_EC_TPC_Dispatching* -TAO_EC_TPC_ProxyPushConsumer::tpc_dispatching () -{ - TAO_EC_Dispatching* dispatcher = this->event_channel_->dispatching (); - TAO_EC_TPC_Dispatching* tpcdispatcher = - dynamic_cast<TAO_EC_TPC_Dispatching*>(dispatcher); - return tpcdispatcher; -} - -TAO_EC_TPC_ProxyPushConsumer::~TAO_EC_TPC_ProxyPushConsumer (void) -{ - // @@@ Do I need to call the logic to remove the consumer from the - // dispatch map in here? I'm not sure... But, if I do, then I need - // to fact that "remove" code out of just the - // disconnect_push_consumer. - if (EC_TPC_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "RTEC (%P|%t): inside ~TAO_EC_TPC_ProxyPushConsumer (%x)\n", this)); -} - -void -TAO_EC_TPC_ProxyPushConsumer::disconnect_push_consumer ( - ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - RtecEventComm::PushConsumer_var emulated_exceptions_suck = - this->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - this->tpc_dispatching ()->remove_consumer (emulated_exceptions_suck.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - BASECLASS::disconnect_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_ProxyConsumer.h b/TAO/orbsvcs/orbsvcs/Event/EC_TPC_ProxyConsumer.h deleted file mode 100644 index 9fb7ff1dc0c..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_ProxyConsumer.h +++ /dev/null @@ -1,50 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_TPC_ProxyConsumer.h - * - * $Id$ - * - * @author Chris Cleeland <cleeland at ociweb.com > - * - */ - -#ifndef TAO_EC_TPC_PROXYCONSUMER_H -#define TAO_EC_TPC_PROXYCONSUMER_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Default_ProxyConsumer.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Dispatching; -class TAO_EC_TPC_Dispatching; - -/** - * @class TAO_EC_TPC_ProxyPushConsumer - * - */ -class TAO_RTEvent_Serv_Export TAO_EC_TPC_ProxyPushConsumer : - public TAO_EC_Default_ProxyPushConsumer -{ -public: - TAO_EC_TPC_ProxyPushConsumer (TAO_EC_Event_Channel_Base* ec); - virtual ~TAO_EC_TPC_ProxyPushConsumer (void); - - virtual void disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)); - -private: - typedef TAO_EC_Default_ProxyPushConsumer BASECLASS; - TAO_EC_TPC_Dispatching* tpc_dispatching (); -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_ProxySupplier.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_TPC_ProxySupplier.cpp deleted file mode 100644 index 6ead39a342e..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_ProxySupplier.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_TPC_ProxySupplier.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_TPC_ProxySupplier.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(Event, EC_TPC_ProxySupplier, "$Id$") - -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "orbsvcs/Event/EC_TPC_Dispatching.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -extern unsigned long EC_TPC_debug_level; - -TAO_EC_TPC_ProxyPushSupplier::~TAO_EC_TPC_ProxyPushSupplier (void) -{ - -} - -void -TAO_EC_TPC_ProxyPushSupplier:: disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - if (EC_TPC_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "EC (%P|%t): enter EC_TPC_ProxySupplier::disconnect_push_supplier (%@): refcount=%u,consumer=%@\n", - this, - this->refcount_, - this->consumer_.in())); - - if (this->is_connected_i ()) - { - this->tpc_dispatching ()->remove_consumer (this->consumer_.in() - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - BASECLASS::disconnect_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - if (EC_TPC_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "EC (%P|%t): leave EC_TPC_ProxySupplier::disconnect_push_supplier (%@)\n", this)); -} - -TAO_EC_TPC_Dispatching* -TAO_EC_TPC_ProxyPushSupplier::tpc_dispatching () -{ - TAO_EC_Dispatching* dispatcher = this->event_channel_->dispatching (); - - return dynamic_cast <TAO_EC_TPC_Dispatching*> (dispatcher); -} - -void -TAO_EC_TPC_ProxyPushSupplier::connect_push_consumer ( - RtecEventComm::PushConsumer_ptr push_consumer, - const RtecEventChannelAdmin::ConsumerQOS& qos - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - RtecEventChannelAdmin::AlreadyConnected, - RtecEventChannelAdmin::TypeError)) -{ - BASECLASS::connect_push_consumer (push_consumer, qos ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (EC_TPC_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "EC (%P|%t): EC_ProxySupplier(%@): refcount=%u,consumer=%@\n", - this, this->refcount_, this->consumer_.in())); - - TAO_EC_TPC_Dispatching* tpcdispatcher = this->tpc_dispatching (); - - // the new dispatching task gets automatically created - tpcdispatcher->add_consumer (push_consumer ACE_ENV_ARG_PARAMETER); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_ProxySupplier.h b/TAO/orbsvcs/orbsvcs/Event/EC_TPC_ProxySupplier.h deleted file mode 100644 index 345b17c0619..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_ProxySupplier.h +++ /dev/null @@ -1,64 +0,0 @@ -// -*- C++ -*- -/** - * @file EC_TPC_ProxySupplier.h - * - * $Id$ - * - * @author Chris Cleeland <cleeland at ociweb.com> - * - */ - -#ifndef TAO_EC_TPC_PROXYSUPPLIER_H -#define TAO_EC_TPC_PROXYSUPPLIER_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Default_ProxySupplier.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Dispatching; -class TAO_EC_TPC_Dispatching; - -class TAO_RTEvent_Serv_Export TAO_EC_TPC_ProxyPushSupplier : - public TAO_EC_Default_ProxyPushSupplier -{ -public: - /// Constructor - TAO_EC_TPC_ProxyPushSupplier (TAO_EC_Event_Channel_Base* event_channel, int validate_connection); - - /// Dtor - virtual ~TAO_EC_TPC_ProxyPushSupplier (void); - - /*! These are overriden from the base class in order to maintain the - map in the dispatcher class. */ - - // = The RtecEventChannelAdmin::ProxyPushSupplier methods... - virtual void connect_push_consumer ( - RtecEventComm::PushConsumer_ptr push_consumer, - const RtecEventChannelAdmin::ConsumerQOS &qos - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - RtecEventChannelAdmin::AlreadyConnected, - RtecEventChannelAdmin::TypeError)); - - virtual void disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)); - -private: - typedef TAO_EC_Default_ProxyPushSupplier BASECLASS; - TAO_EC_TPC_Dispatching* tpc_dispatching (); -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_TPC_ProxySupplier.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_ProxySupplier.i b/TAO/orbsvcs/orbsvcs/Event/EC_TPC_ProxySupplier.i deleted file mode 100644 index 6a31a5fc0d1..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_ProxySupplier.i +++ /dev/null @@ -1,17 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -extern unsigned long EC_TPC_debug_level; - -ACE_INLINE -TAO_EC_TPC_ProxyPushSupplier::TAO_EC_TPC_ProxyPushSupplier (TAO_EC_Event_Channel_Base* ec, int validate_connection) -: TAO_EC_Default_ProxyPushSupplier (ec, validate_connection) -{ - if (EC_TPC_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) EC_TPC_ProxyPushSupplier::CTOR (%@)\n", this)); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Timeout_Filter.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Timeout_Filter.cpp deleted file mode 100644 index 3b479983a13..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Timeout_Filter.cpp +++ /dev/null @@ -1,171 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Timeout_Filter.h" -#include "orbsvcs/Event/EC_Timeout_Generator.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "orbsvcs/Event/EC_ProxySupplier.h" -#include "orbsvcs/Time_Utilities.h" -#include "orbsvcs/Event_Service_Constants.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Timeout_Filter.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (Event, - EC_Timeout_Filter, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Timeout_Filter::TAO_EC_Timeout_Filter ( - TAO_EC_Event_Channel_Base *event_channel, - TAO_EC_ProxyPushSupplier *supplier, - const TAO_EC_QOS_Info& qos_info, - RtecEventComm::EventType type, - RtecEventComm::Time period) - : event_channel_ (event_channel), - supplier_ (supplier), - qos_info_ (qos_info), - type_ (type), - period_ (period), - id_ (-1) -{ - ACE_Time_Value tv_delta; - ORBSVCS_Time::TimeT_to_Time_Value (tv_delta, period); - - TAO_EC_Timeout_Generator *tg = - this->event_channel_->timeout_generator (); - - if (this->type_ == ACE_ES_EVENT_INTERVAL_TIMEOUT - || this->type_ == ACE_ES_EVENT_DEADLINE_TIMEOUT) - { - ACE_Time_Value tv_interval; - ORBSVCS_Time::TimeT_to_Time_Value (tv_interval, this->period_); - - this->id_ = - tg->schedule_timer (this, - tv_delta, - tv_interval); - } - else - { - this->id_ = - tg->schedule_timer (this, - tv_delta, - ACE_Time_Value::zero); - } - - // ACE_DEBUG ((LM_DEBUG, - // "EC_Timeout_Filter - interval = %d:%d, ID = %d\n", - // tv_interval.sec (), tv_interval.usec (), - // this->id_)); -} - -TAO_EC_Timeout_Filter::~TAO_EC_Timeout_Filter (void) -{ - this->event_channel_->timeout_generator ()->cancel_timer (this->qos_info_, - this->id_); -} - -void -TAO_EC_Timeout_Filter::push_to_proxy (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - qos_info.timer_id_ = this->id_; - - if (this->supplier_ != 0) - this->supplier_->filter (event, - qos_info - ACE_ENV_ARG_PARAMETER); -} - -int -TAO_EC_Timeout_Filter::filter (const RtecEventComm::EventSet &event, - TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL) -{ - if (qos_info.timer_id_ == this->id_ - && this->parent () != 0) - { - this->parent ()->push (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - return 1; - } - return 0; -} - -int -TAO_EC_Timeout_Filter::filter_nocopy (RtecEventComm::EventSet &event, - TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL) -{ - if (qos_info.timer_id_ == this->id_ - && this->parent () != 0) - { - this->parent ()->push_nocopy (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - return 1; - } - return 0; -} - -void -TAO_EC_Timeout_Filter::push (const RtecEventComm::EventSet&, - TAO_EC_QOS_Info& - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_Timeout_Filter::push_nocopy (RtecEventComm::EventSet&, - TAO_EC_QOS_Info& - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_Timeout_Filter::clear (void) -{ - if (this->type_ == ACE_ES_EVENT_DEADLINE_TIMEOUT) - { - TAO_EC_Timeout_Generator *tg = - this->event_channel_->timeout_generator (); - - tg->cancel_timer (this->qos_info_, - this->id_); - - ACE_Time_Value tv_interval; - ORBSVCS_Time::TimeT_to_Time_Value (tv_interval, this->period_); - ACE_Time_Value tv_delta = tv_interval; - - this->id_ = - tg->schedule_timer (this, - tv_delta, - tv_interval); - } -} - -CORBA::ULong -TAO_EC_Timeout_Filter::max_event_size (void) const -{ - return 1; -} - -int -TAO_EC_Timeout_Filter::can_match ( - const RtecEventComm::EventHeader&) const -{ - return 0; -} - -int -TAO_EC_Timeout_Filter::add_dependencies ( - const RtecEventComm::EventHeader&, - const TAO_EC_QOS_Info & - ACE_ENV_ARG_DECL_NOT_USED) -{ - return 0; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Timeout_Filter.h b/TAO/orbsvcs/orbsvcs/Event/EC_Timeout_Filter.h deleted file mode 100644 index 0658f0b0b46..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Timeout_Filter.h +++ /dev/null @@ -1,120 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Timeout_Filter.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_TIMEOUT_FILTER_H -#define TAO_EC_TIMEOUT_FILTER_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Filter.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/Event/EC_QOS_Info.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Event_Channel_Base; -class TAO_EC_ProxyPushSupplier; - -/** - * @class TAO_EC_Timeout_Filter - * - * @brief A filter based on event type/source - * - * This filter only accept events with a predefined type/source, - * both the source and the type can be wildcards. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Timeout_Filter : public TAO_EC_Filter -{ -public: - /// Constructor. - TAO_EC_Timeout_Filter (TAO_EC_Event_Channel_Base *event_channel, - TAO_EC_ProxyPushSupplier *supplier, - const TAO_EC_QOS_Info& qos_info, - RtecEventComm::EventType type, - RtecEventComm::Time period); - - /// Destructor. - virtual ~TAO_EC_Timeout_Filter (void); - - /// Return the QOS_Info for this Timeout filter. - const TAO_EC_QOS_Info& qos_info (void) const; - - /// The type of timeout event that we generate. - RtecEventComm::EventType type (void) const; - - /// Callback from the Timeout_Generator - void push_to_proxy (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - - // = The TAO_EC_Filter methods, please check the documentation in - // TAO_EC_Filter. - virtual int filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual int filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void clear (void); - virtual CORBA::ULong max_event_size (void) const; - virtual int can_match (const RtecEventComm::EventHeader& header) const; - virtual int add_dependencies (const RtecEventComm::EventHeader& header, - const TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL); - -private: - TAO_EC_Timeout_Filter (const TAO_EC_Timeout_Filter&); - TAO_EC_Timeout_Filter& operator= (const TAO_EC_Timeout_Filter&); - -private: - /// The event channel. - TAO_EC_Event_Channel_Base* event_channel_; - - /// The supplier that finally receives the timeout event. - TAO_EC_ProxyPushSupplier *supplier_; - - /// Events "generated" by this filter use this QOS_Info. - TAO_EC_QOS_Info qos_info_; - - /// The type of timeout event... - RtecEventComm::EventType type_; - - /// The period for deadline timeouts... - RtecEventComm::Time period_; - - /// The ID of the timeout in the Timeout_Generator, for - /// cancellation. - long id_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Timeout_Filter.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_TIMEOUT_FILTER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Timeout_Filter.i b/TAO/orbsvcs/orbsvcs/Event/EC_Timeout_Filter.i deleted file mode 100644 index a6e30773801..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Timeout_Filter.i +++ /dev/null @@ -1,19 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE const TAO_EC_QOS_Info& -TAO_EC_Timeout_Filter::qos_info (void) const -{ - return this->qos_info_; -} - -ACE_INLINE RtecEventComm::EventType -TAO_EC_Timeout_Filter::type (void) const -{ - return this->type_; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Timeout_Generator.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Timeout_Generator.cpp deleted file mode 100644 index 23d098ceba6..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Timeout_Generator.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Timeout_Generator.h" -#include "orbsvcs/Event/EC_Timeout_Filter.h" -#include "orbsvcs/Event_Service_Constants.h" - -#if ! defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Timeout_Generator.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (Event, - EC_Timeout_Generator, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Timeout_Generator::~TAO_EC_Timeout_Generator (void) -{ -} - -// **************************************************************** - -int -TAO_EC_Timeout_Adapter::handle_timeout (const ACE_Time_Value & /* tv */, - const void *vp) -{ - // ACE_DEBUG ((LM_DEBUG, - // "TAO_EC_Timeout_Adapter::handle_timeout -" - // " expire at %d:%d\n", - // tv.sec (), tv.usec ())); - - TAO_EC_Timeout_Filter *filter = - static_cast<TAO_EC_Timeout_Filter*> (const_cast<void*> (vp)); - - if (filter == 0) - return 0; - - ACE_TRY_NEW_ENV - { - RtecEventComm::Event e; - e.header.type = filter->type (); - e.header.source = 0; - - RtecEventComm::EventSet single_event (1, 1, &e, 0); - - TAO_EC_QOS_Info qos_info = filter->qos_info (); - filter->push_to_proxy (single_event, - qos_info - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - return -1; - } - ACE_ENDTRY; - - return 0; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Timeout_Generator.h b/TAO/orbsvcs/orbsvcs/Event/EC_Timeout_Generator.h deleted file mode 100644 index 44a6642de69..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Timeout_Generator.h +++ /dev/null @@ -1,101 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Timeout_Generator.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_TIMEOUT_GENERATOR_H -#define TAO_EC_TIMEOUT_GENERATOR_H - -#include /**/ "ace/pre.h" -#include "ace/Event_Handler.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#include "orbsvcs/Event/EC_Timeout_Filter.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_QOS_Info; - -/** - * @class TAO_EC_Timeout_Generator - * - * @brief Define the interface for the generators of timeout events. - * - * The Event Channel can use several strategies to dispatch - * timers, for instance, it can use the ORB reactor or a pool of - * reactors running at different priorities or a pool of - * Thread_Timer_Queue_Adapters running at different priorities - * also. - * This class is the abstract base class to abstract this - * strategies. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Timeout_Generator -{ -public: - /// destructor - virtual ~TAO_EC_Timeout_Generator (void); - - /// Activate any internal threads. - virtual void activate (void) = 0; - - /// Deactivate any internal threads, clients can destroy the object - /// after calling this method. - virtual void shutdown (void) = 0; - - /// Add a timer at the given priority, returns the timer ID. - virtual int schedule_timer (TAO_EC_Timeout_Filter* filter, - const ACE_Time_Value& delta, - const ACE_Time_Value& interval) = 0; - - /// Cancel a timer at the given priority. - virtual int cancel_timer (const TAO_EC_QOS_Info& info, - int id) = 0; -}; - -// **************************************************************** - -/** - * @class TAO_EC_Timeout_Adapter - * - * @brief Adapt the EC_Filter interface as an Event_Handler. - * - * ACE timer queues (including the reactor) use Event_Handlers to - * dispatch events, but we want to receive them in EC_Filters, - * this class is and adaptor for that purpose. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Timeout_Adapter : public ACE_Event_Handler -{ -public: - /// Default construction. - TAO_EC_Timeout_Adapter (void); - -private: - /// Casts <act> to EC_Filter and dispatches an event to it. - virtual int handle_timeout (const ACE_Time_Value &tv, - const void *act); -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "orbsvcs/Event/EC_Timeout_Generator.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_TIMEOUT_GENERATOR_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Timeout_Generator.i b/TAO/orbsvcs/orbsvcs/Event/EC_Timeout_Generator.i deleted file mode 100644 index aba1263d609..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Timeout_Generator.i +++ /dev/null @@ -1,12 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_EC_Timeout_Adapter::TAO_EC_Timeout_Adapter (void) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Trivial_Supplier_Filter.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Trivial_Supplier_Filter.cpp deleted file mode 100644 index c5d3dc1b72c..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Trivial_Supplier_Filter.cpp +++ /dev/null @@ -1,112 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Trivial_Supplier_Filter.h" -#include "orbsvcs/Event/EC_Event_Channel_Base.h" -#include "orbsvcs/Event/EC_ConsumerAdmin.h" -#include "orbsvcs/Event/EC_ProxySupplier.h" -#include "orbsvcs/Event/EC_QOS_Info.h" -#include "orbsvcs/Event/EC_Scheduling_Strategy.h" -#include "orbsvcs/Event/EC_ProxyConsumer.h" // @@ MSVC 6 bug - -ACE_RCSID(Event, EC_Trivial_Supplier_Filter, "$Id$") - -// **************************************************************** - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Trivial_Supplier_Filter:: - TAO_EC_Trivial_Supplier_Filter (TAO_EC_Event_Channel_Base* ec) - : event_channel_ (ec) -{ -} - -void -TAO_EC_Trivial_Supplier_Filter::bind (TAO_EC_ProxyPushConsumer*) -{ -} - -void -TAO_EC_Trivial_Supplier_Filter::unbind (TAO_EC_ProxyPushConsumer*) -{ -} - -void -TAO_EC_Trivial_Supplier_Filter::connected (TAO_EC_ProxyPushSupplier* - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_Trivial_Supplier_Filter::reconnected (TAO_EC_ProxyPushSupplier* - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_Trivial_Supplier_Filter::disconnected (TAO_EC_ProxyPushSupplier* - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_Trivial_Supplier_Filter::shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) -{ -} - -void -TAO_EC_Trivial_Supplier_Filter::push (const RtecEventComm::EventSet& event, - TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL) -{ - TAO_EC_Scheduling_Strategy* scheduling_strategy = - this->event_channel_->scheduling_strategy (); - scheduling_strategy->schedule_event (event, - consumer, - this - ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Trivial_Supplier_Filter::push_scheduled_event (RtecEventComm::EventSet &event, - const TAO_EC_QOS_Info &event_info - ACE_ENV_ARG_DECL) -{ - TAO_EC_Filter_Worker worker (event, event_info); - this->event_channel_->for_each_consumer (&worker - ACE_ENV_ARG_PARAMETER); -} - -CORBA::ULong -TAO_EC_Trivial_Supplier_Filter::_incr_refcnt (void) -{ - return 1; -} - -CORBA::ULong -TAO_EC_Trivial_Supplier_Filter::_decr_refcnt (void) -{ - return 1; -} - -// **************************************************************** - -TAO_EC_Trivial_Supplier_Filter_Builder:: - TAO_EC_Trivial_Supplier_Filter_Builder (TAO_EC_Event_Channel_Base *ec) - : filter_ (ec) -{ -} - -TAO_EC_Supplier_Filter* -TAO_EC_Trivial_Supplier_Filter_Builder::create ( - RtecEventChannelAdmin::SupplierQOS&) -{ - return &this->filter_; -} - -void -TAO_EC_Trivial_Supplier_Filter_Builder::destroy ( - TAO_EC_Supplier_Filter*) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Trivial_Supplier_Filter.h b/TAO/orbsvcs/orbsvcs/Event/EC_Trivial_Supplier_Filter.h deleted file mode 100644 index 617bd87f6d7..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Trivial_Supplier_Filter.h +++ /dev/null @@ -1,109 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Trivial_Supplier_Filter.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_TRIVIAL_SUPPLIER_FILTER_H -#define TAO_EC_TRIVIAL_SUPPLIER_FILTER_H - -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Supplier_Filter.h" -#include "orbsvcs/Event/EC_Supplier_Filter_Builder.h" - -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_EC_Event_Channel_Base; -class TAO_EC_ProxyPushSupplier_Set; - -// **************************************************************** - -/** - * @class TAO_EC_Trivial_Supplier_Filter - * - * @brief A null filtering strategy. - * - * This strategy does no filtering, it is useful for backends of - * the CosEventChannel, testing and broadcasters; it uses the - * ConsumerAdmin to find all the consumers and pushes the event to - * all of them. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Trivial_Supplier_Filter : public TAO_EC_Supplier_Filter -{ -public: - /// Constructor - TAO_EC_Trivial_Supplier_Filter (TAO_EC_Event_Channel_Base* ec); - - // = The TAO_EC_Supplier_Filter methods. - virtual void bind (TAO_EC_ProxyPushConsumer* consumer); - virtual void unbind (TAO_EC_ProxyPushConsumer* consumer); - virtual void connected (TAO_EC_ProxyPushSupplier* supplier - ACE_ENV_ARG_DECL); - virtual void reconnected (TAO_EC_ProxyPushSupplier* supplier - ACE_ENV_ARG_DECL); - virtual void disconnected (TAO_EC_ProxyPushSupplier* supplier - ACE_ENV_ARG_DECL); - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL); - virtual void push (const RtecEventComm::EventSet& event, - TAO_EC_ProxyPushConsumer *consumer - ACE_ENV_ARG_DECL_NOT_USED); - virtual void push_scheduled_event (RtecEventComm::EventSet &event, - const TAO_EC_QOS_Info &event_info - ACE_ENV_ARG_DECL); - virtual CORBA::ULong _decr_refcnt (void); - virtual CORBA::ULong _incr_refcnt (void); - -private: - /// The event channel, used to locate the set of consumers. - TAO_EC_Event_Channel_Base *event_channel_; -}; - -// **************************************************************** - -/** - * @class TAO_EC_Trivial_Supplier_Filter_Builder - * - * @brief Create a single Trivial_Supplier_Filter. - * - * This Factory creates a single Trivial_Supplier_Filter that is - * used by all the suppliers (i.e. ProxyConsumers) of an event - * channel. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Trivial_Supplier_Filter_Builder : public TAO_EC_Supplier_Filter_Builder -{ -public: - /// constructor.... - TAO_EC_Trivial_Supplier_Filter_Builder (TAO_EC_Event_Channel_Base* ec); - - // = The TAO_EC_Supplier_Filter_Builder methods... - virtual TAO_EC_Supplier_Filter* - create (RtecEventChannelAdmin::SupplierQOS& qos); - virtual void - destroy (TAO_EC_Supplier_Filter *filter); - -private: - /// The filter.... - TAO_EC_Trivial_Supplier_Filter filter_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* TAO_EC_TRIVIAL_SUPPLIER_FILTER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Type_Filter.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Type_Filter.cpp deleted file mode 100644 index d52f1d869aa..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Type_Filter.cpp +++ /dev/null @@ -1,150 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_Type_Filter.h" - -ACE_RCSID(Event, EC_Type_Filter, "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Type_Filter::TAO_EC_Type_Filter (const RtecEventComm::EventHeader& header) - : header_ (header) -{ -} - -int -TAO_EC_Type_Filter::filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - if (event.length () != 1) - return this->filter_set (event, qos_info ACE_ENV_ARG_PARAMETER); - - if (this->can_match (event[0].header)) - { - this->push (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - return 1; - } - return 0; -} - -int -TAO_EC_Type_Filter::filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - if (event.length () != 1) - return this->filter_set (event, qos_info ACE_ENV_ARG_PARAMETER); - - if (this->can_match (event[0].header)) - { - this->push_nocopy (event, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - return 1; - } - return 0; -} - -void -TAO_EC_Type_Filter::push (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - if (this->parent () != 0) - this->parent ()->push (event, qos_info ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Type_Filter::push_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - if (this->parent () != 0) - this->parent ()->push_nocopy (event, qos_info ACE_ENV_ARG_PARAMETER); -} - -void -TAO_EC_Type_Filter::clear (void) -{ -} - -CORBA::ULong -TAO_EC_Type_Filter::max_event_size (void) const -{ - return 1; -} - -int -TAO_EC_Type_Filter::can_match ( - const RtecEventComm::EventHeader& header) const -{ - if (this->header_.source == 0) - { - if (this->header_.type == 0 || header.type == 0) - return 1; - else - return this->header_.type == header.type; - } - - if (this->header_.type == 0) - { - if (header.source == 0) - return 1; - else - return this->header_.source == header.source; - } - - if (header.source == 0) - { - if (header.type != 0) - return this->header_.type == header.type; - return 1; - } - - if (header.type == 0) - { - return this->header_.source == header.source; - } - - return (this->header_.type == header.type - && this->header_.source == header.source); -} - -int -TAO_EC_Type_Filter::add_dependencies ( - const RtecEventComm::EventHeader& header, - const TAO_EC_QOS_Info & - ACE_ENV_ARG_DECL_NOT_USED) -{ - return this->can_match (header); -} - -int -TAO_EC_Type_Filter::filter_set (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) -{ - CORBA::ULong maximum = event.length (); - if (event.maximum () == 0) - return 0; - - RtecEventComm::EventSet matched (maximum); - CORBA::ULong next_slot = 0; - for (CORBA::ULong i = 0; i != maximum; ++i) - { - if (!this->can_match (event[i].header)) - continue; - matched.length (next_slot + 1); - matched[next_slot] = event[i]; - next_slot++; - } - if (matched.length () == 0) - return 0; - - this->push (matched, qos_info ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - return 1; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Type_Filter.h b/TAO/orbsvcs/orbsvcs/Event/EC_Type_Filter.h deleted file mode 100644 index 12a0660bf72..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Type_Filter.h +++ /dev/null @@ -1,81 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_Type_Filter.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_TYPE_FILTER_H -#define TAO_EC_TYPE_FILTER_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/Event/EC_Filter.h" -#include /**/ "orbsvcs/Event/event_serv_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Type_Filter - * - * @brief A filter based on event type/source - * - * This filter only accept events with a predefined type/source, - * both the source and the type can be wildcards. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Type_Filter : public TAO_EC_Filter -{ -public: - /// Constructor. - TAO_EC_Type_Filter (const RtecEventComm::EventHeader& header); - - // = The TAO_EC_Filter methods, please check the documentation in - // TAO_EC_Filter. - virtual int filter (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual int filter_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void push_nocopy (RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - virtual void clear (void); - virtual CORBA::ULong max_event_size (void) const; - virtual int can_match (const RtecEventComm::EventHeader& header) const; - virtual int add_dependencies (const RtecEventComm::EventHeader& header, - const TAO_EC_QOS_Info &qos_info - ACE_ENV_ARG_DECL); - -private: - TAO_EC_Type_Filter (const TAO_EC_Type_Filter&); - TAO_EC_Type_Filter& operator= (const TAO_EC_Type_Filter&); - - /// Filter an EventSet that contains more than one event. - int filter_set (const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL); - -private: - /// Encapsulate the type/source that we must match. - RtecEventComm::EventHeader header_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* TAO_EC_TYPE_FILTER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_UDP_Admin.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_UDP_Admin.cpp deleted file mode 100644 index eba83581c8d..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_UDP_Admin.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// $Id$ - -#include "orbsvcs/Event/EC_UDP_Admin.h" - -ACE_RCSID (Event, - EC_UDP_Admin, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_EC_Simple_AddrServer::TAO_EC_Simple_AddrServer (CORBA::UShort port) - : port_ (port) -{ -} - -TAO_EC_Simple_AddrServer::~TAO_EC_Simple_AddrServer (void) -{ -} - -void -TAO_EC_Simple_AddrServer::get_addr (const RtecEventComm::EventHeader& header, - RtecUDPAdmin::UDP_Addr_out addr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - addr.ipaddr = header.type; - addr.port = this->port_; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_UDP_Admin.h b/TAO/orbsvcs/orbsvcs/Event/EC_UDP_Admin.h deleted file mode 100644 index 7e5ccff9920..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/EC_UDP_Admin.h +++ /dev/null @@ -1,60 +0,0 @@ -// -*- C++ -*- - -/** - * @file EC_UDP_Admin.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * - * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and - * other members of the DOC group. More details can be found in: - * - * http://doc.ece.uci.edu/~coryan/EC/index.html - */ - -#ifndef TAO_EC_UDP_ADMIN_H -#define TAO_EC_UDP_ADMIN_H -#include /**/ "ace/pre.h" - -#include "orbsvcs/RtecUDPAdminS.h" -#include /**/ "orbsvcs/Event/event_serv_export.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_EC_Simple_AddrServer - * - * @brief TAO Real-time Event Service; a simple UDP address server. - * - * The EC is able to use multiple multicast groups to transmit its - * data, the is given control over the mapping between the Event - * (type,source) pair and the (ipaddr,port) pair using a - * AddrServer. - * This class implements a very simple server that simply maps the - * type component to the ipaddr and uses a fixed port, - * provided at initialization time. - */ -class TAO_RTEvent_Serv_Export TAO_EC_Simple_AddrServer : public POA_RtecUDPAdmin::AddrServer -{ -public: - /// Constructor - TAO_EC_Simple_AddrServer (CORBA::UShort port); - - /// Destructor - virtual ~TAO_EC_Simple_AddrServer (void); - - // = The RtecUDPAdmin::AddrServer methods - virtual void get_addr (const RtecEventComm::EventHeader& header, - RtecUDPAdmin::UDP_Addr_out addr - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - -private: - CORBA::UShort port_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* TAO_EC_UDP_ADMIN_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/event_export.h b/TAO/orbsvcs/orbsvcs/Event/event_export.h deleted file mode 100644 index 87a6ddf5a12..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/event_export.h +++ /dev/null @@ -1,40 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl -// ------------------------------ -#ifndef TAO_RTEVENT_EXPORT_H -#define TAO_RTEVENT_EXPORT_H - -#include "ace/config-all.h" - -#if defined (TAO_AS_STATIC_LIBS) -# if !defined (TAO_RTEVENT_HAS_DLL) -# define TAO_RTEVENT_HAS_DLL 0 -# endif /* ! TAO_RTEVENT_HAS_DLL */ -#else -# if !defined (TAO_RTEVENT_HAS_DLL) -# define TAO_RTEVENT_HAS_DLL 1 -# endif /* ! TAO_RTEVENT_HAS_DLL */ -#endif - -#if defined (TAO_RTEVENT_HAS_DLL) && (TAO_RTEVENT_HAS_DLL == 1) -# if defined (TAO_RTEVENT_BUILD_DLL) -# define TAO_RTEvent_Export ACE_Proper_Export_Flag -# define TAO_RTEVENT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define TAO_RTEVENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* TAO_RTEVENT_BUILD_DLL */ -# define TAO_RTEvent_Export ACE_Proper_Import_Flag -# define TAO_RTEVENT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define TAO_RTEVENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* TAO_RTEVENT_BUILD_DLL */ -#else /* TAO_RTEVENT_HAS_DLL == 1 */ -# define TAO_RTEvent_Export -# define TAO_RTEVENT_SINGLETON_DECLARATION(T) -# define TAO_RTEVENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* TAO_RTEVENT_HAS_DLL == 1 */ - -#endif /* TAO_RTEVENT_EXPORT_H */ - -// End of auto generated file. diff --git a/TAO/orbsvcs/orbsvcs/Event/event_serv_export.h b/TAO/orbsvcs/orbsvcs/Event/event_serv_export.h deleted file mode 100644 index a6f6ba465be..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/event_serv_export.h +++ /dev/null @@ -1,40 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl -// ------------------------------ -#ifndef TAO_RTEVENT_SERV_EXPORT_H -#define TAO_RTEVENT_SERV_EXPORT_H - -#include "ace/config-all.h" - -#if defined (TAO_AS_STATIC_LIBS) -# if !defined (TAO_RTEVENT_SERV_HAS_DLL) -# define TAO_RTEVENT_SERV_HAS_DLL 0 -# endif /* ! TAO_RTEVENT_SERV_HAS_DLL */ -#else -# if !defined (TAO_RTEVENT_SERV_HAS_DLL) -# define TAO_RTEVENT_SERV_HAS_DLL 1 -# endif /* ! TAO_RTEVENT_SERV_HAS_DLL */ -#endif - -#if defined (TAO_RTEVENT_SERV_HAS_DLL) && (TAO_RTEVENT_SERV_HAS_DLL == 1) -# if defined (TAO_RTEVENT_SERV_BUILD_DLL) -# define TAO_RTEvent_Serv_Export ACE_Proper_Export_Flag -# define TAO_RTEVENT_SERV_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define TAO_RTEVENT_SERV_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* TAO_RTEVENT_BUILD_DLL */ -# define TAO_RTEvent_Serv_Export ACE_Proper_Import_Flag -# define TAO_RTEVENT_SERV_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define TAO_RTEVENT_SERV_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* TAO_RTEVENT_SERV_BUILD_DLL */ -#else /* TAO_RTEVENT_SERV_HAS_DLL == 1 */ -# define TAO_RTEvent_Serv_Export -# define TAO_RTEVENT_SERV_SINGLETON_DECLARATION(T) -# define TAO_RTEVENT_SERV_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* TAO_RTEVENT_SERV_HAS_DLL == 1 */ - -#endif /* TAO_RTEVENT_SERV_EXPORT_H */ - -// End of auto generated file. diff --git a/TAO/orbsvcs/orbsvcs/Event/event_skel_export.h b/TAO/orbsvcs/orbsvcs/Event/event_skel_export.h deleted file mode 100644 index 70c88d4289e..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/event_skel_export.h +++ /dev/null @@ -1,40 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl -// ------------------------------ -#ifndef TAO_RTEVENT_SKEL_EXPORT_H -#define TAO_RTEVENT_SKEL_EXPORT_H - -#include "ace/config-all.h" - -#if defined (TAO_AS_STATIC_LIBS) -# if !defined (TAO_RTEVENT_SKEL_HAS_DLL) -# define TAO_RTEVENT_SKEL_HAS_DLL 0 -# endif /* ! TAO_RTEVENT_SKEL_HAS_DLL */ -#else -# if !defined (TAO_RTEVENT_SKEL_HAS_DLL) -# define TAO_RTEVENT_SKEL_HAS_DLL 1 -# endif /* ! TAO_RTEVENT_SKEL_HAS_DLL */ -#endif - -#if defined (TAO_RTEVENT_SKEL_HAS_DLL) && (TAO_RTEVENT_SKEL_HAS_DLL == 1) -# if defined (TAO_RTEVENT_SKEL_BUILD_DLL) -# define TAO_RTEvent_Skel_Export ACE_Proper_Export_Flag -# define TAO_RTEVENT_SKEL_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define TAO_RTEVENT_SKEL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* TAO_RTEVENT_SKEL_BUILD_DLL */ -# define TAO_RTEvent_Skel_Export ACE_Proper_Import_Flag -# define TAO_RTEVENT_SKEL_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define TAO_RTEVENT_SKEL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* TAO_RTEVENT_SKEL_BUILD_DLL */ -#else /* TAO_RTEVENT_SKEL_HAS_DLL == 1 */ -# define TAO_RTEvent_Skel_Export -# define TAO_RTEVENT_SKEL_SINGLETON_DECLARATION(T) -# define TAO_RTEVENT_SKEL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* TAO_RTEVENT_SKEL_HAS_DLL == 1 */ - -#endif /* TAO_RTEVENT_SKEL_EXPORT_H */ - -// End of auto generated file. diff --git a/TAO/orbsvcs/orbsvcs/Event/rtcorba_event_export.h b/TAO/orbsvcs/orbsvcs/Event/rtcorba_event_export.h deleted file mode 100644 index e2af98341c2..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/rtcorba_event_export.h +++ /dev/null @@ -1,40 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl -// ------------------------------ -#ifndef TAO_RTCORBAEVENT_EXPORT_H -#define TAO_RTCORBAEVENT_EXPORT_H - -#include "ace/config-all.h" - -#if defined (TAO_AS_STATIC_LIBS) -# if !defined (TAO_RTCORBAEVENT_HAS_DLL) -# define TAO_RTCORBAEVENT_HAS_DLL 0 -# endif /* ! TAO_RTCORBAEVENT_HAS_DLL */ -#else -# if !defined (TAO_RTCORBAEVENT_HAS_DLL) -# define TAO_RTCORBAEVENT_HAS_DLL 1 -# endif /* ! TAO_RTCORBAEVENT_HAS_DLL */ -#endif - -#if defined (TAO_RTCORBAEVENT_HAS_DLL) && (TAO_RTCORBAEVENT_HAS_DLL == 1) -# if defined (TAO_RTCORBAEVENT_BUILD_DLL) -# define TAO_RTCORBAEvent_Export ACE_Proper_Export_Flag -# define TAO_RTCORBAEVENT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define TAO_RTCORBAEVENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* TAO_RTCORBAEVENT_BUILD_DLL */ -# define TAO_RTCORBAEvent_Export ACE_Proper_Import_Flag -# define TAO_RTCORBAEVENT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define TAO_RTCORBAEVENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* TAO_RTCORBAEVENT_BUILD_DLL */ -#else /* TAO_RTCORBAEVENT_HAS_DLL == 1 */ -# define TAO_RTCORBAEvent_Export -# define TAO_RTCORBAEVENT_SINGLETON_DECLARATION(T) -# define TAO_RTCORBAEVENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* TAO_RTCORBAEVENT_HAS_DLL == 1 */ - -#endif /* TAO_RTCORBAEVENT_EXPORT_H */ - -// End of auto generated file. diff --git a/TAO/orbsvcs/orbsvcs/Event/rtkokyu_event_export.h b/TAO/orbsvcs/orbsvcs/Event/rtkokyu_event_export.h deleted file mode 100644 index 9d56447dabd..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/rtkokyu_event_export.h +++ /dev/null @@ -1,56 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl TAO_RTKokyuEvent -// ------------------------------ -#ifndef TAO_RTKOKYUEVENT_EXPORT_H -#define TAO_RTKOKYUEVENT_EXPORT_H - -#include "ace/config-all.h" - -#if defined (TAO_AS_STATIC_LIBS) -# if !defined (TAO_RTKOKYUEVENT_HAS_DLL) -# define TAO_RTKOKYUEVENT_HAS_DLL 0 -# endif /* ! TAO_RTEVENT_HAS_DLL */ -#else -# if !defined (TAO_RTKOKYUEVENT_HAS_DLL) -# define TAO_RTKOKYUEVENT_HAS_DLL 1 -# endif /* ! TAO_RTKOKYUEVENT_HAS_DLL */ -#endif - -#if defined (TAO_RTKOKYUEVENT_HAS_DLL) && (TAO_RTKOKYUEVENT_HAS_DLL == 1) -# if defined (TAO_RTKOKYUEVENT_BUILD_DLL) -# define TAO_RTKokyuEvent_Export ACE_Proper_Export_Flag -# define TAO_RTKOKYUEVENT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define TAO_RTKOKYUEVENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* TAO_RTKOKYUEVENT_BUILD_DLL */ -# define TAO_RTKokyuEvent_Export ACE_Proper_Import_Flag -# define TAO_RTKOKYUEVENT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define TAO_RTKOKYUEVENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* TAO_RTKOKYUEVENT_BUILD_DLL */ -#else /* TAO_RTKOKYUEVENT_HAS_DLL == 1 */ -# define TAO_RTKokyuEvent_Export -# define TAO_RTKOKYUEVENT_SINGLETON_DECLARATION(T) -# define TAO_RTKOKYUEVENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* TAO_RTKOKYUEVENT_HAS_DLL == 1 */ - -// Set TAO_RTKOKYUEVENT_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (TAO_RTKOKYUEVENT_NTRACE) -# if (ACE_NTRACE == 1) -# define TAO_RTKOKYUEVENT_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define TAO_RTKOKYUEVENT_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !TAO_RTKOKYUEVENT_NTRACE */ - -#if (TAO_RTKOKYUEVENT_NTRACE == 1) -# define TAO_RTKOKYUEVENT_TRACE(X) -#else /* (TAO_RTKOKYUEVENT_NTRACE == 1) */ -# define TAO_RTKOKYUEVENT_TRACE(X) ACE_TRACE_IMPL(X) -#endif /* (TAO_RTKOKYUEVENT_NTRACE == 1) */ - -#endif /* TAO_RTKOKYUEVENT_EXPORT_H */ - -// End of auto generated file. diff --git a/TAO/orbsvcs/orbsvcs/Event/sched_event_export.h b/TAO/orbsvcs/orbsvcs/Event/sched_event_export.h deleted file mode 100644 index b9697e05882..00000000000 --- a/TAO/orbsvcs/orbsvcs/Event/sched_event_export.h +++ /dev/null @@ -1,40 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl -// ------------------------------ -#ifndef TAO_RTSCHEDEVENT_EXPORT_H -#define TAO_RTSCHEDEVENT_EXPORT_H - -#include "ace/config-all.h" - -#if defined (TAO_AS_STATIC_LIBS) -# if !defined (TAO_RTSCHEDEVENT_HAS_DLL) -# define TAO_RTSCHEDEVENT_HAS_DLL 0 -# endif /* ! TAO_RTSCHEDEVENT_HAS_DLL */ -#else -# if !defined (TAO_RTSCHEDEVENT_HAS_DLL) -# define TAO_RTSCHEDEVENT_HAS_DLL 1 -# endif /* ! TAO_RTSCHEDEVENT_HAS_DLL */ -#endif - -#if defined (TAO_RTSCHEDEVENT_HAS_DLL) && (TAO_RTSCHEDEVENT_HAS_DLL == 1) -# if defined (TAO_RTSCHEDEVENT_BUILD_DLL) -# define TAO_RTSchedEvent_Export ACE_Proper_Export_Flag -# define TAO_RTSCHEDEVENT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define TAO_RTSCHEDEVENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* TAO_RTSCHEDEVENT_BUILD_DLL */ -# define TAO_RTSchedEvent_Export ACE_Proper_Import_Flag -# define TAO_RTSCHEDEVENT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define TAO_RTSCHEDEVENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* TAO_RTSCHEDEVENT_BUILD_DLL */ -#else /* TAO_RTSCHEDEVENT_HAS_DLL == 1 */ -# define TAO_RTSchedEvent_Export -# define TAO_RTSCHEDEVENT_SINGLETON_DECLARATION(T) -# define TAO_RTSCHEDEVENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* TAO_RTSCHEDEVENT_HAS_DLL == 1 */ - -#endif /* TAO_RTSCHEDEVENT_EXPORT_H */ - -// End of auto generated file. |