2018-08-07 07:17:51 +00:00
|
|
|
#include <nn/hac/MiscParamsHandler.h>
|
2017-07-12 14:02:10 +00:00
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
nn::hac::MiscParamsHandler::MiscParamsHandler() :
|
2017-07-12 14:02:10 +00:00
|
|
|
mIsSet(false),
|
|
|
|
mEntry(0)
|
|
|
|
{}
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
void nn::hac::MiscParamsHandler::operator=(const MiscParamsHandler & other)
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
2018-06-24 15:01:16 +00:00
|
|
|
mIsSet = other.mIsSet;
|
|
|
|
mEntry.setKernelCapability(other.mEntry.getKernelCapability());
|
2017-07-12 14:02:10 +00:00
|
|
|
}
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
bool nn::hac::MiscParamsHandler::operator==(const MiscParamsHandler & other) const
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
2018-06-24 15:01:16 +00:00
|
|
|
return (mIsSet == other.mIsSet) \
|
|
|
|
&& (mEntry.getKernelCapability() == other.mEntry.getKernelCapability());
|
2017-07-12 14:02:10 +00:00
|
|
|
}
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
bool nn::hac::MiscParamsHandler::operator!=(const MiscParamsHandler & other) const
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
2018-06-24 15:01:16 +00:00
|
|
|
return !(*this == other);
|
2017-07-12 14:02:10 +00:00
|
|
|
}
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
void nn::hac::MiscParamsHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps)
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
2018-06-24 15:01:16 +00:00
|
|
|
if (caps.size() > kMaxKernelCapNum)
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
|
|
|
throw fnd::Exception(kModuleName, "Too many kernel capabilities");
|
|
|
|
}
|
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
if (caps.size() == 0)
|
2017-07-12 14:02:10 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
mEntry.setKernelCapability(caps[0]);
|
|
|
|
|
|
|
|
mIsSet = true;
|
|
|
|
}
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
void nn::hac::MiscParamsHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
|
|
|
if (isSet() == false)
|
|
|
|
return;
|
|
|
|
|
|
|
|
caps.addElement(mEntry.getKernelCapability());
|
|
|
|
}
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
void nn::hac::MiscParamsHandler::clear()
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
|
|
|
mIsSet = false;
|
|
|
|
mEntry.setProgramType(0);
|
|
|
|
}
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
bool nn::hac::MiscParamsHandler::isSet() const
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
|
|
|
return mIsSet;
|
|
|
|
}
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
uint8_t nn::hac::MiscParamsHandler::getProgramType() const
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
|
|
|
return mEntry.getProgramType();
|
|
|
|
}
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
void nn::hac::MiscParamsHandler::setProgramType(uint8_t type)
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
|
|
|
mEntry.setProgramType(type);
|
|
|
|
mIsSet = true;
|
2018-06-24 15:01:16 +00:00
|
|
|
}
|