libBigWig
bigWigIO.h
Go to the documentation of this file.
1 #ifndef LIBBIGWIG_IO_H
2 #define LIBBIGWIG_IO_H
3 
4 #ifndef NOCURL
5 #include <curl/curl.h>
6 #else
7 #include <stdio.h>
8 #ifndef CURLTYPE_DEFINED
9 #define CURLTYPE_DEFINED
10 typedef int CURLcode;
11 typedef void CURL;
12 #endif
13 #define CURLE_OK 0
14 #define CURLE_FAILED_INIT 1
15 #endif
16 
23 extern size_t GLOBAL_DEFAULTBUFFERSIZE;
24 
29  BWG_FILE = 0,
30  BWG_HTTP = 1,
31  BWG_HTTPS = 2,
32  BWG_FTP = 3
33 };
34 
38 typedef struct {
39  union {
40 #ifndef NOCURL
41  CURL *curl;
42 #endif
43  FILE *fp;
44  } x;
45  void *memBuf;
46  size_t filePos;
47  size_t bufPos;
48  size_t bufSize;
49  size_t bufLen;
52  char *fname;
53 } URL_t;
54 
68 size_t urlRead(URL_t *URL, void *buf, size_t bufSize);
69 
80 CURLcode urlSeek(URL_t *URL, size_t pos);
81 
97 URL_t *urlOpen(char *fname, CURLcode (*callBack)(CURL*), const char* mode);
98 
108 void urlClose(URL_t *URL);
109 
110 #endif // LIBBIGWIG_IO_H
urlClose
void urlClose(URL_t *URL)
Close a local/remote file.
Definition: io.c:286
URL_t::fname
char * fname
Definition: bigWigIO.h:52
GLOBAL_DEFAULTBUFFERSIZE
size_t GLOBAL_DEFAULTBUFFERSIZE
Definition: io.c:12
URL_t::bufLen
size_t bufLen
Definition: bigWigIO.h:49
bigWigFile_type_enum
bigWigFile_type_enum
Definition: bigWigIO.h:28
URL_t::memBuf
void * memBuf
Definition: bigWigIO.h:45
URL_t::curl
CURL * curl
Definition: bigWigIO.h:41
URL_t::isCompressed
int isCompressed
Definition: bigWigIO.h:51
URL_t::bufPos
size_t bufPos
Definition: bigWigIO.h:47
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:38
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:43
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:48
URL_t::filePos
size_t filePos
Definition: bigWigIO.h:46