diff options
author | bala <balanatarajan@users.noreply.github.com> | 2001-11-27 16:24:14 +0000 |
---|---|---|
committer | bala <balanatarajan@users.noreply.github.com> | 2001-11-27 16:24:14 +0000 |
commit | 10606d93cbddfdfb32a12cf79a417d8a6913c1f1 (patch) | |
tree | 8095faaa40990fd6869d3da72445b05569814795 | |
parent | 99564a60f12fd1c5ede66b2b270aa6a9e5504558 (diff) | |
download | ATCD-10606d93cbddfdfb32a12cf79a417d8a6913c1f1.tar.gz |
*** empty log message ***
-rw-r--r-- | ace/Strategies.cpp | 88 | ||||
-rw-r--r-- | ace/Strategies.h | 199 | ||||
-rw-r--r-- | ace/Strategies.i | 95 |
3 files changed, 0 insertions, 382 deletions
diff --git a/ace/Strategies.cpp b/ace/Strategies.cpp deleted file mode 100644 index c43d61939f6..00000000000 --- a/ace/Strategies.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// Strategies.cpp -// $Id$ - -#if !defined (ACE_STRATEGIES_C) -#define ACE_STRATEGIES_C - -#include "ace/Reactor.h" -#include "ace/Strategies.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Strategies.i" -#endif /* __ACE_INLINE __ */ - -ACE_RCSID(ace, Strategies, "$Id$") - -ACE_Notification_Strategy::ACE_Notification_Strategy (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) - : eh_ (eh), - mask_ (mask) -{ -} - -ACE_Notification_Strategy::~ACE_Notification_Strategy (void) -{ -} - -ACE_Event_Handler * -ACE_Notification_Strategy::event_handler (void) -{ - return eh_; -} - -void -ACE_Notification_Strategy::event_handler (ACE_Event_Handler *eh) -{ - this->eh_ = eh; -} - -ACE_Reactor_Mask -ACE_Notification_Strategy::mask (void) -{ - return mask_; -} - -void -ACE_Notification_Strategy::mask (ACE_Reactor_Mask m) -{ - this->mask_ = m; -} - -ACE_Reactor_Notification_Strategy::ACE_Reactor_Notification_Strategy (ACE_Reactor *reactor, - ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) - : ACE_Notification_Strategy (eh, mask), - reactor_ (reactor) -{ -} - -int -ACE_Reactor_Notification_Strategy::notify (void) -{ - return this->reactor_->notify (this->eh_, this->mask_); -} - -int -ACE_Reactor_Notification_Strategy::notify (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) -{ - return this->reactor_->notify (eh, mask); -} - -ACE_Reactor * -ACE_Reactor_Notification_Strategy::reactor (void) -{ - return this->reactor_; -} - -void -ACE_Reactor_Notification_Strategy::reactor (ACE_Reactor *r) -{ - this->reactor_ = r; -} - -ACE_Connection_Recycling_Strategy::~ACE_Connection_Recycling_Strategy (void) -{ -} - -#endif /* ACE_STRATEGIES_C */ diff --git a/ace/Strategies.h b/ace/Strategies.h deleted file mode 100644 index 8abb99d6a27..00000000000 --- a/ace/Strategies.h +++ /dev/null @@ -1,199 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Strategies.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_STRATEGIES_H -#define ACE_STRATEGIES_H -#include "ace/pre.h" - -#include "ace/Event_Handler.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// Forward decls. -class ACE_Reactor; - -/** - * @class ACE_Notification_Strategy - * - * @brief Abstract class used for notifing an interested party - * - * A vehicle for extending the behavior of ACE_Message_Queue wrt - * notification *without subclassing*. Thus, it's an example of - * the Bridge/Strategy patterns. - */ -class ACE_Export ACE_Notification_Strategy -{ -public: - ACE_Notification_Strategy (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask); - virtual ~ACE_Notification_Strategy (void); - - virtual int notify (void) = 0; - virtual int notify (ACE_Event_Handler *, - ACE_Reactor_Mask mask) = 0; - - // Get/Set the event handler - ACE_Event_Handler *event_handler (void); - void event_handler (ACE_Event_Handler *eh); - - // Get/Set the reactor mask - ACE_Reactor_Mask mask (void); - void mask (ACE_Reactor_Mask m); - -protected: - ACE_Event_Handler *eh_; - ACE_Reactor_Mask mask_; -}; - -/** - * @class ACE_Reactor_Notification_Strategy - * - * @brief Used to notify an ACE_Reactor - * - * Integrates the <ACE_Message_Queue> notification into the - * <ACE_Reactor::notify> method. - */ -class ACE_Export ACE_Reactor_Notification_Strategy : public ACE_Notification_Strategy -{ -public: - ACE_Reactor_Notification_Strategy (ACE_Reactor *reactor, - ACE_Event_Handler *eh, - ACE_Reactor_Mask mask); - - /// Default dtor. - virtual ~ACE_Reactor_Notification_Strategy (void); - - virtual int notify (void); - - virtual int notify (ACE_Event_Handler *, - ACE_Reactor_Mask mask); - - // Get/Set the reactor - ACE_Reactor *reactor (void); - void reactor (ACE_Reactor *r); - -protected: - ACE_Reactor *reactor_; -}; - -/** - * @class ACE_Connection_Recycling_Strategy - * - * @brief Defines the interface for a connection recycler. - */ -class ACE_Export ACE_Connection_Recycling_Strategy -{ -public: - /// Virtual Destructor - virtual ~ACE_Connection_Recycling_Strategy (void); - - /// Remove from cache. - virtual int purge (const void *recycling_act) = 0; - - /// Add to cache. - virtual int cache (const void *recycling_act) = 0; - - virtual int recycle_state (const void *recycling_act, - ACE_Recyclable_State new_state) = 0; - - /// Get/Set <recycle_state>. - virtual ACE_Recyclable_State recycle_state (const void *recycling_act) const = 0; - - /// Mark as closed. - virtual int mark_as_closed (const void *recycling_act) = 0; - - /// Mark as closed.(non-locking version) - virtual int mark_as_closed_i (const void *recycling_act) = 0; - - /// Cleanup hint and reset <*act_holder> to zero if <act_holder != 0>. - virtual int cleanup_hint (const void *recycling_act, - void **act_holder = 0) = 0; - -protected: - /// Default ctor. - ACE_Connection_Recycling_Strategy (void); -}; - -class ACE_Export ACE_Recyclable -{ -public: - /// Destructor. - virtual ~ACE_Recyclable (void); - - // = Set/Get the recyclable bit - ACE_Recyclable_State recycle_state (void) const; - void recycle_state (ACE_Recyclable_State new_state); - -protected: - /// Protected constructor. - ACE_Recyclable (ACE_Recyclable_State initial_state); - - /// Our state. - ACE_Recyclable_State recycle_state_; -}; - -class ACE_Export ACE_Hashable -{ -public: - /// Destructor. - virtual ~ACE_Hashable (void); - - /// Computes and returns hash value. This "caches" the hash value to - /// improve performance. - virtual u_long hash (void) const; - -protected: - /// Protected constructor. - ACE_Hashable (void); - - /// This is the method that actually performs the non-cached hash - /// computation. - virtual u_long hash_i (void) const = 0; - - /// Pre-computed hash-value. - u_long hash_value_; - -}; - -class ACE_Export ACE_Refcountable -{ -public: - /// Destructor. - virtual ~ACE_Refcountable (void); - - // = Increment/Decrement refcount - int increment (void); - int decrement (void); - - /// Returns the current refcount. - int refcount (void) const; - -protected: - /// Protected constructor. - ACE_Refcountable (int refcount); - - /// Current refcount. - int refcount_; -}; - -// This needs to come here to avoid circular dependencies. -#include "ace/Strategies_T.h" - -#if defined (__ACE_INLINE__) -#include "ace/Strategies.i" -#endif /* __ACE_INLINE __ */ - -#include "ace/post.h" -#endif /* ACE_STRATEGIES_H */ diff --git a/ace/Strategies.i b/ace/Strategies.i deleted file mode 100644 index 5cdcb51c92e..00000000000 --- a/ace/Strategies.i +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// Strategies.i - -ACE_INLINE -ACE_Reactor_Notification_Strategy::~ACE_Reactor_Notification_Strategy (void) -{ -} - -ACE_INLINE -ACE_Connection_Recycling_Strategy::ACE_Connection_Recycling_Strategy (void) -{ -} - -ACE_INLINE -ACE_Recyclable::ACE_Recyclable (ACE_Recyclable_State initial_state) - : recycle_state_ (initial_state) -{ -} - -ACE_INLINE -ACE_Recyclable::~ACE_Recyclable (void) -{ -} - -ACE_INLINE ACE_Recyclable_State -ACE_Recyclable::recycle_state (void) const -{ - return this->recycle_state_; -} - -ACE_INLINE void -ACE_Recyclable::recycle_state (ACE_Recyclable_State new_state) -{ - if (this->recycle_state_ == ACE_RECYCLABLE_CLOSED) - return; - - this->recycle_state_ = new_state; -} - -ACE_INLINE -ACE_Hashable::ACE_Hashable (void) - : hash_value_ (0) -{ -} - -ACE_INLINE -ACE_Hashable::~ACE_Hashable (void) -{ -} - -ACE_INLINE u_long -ACE_Hashable::hash (void) const -{ - // In doing the check below, we take chance of paying a performance - // price when the hash value is zero. But, that will (hopefully) - // happen far less often than a non-zero value, so this caching - // strategy should pay off, esp. if hash computation is expensive - // relative to the simple comparison. - - if (this->hash_value_ == 0) - ((ACE_Hashable *) this)->hash_value_ = this->hash_i (); - - return this->hash_value_; -} - -ACE_INLINE -ACE_Refcountable::ACE_Refcountable (int refcount) - : refcount_ (refcount) -{ -} - -ACE_INLINE -ACE_Refcountable::~ACE_Refcountable (void) -{ -} - -ACE_INLINE int -ACE_Refcountable::increment (void) -{ - return ++this->refcount_; -} - -ACE_INLINE int -ACE_Refcountable::decrement (void) -{ - return --this->refcount_; -} - -ACE_INLINE int -ACE_Refcountable::refcount (void) const -{ - return this->refcount_; -} |