本文整理汇总了C++中MultiTag::name方法的典型用法代码示例。如果您正苦于以下问题:C++ MultiTag::name方法的具体用法?C++ MultiTag::name怎么用?C++ MultiTag::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MultiTag
的用法示例。
在下文中一共展示了MultiTag::name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testRead
void BaseTestReadOnly::testRead() {
File file = File::open("test_read_only.h5", FileMode::ReadOnly);
Section section = file.getSection(section_id);
Block block = file.getBlock(block_id);
DataArray data_array = block.getDataArray(data_array_id);
Dimension dim = data_array.getDimension(dim_index);
SampledDimension dim_sampled = data_array.getDimension(dim_sampled_index).asSampledDimension();
RangeDimension dim_range = data_array.getDimension(dim_range_index).asRangeDimension();
SetDimension dim_set = data_array.getDimension(dim_set_index).asSetDimension();
Tag tag = block.getTag(tag_id);
MultiTag mtag = block.getMultiTag(mtag_id);
Feature feature = tag.getFeature(feature_id);
Property property = section.getProperty(property_id);
// TODO use assertions here
s << block.id() << block.name();
s << data_array.id() << data_array.name();
s << tag.id() << tag.name();
s << mtag.id() << mtag.name();
s << feature.id();
s << property.id() << property.name();
s << dim.index();
s << dim_sampled.index();
s << dim_range.index();
s << dim_set.index();
file.close();
}
示例2: testMultiTagAccess
void TestBlock::testMultiTagAccess() {
vector<string> names = { "tag_a", "tag_b", "tag_c", "tag_d", "tag_e" };
// create a valid positions data array below
typedef boost::multi_array<double, 3>::index index;
DataArray positions = block.createDataArray("array_one",
"testdata",
DataType::Double,
nix::NDSize({ 3, 4, 2 }));
boost::multi_array<double, 3> A(boost::extents[3][4][2]);
int values = 0;
for(index i = 0; i != 3; ++i)
for(index j = 0; j != 4; ++j)
for(index k = 0; k != 2; ++k)
A[i][j][k] = values++;
positions.setData(A);
CPPUNIT_ASSERT(block.multiTagCount() == 0);
CPPUNIT_ASSERT(block.multiTags().size() == 0);
CPPUNIT_ASSERT(block.getMultiTag("invalid_id") == false);
vector<string> ids;
for (auto it = names.begin(); it != names.end(); it++) {
MultiTag tag = block.createMultiTag(*it, "segment", positions);
CPPUNIT_ASSERT(tag.name() == *it);
ids.push_back(tag.id());
}
CPPUNIT_ASSERT_THROW(block.createMultiTag(names[0], "segment", positions),
DuplicateName);
CPPUNIT_ASSERT(block.multiTagCount() == names.size());
CPPUNIT_ASSERT(block.multiTags().size() == names.size());
for (auto it = ids.begin(); it != ids.end(); it++) {
MultiTag tag = block.getMultiTag(*it);
CPPUNIT_ASSERT(block.hasMultiTag(*it) == true);
CPPUNIT_ASSERT(tag.id() == *it);
block.deleteMultiTag(*it);
}
CPPUNIT_ASSERT(block.multiTagCount() == 0);
CPPUNIT_ASSERT(block.multiTags().size() == 0);
CPPUNIT_ASSERT(block.getMultiTag("invalid_id") == false);
}