src/sat/msat/msatQueue.c File Reference

#include "msatInt.h"
Include dependency graph for msatQueue.c:

Go to the source code of this file.

Data Structures

struct  Msat_Queue_t_

Functions

Msat_Queue_tMsat_QueueAlloc (int nVars)
void Msat_QueueFree (Msat_Queue_t *p)
int Msat_QueueReadSize (Msat_Queue_t *p)
void Msat_QueueInsert (Msat_Queue_t *p, int Lit)
int Msat_QueueExtract (Msat_Queue_t *p)
void Msat_QueueClear (Msat_Queue_t *p)

Function Documentation

Msat_Queue_t* Msat_QueueAlloc ( int  nVars  ) 

FUNCTION DEFINITIONS ///Function*************************************************************

Synopsis [Allocates the variable propagation queue.]

Description []

SideEffects []

SeeAlso []

Definition at line 50 of file msatQueue.c.

00051 {
00052     Msat_Queue_t * p;
00053     p = ALLOC( Msat_Queue_t, 1 );
00054     memset( p, 0, sizeof(Msat_Queue_t) );
00055     p->nVars  = nVars;
00056     p->pVars  = ALLOC( int, nVars );
00057     return p;
00058 }

void Msat_QueueClear ( Msat_Queue_t p  ) 

Function*************************************************************

Synopsis [Resets the queue.]

Description []

SideEffects []

SeeAlso []

Definition at line 146 of file msatQueue.c.

00147 {
00148     p->iFirst = 0;
00149     p->iLast  = 0;
00150 }

int Msat_QueueExtract ( Msat_Queue_t p  ) 

Function*************************************************************

Synopsis [Extracts an entry from the queue.]

Description []

SideEffects []

SeeAlso []

Definition at line 128 of file msatQueue.c.

00129 {
00130     if ( p->iFirst == p->iLast )
00131         return -1;
00132     return p->pVars[p->iFirst++];
00133 }

void Msat_QueueFree ( Msat_Queue_t p  ) 

Function*************************************************************

Synopsis [Deallocate the variable propagation queue.]

Description []

SideEffects []

SeeAlso []

Definition at line 71 of file msatQueue.c.

00072 {
00073     free( p->pVars );
00074     free( p );
00075 }

void Msat_QueueInsert ( Msat_Queue_t p,
int  Lit 
)

Function*************************************************************

Synopsis [Insert an entry into the queue.]

Description []

SideEffects []

SeeAlso []

Definition at line 104 of file msatQueue.c.

00105 {
00106     if ( p->iLast == p->nVars )
00107     {
00108         int i;
00109         assert( 0 );
00110         for ( i = 0; i < p->iLast; i++ )
00111             printf( "entry = %2d  lit = %2d  var = %2d \n", i, p->pVars[i], p->pVars[i]/2 );
00112     }
00113     assert( p->iLast < p->nVars );
00114     p->pVars[p->iLast++] = Lit;
00115 }

int Msat_QueueReadSize ( Msat_Queue_t p  ) 

Function*************************************************************

Synopsis [Reads the queue size.]

Description []

SideEffects []

SeeAlso []

Definition at line 88 of file msatQueue.c.

00089 {
00090     return p->iLast - p->iFirst;
00091 }


Generated on Tue Jan 5 12:19:40 2010 for abc70930 by  doxygen 1.6.1