Files
salmanoff/smocore/componentThread.cpp
T

32 lines
721 B
C++
Raw Normal View History

2025-12-26 01:18:39 -04:00
#include <stdexcept>
#include <string>
#include <componentThread.h>
2025-01-11 04:34:49 -04:00
namespace smo {
2025-01-11 04:34:49 -04:00
std::string getThreadName(sscl::ThreadId id)
2025-01-11 04:34:49 -04:00
{
2025-12-26 01:18:39 -04:00
// Cast ThreadId to SmoThreadId for validation and lookup
2025-12-27 16:21:22 -04:00
smo::SmoThreadId smoId = static_cast<smo::SmoThreadId>(id);
if (static_cast<int>(smoId) >= static_cast<int>(smo::SmoThreadId::N_ITEMS))
2025-01-11 04:34:49 -04:00
{
throw std::runtime_error(std::string(__func__)
2025-12-26 01:18:39 -04:00
+ ": Invalid thread ID");
2025-01-11 04:34:49 -04:00
}
// Use function-local static to ensure proper construction order.
2025-12-27 16:21:22 -04:00
static const std::string threadNames[static_cast<int>(smo::SmoThreadId::N_ITEMS)]
2025-12-26 01:18:39 -04:00
= {
"mrntt",
"director",
"simulator",
"subconscious",
"body",
"world"
};
return threadNames[static_cast<int>(smoId)];
2025-01-11 04:34:49 -04:00
}
} // namespace smo