2017-08-05 13:09:50 +00:00
|
|
|
#include <nx/ThreadInfoHandler.h>
|
2017-07-12 14:02:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nx::ThreadInfoHandler::ThreadInfoHandler() :
|
|
|
|
mIsSet(false),
|
|
|
|
mEntry(0,0,0,0)
|
|
|
|
{}
|
|
|
|
|
|
|
|
bool nx::ThreadInfoHandler::operator==(const ThreadInfoHandler & other) const
|
|
|
|
{
|
|
|
|
return isEqual(other);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool nx::ThreadInfoHandler::operator!=(const ThreadInfoHandler & other) const
|
|
|
|
{
|
|
|
|
return !isEqual(other);
|
|
|
|
}
|
|
|
|
|
|
|
|
void nx::ThreadInfoHandler::operator=(const ThreadInfoHandler & other)
|
|
|
|
{
|
|
|
|
copyFrom(other);
|
|
|
|
}
|
|
|
|
|
|
|
|
void nx::ThreadInfoHandler::importKernelCapabilityList(const fnd::List<KernelCapability>& caps)
|
|
|
|
{
|
|
|
|
if (caps.getSize() > kMaxKernelCapNum)
|
|
|
|
{
|
|
|
|
throw fnd::Exception(kModuleName, "Too many kernel capabilities");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (caps.getSize() == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
mEntry.setKernelCapability(caps[0]);
|
|
|
|
mIsSet = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void nx::ThreadInfoHandler::exportKernelCapabilityList(fnd::List<KernelCapability>& caps) const
|
|
|
|
{
|
|
|
|
if (isSet() == false)
|
|
|
|
return;
|
|
|
|
|
|
|
|
caps.addElement(mEntry.getKernelCapability());
|
|
|
|
}
|
|
|
|
|
|
|
|
void nx::ThreadInfoHandler::clear()
|
|
|
|
{
|
|
|
|
mIsSet = false;
|
|
|
|
mEntry.setMaxPriority(0);
|
|
|
|
mEntry.setMinPriority(0);
|
2017-07-17 08:21:39 +00:00
|
|
|
mEntry.setMaxCpuId(0);
|
|
|
|
mEntry.setMinCpuId(0);
|
2017-07-12 14:02:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool nx::ThreadInfoHandler::isSet() const
|
|
|
|
{
|
|
|
|
return mIsSet;
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
uint8_t nx::ThreadInfoHandler::getMinPriority() const
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
|
|
|
return mEntry.getMinPriority();
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
void nx::ThreadInfoHandler::setMinPriority(uint8_t priority)
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
|
|
|
mEntry.setMinPriority(priority);
|
|
|
|
mIsSet = true;
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
uint8_t nx::ThreadInfoHandler::getMaxPriority() const
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
|
|
|
return mEntry.getMaxPriority();
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
void nx::ThreadInfoHandler::setMaxPriority(uint8_t priority)
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
|
|
|
mEntry.setMaxPriority(priority);
|
|
|
|
mIsSet = true;
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
uint8_t nx::ThreadInfoHandler::getMinCpuId() const
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
2017-07-17 08:21:39 +00:00
|
|
|
return mEntry.getMinCpuId();
|
2017-07-12 14:02:10 +00:00
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
void nx::ThreadInfoHandler::setMinCpuId(uint8_t core_num)
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
2017-07-17 08:21:39 +00:00
|
|
|
mEntry.setMinCpuId(core_num);
|
2017-07-12 14:02:10 +00:00
|
|
|
mIsSet = true;
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
uint8_t nx::ThreadInfoHandler::getMaxCpuId() const
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
2017-07-17 08:21:39 +00:00
|
|
|
return mEntry.getMaxCpuId();
|
2017-07-12 14:02:10 +00:00
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
void nx::ThreadInfoHandler::setMaxCpuId(uint8_t core_num)
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
2017-07-17 08:21:39 +00:00
|
|
|
mEntry.setMaxCpuId(core_num);
|
2017-07-12 14:02:10 +00:00
|
|
|
mIsSet = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void nx::ThreadInfoHandler::copyFrom(const ThreadInfoHandler & other)
|
|
|
|
{
|
|
|
|
mIsSet = other.mIsSet;
|
|
|
|
mEntry.setKernelCapability(other.mEntry.getKernelCapability());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool nx::ThreadInfoHandler::isEqual(const ThreadInfoHandler & other) const
|
|
|
|
{
|
|
|
|
return (mIsSet == other.mIsSet) \
|
|
|
|
&& (mEntry.getKernelCapability() == other.mEntry.getKernelCapability());
|
|
|
|
}
|