Pair_T.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Pair_T.h
00006  *
00007  *  Pair_T.h,v 4.15 2005/10/28 16:14:54 ossama Exp
00008  *
00009  *  @author Irfan Pyarali <irfan@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 
00014 #ifndef ACE_PAIR_T_H
00015 #define ACE_PAIR_T_H
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "ace/config-all.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00025 
00026 /**
00027  * @class ACE_Pair
00028  *
00029  * @brief Defines a pair.
00030  *
00031  * Similar to the STL pair.
00032  */
00033 template <class T1, class T2>
00034 class ACE_Pair
00035 {
00036 public:
00037 
00038   // = Traits.
00039   typedef T1 first_type;
00040   typedef T2 second_type;
00041 
00042   // = Initialization and termination methods.
00043   /// Constructor.
00044   ACE_Pair (const T1 &t1,
00045             const T2 &t2);
00046 
00047   /// Default constructor.
00048   ACE_Pair (void);
00049 
00050   /// Get first.
00051   T1 &first (void);
00052   const T1 &first (void) const;
00053 
00054   /// Set first.
00055   void first (const T1 &t1);
00056 
00057   /// Get second.
00058   T2 &second (void);
00059   const T2 &second (void) const;
00060 
00061   /// Set second.
00062   void second (const T2 &t2);
00063 
00064   // Compare pairs.
00065   bool operator== (const ACE_Pair<T1, T2> &rhs) const;
00066 
00067 protected:
00068   /// First.
00069   T1 first_;
00070 
00071   /// Second.
00072   T2 second_;
00073 };
00074 
00075 /**
00076  * @class ACE_Reference_Pair
00077  *
00078  * @brief Defines a pair that only hold references.
00079  *
00080  * Similar to the STL pair (but restricted to holding references
00081  * and not copies).
00082  */
00083 template <class T1, class T2>
00084 class ACE_Reference_Pair
00085 {
00086 public:
00087 
00088   // = Traits.
00089   typedef T1 first_type;
00090   typedef T2 second_type;
00091 
00092   // = Initialization and termination methods.
00093   /// Constructor.
00094   ACE_Reference_Pair (T1 &t1,
00095                       T2 &t2);
00096 
00097   /// Access first.
00098   T1 &first (void) const;
00099 
00100   /// Access second.
00101   T2 &second (void) const;
00102 
00103   // Compare pairs.
00104   bool operator== (const ACE_Reference_Pair<T1, T2> &rhs) const;
00105 
00106 protected:
00107   /// First.
00108   T1 &first_;
00109 
00110   /// Second.
00111   T2 &second_;
00112 };
00113 
00114 ACE_END_VERSIONED_NAMESPACE_DECL
00115 
00116 #if defined (__ACE_INLINE__)
00117 #include "ace/Pair_T.inl"
00118 #endif /* __ACE_INLINE__ */
00119 
00120 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
00121 #include "ace/Pair_T.cpp"
00122 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
00123 
00124 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
00125 #pragma implementation ("Pair_T.cpp")
00126 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
00127 
00128 #include /**/ "ace/post.h"
00129 #endif /* ACE_PAIR_T_H */

Generated on Thu Nov 9 09:41:59 2006 for ACE by doxygen 1.3.6