nstool/lib/libhac/source/ThreadInfoHandler.cpp

103 lines
2.1 KiB
C++
Raw Permalink Normal View History

2018-08-07 07:17:51 +00:00
#include <nn/hac/ThreadInfoHandler.h>
2018-08-07 07:17:51 +00:00
nn::hac::ThreadInfoHandler::ThreadInfoHandler() :
mIsSet(false),
mEntry(0,0,0,0)
{}
2018-08-07 07:17:51 +00:00
void nn::hac::ThreadInfoHandler::operator=(const ThreadInfoHandler & other)
{
mIsSet = other.mIsSet;
mEntry.setKernelCapability(other.mEntry.getKernelCapability());
}
2018-08-07 07:17:51 +00:00
bool nn::hac::ThreadInfoHandler::operator==(const ThreadInfoHandler & other) const
{
return (mIsSet == other.mIsSet) \
&& (mEntry.getKernelCapability() == other.mEntry.getKernelCapability());
}
2018-08-07 07:17:51 +00:00
bool nn::hac::ThreadInfoHandler::operator!=(const ThreadInfoHandler & other) const
{
return !(*this == other);
}
2018-08-07 07:17:51 +00:00
void nn::hac::ThreadInfoHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps)
{
if (caps.size() > kMaxKernelCapNum)
{
throw fnd::Exception(kModuleName, "Too many kernel capabilities");
}
if (caps.size() == 0)
return;
mEntry.setKernelCapability(caps[0]);
mIsSet = true;
}
2018-08-07 07:17:51 +00:00
void nn::hac::ThreadInfoHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const
{
if (isSet() == false)
return;
caps.addElement(mEntry.getKernelCapability());
}
2018-08-07 07:17:51 +00:00
void nn::hac::ThreadInfoHandler::clear()
{
mIsSet = false;
mEntry.setMaxPriority(0);
mEntry.setMinPriority(0);
mEntry.setMaxCpuId(0);
mEntry.setMinCpuId(0);
}
2018-08-07 07:17:51 +00:00
bool nn::hac::ThreadInfoHandler::isSet() const
{
return mIsSet;
}
2018-08-07 07:17:51 +00:00
uint8_t nn::hac::ThreadInfoHandler::getMinPriority() const
{
return mEntry.getMinPriority();
}
2018-08-07 07:17:51 +00:00
void nn::hac::ThreadInfoHandler::setMinPriority(uint8_t priority)
{
mEntry.setMinPriority(priority);
mIsSet = true;
}
2018-08-07 07:17:51 +00:00
uint8_t nn::hac::ThreadInfoHandler::getMaxPriority() const
{
return mEntry.getMaxPriority();
}
2018-08-07 07:17:51 +00:00
void nn::hac::ThreadInfoHandler::setMaxPriority(uint8_t priority)
{
mEntry.setMaxPriority(priority);
mIsSet = true;
}
2018-08-07 07:17:51 +00:00
uint8_t nn::hac::ThreadInfoHandler::getMinCpuId() const
{
return mEntry.getMinCpuId();
}
2018-08-07 07:17:51 +00:00
void nn::hac::ThreadInfoHandler::setMinCpuId(uint8_t core_num)
{
mEntry.setMinCpuId(core_num);
mIsSet = true;
}
2018-08-07 07:17:51 +00:00
uint8_t nn::hac::ThreadInfoHandler::getMaxCpuId() const
{
return mEntry.getMaxCpuId();
}
2018-08-07 07:17:51 +00:00
void nn::hac::ThreadInfoHandler::setMaxCpuId(uint8_t core_num)
{
mEntry.setMaxCpuId(core_num);
mIsSet = true;
}