LocalFileObject Class Reference

#include <FileObject.h>

Inherits FileObject.

Public Member Functions

 LocalFileObject (char *name)
bool Open (unsigned int mode, char *md5sum=NULL)
int Close ()
int Read (char *buf, int size)
int Write (char *buf, int size, char *md5sum)
RioObjectSize getSize ()
bool getVideoRate (unsigned int *VideoRate)
 GetVideoRate retorna a taxa de transmissao (em Kbps) de video default (pois os arquivos locais nao possuem uma taxa de video).
bool setVideoRate (unsigned int VideoRate)
 SetVideoRate Esta funcao nao faz nada e somente e definida porque precisamos definir todas as funcoes abstratas.

Static Public Attributes

static const unsigned int DEFAULT_PERM = 0666

Private Attributes

char filename [MAXNAMELEN]
int fd

Detailed Description

Definition at line 51 of file FileObject.h.


Constructor & Destructor Documentation

LocalFileObject::LocalFileObject ( char *  name  ) 

Definition at line 56 of file FileObject.cpp.

00057 {
00058     strcpy( this->filename, filename );
00059 }


Member Function Documentation

int LocalFileObject::Close (  )  [virtual]

Implements FileObject.

Definition at line 69 of file FileObject.cpp.

00070 {
00071     return close( fd );
00072 }

RioObjectSize LocalFileObject::getSize (  )  [virtual]

Implements FileObject.

Definition at line 84 of file FileObject.cpp.

00085 {
00086     #ifndef WINDOWS
00087     loff_t size;
00088     loff_t curPos;
00089     //unsigned int poshigh,poslow;
00090     //syscall( __NR__llseek, fd, 0, 0, &curPos, SEEK_CUR );
00091     //poshigh = (curPos >> 32 ) & 0xffffffff;
00092     //poslow  = (curPos) & 0xffffffff;
00093     //syscall( __NR__llseek, fd, 0, 0, &size, SEEK_END );
00094     //syscall( __NR__llseek, fd, poshigh, poslow, &curPos, SEEK_SET );
00095     curPos = lseek64( fd, 0, SEEK_CUR );
00096     size = lseek64( fd, 0, SEEK_END );
00097     curPos = lseek64( fd, curPos, SEEK_SET );
00098     #else
00099         #ifdef __RIO_IRIX
00100         off64_t curPos;
00101         off64_t size;
00102         curPos = lseek64( fd, 0, SEEK_CUR );
00103         size=lseek64( fd, 0, SEEK_END );
00104         lseek( fd, curPos, SEEK_SET );
00105         #else
00106         offset_t curPos;
00107         offset_t size;
00108         curPos = llseek( fd, 0, SEEK_CUR );
00109         size=llseek( fd, 0, SEEK_END );
00110         llseek( fd, curPos, SEEK_SET );
00111         #endif
00112     #endif
00113     return size;
00114 }

bool LocalFileObject::getVideoRate ( unsigned int *  VideoRate  )  [virtual]

GetVideoRate retorna a taxa de transmissao (em Kbps) de video default (pois os arquivos locais nao possuem uma taxa de video).

Parameters:
VideoRate ponteiro para o inteiro nao sinalizado que armazenara a taxa de transmissao do video.
Returns:
sempre sera true.

Implements FileObject.

Definition at line 122 of file FileObject.cpp.

00123 {
00124     *VideoRate = DEFAULTVIDEORATE;
00125     return true;
00126 }

bool LocalFileObject::Open ( unsigned int  mode,
char *  md5sum = NULL 
) [virtual]

Implements FileObject.

Definition at line 62 of file FileObject.cpp.

00063 {
00064     fd = open( filename, mode, DEFAULT_PERM );
00065 
00066     return ( fd != -1 );
00067 }

int LocalFileObject::Read ( char *  buf,
int  size 
) [virtual]

Implements FileObject.

Definition at line 74 of file FileObject.cpp.

00075 {
00076     return read( fd, buf, size );
00077 }

bool LocalFileObject::setVideoRate ( unsigned int  VideoRate  )  [virtual]

SetVideoRate Esta funcao nao faz nada e somente e definida porque precisamos definir todas as funcoes abstratas.

Parameters:
VideoRate nao usado.
Returns:
sempre true.

Implements FileObject.

Definition at line 130 of file FileObject.cpp.

00131 {
00132     return true;
00133 }

int LocalFileObject::Write ( char *  buf,
int  size,
char *  md5sum 
) [virtual]

Implements FileObject.

Definition at line 79 of file FileObject.cpp.

00080 {
00081     return write(fd, buf, size);
00082 }


Field Documentation

const unsigned int LocalFileObject::DEFAULT_PERM = 0666 [static]

Definition at line 62 of file FileObject.h.

int LocalFileObject::fd [private]

Definition at line 86 of file FileObject.h.

char LocalFileObject::filename[MAXNAMELEN] [private]

Definition at line 85 of file FileObject.h.


The documentation for this class was generated from the following files:
Generated on Wed Jul 4 16:03:35 2012 for RIO by  doxygen 1.6.3