Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Friends | List of all members
dart::CidIndexedTable< CidType, Columns > Class Template Reference

#include <class_table.h>

Public Member Functions

 CidIndexedTable (ClassTableAllocator *allocator)
 
 ~CidIndexedTable ()
 
 CidIndexedTable (const CidIndexedTable &other)=delete
 
void SetNumCidsAndCapacity (intptr_t new_num_cids, intptr_t new_capacity)
 
void AllocateIndex (intptr_t index, bool *did_grow)
 
intptr_t AddRow (bool *did_grow)
 
void ShrinkTo (intptr_t new_num_cids)
 
bool IsValidIndex (intptr_t index) const
 
void CopyFrom (const CidIndexedTable &other)
 
void Remap (intptr_t *old_to_new_cid)
 
template<intptr_t kColumnIndex, typename T = std::tuple_element_t<kColumnIndex, std::tuple<Columns...>>>
TGetColumn ()
 
template<intptr_t kColumnIndex, typename T = std::tuple_element_t<kColumnIndex, std::tuple<Columns...>>>
const TGetColumn () const
 
template<intptr_t kColumnIndex, typename T = std::tuple_element_t<kColumnIndex, std::tuple<Columns...>>>
TAt (intptr_t index)
 
template<intptr_t kColumnIndex, typename T = std::tuple_element_t<kColumnIndex, std::tuple<Columns...>>>
const TAt (intptr_t index) const
 
intptr_t num_cids () const
 
intptr_t capacity () const
 

Friends

class ClassTable
 

Detailed Description

template<typename CidType, typename... Columns>
class dart::CidIndexedTable< CidType, Columns >

Definition at line 153 of file class_table.h.

Constructor & Destructor Documentation

◆ CidIndexedTable() [1/2]

template<typename CidType , typename... Columns>
dart::CidIndexedTable< CidType, Columns >::CidIndexedTable ( ClassTableAllocator allocator)
inlineexplicit

Definition at line 155 of file class_table.h.

156 : allocator_(allocator) {}

◆ ~CidIndexedTable()

template<typename CidType , typename... Columns>
dart::CidIndexedTable< CidType, Columns >::~CidIndexedTable ( )
inline

Definition at line 158 of file class_table.h.

158 {
159 std::apply([&](auto&... column) { (allocator_->Free(column.load()), ...); },
160 columns_);
161 }
static bool apply(Pass *pass, SkRecord *record)
void Free(ClassTable *table)
Definition: class_table.cc:395

◆ CidIndexedTable() [2/2]

template<typename CidType , typename... Columns>
dart::CidIndexedTable< CidType, Columns >::CidIndexedTable ( const CidIndexedTable< CidType, Columns > &  other)
delete

Member Function Documentation

◆ AddRow()

template<typename CidType , typename... Columns>
intptr_t dart::CidIndexedTable< CidType, Columns >::AddRow ( bool *  did_grow)
inline

Definition at line 181 of file class_table.h.

181 {
182 *did_grow = EnsureCapacity(num_cids_);
183 intptr_t id = num_cids_;
184 SetNumCids(num_cids_ + 1);
185 return id;
186 }
const uintptr_t id

◆ AllocateIndex()

template<typename CidType , typename... Columns>
void dart::CidIndexedTable< CidType, Columns >::AllocateIndex ( intptr_t  index,
bool *  did_grow 
)
inline

Definition at line 176 of file class_table.h.

176 {
177 *did_grow = EnsureCapacity(index);
178 SetNumCids(Utils::Maximum(num_cids_, index + 1));
179 }
static constexpr T Maximum(T x, T y)
Definition: utils.h:41

◆ At() [1/2]

template<typename CidType , typename... Columns>
template<intptr_t kColumnIndex, typename T = std::tuple_element_t<kColumnIndex, std::tuple<Columns...>>>
T & dart::CidIndexedTable< CidType, Columns >::At ( intptr_t  index)
inline

Definition at line 236 of file class_table.h.

236 {
237 ASSERT(IsValidIndex(index));
238 return GetColumn<kColumnIndex>()[index];
239 }
bool IsValidIndex(intptr_t index) const
Definition: class_table.h:193
#define ASSERT(E)

◆ At() [2/2]

template<typename CidType , typename... Columns>
template<intptr_t kColumnIndex, typename T = std::tuple_element_t<kColumnIndex, std::tuple<Columns...>>>
const T & dart::CidIndexedTable< CidType, Columns >::At ( intptr_t  index) const
inline

