本文整理汇总了C++中Array::GetColCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Array::GetColCount方法的具体用法?C++ Array::GetColCount怎么用?C++ Array::GetColCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Array
的用法示例。
在下文中一共展示了Array::GetColCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetWrapperObject
//------------------------------------------------------------------------------
void MathElement::SetWrapperObject(GmatBase *obj, const std::string &name)
{
#ifdef DEBUG_WRAPPERS
MessageInterface::ShowMessage
("MathElement::SetWrapperObject() obj=<%p>, name='%s'\n", obj, name.c_str());
#endif
refObject = (Parameter*) obj;
refObjectType = refObject->GetTypeName().c_str();
// go through wrapperObjectNames
for (UnsignedInt i=0; i<wrapperObjectNames.size(); i++)
{
if (name == wrapperObjectNames[i])
{
#ifdef DEBUG_WRAPPERS
MessageInterface::ShowMessage
(" wrapperName = '%s'\n", wrapperObjectNames[i].c_str());
#endif
// Handle array index
Integer row, col;
std::string newName;
GmatStringUtil::GetArrayIndex(wrapperObjectNames[i], row, col, newName);
// Check if name is the same
if (newName != name)
throw MathException
("MathElement::SetRefObject() Cannot find parameter name:" + name);
if (refObjectType == "Array")
{
Array *arr = (Array*)refObject;
elementType = Gmat::RMATRIX_TYPE;
Integer theRowCount = arr->GetRowCount();
Integer theColCount = arr->GetColCount();
#ifdef DEBUG_WRAPPERS
MessageInterface::ShowMessage
("MathElement::SetRefObject() elementType=%d, theRowCount=%d, "
"theColCount=%d\n", elementType, theRowCount, theColCount);
#endif
if (!matrix.IsSized())
matrix.SetSize(theRowCount, theColCount);
else
{
#ifdef DEBUG_WRAPPERS
MessageInterface::ShowMessage
("MathElement::SetRefObject() matrix already sized. "
"matrix.size=%d, %d\n", matrix.GetNumRows(),
matrix.GetNumColumns());
#endif
}
matrix = arr->GetRmatrix(); // initial value
#ifdef DEBUG_WRAPPERS
MessageInterface::ShowMessage
("MathElement::SetRefObject() name=%s, matrix=\n%s\n", name.c_str(),
matrix.ToString().c_str());
#endif
}
else if (refObject->GetReturnType() == Gmat::REAL_TYPE)
{
elementType = Gmat::REAL_TYPE;
realValue = refObject->GetReal(); // initial value
#ifdef DEBUG_WRAPPERS
MessageInterface::ShowMessage
("MathElement::SetRefObject() name=%s, elementType=%d, "
"realValue=%f\n", GetName().c_str(), elementType, realValue);
#endif
}
}
}
}