mcs::URLReader Class Reference

#include <mcs.hh>

Inheritance diagram for mcs::URLReader:

Inheritance graph
[legend]

List of all members.


Detailed Description

A class that provide a uniform access to file retrieving.

This class is capable (through CURL) to provide access to files both on local or remote file systems.

Definition at line 7811 of file mcs.hh.


Public Member Functions

void Close ()
 Terminates a file retrieval.
void Download (string url, string fn)
int OpenAsFD (string url)
 Obtain a file descriptor to read the file passed as parameter.
const char * OpenAsFifo (string url)
 Create a FIFO on file system to read from the specified file.
int Read (char *buf, int maxlen)
 Read from the resource.
string url ()
 URLReader ()
 Constructor.
virtual ~URLReader ()
 Destructor.

Static Public Member Functions

static bool chkLocal (string &url)

Protected Member Functions

void flush ()
virtual unsigned int Write (void *ptr, unsigned int size, unsigned int nmemb)
 Writes a chunk of data into the pipe.

Private Member Functions

void thread_fetch ()

Static Private Member Functions

static size_t cb_write (void *ptr, size_t size, size_t nmemb, void *This)
static int thread_run (void *p)

Private Attributes

bool local
 If the URL refer to a resource on local filesystem.
string lurl
 URL requested.
ThreadFuncthr

Static Private Attributes

static bool fl_curl_global_init = false
 True if curl_global_init has been called (must be called once).

Constructor & Destructor Documentation

mcs::URLReader::URLReader (  ) 

Constructor.

Definition at line 207 of file Readers.cc.

mcs::URLReader::~URLReader (  )  [virtual]

Destructor.

Definition at line 218 of file Readers.cc.


Member Function Documentation

void mcs::URLReader::Close (  ) 

Terminates a file retrieval.

This method closes the open file descriptor (if any) and terminates an open connection. Note that this method must be called once for each OpenAsFD() or OpenAsFile() call.

This method will raise an exception if an error occurred during file retrieval.

Definition at line 285 of file Readers.cc.

int mcs::URLReader::OpenAsFD ( string  url  ) 

Obtain a file descriptor to read the file passed as parameter.

Definition at line 237 of file Readers.cc.

const char * mcs::URLReader::OpenAsFifo ( string  url  ) 

Create a FIFO on file system to read from the specified file.

Definition at line 250 of file Readers.cc.

int mcs::URLReader::Read ( char *  buf,
int  maxlen 
)

Read from the resource.

Definition at line 409 of file Readers.cc.

unsigned int mcs::URLReader::Write ( void *  ptr,
unsigned int  size,
unsigned int  nmemb 
) [protected, virtual]

Writes a chunk of data into the pipe.

This method is called each time a new chunk of data is ready to be written in the write side of the pipe. This method can be ovverriden to implement custom filtering.

Definition at line 402 of file Readers.cc.


Member Data Documentation

bool mcs::URLReader::fl_curl_global_init = false [static, private]

True if curl_global_init has been called (must be called once).

Definition at line 7815 of file mcs.hh.

bool mcs::URLReader::local [private]

If the URL refer to a resource on local filesystem.

Definition at line 7821 of file mcs.hh.

string mcs::URLReader::lurl [private]

URL requested.

Definition at line 7818 of file mcs.hh.


The documentation for this class was generated from the following files:
mcslogo

MCS (My Customizable Server) ver. 0.3.3-alpha3
Documentation generated on Thu Mar 22 13:22:23 UTC 2012