QueueNode Class Reference

Class for storing nodes in a queue. This class is used to store nodes in the queue of things to transfer. More...

#include <queuenode.h>

Inheritance diagram for QueueNode:

CommandNode DirListNode DownloadNode InitializationNode UploadNode List of all members.

Public Member Functions

virtual ~QueueNode ()
 QueueNode Default constructor.
int GetStatus ()
int GetType ()
 Return the type of the transaction.
float GetProgress ()
 Return the current progress of the QueueNode's operation.
String GetRemotePath ()
String GetLocalPath ()
ssize_t GetDownloadedTotal ()
 Find how much was downloaded so far (in bytes).
ssize_t GetUploadedTotal ()
 Find how much was downloaded so far (in bytes).
ssize_t GetTotalSize ()
 Find the actual size of the file being transferred (in bytes).

Protected Member Functions

 QueueNode (Server *pcServer, const String &zLocalPath, const String &zRemotePath, int nType, int nID)
 QueueNode Constructor. Initializes the QueueNode storing all the data related to the node.
void SetDownloadedTotal (ssize_t nSize)
 Set how much was downloaded so far.
void SetUploadedTotal (ssize_t nSize)
 Set how much was uploaded so far.
void SetTotalSize (ssize_t nSize)
 Set the actual size of the file being downloaded.
virtual CURLcode AttachToHandle (CURL *pHandle)
 Set the necessary options in the curl handle. The important parts are done in the subclasses.
virtual CURLcode RemoveFromHandle (CURL *pHandle)
 Remove any settings from the curl handle set in AttachToHandle().

Protected Attributes

Serverm_pcServer
 Server that this QueueNode belongs to.
String m_zLocalPath
 Local path of the file to be transfered.
String m_zRemotePath
 Remote path of the file to be transfered.
int m_nType
 Stores type of transfer this node represents. Could be: Upload, Download, Directory Listing, etc.
int m_nStatus
 Stores the status of the node. Should use one of the enums for Active or Queued.
int m_nID
 Our id for the Server's std::map.
ssize_t m_nTotalSize
ssize_t m_nTotalDownloaded
ssize_t m_nTotalUploaded

Private Member Functions

virtual size_t Read (void *pBuf, size_t nSize)
 Read data into the provided buffer.
virtual size_t Write (void *pBuf, size_t nSize)
 Write data from the provided buffer.
virtual int Seek (curl_off_t nOffset, int nOrigin)
 Seek into the data that is being manipulated.
virtual int ProgressBar (double fDownTotal, double fDownNow, double fUpTotal, double fUpNow)
 Update the progress bar for the QueueNode.

Static Private Member Functions

static size_t ReadCallback (void *pBuf, size_t nSize, size_t nMult, void *pCookie)
 Read Callback The libcurl read callback. Can't pass a virtual function to libcurl so we use these static wrappers.
static size_t WriteCallback (void *pBuf, size_t nSize, size_t nMult, void *pCookie)
 Write Callback The libcurl write callback. Can't pass a virtual function to libcurl so we use these static wrappers.
static int SeekCallback (void *pCookie, curl_off_t nOffset, int nOrigin)
 Seek Callback The libcurl seek callback. Can't pass a virtual function to libcurl so we use these static wrappers.
static int ProgressBarCallback (void *pCookie, double fDownTotal, double fDownNow, double fUpTotal, double fUpNow)
 Progress Bar Callback The libcurl progress bar. callback. Can't pass a virtual function to libcurl so we use these static wrappers.

Friends

class TransferThread

Detailed Description

Class for storing nodes in a queue. This class is used to store nodes in the queue of things to transfer.


Member Function Documentation

int QueueNode::GetStatus (  )  [inline]

Return the current status of the node.

Todo:
Should this be here since it is a GUI access methods?

int QueueNode::GetType (  )  [inline]

Return the type of the transaction.

Todo:
Should this be here since it is a GUI access methods?

float QueueNode::GetProgress (  )  [inline]

Return the current progress of the QueueNode's operation.

Todo:
Currently this just returns 0.
Todo:
Should this be here since it is a GUI access methods?

virtual size_t QueueNode::Read ( void *  pBuf,
size_t  nSize 
) [inline, private, virtual]

Read data into the provided buffer.

Parameters:
pBuf Pointer to the buffer to read data into.
nSize The amount of data to be read.
Warning:
This is only a place holder and does nothing. It is meant to be subclassed by the different types of QueueNodes.

Reimplemented in UploadNode.

