Zero  0.1.0
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
w_list_t< T, LOCK > Class Template Reference

Templated list of type T. More...

#include <w_list.h>

Inheritance diagram for w_list_t< T, LOCK >:
w_list_base_t w_vbase_t w_base_t w_keyed_list_t< T, LOCK, K > w_ascend_list_t< T, LOCK, K > w_descend_list_t< T, LOCK, K >

Public Member Functions

 w_list_t (uint32_t link_offset, LOCK *l)
 Linked list constructor. More...
 
 w_list_t ()
 
 ~w_list_t ()
 
void set_offset (uint32_t link_offset)
 
virtual void put_in_order (T *t)
 
w_list_t< T, LOCK > & push_front (T *t)
 
w_list_t< T, LOCK > & push_back (T *t)
 
Tfront ()
 
Tback ()
 
Tpop_front ()
 
Tpop_back ()
 
w_list_t< T, LOCK > & push (T *t)
 Insert. More...
 
w_list_t< T, LOCK > & append (T *t)
 Insert at tail. More...
 
void insert_after (T *t, T *pos)
 
void insert_before (T *t, T *pos)
 
Tpop ()
 Remove. More...
 
Tchop ()
 Remove from rear. More...
 
void remove (T *t)
 
Ttop ()
 Get first but don't remove. More...
 
Tbottom ()
 Get last but don't remove. More...
 
Tnext (w_link_t *p)
 Get next. More...
 
Tprev (w_link_t *p)
 Get prev. More...
 
Tnext_of (T *t)
 
Tprev_of (T *t)
 
uint32_t count ()
 
- Public Member Functions inherited from w_list_base_t
bool is_empty () const
 
uint32_t num_members () const
 
void dump ()
 
- Public Member Functions inherited from w_vbase_t
 w_vbase_t ()
 
virtual ~w_vbase_t ()
 

Protected Member Functions

w_link_tlink_of (T *t)
 
const w_link_tlink_of (const T *t) const
 const version of the above More...
 
Tbase_of (w_link_t *p) const
 return object of which the given link is a member More...
 
const Tbase_of (const w_link_t *p) const
 const version of the above More...
 
- Protected Member Functions inherited from w_list_base_t
 w_list_base_t ()
 
 w_list_base_t (uint32_t offset)
 
 ~w_list_base_t ()
 
void set_offset (uint32_t offset)
 

Private Member Functions

 w_list_t (const w_list_t< T, LOCK > &x)
 
w_list_t< T, LOCK > & operator= (const w_list_t< T, LOCK > &)
 

Private Attributes

LOCK * lock
 

Friends

ostream const w_list_t< T, LOCK > & l
 
class w_list_i< T, LOCK >
 
