src/misc/vec/vecVec.h File Reference

#include <stdio.h>
Include dependency graph for vecVec.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Vec_Vec_t_

Defines

#define Vec_VecForEachLevel(vGlob, vVec, i)   for ( i = 0; (i < Vec_VecSize(vGlob)) && (((vVec) = (Vec_Ptr_t*)Vec_VecEntry(vGlob, i)), 1); i++ )
#define Vec_VecForEachLevelStart(vGlob, vVec, i, LevelStart)   for ( i = LevelStart; (i < Vec_VecSize(vGlob)) && (((vVec) = (Vec_Ptr_t*)Vec_VecEntry(vGlob, i)), 1); i++ )
#define Vec_VecForEachLevelStartStop(vGlob, vVec, i, LevelStart, LevelStop)   for ( i = LevelStart; (i <= LevelStop) && (((vVec) = (Vec_Ptr_t*)Vec_VecEntry(vGlob, i)), 1); i++ )
#define Vec_VecForEachLevelReverse(vGlob, vVec, i)   for ( i = Vec_VecSize(vGlob) - 1; (i >= 0) && (((vVec) = (Vec_Ptr_t*)Vec_VecEntry(vGlob, i)), 1); i-- )
#define Vec_VecForEachLevelReverseStartStop(vGlob, vVec, i, LevelStart, LevelStop)   for ( i = LevelStart; (i >= LevelStop) && (((vVec) = (Vec_Ptr_t*)Vec_VecEntry(vGlob, i)), 1); i-- )
#define Vec_VecForEachEntry(vGlob, pEntry, i, k)
#define Vec_VecForEachEntryLevel(vGlob, pEntry, i, Level)   Vec_PtrForEachEntry( Vec_VecEntry(vGlob, Level), pEntry, i )
#define Vec_VecForEachEntryStart(vGlob, pEntry, i, k, LevelStart)
#define Vec_VecForEachEntryStartStop(vGlob, pEntry, i, k, LevelStart, LevelStop)
#define Vec_VecForEachEntryReverse(vGlob, pEntry, i, k)
#define Vec_VecForEachEntryReverseReverse(vGlob, pEntry, i, k)
#define Vec_VecForEachEntryReverseStart(vGlob, pEntry, i, k, LevelStart)

Typedefs

typedef struct Vec_Vec_t_ Vec_Vec_t

Functions

static Vec_Vec_tVec_VecAlloc (int nCap)
static Vec_Vec_tVec_VecStart (int nSize)
static void Vec_VecExpand (Vec_Vec_t *p, int Level)
static int Vec_VecSize (Vec_Vec_t *p)
static void * Vec_VecEntry (Vec_Vec_t *p, int i)
static void Vec_VecFree (Vec_Vec_t *p)
static int Vec_VecSizeSize (Vec_Vec_t *p)
static void Vec_VecClear (Vec_Vec_t *p)
static void Vec_VecPush (Vec_Vec_t *p, int Level, void *Entry)
static void Vec_VecPushUnique (Vec_Vec_t *p, int Level, void *Entry)
static int Vec_VecSortCompare1 (Vec_Ptr_t **pp1, Vec_Ptr_t **pp2)
static int Vec_VecSortCompare2 (Vec_Ptr_t **pp1, Vec_Ptr_t **pp2)
static void Vec_VecSort (Vec_Vec_t *p, int fReverse)

Define Documentation

#define Vec_VecForEachEntry ( vGlob,
pEntry,
i,
 ) 
Value:
for ( i = 0; i < Vec_VecSize(vGlob); i++ )                                                \
        Vec_PtrForEachEntry( Vec_VecEntry(vGlob, i), pEntry, k )

Definition at line 63 of file vecVec.h.

#define Vec_VecForEachEntryLevel ( vGlob,
pEntry,
i,
Level   )     Vec_PtrForEachEntry( Vec_VecEntry(vGlob, Level), pEntry, i )

Definition at line 66 of file vecVec.h.

#define Vec_VecForEachEntryReverse ( vGlob,
pEntry,
i,
 ) 
Value:
for ( i = 0; i < Vec_VecSize(vGlob); i++ )                                                \
        Vec_PtrForEachEntryReverse( Vec_VecEntry(vGlob, i), pEntry, k )

Definition at line 74 of file vecVec.h.

#define Vec_VecForEachEntryReverseReverse ( vGlob,
pEntry,
i,
 ) 
Value:
for ( i = Vec_VecSize(vGlob) - 1; i >= 0; i-- )                                           \
        Vec_PtrForEachEntryReverse( Vec_VecEntry(vGlob, i), pEntry, k )

Definition at line 77 of file vecVec.h.

