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


C++ NcDim::isNull方法代码示例

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


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

示例1: main

int main()
{
  try
    {
      cout<<"Opening file \"firstFile.cdf\" with NcFile::replace"<<endl;
      NcFile ncFile("firstFile.cdf",NcFile::replace);
    
      cout<<left<<setw(55)<<"Testing addGroup(\"groupName\")";
      NcGroup groupA(ncFile.addGroup("groupA"));
      NcGroup groupA0(ncFile.addGroup("groupA0"));
      NcGroup groupB(groupA.addGroup("groupB"));
      NcGroup groupC(groupA.addGroup("groupC"));
      cout <<"    -----------   passed\n";
    
      cout <<left<<setw(55)<<"Testing addDim(\"dimensionName\")";
      NcDim dim1 = ncFile.addDim("dim1",11);
      NcDim dim2 = ncFile.addDim("dim2");
      NcDim dim3 = ncFile.addDim("dim3",13);
      NcDim dim4 = groupB.addDim("dim4",14);
      NcDim dim5 = groupB.addDim("dim5",15);
      NcDim dim6 = groupB.addDim("dim6",16);
      NcDim dim7 = groupB.addDim("dim7",17);
      cout <<"    -----------   passed\n";




      cout <<left<<setw(55)<<"Testing NcDim::isUnlimited()";
      if( dim1.isUnlimited())    throw NcException("NcException","Error in test 1.1",__FILE__,__LINE__);
      if( !dim2.isUnlimited())   throw NcException("NcException","Error in test 1.2",__FILE__,__LINE__);
      if( dim3.isUnlimited())    throw NcException("NcException","Error in test 1.3",__FILE__,__LINE__);
      if( dim4.isUnlimited())    throw NcException("NcException","Error in test 1.4",__FILE__,__LINE__);
      if( dim5.isUnlimited())    throw NcException("NcException","Error in test 1.5",__FILE__,__LINE__);
      if( dim6.isUnlimited())    throw NcException("NcException","Error in test 1.6",__FILE__,__LINE__);
      if( dim7.isUnlimited())    throw NcException("NcException","Error in test 1.7",__FILE__,__LINE__);
      cout <<"    -----------   passed\n";

     cout <<left<<setw(55)<<"Testing NcDim::isNull()";
     if( dim1.isNull())    throw NcException("NcException","Error in test 2.1",__FILE__,__LINE__);
     NcDim tmpDim;
     if( !tmpDim.isNull()) throw NcException("NcException","Error in test 2.2",__FILE__,__LINE__);
      cout <<"    -----------   passed\n";

     cout <<left<<setw(55)<<"Testing NcDim::getSize()";
     if( dim1.getSize() != 11)    throw NcException("NcException","Error in test 3.1",__FILE__,__LINE__);
     if( dim2.getSize() != 0 )    throw NcException("NcException","Error in test 3.2",__FILE__,__LINE__);
     if( dim3.getSize() != 13)    throw NcException("NcException","Error in test 3.3",__FILE__,__LINE__);
     if( dim4.getSize() != 14)    throw NcException("NcException","Error in test 3.4",__FILE__,__LINE__);
     if( dim5.getSize() != 15)    throw NcException("NcException","Error in test 3.5",__FILE__,__LINE__);
     if( dim6.getSize() != 16)    throw NcException("NcException","Error in test 3.6",__FILE__,__LINE__);
     if( dim7.getSize() != 17)    throw NcException("NcException","Error in test 3.7",__FILE__,__LINE__);
     cout <<"    -----------   passed\n";

     cout <<left<<setw(55)<<"Testing NcDim::getParentGroup()";
     if( !(dim1.getParentGroup() == ncFile))   throw NcException("NcException","Error in test 4.1",__FILE__,__LINE__);
     if( !(dim2.getParentGroup() == ncFile))   throw NcException("NcException","Error in test 4.2",__FILE__,__LINE__);
     if( !(dim3.getParentGroup() == ncFile))   throw NcException("NcException","Error in test 4.3",__FILE__,__LINE__);
     if( !(dim4.getParentGroup() == groupB))   throw NcException("NcException","Error in test 4.4",__FILE__,__LINE__);
     if( !(dim5.getParentGroup() == groupB))   throw NcException("NcException","Error in test 4.5",__FILE__,__LINE__);
     if( !(dim6.getParentGroup() == groupB))   throw NcException("NcException","Error in test 4.6",__FILE__,__LINE__);
     if( !(dim7.getParentGroup() == groupB))   throw NcException("NcException","Error in test 4.7",__FILE__,__LINE__);
     cout <<"    -----------   passed\n";

     cout <<left<<setw(55)<<"Testing NcDim::getName()";
     if( dim1.getName() != "dim1")   throw NcException("NcException","Error in test 5.1",__FILE__,__LINE__);
     if( dim2.getName() != "dim2")   throw NcException("NcException","Error in test 5.2",__FILE__,__LINE__);
     if( dim3.getName() != "dim3")   throw NcException("NcException","Error in test 5.3",__FILE__,__LINE__);
     if( dim4.getName() != "dim4")   throw NcException("NcException","Error in test 5.4",__FILE__,__LINE__);
     if( dim5.getName() != "dim5")   throw NcException("NcException","Error in test 5.5",__FILE__,__LINE__);
     if( dim6.getName() != "dim6")   throw NcException("NcException","Error in test 5.6",__FILE__,__LINE__);
     if( dim7.getName() != "dim7")   throw NcException("NcException","Error in test 5.7",__FILE__,__LINE__);
     cout <<"    -----------   passed\n";





      cout <<left<<setw(55)<<"Testing NcGroup::getDimCount([netCDF::Location])";
      if( ncFile.getDimCount() != 3)                           throw NcException("NcException","Error in test 6.1",__FILE__,__LINE__);
      if( ncFile.getDimCount(NcGroup::Current) != 3)           throw NcException("NcException","Error in test 6.2",__FILE__,__LINE__);
      if( ncFile.getDimCount(NcGroup::All) != 7)               throw NcException("NcException","Error in test 6.3",__FILE__,__LINE__);
      if( ncFile.getDimCount(NcGroup::Parents) != 0)           throw NcException("NcException","Error in test 6.4",__FILE__,__LINE__);
      if( ncFile.getDimCount(NcGroup::Children) != 4)          throw NcException("NcException","Error in test 6.5",__FILE__,__LINE__);
      if( ncFile.getDimCount(NcGroup::ParentsAndCurrent) != 3) throw NcException("NcException","Error in test 6.6",__FILE__,__LINE__);
      if( ncFile.getDimCount(NcGroup::ChildrenAndCurrent) != 7)throw NcException("NcException","Error in test 6.7",__FILE__,__LINE__);
      if( groupA.getDimCount() != 0)                           throw NcException("NcException","Error in test 6.8",__FILE__,__LINE__);
      if( groupA.getDimCount(NcGroup::Current) != 0)           throw NcException("NcException","Error in test 6.9",__FILE__,__LINE__);
      if( groupA.getDimCount(NcGroup::All) != 7)               throw NcException("NcException","Error in test 6.10",__FILE__,__LINE__);
      if( groupA.getDimCount(NcGroup::Parents) != 3)           throw NcException("NcException","Error in test 6.11",__FILE__,__LINE__);
      if( groupA.getDimCount(NcGroup::Children) != 4)          throw NcException("NcException","Error in test 6.12",__FILE__,__LINE__);
      if( groupA.getDimCount(NcGroup::ParentsAndCurrent) != 3) throw NcException("NcException","Error in test 6.13",__FILE__,__LINE__);
      if( groupA.getDimCount(NcGroup::ChildrenAndCurrent) != 4)throw NcException("NcException","Error in test 6.14",__FILE__,__LINE__);
      cout <<"    -----------   passed\n";


	
      cout <<left<<setw(55)<<"Testing NcGroup::getDims([netCDF::Location])";
      {
	multimap<string,NcDim> dimMap;
	multimap<string,NcDim>::iterator iter;
//.........这里部分代码省略.........
开发者ID:Federico2014,项目名称:edg4x-rose,代码行数:101,代码来源:test_dim.cpp


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