Minsky: 3.17.0
minsky::IntrusiveMap< Key, Val > Class Template Reference

#include <intrusiveMap.h>

Inheritance diagram for minsky::IntrusiveMap< Key, Val >:
Inheritance graph
Collaboration diagram for minsky::IntrusiveMap< Key, Val >:
Collaboration graph

Classes

struct  iterator
 

Public Types

typedef Super::const_iterator const_iterator
 
typedef Super::value_type value_type
 
typedef Key key_type
 
typedef Val mapped_type
 

Public Member Functions

template<class... A>
 IntrusiveMap (A... a)
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
iterator find (const Key &k)
 
const_iterator find (const Key &k) const
 
size_t count (const Key &k) const
 
std::pair< iterator, bool > insert (const value_type &x)
 
template<class I1 , class I2 >
void insert (I1 i1, I2 i2)
 
void insert (const Key &k, const Val &v)
 
value_typeoperator[] (const Key &k)
 
value_type operator[] (const Key &k) const
 
void swap (IntrusiveMap &x)
 
std::set< Key > keys () const
 

Public Attributes

std::set< Key > updateAccess
 track writeable access into this Map More...
 

Private Types

typedef std::set< IntrusiveWrap< Key, Val > > Super
 

Detailed Description

template<class Key, class Val>
class minsky::IntrusiveMap< Key, Val >

An intrusive map is like a std::map, except that the value type must include an member "id" of type Key, which holds the key value.

Definition at line 80 of file intrusiveMap.h.

Member Typedef Documentation

◆ const_iterator

template<class Key, class Val>
typedef Super::const_iterator minsky::IntrusiveMap< Key, Val >::const_iterator

Definition at line 84 of file intrusiveMap.h.

◆ key_type

template<class Key, class Val>
typedef Key minsky::IntrusiveMap< Key, Val >::key_type

Definition at line 86 of file intrusiveMap.h.

◆ mapped_type

template<class Key, class Val>
typedef Val minsky::IntrusiveMap< Key, Val >::mapped_type

Definition at line 87 of file intrusiveMap.h.

◆ Super

template<class Key, class Val>
typedef std::set<IntrusiveWrap<Key, Val> > minsky::IntrusiveMap< Key, Val >::Super
private

Definition at line 82 of file intrusiveMap.h.

◆ value_type

template<class Key, class Val>
typedef Super::value_type minsky::IntrusiveMap< Key, Val >::value_type

Definition at line 85 of file intrusiveMap.h.

Constructor & Destructor Documentation

◆ IntrusiveMap()

template<class Key, class Val>
template<class... A>
minsky::IntrusiveMap< Key, Val >::IntrusiveMap ( A...  a)
inlineexplicit

Definition at line 92 of file intrusiveMap.h.

92 : Super(std::forward<A>(a)...) {}
std::set< IntrusiveWrap< Key, Val > > Super
Definition: intrusiveMap.h:82

Member Function Documentation

◆ begin() [1/2]

template<class Key, class Val>
iterator minsky::IntrusiveMap< Key, Val >::begin ( )
inline

Definition at line 113 of file intrusiveMap.h.

113 {return iterator(Super::begin());}

◆ begin() [2/2]

template<class Key, class Val>
const_iterator minsky::IntrusiveMap< Key, Val >::begin ( ) const
inline

Definition at line 114 of file intrusiveMap.h.

114 {return Super::begin();}

◆ count()

template<class Key, class Val>
size_t minsky::IntrusiveMap< Key, Val >::count ( const Key &  k) const
inline

Definition at line 125 of file intrusiveMap.h.

125 {return Super::count(value_type(k));}
Super::value_type value_type
Definition: intrusiveMap.h:85

◆ end() [1/2]

template<class Key, class Val>
iterator minsky::IntrusiveMap< Key, Val >::end ( )
inline

Definition at line 116 of file intrusiveMap.h.

Referenced by minsky::IntrusiveMap< K, V >::operator[]().

116 {return iterator(Super::end());}
Here is the caller graph for this function:

◆ end() [2/2]

template<class Key, class Val>
const_iterator minsky::IntrusiveMap< Key, Val >::end ( ) const
inline

Definition at line 117 of file intrusiveMap.h.

117 {return Super::end();}