#define Vec_VecForEachEntryReverseStart ( vGlob,
pEntry,
i,
k,
LevelStart   ) 
Value:
for ( i = LevelStart; i >= 0; i-- )                                                       \
        Vec_PtrForEachEntry( Vec_VecEntry(vGlob, i), pEntry, k )

Definition at line 80 of file vecVec.h.

#define Vec_VecForEachEntryStart ( vGlob,
pEntry,
i,
k,
LevelStart   ) 
Value:
for ( i = LevelStart; i < Vec_VecSize(vGlob); i++ )                                       \
        Vec_PtrForEachEntry( Vec_VecEntry(vGlob, i), pEntry, k )

Definition at line 68 of file vecVec.h.

#define Vec_VecForEachEntryStartStop ( vGlob,
pEntry,
i,
k,
LevelStart,
LevelStop   ) 
Value:
for ( i = LevelStart; i <= LevelStop; i++ )                                               \
        Vec_PtrForEachEntry( Vec_VecEntry(vGlob, i), pEntry, k )

Definition at line 71 of file vecVec.h.

#define Vec_VecForEachLevel ( vGlob,
vVec,
 )     for ( i = 0; (i < Vec_VecSize(vGlob)) && (((vVec) = (Vec_Ptr_t*)Vec_VecEntry(vGlob, i)), 1); i++ )

MACRO DEFINITIONS ///

Definition at line 51 of file vecVec.h.

#define Vec_VecForEachLevelReverse ( vGlob,
vVec,
 )     for ( i = Vec_VecSize(vGlob) - 1; (i >= 0) && (((vVec) = (Vec_Ptr_t*)Vec_VecEntry(vGlob, i)), 1); i-- )

Definition at line 57 of file vecVec.h.

#define Vec_VecForEachLevelReverseStartStop ( vGlob,
vVec,
i,
LevelStart,
LevelStop   )     for ( i = LevelStart; (i >= LevelStop) && (((vVec) = (Vec_Ptr_t*)Vec_VecEntry(vGlob, i)), 1); i-- )

Definition at line 59 of file vecVec.h.

#define Vec_VecForEachLevelStart ( vGlob,
vVec,
i,
LevelStart   )     for ( i = LevelStart; (i < Vec_VecSize(vGlob)) && (((vVec) = (Vec_Ptr_t*)Vec_VecEntry(vGlob, i)), 1); i++ )

Definition at line 53 of file vecVec.h.

#define Vec_VecForEachLevelStartStop ( vGlob,
vVec,
i,
LevelStart,
LevelStop   )     for ( i = LevelStart; (i <= LevelStop) && (((vVec) = (Vec_Ptr_t*)Vec_VecEntry(vGlob, i)), 1); i++ )

Definition at line 55 of file vecVec.h.


Typedef Documentation

typedef struct Vec_Vec_t_ Vec_Vec_t

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

FileName [vecVec.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Resizable arrays.]

Synopsis [Resizable vector of resizable vectors.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

] INCLUDES /// PARAMETERS /// BASIC TYPES ///

Definition at line 38 of file vecVec.h.


Function Documentation

static Vec_Vec_t* Vec_VecAlloc ( int  nCap  )  [inline, static]

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

Synopsis [Allocates a vector with the given capacity.]

Description []

SideEffects []

SeeAlso []

Definition at line 99 of file vecVec.h.

00100 {
00101     Vec_Vec_t * p;
00102     p = ALLOC( Vec_Vec_t, 1 );
00103     if ( nCap > 0 && nCap < 8 )
00104         nCap = 8;
00105     p->nSize  = 0;
00106     p->nCap   = nCap;
00107     p->pArray = p->nCap? ALLOC( void *, p->nCap ) : NULL;
00108     return p;
00109 }

