Blender V4.3
blender::GenericKey Class Referenceabstract

#include <BLI_generic_key.hh>

Inherited by blender::memory_cache::tests::GenericIntKey.

Public Member Functions

virtual ~GenericKey ()=default
 
virtual uint64_t hash () const =0
 
virtual bool equal_to (const GenericKey &other) const =0
 
virtual std::unique_ptr< GenericKeyto_storable () const =0
 

Friends

bool operator== (const GenericKey &a, const GenericKey &b)
 
bool operator!= (const GenericKey &a, const GenericKey &b)
 

Detailed Description

A #GenericKey allows different kinds of keys to be used in the same data-structure like a #Set or #Map.

Typically, the key is stored as std::reference_wrapper<const GenericKey> in the data-structure. That implies that one has to make sure that the key is not destructed while it's still in use.

Definition at line 25 of file BLI_generic_key.hh.

Constructor & Destructor Documentation

◆ ~GenericKey()

virtual blender::GenericKey::~GenericKey ( )
virtualdefault

Member Function Documentation

◆ equal_to()

virtual bool blender::GenericKey::equal_to ( const GenericKey & other) const
pure virtual

Check if the other key is equal to this one. Usually that involves a dynamic_cast to check if it has the same type.

Implemented in blender::memory_cache::tests::GenericIntKey.

◆ hash()

virtual uint64_t blender::GenericKey::hash ( ) const
pure virtual

The hash function has to be implemented by the non-abstract subclass.

Implemented in blender::memory_cache::tests::GenericIntKey.

◆ to_storable()

virtual std::unique_ptr< GenericKey > blender::GenericKey::to_storable ( ) const
pure virtual

For efficiency, it can be good to not always allocate the key if it's just used for lookup. This method allows the key to be converted into a heap-allocated version that can be stored safely if necessary.

Implemented in blender::memory_cache::tests::GenericIntKey.

Referenced by blender::memory_cache::get_base().

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const GenericKey & a,
const GenericKey & b )
friend

Definition at line 53 of file BLI_generic_key.hh.

◆ operator==

bool operator== ( const GenericKey & a,
const GenericKey & b )
friend

Definition at line 45 of file BLI_generic_key.hh.


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