include/memSingleBlock.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  memSingleBlock

Functions

memSingleBlockmemSingleBlock_initialize (size_t entrySize, int4 blockSize)
void memSingleBlock_initializeExisting (struct memSingleBlock *memSingleBlock, size_t entrySize, int4 blockSize)
void * memSingleBlock_newEntry (struct memSingleBlock *memSingleBlock)
void memSingleBlock_resetCurrent (struct memSingleBlock *memSingleBlock)
void * memSingleBlock_getCurrent (struct memSingleBlock *memSingleBlock)
void * memSingleBlock_getEntry (struct memSingleBlock *memSingleBlock, int4 position)
void * memSingleBlock_getLastEntry (struct memSingleBlock *memSingleBlock)
void memSingleBlock_free (struct memSingleBlock *memSingleBlock)


Function Documentation

void memSingleBlock_free ( struct memSingleBlock memSingleBlock  ) 

Definition at line 138 of file memSingleBlock.c.

References memSingleBlock::block.

Referenced by alignments_free(), cluster_clusterSequences(), cluster_simpleClusterSequences(), cluster_spexClusterSequences(), rsdb_spexClusterSequences(), wordLookupDFA_build(), and wordLookupDFA_calcFrequencyGroups().

00139 {
00140         // Free the memory block then struct itself
00141     free(memSingleBlock->block);
00142     free(memSingleBlock);
00143 }

Here is the caller graph for this function:

void* memSingleBlock_getCurrent ( struct memSingleBlock memSingleBlock  )  [inline]

Definition at line 104 of file memSingleBlock.c.

References memSingleBlock::block, memSingleBlock::currentEntry, memSingleBlock::entrySize, and memSingleBlock::numEntries.

Referenced by alignments_findFinalAlignments(), alignments_free(), alignments_getFinalAlignmentDescriptions(), alignments_getTracebacks(), cluster_clusterSequences(), cluster_processList(), cluster_processSequenceMatches(), cluster_spexClusterSequences(), main(), qPosList_processList(), rsdb_spexClusterSequences(), and rsdb_updateDiagonalMatches().

00105 {
00106         void* entry;
00107 
00108     // If we have reached the last entry return NULL
00109     if (memSingleBlock->currentEntry >= memSingleBlock->numEntries)
00110     {
00111         return NULL;
00112     }
00113         else
00114     {
00115         entry = ((char*)(memSingleBlock->block)) +
00116                          memSingleBlock->currentEntry * memSingleBlock->entrySize;
00117                 memSingleBlock->currentEntry++;
00118         return entry;
00119     }
00120 }

Here is the caller graph for this function:

void* memSingleBlock_getEntry ( struct memSingleBlock memSingleBlock,
int4  position 
) [inline]

Definition at line 123 of file memSingleBlock.c.

References memSingleBlock::block, and memSingleBlock::entrySize.

Referenced by alignments_findFinalAlignments(), alignments_findTopFinalAlignments(), alignments_getTracebacks(), alignments_isFinalAlignment(), alignments_loadSubjectsIntoMemory(), alignments_printFinalAlignments(), alignments_printGoodAlignments(), print_gappedAlignmentsBrief(), print_gappedAlignmentsFull(), and wordLookupDFA_build().

00124 {
00125         void* entry;
00126         entry = ((char*)(memSingleBlock->block)) + position * memSingleBlock->entrySize;
00127         return entry;
00128 }

Here is the caller graph for this function:

void* memSingleBlock_getLastEntry ( struct memSingleBlock memSingleBlock  )  [inline]

Definition at line 131 of file memSingleBlock.c.

References memSingleBlock::block, memSingleBlock::entrySize, and memSingleBlock::numEntries.

Referenced by alignments_getTracebacks(), and qPosList_processList().

00132 {
00133         return ((char*)(memSingleBlock->block)) +
00134             (memSingleBlock->numEntries - 1) * memSingleBlock->entrySize;
00135 }

Here is the caller graph for this function:

struct memSingleBlock* memSingleBlock_initialize ( size_t  entrySize,
int4  blockSize 
) [read]

Definition at line 20 of file memSingleBlock.c.

References global_malloc().

Referenced by alignments_initialize(), cluster_clusterSequences(), cluster_simpleClusterSequences(), cluster_spexClusterSequences(), main(), rsdb_spexClusterSequences(), and wordLookupDFA_build().

00021 {
00022         struct memSingleBlock* memSingleBlock;
00023 
00024     // Declare memory for first block
00025     memSingleBlock = (struct memSingleBlock*)global_malloc(sizeof(struct memSingleBlock));
00026 
00027     if (memSingleBlock == NULL)
00028     {
00029                 fprintf(stderr, "Error allocating memory\n");
00030                 exit(-1);
00031     }
00032 
00033     memSingleBlock->blockSize = blockSize;
00034     memSingleBlock->entrySize = entrySize;
00035         memSingleBlock->numEntries = 0;
00036 
00037     // Declare memory for the block
00038     memSingleBlock->block = (void*)global_malloc(memSingleBlock->entrySize * memSingleBlock->blockSize);
00039 
00040     if (memSingleBlock->block == NULL)
00041     {
00042                 fprintf(stderr, "Error allocating memory\n");
00043                 exit(-1);
00044     }
00045 
00046     return memSingleBlock;
00047 }

Here is the call graph for this function:

Here is the caller graph for this function:

void memSingleBlock_initializeExisting ( struct memSingleBlock memSingleBlock,
size_t  entrySize,
int4  blockSize 
)

Definition at line 51 of file memSingleBlock.c.

References memSingleBlock::block, memSingleBlock::blockSize, memSingleBlock::entrySize, global_malloc(), and memSingleBlock::numEntries.

Referenced by cluster_clusterSequences(), cluster_spexClusterSequences(), qPosList_initialize(), and rsdb_spexClusterSequences().

00053 {
00054     memSingleBlock->blockSize = blockSize;
00055     memSingleBlock->entrySize = entrySize;
00056         memSingleBlock->numEntries = 0;
00057 
00058     // Declare memory for the block
00059     memSingleBlock->block = (void*)global_malloc(memSingleBlock->entrySize * memSingleBlock->blockSize);
00060 
00061     if (memSingleBlock->block == NULL)
00062     {
00063                 fprintf(stderr, "Error allocating memory\n");
00064                 exit(-1);
00065     }
00066 }

Here is the call graph for this function:

Here is the caller graph for this function:

void* memSingleBlock_newEntry ( struct memSingleBlock memSingleBlock  )  [inline]

Definition at line 69 of file memSingleBlock.c.

References memSingleBlock::block, memSingleBlock::blockSize, memSingleBlock::entrySize, global_realloc(), and memSingleBlock::numEntries.

Referenced by alignments_addFinalAlignment(), alignments_addGoodAlignment(), cluster_clusterSequences(), cluster_processList(), cluster_simpleClusterSequences(), cluster_spexClusterSequences(), encoding_replaceWildcards(), qPosList_processList(), rsdb_updateDiagonalMatches(), and wordLookupDFA_build().

00070 {
00071         void* newEntry;
00072 
00073         // Check if we need to increase the block size
00074         if (memSingleBlock->numEntries >= memSingleBlock->blockSize)
00075         {
00076         // Increase the size
00077         memSingleBlock->blockSize *= 2;
00078 
00079         memSingleBlock->block = (void*)global_realloc(memSingleBlock->block,
00080                                  memSingleBlock->entrySize * memSingleBlock->blockSize);
00081 
00082         if (memSingleBlock->block == NULL)
00083         {
00084             fprintf(stderr, "Error allocating memory\n");
00085             exit(-1);
00086         }
00087     }
00088 
00089     // Use the next available slot in the latest block
00090     newEntry = ((char*)(memSingleBlock->block)) + memSingleBlock->numEntries * memSingleBlock->entrySize;
00091 
00092     memSingleBlock->numEntries++;
00093 
00094     return newEntry;
00095 }

Here is the call graph for this function:

Here is the caller graph for this function:

void memSingleBlock_resetCurrent ( struct memSingleBlock memSingleBlock  )  [inline]

Definition at line 98 of file memSingleBlock.c.

References memSingleBlock::currentEntry.

Referenced by alignments_findFinalAlignments(), alignments_free(), alignments_getFinalAlignmentDescriptions(), alignments_getTracebacks(), cluster_clusterSequences(), cluster_processList(), cluster_processSequenceMatches(), cluster_spexClusterSequences(), main(), qPosList_processList(), rsdb_spexClusterSequences(), and rsdb_updateDiagonalMatches().

00099 {
00100         memSingleBlock->currentEntry = 0;
00101 }

Here is the caller graph for this function:


Generated on Wed Dec 19 20:50:09 2007 for fsa-blast by  doxygen 1.5.2