ArClientFileToClient Class Reference

#include <ArClientFileUtils.h>

List of all members.


Detailed Description

This class will interact with the ArServerFileToClient and get a file on the server.

If you want to find out what files are on the server use ArClientFileLister.

When get a file it doesn't happen right away, but when the file is received (or failes) the fileGotten callbacks will be called, 0 as the int for the callback means everything is good, positive error messages are from the server (1 == tried to go outside allowed area, 2 == no such directory, 3 == empty file name, 4 == problem reading file), negative are from this class (-1 == got directory but it wasn't what we wanted (if you wait the right one might come in, like if someone selects one dir then the other), -2 == can't open file to put result into).


Public Member Functions

void addFileReceivedCallback (ArFunctor1< int > *functor, ArListPos::Pos position=ArListPos::LAST)
 Adds a callback for when we get the desired file (or fail).
 ArClientFileToClient (ArClientBase *client)
 Constructor.
void cancelGet (void)
 Cancels getting a file.
const char * getClientFileName (void)
 Gets the filename we'll save the gotten file in.
const char * getDirectory (void)
 Gets the directory we're getting from.
bool getFileFromDirectory (const char *directory, const char *fileName, const char *clientFileName, bool isSetTimestamp=false)
 Get the file from a directory.
const char * getFileName (void)
 Gets the filename we're getting.
ArTime getLastReceived (void)
 Gets the last time we finished getting a file.
ArTime getLastRequested (void)
 Gets the last time we asked for a file.
bool isAvailable (void)
 Sees if the server supports what this class needs.
bool isAvailableSetTimestamp (void)
bool isWaitingForFile (void)
 If we're getting a file now.
void remFileReceivedCallback (ArFunctor1< int > *functor)
 Removes a callback for when we get the desired file (or fail).
virtual ~ArClientFileToClient ()
 Destructor.

Protected Member Functions

void callFileReceivedCallbacks (int val)
void doGetFile (ArNetPacket *packet, bool isSetTimestamp)
void netGetFile (ArNetPacket *packet)
void netGetFileWithTimestamp (ArNetPacket *packet)

Protected Attributes

ArMutex myCallbackMutex
ArClientBasemyClient
std::string myClientFileName
ArMutex myDataMutex
std::string myDirectory
FILE * myFile
std::string myFileName
std::list< ArFunctor1< int > * > myFileReceivedCallbacks
ArFunctor1C< ArClientFileToClient,
ArNetPacket * > 
myGetFileCB
ArFunctor1C< ArClientFileToClient,
ArNetPacket * > 
myGetFileWithTimestampCB
bool myIsWaitingForFile
ArTime myLastReceived
ArTime myLastRequested
std::string myWholeFileName


Constructor & Destructor Documentation

ArClientFileToClient::ArClientFileToClient ( ArClientBase client  ) 

Constructor.

ArClientFileToClient::~ArClientFileToClient (  )  [virtual]

Destructor.


Member Function Documentation

void ArClientFileToClient::addFileReceivedCallback ( ArFunctor1< int > *  functor,
ArListPos::Pos  position = ArListPos::LAST 
)

Adds a callback for when we get the desired file (or fail).

void ArClientFileToClient::callFileReceivedCallbacks ( int  val  )  [protected]

void ArClientFileToClient::cancelGet ( void   ) 

Cancels getting a file.

void ArClientFileToClient::doGetFile ( ArNetPacket packet,
bool  isSetTimestamp 
) [protected]

const char * ArClientFileToClient::getClientFileName ( void   ) 

Gets the filename we'll save the gotten file in.

const char * ArClientFileToClient::getDirectory ( void   ) 

Gets the directory we're getting from.

bool ArClientFileToClient::getFileFromDirectory ( const char *  directory,
const char *  fileName,
const char *  clientFileName,
bool  isSetTimestamp = false 
)

Get the file from a directory.

const char * ArClientFileToClient::getFileName ( void   ) 

Gets the filename we're getting.

ArTime ArClientFileToClient::getLastReceived ( void   ) 

Gets the last time we finished getting a file.

ArTime ArClientFileToClient::getLastRequested ( void   ) 

Gets the last time we asked for a file.

bool ArClientFileToClient::isAvailable ( void   ) 

Sees if the server supports what this class needs.

bool ArClientFileToClient::isAvailableSetTimestamp ( void   ) 

bool ArClientFileToClient::isWaitingForFile ( void   ) 

If we're getting a file now.

void ArClientFileToClient::netGetFile ( ArNetPacket packet  )  [protected]

void ArClientFileToClient::netGetFileWithTimestamp ( ArNetPacket packet  )  [protected]

void ArClientFileToClient::remFileReceivedCallback ( ArFunctor1< int > *  functor  ) 

Removes a callback for when we get the desired file (or fail).


Member Data Documentation

ArMutex ArClientFileToClient::myCallbackMutex [protected]

ArClientBase* ArClientFileToClient::myClient [protected]

std::string ArClientFileToClient::myClientFileName [protected]

ArMutex ArClientFileToClient::myDataMutex [protected]

std::string ArClientFileToClient::myDirectory [protected]

FILE* ArClientFileToClient::myFile [protected]

std::string ArClientFileToClient::myFileName [protected]

std::list<ArFunctor1<int> *> ArClientFileToClient::myFileReceivedCallbacks [protected]

ArFunctor1C<ArClientFileToClient, ArNetPacket *> ArClientFileToClient::myGetFileCB [protected]

ArFunctor1C<ArClientFileToClient, ArNetPacket *> ArClientFileToClient::myGetFileWithTimestampCB [protected]

bool ArClientFileToClient::myIsWaitingForFile [protected]

ArTime ArClientFileToClient::myLastReceived [protected]

ArTime ArClientFileToClient::myLastRequested [protected]

std::string ArClientFileToClient::myWholeFileName [protected]


The documentation for this class was generated from the following files:
Generated on Fri Jul 31 12:37:28 2009 for ArNetworking by  doxygen 1.4.7