Blender  V3.3
deg_builder_map.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2018 Blender Foundation. All rights reserved. */
3 
9 
10 #include "DNA_ID.h"
11 
12 namespace blender::deg {
13 
14 bool BuilderMap::checkIsBuilt(ID *id, int tag) const
15 {
16  return (getIDTag(id) & tag) == tag;
17 }
18 
19 void BuilderMap::tagBuild(ID *id, int tag)
20 {
21  id_tags_.lookup_or_add(id, 0) |= tag;
22 }
23 
25 {
26  int &id_tag = id_tags_.lookup_or_add(id, 0);
27  const bool result = (id_tag & tag) == tag;
28  id_tag |= tag;
29  return result;
30 }
31 
32 int BuilderMap::getIDTag(ID *id) const
33 {
34  return id_tags_.lookup_default(id, 0);
35 }
36 
37 } // namespace blender::deg
ID and Library types, which are fundamental for sdna.
Value lookup_default(const Key &key, const Value &default_value) const
Definition: BLI_map.hh:510
Value & lookup_or_add(const Key &key, const Value &value)
Definition: BLI_map.hh:530
int getIDTag(ID *id) const
void tagBuild(ID *id, int tag=TAG_COMPLETE)
bool checkIsBuiltAndTag(ID *id, int tag=TAG_COMPLETE)
Map< ID *, int > id_tags_
bool checkIsBuilt(ID *id, int tag=TAG_COMPLETE) const
Definition: DNA_ID.h:368