Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
census.hpp
Go to the documentation of this file.
1#pragma once
2
6
7#include <array>
8#include <cstddef>
9#include <cstdint>
10#include <span>
11#include <vector>
12
14
20 std::size_t max_owners_per_concept = 64;
21};
22
29 public:
30 bool contains(Concept concept_value) const noexcept;
31 std::uint64_t count(Concept concept_value) const noexcept;
32
35 std::span<const timeline::ItemId> owners(Concept concept_value) const noexcept;
36
38 std::vector<Concept> present() const;
39 bool empty() const noexcept;
40
43 void record(Concept concept_value, timeline::ItemId owner, const CensusLimits& limits);
44
45 private:
46 struct Entry {
47 std::uint64_t count = 0;
48 std::vector<timeline::ItemId> owners;
49 };
50 std::array<Entry, kConceptCount> entries_{};
51};
52
58ConceptCensus census(const timeline::Project& project, const CensusLimits& limits = {});
59
60} // namespace pulp::interchange
Which interchange concepts a document uses, how often, and where.
Definition census.hpp:28
std::vector< Concept > present() const
Concepts recorded at least once, in vocabulary order.
bool empty() const noexcept
void record(Concept concept_value, timeline::ItemId owner, const CensusLimits &limits)
Record one sighting.
bool contains(Concept concept_value) const noexcept
std::uint64_t count(Concept concept_value) const noexcept
std::span< const timeline::ItemId > owners(Concept concept_value) const noexcept
Up to CensusLimits::max_owners_per_concept ids of the items that carry the concept.
Immutable root of a Timeline document and its monotonic identity domain.
Definition model.hpp:1079
Definition census.hpp:13
Concept
The format-neutral interchange concept vocabulary.
Definition concepts.hpp:13
ConceptCensus census(const timeline::Project &project, const CensusLimits &limits={})
Walk a document and record every concept it uses.
Definition program_compiler.hpp:18
Bounds on how much evidence one census retains.
Definition census.hpp:16
std::size_t max_owners_per_concept
Owner ids are an evidence sample, not the whole set.
Definition census.hpp:20