UA Server SDK C++ Bundle  1.4.1.271
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
UaIODevice Class Referenceabstract

The UaIODevice class is the base interface class of all I/O devices. More...

#include <uaiodevice.h>

Inherited by UaFile.

Public Types

enum  OpenModeFlag { ,
  OpenModeRead = 0x01, OpenModeWrite = 0x02, OpenModeEraseExisiting = 0x04, OpenModeAppend = 0x08,
  OpenModeText = 0x10
}
 OpenMode enumeration. More...
 

Public Member Functions

virtual OpcUa_Boolean open (OpenMode mode)=0
 Open a file in the mode specified. More...
 
virtual void close ()=0
 Close a file the was opened before with. More...
 
virtual OpcUa_Int64 pos () const =0
 Return the current position to read or write. More...
 
virtual OpcUa_Boolean seek (OpcUa_Int64 pos)=0
 Set the current position to the position specified. More...
 
virtual OpcUa_Int64 size () const =0
 Returns the size of the file. More...
 
virtual OpcUa_Int64 read (char *data, OpcUa_Int64 maxSize)=0
 Reads data from a file opened with open(). More...
 
virtual OpcUa_Int64 write (const char *data, OpcUa_Int64 size)=0
 Write data to a file opened with open(). More...
 

Detailed Description

The UaIODevice class is the base interface class of all I/O devices.

Member Enumeration Documentation

OpenMode enumeration.

Enumerator
OpenModeRead 

Open the file for reading.

OpenModeWrite 

Open the file for writing. This creates a new file if the file does not exist.

OpenModeEraseExisiting 

If the file is opened for writing the existing content of the file is erased and an empty file is provided.

OpenModeAppend 

The file is opened at the end of the file.

OpenModeText 

Open the file in text mode - default is binary.

Member Function Documentation

virtual void UaIODevice::close ( )
pure virtual

Close a file the was opened before with.

See Also
open()

Implemented in UaFile.

virtual OpcUa_Boolean UaIODevice::open ( OpenMode  mode)
pure virtual

Open a file in the mode specified.

Returns true on success; otherwise returns false.

Parameters
modeIndicates whether the file should be opened only for read operations or for read and write operations and where the initial position is set.
Returns
true if successful false if not.
See Also
close()

Implemented in UaFile.

virtual OpcUa_Int64 UaIODevice::pos ( ) const
pure virtual

Return the current position to read or write.

Returns true on success; otherwise returns false.

Returns
true if successful false if not.

Implemented in UaFile.

virtual OpcUa_Int64 UaIODevice::read ( char *  data,
OpcUa_Int64  maxSize 
)
pure virtual

Reads data from a file opened with open().

Parameters
dataA buffer to store the read data.
maxSizeThe number of elements to read. One element has the size of one char.
Returns
The number of elements read. If this number differs from maxSize, either an error occured or the end of the file has been reached.
See Also
write()

Implemented in UaFile.

virtual OpcUa_Boolean UaIODevice::seek ( OpcUa_Int64  pos)
pure virtual

Set the current position to the position specified.

Returns true on success; otherwise returns false.

Parameters
posthe position to set. If pos is bigger than the end of the file seek() sets the position to the end of the file.
Returns
true if successful false if not.
See Also
pos()

Implemented in UaFile.

virtual OpcUa_Int64 UaIODevice::size ( ) const
pure virtual

Returns the size of the file.

Returns
The number of bytes of the file size. Or -1 if the operation fails.

Implemented in UaFile.

virtual OpcUa_Int64 UaIODevice::write ( const char *  data,
OpcUa_Int64  size 
)
pure virtual

Write data to a file opened with open().

Parameters
dataA buffer to store the read data.
sizeThe number of elements to write. One element has the size of one char.
Returns
The number of elements successfully written. If this number differs from size an error occured.
See Also
read()

Implemented in UaFile.


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