tetgenmesh::queue Class Reference

#include <tetgen.h>

+ Inheritance diagram for tetgenmesh::queue:

Public Member Functions

 queue (int bytecount, int itemcount=256)
 
void clear ()
 
long len ()
 
bool empty ()
 
void * push (void *newitem)
 
void * pop ()
 
- Public Member Functions inherited from tetgenmesh::memorypool
 memorypool ()
 
 memorypool (int, int, enum wordtype, int)
 
 ~memorypool ()
 
void poolinit (int, int, enum wordtype, int)
 
void restart ()
 
void * alloc ()
 
void dealloc (void *)
 
void traversalinit ()
 
void * traverse ()
 

Public Attributes

void ** head
 
void ** tail
 
int linkitembytes
 
int linkitems
 
- Public Attributes inherited from tetgenmesh::memorypool
void ** firstblock
 
void ** nowblock
 
void * nextitem
 
void * deaditemstack
 
void ** pathblock
 
void * pathitem
 
wordtype itemwordtype
 
int alignbytes
 
int itembytes
 
int itemwords
 
int itemsperblock
 
long items
 
long maxitems
 
int unallocateditems
 
int pathitemsleft
 

Constructor & Destructor Documentation

◆ queue()

tetgenmesh::queue::queue ( int  bytecount,
int  itemcount = 256 
)
inline
1558  {
1559  linkitembytes = bytecount;
1560  poolinit(bytecount + sizeof(void *), itemcount, POINTER, 0);
1561  head = (void **) alloc();
1562  tail = (void **) alloc();
1563  *head = (void *) tail;
1564  *tail = NULL;
1565  linkitems = 0;
1566  }
void poolinit(int, int, enum wordtype, int)
int linkitembytes
Definition: tetgen.h:1555
int linkitems
Definition: tetgen.h:1556
void ** head
Definition: tetgen.h:1554
void ** tail
Definition: tetgen.h:1554
@ POINTER
Definition: tetgen.h:826

References tetgenmesh::memorypool::alloc(), head, linkitembytes, linkitems, tetgenmesh::POINTER, tetgenmesh::memorypool::poolinit(), and tail.

Member Function Documentation

◆ clear()

void tetgenmesh::queue::clear ( )
inline
1568  {
1569  // Reset the pool.
1570  restart();
1571  // Initialize all variables.
1572  head = (void **) alloc();
1573  tail = (void **) alloc();
1574  *head = (void *) tail;
1575  *tail = NULL;
1576  linkitems = 0;
1577  }

References tetgenmesh::memorypool::alloc(), head, linkitems, tetgenmesh::memorypool::restart(), and tail.

◆ empty()

bool tetgenmesh::queue::empty ( )
inline
1580 { return linkitems == 0; }

References linkitems.

◆ len()

long tetgenmesh::queue::len ( )
inline
1579 { return linkitems; }

References linkitems.

◆ pop()

void* tetgenmesh::queue::pop ( )
inline
1594  {
1595  if (linkitems > 0) {
1596  void **deadnode = (void **) *head;
1597  *head = *deadnode;
1598  dealloc((void *) deadnode);
1599  linkitems--;
1600  return (void *)(deadnode + 1);
1601  } else {
1602  return NULL;
1603  }
1604  }

References tetgenmesh::memorypool::dealloc(), head, and linkitems.

◆ push()

void* tetgenmesh::queue::push ( void *  newitem)
inline
1582  {
1583  void **newnode = tail;
1584  if (newitem != (void *) NULL) {
1585  memcpy((void *)(newnode + 1), newitem, linkitembytes);
1586  }
1587  tail = (void **) alloc();
1588  *tail = NULL;
1589  *newnode = (void *) tail;
1590  linkitems++;
1591  return (void *)(newnode + 1);
1592  }

References tetgenmesh::memorypool::alloc(), linkitembytes, linkitems, and tail.

Member Data Documentation

◆ head

void** tetgenmesh::queue::head

Referenced by clear(), pop(), and queue().

◆ linkitembytes

int tetgenmesh::queue::linkitembytes

Referenced by push(), and queue().

◆ linkitems

int tetgenmesh::queue::linkitems

Referenced by clear(), empty(), len(), pop(), push(), and queue().

◆ tail

void ** tetgenmesh::queue::tail

Referenced by clear(), push(), and queue().


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