ostream & operator<<BIND_FRIEND_OPERATOR_PART_2 (T, LOCK)(ostream &o
 streams output More...
 

Additional Inherited Members

- Public Types inherited from w_base_t
enum  CompareOp {
  badOp = 0x0, eqOp = 0x1, gtOp = 0x2, geOp = 0x3,
  ltOp = 0x4, leOp = 0x5, NegInf = 0x100, eqNegInf,
  gtNegInf, geNegInf, ltNegInf, leNegInf,
  PosInf = 0x400, eqPosInf, gtPosInf, gePosInf,
  ltPosInf, lePosInf
}
 Comparison Operators. More...
 
typedef unsigned char u_char
 
typedef unsigned short u_short
 
typedef unsigned long u_long
 
typedef uint64_t large_stat_t
 
typedef int32_t base_stat_t
 
typedef float base_float_t
 
typedef float f4_t
 
typedef double f8_t
 
- Static Public Member Functions inherited from w_base_t
static bool is_aligned (size_t sz)
 
static bool is_aligned (const void *s)
 
static bool is_big_endian ()
 
static bool is_little_endian ()
 
static int64_t strtoi8 (const char *, char **end=0, int base=0)
 Convert string to 8-byte integer. More...
 
static uint64_t strtou8 (const char *, char **end=0, int base=0)
 Convert string to 8-byte unsigned integer. More...
 
static bool is_finite (const f8_t x)
 
static bool is_infinite (const f8_t x)
 
static bool is_nan (const f8_t x)
 
static bool is_infinite_or_nan (const f8_t x)
 
static uint16_t w_ntohs (uint16_t)
 
static uint16_t w_htons (uint16_t)
 
static uint32_t w_ntohl (uint32_t)
 
static uint32_t w_htonl (uint32_t)
 
static void assert_failed (const char *desc, const char *file, uint32_t line)
 print a message and abort More...
 
static void abort ()
 dump core More...
 
- Static Public Attributes inherited from w_base_t
static const int8_t int1_max = 0x7f
 
static const int8_t int1_min = (int8_t)0x80u
 
static const int16_t int2_max = 0x7fff
 
static const int16_t int2_min = (int16_t)0x8000u
 
static const int32_t int4_max = 0x7fffffff
 
static const int32_t int4_min = 0x80000000
 
static const int64_t int8_max
 
static const int64_t int8_min
 
static const uint8_t uint1_max = 0xff
 
static const uint8_t uint1_min = 0x0
 
static const uint16_t uint2_max = 0xffff
 
static const uint16_t uint2_min = 0x0
 
static const uint32_t uint4_max = 0xffffffff
 
static const uint32_t uint4_min = 0x0
 
static const uint64_t uint8_max
 
static const uint64_t uint8_min
 
- Protected Attributes inherited from w_list_base_t
w_link_t _tail
 
uint32_t _cnt
 
uint32_t _adj
 

Detailed Description

template<class T, class LOCK>
class w_list_t< T, LOCK >

Templated list of type T.

Attention
These lists are not thread-safe. The user must provide the locks to access the lists if thread-safety is necessary. In order to identify the locations of all these, I am adding a template type for the lock, and I'm going to assert lock.is_mine, at least in debugging mode.

Constructor & Destructor Documentation

§ w_list_t() [1/3]

template<class T, class LOCK>
w_list_t< T, LOCK >::w_list_t ( uint32_t  link_offset,
LOCK *  l 
)
inline

Linked list constructor.

Parameters
[in]link_offsetOffset into type T of the w_link_t used for this list.
[in]lPointer to the lock that will protect this list.
Note
These lists are not locked; it is up to the client to provide synchronization for the list. The LOCK template argument is solely to make the list uses somewhat self-documenting. By code perusal you might be able to tell what lock type and what lock is meant to protect this list.

§ w_list_t() [2/3]

template<class T, class LOCK>
w_list_t< T, LOCK >::w_list_t ( )
inline

create a list sans offset. Client must use set_offset later, before using the list.

§ ~w_list_t()

template<class T, class LOCK>
w_list_t< T, LOCK >::~w_list_t ( )
inline

§ w_list_t() [3/3]

template<class T, class LOCK>
w_list_t< T, LOCK >::w_list_t ( const w_list_t< T, LOCK > &  x)
private

Member Function Documentation

§ append()

template<class T, class LOCK>
w_list_t<T, LOCK>& w_list_t< T, LOCK >::append ( T t)
inline

Insert at tail.

§ back()

template<class T, class LOCK>
T* w_list_t< T, LOCK >::back ( )
inline

§ base_of() [1/2]

template<class T, class LOCK>
T* w_list_t< T, LOCK >::base_of ( w_link_t p) const
inlineprotected

return object of which the given link is a member

§ base_of() [2/2]

template<class T, class LOCK>
const T* w_list_t< T, LOCK >::base_of ( const w_link_t p) const
inlineprotected

const version of the above

§ bottom()

template<class T, class LOCK>
T* w_list_t< T, LOCK >::bottom ( )
inline

Get last but don't remove.

§ chop()

template<class T, class LOCK>
T* w_list_t< T, LOCK >::chop ( )
inline

Remove from rear.

§ count()

template<class T, class LOCK>
uint32_t w_list_t< T, LOCK >::count ( )
inline

§ front()

template<class T, class LOCK>
T* w_list_t< T, LOCK >::front ( )
inline

§ insert_after()

template<class T, class LOCK>
void w_list_t< T, LOCK >::insert_after ( T t,
T pos 
)
inline

§ insert_before()

template<class T, class LOCK>
void w_list_t< T, LOCK >::insert_before ( T t,
T pos 
)
inline

§ link_of() [1/2]

template<class T, class LOCK>
w_link_t* w_list_t< T, LOCK >::link_of ( T t)
inlineprotected

return non-const ptr to link member of an object in this list

§ link_of() [2/2]

template<class T, class LOCK>
const w_link_t* w_list_t< T, LOCK >::link_of ( const T t) const
inlineprotected

const version of the above

§ next()

template<class T, class LOCK>
T* w_list_t< T, LOCK >::next ( w_link_t p)
inline

Get next.

§ next_of()

template<class T, class LOCK>
T* w_list_t< T, LOCK >::next_of ( T t)
inline

§ operator=()

template<class T, class LOCK>
w_list_t<T, LOCK>& w_list_t< T, LOCK >::operator= ( const w_list_t< T, LOCK > &  )
private

§ pop()

template<class T, class LOCK>
T* w_list_t< T, LOCK >::pop ( )
inline

Remove.

§ pop_back()

template<class T, class LOCK>
T* w_list_t< T, LOCK >::pop_back ( )
inline

§ pop_front()

template<class T, class LOCK>
T* w_list_t< T, LOCK >::pop_front ( )
inline

§ prev()

template<class T, class LOCK>
T* w_list_t< T, LOCK >::prev ( w_link_t p)
inline

Get prev.

§ prev_of()

template<class T, class LOCK>
T* w_list_t< T, LOCK >::prev_of ( T t)
inline

§ push()

template<class T, class LOCK>
w_list_t<T, LOCK>& w_list_t< T, LOCK >::push ( T t)
inline

Insert.

§ push_back()

template<class T, class LOCK>
w_list_t<T, LOCK>& w_list_t< T, LOCK >::push_back ( T t)
inline

§ push_front()

template<class T, class LOCK>
w_list_t<T, LOCK>& w_list_t< T, LOCK >::push_front ( T t)
inline

§ put_in_order()

template<class T, class LOCK>
virtual void w_list_t< T, LOCK >::put_in_order ( T t)
inlinevirtual

For ordered lists, this uses the ordering. For unordered lists (simply w_list_t<T,LOCK>), it just inserts.

Reimplemented in w_descend_list_t< T, LOCK, K >, w_descend_list_t< xct_t, mcs_lock, tid_t >, and w_ascend_list_t< T, LOCK, K >.

§ remove()

template<class T, class LOCK>
void w_list_t< T, LOCK >::remove ( T t)
inline

§ set_offset()

template<class T, class LOCK>
void w_list_t< T, LOCK >::set_offset ( uint32_t  link_offset)
inline

Tell the list where to find the offset of the w_link_t in the item-type T. Lists constructed with the vacuous constructor must have this called before the list is used.

§ top()

template<class T, class LOCK>
T* w_list_t< T, LOCK >::top ( )
inline

Get first but don't remove.

Friends And Related Function Documentation

§ l

template<class T, class LOCK>
friend ostream const w_list_t<T, LOCK>& l
friend

§ operator<
template<class T, class LOCK>
ostream& operator<<BIND_FRIEND_OPERATOR_PART_2 ( T  ,
LOCK   
)
friend

streams output

§ w_list_i< T, LOCK >

template<class T, class LOCK>
friend class w_list_i< T, LOCK >
friend

Member Data Documentation

§ lock

template<class T, class LOCK>
LOCK* w_list_t< T, LOCK >::lock
private

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