MLT  7.28.0
Public Types | Public Member Functions | Data Fields | Private Member Functions
mlt_deque_s Struct Reference

Double-Ended Queue (deque) class. More...

Public Types

typedef int(* mlt_deque_compare) (void *a, void *b)
 The callback function used to compare items for insert sort. More...
 

Public Member Functions

void mlt_deque_close (mlt_deque self)
 Destroy the queue. More...
 
int mlt_deque_count (mlt_deque self)
 Return the number of items in the deque. More...
 
mlt_deque mlt_deque_init ()
 Create a deque. More...
 
int mlt_deque_insert (mlt_deque self, void *item, mlt_deque_compare cmp)
 Insert an item in a sorted fashion. More...
 
void * mlt_deque_peek (mlt_deque self, int index)
 Inquire on item in deque but don't remove. More...
 
void * mlt_deque_peek_back (mlt_deque self)
 Inquire on item at back of deque but don't remove. More...
 
double mlt_deque_peek_back_double (mlt_deque self)
 Inquire on a double float at back of deque but don't remove. More...
 
int mlt_deque_peek_back_int (mlt_deque self)
 Inquire on an integer at back of deque but don't remove. More...
 
void * mlt_deque_peek_front (mlt_deque self)
 Inquire on item at front of deque but don't remove. More...
 
double mlt_deque_peek_front_double (mlt_deque self)
 Inquire on a double float at front of deque but don't remove. More...
 
int mlt_deque_peek_front_int (mlt_deque self)
 Inquire on an integer at front of deque but don't remove. More...
 
void * mlt_deque_pop_back (mlt_deque self)
 Pop an item. More...
 
double mlt_deque_pop_back_double (mlt_deque self)
 Pop a double float. More...
 
int mlt_deque_pop_back_int (mlt_deque self)
 Pop an integer. More...
 
void * mlt_deque_pop_front (mlt_deque self)
 Remove an item from the start. More...
 
double mlt_deque_pop_front_double (mlt_deque self)
 Remove a double float from the start. More...
 
int mlt_deque_pop_front_int (mlt_deque self)
 Remove an integer from the start. More...
 
int mlt_deque_push_back (mlt_deque self, void *item)
 Push an item to the end. More...
 
int mlt_deque_push_back_double (mlt_deque self, double item)
 Push a double float to the end. More...
 
int mlt_deque_push_back_int (mlt_deque self, int item)
 Push an integer to the end. More...
 
int mlt_deque_push_front (mlt_deque self, void *item)
 Queue an item at the start. More...
 
int mlt_deque_push_front_double (mlt_deque self, double item)
 Queue a double float at the start. More...
 
int mlt_deque_push_front_int (mlt_deque self, int item)
 Queue an integer at the start. More...
 

Data Fields

atomic_int count
 
deque_entrylist
 
int size
 

Private Member Functions

static int mlt_deque_allocate (mlt_deque self)
 Allocate space on the deque. More...
 

Detailed Description

Double-Ended Queue (deque) class.

The double-ended queue is a very versatile data structure. MLT uses it as list, stack, and circular queue.

Member Typedef Documentation

◆ mlt_deque_compare

typedef int(* mlt_deque_compare) (void *a, void *b)

The callback function used to compare items for insert sort.

Parameters
athe first object
bthe second object
Returns
0 if equal, < 0 if a < b, or > 0 if a > b

Member Function Documentation

◆ mlt_deque_allocate()

static int mlt_deque_allocate ( mlt_deque  self)
private

Allocate space on the deque.

Parameters
selfa deque
Returns
true if there was an error

◆ mlt_deque_close()

void mlt_deque_close ( mlt_deque  self)

Destroy the queue.

Parameters
selfa deque

◆ mlt_deque_count()

int mlt_deque_count ( mlt_deque  self)

Return the number of items in the deque.

Parameters
selfa deque
Returns
the number of items

◆ mlt_deque_init()

mlt_deque mlt_deque_init ( )

Create a deque.

Returns
a new deque

◆ mlt_deque_insert()

int mlt_deque_insert ( mlt_deque  self,
void *  item,
mlt_deque_compare  cmp 
)

Insert an item in a sorted fashion.

Optimized for the equivalent of mlt_deque_push_back.

