ArClientFileFromClient Class Reference

#include <ArClientFileUtils.h>

List of all members.


Detailed Description

This class will interact with the ArServerFileFromClient and put a file on to 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 (0 = good (got file), 1 = getting file, 2 = tried to go outside allowed area, 3 = bad directory, 4 = empty file name (or other problem with fileName), 5 = can't write temp file, 6 = error moving file from temp to perm, 7 = another client putting file, 8 = timeout (no activity for 15 seconds) and another client wanted to put the file, 9 = client adding to, finishing, or canceling a file the server doesn't have), negative would be from this class but there aren't any of those yet


Public Types

enum  SendSpeed { SPEED_AUTO, SPEED_FAST, SPEED_SLOW }
 Enum that describes the speed to send at. More...
 SPEED_AUTO
 Send it fast if available, if not then send it slow.
 SPEED_FAST
 Send it fast.
 SPEED_SLOW
 Send it slow.

Public Member Functions

void addFileSentCallback (ArFunctor1< int > *functor, ArListPos::Pos position=ArListPos::LAST)
 Adds a callback for when we get the desired file (or fail).
 ArClientFileFromClient (ArClientBase *client)
 Constructor.
void cancelPut (void)
 Cancels putting a file.
const char * getClientFileName (void)
 Gets the filename we're taking from the client.
const char * getDirectory (void)
 Gets the directory we're putting to.
const char * getFileName (void)
 Gets the filename we're putting.
ArTime getLastCompletedSend (void)
 Gets the last time we finished putting a file.
ArTime getLastStartedSend (void)
 Gets the last time we started putting a file.
bool isAvailable (void)
 Sees if the server supports what this class needs.
bool isAvailableFast (void)
 Sees if the server supports what this class needs to send fast.
bool isAvailableSetTimestamp (void)
 Sees if the server supports the ability to set the file timestamp.
bool isAvailableSlow (void)
 Sees if the server supports what this class needs to send slowly.
bool isWaitingForReturn (void)
 If we're waiting for completion now.
bool putFileToDirectory (const char *directory, const char *fileName, const char *clientFileName, SendSpeed sendSpeed=SPEED_AUTO, bool isSetTimestamp=false)
 Puts the specified client file on the server in the given directory and file.
void remFileSentCallback (ArFunctor1< int > *functor)
 Removes a callback for when we get the desired file (or fail).
virtual ~ArClientFileFromClient ()
 Destructor.

Protected Member Functions

void callFileSentCallbacks (int val)
void netPutFile (ArNetPacket *packet)

Protected Attributes

ArMutex myCallbackMutex
ArClientBasemyClient
std::string myClientFileName
std::string myCommandName
ArMutex myDataMutex
std::string myDirectory
FILE * myFile
std::string myFileName
std::list< ArFunctor1< int > * > myFileSentCallbacks
bool myInterleaved
bool myIsWaitingForReturn
ArTime myLastCompletedSend
ArTime myLastStartedSend
ArFunctor1C< ArClientFileFromClient,
ArNetPacket * > 
myPutFileCB
bool myReadyForNextPacket
bool myTimestamp
std::string myWholeFileName


Member Enumeration Documentation

enum ArClientFileFromClient::SendSpeed

Enum that describes the speed to send at.

Enumerator:
SPEED_AUTO  Send it fast if available, if not then send it slow.
SPEED_FAST  Send it fast.
SPEED_SLOW  Send it slow.


Constructor & Destructor Documentation

ArClientFileFromClient::ArClientFileFromClient ( ArClientBase client  ) 

Constructor.

ArClientFileFromClient::~ArClientFileFromClient (  )  [virtual]

Destructor.


Member Function Documentation

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

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

void ArClientFileFromClient::callFileSentCallbacks ( int  val  )  [protected]

void ArClientFileFromClient::cancelPut ( void   ) 

Cancels putting a file.

const char * ArClientFileFromClient::getClientFileName ( void   ) 

Gets the filename we're taking from the client.

const char * ArClientFileFromClient::getDirectory ( void   ) 

Gets the directory we're putting to.

const char * ArClientFileFromClient::getFileName ( void   ) 

Gets the filename we're putting.

ArTime ArClientFileFromClient::getLastCompletedSend ( void   ) 

Gets the last time we finished putting a file.

ArTime ArClientFileFromClient::getLastStartedSend ( void   ) 

Gets the last time we started putting a file.

bool ArClientFileFromClient::isAvailable ( void   ) 

Sees if the server supports what this class needs.

bool ArClientFileFromClient::isAvailableFast ( void   ) 

Sees if the server supports what this class needs to send fast.

bool ArClientFileFromClient::isAvailableSetTimestamp ( void   ) 

Sees if the server supports the ability to set the file timestamp.

bool ArClientFileFromClient::isAvailableSlow ( void   ) 

Sees if the server supports what this class needs to send slowly.

bool ArClientFileFromClient::isWaitingForReturn ( void   ) 

If we're waiting for completion now.

void ArClientFileFromClient::netPutFile ( ArNetPacket packet  )  [protected]

bool ArClientFileFromClient::putFileToDirectory ( const char *  directory,
const char *  fileName,
const char *  clientFileName,
SendSpeed  sendSpeed = SPEED_AUTO,
bool  isSetTimestamp = false 
)

Puts the specified client file on the server in the given directory and file.

void ArClientFileFromClient::remFileSentCallback ( ArFunctor1< int > *  functor  ) 

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


Member Data Documentation

ArMutex ArClientFileFromClient::myCallbackMutex [protected]

ArClientBase* ArClientFileFromClient::myClient [protected]

std::string ArClientFileFromClient::myClientFileName [protected]

std::string ArClientFileFromClient::myCommandName [protected]

ArMutex ArClientFileFromClient::myDataMutex [protected]

std::string ArClientFileFromClient::myDirectory [protected]

FILE* ArClientFileFromClient::myFile [protected]

std::string ArClientFileFromClient::myFileName [protected]

std::list<ArFunctor1<int> *> ArClientFileFromClient::myFileSentCallbacks [protected]

bool ArClientFileFromClient::myInterleaved [protected]

bool ArClientFileFromClient::myIsWaitingForReturn [protected]

ArTime ArClientFileFromClient::myLastCompletedSend [protected]

ArTime ArClientFileFromClient::myLastStartedSend [protected]

ArFunctor1C<ArClientFileFromClient, ArNetPacket *> ArClientFileFromClient::myPutFileCB [protected]

bool ArClientFileFromClient::myReadyForNextPacket [protected]

bool ArClientFileFromClient::myTimestamp [protected]

std::string ArClientFileFromClient::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