本文整理汇总了C++中GmatBase::GetType方法的典型用法代码示例。如果您正苦于以下问题:C++ GmatBase::GetType方法的具体用法?C++ GmatBase::GetType怎么用?C++ GmatBase::GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GmatBase
的用法示例。
在下文中一共展示了GmatBase::GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VerifyAddHardware
//-------------------------------------------------------------------------
// This function is used to verify GroundStation's added hardware.
//
// return true if there is no error, false otherwise.
//-------------------------------------------------------------------------
// made changes by Tuan Nguyen
bool GroundStation::VerifyAddHardware()
{
Gmat::ObjectType type;
std::string subTypeName;
GmatBase* obj;
// 1. Verify all hardware in hardwareList are not NULL:
for(ObjectArray::iterator i= hardwareList.begin(); i != hardwareList.end(); ++i)
{
obj = (*i);
if (obj == NULL)
{
MessageInterface::ShowMessage("***Error***:One element of hardwareList = NULL\n");
return false;
}
}
// 2. Verify primary antenna to be in hardwareList:
// 2.1. Create antenna list from hardwareList for searching:
// extract all antenna from hardwareList and store to antennaList
ObjectArray antennaList;
for(ObjectArray::iterator i= hardwareList.begin(); i != hardwareList.end(); ++i)
{
obj = (*i);
subTypeName = obj->GetTypeName();
if (subTypeName == "Antenna")
antennaList.push_back(obj);
}
// 2.2. Verify primary antenna of Receiver, Transmitter, and Transponder:
GmatBase* antenna;
GmatBase* primaryAntenna;
std::string primaryAntennaName;
bool verify = true;
for(ObjectArray::iterator i= hardwareList.begin(); i != hardwareList.end(); ++i)
{
obj = (*i);
type = obj->GetType();
if (type == Gmat::HARDWARE)
{
subTypeName = obj->GetTypeName();
if ((subTypeName == "Transmitter")||
(subTypeName == "Receiver")||
(subTypeName == "Transponder"))
{
// Get primary antenna:
primaryAntennaName = obj->GetRefObjectName(Gmat::HARDWARE);
primaryAntenna = obj->GetRefObject(Gmat::HARDWARE,primaryAntennaName);
bool check;
if (primaryAntenna == NULL)
{
MessageInterface::ShowMessage
("***Error***:primary antenna of %s in %s's AddHardware list is NULL \n",
obj->GetName().c_str(), this->GetName().c_str());
check = false;
}
else
{
// Check primary antenna of transmitter, receiver, or transponder is in antenna list:
check = false;
for(ObjectArray::iterator j= antennaList.begin(); j != antennaList.end(); ++j)
{
antenna = (*j);
if (antenna == primaryAntenna)
{
check = true;
break;
}
else if (antenna->GetName() == primaryAntenna->GetName())
{
MessageInterface::ShowMessage
("Primary antenna %s of %s is a clone of an antenna in %s's AddHardware\n",
primaryAntenna->GetName().c_str(), obj->GetName().c_str(), this->GetName().c_str());
}
}
if (check == false)
{
// Display error message:
MessageInterface::ShowMessage
("***Error***:primary antenna of %s is not in %s's AddHardware\n",
obj->GetName().c_str(), this->GetName().c_str());
}
}
verify = verify && check;
}
}
}
return verify;
}