Accelerator structure to reduce memory requirements by enabling reuse of resolved tags.
More...
#include <tag.hpp>
Accelerator structure to reduce memory requirements by enabling reuse of resolved tags.
Definition at line 68 of file tag.hpp.
◆ Entries
◆ const_iterator
◆ TagCache()
| c4::yml::TagCache::TagCache |
( |
| ) |
|
|
inlinenoexcept |
◆ find()
Definition at line 537 of file tag.cpp.
539 LookupResult ret = {};
541 if(sz < linear_threshold)
543 for(
size_t i = 0; i < sz; ++i)
545 Entry
const& C4_RESTRICT e = m_entries[i];
546 if(e.tag == tag && e.doc_id == doc_id)
548 ret.resolved = e.resolved;
552 else if(e.tag > tag || ((e.tag == tag) && e.doc_id > doc_id))
568 _RYML_ASSERT_BASIC_(m_entries.m_callbacks, mid < sz);
569 Entry
const& C4_RESTRICT e = m_entries[mid];
570 if(e.tag < tag || (e.tag == tag && e.doc_id < doc_id))
573 _RYML_ASSERT_BASIC_(m_entries.m_callbacks, count >= halfsz + 1);
584 Entry
const& C4_RESTRICT e = m_entries[first];
585 if(e.tag == tag && e.doc_id == doc_id)
587 ret.resolved = m_entries[first].resolved;
RYML_ID_TYPE id_type
The type of a node id in the YAML tree; to override the default type, define the macro RYML_ID_TYPE t...
References c4::yml::TagCache::LookupResult::pos, and c4::yml::TagCache::LookupResult::resolved.
◆ add()
Definition at line 594 of file tag.cpp.
596 const id_type sz = m_entries.size();
597 _RYML_ASSERT_BASIC_(m_entries.m_callbacks, pos <= sz);
598 _RYML_ASSERT_BASIC_(m_entries.m_callbacks, pos == sz || tag < m_entries[pos].tag || (tag == m_entries[pos].tag && doc_id < m_entries[pos].doc_id));
599 m_entries.resize(sz + 1);
601 memmove(m_entries.m_stack + pos + 1, m_entries.m_stack + pos, (sz - pos) *
sizeof(Entry));
602 m_entries.m_stack[pos].tag = tag;
603 m_entries.m_stack[pos].resolved = resolved;
604 m_entries.m_stack[pos].doc_id = doc_id;
605 _c4dbgpf(
"tagcache: add entry @pos={}: docid={} {} -> {}", pos, doc_id, tag, _maybe_null_str(resolved));
◆ clear()
| void c4::yml::TagCache::clear |
( |
| ) |
|
|
inlinenoexcept |
Definition at line 91 of file tag.hpp.
91 { m_entries.clear(); }
The documentation for this struct was generated from the following files:
- /home/docs/checkouts/readthedocs.org/user_builds/rapidyaml/checkouts/v0.12.1/src/c4/yml/tag.hpp
- /home/docs/checkouts/readthedocs.org/user_builds/rapidyaml/checkouts/v0.12.1/src/c4/yml/tag.cpp