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


C++ DynamicArray::append方法代码示例

本文整理汇总了C++中DynamicArray::append方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicArray::append方法的具体用法?C++ DynamicArray::append怎么用?C++ DynamicArray::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DynamicArray的用法示例。


在下文中一共展示了DynamicArray::append方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: HavokDataHolder

        HavokDataHolder(hkDisplayGeometry* displayGeometry, const hkArray<hkGeometry::Triangle>& triangles)
        {
            m_pDisplayGeometry = displayGeometry;
            displayGeometry->addReference();

            m_indices.reserve(triangles.getSize() * 3);
            for(auto& triangle : triangles)
            {
                m_indices.append(triangle.m_a);
                m_indices.append(triangle.m_b);
                m_indices.append(triangle.m_c);
            }

        }
开发者ID:imbabaer,项目名称:gpp,代码行数:14,代码来源:displayhandler.cpp

示例2: select

void _FSSEnvironment::select(const Selector& atomSelector,
		DynamicArray<Operation*>& resultList) {

	// Find the criterion with the lowest number of matching operations.
	// Exclude the terminator symbol from the selector while searching.
	SelectorCriterion* startingCriterion = NULL;
	int criteriaCount = atomSelector.getCriteria().length - 1;
	for (int i = 0; i < criteriaCount; i++) {
		SelectorCriterion& criterion = atomSelector.getCriteria()[i];
		if (criterion.getType() == SelectorCriteriaType::SCT_OPERATION) {
			startingCriterion = &criterion;
			break;
		} else if (criterion.getType() == SelectorCriteriaType::SCT_CLASS) {

			if (startingCriterion == NULL || startingCriterion->getType() ==
					SelectorCriteriaType::SCT_CLASS)
			{
				if (startingCriterion == NULL || 
					criterion.getClass()->getMembers().length <
					startingCriterion->getClass()->getMembers().length) {
					startingCriterion = &criterion;
				}
			} else {
				throw AssertionFailureException("Comparing against non-class"\
						"criterion", __FILE__, __LINE__);
			}
		} else {
			throw AssertionFailureException("Invalid criterion type.",
					__FILE__, __LINE__);
		}
	}

	// Add all operations from the starting criterion to the results list
	if (startingCriterion->getType() == SCT_OPERATION) {
		resultList.append(startingCriterion->getOperation());
	} else if (startingCriterion->getType() == SCT_CLASS) {
		int memberCount = startingCriterion->getClass()->getMembers().length;
		for (int i = 0; i < memberCount; i++) {
			resultList.append(startingCriterion->getClass()->getMembers()[i]);
		}
	}

	// Remove stuff that doesn't match.
	for (int i = 0; i < criteriaCount; i++) {
		SelectorCriterion& criterion = atomSelector.getCriteria()[i];
		if (&criterion == startingCriterion) {
			continue;
		}

		int memberCount = resultList.getSize();
		for (int j = 0; j < memberCount; j++) {

			bool cull = false;
			if (criterion.getType() == SCT_OPERATION) {
				cull = resultList[i] != criterion.getOperation(); 
			} else if (criterion.getType() == SCT_CLASS) {
				cull = !resultList[i]->hasClass(*criterion.getClass());
			} else {
				throw AssertionFailureException("Invalid criterion type.",
						__FILE__, __LINE__);
			}
			
			if (cull) {
				resultList.removeAt(j);
				memberCount--;
				j--;
			}

		}
	}
}
开发者ID:andrewoftoronto,项目名称:FreeDynamics,代码行数:71,代码来源:impl_FSS.cpp


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