本文整理汇总了C++中ObjectArray::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectArray::empty方法的具体用法?C++ ObjectArray::empty怎么用?C++ ObjectArray::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectArray
的用法示例。
在下文中一共展示了ObjectArray::empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetTankFromSpacecraft
//------------------------------------------------------------------------------
// bool SetTankFromSpacecraft()
//------------------------------------------------------------------------------
bool ImpulsiveBurn::SetTankFromSpacecraft()
{
#ifdef DEBUG_IMPBURN_SET
MessageInterface::ShowMessage
("ImpulsiveBurn::SetTankFromSpacecraft() entered, spacecraft=<%p>'%s'\n",
spacecraft, spacecraft ? spacecraft->GetName().c_str() : "NULL");
MessageInterface::ShowMessage(" tankNames.size()=%d\n", tankNames.size());
#endif
if (spacecraft == NULL)
return false;
if (tankNames.empty())
throw BurnException("ImpulsiveBurn::Initialize() " + instanceName +
" has no associated tank");
ObjectArray tankArray = spacecraft->GetRefObjectArray(Gmat::FUEL_TANK);
#ifdef DEBUG_IMPBURN_SET
MessageInterface::ShowMessage
(" spacecraft tankArray.size()=%d\n", tankArray.size());
#endif
if (!tankNames.empty() && !tankArray.empty())
{
ObjectArray::iterator scTank = tankArray.begin();
// Find the tank on the spacecraft
for (StringArray::iterator tankName = tankNames.begin();
tankName != tankNames.end(); ++tankName)
{
while (scTank != tankArray.end())
{
#ifdef DEBUG_IMPBURN_SET
MessageInterface::ShowMessage
(" The tank '%s' associated with spacecraft is <%p>'%s'\n",
(*tankName).c_str(), (*scTank),
(*scTank) ? (*scTank)->GetName().c_str() : "NULL");
#endif
// Just in case, check for NULL tank pointer
if (*scTank == NULL)
continue;
// Assign the tank
if ((*scTank)->GetName() == *tankName)
{
tankMap[*tankName] = (*scTank);
#ifdef DEBUG_IMPBURN_SET
MessageInterface::ShowMessage
(" Assigned <%p>'%s' to tankMap\n", *scTank, (*tankName).c_str());
#endif
}
++scTank;
}
}
if (tankNames.size() != tankMap.size())
throw BurnException("The impulsive burn " + instanceName +
" could not find the fuel tank needed to deplete mass; please "
"attach the tank to the spacecraft " + spacecraft->GetName() +
" or turn off mass depletion.");
}
#ifdef DEBUG_IMPBURN_SET
MessageInterface::ShowMessage
("ImpulsiveBurn::SetTankFromSpacecraft() returning true\n");
#endif
return true;
}