abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
vecAtt.h File Reference
#include <stdio.h>

Go to the source code of this file.

Data Structures

struct  Vec_Att_t_
 

Typedefs

typedef struct Vec_Att_t_ Vec_Att_t
 BASIC TYPES ///. More...
 

Enumerations

enum  Vec_AttrType_t {
  VEC_ATTR_NONE = 0, VEC_ATTR_COPY, VEC_ATTR_LOCAL_AIG, VEC_ATTR_LOCAL_SOP,
  VEC_ATTR_LOCAL_BDD, VEC_ATTR_GLOBAL_AIG, VEC_ATTR_GLOBAL_SOP, VEC_ATTR_GLOBAL_BDD,
  VEC_ATTR_LEVEL, VEC_ATTR_LEVEL_REV, VEC_ATTR_RETIME_LAG, VEC_ATTR_FRAIG,
  VEC_ATTR_MVVAR, VEC_ATTR_DATA1, VEC_ATTR_DATA2, VEC_ATTR_TOTAL_NUM
}
 INCLUDES ///. More...
 

Functions

static Vec_Att_tVec_AttAlloc (int nSize, void *pMan, void(*pFuncFreeMan)(void *), void *(*pFuncStartObj)(void *), void(*pFuncFreeObj)(void *, void *))
 MACRO DEFINITIONS ///. More...
 
static void * Vec_AttFree (Vec_Att_t *p, int fFreeMan)
 
static void Vec_AttClear (Vec_Att_t *p)
 
static void Vec_AttFreeEntry (Vec_Att_t *p, int i)
 
static void Vec_AttGrow (Vec_Att_t *p, int nCapMin)
 
static void Vec_AttWriteEntry (Vec_Att_t *p, int i, void *pEntry)
 
static void * Vec_AttEntry (Vec_Att_t *p, int i)
 
static void * Vec_AttMan (Vec_Att_t *p)
 
static void ** Vec_AttArray (Vec_Att_t *p)
 

Typedef Documentation

typedef struct Vec_Att_t_ Vec_Att_t

BASIC TYPES ///.

Definition at line 62 of file vecAtt.h.

Enumeration Type Documentation

INCLUDES ///.

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

FileName [vecAtt.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Resizable arrays.]

Synopsis [Array of user-specified attiributes.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
vecAtt.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

]PARAMETERS ///

Enumerator
VEC_ATTR_NONE 
VEC_ATTR_COPY 
VEC_ATTR_LOCAL_AIG 
VEC_ATTR_LOCAL_SOP 
VEC_ATTR_LOCAL_BDD 
VEC_ATTR_GLOBAL_AIG 
VEC_ATTR_GLOBAL_SOP 
VEC_ATTR_GLOBAL_BDD 
VEC_ATTR_LEVEL 
VEC_ATTR_LEVEL_REV 
VEC_ATTR_RETIME_LAG 
VEC_ATTR_FRAIG 
VEC_ATTR_MVVAR 
VEC_ATTR_DATA1 
VEC_ATTR_DATA2 
VEC_ATTR_TOTAL_NUM 

Definition at line 39 of file vecAtt.h.

Function Documentation

static Vec_Att_t* Vec_AttAlloc ( int  nSize,
void *  pMan,
void(*)(void *)  pFuncFreeMan,
void *(*)(void *)  pFuncStartObj,
void(*)(void *, void *)  pFuncFreeObj 
)
inlinestatic

MACRO DEFINITIONS ///.

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

Synopsis [Allocates a vector with the given capacity.]

Description []

SideEffects []

SeeAlso []

Definition at line 96 of file vecAtt.h.

