78 template<
class T,
class LOCK,
class K>
class w_hash_t;
119 w_assert9(_prev ==
this && _next ==
this);
147 bool is_empty()
const;
149 uint32_t num_members()
const;
160 void set_offset(uint32_t offset);
244 template<
class T,
class L>
class w_list_t;
257 template<
class T,
class LOCK>
364 link_of(t)->attach(&
_tail);
376 link_of(t)->attach(link_of(pos));
381 link_of(t)->attach(link_of(pos)->prev());
396 link_of(t)->detach();
412 return base_of(p->
next());
418 return base_of(p->
prev());
426 return base_of(p->
next());
437 return base_of(p->
prev());
449 friend ostream&
operator<<BIND_FRIEND_OPERATOR_PART_2(
T, LOCK)(
463 #define W_LIST_ARG(class, member) w_offsetof(class,member) 491 template<
class T,
class LOCK>
501 _backwards(false) {};
508 _backwards(backwards) {
519 _backwards = backwards;
530 _curr = (_next == &(_list->_tail)) ? 0 : _list->base_of(_next);
531 _next = (_backwards ? _next->prev() : _next->next());
571 template<
class T,
class LOCK>
605 template<
class T,
class LOCK,
class K>
616 virtual T* search(
const K& k);
625 void set_offset(uint32_t key_offset, uint32_t link_offset);
629 return *(K*)(((
const char*)&t) + _key_offset);
653 #define W_KEYED_ARG(class, key, link) \ 654 W_LIST_ARG(class,key), W_LIST_ARG(class,link) 662 template<
class T,
class LOCK,
class K>
674 virtual T* search(
const K& k);
676 virtual void put_in_order(
T* t);
688 template<
class T,
class LOCK,
class K>
700 virtual T* search(
const K& k);
702 virtual void put_in_order(
T* t);
708 template<
class T,
class LOCK>
709 ostream& operator<<(ostream& o, const w_list_t<T, LOCK>& l) {
712 cout <<
"cnt = " << l.num_members();
714 while (p != &l._tail) {
715 const T* t = l.base_of(p);
716 if (!(o << endl <<
'\t' << *t)) {
724 template<
class T,
class LOCK,
class K>
727 uint32_t link_offset,
731 _key_offset(key_offset) {
734 w_assert9(key_offset +
sizeof(K) <=
sizeof(
T));
738 template<
class T,
class LOCK,
class K>
743 template<
class T,
class LOCK,
class K>
746 uint32_t link_offset) {
752 template<
class T,
class LOCK,
class K>
762 template<
class T,
class LOCK,
class K>
773 template<
class T,
class LOCK,
class K>
788 template<
class T,
class LOCK,
class K>
799 template<
class T,
class LOCK,
class K>
uint32_t _key_offset
Definition: w_list.h:639
Class that adds virtual destructor to w_base_t.
Definition: w_base.h:466
void insert_before(T *t, T *pos)
Definition: w_list.h:380
uint32_t num_members() const
Definition: w_list.h:240
const T * next()
Definition: w_list.h:585
~w_list_t()
Definition: w_list.h:320
w_link_t * next() const
Definition: w_list.h:205
T * next(w_link_t *p)
Get next.
Definition: w_list.h:410
w_link_t * prev() const
Definition: w_list.h:201
uint32_t _adj
Definition: w_list.h:166
#define w_assert1(x)
Level 1 should not add significant extra time.
Definition: w_base.h:198
Const iterator for a list.
Definition: w_list.h:572
void set_offset(uint32_t offset)
Definition: w_list.h:225
static const uint32_t uint4_max
Definition: w_base.h:316
void set_offset(uint32_t link_offset)
Definition: w_list.h:326
w_link_t * _prev
Definition: w_list.h:136
~w_keyed_list_t()
Definition: w_list.h:623
T * pop()
Remove.
Definition: w_list.h:385
T * first()
Definition: w_list.h:608
w_list_base_t & operator=(w_list_base_t &)
#define w_assert3(x)
Level 3 definitely adds significant time.
Definition: w_base.h:214
T * top()
Get first but don't remove.
Definition: w_list.h:400
List maintained in ascending order.
Definition: w_list.h:663
T * pop_front()
Definition: w_list.h:354
#define w_assert2(x)
Level 2 adds some time.
Definition: w_base.h:206
void check()
Definition: w_list.h:118
const K & key_of(const T &t)
Definition: w_list.h:628
w_list_const_i()
Definition: w_list.h:574
T * bottom()
Get last but don't remove.
Definition: w_list.h:405
w_link_t()
Definition: w_list.h:176
w_list_t< T, LOCK > & append(T *t)
Insert at tail.
Definition: w_list.h:369
T * base_of(w_link_t *p) const
return object of which the given link is a member
Definition: w_list.h:274
void attach(w_link_t *prev_link)
Definition: w_listm.cpp:38
w_link_t * detach()
remove containing object from the list.
Definition: w_listm.cpp:49
w_keyed_list_t(LOCK *lock)
Definition: w_list.h:739
List maintained in descending order.
Definition: w_list.h:689
w_list_i()
Definition: w_list.h:497
w_list_t< T, LOCK > & push(T *t)
Insert.
Definition: w_list.h:363
Base class for sorted lists.
Definition: w_list.h:606
unsafe_list_dummy_lock_t *const unsafe_nolock
Definition: w_list.h:92
virtual T * search(const K &k)
Definition: w_list.h:764
T * last()
Definition: w_list.h:612
Iterator for a list.
Definition: w_list.h:76
T * front()
Definition: w_list.h:346
~w_list_const_i()
Definition: w_list.h:579
void reset(const w_list_t< T, LOCK > &l, bool backwards=false)
Definition: w_list.h:516
virtual void put_in_order(T *t)
Definition: w_list.h:332
w_list_base_t * _list
Definition: w_list.h:132
virtual void put_in_order(T *t)
Definition: w_list.h:775
w_list_t< T, LOCK > & push_back(T *t)
Definition: w_list.h:342
w_link_t * link_of(T *t)
Definition: w_list.h:262
void insert_after(T *t, T *pos)
Definition: w_list.h:375
const w_list_t< T, LOCK > * _list
Definition: w_list.h:551
uint32_t count()
Definition: w_list.h:444
T * prev(w_link_t *p)
Get prev.
Definition: w_list.h:416
bool is_empty() const
Definition: w_list.h:236
You can instantiate unsafe lists by using this type.
Definition: w_list.h:90
const w_link_t * link_of(const T *t) const
const version of the above
Definition: w_list.h:268
virtual void put_in_order(T *t)
Definition: w_list.h:801
w_descend_list_t(uint32_t key_offset, uint32_t link_offset, LOCK *l)
Definition: w_list.h:694
~w_ascend_list_t()
Definition: w_list.h:672
LOCK * lock
Definition: w_list.h:286
Link structure for membership in any class to be put on a w_list*.
Definition: w_list.h:104
Templated list of type T.
Definition: w_list.h:74
virtual ~w_list_i()
Definition: w_list.h:512
T * next()
Definition: w_list.h:528
friend ostream const w_list_t< T, LOCK > & l
Definition: w_list.h:451
T * prev_of(T *t)
Definition: w_list.h:433
uint32_t _cnt
Definition: w_list.h:164
w_list_t< T, LOCK > & push_front(T *t)
Definition: w_list.h:338
~w_descend_list_t()
Definition: w_list.h:698
T * _curr
Definition: w_list.h:556
#define w_assert9(x)
changing an assert to an assert9 turns it off.
Definition: w_base.h:243
bool _backwards
Definition: w_list.h:558
T * next_of(T *t)
Definition: w_list.h:422
T * back()
Definition: w_list.h:350
~w_list_base_t()
Definition: w_list.h:231
void reset(const w_list_t< T, LOCK > &l)
Definition: w_list.h:581
w_list_i(const w_list_t< T, LOCK > &l, bool backwards=false)
Definition: w_list.h:505
virtual T * search(const K &k)
Definition: w_list.h:790
w_link_t * _next
Definition: w_list.h:554
w_list_const_i(const w_list_t< T, LOCK > &l)
Definition: w_list.h:576
w_ascend_list_t(uint32_t key_offset, uint32_t link_offset, LOCK *lock)
Definition: w_list.h:668
w_list_t(uint32_t link_offset, LOCK *l)
Linked list constructor.
Definition: w_list.h:303
w_link_t _tail
Definition: w_list.h:162
T * chop()
Remove from rear.
Definition: w_list.h:390
void set_offset(uint32_t key_offset, uint32_t link_offset)
Definition: w_list.h:745
w_list_base_t * member_of() const
Definition: w_list.h:197
w_list_t()
Definition: w_list.h:316
~w_link_t()
Definition: w_list.h:183
const T * base_of(const w_link_t *p) const
const version of the above
Definition: w_list.h:280
const T * curr() const
Definition: w_list.h:589
#define T
Definition: w_okvl_inl.h:45
w_list_base_t()
Definition: w_list.h:209
T * pop_back()
Definition: w_list.h:358
T * curr() const
Return the current item in the list.
Definition: w_list.h:546
virtual T * search(const K &k)
Definition: w_list.h:754
#define CAST(t, o)
Definition: w_base.h:88
w_link_t * _next
Definition: w_list.h:134
Base class for various list classes.
Definition: w_list.h:144
w_link_t & operator=(const w_link_t &)
Definition: w_list.h:192