summaryrefslogtreecommitdiff
path: root/ace/Pair_T.h
blob: 18787e4902b8ec3f11c2dfa5ca1aacb798bbb40b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    ace
//
// = FILENAME
//    Pair_T.h
//
// = AUTHOR
//    Irfan Pyarali <irfan@cs.wustl.edu>
//
// ============================================================================

#ifndef ACE_PAIR_T_H
#define ACE_PAIR_T_H
#include "ace/pre.h"

#include "ace/Pair.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

template <class T1, class T2>
class ACE_Pair
{
  // = TITLE
  //     Defines a pair.
  //
  // = DESCRIPTION
  //     Similar to the STL pair.
public:

  // = Traits.
  typedef T1 first_type;
  typedef T2 second_type;

  // = Initialization and termination methods.
  ACE_Pair (const T1 &t1,
            const T2 &t2);
  // Constructor.

  ACE_Pair (void);
  // Default constructor.

  T1 &first (void);
  const T1 &first (void) const;
  void first (const T1 &t1);
  // Get/Set first.

  T2 &second (void);
  const T2 &second (void) const;
  void second (const T2 &t2);
  // Access second.

protected:

  T1 first_;
  T2 second_;
};

template <class T1, class T2>
class ACE_Reference_Pair
{
  // = TITLE
  //     Defines a pair that only hold references.
  //
  // = DESCRIPTION
  //     Similar to the STL pair (but restricted to holding references
  //     and not copies).
public:

  // = Traits.
  typedef T1 first_type;
  typedef T2 second_type;

  // = Initialization and termination methods.
  ACE_Reference_Pair (T1 &t1,
                      T2 &t2);
  // Constructor.

  T1 &first (void) const;
  // Access first.

  T2 &second (void) const;
  // Access second.

protected:

  T1 &first_;
  T2 &second_;
};

#if defined (__ACE_INLINE__)
#include "ace/Pair_T.i"
#endif /* __ACE_INLINE__ */

#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Pair_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */

#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Pair_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */

#include "ace/post.h"
#endif /* ACE_PAIR_T_H */