Definition at line 244 of file class_table.h.

244 {
245 ASSERT(IsValidIndex(index));
246 return GetColumn<kColumnIndex>()[index];
247 }

◆ capacity()

template<typename CidType , typename... Columns>
intptr_t dart::CidIndexedTable< CidType, Columns >::capacity ( ) const
inline

Definition at line 250 of file class_table.h.

250{ return capacity_; }

◆ CopyFrom()

template<typename CidType , typename... Columns>
void dart::CidIndexedTable< CidType, Columns >::CopyFrom ( const CidIndexedTable< CidType, Columns > &  other)
inline

Definition at line 197 of file class_table.h.

197 {
198 ASSERT(allocator_ == other.allocator_);
199
200 std::apply([&](auto&... column) { (allocator_->Free(column.load()), ...); },
201 columns_);
202
203 columns_ = std::apply(
204 [&](auto&... column) {
205 return std::make_tuple(
206 allocator_->Clone(column.load(), other.num_cids_)...);
207 },
208 other.columns_);
209 capacity_ = num_cids_ = other.num_cids_;
210 }
T * Clone(T *array, intptr_t size)
Definition: class_table.h:105

◆ GetColumn() [1/2]

template<typename CidType , typename... Columns>
template<intptr_t kColumnIndex, typename T = std::tuple_element_t<kColumnIndex, std::tuple<Columns...>>>
T * dart::CidIndexedTable< CidType, Columns >::GetColumn ( )
inline

Definition at line 222 of file class_table.h.

222 {
223 return std::get<kColumnIndex>(columns_).load();
224 }

◆ GetColumn() [2/2]

template<typename CidType , typename... Columns>
template<intptr_t kColumnIndex, typename T = std::tuple_element_t<kColumnIndex, std::tuple<Columns...>>>
const T * dart::CidIndexedTable< CidType, Columns >::GetColumn ( ) const
inline

Definition at line 229 of file class_table.h.

229 {
230 return std::get<kColumnIndex>(columns_).load();
231 }

◆ IsValidIndex()

template<typename CidType , typename... Columns>
bool dart::CidIndexedTable< CidType, Columns >::IsValidIndex ( intptr_t  index) const
inline

Definition at line 193 of file class_table.h.

193 {
194 return 0 <= index && index < num_cids_;
195 }

◆ num_cids()

template<typename CidType , typename... Columns>
intptr_t dart::CidIndexedTable< CidType, Columns >::num_cids ( ) const
inline

Definition at line 249 of file class_table.h.

249{ return num_cids_; }

◆ Remap()

template<typename CidType , typename... Columns>
void dart::CidIndexedTable< CidType, Columns >::Remap ( intptr_t *  old_to_new_cid)
inline

Definition at line 212 of file class_table.h.

212 {
213 CidIndexedTable clone(allocator_);
214 clone.CopyFrom(*this);
215 RemapAllColumns(clone, old_to_new_cid,
216 std::index_sequence_for<Columns...>{});
217 }
CidIndexedTable(ClassTableAllocator *allocator)
Definition: class_table.h:155

◆ SetNumCidsAndCapacity()

template<typename CidType , typename... Columns>
void dart::CidIndexedTable< CidType, Columns >::SetNumCidsAndCapacity ( intptr_t  new_num_cids,
intptr_t  new_capacity 
)
inline

Definition at line 165 of file class_table.h.

165 {
166 columns_ = std::apply(
167 [&](auto&... column) {
168 return std::make_tuple(
169 allocator_->Realloc(column.load(), num_cids_, new_capacity)...);
170 },
171 columns_);
172 capacity_ = new_capacity;
173 SetNumCids(new_num_cids);
174 }
T * Realloc(T *array, intptr_t size, intptr_t new_size)
Definition: class_table.h:121

◆ ShrinkTo()

template<typename CidType , typename... Columns>
void dart::CidIndexedTable< CidType, Columns >::ShrinkTo ( intptr_t  new_num_cids)
inline

Definition at line 188 of file class_table.h.

188 {
189 ASSERT(new_num_cids <= num_cids_);
190 num_cids_ = new_num_cids;
191 }

Friends And Related Function Documentation

◆ ClassTable

template<typename CidType , typename... Columns>
friend class ClassTable
friend

Definition at line 253 of file class_table.h.


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