picotm  0.8.0
Data Structures | Macros | Typedefs | Functions
picotm-txmultiset-state.h File Reference

Provides non-transactional state and entries for transactional multisets. More...

#include <picotm/compiler.h>
#include <picotm/picotm-lib-rwlock.h>

Data Structures

struct  txmultiset_entry
 Represents an entry in a transaction-safe multiset. More...
 
struct  txmultiset_state
 The global state of transaction-safe multiset. More...
 

Macros

#define __TXMULTISET_ENTRY_INITIALIZER(_parent)
 Initializer macro for struct txmultiset_entry. More...
 
#define TXMULTISET_ENTRY_INITIALIZER
 Initializer macro for struct txmultiset_entry.
 
#define TXMULTISET_STATE_INITIALIZER(_multiset_state, _key, _compare)
 Initializer macro for struct txmultiset_state.
 

Typedefs

typedef const void *(* txmultiset_key_function) (struct txmultiset_entry *entry)
 Generates a compare key for a multiset entry. More...
 
typedef int(* txmultiset_compare_function) (const void *lhs, const void *rhs)
 Key-compare function for two multiset-entry keys. More...
 

Functions

PICOTM_NOTHROW void txmultiset_entry_init (struct txmultiset_entry *self)
 Initializes an entry of a transactional multiset. More...
 
PICOTM_NOTHROW void txmultiset_entry_uninit (struct txmultiset_entry *self)
 Cleans up an entry of a transactional multiset. More...
 
PICOTM_NOTHROW struct txmultiset_entrytxmultiset_entry_next_tx (const struct txmultiset_entry *self)
 Returns the next multiset entry. More...
 
PICOTM_NOTHROW struct txmultiset_entrytxmultiset_entry_prev_tx (const struct txmultiset_entry *self)
 Returns the previous multiset entry. More...
 
PICOTM_NOTHROW void txmultiset_state_init (struct txmultiset_state *self, txmultiset_key_function key, txmultiset_compare_function compare)
 Initializes multiset state. More...
 
PICOTM_NOTHROW void txmultiset_state_uninit (struct txmultiset_state *self)
 Cleans up multiset state. More...
 
PICOTM_NOTHROW void txmultiset_state_clear_and_uninit_entries (struct txmultiset_state *self, void(*uninit)(struct txmultiset_entry *, void *), void *data)
 Removes all entries from a multiset state and runs a cleanup function on each. More...
 

Macro Definition Documentation

◆ __TXMULTISET_ENTRY_INITIALIZER

#define __TXMULTISET_ENTRY_INITIALIZER (   _parent)
Warning
This is an internal interface. Don't use it in application code.

Typedef Documentation

◆ txmultiset_compare_function

typedef int(* txmultiset_compare_function) (const void *lhs, const void *rhs)
Parameters
lhsThe left-hand-side key.
rhsThe right-hand-side key.
Returns
A value less than, equal to, or greater than 0 if lhs is less than, equal to, or greater than rhs.

◆ txmultiset_key_function

typedef const void*(* txmultiset_key_function) (struct txmultiset_entry *entry)
Parameters
Themultiset entry.
Returns
A comparable key for the multiset entry.

Function Documentation

◆ txmultiset_entry_init()

PICOTM_NOTHROW void txmultiset_entry_init ( struct txmultiset_entry self)
Parameters
selfThe multiset entry to initialize.

◆ txmultiset_entry_next_tx()

PICOTM_NOTHROW struct txmultiset_entry* txmultiset_entry_next_tx ( const struct txmultiset_entry self)
Parameters
selfThe current multiset entry.
Returns
The next multiset entry.

◆ txmultiset_entry_prev_tx()

PICOTM_NOTHROW struct txmultiset_entry* txmultiset_entry_prev_tx ( const struct txmultiset_entry self)
Parameters
selfThe current multiset entry.
Returns
The previous multiset entry.

◆ txmultiset_entry_uninit()

PICOTM_NOTHROW void txmultiset_entry_uninit ( struct txmultiset_entry self)
Parameters
selfThe multiset entry to clean up.

◆ txmultiset_state_clear_and_uninit_entries()

PICOTM_NOTHROW void txmultiset_state_clear_and_uninit_entries ( struct txmultiset_state self,
void(*)(struct txmultiset_entry *, void *)  uninit,
void *  data 
)
Parameters
selfThe multiset state to clear.
uninitThe multiset-entry clean-up function.
dataThe clean-up function's data parameter.

◆ txmultiset_state_init()

PICOTM_NOTHROW void txmultiset_state_init ( struct txmultiset_state self,
txmultiset_key_function  key,
txmultiset_compare_function  compare 
)
Parameters
selfThe multiset state to initialize.
keyThe key generator function for the multiset's entries.
compareThe key-compare function.

◆ txmultiset_state_uninit()

PICOTM_NOTHROW void txmultiset_state_uninit ( struct txmultiset_state self)
Parameters
selfThe multiset state to clean up.