libassetmap  1.0.0
Hash-table based archive format containing compressed data
Classes | Public Member Functions | List of all members
AssetMap::MemMappedBucket Class Reference

Public Member Functions

 MemMappedBucket (uint8_t *begin, uint8_t *bucketsTbl, lam_size_t id, IDecompress &decomp) noexcept
 Constructs a bucket over existing data. More...
 
 MemMappedBucket (uint8_t *begin, uint8_t *bucketsTbl, ptrdiff_t offset, lam_size_t bucketId, ICompress &comp) noexcept
 Initialises an empty bucket at the given location. More...
 
MemMappedBucketEntry Append () noexcept
 Returns an empty entry instance intended to be populated. More...
 
MemMappedBucketEntry operator[] (std::string_view name) const
 Finds an entry in this bucket with the given name. More...
 
Iterator begin () const noexcept
 Returns an iterator to the beginning of the bucket. More...
 
Iterator end () const noexcept
 Returns an iterator to one-past-the-end as for C++ iterators. More...
 

Constructor & Destructor Documentation

◆ MemMappedBucket() [1/2]

AssetMap::MemMappedBucket::MemMappedBucket ( uint8_t *  begin,
uint8_t *  bucketsTbl,
lam_size_t  id,
IDecompress &  decomp 
)
noexcept

Constructs a bucket over existing data.

Postcondition
Attempting to Append() new entries after using this constructor results in undefined behaviour. The IDecompress instance and data must live as long as this instance and any objects obtained through it.
Parameters
beginA pointer to the start of the Bucket
bucketsTblA pointer to the start of the bucket offset table
idThe valid index of the bucket in the buckets table.
decompAn IDecompress instance to use for decompression.

◆ MemMappedBucket() [2/2]

AssetMap::MemMappedBucket::MemMappedBucket ( uint8_t *  begin,
uint8_t *  bucketsTbl,
ptrdiff_t  offset,
lam_size_t  bucketId,
ICompress &  comp 
)
noexcept

Initialises an empty bucket at the given location.

Postcondition
The ICompress instance and data must live as long as this instance and any objects obtained through it.
Parameters
beginA pointer to the start of the Bucket
bucketsTblA pointer to the start of the bucket offset table
idThe valid index of the bucket in the buckets table.
decompAn ICompress instance to use for decompression.

Member Function Documentation

◆ Append()

MemMappedBucketEntry AssetMap::MemMappedBucket::Append ( )
noexcept

Returns an empty entry instance intended to be populated.

Returns
An entry object with zero size and no name.

◆ begin()

Iterator AssetMap::MemMappedBucket::begin ( ) const
noexcept

Returns an iterator to the beginning of the bucket.

Returns
an iterator to the beginning or end() if empty.

◆ end()

Iterator AssetMap::MemMappedBucket::end ( ) const
noexcept

Returns an iterator to one-past-the-end as for C++ iterators.

Returns
The one-past-the-end iterator.

◆ operator[]()

MemMappedBucketEntry AssetMap::MemMappedBucket::operator[] ( std::string_view  name) const

Finds an entry in this bucket with the given name.

Postcondition
If the entry does not exist, the implementation will return either an instance explicitly convertible to bool false or an entry with the wrong name. You must check for both cases if you do not know whether the name exists.
Parameters
nameThe name of the entry to return.
Returns
Either the found entry or one of the post-condition cases.

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