本文整理汇总了C++中table::column_count方法的典型用法代码示例。如果您正苦于以下问题:C++ table::column_count方法的具体用法?C++ table::column_count怎么用?C++ table::column_count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类table
的用法示例。
在下文中一共展示了table::column_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.");
}
}
}
示例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());
}
}