virtual size_t QueueNode::Write ( void *  pBuf,
size_t  nSize 
) [inline, private, virtual]

Write data from the provided buffer.

Parameters:
pBuf The location of the data that should be read from to write information.
nSize Size of the data that is in pBuf.
Warning:
This is only a place holder and does nothing. It is meant to be subclassed by the different types of QueueNodes.

Reimplemented in DownloadNode, and DirListNode.

virtual int QueueNode::Seek ( curl_off_t  nOffset,
int  nOrigin 
) [inline, private, virtual]

Seek into the data that is being manipulated.

Parameters:
nOffset Amount to offset into the data being manipulated.
nOrigin Where to start offsetting from.
Warning:
This is only a place holder and does nothing. It is meant to be subclassed by the different types of QueueNodes.

Reimplemented in DownloadNode, and UploadNode.

virtual int QueueNode::ProgressBar ( double  fDownTotal,
double  fDownNow,
double  fUpTotal,
double  fUpNow 
) [inline, private, virtual]

Update the progress bar for the QueueNode.

Parameters:
fDownTotal Total data downloaded to be downloaded
fDownNow Total data downloaded so far.
fUpTotal Total data to be uploaded.
fUpNow Total data uploaded so far.
Warning:
This is only a place holder and does nothing. It is meant to be subclassed by the different types of QueueNodes.

Reimplemented in DownloadNode, UploadNode, and DirListNode.

size_t QueueNode::ReadCallback ( void *  pBuf,
size_t  nSize,
size_t  nMult,
void *  pCookie 
) [static, private]

Read Callback The libcurl read callback. Can't pass a virtual function to libcurl so we use these static wrappers.

Parameters:
pBuf The location to read input data to.
nSize The amount of data to be read.
nMult The size in bytes of each data unit.
pCookie This contains the QueueNode* that we want to call the Read method on.

size_t QueueNode::WriteCallback ( void *  pBuf,
size_t  nSize,
size_t  nMult,
void *  pCookie 
) [static, private]

Write Callback The libcurl write callback. Can't pass a virtual function to libcurl so we use these static wrappers.

Todo:
Verify descriptions of callback parameters with libcurl documentation.
Parameters:
pBuf The data that QueueNode will parse.
nSize The size of the data being passed to the QueueNode.
nMult The size of the data type being passed.
pCookie This contains the QueueNode* that we want to call the Write method on.

int QueueNode::SeekCallback ( void *  pCookie,
curl_off_t  nOffset,
int  nOrigin 
) [static, private]

Seek Callback The libcurl seek callback. Can't pass a virtual function to libcurl so we use these static wrappers.

Parameters:
pCookie This contains the QueueNode* that we want to call the Seek method on.
nOffset How many bytes to offset into the file.
nOrigin The origin from which to start the offset.

int QueueNode::ProgressBarCallback ( void *  pCookie,
double  fDownTotal,
double  fDownNow,
double  fUpTotal,
double  fUpNow 
) [static, private]

Progress Bar Callback The libcurl progress bar. callback. Can't pass a virtual function to libcurl so we use these static wrappers.

Parameters:
pCookie The pointer to the QueueNode object to send the ProgreesBar update to.
fDownTotal Total data downloaded to be downloaded
fDownNow Total data downloaded so far.
fUpTotal Total data to be uploaded.
fUpNow Total data uploaded so far.

void QueueNode::SetDownloadedTotal ( ssize_t  nSize  )  [inline, protected]

Set how much was downloaded so far.

Parameters:
uSize The amount of data downloaded so far (in bytes).

void QueueNode::SetUploadedTotal ( ssize_t  nSize  )  [inline, protected]

Set how much was uploaded so far.

Parameters:
uSize The amount of data uploaded so far (in bytes).

void QueueNode::SetTotalSize ( ssize_t  nSize  )  [inline, protected]

Set the actual size of the file being downloaded.

Parameters:
uSize The size of the file (in bytes).


Member Data Documentation

int QueueNode::m_nType [protected]

Stores type of transfer this node represents. Could be: Upload, Download, Directory Listing, etc.

See the enums in the header file.

Todo:
Should this be an enum type?

int QueueNode::m_nStatus [protected]

Stores the status of the node. Should use one of the enums for Active or Queued.

See the enums in the header file.

Todo:
Should this be an enum type?


The documentation for this class was generated from the following files:
Generated on Fri Jan 2 17:23:34 2009 for Transferrer by  doxygen 1.5.1