File Class Reference

#include <File.h>

List of all members.

Public Member Functions

 File (const char *name, const char *mode)
 ~File ()
void read (void *p, unsigned size)
void write (const void *p, unsigned size)
void printf (const char *format,...)
bool exists () const
bool eof () const
 File (const char *name, const char *mode)
 ~File ()
void read (void *p, unsigned size)
void write (const void *p, unsigned size)
void printf (const char *format,...)
bool exists () const
bool eof () const
 File (const char *name, const char *mode)
 ~File ()
void read (void *p, unsigned size)
void write (const void *p, unsigned size)
void printf (const char *format,...)
bool exists () const
bool eof ()

Static Public Member Functions

static char * getGTDir ()
static char * getGTDir ()
static char * getGTDir ()

Private Attributes

OFS::FILE * stream
char buf [65536]
unsigned int bufSize
unsigned int index
bool isWrite
FILE * stream
FILE * stream


Detailed Description

This class provides basic file input/output capabilies.

Definition at line 20 of file File.h.


Constructor & Destructor Documentation

File::File ( const char *  name,
const char *  mode 
)

Constructor.

Parameters:
name File name or path. If it is a relative path, it is assumed to be relative to the path for configuration files. Otherwise, the path is used directly.
mode File open mode as used by fopen defined in stdio.h.

Definition at line 14 of file File.cpp.

References ASSERT, buf, bufSize, getGTDir(), index, isWrite, and stream.

File::~File (  ) 

Destructor.

Definition at line 32 of file File.cpp.

References buf, index, isWrite, stream, and VERIFY.

File::File ( const char *  name,
const char *  mode 
) [inline]

Constructor.

Parameters:
name File name or path. If it is a relative path, it is assumed to be relative to the path for configuration files. Otherwise, the path is used directly.
mode File open mode as used by fopen defined in stdio.h.

Definition at line 30 of file File.h.

References ASSERT, buf, getGTDir(), and stream.

File::~File (  )  [inline]

Destructor.

Definition at line 46 of file File.h.

References stream.

File::File ( const char *  name,
const char *  mode 
)

Constructor.

Parameters:
name File name or path. If it is a relative path, it is assumed to be relative to the path for configuration files. Otherwise, the path is used directly.
mode File open mode as used by fopen defined in stdio.h.

File::~File (  ) 

Destructor.


Member Function Documentation

bool File::eof (  ) 

The function returns whether the end of the file represented by an object of this class was reached.

Returns:
End of file reached?

Definition at line 52 of file File.cpp.

References stream, and VERIFY.

bool File::eof (  )  const [inline]

The function returns whether the end of the file represented by an object of this class was reached.

Returns:
End of file reached?

Definition at line 92 of file File.h.

References stream.

bool File::eof (  )  const

The function returns whether the end of the file represented by an object of this class was reached.

Returns:
End of file reached?

Definition at line 83 of file File.cpp.

References bufSize, index, and stream.

Referenced by InFile::getEof(), and read().

bool File::exists (  )  const [inline]

The function returns whether the file represented by an object of this class actually exists.

Returns:
The existence of the file.

Definition at line 62 of file File.h.

References stream.

bool File::exists (  )  const [inline]

The function returns whether the file represented by an object of this class actually exists.

Returns:
The existence of the file.

Definition at line 85 of file File.h.

References stream.

bool File::exists (  )  const [inline]

The function returns whether the file represented by an object of this class actually exists.

Returns:
The existence of the file.

Definition at line 72 of file File.h.

References stream.

Referenced by OutFile::exists(), and InFile::exists().

static char* File::getGTDir (  )  [static]

The function returns the current GT directory, e.g. /MS/OPENR/APP or <...>/GT2003 or /usr/local/GT2003

Returns:
The current GTDir

static char* File::getGTDir (  )  [inline, static]

The function returns the current GT directory, e.g. /MS/OPENR/APP or <...>/GT2003 or /usr/local/GT2003

Returns:
The current GTDir

Definition at line 99 of file File.h.

char * File::getGTDir (  )  [static]

The function returns the current GT directory, e.g. /MS/OPENR/APP or <...>/GT2003 or /usr/local/GT2003

Returns:
The current GTDir

Definition at line 92 of file File.cpp.

