Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Pair_T.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Pair_T.h
00006  *
00007  *  $Id: Pair_T.h,v 1.1.1.4 2003/02/21 18:36:32 chad 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 /**
00025  * @class ACE_Pair
00026  *
00027  * @brief Defines a pair.
00028  *
00029  * Similar to the STL pair.
00030  */
00031 template <class T1, class T2>
00032 class ACE_Pair
00033 {
00034 public:
00035 
00036   // = Traits.
00037   typedef T1 first_type;
00038   typedef T2 second_type;
00039 
00040   // = Initialization and termination methods.
00041   /// Constructor.
00042   ACE_Pair (const T1 &t1,
00043             const T2 &t2);
00044 
00045   /// Default constructor.
00046   ACE_Pair (void);
00047 
00048   /// Get first.
00049   T1 &first (void);
00050   const T1 &first (void) const;
00051 
00052   /// Set first.
00053   void first (const T1 &t1);
00054 
00055   /// Get second.
00056   T2 &second (void);
00057   const T2 &second (void) const;
00058 
00059   /// Set second.
00060   void second (const T2 &t2);
00061 
00062   // Compare pairs.
00063   int operator== (const ACE_Pair<T1, T2> &rhs) const;
00064 
00065 protected:
00066   /// First.
00067   T1 first_;
00068 
00069   /// Second.
00070   T2 second_;
00071 };
00072 
00073 /**
00074  * @class ACE_Reference_Pair
00075  *
00076  * @brief Defines a pair that only hold references.
00077  *
00078  * Similar to the STL pair (but restricted to holding references
00079  * and not copies).
00080  */
00081 template <class T1, class T2>
00082 class ACE_Reference_Pair
00083 {
00084 public:
00085 
00086   // = Traits.
00087   typedef T1 first_type;
00088   typedef T2 second_type;
00089 
00090   // = Initialization and termination methods.
00091   /// Constructor.
00092   ACE_Reference_Pair (T1 &t1,
00093                       T2 &t2);
00094 
00095   /// Access first.
00096   T1 &first (void) const;
00097 
00098   /// Access second.
00099   T2 &second (void) const;
00100 
00101   // Compare pairs.
00102   int operator== (const ACE_Reference_Pair<T1, T2> &rhs) const;
00103 
00104 protected:
00105   /// First.
00106   T1 &first_;
00107 
00108   /// Second.
00109   T2 &second_;
00110 };
00111 
00112 #if defined (__ACE_INLINE__)
00113 #include "ace/Pair_T.i"
00114 #endif /* __ACE_INLINE__ */
00115 
00116 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
00117 #include "ace/Pair_T.cpp"
00118 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
00119 
00120 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
00121 #pragma implementation ("Pair_T.cpp")
00122 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
00123 
00124 #include "ace/post.h"
00125 #endif /* ACE_PAIR_T_H */

Generated on Mon Jun 16 11:20:46 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002