本文整理汇总了C++中Participant::getDomainCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Participant::getDomainCount方法的具体用法?C++ Participant::getDomainCount怎么用?C++ Participant::getDomainCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Participant
的用法示例。
在下文中一共展示了Participant::getDomainCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
std::shared_ptr<XmlNode> DptfStatus::getArbitratorXmlForLoadedParticipants()
{
auto root = XmlNode::createRoot();
root->addChild(XmlNode::createComment("format_id=" + ArbitratorStatusFormatId.toString()));
auto arbitratorRoot = XmlNode::createWrapperElement("arbitrator_status");
auto participantIndexList = m_participantManager->getParticipantIndexes();
auto numberOfUniqueDomains = 0;
for (auto participantIndex = participantIndexList.begin(); participantIndex != participantIndexList.end(); ++participantIndex)
{
try
{
Participant* participant = m_participantManager->getParticipantPtr(*participantIndex);
numberOfUniqueDomains = numberOfUniqueDomains + participant->getDomainCount();
}
catch (...)
{
// Participant not available
}
}
arbitratorRoot->addChild(XmlNode::createDataElement("number_of_domains", StatusFormat::friendlyValue(numberOfUniqueDomains)));
auto policyIndexes = m_policyManager->getPolicyIndexes();
for (auto policyIndex = policyIndexes.begin(); policyIndex != policyIndexes.end(); ++policyIndex)
{
try
{
Policy* policy = m_policyManager->getPolicyPtr(*policyIndex);
std::string name = policy->getName();
auto policyRoot = XmlNode::createWrapperElement("policy");
auto policyName = XmlNode::createDataElement("policy_name", name);
policyRoot->addChild(policyName);
for (auto participantIndex = participantIndexList.begin(); participantIndex != participantIndexList.end(); ++participantIndex)
{
try
{
Participant* participant = m_participantManager->getParticipantPtr(*participantIndex);
policyRoot->addChild(participant->getArbitrationXmlForPolicy(*policyIndex));
}
catch (...)
{
// Participant not available
}
}
arbitratorRoot->addChild(policyRoot);
}
catch (...)
{
// Policy not available, do not add.
}
}
root->addChild(arbitratorRoot);
return root;
}
示例2: getXmlForParticipant
std::string DptfStatus::getXmlForParticipant(UInt32 mappedIndex, eEsifError* returnCode)
{
auto participantIndexList = m_participantManager->getParticipantIndexes();
UIntN totalDomainCount = 0;
// Total # of participants + domains for error checking
for (auto i = participantIndexList.begin(); i != participantIndexList.end(); ++i)
{
try
{
Participant* participant = m_participantManager->getParticipantPtr(*i);
totalDomainCount += participant->getDomainCount();
}
catch (...)
{
// If participant pointer couldn't be returned or couldn't get domain count
// Most likely, a participant was removed and left bind a null pointer
}
}
if (mappedIndex >= totalDomainCount)
{
*returnCode = ESIF_E_UNSPECIFIED;
throw dptf_exception("Invalid participant status requested.");
}
try
{
auto participantData = m_participantStatusMap->getStatusAsXml(mappedIndex);
std::string s = participantData->toString();
return s;
}
catch (...)
{
*returnCode = ESIF_E_UNSPECIFIED;
throw;
}
}