| 181 | ReferenceTable::WriteAccess::~WriteAccess() = default; |
| 182 | |
| 183 | ReferenceTableEntry ReferenceTable::WriteAccess::makeRef(const char* tag) const { |
| 184 | auto id = _table->_sequence.newId(); |
| 185 | |
| 186 | auto index = static_cast<size_t>(id.getIndex()); |
| 187 | ReferenceTableEntry* entry; |
| 188 | if (index >= _table->_entries.size()) { |
| 189 | entry = &_table->_entries.emplace_back(); |
| 190 | } else { |
| 191 | entry = &_table->_entries[index]; |
| 192 | } |
| 193 | |
| 194 | entry->id = id; |
| 195 | entry->retainCount = 1; |
| 196 | entry->tag = tag; |
| 197 | |
| 198 | return *entry; |
| 199 | } |
| 200 | |
| 201 | void ReferenceTable::WriteAccess::retainRef(SequenceID id) const { |
| 202 | auto& entry = _table->getEntry(id); |