0% found this document useful (0 votes)
73 views1 page

Buffer Hier

The document describes a class hierarchy for record files and buffer classes used to read and write data from files, with the BufferFile and RecordFile classes at the top level that are specialized by subclasses like FixedLengthBuffer, VariableLengthBuffer, DelimFieldBuffer, and LengthFieldBuffer which add additional functionality. These buffer classes contain methods for initializing the buffer, reading and writing data, and packing and unpacking records based on the specific buffer implementation. The subclasses further specialize the buffer classes to handle fixed-length records, delimited records, and length field-delimited records respectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views1 page

Buffer Hier

The document describes a class hierarchy for record files and buffer classes used to read and write data from files, with the BufferFile and RecordFile classes at the top level that are specialized by subclasses like FixedLengthBuffer, VariableLengthBuffer, DelimFieldBuffer, and LengthFieldBuffer which add additional functionality. These buffer classes contain methods for initializing the buffer, reading and writing data, and packing and unpacking records based on the specific buffer implementation. The subclasses further specialize the buffer classes to handle fixed-length records, delimited records, and length field-delimited records respectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Record Files and the Buffer Class Hierarchy

(code described in Chpts 4-5, Appdx F of "File Structures", 1998) F15-16


BufferFile
Open Read
F1-2
IOBuffer &Buffer; Create Write
Person fstream File; Close Append
char Name[22]; Clear InitBuffer(Delim) uses Rewind
char City[16];
Unpack InitBuffer(LenFld)
char State[3];
char Zip[10]; Pack InitBuffer(FixFld) base class of

F17
uses
F3-4 RecordFile <Person>
IOBuffer contains a Read
operator= Write Append
char *Buffer; int NextByte;
int BufferSize; int Packing; Read Write
int MaxBytes; Pack Unpack F11-12
FixedLengthBuffer
F5-6 Clear ChangeRecordSize
VariableLengthBuffer Read Write
PackFixLen Read SizeOfBuffer ReadHeader
PackDelimited Write operator= WriteHeader
PackLength ReadHeader
WriteHeader F13-14
FixedFieldBuffer
F7-8 Clear NumberOfFields
DelimFieldBuffer int *FieldSize;
F9-10
int MaxFields;
Read Write
Clear LengthFieldBuffer int NumFields; Pack ReadHeader
char Delim;
Pack Unpack Clear int NextField; Unpack WriteHeader
ReadHeader Pack Unpack AddField operator=
WriteHeader

prepared by M. Wainer for CS330

You might also like