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


C++ table::row_count方法代码示例

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


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

示例1: require_valid_table

static void require_valid_table(const mesh& Mesh, const string_t& Name, const table& Table)
{
	if(Name == "constant" && Table.column_count() && Table.row_count() != 1)
		throw std::runtime_error("'constant' table must have length 1.");

	for(mesh::table_t::const_iterator array_iterator = Table.begin(); array_iterator != Table.end(); ++array_iterator)
	{
		const array* const current_array = array_iterator->second.get();
		if(!current_array)
			throw std::runtime_error("NULL table array.");

		const array* const first_array = Table.begin()->second.get();
		if(current_array->size() != first_array->size())
			throw std::runtime_error("Array length mismatch for table [" + Name + "]");

		if(current_array->get_metadata_value(metadata::key::domain()) == metadata::value::point_indices_domain())
		{
			if(!Mesh.points)
				throw std::runtime_error("Mesh missing points array.");
			
			if(!Mesh.point_selection)
				throw std::runtime_error("Mesh missing point selections array.");

			require_valid_points(Mesh);

			const mesh::indices_t* const indices = dynamic_cast<const mesh::indices_t*>(current_array);
			if(!indices)
				throw std::runtime_error("Point indices array must be an index type.");

			const mesh::indices_t::const_iterator max = std::max_element(indices->begin(), indices->end());
			if(max != indices->end() && *max >= Mesh.points->size())
				throw std::runtime_error("Point indices array out-of-bounds.");
		}
	}
}
开发者ID:AwesomeDoesIt,项目名称:k3d,代码行数:35,代码来源:primitive_validation.cpp

示例2: require_table_row_count

void require_table_row_count(const mesh::primitive& Primitive, const table& Table, const string_t& TableName, const uint_t RowCount)
{
	if(TableName == "constant")
		throw std::runtime_error("'constant' tables are automatically tested, and must have length 1.");

	if(0 == Table.column_count())
		return;

	if(Table.row_count() != RowCount)
	{
		std::ostringstream buffer;
		buffer << "[" << Primitive.type << "] table [" << TableName << "] incorrect length [" << Table.row_count() << "], expected [" << RowCount << "]";
		throw std::runtime_error(buffer.str());
	}
}
开发者ID:AwesomeDoesIt,项目名称:k3d,代码行数:15,代码来源:primitive_validation.cpp


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