当前位置: 首页>>代码示例>>C++>>正文


C++ Array::GetColCount方法代码示例

本文整理汇总了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
         }
      }
   }
}
开发者ID:rockstorm101,项目名称:GMAT,代码行数:79,代码来源:MathElement.cpp


注:本文中的Array::GetColCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。