Loading...
Searching...
No Matches
bigWigIO.h
Go to the documentation of this file.
#ifndef LIBBIGWIG_IO_H
#define LIBBIGWIG_IO_H
#ifndef NOCURL
#include <curl/curl.h>
#else
#include <stdio.h>
#ifndef CURLTYPE_DEFINED
#define CURLTYPE_DEFINED
typedef int CURLcode;
typedef void CURL;
#endif
#define CURLE_OK 0
#define CURLE_FAILED_INIT 1
#endif
extern size_t GLOBAL_DEFAULTBUFFERSIZE;
enum bigWigFile_type_enum {
BWG_FILE = 0,
BWG_HTTP = 1,
BWG_HTTPS = 2,
BWG_FTP = 3
};
typedef struct {
union {
#ifndef NOCURL
CURL *curl;
#endif
FILE *fp;
} x;
void *memBuf;
size_t filePos;
size_t bufPos;
size_t bufSize;
size_t bufLen;
enum bigWigFile_type_enum type;
int isCompressed;
const char *fname;
} URL_t;
size_t urlRead(URL_t *URL, void *buf, size_t bufSize);
CURLcode urlSeek(URL_t *URL, size_t pos);
URL_t *urlOpen(const char *fname, CURLcode (*callBack)(CURL*), const char* mode);
void urlClose(URL_t *URL);
#endif // LIBBIGWIG_IO_H
GLOBAL_DEFAULTBUFFERSIZE
size_t GLOBAL_DEFAULTBUFFERSIZE
Definition io.c:12
bigWigFile_type_enum
bigWigFile_type_enum
Definition bigWigIO.h:28
urlSeek
CURLcode urlSeek(URL_t *URL, size_t pos)
Seeks to a given position in a local or remote file.
Definition io.c:120
urlRead
size_t urlRead(URL_t *URL, void *buf, size_t bufSize)
Reads data into the given buffer.
Definition io.c:89
urlOpen
URL_t * urlOpen(const char *fname, CURLcode(*callBack)(CURL *), const char *mode)
Open a local or remote file.
Definition io.c:161
urlClose
void urlClose(URL_t *URL)
Close a local/remote file.
Definition io.c:286
URL_t
This structure holds the file pointers and buffers needed for raw access to local and remote files.
Definition bigWigIO.h:38
URL_t::curl
CURL * curl
Definition bigWigIO.h:41
URL_t::bufLen
size_t bufLen
Definition bigWigIO.h:49
URL_t::fname
const char * fname
Definition bigWigIO.h:52
URL_t::type
enum bigWigFile_type_enum type
Definition bigWigIO.h:50
URL_t::bufSize
size_t bufSize
Definition bigWigIO.h:48
URL_t::filePos
size_t filePos
Definition bigWigIO.h:46
URL_t::isCompressed
int isCompressed
Definition bigWigIO.h:51
URL_t::memBuf
void * memBuf
Definition bigWigIO.h:45
URL_t::bufPos
size_t bufPos
Definition bigWigIO.h:47
URL_t::fp
FILE * fp
Definition bigWigIO.h:43