Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::IntSet Class Reference

Public Member Functions

 IntSet (IntKeyHash hash)
 
void Insert (int x)
 
void Remove (int x)
 
bool Present (int x)
 
void Clear ()
 
uint32_t occupancy () const
 

Detailed Description

Definition at line 17 of file hashmap_test.cc.

Constructor & Destructor Documentation

◆ IntSet()

dart::IntSet::IntSet ( IntKeyHash  hash)
inlineexplicit

Definition at line 19 of file hashmap_test.cc.

static uint32_t hash(const SkShaderBase::GradientInfo &v)
static bool SamePointerValue(void *key1, void *key2)
Definition: hashmap.h:24
static intptr_t kInitialSize
Definition: hashmap_test.cc:13

Member Function Documentation

◆ Clear()

void dart::IntSet::Clear ( )
inline

Definition at line 45 of file hashmap_test.cc.

45{ map_.Clear(); }
void Clear(ClearFun clear=nullptr)
Definition: hashmap.cc:111

◆ Insert()

void dart::IntSet::Insert ( int  x)
inline

Definition at line 22 of file hashmap_test.cc.

22 {
23 EXPECT_NE(0, x); // 0 corresponds to (void*)nullptr - illegal key value
25 map_.Lookup(reinterpret_cast<void*>(x), hash_(x), true);
26 EXPECT(p != nullptr); // insert is set!
27 EXPECT_EQ(reinterpret_cast<void*>(x), p->key);
28 // We don't care about p->value.
29 }
#define EXPECT(type, expectedAlignment, expectedSize)
Entry * Lookup(void *key, uint32_t hash, bool insert)
Definition: hashmap.cc:20
double x

◆ occupancy()

uint32_t dart::IntSet::occupancy ( ) const
inline

Definition at line 47 of file hashmap_test.cc.

47 {
48 uint32_t count = 0;
49 for (SimpleHashMap::Entry* p = map_.Start(); p != nullptr;
50 p = map_.Next(p)) {
51 count++;
52 }
53 EXPECT_EQ(map_.occupancy_, count);
54 return count;
55 }
int count
Definition: FontMgrTest.cpp:50
Entry * Start() const
Definition: hashmap.cc:123
Entry * Next(Entry *p) const
Definition: hashmap.cc:127

◆ Present()

bool dart::IntSet::Present ( int  x)
inline

Definition at line 36 of file hashmap_test.cc.

36 {
38 map_.Lookup(reinterpret_cast<void*>(x), hash_(x), false);
39 if (p != nullptr) {
40 EXPECT_EQ(reinterpret_cast<void*>(x), p->key);
41 }
42 return p != nullptr;
43 }

◆ Remove()

void dart::IntSet::Remove ( int  x)
inline

Definition at line 31 of file hashmap_test.cc.

31 {
32 EXPECT_NE(0, x); // 0 corresponds to (void*)nullptr - illegal key value
33 map_.Remove(reinterpret_cast<void*>(x), hash_(x));
34 }
void Remove(void *key, uint32_t hash)
Definition: hashmap.cc:49

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