1 #include "LinkedBlockList.h"
\r
6 /*********************************************************************/
\r
8 void LinkedBlockList::addFront(ListType item) {
\r
10 if ( m_head_block_size == GCLL_BLOCK_SIZE )
\r
12 LLBlock *tmp = (LLBlock *) new LLBlock;
\r
14 mexErrMsgIdAndTxt("GraphCut:LinkedBlockList:addFront", "Out of memory");
\r
15 tmp -> m_next = m_head;
\r
17 m_head_block_size = 0;
\r
20 m_head ->m_item[m_head_block_size] = item;
\r
21 m_head_block_size++;
\r
24 /*********************************************************************/
\r
26 ListType LinkedBlockList::next()
\r
28 ListType toReturn = m_cursor -> m_item[m_cursor_ind];
\r
32 if ( m_cursor == m_head && m_cursor_ind >= m_head_block_size )
\r
34 m_cursor = m_cursor ->m_next;
\r
37 else if ( m_cursor_ind == GCLL_BLOCK_SIZE )
\r
39 m_cursor = m_cursor ->m_next;
\r
45 /*********************************************************************/
\r
47 bool LinkedBlockList::hasNext()
\r
49 if ( m_cursor != 0 ) return (true);
\r
54 /*********************************************************************/
\r
56 LinkedBlockList::~LinkedBlockList()
\r
60 while ( m_head != 0 )
\r
63 m_head = m_head->m_next;
\r
68 /*********************************************************************/
\r