Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
dart::HashMap< BaseIterTable > Class Template Reference

#include <hash_table.h>

Inheritance diagram for dart::HashMap< BaseIterTable >:

Public Member Functions

 HashMap (ArrayPtr data)
 
 HashMap (Zone *zone, ArrayPtr data)
 
 HashMap (Object *key, Smi *value, Array *data)
 
template<typename Key >
ObjectPtr GetOrNull (const Key &key, bool *present=nullptr) const
 
template<typename Key >
ObjectPtr GetOrDie (const Key &key) const
 
bool UpdateOrInsert (const Object &key, const Object &value) const
 
template<typename Key >
void UpdateValue (const Key &key, const Object &value) const
 
ObjectPtr InsertOrGetValue (const Object &key, const Object &value_if_absent) const
 
template<typename Key >
ObjectPtr InsertNewOrGetValue (const Key &key, const Object &value_if_absent) const
 
template<typename Key >
bool Remove (const Key &key) const
 
void Clear () const
 

Protected Member Functions

void EnsureCapacity () const
 

Detailed Description

template<typename BaseIterTable>
class dart::HashMap< BaseIterTable >

Definition at line 692 of file hash_table.h.

Constructor & Destructor Documentation

◆ HashMap() [1/3]

template<typename BaseIterTable >
dart::HashMap< BaseIterTable >::HashMap ( ArrayPtr  data)
inlineexplicit

Definition at line 694 of file hash_table.h.

695 : BaseIterTable(Thread::Current()->zone(), data) {}
static Thread * Current()
Definition: thread.h:362
static int8_t data[kExtLength]

◆ HashMap() [2/3]

template<typename BaseIterTable >
dart::HashMap< BaseIterTable >::HashMap ( Zone zone,
ArrayPtr  data 
)
inline

Definition at line 696 of file hash_table.h.

696: BaseIterTable(zone, data) {}

◆ HashMap() [3/3]

template<typename BaseIterTable >
dart::HashMap< BaseIterTable >::HashMap ( Object key,
Smi value,
Array data 
)
inline

Definition at line 697 of file hash_table.h.

698 : BaseIterTable(key, value, data) {}
uint8_t value

Member Function Documentation

◆ Clear()

template<typename BaseIterTable >
void dart::HashMap< BaseIterTable >::Clear ( ) const
inline

Definition at line 772 of file hash_table.h.

void Initialize(zx::channel directory_request, std::optional< zx::eventpair > view_ref)
Initializes Dart bindings for the Fuchsia application model.
Definition: fuchsia.cc:103

◆ EnsureCapacity()

template<typename BaseIterTable >
void dart::HashMap< BaseIterTable >::EnsureCapacity ( ) const
inlineprotected

Definition at line 775 of file hash_table.h.

775 {
777 }
static constexpr double kMaxLoadFactor
Definition: hash_table.h:617
static void EnsureLoadFactor(double high, const Table &table)
Definition: hash_table.h:620

◆ GetOrDie()

template<typename BaseIterTable >
template<typename Key >
ObjectPtr dart::HashMap< BaseIterTable >::GetOrDie ( const Key key) const
inline

Definition at line 708 of file hash_table.h.

708 {
709 intptr_t entry = BaseIterTable::FindKey(key);
710 if (entry == -1) UNREACHABLE();
711 return BaseIterTable::GetPayload(entry, 0);
712 }
#define UNREACHABLE()
Definition: assert.h:248

◆ GetOrNull()

template<typename BaseIterTable >
template<typename Key >
ObjectPtr dart::HashMap< BaseIterTable >::GetOrNull ( const Key key,
bool *  present = nullptr 
) const
inline

Definition at line 700 of file hash_table.h.

700 {
701 intptr_t entry = BaseIterTable::FindKey(key);
702 if (present != nullptr) {
703 *present = (entry != -1);
704 }
705 return (entry == -1) ? Object::null() : BaseIterTable::GetPayload(entry, 0);
706 }
static ObjectPtr null()
Definition: object.h:433

◆ InsertNewOrGetValue()

template<typename BaseIterTable >
template<typename Key >
ObjectPtr dart::HashMap< BaseIterTable >::InsertNewOrGetValue ( const Key key,
const Object value_if_absent 
) const
inline

Definition at line 746 of file hash_table.h.

747 {
749 intptr_t entry = -1;
750 if (!BaseIterTable::FindKeyOrDeletedOrUnused(key, &entry)) {
751 BaseIterTable::KeyHandle() =
752 BaseIterTable::BaseTable::Traits::NewKey(key);
753 BaseIterTable::InsertKey(entry, BaseIterTable::KeyHandle());
754 BaseIterTable::UpdatePayload(entry, 0, value_if_absent);
755 return value_if_absent.ptr();
756 } else {
757 return BaseIterTable::GetPayload(entry, 0);
758 }
759 }
void EnsureCapacity() const
Definition: hash_table.h:775

◆ InsertOrGetValue()

template<typename BaseIterTable >
ObjectPtr dart::HashMap< BaseIterTable >::InsertOrGetValue ( const Object key,
const Object value_if_absent 
) const
inline

Definition at line 732 of file hash_table.h.

733 {
735 intptr_t entry = -1;
736 if (!BaseIterTable::FindKeyOrDeletedOrUnused(key, &entry)) {
737 BaseIterTable::InsertKey(entry, key);
738 BaseIterTable::UpdatePayload(entry, 0, value_if_absent);
739 return value_if_absent.ptr();
740 } else {
741 return BaseIterTable::GetPayload(entry, 0);
742 }
743 }

◆ Remove()

template<typename BaseIterTable >
template<typename Key >
bool dart::HashMap< BaseIterTable >::Remove ( const Key key) const
inline

Definition at line 762 of file hash_table.h.

762 {
763 intptr_t entry = BaseIterTable::FindKey(key);
764 if (entry == -1) {
765 return false;
766 } else {
767 BaseIterTable::DeleteEntry(entry);
768 return true;
769 }
770 }

◆ UpdateOrInsert()

template<typename BaseIterTable >
bool dart::HashMap< BaseIterTable >::UpdateOrInsert ( const Object key,
const Object value 
) const
inline

Definition at line 713 of file hash_table.h.

713 {
715 intptr_t entry = -1;
716 bool present = BaseIterTable::FindKeyOrDeletedOrUnused(key, &entry);
717 if (!present) {
718 BaseIterTable::InsertKey(entry, key);
719 }
720 BaseIterTable::UpdatePayload(entry, 0, value);
721 return present;
722 }

◆ UpdateValue()

template<typename BaseIterTable >
template<typename Key >
void dart::HashMap< BaseIterTable >::UpdateValue ( const Key key,
const Object value 
) const
inline

Definition at line 725 of file hash_table.h.

725 {
726 intptr_t entry = BaseIterTable::FindKey(key);
727 ASSERT(entry != -1);
728 BaseIterTable::UpdatePayload(entry, 0, value);
729 }
#define ASSERT(E)

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