00001 /* 00002 * Copyright (C) 2009, Edmundo Albuquerque de Souza e Silva. 00003 * 00004 * This file may be distributed under the terms of the Q Public License 00005 * as defined by Trolltech AS of Norway and appearing in the file 00006 * LICENSE.QPL included in the packaging of this file. 00007 * 00008 * THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING 00009 * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00010 * PURPOSE. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, 00011 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 00012 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 00013 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 00014 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 00015 * 00016 */ 00017 00018 #ifndef __RIOFILE_H__ 00019 #define __RIOFILE_H__ 00020 00021 #include "RioInterfaceTypes.h" 00022 #include "RioInterface.h" 00023 00024 #ifndef MAXPATHSIZE 00025 #define MAXPATHSIZE 255 00026 #endif 00027 00028 class RioFile 00029 { 00030 public: 00031 RioFile( const char *, unsigned int ); 00032 ~RioFile( void ); 00033 00034 int Open( RioAccess, CRioStream * ); 00035 int Close( void ); 00036 00037 void Download( const char * = "" ); 00038 int Delete( void ); 00039 00040 const char * GetLocalFilename( ); 00041 00042 static void CallBack( struct RioRequest * ); 00043 void SetBufferStatus( int ); 00044 private: 00045 bool HasLocal; 00046 char LocalFilename[ MAXPATHSIZE ]; 00047 char RemoteFilename[ MAXPATHSIZE ]; 00048 00049 pthread_mutex_t Mutex; 00050 pthread_cond_t Condition; 00051 00052 CRioObject Object; 00053 00054 RioRequest Request; 00055 int BufferStatus; 00056 unsigned int BlockSize; /* size of block in bytes */ 00057 RioObjectSize ObjSize; /* size of this object in bytes */ 00058 RioBlock TotalBlocks; /* size of this object in blocks */ 00059 RioBlock CurrentBlock; /* last block retrieved from server */ 00060 }; 00061 00062 #endif