ApparatusFramework::WinFile Class Reference
[Device Services]

#include <DeviceServices/Win32/current/include/WinFile.h>

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

List of all members.

Public Member Functions

 WinFile ()
virtual ~WinFile ()
virtual void opened (FILE *pFileHandle, WinFileSys *pFileSys)
virtual int32 close ()
virtual int32 getVersion ()
virtual int32 read (uint8 *buffer, const int32 count)
virtual int32 write (uint8 *buffer, const int32 count)
virtual int32 ioCtl (uint32 cmd, void *arg)
virtual int32 seek (uint32 offset, SeekWhenceEnum whence)
virtual void flush ()

Detailed Description

Interface to a file as used in the apparatus services framework.

Definition at line 56 of file WinFile.h.


Constructor & Destructor Documentation

ApparatusFramework::WinFile::WinFile (  ) 

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.
virtual ApparatusFramework::WinFile::~WinFile (  )  [virtual]

Destructs a file. Closes it if needed.


Member Function Documentation

virtual int32 ApparatusFramework::WinFile::close (  )  [virtual]

interface methods 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::File.

virtual void ApparatusFramework::WinFile::flush (  )  [virtual]

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

Implements ApparatusFramework::File.

virtual int32 ApparatusFramework::WinFile::getVersion (  )  [virtual]

This method is not supported by the windows file system and will always return 0.

Returns:
Always 0.

Implements ApparatusFramework::File.

virtual int32 ApparatusFramework::WinFile::ioCtl ( uint32  cmd,
void *  arg 
) [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::File.

virtual void ApparatusFramework::WinFile::opened ( FILE *  pFileHandle,
WinFileSys pFileSys 
) [virtual]

Tells the file that is has been opened, used by the corresponding file system.

Parameters:
pFileHandle The handle as provided by the windows file system
pFileSys Pointer to the windows file system. Used to notify close.
virtual int32 ApparatusFramework::WinFile::read ( uint8 buffer,
const int32  count 
) [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.
  • >=0: Number of characters read
  • <0: error code. See CharDeviceRetVal

Implements ApparatusFramework::File.

virtual int32 ApparatusFramework::WinFile::seek ( uint32  offset,
SeekWhenceEnum  whence 
) [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.
  • >=0: The new offset
  • <0: error code. See CharDeviceRetVal

Implements ApparatusFramework::File.

virtual int32 ApparatusFramework::WinFile::write ( uint8 buffer,
const int32  count 
) [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.
  • >=0: Number of characters written
  • <0: error code. See CharDeviceRetVal

Implements ApparatusFramework::File.

© 2004-2010 bbv Software Services AG / Apparatus Services