MCPcopy Create free account
hub / github.com/WarmUpTill/SceneSwitcher / IsInUse

Method IsInUse

lib/utils/temp-variable.cpp:157–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157bool TempVariable::IsInUse() const
158{
159 const auto currentGen =
160 tempVarInUseGeneration.load(std::memory_order_relaxed);
161 if (_isInUseCacheGeneration == currentGen) {
162 return _isInUseCache;
163 }
164
165 bool inUse = false;
166 const auto ref = GetRef();
167
168 if (ref.HasValidID()) {
169 for (const auto &macro : GetAllMacros()) {
170 if (segmentsReferTo(macro->Conditions(), ref) ||
171 segmentsReferTo(macro->Actions(), ref) ||
172 segmentsReferTo(macro->ElseActions(), ref)) {
173 inUse = true;
174 break;
175 }
176 }
177 }
178
179 _isInUseCache = inUse;
180 _isInUseCacheGeneration = currentGen;
181 return inUse;
182}
183
184void IncrementTempVarInUseGeneration()
185{

Callers 1

IsTempVarInUseMethod · 0.80

Calls 4

GetAllMacrosFunction · 0.85
segmentsReferToFunction · 0.85
HasValidIDMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected