cudd
3.0.0
The University of Colorado Decision Diagram Package
|
Procedure to manage level queues. More...
Macros | |
#define | lqHash(key, shift) (((unsigned)(ptruint)(key) * DD_P1) >> (shift)) |
Hash function for the table of a level queue. More... | |
Functions | |
DdLevelQueue * | cuddLevelQueueInit (int levels, int itemSize, int numBuckets, DdManager *manager) |
Initializes a level queue. More... | |
void | cuddLevelQueueQuit (DdLevelQueue *queue) |
Shuts down a level queue. More... | |
void * | cuddLevelQueueEnqueue (DdLevelQueue *queue, void *key, int level) |
Inserts a new key in a level queue. More... | |
void * | cuddLevelQueueFirst (DdLevelQueue *queue, void *key, int level) |
Inserts the first key in a level queue. More... | |
void | cuddLevelQueueDequeue (DdLevelQueue *queue, int level) |
Remove an item from the front of a level queue. More... | |
static DdQueueItem * | hashLookup (DdLevelQueue *queue, void *key) |
Looks up a key in the hash table of a level queue. More... | |
static int | hashInsert (DdLevelQueue *queue, DdQueueItem *item) |
Inserts an item in the hash table of a level queue. More... | |
static void | hashDelete (DdLevelQueue *queue, DdQueueItem *item) |
Removes an item from the hash table of a level queue. More... | |
static int | hashResize (DdLevelQueue *queue) |
Resizes the hash table of a level queue. More... | |
Procedure to manage level queues.
The functions in this file allow an application to easily manipulate a queue where nodes are prioritized by level. The emphasis is on efficiency. Therefore, the queue items can have variable size. If the application does not need to attach information to the nodes, it can declare the queue items to be of type DdQueueItem. Otherwise, it can declare them to be of a structure type such that the first three fields are data pointers. The third pointer points to the node. The first two pointers are used by the level queue functions. The remaining fields are initialized to 0 when a new item is created, and are then left to the exclusive use of the application. On the DEC Alphas the three pointers must be 32-bit pointers when CUDD is compiled with 32-bit pointers. The level queue functions make sure that each node appears at most once in the queue. They do so by keeping a hash table where the node is used as key. Queue items are recycled via a free list for efficiency.
Copyright (c) 1995-2015, Regents of the University of Colorado
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the University of Colorado nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define lqHash | ( | key, | |
shift | |||
) | (((unsigned)(ptruint)(key) * DD_P1) >> (shift)) |
Hash function for the table of a level queue.
void cuddLevelQueueDequeue | ( | DdLevelQueue * | queue, |
int | level | ||
) |
void* cuddLevelQueueEnqueue | ( | DdLevelQueue * | queue, |
void * | key, | ||
int | level | ||
) |
Inserts a new key in a level queue.
A new entry is created in the queue only if the node is not already enqueued.
queue | level queue |
key | key to be enqueued |
level | level at which to insert |
void* cuddLevelQueueFirst | ( | DdLevelQueue * | queue, |
void * | key, | ||
int | level | ||
) |
Inserts the first key in a level queue.
queue | level queue |
key | key to be enqueued |
level | level at which to insert |
DdLevelQueue* cuddLevelQueueInit | ( | int | levels, |
int | itemSize, | ||
int | numBuckets, | ||
DdManager * | manager | ||
) |
Initializes a level queue.
A level queue is a queue where inserts are based on the levels of the nodes. Within each level the policy is FIFO. Level queues are useful in traversing a BDD top-down. Queue items are kept in a free list when dequeued for efficiency.
levels | number of levels |
itemSize | size of the item |
numBuckets | initial number of hash buckets |
void cuddLevelQueueQuit | ( | DdLevelQueue * | queue | ) |
Shuts down a level queue.
Releases all the associated memory.
|
static |
Removes an item from the hash table of a level queue.
Nothing is done if the item is not in the table.
|
static |
Inserts an item in the hash table of a level queue.
No check is performed to see if an item with the same key is already in the hash table.
|
static |
Looks up a key in the hash table of a level queue.
|
static |
Resizes the hash table of a level queue.