This is Unofficial EPICS BASE Doxygen Site
weak_value_map< K, V, C >::element_proxy Class Reference

#include "weakmap.h"

Public Member Functions

 ~element_proxy ()
 
value_pointeroperator= (value_pointer &v)
 
V & operator* () const
 Support: *map[k]. More...
 
V * operator-> () const
 Support: map[k]->mem. More...
 
 operator value_pointer () const
 Support: value_pointer V(map[k]) More...
 
bool operator== (const value_pointer &v) const
 
bool operator!= (const value_pointer &v) const
 

Friends

class weak_value_map
 

Detailed Description

template<typename K, typename V, typename C = std::less<K>>
class weak_value_map< K, V, C >::element_proxy

proxy class for lookup of non-const Supports assignment and deref. implicitly castable to value_pointer (aka shared_ptr<V>)

Definition at line 155 of file weakmap.h.

Constructor & Destructor Documentation

template<typename K, typename V, typename C = std::less<K>>
weak_value_map< K, V, C >::element_proxy::~element_proxy ( )
inline

Definition at line 162 of file weakmap.h.

162 {}

Member Function Documentation

template<typename K, typename V, typename C = std::less<K>>
weak_value_map< K, V, C >::element_proxy::operator value_pointer ( ) const
inline

Support: value_pointer V(map[k])

Definition at line 184 of file weakmap.h.

185  {
186  value_pointer ret = M.find(k);
187  if(!ret)
188  throw std::runtime_error("Bad key");
189  return ret;
190  }
value_pointer find(const K &k) const
Definition: weakmap.h:215
std::tr1::shared_ptr< V > value_pointer
Definition: weakmap.h:64
template<typename K, typename V, typename C = std::less<K>>
bool weak_value_map< K, V, C >::element_proxy::operator!= ( const value_pointer v) const
inline

Definition at line 195 of file weakmap.h.

196  {
197  return !(*this==v);
198  }
template<typename K, typename V, typename C = std::less<K>>
V& weak_value_map< K, V, C >::element_proxy::operator* ( ) const
inline

Support: *map[k].

Definition at line 176 of file weakmap.h.

176  {
177  return *value_pointer(*this);
178  }
std::tr1::shared_ptr< V > value_pointer
Definition: weakmap.h:64
template<typename K, typename V, typename C = std::less<K>>
V* weak_value_map< K, V, C >::element_proxy::operator-> ( ) const
inline

Support: map[k]->mem.

Definition at line 180 of file weakmap.h.

180  {
181  return value_pointer(*this).get();
182  }
std::tr1::shared_ptr< V > value_pointer
Definition: weakmap.h:64
template<typename K, typename V, typename C = std::less<K>>
value_pointer& weak_value_map< K, V, C >::element_proxy::operator= ( value_pointer v)
inline

Support: map[k] = v The value_pointer passed in will be replaced with a wrapped reference

Returns
the argument

Definition at line 166 of file weakmap.h.

167  {
168  if(!v.unique())
169  throw std::invalid_argument("Only unique() references may be inserted");
170  value_pointer chainptr(v.get(), dtor(M._data, k, v));
171  M._data->store[k] = chainptr;
172  v.swap(chainptr);
173  return v;
174  }
std::tr1::shared_ptr< V > value_pointer
Definition: weakmap.h:64
template<typename K, typename V, typename C = std::less<K>>
bool weak_value_map< K, V, C >::element_proxy::operator== ( const value_pointer v) const
inline

Definition at line 191 of file weakmap.h.

192  {
193  return M.find(k)==v;
194  }
value_pointer find(const K &k) const
Definition: weakmap.h:215

Friends And Related Function Documentation

template<typename K, typename V, typename C = std::less<K>>
friend class weak_value_map
friend

Definition at line 158 of file weakmap.h.


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