static void Vec_VecClear ( Vec_Vec_t p  )  [inline, static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 239 of file vecVec.h.

00240 {
00241     Vec_Ptr_t * vVec;
00242     int i;
00243     Vec_VecForEachLevel( p, vVec, i )
00244         Vec_PtrClear( vVec );
00245 }

static void* Vec_VecEntry ( Vec_Vec_t p,
int  i 
) [inline, static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 182 of file vecVec.h.

00183 {
00184     assert( i >= 0 && i < p->nSize );
00185     return p->pArray[i];
00186 }

static void Vec_VecExpand ( Vec_Vec_t p,
int  Level 
) [inline, static]

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

Synopsis [Allocates a vector with the given capacity.]

Description []

SideEffects []

SeeAlso []

Definition at line 144 of file vecVec.h.

00145 {
00146     int i;
00147     if ( p->nSize >= Level + 1 )
00148         return;
00149     Vec_PtrGrow( (Vec_Ptr_t *)p, Level + 1 );
00150     for ( i = p->nSize; i <= Level; i++ )
00151         p->pArray[i] = Vec_PtrAlloc( 0 );
00152     p->nSize = Level + 1;
00153 }

static void Vec_VecFree ( Vec_Vec_t p  )  [inline, static]

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

Synopsis [Frees the vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 199 of file vecVec.h.

00200 {
00201     Vec_Ptr_t * vVec;
00202     int i;
00203     Vec_VecForEachLevel( p, vVec, i )
00204         Vec_PtrFree( vVec );
00205     Vec_PtrFree( (Vec_Ptr_t *)p );
00206 }

static void Vec_VecPush ( Vec_Vec_t p,
int  Level,
void *  Entry 
) [inline, static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 258 of file vecVec.h.

00259 {
00260     if ( p->nSize < Level + 1 )
00261     {
00262         int i;
00263         Vec_PtrGrow( (Vec_Ptr_t *)p, Level + 1 );
00264         for ( i = p->nSize; i < Level + 1; i++ )
00265             p->pArray[i] = Vec_PtrAlloc( 0 );
00266         p->nSize = Level + 1;
00267     }
00268     Vec_PtrPush( (Vec_Ptr_t*)p->pArray[Level], Entry );
00269 }

static void Vec_VecPushUnique ( Vec_Vec_t p,
int  Level,
void *  Entry 
) [inline, static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 282 of file vecVec.h.

00283 {
00284     if ( p->nSize < Level + 1 )
00285         Vec_VecPush( p, Level, Entry );
00286     else
00287         Vec_PtrPushUnique( (Vec_Ptr_t*)p->pArray[Level], Entry );
00288 }

static int Vec_VecSize ( Vec_Vec_t p  )  [inline, static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 166 of file vecVec.h.

00167 {
00168     return p->nSize;
00169 }

static int Vec_VecSizeSize ( Vec_Vec_t p  )  [inline, static]

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

Synopsis [Frees the vector of vectors.]

Description []

SideEffects []

SeeAlso []

Definition at line 219 of file vecVec.h.

00220 {
00221     Vec_Ptr_t * vVec;
00222     int i, Counter = 0;
00223     Vec_VecForEachLevel( p, vVec, i )
00224         Counter += vVec->nSize;
00225     return Counter;
00226 }

static void Vec_VecSort ( Vec_Vec_t p,
int  fReverse 
) [inline, static]

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

Synopsis [Sorting the entries by their integer value.]

Description []

SideEffects []

SeeAlso []

Definition at line 341 of file vecVec.h.

00342 {
00343     if ( fReverse ) 
00344         qsort( (void *)p->pArray, p->nSize, sizeof(void *), 
00345                 (int (*)(const void *, const void *)) Vec_VecSortCompare2 );
00346     else
00347         qsort( (void *)p->pArray, p->nSize, sizeof(void *), 
00348                 (int (*)(const void *, const void *)) Vec_VecSortCompare1 );
00349 }

static int Vec_VecSortCompare1 ( Vec_Ptr_t **  pp1,
Vec_Ptr_t **  pp2 
) [inline, static]

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

Synopsis [Comparison procedure for two arrays.]

Description []

SideEffects []

SeeAlso []

Definition at line 301 of file vecVec.h.

00302 {
00303     if ( Vec_PtrSize(*pp1) < Vec_PtrSize(*pp2) )
00304         return -1;
00305     if ( Vec_PtrSize(*pp1) > Vec_PtrSize(*pp2) ) 
00306         return 1;
00307     return 0; 
00308 }

static int Vec_VecSortCompare2 ( Vec_Ptr_t **  pp1,
Vec_Ptr_t **  pp2 
) [inline, static]

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

Synopsis [Comparison procedure for two integers.]

Description []

SideEffects []

SeeAlso []

Definition at line 321 of file vecVec.h.

00322 {
00323     if ( Vec_PtrSize(*pp1) > Vec_PtrSize(*pp2) )
00324         return -1;
00325     if ( Vec_PtrSize(*pp1) < Vec_PtrSize(*pp2) ) 
00326         return 1;
00327     return 0; 
00328 }

static Vec_Vec_t* Vec_VecStart ( int  nSize  )  [inline, static]

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

Synopsis [Allocates a vector with the given capacity.]

Description []

SideEffects []

SeeAlso []

Definition at line 122 of file vecVec.h.

00123 {
00124     Vec_Vec_t * p;
00125     int i;
00126     p = Vec_VecAlloc( nSize );
00127     for ( i = 0; i < nSize; i++ )
00128         p->pArray[i] = Vec_PtrAlloc( 0 );
00129     p->nSize = nSize;
00130     return p;
00131 }


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