libBigWig
bigWigIO.h
Go to the documentation of this file.
1 #ifndef NOCURL
2 #include <curl/curl.h>
3 #else
4 #include <stdio.h>
5 typedef int CURLcode;
6 typedef void CURL;
7 #define CURLE_OK 0
8 #define CURLE_FAILED_INIT 1
9 #endif
10 
17 extern size_t GLOBAL_DEFAULTBUFFERSIZE;
18 
23  BWG_FILE = 0,
24  BWG_HTTP = 1,
25  BWG_HTTPS = 2,
26  BWG_FTP = 3
27 };
28 
32 typedef struct {
33  union {
34 #ifndef NOCURL
35  CURL *curl;
36 #endif
37  FILE *fp;
38  } x;
39  void *memBuf;
40  size_t filePos;
41  size_t bufPos;
42  size_t bufSize;
43  size_t bufLen;
46  char *fname;
47 } URL_t;
48 
62 size_t urlRead(URL_t *URL, void *buf, size_t bufSize);
63 
74 CURLcode urlSeek(URL_t *URL, size_t pos);
75 
91 URL_t *urlOpen(char *fname, CURLcode (*callBack)(CURL*), const char* mode);
92 
102 void urlClose(URL_t *URL);
urlClose
void urlClose(URL_t *URL)
Close a local/remote file.
Definition: io.c:286
URL_t::fname
char * fname
Definition: bigWigIO.h:46
GLOBAL_DEFAULTBUFFERSIZE
size_t GLOBAL_DEFAULTBUFFERSIZE
Definition: io.c:12
URL_t::bufLen
size_t bufLen
Definition: bigWigIO.h:43
bigWigFile_type_enum
bigWigFile_type_enum
Definition: bigWigIO.h:22
URL_t::memBuf
void * memBuf
Definition: bigWigIO.h:39
URL_t::curl
CURL * curl
Definition: bigWigIO.h:35
URL_t::isCompressed
int isCompressed
Definition: bigWigIO.h:45
URL_t::bufPos
size_t bufPos
Definition: bigWigIO.h:41
urlRead
size_t urlRead(URL_t *URL, void *buf, size_t bufSize)
Reads data into the given buffer.
Definition: io.c:89
URL_t
This structure holds the file pointers and buffers needed for raw access to local and remote files.
Definition: bigWigIO.h:32
urlOpen
URL_t * urlOpen(char *fname, CURLcode(*callBack)(CURL *), const char *mode)
Open a local or remote file.
Definition: io.c:161
URL_t::fp
FILE * fp
Definition: bigWigIO.h:37
urlSeek
CURLcode urlSeek(URL_t *URL, size_t pos)
Seeks to a given position in a local or remote file.
Definition: io.c:120
URL_t::bufSize
size_t bufSize
Definition: bigWigIO.h:42
URL_t::filePos
size_t filePos
Definition: bigWigIO.h:40