template <typename Storage>

class Image

Defined at line 18 of file ../../src/lib/zbitl/include/lib/zbitl/image.h

Forward declaration; defined in image.h.

Public Methods

void Image<Storage> (const View<Storage> & other)

Also copy/move-constructible from the View counterpart type.

This permits implicit conversion from View

<Storage

> to Image

<Storage

>.

The inverse is already implicit in the subclass relationship.

Defined at line 33 of file ../../src/lib/zbitl/include/lib/zbitl/image.h

void Image<Storage> (View<Storage> && other)

Defined at line 34 of file ../../src/lib/zbitl/include/lib/zbitl/image.h

fit::result<Error> clear ()

Updates the underlying storage to hold an empty ZBI. It is valid to call

this method even if the underlying storage does not already represent a

ZBI or is too small to do so; it will attempt to extend the capacity and

write a new container header.

Defined at line 40 of file ../../src/lib/zbitl/include/lib/zbitl/image.h

fit::result<Error, iterator> Append (const zbi_header_t & new_header)

This version of Append reserves enough space in the underlying ZBI to

append an item corresponding to the provided header. The header is

sanitized (via `SanitizeHeader`) with the header.length value preserved,

as it determines the amount of payload space allocated. The sanitized

header is immediately written to the storage and an iterator pointing to

the partially written item is returned to the caller on success. It is

the caller's responsibility to write the desired data to the payload

offset (accessible via the iterator).

If `header.flags` has `ZBI_FLAGS_CRC32` set, then it is the caller's

further responsibility to ensure that `header.crc32` is correct or to use

`EditHeader` later on the returned iterator with a correct value.

Defined at line 54 of file ../../src/lib/zbitl/include/lib/zbitl/image.h

fit::result<Error> Append (zbi_header_t header, ByteView data)

A simpler variation of Append, in which the provided header and payload

data are written to underlying storage up front. `header.length` will

automatically be set as `data.size()`. Moreover, if the ZBI_FLAGS_CRC32

flag is provided, the CRC32 will be automatically computed and set as

well.

Defined at line 126 of file ../../src/lib/zbitl/include/lib/zbitl/image.h

fit::result<Error> Append (zbi_header_t header, ByteView data)

A simpler variation of Append, in which the provided header and payload

data are written to underlying storage up front. `header.length` will

automatically be set as `data.size()`. Moreover, if the ZBI_FLAGS_CRC32

flag is provided, the CRC32 will be automatically computed and set as

well.

Defined at line 126 of file ../../src/lib/zbitl/include/lib/zbitl/image.h

fit::result<Error> Append (zbi_header_t header, ByteView data)

A simpler variation of Append, in which the provided header and payload

data are written to underlying storage up front. `header.length` will

automatically be set as `data.size()`. Moreover, if the ZBI_FLAGS_CRC32

flag is provided, the CRC32 will be automatically computed and set as

well.

Defined at line 126 of file ../../src/lib/zbitl/include/lib/zbitl/image.h

fit::result<Error> Append (zbi_header_t header, ByteView data)

A simpler variation of Append, in which the provided header and payload

data are written to underlying storage up front. `header.length` will

automatically be set as `data.size()`. Moreover, if the ZBI_FLAGS_CRC32

flag is provided, the CRC32 will be automatically computed and set as

well.

Defined at line 126 of file ../../src/lib/zbitl/include/lib/zbitl/image.h

template <typename ViewIterator>
fit::result<ExtendError<ViewIterator>> Extend (ViewIterator first, ViewIterator last)

Extends the underlying ZBI by the items corresponding to an iterator range

another View. As this operation is inherently a copy from that view, a

CopyError of the latter is returned.

The semantics are similar to that of View's Copy(): this is a blind, bulk

copy from [first, last) and the relevant headers are not sanitized or

checked for correctness when written.

Defined at line 171 of file ../../src/lib/zbitl/include/lib/zbitl/image.h

fit::result<Error, iterator> TrimLastItem (iterator item, uint32_t new_length)

The given iterator must be to the last item in the ZBI. Adjust its length

to the given new length, which must be no larger than the space already

accounted for the item when it was appended. On success, the new iterator

at the same item is returned; old iterators to this item are invalidated.

Defined at line 218 of file ../../src/lib/zbitl/include/lib/zbitl/image.h

fit::result<Error> Truncate (iterator new_end)

Remove the given item and all items past it, invalidating any iterators to

those items.

Defined at line 249 of file ../../src/lib/zbitl/include/lib/zbitl/image.h