diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2008-03-04 14:51:23 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2008-03-04 14:51:23 +0000 |
commit | 99aa8c60282c7b8072eb35eb9ac815702f5bf586 (patch) | |
tree | bda96bf8c3a4c2875a083d7b16720533c8ffeaf4 /ACE/ace/Array_Base.inl | |
parent | c4078c377d74290ebe4e66da0b4975da91732376 (diff) | |
download | ATCD-99aa8c60282c7b8072eb35eb9ac815702f5bf586.tar.gz |
undoing accidental deletion
Diffstat (limited to 'ACE/ace/Array_Base.inl')
-rw-r--r-- | ACE/ace/Array_Base.inl | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/ACE/ace/Array_Base.inl b/ACE/ace/Array_Base.inl new file mode 100644 index 00000000000..849bcc18de2 --- /dev/null +++ b/ACE/ace/Array_Base.inl @@ -0,0 +1,146 @@ +// -*- C++ -*- +// +// $Id$ + +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 (void) +{ + 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 (void) +{ + return this->array_; +} + +template <class T> +ACE_INLINE typename ACE_Array_Base<T>::iterator +ACE_Array_Base<T>::end (void) +{ + return this->array_ + this->cur_size_; +} + +template <class T> +ACE_INLINE typename ACE_Array_Base<T>::const_iterator +ACE_Array_Base<T>::begin (void) const +{ + return this->array_; +} + +template <class T> +ACE_INLINE typename ACE_Array_Base<T>::const_iterator +ACE_Array_Base<T>::end (void) const +{ + return this->array_ + this->cur_size_; +} + +template <class T> +ACE_INLINE typename ACE_Array_Base<T>::reverse_iterator +ACE_Array_Base<T>::rbegin (void) +{ + return reverse_iterator (this->end ()); +} + +template <class T> +ACE_INLINE typename ACE_Array_Base<T>::reverse_iterator +ACE_Array_Base<T>::rend (void) +{ + return reverse_iterator (this->begin ()); +} + +template <class T> +ACE_INLINE typename ACE_Array_Base<T>::const_reverse_iterator +ACE_Array_Base<T>::rbegin (void) 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 (void) const +{ + return const_reverse_iterator (this->begin ()); +} + +template <class T> ACE_INLINE typename ACE_Array_Base<T>::size_type +ACE_Array_Base<T>::size (void) const +{ + return this->cur_size_; +} + +template <class T> ACE_INLINE typename ACE_Array_Base<T>::size_type +ACE_Array_Base<T>::max_size (void) 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 (void) 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 (void) +{ + // 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 (void) const +{ + ACE_TRACE ("ACE_Array_Iterator<T>::done"); + + return this->current_ >= array_.size (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL |