Blender V4.3
BKE_outliner_treehash.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4#pragma once
5
16#include <memory>
17
18#include "BLI_map.hh"
19
20struct BLI_mempool;
21struct ID;
22struct TreeStoreElem;
23
25
26/* -------------------------------------------------------------------- */
27
29 public:
30 ID *id = nullptr;
31 short type = 0;
32 short nr = 0;
33
34 explicit TreeStoreElemKey(const TreeStoreElem &elem);
35 TreeStoreElemKey(ID *id, short type, short nr);
36
37 uint64_t hash() const;
38 friend bool operator==(const TreeStoreElemKey &a, const TreeStoreElemKey &b);
39};
40
41/* -------------------------------------------------------------------- */
42
43class TreeHash {
45
46 public:
48
50 static std::unique_ptr<TreeHash> create_from_treestore(BLI_mempool &treestore);
51
53 void rebuild_from_treestore(BLI_mempool &treestore);
54
56 void clear_used();
57
59 void add_element(TreeStoreElem &elem);
61 void remove_element(TreeStoreElem &elem);
62
64 TreeStoreElem *lookup_unused(short type, short nr, ID *id) const;
65
67 TreeStoreElem *lookup_any(short type, short nr, ID *id) const;
68
69 private:
70 TreeHash() = default;
71
72 TseGroup *lookup_group(const TreeStoreElemKey &key) const;
73 TseGroup *lookup_group(const TreeStoreElem &elem) const;
74 TseGroup *lookup_group(short type, short nr, ID *id) const;
75 void fill_treehash(BLI_mempool &treestore);
76};
77
78} // namespace blender::bke::outliner::treehash
void rebuild_from_treestore(BLI_mempool &treestore)
TreeStoreElem * lookup_unused(short type, short nr, ID *id) const
TreeStoreElem * lookup_any(short type, short nr, ID *id) const
static std::unique_ptr< TreeHash > create_from_treestore(BLI_mempool &treestore)
friend bool operator==(const TreeStoreElemKey &a, const TreeStoreElemKey &b)
local_group_size(16, 16) .push_constant(Type b
unsigned __int64 uint64_t
Definition stdint.h:90
Definition DNA_ID.h:413