#include <StreamFile.h>
Inheritance diagram for mx::StreamFile:
Public Member Functions | |
mxm::smart< mxmStringList > | enumerateInterfaces () |
(Re)implemented. | |
mxm::smart< mxmStringList > | enumerateCapabilities (const mxmString &interface) |
(Re)implemented. | |
void | setFilename (const mxmString &filename) |
[Config Phase] (Re)implemented. | |
void | setFileDescriptor (int fd) |
[Config Phase] (Re)implemented. | |
void | setWriteMode (bool enabled) |
[Config Phase] Specifies whether the file should be opened for reading or for writing, | |
void | setTimedBlockModeEnabled (bool enabled, long timeout=1000) |
Toggles/configures the timed block mode, see above. | |
int | fetchStreamBytes (mxm::u8 *buffer, int num) |
(Re)implemented. | |
bool | stillUp (void) |
(Re)implemented. | |
void | receiveStreamBytes (const mxm::u8 *bytes, int byte_num) |
(Re)implemented. | |
bool | errorState () |
(Re)implemented. | |
void | setErrorState () |
(Re)implemented. | |
void | shutdown () |
(Re)implemented. | |
bool | activate () |
(Re)implemented. | |
Static Public Member Functions | |
static IComponentInvoker * | newInvoker () |
Generates an invoker singleton for the StreamFile component. | |
Private Member Functions | |
void | closeFile () |
Helper - just closes file, must be called only once! | |
Static Private Member Functions | |
static mxm::smart< mxmStringList > | _enumerateInterfaces () |
These static methods provide interface and capability ids for registration with the framework (for both the component and its invoker). | |
static mxm::smart< mxmStringList > | _enumerateCapabilities (const mxmString &interface) |
Private Attributes | |
mxmString | Filename |
int | FileDescriptor |
bool | WriteMode |
bool | Online |
int | FD |
bool | StillUp |
bool | ErrorEncountered |
bool | HasBeenShutDown |
bool | CloseFileUponDestruction |
bool | TimedBlockMode |
long | BlockTimeout |
Classes | |
class | Invoker |
If invoked by specifying a filename to the constructor, the respective file is automatically opened. It is also automatically closed again when the stream file is deleted later.
If, on the other hand, the stream file is invoked by specifying a POSIX
file descriptor to the constructor, the file descriptor is used instead. Note that in this case the corresponing file is not closed upon stream file destruction.
The stream file sports a so-called Timed Block Mode that can be toggled at any time using the setTimedBlockModeEnabled() method. If enabled, a UNIX select()
call is issued prior to read attempts on the encapsuled file descriptor using the specified timeout. This causes the fetchBytes() implementation to block in the kernel if no data is available, but at most for that many milliseconds as was specified to setTimedBlockModeEnabled(). If such a blocking times out before any new data come in over the file descriptor, fetchBytes() returns with a return value of 0
.
As usual, with Microsoft
happily adding non-POSIX
flags to POSIX
interfaces, we have to provide a modified implementation for the WINDOWS
platform.
Shut-down mode was retrofitted: potential file gets closed, then the object won't do anything any more except for indicating error state.
[khe]
Kai Hergenroether
|
[Config Phase] Specifies whether the file should be opened for reading or for writing,
Default is |