Flutter Windows Embedder
flutter::SequentialIdGenerator Class Reference

#include <sequential_id_generator.h>

Public Member Functions

 SequentialIdGenerator (uint32_t min_id, uint32_t max_id)
 
 ~SequentialIdGenerator ()
 
uint32_t GetGeneratedId (uint32_t number)
 
bool HasGeneratedIdFor (uint32_t number) const
 
void ReleaseNumber (uint32_t number)
 
void ReleaseId (uint32_t id)
 

Detailed Description

Definition at line 20 of file sequential_id_generator.h.

Constructor & Destructor Documentation

◆ SequentialIdGenerator()

flutter::SequentialIdGenerator::SequentialIdGenerator ( uint32_t  min_id,
uint32_t  max_id 
)
explicit

Definition at line 27 of file sequential_id_generator.cc.

28  : min_id_(min_id), min_available_id_(min_id), max_id_(max_id) {}

◆ ~SequentialIdGenerator()

flutter::SequentialIdGenerator::~SequentialIdGenerator ( )

Definition at line 30 of file sequential_id_generator.cc.

30 {}

Member Function Documentation

◆ GetGeneratedId()

uint32_t flutter::SequentialIdGenerator::GetGeneratedId ( uint32_t  number)

Definition at line 32 of file sequential_id_generator.cc.

32  {
33  auto it = number_to_id_.find(number);
34  if (it != number_to_id_.end())
35  return it->second;
36 
37  auto id = GetNextAvailableId();
38  number_to_id_.emplace(number, id);
39  id_to_number_.emplace(id, number);
40  return id;
41 }

Referenced by flutter::testing::TEST().

◆ HasGeneratedIdFor()

bool flutter::SequentialIdGenerator::HasGeneratedIdFor ( uint32_t  number) const

Definition at line 43 of file sequential_id_generator.cc.

43  {
44  return number_to_id_.find(number) != number_to_id_.end();
45 }

Referenced by flutter::testing::TEST().

◆ ReleaseId()

void flutter::SequentialIdGenerator::ReleaseId ( uint32_t  id)

Definition at line 54 of file sequential_id_generator.cc.

54  {
55  if (id_to_number_.count(id) > 0U) {
56  UpdateNextAvailableIdAfterRelease(id);
57  Remove(id_to_number_[id], &number_to_id_, &id_to_number_);
58  }
59 }

◆ ReleaseNumber()

void flutter::SequentialIdGenerator::ReleaseNumber ( uint32_t  number)

Definition at line 47 of file sequential_id_generator.cc.

47  {
48  if (number_to_id_.count(number) > 0U) {
49  UpdateNextAvailableIdAfterRelease(number_to_id_[number]);
50  Remove(number, &number_to_id_, &id_to_number_);
51  }
52 }

Referenced by flutter::testing::TEST().


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