ApparatusFramework::File Class Reference
[Device Services]

#include <DeviceServices/common/current/include/File.h>

Inheritance diagram for ApparatusFramework::File:
ApparatusFramework::CharDevice ApparatusFramework::WinFile

List of all members.

Public Member Functions

 File ()
virtual ~File ()
int32 open (void *arg=0)
virtual int32 close ()=0
virtual int32 getVersion ()=0
virtual int32 read (uint8 *buffer, const int32 count)=0
virtual int32 write (uint8 *buffer, const int32 count)=0
virtual int32 ioCtl (uint32 cmd, void *arg)=0
virtual int32 seek (uint32 offset, SeekWhenceEnum whence)=0
virtual void flush ()=0

Detailed Description

Interface to a file as used in the apparatus services framework. A file object can not be opened directly and should only be instantiated by a file system. The open method of the file manager can be used to obtain a handle on a file.

Definition at line 65 of file File.h.


Constructor & Destructor Documentation

ApparatusFramework::File::File (  )  [inline]

Construction, destruction Constructs a new file. Nothing more (no opening, configuring etc.)

Note:
: A file should not be constructed by an application directly, but rather by the corresponding file system.

Definition at line 73 of file File.h.

virtual ApparatusFramework::File::~File (  )  [inline, virtual]

Destructs a file. Closes it if needed.

Definition at line 77 of file File.h.


Member Function Documentation

virtual int32 ApparatusFramework::File::close (  )  [pure virtual]

Closes the file, releases resources used for the operation. After another open, the file is ready for access again.

Returns:
Status of the method. See CharDeviceRetVal

Implements ApparatusFramework::CharDevice.

Implemented in ApparatusFramework::WinFile.

virtual void ApparatusFramework::File::flush (  )  [pure virtual]

Writes all internally buffered data onto the file and clears the write and read buffers.

Implements ApparatusFramework::CharDevice.

Implemented in ApparatusFramework::WinFile.

virtual int32 ApparatusFramework::File::getVersion (  )  [pure virtual]

Returns the version of this file. The version number is the one specified when creating a file.

Returns:
The version of this file as specified when created.

Implemented in ApparatusFramework::WinFile.

virtual int32 ApparatusFramework::File::ioCtl ( uint32  cmd,
void *  arg 
) [pure virtual]

Universal method that may be used to configure the device and implement functionality not provided by the interface. The meaning of the different commands executed by this function is entirely device dependent (cmd 1 on device A may be something completely different on device B).

Parameters:
cmd A command that specifies the function to be executed by the method
arg A pointer to an argument passed to the function to be executed
Returns:
Status of the method. See CharDeviceRetVal

Implements ApparatusFramework::CharDevice.

Implemented in ApparatusFramework::WinFile.

int32 ApparatusFramework::File::open ( void *  arg = 0  )  [inline, virtual]

interface methods A file is opened over the FileMgr and not directly here.

Parameters:
arg A void pointer that can be used for whatever one choses (default = null).
Returns:
Status of the method. See CharDeviceRetVal

Implements ApparatusFramework::CharDevice.

Definition at line 84 of file File.h.

References BBV_UNUSED_ARG, and ApparatusFramework::CHAR_DEVICE_GENERIC_FAILURE.

virtual int32 ApparatusFramework::File::read ( uint8 buffer,
const int32  count 
) [pure virtual]

Reads a specified number of characters from the file into a provided buffer. This read method for a file is usually implemented blocking (blocks the calling client).

Parameters:
buffer Pointer to a character buffer. Its the buffer that read will use to fill in the fetched data.
count Number of characters to be read (does not necessarily correspond with the return value).
Returns:
Status of the method.

Implements ApparatusFramework::CharDevice.

Implemented in ApparatusFramework::WinFile.

virtual int32 ApparatusFramework::File::seek ( uint32  offset,
SeekWhenceEnum  whence 
) [pure virtual]

Allows to jump to a certain position. Seek uses an offset that specifies the location from a certain starting point. (e.g. used in files to write onto a specified position). Seek may also be used to find the size of a file (return value of seek(0, SEEK_END)).

Parameters:
offset A number that specifies the amount of chars the wanted position is away from a given starting position (whence defines that).
whence Defines the starting position or how the given index should be interpreted. See SeekWhenceEnum
Returns:
Status of the method.

Implements ApparatusFramework::CharDevice.

Implemented in ApparatusFramework::WinFile.

virtual int32 ApparatusFramework::File::write ( uint8 buffer,
const int32  count 
) [pure virtual]

Writes a specified number of characters from a buffer onto the file.

Parameters:
buffer Pointer to a character buffer. Its the buffer that write takes as data source.
count Number of characters to be taken out of the buffer onto the file.
Returns:
Status of the method.

Implements ApparatusFramework::CharDevice.

Implemented in ApparatusFramework::WinFile.

© 2004-2010 bbv Software Services AG / Apparatus Services