Files
salmanoff/smocore/componentThread.cpp
hayodea aec3cbedf2 Split: Expose name via CompThr's derivatives' ctors
This completes the functional work of splitting libspinscale off
from SMO. Spinscale shouldn't have any real dependencies on SMO
from here on out.
2026-02-22 18:54:56 -04:00

32 lines
721 B
C++

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