Referenced by CTacticDesignerDlgBar::AddFromFile(), RoboCupCtrl::connect(), CWLANDeployDialog::copyStick(), CWLANDeployDialog::copyWLAN(), CRobotControlSimulatedRobots::create(), CTimeDiagramDlgBar::exportToFileAsCSV(), File(), generateHeadTailXml(), generateKickSelectionXml(), generateLEDSoundXml(), generateMatlabIDs(), generateMotionNet(), generateSpecialActionXml(), CWLANDeployDialog::getAiboName(), CLogPlayerToolBar::handleCommand(), CSettingsDlgBar::loadSettings(), main(), RobotConsole::msg(), CKickEditorDlgBar::OnContextMenu(), CWLANConfigurationDialog::OnCopy(), CColorTable64DlgBar::OnCt64Open(), CColorTable64DlgBar::OnCt64Save(), CHSIColorTableToolDlgBar::OnHsicolortabletoolLoadcolortableButton(), CHSIColorTableToolDlgBar::OnHsicolortabletoolSavecolortableButton(), CKickEditorDlgBar::OnOpen(), CWLANDeployDialog::OnRefreshAll(), CKickEditorDlgBar::OnSave(), CGT2004WalkingEngineParamSetDlgBar::OnSave(), CTacticDesignerDlgBar::OnSaveButton(), CSettingsDlgBar::OnSettingsDelete(), CSettingsDlgBar::OnSettingsRename(), CWLANDeployDialog::OnSnapshot(), CTSLColorTableToolDlgBar::OnTSLColorTableToolLoad(), CTSLColorTableToolDlgBar::OnTSLColorTableToolSave(), CTSLColorTableToolDlgBar::OnTSLColorTableToolSaveYUV(), CInvKinParametersDlgBar::OnWalkParamLoad(), CInvKinParametersDlgBar::OnWalkParamSave(), CInvKinParametersDlgBar::OnWriteLogFile(), CXABSL2ProfilerDlgBar::OnXabsl2profilerExportxmlButton(), CXABSL2ProfilerDlgBar::OnXabsl2profilerLoadlogButton(), parseExternMof(), parseMofs(), CWLANDeployDialog::prepareImage(), CInvKinParametersDlgBar::readContextMenu(), CPing::readOutARP(), CWLANDeployDialog::refreshBinaryCombo(), CWLANDeployDialog::refreshColortableCombo(), CKickEditorDlgBar::reloadCaseBase(), CValueHistoryDlgBar::saveAllCSV(), CJointViewerDlgBar::saveAllCSV(), CJointViewerDlgBar::saveAsCSV(), CJointViewerDlgBar::saveFTSpectrum(), RouterCtrl::start(), RouterCtrl::stop(), usage(), and CPing::WIN32GetMAC().

void File::printf ( const char *  format,
  ... 
)

The function implements printf for the stream represented by instances of this class.

Parameters:
format Format string as used by printf defined in stdio.h.
... See printf in stdio.h.

void File::printf ( const char *  format,
  ... 
) [inline]

The function implements printf for the stream represented by instances of this class.

Parameters:
format Format string as used by printf defined in stdio.h.
... See printf in stdio.h.

Definition at line 72 of file File.h.

References stream.

void File::printf ( const char *  format,
  ... 
)

The function implements printf for the stream represented by instances of this class.

Parameters:
format Format string as used by printf defined in stdio.h.
... See printf in stdio.h.

Definition at line 74 of file File.cpp.

References ASSERT, index, and stream.

void File::read ( void *  p,
unsigned  size 
)

The function read a number of bytes from the file to a certain memory location.

Parameters:
p The start of the memory space the data is written to.
size The number of bytes read from the file.

void File::read ( void *  p,
unsigned  size 
) [inline]

The function read a number of bytes from the file to a certain memory location.

Parameters:
p The start of the memory space the data is written to.
size The number of bytes read from the file.

Definition at line 54 of file File.h.

References eof(), stream, and VERIFY.

void File::read ( void *  p,
unsigned  size 
)

The function read a number of bytes from the file to a certain memory location.

Parameters:
p The start of the memory space the data is written to.
size The number of bytes read from the file.

Definition at line 42 of file File.cpp.

References ASSERT, buf, bufSize, index, isWrite, and stream.

Referenced by InFile::readFromStream().

void File::write ( const void *  p,
unsigned  size 
)

The function writes a number of bytes from a certain memory location into the file.

Parameters:
p The start of the memory space the data is read from.
size The number of bytes written into the file.

void File::write ( const void *  p,
unsigned  size 
) [inline]

The function writes a number of bytes from a certain memory location into the file.

Parameters:
p The start of the memory space the data is read from.
size The number of bytes written into the file.

Definition at line 63 of file File.h.

References stream, and VERIFY.

void File::write ( const void *  p,
unsigned  size 
)

The function writes a number of bytes from a certain memory location into the file.

Parameters:
p The start of the memory space the data is read from.
size The number of bytes written into the file.

Definition at line 60 of file File.cpp.

References buf, index, stream, and VERIFY.

Referenced by OutFile::writeToStream().


Member Data Documentation

char File::buf[65536] [private]

A buffer to reduce the number of operation system calls.

Definition at line 24 of file File.h.

Referenced by File(), read(), write(), and ~File().

unsigned int File::bufSize [private]

The number of bytes in the buffer while reading.

Definition at line 25 of file File.h.

Referenced by eof(), File(), and read().

unsigned int File::index [private]

The next byte in the buffer to read/write.

Definition at line 25 of file File.h.

Referenced by eof(), File(), printf(), read(), write(), and ~File().

bool File::isWrite [private]

Is this a write stream?

Definition at line 27 of file File.h.

Referenced by File(), read(), and ~File().

FILE* File::stream [private]

File handle.

Definition at line 18 of file File.h.

FILE* File::stream [private]

File handle.

Definition at line 21 of file File.h.

OFS::FILE* File::stream [private]

File handle.

Definition at line 23 of file File.h.

Referenced by eof(), exists(), File(), printf(), read(), write(), and ~File().


The documentation for this class was generated from the following files:
Generated on Thu Dec 7 01:31:39 2006 for DT2005.panorama by  doxygen 1.4.7