Array_Map.inl

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Array_Map.inl,v 1.6 2006/06/04 14:03:12 schmidt Exp
00004 
00005 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00006 
00007 template<typename Key, typename Value, class EqualTo>
00008 ACE_INLINE
00009 ACE_Array_Map<Key, Value, EqualTo>::ACE_Array_Map (
00010   typename ACE_Array_Map<Key, Value, EqualTo>::size_type s)
00011   : size_ (0)
00012   , capacity_ (s)
00013   , nodes_ (s == 0 ? 0 : new value_type[s])
00014 {
00015 }
00016 
00017 template<typename Key, typename Value, class EqualTo>
00018 ACE_INLINE ACE_Array_Map<Key, Value, EqualTo> &
00019 ACE_Array_Map<Key, Value, EqualTo>::operator= (
00020   ACE_Array_Map<Key, Value, EqualTo> const & map)
00021 {
00022   // Strongly exception-safe assignment.
00023 
00024   ACE_Array_Map<Key, Value, EqualTo> temp (map);
00025   this->swap (temp);
00026   return *this;
00027 }
00028 
00029 template<typename Key, typename Value, class EqualTo>
00030 ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::iterator
00031 ACE_Array_Map<Key, Value, EqualTo>::begin (void)
00032 {
00033   return this->nodes_;
00034 }
00035 
00036 template<typename Key, typename Value, class EqualTo>
00037 ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::iterator
00038 ACE_Array_Map<Key, Value, EqualTo>::end (void)
00039 {
00040   return this->nodes_ + this->size_;
00041 }
00042 
00043 template<typename Key, typename Value, class EqualTo>
00044 ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::const_iterator
00045 ACE_Array_Map<Key, Value, EqualTo>::begin (void) const
00046 {
00047   return this->nodes_;
00048 }
00049 
00050 template<typename Key, typename Value, class EqualTo>
00051 ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::const_iterator
00052 ACE_Array_Map<Key, Value, EqualTo>::end (void) const
00053 {
00054   return this->nodes_ + this->size_;
00055 }
00056 
00057 template<typename Key, typename Value, class EqualTo>
00058 ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::reverse_iterator
00059 ACE_Array_Map<Key, Value, EqualTo>::rbegin (void)
00060 {
00061   return reverse_iterator (this->end ());
00062 }
00063 
00064 template<typename Key, typename Value, class EqualTo>
00065 ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::reverse_iterator
00066 ACE_Array_Map<Key, Value, EqualTo>::rend (void)
00067 {
00068   return reverse_iterator (this->begin ());
00069 }
00070 
00071 template<typename Key, typename Value, class EqualTo>
00072 ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::const_reverse_iterator
00073 ACE_Array_Map<Key, Value, EqualTo>::rbegin (void) const
00074 {
00075   return const_reverse_iterator (this->end ());
00076 }
00077 
00078 template<typename Key, typename Value, class EqualTo>
00079 ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::const_reverse_iterator
00080 ACE_Array_Map<Key, Value, EqualTo>::rend (void) const
00081 {
00082   return const_reverse_iterator (this->begin ());
00083 }
00084 
00085 template<typename Key, typename Value, class EqualTo>
00086 ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::size_type
00087 ACE_Array_Map<Key, Value, EqualTo>::size (void) const
00088 {
00089   return this->size_;
00090 }
00091 
00092 template<typename Key, typename Value, class EqualTo>
00093 ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::size_type
00094 ACE_Array_Map<Key, Value, EqualTo>::max_size (void) const
00095 {
00096   return size_type (-1) / sizeof (value_type);
00097 }
00098 
00099 template<typename Key, typename Value, class EqualTo>
00100 ACE_INLINE bool
00101 ACE_Array_Map<Key, Value, EqualTo>::is_empty (void) const
00102 {
00103   return this->size_ == 0;
00104 }
00105 
00106 // The following method is deprecated.
00107 
00108 template<typename Key, typename Value, class EqualTo>
00109 ACE_INLINE bool
00110 ACE_Array_Map<Key, Value, EqualTo>::empty (void) const
00111 {
00112   return this->is_empty ();
00113 }
00114 
00115 template<typename Key, typename Value, class EqualTo>
00116 ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::size_type
00117 ACE_Array_Map<Key, Value, EqualTo>::count (
00118   typename ACE_Array_Map<Key, Value, EqualTo>::key_type const & k)
00119 {
00120   return
00121     (this->find (k) == this->end () ? 0 : 1); // Only one datum per key.
00122 }
00123 
00124 template<typename Key, typename Value, class EqualTo>
00125 ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::data_type &
00126 ACE_Array_Map<Key, Value, EqualTo>::operator[] (
00127   typename ACE_Array_Map<Key, Value, EqualTo>::key_type const & k)
00128 {
00129   iterator i = (this->insert (value_type (k, data_type ()))).first;
00130   return (*i).second;
00131 }
00132 
00133 ACE_END_VERSIONED_NAMESPACE_DECL

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