Main Page Namespace List Compound List File List Namespace Members Compound Members

# nFANTOM100::iFile Class Reference

Interface to a file on a LEGO MINDSTORMS NXT. More...

`#include <iFile.h>`

List of all members.

## Public Methods

virtual void | getName (ViChar fileName[]) const=0
| Retrieves the name of this file. More...
virtual ViUInt32 | getSize (tStatus &status)=0
| Retrieves the total size of this file in bytes. More...
virtual ViUInt32 | getAvailableSize (tStatus &status)=0
| Retrieves the remaining available size, in bytes, in this file. More...
virtual void | openForRead (tStatus &status)=0
| Opens this file for reading. More...
virtual void | openForWrite (ViUInt32 sizeInBytes, tStatus &status)=0
| Open this file for writing. More...
virtual void | openForLinearWrite (ViUInt32 sizeInBytes, tStatus &status)=0
| Open this file for linear (contiguous) writing. More...
virtual void | openForDataWrite (ViUInt32 sizeInBytes, tStatus &status)=0
| Open this data file for writing. More...
virtual void | openForDataAppend (tStatus &status)=0
| Open this data file for appending additional data. More...
virtual void | close (tStatus &status)=0
| Closes this file. More...
virtual ViUInt32 | read (ViPBuf bufferPtr, ViUInt32 numberOfBytes, tStatus &status)=0
| Reads from this file. More...
virtual ViUInt32 | write (const ViByte bufferPtr[], ViUInt32 numberOfBytes, tStatus &status)=0
| Writes to this file. More...
virtual void | remove (tStatus &status)=0
| Removes this file. More...

## Protected Methods

virtual | ~iFile ()=0
| Destructor.

## Friends

class | tNXT

## Detailed Description

Interface to a file on a LEGO MINDSTORMS NXT.

## Member Function Documentation

virtual void nFANTOM100::iFile::close | ( | tStatus & | status | ) | `[pure virtual]`

Closes this file.

Closes the file that corresponds to this object on the associated NXT. The file is not closed if the specified status is fatal.

Parameters:

  status | Status chaining object.

virtual ViUInt32 nFANTOM100::iFile::getAvailableSize | ( | tStatus & | status | ) | `[pure virtual]`

Retrieves the remaining available size, in bytes, in this file.

This number is only helpful for data logging files, which can contain variable amounts of data. The returned size is undefined if the specified status is fatal.

Parameters:

  status | Status chaining object.

Returns:
  The remaining available size, in bytes, in this file.

virtual void nFANTOM100::iFile::getName | ( | ViChar | fileName[] | ) | const`[pure virtual]`

Retrieves the name of this file.

Parameters:

  fileName | Populated with the name of this file. The file name character array must be able to accomodate a NULL-terminated, 15.3 formatted module name. That is, it must have a capacity of 20 bytes.

virtual ViUInt32 nFANTOM100::iFile::getSize | ( | tStatus & | status | ) | `[pure virtual]`

Retrieves the total size of this file in bytes.

The returned size is undefined if the specified status is fatal.

Parameters:

  status | Status chaining object.

Returns:
  The total size of this file in bytes.

virtual void nFANTOM100::iFile::openForDataAppend | ( | tStatus & | status | ) | `[pure virtual]`

Open this data file for appending additional data.

Opens, for appending additional data, the data file that corresponds to this object on the associated NXT. If this file doesn't exist on the NXT, the behavior is undefined. If this file does exist on the NXT, the data that is written is appended to the end of the exiting data. The file is not opened if the specified status is fatal.

Parameters:

  status | Status chaining object.

virtual void nFANTOM100::iFile::openForDataWrite | ( | ViUInt32 | sizeInBytes,
|  | tStatus & | status
| ) | `[pure virtual]`

Open this data file for writing.

Opens, for writing, the data file that corresponds to this object on the associated NXT. This data file differs from normal files in that a data file can be closed before the entire file has been written. If this file doesn't exist on the NXT, it is created. If this file does exist on the NXT, an error is generated. The file is not opened if the specified status is fatal.

Parameters:

  sizeInBytes | Size of the data, in bytes, that may be written to the file.
  status | Status chaining object.

virtual void nFANTOM100::iFile::openForLinearWrite | ( | ViUInt32 | sizeInBytes,
|  | tStatus & | status
| ) | `[pure virtual]`

Open this file for linear (contiguous) writing.

Opens, for linear (contiguous) writing, the file that corresponds to this object on the associated NXT. If this file doesn't exist on the NXT, it is created. If this file does exist on the NXT, an error is generated. The file is not opened if the specified status is fatal.

Parameters:

  sizeInBytes | Size of the data, in bytes, that will be written to the file.
  status | Status chaining object.

virtual void nFANTOM100::iFile::openForRead | ( | tStatus & | status | ) | `[pure virtual]`

Opens this file for reading.

Opens, for reading, the file that corresponds to this object on the associated NXT. The file is not opened if the specified status is fatal.

Parameters:

  status | Status chaining object.

virtual void nFANTOM100::iFile::openForWrite | ( | ViUInt32 | sizeInBytes,
|  | tStatus & | status
| ) | `[pure virtual]`

Open this file for writing.

Opens, for writing, the file that corresponds to this object on the associated NXT. If this file doesn't exist on the NXT, it is created. If this file does exist on the NXT, an error is generated. The file is not opened if the specified status is fatal.

Parameters:

  sizeInBytes | Size of the data, in bytes, that will be written to this file.
  status | Status chaining object.

virtual ViUInt32 nFANTOM100::iFile::read | ( | ViPBuf | bufferPtr,
|  | ViUInt32 | numberOfBytes,
|  | tStatus & | status
| ) | `[pure virtual]`

Reads from this file.

Reads the specified number of bytes from this file into the specified buffer. No data is read if the specified status is fatal. The ownership of the buffer is not transferred to this file object.

Parameters:

  bufferPtr | A pointer to the buffer that will be populated with the data that is read. The capacity of the specified buffer must be at least the specified number of bytes.
  numberOfBytes | Number of bytes to read.
  status | Status chaining object.

Returns:
  The number of bytes actually read from this file.

Precondition:
  This file must have been opened for reading with the iFile::openForRead method.

Postcondition:
  The specified buffer may be deallocated.

virtual void nFANTOM100::iFile::remove | ( | tStatus & | status | ) | `[pure virtual]`

Removes this file.

Removes the file that corresponds to this object on the associated NXT. The file is not removed if the specified status is fatal.

Parameters:

  status | Status chaining object.

virtual ViUInt32 nFANTOM100::iFile::write | ( | const ViByte | bufferPtr[],
|  | ViUInt32 | numberOfBytes,
|  | tStatus & | status
| ) | `[pure virtual]`

Writes to this file.

Writes the specified number of bytes from the specified buffer to this file. No data is written if the specified status is fatal. The ownership of the buffer is not transferred to this file object.

Parameters:

  bufferPtr | A pointer to the buffer that contains the data that will be written. The capacity of the specified buffer must be at least the specified number of bytes.
  numberOfBytes | Number of bytes to write to this file.
  status | Status chaining object.

Returns:
  The number of bytes actually written to this file.

Precondition:
  This file must have previously been opened for writing.

Postcondition:
  The specified buffer may be deallocated.

The documentation for this class was generated from the following file:

- iFile.h

© Copyright 2005-2006, National Instruments Corporation. All rights reserved.