#include <sfile.h>
Inheritance diagram for PStructuredFile:
Structure definition functions | |
enum | ElementType { Character, Integer16, Integer32, Integer64, Float32, Float64, Float80, NumElementTypes } |
All element types in a structure. More... | |
PINDEX | GetStructureSize () |
void | SetStructure (Element *structure, PINDEX numElements) |
Public Types | |
Public Member Functions | |
Construction | |
PStructuredFile () | |
PStructuredFile (OpenMode mode, int opts=ModeDefault) | |
PStructuredFile (const PFilePath &name, OpenMode mode=ReadWrite, int opts=ModeDefault) | |
Structured I/O functions | |
BOOL | Read (void *buffer) |
BOOL | Write (const void *buffer) |
Protected Attributes | |
PINDEX | structureSize |
Number of bytes in structure. | |
Element * | structure |
Array of elements in the structure. | |
PINDEX | numElements |
Number of elements in the array. |
This differs from object serialisation in that the access is always to a disk file and is random access. It would primarily be used for database type applications.
|
All element types in a structure.
|
|
Create a structured file object but do not open it. It does not initially have a valid file name. However, an attempt to open the file using the #PFile::Open()# function will generate a unique temporary file. The initial structure size is one byte. |
|
Create a unique temporary file name, and open the file in the specified mode and using the specified options. Note that opening a new, unique, temporary file name in ReadOnly mode will always fail. This would only be usefull in a mode and options that will create the file. The #PChannel::IsOpen()# function may be used after object construction to determine if the file was successfully opened.
|
|
Create a structured file object with the specified name and open it in the specified mode and with the specified options. The #PChannel::IsOpen()# function may be used after object construction to determine if the file was successfully opened.
|
|
Get the size of each structure in the file.
|
|
Read a sequence of bytes into the specified buffer, translating the structure according to the specification made in the #SetStructure()# function.
|
|
Set the structure of each record in the file.
|
|
Write a sequence of bytes into the specified buffer, translating the structure according to the specification made in the #SetStructure()# function.
|
|
Number of elements in the array.
|
|
Array of elements in the structure.
|
|
Number of bytes in structure.
|