◆ find() [1/2]

template<class Key, class Val>
iterator minsky::IntrusiveMap< Key, Val >::find ( const Key &  k)
inline

Definition at line 119 of file intrusiveMap.h.

Referenced by minsky::IntrusiveMap< K, V >::operator[]().

119  {
120  updateAccess.insert(k);
121  return iterator(Super::find(value_type(k)));
122  }
std::set< Key > updateAccess
track writeable access into this Map
Definition: intrusiveMap.h:90
Super::value_type value_type
Definition: intrusiveMap.h:85
Here is the caller graph for this function:

◆ find() [2/2]

template<class Key, class Val>
const_iterator minsky::IntrusiveMap< Key, Val >::find ( const Key &  k) const
inline

Definition at line 123 of file intrusiveMap.h.

123 {return Super::find(value_type(k));}
Super::value_type value_type
Definition: intrusiveMap.h:85

◆ insert() [1/3]

template<class Key, class Val>
std::pair<iterator, bool> minsky::IntrusiveMap< Key, Val >::insert ( const value_type x)
inline

Definition at line 127 of file intrusiveMap.h.

Referenced by minsky::IntrusiveMap< K, V >::insert().

127  {
128  std::pair<const_iterator, bool> p = Super::insert(x);
129  return make_pair(iterator(p.first), p.second);
130  }
Here is the caller graph for this function:

◆ insert() [2/3]

template<class Key, class Val>
template<class I1 , class I2 >
void minsky::IntrusiveMap< Key, Val >::insert ( I1  i1,
I2  i2 
)
inline

Definition at line 133 of file intrusiveMap.h.

133 {Super::insert(i1,i2);}

◆ insert() [3/3]

template<class Key, class Val>
void minsky::IntrusiveMap< Key, Val >::insert ( const Key &  k,
const Val &  v 
)
inline

Definition at line 135 of file intrusiveMap.h.

136  {insert(value_type(k,v));}
std::pair< iterator, bool > insert(const value_type &x)
Definition: intrusiveMap.h:127
Super::value_type value_type
Definition: intrusiveMap.h:85

◆ keys()

template<class Key, class Val>
std::set<Key> minsky::IntrusiveMap< Key, Val >::keys ( ) const
inline

Definition at line 155 of file intrusiveMap.h.

155  {
156  std::set<Key> r;
157  for (const value_type& i: *this)
158  r.insert(i.id());
159  return r;
160  }
Super::value_type value_type
Definition: intrusiveMap.h:85

◆ operator[]() [1/2]

template<class Key, class Val>
value_type& minsky::IntrusiveMap< Key, Val >::operator[] ( const Key &  k)
inline

Definition at line 138 of file intrusiveMap.h.

138  {
139  const_iterator it=find(k);
140  if (it==end())
141  it = Super::insert(value_type(k)).first;
142  return const_cast<value_type&>(*it);
143  }
Super::const_iterator const_iterator
Definition: intrusiveMap.h:84
iterator find(const Key &k)
Definition: intrusiveMap.h:119
Super::value_type value_type
Definition: intrusiveMap.h:85

◆ operator[]() [2/2]

template<class Key, class Val>
value_type minsky::IntrusiveMap< Key, Val >::operator[] ( const Key &  k) const
inline

Definition at line 145 of file intrusiveMap.h.

145  {
146  const_iterator it=find(k);
147  if (it==end())
148  return value_type(k);
149  else
150  return *it;
151  }
Super::const_iterator const_iterator
Definition: intrusiveMap.h:84
iterator find(const Key &k)
Definition: intrusiveMap.h:119
Super::value_type value_type
Definition: intrusiveMap.h:85

◆ swap()

template<class Key, class Val>
void minsky::IntrusiveMap< Key, Val >::swap ( IntrusiveMap< Key, Val > &  x)
inline

Definition at line 153 of file intrusiveMap.h.

153 {Super::swap(x);}

Member Data Documentation

◆ updateAccess

template<class Key, class Val>
std::set<Key> minsky::IntrusiveMap< Key, Val >::updateAccess

track writeable access into this Map

Definition at line 90 of file intrusiveMap.h.

Referenced by minsky::IntrusiveMap< K, V >::find().


The documentation for this class was generated from the following file: