mirror of
https://github.com/NGSolve/netgen.git
synced 2025-02-25 13:35:40 +05:00
wrap static variable into function
This commit is contained in:
parent
fda7cfa2bc
commit
54287bbfbb
@ -10,24 +10,31 @@
|
||||
namespace ngcore
|
||||
{
|
||||
// clang-tidy should ignore this static object
|
||||
static std::map<std::string, detail::ClassArchiveInfo> type_register; // NOLINT
|
||||
// static std::map<std::string, detail::ClassArchiveInfo> type_register; // NOLINT
|
||||
|
||||
auto& GetTypeRegister()
|
||||
{
|
||||
static std::map<std::string, detail::ClassArchiveInfo> type_register;
|
||||
return type_register;
|
||||
}
|
||||
|
||||
const detail::ClassArchiveInfo& Archive :: GetArchiveRegister(const std::string& classname)
|
||||
{
|
||||
// if(type_register == nullptr) type_register =
|
||||
// std::make_unique<std::map<std::string, detail::ClassArchiveInfo>>();
|
||||
return (type_register)[classname];
|
||||
return GetTypeRegister()[classname];
|
||||
}
|
||||
void Archive :: SetArchiveRegister(const std::string& classname, const detail::ClassArchiveInfo& info)
|
||||
{
|
||||
// if(type_register == nullptr) type_register =
|
||||
// std::make_unique<std::map<std::string, detail::ClassArchiveInfo>>();
|
||||
(type_register)[classname] = info;
|
||||
GetTypeRegister()[classname] = info;
|
||||
}
|
||||
bool Archive :: IsRegistered(const std::string& classname)
|
||||
{
|
||||
// if(type_register == nullptr) type_register =
|
||||
// std::make_unique<std::map<std::string, detail::ClassArchiveInfo>>();
|
||||
return type_register.count(classname) != 0;
|
||||
return GetTypeRegister().count(classname) != 0;
|
||||
}
|
||||
|
||||
#ifdef NETGEN_PYTHON
|
||||
|
Loading…
Reference in New Issue
Block a user