FESF_UTIL2_SOLUTION_HEADER

This structure is the representation of a FESF solution header.

Methods

Constructors

FESF_UTIL2_SOLUTION_HEADER(uint32_t HeaderSize = 0);
Create a new Solution Header.

 

FESF_UTIL2_SOLUTION_HEADER(const FESF_UTIL2_SOLUTION_HEADER &Rhs);

Create a new Solution Header as a COPY of the provided input.

 

FESF_UTIL2_SOLUTION_HEADER(FESF_UTIL2_SOLUTION_HEADER &&Rhs);

Create a new Solution Header with the identical contents (as a MOVE)

SetCurrentLength

void SetCurrentLength(const uint32_t Length);

Sets the size of the header. See notes below.

CurrentLength

uint32_t CurrentLength();

Gets the size of the header. See notes below.

MaxLength

uint32_t MaxLength();

Gets the maximum size of the header. See notes below.

Get

void* Get();

Returns a pointer to the header data. See notes below.

IsValid

bool IsValid();

Returns whether the header is valid.

ReallocateBuffer

void ReallocateBuffer(uint32_t NewSize);

Increases the maximum size available for the header.

Notes

The Solution Header itself is accessed using the .Get method. So, for example, if you successfully call FesfUtil2ReadHeader as follows:

auto theHeader = FesfUtil2ReadHeader("C:\fred\myfile.txt");

The Solution Header that's been read from the file and returned to you can be accessed by:

theHeader.Get()

 

In terms of lengths, note that a Solution Header has two "length" values:

.CurrentLength()

This is the currently used/valid length of the solution header.
When a header is copied or written,
CurrentLength is the number of bytes written. When a header is read, CurrentLength is the number of valid bytes in the header.

.MaxLength()

This is the maximum header size that can be written to the associated file without requiring the header to be extended.

 

When an FESF_UTIL2_SOLUTION_HEADER is instantiated or reallocated (with the ReallocateBuffer method), the HeaderSize provided is used to size the allocated buffer and both MaxLength and CurrentLength are initially set to this size. The CurrentLength can be subsequently updated to less than MaxLength by calling SetCurrentLength().

When a header is read, the header buffer is allocated with MaxLength bytes, and the size of the solution header data that was actually read is indicated by CurrentLength.