summaryrefslogtreecommitdiff
path: root/ACE/ace/Array_Base.inl
blob: 5a5cef338ff616dddfed2c14090463dd8f189f89 (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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
// -*- C++ -*-
ACE_BEGIN_VERSIONED_NAMESPACE_DECL

// Clean up the array (e.g., delete dynamically allocated memory).
template <class T> ACE_INLINE
ACE_Array_Base<T>::~ACE_Array_Base ()
{
  ACE_DES_ARRAY_FREE (this->array_,
                      this->max_size_,
                      this->allocator_->free,
                      T);
}

template <class T>
ACE_INLINE typename ACE_Array_Base<T>::iterator
ACE_Array_Base<T>::begin ()
{
  return this->array_;
}

template <class T>
ACE_INLINE typename ACE_Array_Base<T>::iterator
ACE_Array_Base<T>::end ()
{
  return this->array_ + this->cur_size_;
}

template <class T>
ACE_INLINE typename ACE_Array_Base<T>::const_iterator
ACE_Array_Base<T>::begin () const
{
  return this->array_;
}

template <class T>
ACE_INLINE typename ACE_Array_Base<T>::const_iterator
ACE_Array_Base<T>::end () const
{
  return this->array_ + this->cur_size_;
}

template <class T>
ACE_INLINE typename ACE_Array_Base<T>::reverse_iterator
ACE_Array_Base<T>::rbegin ()
{
  return reverse_iterator (this->end ());
}

template <class T>
ACE_INLINE typename ACE_Array_Base<T>::reverse_iterator
ACE_Array_Base<T>::rend ()
{
  return reverse_iterator (this->begin ());
}

template <class T>
ACE_INLINE typename ACE_Array_Base<T>::const_reverse_iterator
ACE_Array_Base<T>::rbegin () const
{
  return const_reverse_iterator (this->end ());
}

template <class T>
ACE_INLINE typename ACE_Array_Base<T>::const_reverse_iterator
ACE_Array_Base<T>::rend () const
{
  return const_reverse_iterator (this->begin ());
}

template <class T> ACE_INLINE typename ACE_Array_Base<T>::size_type
ACE_Array_Base<T>::size () const
{
  return this->cur_size_;
}

template <class T> ACE_INLINE typename ACE_Array_Base<T>::size_type
ACE_Array_Base<T>::max_size () const
{
  return this->max_size_;
}

template <class T> ACE_INLINE bool
ACE_Array_Base<T>::in_range (typename ACE_Array_Base<T>::size_type index) const
{
  return index < this->cur_size_;
}

template <class T> ACE_INLINE T &
ACE_Array_Base<T>::operator[] (typename ACE_Array_Base<T>::size_type index)
{
  return this->array_[index];
}

template <class T> ACE_INLINE const T &
ACE_Array_Base<T>::operator[] (typename ACE_Array_Base<T>::size_type index) const
{
  return this->array_[index];
}

// ****************************************************************

template <class T> ACE_INLINE void
ACE_Array_Iterator<T>::dump () const
{
#if defined (ACE_HAS_DUMP)
  // ACE_TRACE ("ACE_Array_Iterator<T>::dump");
#endif /* ACE_HAS_DUMP */
}

template <class T> ACE_INLINE
ACE_Array_Iterator<T>::ACE_Array_Iterator (ACE_Array_Base<T> &a)
    : current_ (0),
      array_ (a)
{
  // ACE_TRACE ("ACE_Array_Iterator<T>::ACE_Array_Iterator");
}

template <class T> ACE_INLINE int
ACE_Array_Iterator<T>::advance ()
{
  // ACE_TRACE ("ACE_Array_Iterator<T>::advance");

  if (this->current_ < array_.size ())
    {
      ++this->current_;
      return 1;
    }
  else
    {
      // Already finished iterating.
      return 0;
    }
}

template <class T> ACE_INLINE int
ACE_Array_Iterator<T>::done () const
{
  ACE_TRACE ("ACE_Array_Iterator<T>::done");

  return this->current_ >= array_.size ();
}

ACE_END_VERSIONED_NAMESPACE_DECL