101 {
102  Vec_Att_t * p;
103  p = ABC_ALLOC( Vec_Att_t, 1 );
104  memset( p, 0, sizeof(Vec_Att_t) );
105  p->pMan = pMan;
106  p->pFuncFreeMan = pFuncFreeMan;
107  p->pFuncStartObj = pFuncStartObj;
108  p->pFuncFreeObj = pFuncFreeObj;
109  p->nCap = nSize? nSize : 16;
110  p->pArrayPtr = ABC_ALLOC( void *, p->nCap );
111  memset( p->pArrayPtr, 0, sizeof(void *) * p->nCap );
112  return p;
113 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
void * pMan
Definition: vecAtt.h:71
void(* pFuncFreeMan)(void *)
Definition: vecAtt.h:72
void(* pFuncFreeObj)(void *, void *)
Definition: vecAtt.h:74
int nCap
Definition: vecAtt.h:66
void *(* pFuncStartObj)(void *)
Definition: vecAtt.h:73
void ** pArrayPtr
Definition: vecAtt.h:69
static void** Vec_AttArray ( Vec_Att_t p)
inlinestatic

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

Synopsis [Returns the array of attributes.]

Description []

SideEffects []

SeeAlso []

Definition at line 284 of file vecAtt.h.

285 {
286  return p->pArrayPtr;
287 }
void ** pArrayPtr
Definition: vecAtt.h:69
static void Vec_AttClear ( Vec_Att_t p)
inlinestatic

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

Synopsis [Clears the vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 159 of file vecAtt.h.

160 {
161  // free the attributes of objects
162  if ( p->pFuncFreeObj )
163  {
164  int i;
165  if ( p->pFuncFreeObj )
166  for ( i = 0; i < p->nCap; i++ )
167  if ( p->pArrayPtr[i] )
168  p->pFuncFreeObj( p->pMan, p->pArrayPtr[i] );
169  }
170  memset( p->pArrayPtr, 0, sizeof(void *) * p->nCap );
171 }
char * memset()
void * pMan
Definition: vecAtt.h:71
void(* pFuncFreeObj)(void *, void *)
Definition: vecAtt.h:74
int nCap
Definition: vecAtt.h:66
void ** pArrayPtr
Definition: vecAtt.h:69
static void* Vec_AttEntry ( Vec_Att_t p,
int  i 
)
inlinestatic

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

Synopsis [Returns the entry.]

Description []

SideEffects []

SeeAlso []

Definition at line 247 of file vecAtt.h.

248 {
249  assert( p->pArrayPtr );
250  if ( i >= p->nCap )
251  Vec_AttGrow( p, (2 * p->nCap > i)? 2 * p->nCap : i + 10 );
252  if ( p->pArrayPtr[i] == NULL && p->pFuncStartObj )
253  p->pArrayPtr[i] = p->pFuncStartObj( p->pMan );
254  return p->pArrayPtr[i];
255 }
static void Vec_AttGrow(Vec_Att_t *p, int nCapMin)
Definition: vecAtt.h:207
void * pMan
Definition: vecAtt.h:71
int nCap
Definition: vecAtt.h:66
void *(* pFuncStartObj)(void *)
Definition: vecAtt.h:73
void ** pArrayPtr
Definition: vecAtt.h:69
#define assert(ex)
Definition: util_old.h:213
static void* Vec_AttFree ( Vec_Att_t p,
int  fFreeMan 
)
inlinestatic

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

Synopsis [Frees the vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 126 of file vecAtt.h.

127 {
128  void * pMan;
129  if ( p == NULL )
130  return NULL;
131  // free the attributes of objects
132  if ( p->pFuncFreeObj )
133  {
134  int i;
135  for ( i = 0; i < p->nCap; i++ )
136  if ( p->pArrayPtr[i] )
137  p->pFuncFreeObj( p->pMan, p->pArrayPtr[i] );
138  }
139  // free the memory manager
140  pMan = fFreeMan? NULL : p->pMan;
141  if ( p->pMan && fFreeMan )
142  p->pFuncFreeMan( p->pMan );
143  ABC_FREE( p->pArrayPtr );
144  ABC_FREE( p );
145  return pMan;
146 }
void * pMan
Definition: vecAtt.h:71
void(* pFuncFreeMan)(void *)
Definition: vecAtt.h:72
void(* pFuncFreeObj)(void *, void *)
Definition: vecAtt.h:74
int nCap
Definition: vecAtt.h:66
void ** pArrayPtr
Definition: vecAtt.h:69
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_AttFreeEntry ( Vec_Att_t p,
int  i 
)
inlinestatic

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

Synopsis [Deletes one entry from the attribute manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 184 of file vecAtt.h.

185 {
186  if ( i >= p->nCap )
187  return;
188  if ( p->pMan )
189  {
190  if ( p->pArrayPtr[i] && p->pFuncFreeObj )
191  p->pFuncFreeObj( p->pMan, (void *)p->pArrayPtr[i] );
192  }
193  p->pArrayPtr[i] = NULL;
194 }
void * pMan
Definition: vecAtt.h:71
void(* pFuncFreeObj)(void *, void *)
Definition: vecAtt.h:74
int nCap
Definition: vecAtt.h:66
void ** pArrayPtr
Definition: vecAtt.h:69
static void Vec_AttGrow ( Vec_Att_t p,
int  nCapMin 
)
inlinestatic

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

Synopsis [Resizes the vector to the given capacity.]

Description []

SideEffects []

SeeAlso []

Definition at line 207 of file vecAtt.h.

208 {
209  if ( p->nCap >= nCapMin )
210  return;
211  p->pArrayPtr = ABC_REALLOC( void *, p->pArrayPtr, nCapMin );
212  memset( p->pArrayPtr + p->nCap, 0, sizeof(void *) * (nCapMin - p->nCap) );
213  p->nCap = nCapMin;
214 }
char * memset()
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
int nCap
Definition: vecAtt.h:66
void ** pArrayPtr
Definition: vecAtt.h:69
static void* Vec_AttMan ( Vec_Att_t p)
inlinestatic

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

Synopsis [Returns the entry.]

Description []

SideEffects []

SeeAlso []

Definition at line 268 of file vecAtt.h.

269 {
270  return p->pMan;
271 }
void * pMan
Definition: vecAtt.h:71
static void Vec_AttWriteEntry ( Vec_Att_t p,
int  i,
void *  pEntry 
)
inlinestatic

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

Synopsis [Writes the entry into its place.]

Description [Only works if the manager is not defined.]

SideEffects []

SeeAlso []

Definition at line 227 of file vecAtt.h.

228 {
229  assert( p->pArrayPtr );
230  assert( p->pFuncStartObj == NULL );
231  if ( i >= p->nCap )
232  Vec_AttGrow( p, (2 * p->nCap > i)? 2 * p->nCap : i + 10 );
233  p->pArrayPtr[i] = pEntry;
234 }
static void Vec_AttGrow(Vec_Att_t *p, int nCapMin)
Definition: vecAtt.h:207
int nCap
Definition: vecAtt.h:66
void *(* pFuncStartObj)(void *)
Definition: vecAtt.h:73
void ** pArrayPtr
Definition: vecAtt.h:69
#define assert(ex)
Definition: util_old.h:213