OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::instance_id Namespace Reference

Namespaces

namespace  anonymous_namespace{InstanceID.cpp}

Functions

std::string ensure (AppConfig &config)
void reset_cache_for_tests ()

Function Documentation

◆ ensure()

std::string Slic3r::instance_id::ensure ( AppConfig & config)
171{
172 std::lock_guard<std::mutex> lock(cache_mutex());
173 if (cache_ready())
174 return cached_iid();
175
176 if (auto secure = read_secure()) {
177 cached_iid() = *secure;
178 cache_ready() = true;
179 prune_config_value(config);
180 return cached_iid();
181 }
182
183 if (auto from_config = read_config_value(config)) {
184 cached_iid() = *from_config;
185 cache_ready() = true;
186 if (!write_secure(cached_iid()))
187 write_config_value(config, cached_iid());
188 else
189 prune_config_value(config);
190 return cached_iid();
191 }
192
193 cached_iid() = generate_uuid();
194 cache_ready() = true;
195
196 if (!write_secure(cached_iid()))
197 write_config_value(config, cached_iid());
198 else
199 prune_config_value(config);
200
201 return cached_iid();
202}

Referenced by Slic3r::GUI::anonymous_namespace{GUI_App.cpp}::detect_updater_iid().

Here is the caller graph for this function:

◆ reset_cache_for_tests()

void Slic3r::instance_id::reset_cache_for_tests ( )
205{
206 std::lock_guard<std::mutex> lock(cache_mutex());
207 cached_iid().clear();
208 cache_ready() = false;
209}