#include <ArClientFileUtils.h>
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 |
ArClientBase * | myClient |
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 |