abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
msatClauseVec.c File Reference
#include "msatInt.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Msat_ClauseVec_t
Msat_ClauseVecAlloc (int nCap)
 DECLARATIONS ///. More...
 
void Msat_ClauseVecFree (Msat_ClauseVec_t *p)
 
Msat_Clause_t ** Msat_ClauseVecReadArray (Msat_ClauseVec_t *p)
 
int Msat_ClauseVecReadSize (Msat_ClauseVec_t *p)
 
void Msat_ClauseVecGrow (Msat_ClauseVec_t *p, int nCapMin)
 
void Msat_ClauseVecShrink (Msat_ClauseVec_t *p, int nSizeNew)
 
void Msat_ClauseVecClear (Msat_ClauseVec_t *p)
 
void Msat_ClauseVecPush (Msat_ClauseVec_t *p, Msat_Clause_t *Entry)
 
Msat_Clause_tMsat_ClauseVecPop (Msat_ClauseVec_t *p)
 
void Msat_ClauseVecWriteEntry (Msat_ClauseVec_t *p, int i, Msat_Clause_t *Entry)
 
Msat_Clause_tMsat_ClauseVecReadEntry (Msat_ClauseVec_t *p, int i)
 

Function Documentation

ABC_NAMESPACE_IMPL_START Msat_ClauseVec_t* Msat_ClauseVecAlloc ( int  nCap)

DECLARATIONS ///.

CFile****************************************************************

FileName [msatClauseVec.c]

PackageName [A C version of SAT solver MINISAT, originally developed in C++ by Niklas Een and Niklas Sorensson, Chalmers University of Technology, Sweden: http://www.cs.chalmers.se/~een/Satzoo.]

Synopsis [Procedures working with arrays of SAT clauses.]

Author [Alan Mishchenko alanm.nosp@m.i@ee.nosp@m.cs.be.nosp@m.rkel.nosp@m.ey.ed.nosp@m.u]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - January 1, 2004.]

Revision [

Id:
msatClauseVec.c,v 1.0 2004/01/01 1:00:00 alanmi Exp

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

Synopsis [Allocates a vector with the given capacity.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file msatClauseVec.c.

46 {
48  p = ABC_ALLOC( Msat_ClauseVec_t, 1 );
49  if ( nCap > 0 && nCap < 16 )
50  nCap = 16;
51  p->nSize = 0;
52  p->nCap = nCap;
53  p->pArray = p->nCap? ABC_ALLOC( Msat_Clause_t *, p->nCap ) : NULL;
54  return p;
55 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
typedefABC_NAMESPACE_HEADER_START struct Msat_Clause_t_ Msat_Clause_t
INCLUDES ///.
Definition: msatInt.h:57
Msat_Clause_t ** pArray
Definition: msatInt.h:157
void Msat_ClauseVecClear ( Msat_ClauseVec_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 153 of file msatClauseVec.c.

154 {
155  p->nSize = 0;
156 }
void Msat_ClauseVecFree ( Msat_ClauseVec_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 68 of file msatClauseVec.c.

69 {
70  ABC_FREE( p->pArray );
71  ABC_FREE( p );
72 }
#define ABC_FREE(obj)
Definition: abc_global.h:232
Msat_Clause_t ** pArray
Definition: msatInt.h:157
void Msat_ClauseVecGrow ( Msat_ClauseVec_t p,
int  nCapMin 
)

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

Synopsis [Resizes the vector to the given capacity.]

Description []

SideEffects []

SeeAlso []

Definition at line 117 of file msatClauseVec.c.

118 {
119  if ( p->nCap >= nCapMin )
120  return;
121  p->pArray = ABC_REALLOC( Msat_Clause_t *, p->pArray, nCapMin );
122  p->nCap = nCapMin;
123 }
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
typedefABC_NAMESPACE_HEADER_START struct Msat_Clause_t_ Msat_Clause_t
INCLUDES ///.
Definition: msatInt.h:57
Msat_Clause_t ** pArray
Definition: msatInt.h:157
Msat_Clause_t* Msat_ClauseVecPop ( Msat_ClauseVec_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 192 of file msatClauseVec.c.

193 {
194  return p->pArray[--p->nSize];
195 }
Msat_Clause_t ** pArray
Definition: msatInt.h:157
void Msat_ClauseVecPush ( Msat_ClauseVec_t p,
Msat_Clause_t Entry 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 169 of file msatClauseVec.c.

170 {
171  if ( p->nSize == p->nCap )
172  {
173  if ( p->nCap < 16 )
174  Msat_ClauseVecGrow( p, 16 );
175  else
176  Msat_ClauseVecGrow( p, 2 * p->nCap );
177  }
178  p->pArray[p->nSize++] = Entry;
179 }
void Msat_ClauseVecGrow(Msat_ClauseVec_t *p, int nCapMin)
Msat_Clause_t ** pArray
Definition: msatInt.h:157
Msat_Clause_t** Msat_ClauseVecReadArray ( Msat_ClauseVec_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 85 of file msatClauseVec.c.

86 {
87  return p->pArray;
88 }
Msat_Clause_t ** pArray
Definition: msatInt.h:157
Msat_Clause_t* Msat_ClauseVecReadEntry ( Msat_ClauseVec_t p,
int  i 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 225 of file msatClauseVec.c.

226 {
227  assert( i >= 0 && i < p->nSize );
228  return p->pArray[i];
229 }
Msat_Clause_t ** pArray
Definition: msatInt.h:157
#define assert(ex)
Definition: util_old.h:213
int Msat_ClauseVecReadSize ( Msat_ClauseVec_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 101 of file msatClauseVec.c.

102 {
103  return p->nSize;
104 }
void Msat_ClauseVecShrink ( Msat_ClauseVec_t p,
int  nSizeNew 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 136 of file msatClauseVec.c.

137 {
138  assert( p->nSize >= nSizeNew );
139  p->nSize = nSizeNew;
140 }
#define assert(ex)
Definition: util_old.h:213
void Msat_ClauseVecWriteEntry ( Msat_ClauseVec_t p,
int  i,
Msat_Clause_t Entry 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 208 of file msatClauseVec.c.

209 {
210  assert( i >= 0 && i < p->nSize );
211  p->pArray[i] = Entry;
212 }
Msat_Clause_t ** pArray
Definition: msatInt.h:157
#define assert(ex)
Definition: util_old.h:213