Parameters
selfa deque
iteman opaque pointer
cmpa function pointer to the comparison function
Returns
true if there was an error

◆ mlt_deque_peek()

void * mlt_deque_peek ( mlt_deque  self,
int  index 
)

Inquire on item in deque but don't remove.

Parameters
selfa deque
indexthe position in the deque
Returns
an opaque pointer

◆ mlt_deque_peek_back()

void * mlt_deque_peek_back ( mlt_deque  self)

Inquire on item at back of deque but don't remove.

Parameters
selfa deque
Returns
an opaque pointer

◆ mlt_deque_peek_back_double()

double mlt_deque_peek_back_double ( mlt_deque  self)

Inquire on a double float at back of deque but don't remove.

Parameters
selfa deque
Returns
a double float

◆ mlt_deque_peek_back_int()

int mlt_deque_peek_back_int ( mlt_deque  self)

Inquire on an integer at back of deque but don't remove.

Parameters
selfa deque
Returns
an integer

◆ mlt_deque_peek_front()

void * mlt_deque_peek_front ( mlt_deque  self)

Inquire on item at front of deque but don't remove.

Parameters
selfa deque
Returns
an opaque pointer

◆ mlt_deque_peek_front_double()

double mlt_deque_peek_front_double ( mlt_deque  self)

Inquire on a double float at front of deque but don't remove.

Parameters
selfa deque
Returns
a double float

◆ mlt_deque_peek_front_int()

int mlt_deque_peek_front_int ( mlt_deque  self)

Inquire on an integer at front of deque but don't remove.

Parameters
selfa deque
Returns
an integer

◆ mlt_deque_pop_back()

void * mlt_deque_pop_back ( mlt_deque  self)

Pop an item.

Parameters
selfa pointer
Returns
an opaque pointer

◆ mlt_deque_pop_back_double()

double mlt_deque_pop_back_double ( mlt_deque  self)

Pop a double float.

Parameters
selfa deque
Returns
a double float

◆ mlt_deque_pop_back_int()

int mlt_deque_pop_back_int ( mlt_deque  self)

Pop an integer.

Parameters
selfa deque
Returns
an integer

◆ mlt_deque_pop_front()

void * mlt_deque_pop_front ( mlt_deque  self)

Remove an item from the start.

Parameters
selfa pointer
Returns
an opaque pointer

◆ mlt_deque_pop_front_double()

double mlt_deque_pop_front_double ( mlt_deque  self)

Remove a double float from the start.

Parameters
selfa deque
Returns
a double float

◆ mlt_deque_pop_front_int()

int mlt_deque_pop_front_int ( mlt_deque  self)

Remove an integer from the start.

Parameters
selfa deque
Returns
an integer

◆ mlt_deque_push_back()

int mlt_deque_push_back ( mlt_deque  self,
void *  item 
)

Push an item to the end.

Parameters
selfa deque
iteman opaque pointer
Returns
true if there was an error

◆ mlt_deque_push_back_double()

int mlt_deque_push_back_double ( mlt_deque  self,
double  item 
)

Push a double float to the end.

Parameters
selfa deque
itema double float
Returns
true if there was an error

◆ mlt_deque_push_back_int()

int mlt_deque_push_back_int ( mlt_deque  self,
int  item 
)

Push an integer to the end.

Parameters
selfa deque
iteman integer
Returns
true if there was an error

◆ mlt_deque_push_front()

int mlt_deque_push_front ( mlt_deque  self,
void *  item 
)

Queue an item at the start.

Parameters
selfa deque
iteman opaque pointer
Returns
true if there was an error

◆ mlt_deque_push_front_double()

int mlt_deque_push_front_double ( mlt_deque  self,
double  item 
)

Queue a double float at the start.

Parameters
selfa deque
itema double float
Returns
true if there was an error

◆ mlt_deque_push_front_int()

int mlt_deque_push_front_int ( mlt_deque  self,
int  item 
)

Queue an integer at the start.

Parameters
selfa deque
iteman integer
Returns
true if there was an error

Field Documentation

◆ count

atomic_int mlt_deque_s::count

◆ list

deque_entry* mlt_deque_s::list

◆ size

int mlt_deque_s::size

The documentation for this struct was generated from the following files: