Loading...
Searching...
No Matches
bwCommon.h File Reference

Go to the source code of this file.

## Functions

int | bwSetPos (bigWigFile_t *fp, size_t pos)
| Like fsetpos, but for local or remote bigWig files. This will set the file position indicator to the specified point. For local files this literally is fsetpos, while for remote files it fills a memory buffer with data starting at the desired position.
size_t | bwRead (void *data, size_t sz, size_t nmemb, bigWigFile_t *fp)
| A local/remote version of fread. Reads data from either local or remote bigWig files.
long | bwTell (bigWigFile_t *fp)
| Determine what the file position indicator say. This is equivalent to ftell for local or remote files.
bwRTree_t * | bwReadIndex (bigWigFile_t *fp, uint64_t offset)
| Reads a data index (either full data or a zoom level) from a bigWig file. There is little reason for end users to use this function. This must be freed with bwDestroyIndex.
void | bwDestroyIndexNode (bwRTreeNode_t *node)
| Destroy an bwRTreeNode_t and all of its children.
void | bwDestroyIndex (bwRTree_t *idx)
| Frees space allocated by bwReadIndex There is generally little reason to use this, since end users should typically not need to run bwReadIndex themselves.
int | bwFinalize (bigWigFile_t *fp)
| Finishes what's needed to write a bigWigFile Flushes the buffer, converts the index linked list to a tree, writes that to disk, handles zoom level stuff, writes magic at the end.

## Detailed Description

You have no reason to use these functions. They may change without warning because there's no reason for them to be used outside of libBigWig's internals.

These are structures and functions from a variety of files that are used across files internally but don't need to be see by libBigWig users.

## Function Documentation

## bwDestroyIndex()

void bwDestroyIndex | ( | bwRTree_t * | idx | ) |

Frees space allocated by bwReadIndex There is generally little reason to use this, since end users should typically not need to run bwReadIndex themselves.

Parameters

  idx | A bwRTree_t pointer allocated by bwReadIndex.

## bwDestroyIndexNode()

void bwDestroyIndexNode | ( | bwRTreeNode_t * | node | ) |

Destroy an bwRTreeNode_t and all of its children.

Parameters

  node | The node to destroy.

## bwFinalize()

int bwFinalize | ( | bigWigFile_t * | fp | ) |

Finishes what's needed to write a bigWigFile Flushes the buffer, converts the index linked list to a tree, writes that to disk, handles zoom level stuff, writes magic at the end.

Parameters

  fp | A valid bigWigFile_t pointer

Returns
  0 on success

## bwRead()

size_t bwRead | ( | void * | data,
|  | size_t | sz,
|  | size_t | nmemb,
|  | bigWigFile_t * | fp )

A local/remote version of fread. Reads data from either local or remote bigWig files.

Parameters

  data | An allocated memory block big enough to hold the data.
  sz | The size of each member that should be copied.
  nmemb | The number of members to copy.
  fp | The bigWigFile_t * from which to copy the data.

See also
  bwSetPos

Returns
  For nmemb==1, the size of the copied data. For nmemb>1, the number of members fully copied (this is equivalent to fread).

## bwReadIndex()

bwRTree_t * bwReadIndex | ( | bigWigFile_t * | fp,
|  | uint64_t | offset )

Reads a data index (either full data or a zoom level) from a bigWig file. There is little reason for end users to use this function. This must be freed with bwDestroyIndex.

Parameters

  fp | A valid bigWigFile_t pointer
  offset | The file offset where the index begins

Returns
  A bwRTree_t pointer or NULL on error.

## bwSetPos()

int bwSetPos | ( | bigWigFile_t * | fp,
|  | size_t | pos )

Like fsetpos, but for local or remote bigWig files. This will set the file position indicator to the specified point. For local files this literally is fsetpos, while for remote files it fills a memory buffer with data starting at the desired position.

Parameters

  fp | A valid opened bigWigFile_t.
  pos | The position within the file to seek to.

Returns
  0 on success and -1 on error.

## bwTell()

long bwTell | ( | bigWigFile_t * | fp | ) |

Determine what the file position indicator say. This is equivalent to ftell for local or remote files.

Parameters

  fp | The file.

Returns
  The position in the file.