fixed_typemap.hpp: minor cleanup

This commit is contained in:
Nekotekina 2020-02-27 21:41:05 +03:00
parent e133c7a7dc
commit bacd1698fc
2 changed files with 14 additions and 10 deletions

View File

@ -1763,15 +1763,15 @@ s32 error_code::error_report(const fmt_type_info* sup, u64 arg, const fmt_type_i
}
template <>
void stx::manual_fixed_typemap<void>::init_reporter(const char* name, unsigned long long created)
void stx::manual_fixed_typemap<void>::init_reporter(const char* name, unsigned long long created) const noexcept
{
sys_log.notice("Object '%s' was created [%u]", name, created);
sys_log.notice("[ord:%u] Object '%s' was created", created, name);
}
template <>
void stx::manual_fixed_typemap<void>::destroy_reporter(const char* name, unsigned long long created)
void stx::manual_fixed_typemap<void>::destroy_reporter(const char* name, unsigned long long created) const noexcept
{
sys_log.notice("Object '%s' was destroyed [%u]", name, created);
sys_log.notice("[ord:%u] Object '%s' is destroying", created, name);
}
Emulator Emu;

View File

@ -51,11 +51,21 @@ namespace stx
}
};
// Raw pointers to existing objects (may be nullptr)
std::unique_ptr<void*[]> m_list;
// Creation order for each object (used to reverse destruction order)
std::unique_ptr<unsigned long long[]> m_order;
// Used to generate creation order (increased on every construction)
unsigned long long m_init_count = 0;
// Body is somewhere else if enabled
void init_reporter(const char* name, unsigned long long created) const noexcept;
// Body is somewhere else if enabled
void destroy_reporter(const char* name, unsigned long long created) const noexcept;
public:
constexpr manual_fixed_typemap() noexcept = default;
@ -209,11 +219,5 @@ namespace stx
{
return static_cast<T*>(m_list[stx::typeindex<typeinfo, std::decay_t<T>>()]);
}
// Body is somewhere else if enabled
void init_reporter(const char* name, unsigned long long created);
// Body is somewhere else if enabled
void destroy_reporter(const char* name, unsigned long long created);
};
}