iceberg-cpp
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
iceberg::PartitionMap< V > Class Template Reference

A map that uses a pair of spec ID and partition tuple as keys. More...

#include <partition_value_util.h>

Public Types

using map_type = std::unordered_map< PartitionKey, V, PartitionKeyHash, PartitionKeyEqual >
 
using iterator = typename map_type::iterator
 
using const_iterator = typename map_type::const_iterator
 

Public Member Functions

size_t size () const
 Get the number of entries in the map.
 
bool empty () const
 Check if the map is empty.
 
void clear ()
 Clear all entries from the map.
 
bool contains (int32_t spec_id, const PartitionValues &values) const
 Check if the map contains a key.
 
std::optional< std::reference_wrapper< V > > get (int32_t spec_id, const PartitionValues &values)
 Get the value associated with a key.
 
std::optional< std::reference_wrapper< const V > > get (int32_t spec_id, const PartitionValues &values) const
 Get the value associated with a key (const version).
 
bool put (int32_t spec_id, PartitionValues values, V value)
 Insert or update a value in the map.
 
bool remove (int32_t spec_id, const PartitionValues &values)
 Remove an entry from the map.
 
iterator begin ()
 Get iterator to the beginning.
 
const_iterator begin () const
 
const_iterator cbegin () const
 
iterator end ()
 Get iterator to the end.
 
const_iterator end () const
 
const_iterator cend () const
 

Detailed Description

template<typename V>
class iceberg::PartitionMap< V >

A map that uses a pair of spec ID and partition tuple as keys.

Template Parameters
Vthe type of values

Member Function Documentation

◆ contains()

template<typename V >
bool iceberg::PartitionMap< V >::contains ( int32_t  spec_id,
const PartitionValues values 
) const
inline

Check if the map contains a key.

Parameters
spec_idThe partition spec ID.
valuesThe partition values.
Returns
true if the key exists, false otherwise.

◆ get() [1/2]

template<typename V >
std::optional< std::reference_wrapper< V > > iceberg::PartitionMap< V >::get ( int32_t  spec_id,
const PartitionValues values 
)
inline

Get the value associated with a key.

Parameters
spec_idThe partition spec ID.
valuesThe partition values.
Returns
Reference to the value if found, std::nullopt otherwise.

◆ get() [2/2]

template<typename V >
std::optional< std::reference_wrapper< const V > > iceberg::PartitionMap< V >::get ( int32_t  spec_id,
const PartitionValues values 
) const
inline

Get the value associated with a key (const version).

Parameters
spec_idThe partition spec ID.
valuesThe partition values.
Returns
Reference to the value if found, std::nullopt otherwise.

◆ put()

template<typename V >
bool iceberg::PartitionMap< V >::put ( int32_t  spec_id,
PartitionValues  values,
value 
)
inline

Insert or update a value in the map.

Parameters
spec_idThe partition spec ID.
valuesThe partition values.
valueThe value to insert.
Returns
true if the entry was updated, false if it was inserted.

◆ remove()

template<typename V >
bool iceberg::PartitionMap< V >::remove ( int32_t  spec_id,
const PartitionValues values 
)
inline

Remove an entry from the map.

Parameters
spec_idThe partition spec ID.
valuesThe partition values.
Returns
true if the entry was removed, false if it didn't exist.

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