19 #ifndef INTRUSIVEMAP_H 20 #define INTRUSIVEMAP_H 21 #include <TCL_obj_base.h> 22 #include <TCL_obj_stl.h> 42 #pragma GCC diagnostic push 44 #pragma GCC diagnostic ignored "-Wparentheses" 46 template <
class Key,
class Val>
57 template <
class K,
class V>
73 #pragma GCC diagnostic pop 81 template <
class Key,
class Val>
84 typedef std::set<IntrusiveWrap<Key, Val> >
Super;
115 iterator
begin() {
return iterator(Super::begin());}
118 iterator
end() {
return iterator(Super::end());}
130 std::pair<const_iterator, bool> p = Super::insert(x);
131 return make_pair(iterator(p.first), p.second);
134 template <
class I1,
class I2>
135 void insert(I1 i1, I2 i2) {Super::insert(i1,i2);}
166 template <
class K,
class V>
181 #pragma omit TCL_obj minsky::IntrusiveMap 182 #pragma omit pack minsky::IntrusiveMap 183 #pragma omit unpack minsky::IntrusiveMap 190 template <
class K,
class T>
198 template <
class Key,
class Val>
199 struct is_map<
minsky::IntrusiveWrap<Key,Val> >:
public true_type
201 static string keys() {
return ".#keys";}
202 static string type() {
return ".@is_map";}
208 template <
class K,
class T>
209 struct is_associative_container<
minsky::IntrusiveMap<K,T> >:
210 public std::true_type {};
215 template <
class K,
class T>
216 struct is_map<
minsky::IntrusiveMap<K,T>>:
public is_map_map {};
220 #include <TCL_obj_stl.h> 221 #include <pack_base.h> 222 #include <pack_stl.h> 228 template <
class K,
class V>
235 for (
auto i=a.begin(); i!=a.end(); ++i)
238 b<<static_cast<const V&>(*i);
243 template <
class K,
class V>
246 template <
class T,
class U>
247 void insert(T& a,
const U& v) {a.insert(v);}
248 template <
class T,
class U>
257 for (
size_t i=0; i<sz; ++i)
261 typename T::value_type v(
id);
262 unpack(b,d,static_cast<V&>(v));
270 #include "intrusiveMap.cd"
void keys_of(const minsky::IntrusiveMap< K, T > &o)
value_type * operator->()
value_type & operator[](const Key &k)
const_iterator end() const
void insert(const Key &k, const Val &v)
Super::const_iterator const_iterator
void unpack(classdesc::pack_t &, const classdesc::string &, classdesc::ref< ecolab::urand > &)
iterator(const_iterator it)
void operator()(cd::pack_t &b, const cd::string &d, T &a)
size_t count(const Key &k) const
IntrusiveWrap(const std::pair< K, V > x)
const value_type & operator*() const
KeyAssertion(const K &id)
void operator()(cd::pack_t &b, const cd::string &d, T &a)
Creation and access to the minskyTCL_obj object, which has code to record whenever Minsky's state cha...
const value_type * operator->() const
const_iterator begin() const
void insert(const T &a, const U &v)
IntrusiveWrap(const Key &id, const Val &v=Val())
TrackedIntrusiveMap(A... a)
IntrusiveWrap & operator=(IntrusiveWrap &v)
std::pair< iterator, bool > insert(const value_type &x)
std::set< Key > keys() const
Expr operator*(const NodePtr &x, const Expr &y)
bool hasBeenAccessed(K x)
std::set< IntrusiveWrap< Key, Val > > Super
bool operator<(const IntrusiveWrap &x) const
const_iterator find(const Key &k) const
iterator find(const Key &k)
vector< SliceLabelToken, LibCAllocator< SliceLabelToken > > Key
std::set< Key > updateAccess
track writeable access into this Map
void insert(T &a, const U &v)
const std::set< K > & accessLog() const
Super::value_type value_type
value_type operator[](const Key &k) const
void insert(I1 i1, I2 i2)
void swap(IntrusiveMap &x)
IntrusiveWrap & operator=(const Val &v)