#include "extra.h"
Go to the source code of this file.
Data Structures | |
struct | Attr_ManStruct_t_ |
Typedefs | |
typedef struct Attr_ManStruct_t_ | Attr_Man_t |
Functions | |
static Attr_Man_t * | Attr_ManAlloc (int nAttrSize, int fManMem) |
static Attr_Man_t * | Attr_ManStartInt (int nAttrs) |
static Attr_Man_t * | Attr_ManStartPtr (int nAttrs) |
static Attr_Man_t * | Attr_ManStartPtrMem (int nAttrs, int nAttrSize) |
static void | Attr_ManStop (Attr_Man_t *p) |
static int | Attr_ManReadAttrInt (Attr_Man_t *p, int Id) |
static void * | Attr_ManReadAttrPtr (Attr_Man_t *p, int Id) |
static void | Attr_ManWriteAttrInt (Attr_Man_t *p, int Id, int Attr) |
static void | Attr_ManWriteAttrPtr (Attr_Man_t *p, int Id, void *pAttr) |
static int * | Attr_ManFetchSpotInt (Attr_Man_t *p, int Id) |
static void ** | Attr_ManFetchSpotPtr (Attr_Man_t *p, int Id) |
static int | Attr_ManFetchAttrInt (Attr_Man_t *p, int Id) |
static void * | Attr_ManFetchAttrPtr (Attr_Man_t *p, int Id) |
static void | Attr_ManSetAttrInt (Attr_Man_t *p, int Id, int Attr) |
static void | Attr_ManSetAttrPtr (Attr_Man_t *p, int Id, void *pAttr) |
typedef struct Attr_ManStruct_t_ Attr_Man_t |
CFile****************************************************************
FileName [attr.h]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Network attributes.]
Synopsis [External declarations.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [
] INCLUDES /// PARAMETERS /// BASIC TYPES ///
static Attr_Man_t* Attr_ManAlloc | ( | int | nAttrSize, | |
int | fManMem | |||
) | [inline, static] |
MACRO DEFINITIONS /// FUNCTION DECLARATIONS ///Function*************************************************************
Synopsis [Allocates the attribute manager.]
Description [The manager is simple if it does not need memory manager.]
SideEffects []
SeeAlso []
Definition at line 81 of file attr.h.
00082 { 00083 Attr_Man_t * p; 00084 p = ALLOC( Attr_Man_t, 1 ); 00085 memset( p, 0, sizeof(Attr_Man_t) ); 00086 p->nAttrSize = nAttrSize; 00087 if ( fManMem ) 00088 p->pManMem = Extra_MmFixedStart( nAttrSize ); 00089 return p; 00090 }
static int Attr_ManFetchAttrInt | ( | Attr_Man_t * | p, | |
int | Id | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Returns or creates the attribute of the given object.]
Description []
SideEffects []
SeeAlso []
Definition at line 349 of file attr.h.
00350 { 00351 return *Attr_ManFetchSpotInt( p, Id ); 00352 }
static void* Attr_ManFetchAttrPtr | ( | Attr_Man_t * | p, | |
int | Id | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Returns or creates the attribute of the given object.]
Description []
SideEffects []
SeeAlso []
Definition at line 365 of file attr.h.
00366 { 00367 return *Attr_ManFetchSpotPtr( p, Id ); 00368 }
static int* Attr_ManFetchSpotInt | ( | Attr_Man_t * | p, | |
int | Id | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Returns or creates the pointer to the attribute of the given object.]
Description []
SideEffects []
SeeAlso []
Definition at line 286 of file attr.h.
00287 { 00288 assert( p->fUseInt ); 00289 if ( Id >= p->nAttrs ) 00290 { 00291 // save the old size 00292 int i, nAttrsOld = p->nAttrs; 00293 // get the new size 00294 p->nAttrs = p->nAttrs? 2*p->nAttrs : 1024; 00295 p->pAttrs = realloc( p->pAttrs, sizeof(int) * p->nAttrs ); 00296 // fill in the empty spots 00297 for ( i = nAttrsOld; i < p->nAttrs; i++ ) 00298 ((int *)p->pAttrs)[Id] = 0; 00299 } 00300 return ((int *)p->pAttrs) + Id; 00301 }
static void** Attr_ManFetchSpotPtr | ( | Attr_Man_t * | p, | |
int | Id | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Returns or creates the pointer to the attribute of the given object.]
Description []
SideEffects []
SeeAlso []
Definition at line 314 of file attr.h.
00315 { 00316 assert( !p->fUseInt ); 00317 if ( Id >= p->nAttrs ) 00318 { 00319 // save the old size 00320 int i, nAttrsOld = p->nAttrs; 00321 // get the new size 00322 p->nAttrs = p->nAttrs? 2*p->nAttrs : 1024; 00323 p->pAttrs = realloc( p->pAttrs, sizeof(void *) * p->nAttrs ); 00324 // fill in the empty spots 00325 for ( i = nAttrsOld; i < p->nAttrs; i++ ) 00326 p->pAttrs[Id] = NULL; 00327 } 00328 // if memory manager is available but entry is not created, create it 00329 if ( p->pManMem && p->pAttrs[Id] != NULL ) 00330 { 00331 p->pAttrs[Id] = Extra_MmFixedEntryFetch( p->pManMem ); 00332 memset( p->pAttrs[Id], 0, p->nAttrSize ); 00333 } 00334 return p->pAttrs + Id; 00335 }
static int Attr_ManReadAttrInt | ( | Attr_Man_t * | p, | |
int | Id | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Reads the attribute of the given object.]
Description []
SideEffects []
SeeAlso []
static void* Attr_ManReadAttrPtr | ( | Attr_Man_t * | p, | |
int | Id | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Reads the attribute of the given object.]
Description []
SideEffects []
SeeAlso []
static void Attr_ManSetAttrInt | ( | Attr_Man_t * | p, | |
int | Id, | |||
int | Attr | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Sets the attribute of the given object.]
Description []
SideEffects []
SeeAlso []
Definition at line 381 of file attr.h.
00382 { 00383 *Attr_ManFetchSpotInt( p, Id ) = Attr; 00384 }
static void Attr_ManSetAttrPtr | ( | Attr_Man_t * | p, | |
int | Id, | |||
void * | pAttr | |||
) | [inline, static] |
static Attr_Man_t* Attr_ManStartInt | ( | int | nAttrs | ) | [inline, static] |
Function*************************************************************
Synopsis [Start the attribute manager for integers.]
Description []
SideEffects []
SeeAlso []
Definition at line 103 of file attr.h.
00104 { 00105 Attr_Man_t * p; 00106 p = Attr_ManAlloc( sizeof(int), 0 ); 00107 p->nAttrs = nAttrs; 00108 p->pAttrs = (void **)ALLOC( int, nAttrs ); 00109 memset( (int *)p->pAttrs, 0, sizeof(int) * nAttrs ); 00110 p->fUseInt = 1; 00111 return p; 00112 }
static Attr_Man_t* Attr_ManStartPtr | ( | int | nAttrs | ) | [inline, static] |
Function*************************************************************
Synopsis [Start the attribute manager for pointers.]
Description []
SideEffects []
SeeAlso []
Definition at line 125 of file attr.h.
00126 { 00127 Attr_Man_t * p; 00128 p = Attr_ManAlloc( sizeof(void *), 0 ); 00129 p->nAttrs = nAttrs; 00130 p->pAttrs = ALLOC( void *, nAttrs ); 00131 memset( p->pAttrs, 0, sizeof(void *) * nAttrs ); 00132 return p; 00133 }
static Attr_Man_t* Attr_ManStartPtrMem | ( | int | nAttrs, | |
int | nAttrSize | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Start the attribute manager for the fixed entry size.]
Description []
SideEffects []
SeeAlso []
Definition at line 146 of file attr.h.
00147 { 00148 Attr_Man_t * p; 00149 int i; 00150 p = Attr_ManAlloc( nAttrSize, 1 ); 00151 p->nAttrs = nAttrs; 00152 p->pAttrs = ALLOC( void *, nAttrs ); 00153 for ( i = 0; i < p->nAttrs; i++ ) 00154 { 00155 p->pAttrs[i] = Extra_MmFixedEntryFetch( p->pManMem ); 00156 memset( p->pAttrs[i], 0, nAttrSize ); 00157 } 00158 return p; 00159 }
static void Attr_ManStop | ( | Attr_Man_t * | p | ) | [inline, static] |
Function*************************************************************
Synopsis [Stop the attribute manager.]
Description []
SideEffects []
SeeAlso []
Definition at line 172 of file attr.h.
00173 { 00174 // free the attributes of objects 00175 if ( p->pFuncFreeObj ) 00176 { 00177 int i; 00178 if ( p->fUseInt ) 00179 { 00180 for ( i = 0; i < p->nAttrs; i++ ) 00181 if ( ((int *)p->pAttrs)[i] ) 00182 p->pFuncFreeObj( p->pManAttr, (void *)((int *)p->pAttrs)[i] ); 00183 } 00184 else 00185 { 00186 for ( i = 0; i < p->nAttrs; i++ ) 00187 if ( p->pAttrs[i] ) 00188 p->pFuncFreeObj( p->pManAttr, p->pAttrs[i] ); 00189 } 00190 } 00191 // free the attribute manager 00192 if ( p->pManAttr && p->pFuncFreeMan ) 00193 p->pFuncFreeMan( p->pManAttr ); 00194 // free the memory manager 00195 if ( p->pManMem ) 00196 Extra_MmFixedStop( p->pManMem); 00197 // free the attribute manager 00198 FREE( p->pAttrs ); 00199 free( p ); 00200 }
static void Attr_ManWriteAttrInt | ( | Attr_Man_t * | p, | |
int | Id, | |||
int | Attr | |||
) | [inline, static] |
static void Attr_ManWriteAttrPtr | ( | Attr_Man_t * | p, | |
int | Id, | |||
void * | pAttr | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Writes the attribute of the given object.]
Description []
SideEffects []
SeeAlso []