ESF_Proxy_RB_Tree.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /**
00004  *  @file   ESF_Proxy_RB_Tree.h
00005  *
00006  *  ESF_Proxy_RB_Tree.h,v 1.10 2006/03/15 07:52:21 jtc Exp
00007  *
00008  *  @author Carlos O'Ryan (coryan@cs.wustl.edu)
00009  *
00010  *  http://doc.ece.uci.edu/~coryan/EC/index.html
00011  */
00012 
00013 #ifndef TAO_ESF_PROXY_RB_TREE_H
00014 #define TAO_ESF_PROXY_RB_TREE_H
00015 
00016 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00017 # pragma once
00018 #endif /* ACE_LACKS_PRAGMA_ONCE */
00019 
00020 #include "ace/RB_Tree.h"
00021 
00022 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00023 
00024 /// Iterator class for a ACE_ESF_RB_Tree
00025 template<class PROXY>
00026 class TAO_ESF_Proxy_RB_Tree_Iterator
00027 {
00028 public:
00029   typedef ACE_RB_Tree_Iterator<PROXY *,
00030                                int,
00031                                ACE_Less_Than<PROXY*>,
00032                                ACE_Null_Mutex>
00033     Implementation;
00034 
00035   TAO_ESF_Proxy_RB_Tree_Iterator (const Implementation &i);
00036 
00037   bool operator == (const TAO_ESF_Proxy_RB_Tree_Iterator<PROXY> &rhs) const;
00038   bool operator != (const TAO_ESF_Proxy_RB_Tree_Iterator<PROXY> &rhs) const;
00039   TAO_ESF_Proxy_RB_Tree_Iterator<PROXY>& operator++ (void);
00040   TAO_ESF_Proxy_RB_Tree_Iterator<PROXY> operator++ (int);
00041   PROXY *operator *(void);
00042 
00043 private:
00044   Implementation impl_;
00045 };
00046 
00047 // ****************************************************************
00048 
00049 /// Concrete Proxy collection based on ACE_RB_Tree
00050 /**
00051  * The Event Service Framework provides several alternatives for the
00052  * underlying proxy collections.
00053  * This version is based on Red-Black trees that offer good insertion,
00054  * removal and lookup performance, but the iteration is slightly
00055  * degraded.
00056  */
00057 template<class PROXY>
00058 class TAO_ESF_Proxy_RB_Tree
00059 {
00060 public:
00061   /// A typedef for the underlying implementaiton class
00062   typedef ACE_RB_Tree<PROXY*,int,ACE_Less_Than<PROXY*>,ACE_Null_Mutex> Implementation;
00063 
00064   /// A typedef for the underlying iterator
00065   typedef TAO_ESF_Proxy_RB_Tree_Iterator<PROXY> Iterator;
00066 
00067   /// Constructor
00068   TAO_ESF_Proxy_RB_Tree (void);
00069 
00070   /// Return the first element in the collection, or end() if there
00071   /// are none
00072   TAO_ESF_Proxy_RB_Tree_Iterator<PROXY> begin (void);
00073 
00074   /// Return one past the last element in the collection
00075   TAO_ESF_Proxy_RB_Tree_Iterator<PROXY> end (void);
00076 
00077   /// Return the number of elements in the collection
00078   size_t size (void) const;
00079 
00080   /// Insert a new element to the collection
00081   void connected (PROXY *
00082                   ACE_ENV_ARG_DECL_NOT_USED);
00083 
00084   /// Insert a new element that could be there already.
00085   void reconnected (PROXY *
00086                     ACE_ENV_ARG_DECL_NOT_USED);
00087   /// Remove an element from the collection
00088   void disconnected (PROXY *
00089                      ACE_ENV_ARG_DECL_NOT_USED);
00090 
00091   /// Shutdown the collection, i.e. remove all elements and release
00092   /// resources
00093   void shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED);
00094 
00095 private:
00096   /// The underlying implementation object
00097   Implementation impl_;
00098 };
00099 
00100 TAO_END_VERSIONED_NAMESPACE_DECL
00101 
00102 #if defined (__ACE_INLINE__)
00103 #include "orbsvcs/ESF/ESF_Proxy_RB_Tree.i"
00104 #endif /* __ACE_INLINE__ */
00105 
00106 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
00107 #include "orbsvcs/ESF/ESF_Proxy_RB_Tree.cpp"
00108 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
00109 
00110 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
00111 #pragma implementation ("ESF_Proxy_RB_Tree.cpp")
00112 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
00113 
00114 #endif /* TAO_ESF_PROXY_RB_TREE_H */

Generated on Thu Nov 9 13:08:13 2006 for TAO_ESF by doxygen 1.3.6