⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simple-test.cc

📁 MICO2.3.13 corba 环境平台
💻 CC
📖 第 1 页 / 共 4 页
字号:
  cout << "Checking RoleFactory::NilRelatedObject exception  ..." << flush;  exception = FALSE;#ifdef HAVE_EXCEPTIONS  try {#endif    role1 = CosContainment::ContainsRole::_narrow       (contains_factory->create_role        (CosGraphs::Node::_nil ()));#ifdef HAVE_EXCEPTIONS  } catch (CosRelationships::RoleFactory::NilRelatedObject_catch &ex1) {    exception = TRUE;  }#endif  if (exception)    cout << "ok.\n" << flush;  else {    cout << "failed.\n" << flush;  }  #ifdef HAVE_EXCEPTIONS  try {#endif    fig2 = Documents::Figure::_narrow (figure_factory->create ("fig2.jpg"));    node2 = CosGraphs::Node::_narrow       (node_factory->create_node (fig2));    role2 = CosContainment::ContainedInRole::_narrow       (containedin_factory->create_role        (node2));        role1 = CosContainment::ContainsRole::_narrow      (contains_factory->create_role       (node1));#ifdef HAVE_EXCEPTIONS  } catch (CosRelationships::RoleFactory::RelatedObjectTypeError_catch &ex1) {    cout << "RelatedObjectTypeError!\n" << flush;  }#endif  assert (!CORBA::is_nil (role1));  assert (!CORBA::is_nil (role2));  exception = FALSE;    cout << "Checking RelationshipFactory::create () ..." << flush;  CosRelationships::NamedRoles nr;  nr.length (2);  nr[0].name = CORBA::string_dup ("ContainsRole");  nr[0].aRole = CosRelationships::Role::_duplicate (role1);  nr[1].name = CORBA::string_dup ("ContainedInRole");  nr[1].aRole = CosRelationships::Role::_duplicate (role2);  #ifdef HAVE_EXCEPTIONS  try {#endif    relship1 = CosContainment::Relationship::_narrow      (containment_factory->create (nr));#ifdef HAVE_EXCEPTIONS  }   catch (CosRelationships::RelationshipFactory::DegreeError_catch &ex) {    cout << "DegreeError exception!!!\n" << flush;    cout << "Required degree is " << ex->required_degree << "\n" << flush;    relship1 = CosContainment::Relationship::_nil ();  }   catch (CosRelationships::RelationshipFactory::DuplicateRoleName_catch &ex) {    cout << "DuplicateRoleName exception!!!\n" << flush;    cout << "ex->culprits.length () = " << (ex->culprits).length () << "\n" << flush;    for (unsigned int i=0; i<(ex->culprits).length () ; i++) {      cout << i << ". name: " << (ex->culprits[i]).name << "\n" << flush;    }    relship1 = CosContainment::Relationship::_nil ();  }   catch (CosRelationships::RelationshipFactory::UnknownRoleName_catch &ex) {    cout << "UnknownRoleName exception!!!\n" << flush;    cout << "ex->culprits.length () = " << (ex->culprits).length () << "\n" << flush;    for (unsigned int i=0; i< (ex->culprits).length (); i++) {      cout << i << ". name: " << (ex->culprits[i]).name << "\n" << flush;    }    relship1 = CosContainment::Relationship::_nil ();    cout << "End of catch statement!\n" << flush;  }#endif  if (!CORBA::is_nil (relship1)) {    cout << "ok.\n" << flush;  }  else {    cout << "failed.\n";  }  exception = FALSE;  state_good = FALSE;  cout << "Checking RelationshipFactory::UnknownRoleName exception  ..."        << flush;  nr.length (2);  nr[0].name = strdup ("Ha");  nr[0].aRole = CosRelationships::Role::_duplicate (role1);  nr[1].name = strdup ("ConatinedInRole");  nr[1].aRole = CosRelationships::Role::_duplicate (role2);  #ifdef HAVE_EXCEPTIONS  try {#endif    relship1 = CosContainment::Relationship::_narrow       (containment_factory->create (nr));#ifdef HAVE_EXCEPTIONS  }   catch (CosRelationships::RelationshipFactory::DegreeError_catch &ex) {    cout << "DegreeError exception!!!\n" << flush;    cout << "Required degree is " << ex->required_degree << "\n" << flush;    exception = TRUE;  }   catch (CosRelationships::RelationshipFactory::DuplicateRoleName_catch &ex) {    cout << "DuplicateRoleName exception!!!\n" << flush;    cout << "ex->culprits.length () = " << (ex->culprits).length () << "\n" << flush;    for (unsigned int i=0; i<(ex->culprits).length () ; i++) {      cout << i << ". name: " << (ex->culprits[i]).name << "\n" << flush;    }    exception = TRUE;  }   catch (CosRelationships::RelationshipFactory::UnknownRoleName_catch &ex) {    //       cout << "UnknownRoleName exception!!!\n" << flush;    //       cout << "ex->culprits.length () = " << (ex->culprits).length () << "\n"     //       << flush;    //       for (int i=0; i< (ex->culprits).length (); i++) {    //         cout << i << ". name: " << (ex->culprits[i]).name << "\n" << flush;    //       }    state_good = TRUE;  }#endif  if (state_good) {    cout << "ok.\n" << flush;  }  else     cout << "failed.\n" << flush;  exception = FALSE;  state_good = FALSE;  cout << "Checking RelationshipFactory::DuplicateRoleName exception  ..."        << flush;  nr.length (2);  nr[0].name = CORBA::string_dup ("ContainsRole");  nr[0].aRole = CosRelationships::Role::_duplicate (role1);  nr[1].name = CORBA::string_dup ("ContainsRole");  nr[1].aRole = CosRelationships::Role::_duplicate (role1); #ifdef HAVE_EXCEPTIONS  try {#endif    relship1 = CosContainment::Relationship::_narrow      (containment_factory->create (nr));#ifdef HAVE_EXCEPTIONS  }   catch (CosRelationships::RelationshipFactory::DegreeError_catch &ex) {    cout << "DegreeError exception!!!\n" << flush;    cout << "Required degree is " << ex->required_degree << "\n" << flush;    exception = TRUE;  }   catch (CosRelationships::RelationshipFactory::DuplicateRoleName_catch &ex) {    //       cout << "DuplicateRoleName exception!!!\n" << flush;    //       cout << "ex->culprits.length () = " << (ex->culprits).length () << "\n"    //            << flush;    //       for (int i=0; i<(ex->culprits).length () ; i++) {    //         cout << i << ". name: " << (ex->culprits[i]).name << "\n" << flush;    //       }    state_good = TRUE;  }   catch (CosRelationships::RelationshipFactory::UnknownRoleName_catch &ex) {    cout << "UnknownRoleName exception!!!\n" << flush;    cout << "ex->culprits.length () = " << (ex->culprits).length () << "\n" << flush;    for (unsigned int i=0; i< (ex->culprits).length (); i++) {      cout << i << ". name: " << (ex->culprits[i]).name << "\n" << flush;    }    exception = TRUE;    cout << "End of catch statement!\n" << flush;  }#endif  if (state_good)     cout << "ok.\n" << flush;  else    cout << "failed.\n" << flush;  exception = FALSE;  state_good = FALSE;  cout << "Checking RelationshipFactory::DegreeError exception  ..." << flush;  nr.length (3);  nr[0].name = CORBA::string_dup ("ContainsRole");  nr[0].aRole = CosRelationships::Role::_duplicate (role1);  nr[1].name = CORBA::string_dup ("ContainedInRole");  nr[1].aRole = CosRelationships::Role::_duplicate (role2);  nr[2].name = CORBA::string_dup ("ContainedInRole");  nr[2].aRole = CosRelationships::Role::_duplicate (role2);#ifdef HAVE_EXCEPTIONS  try {#endif    relship1 = CosContainment::Relationship::_narrow       (containment_factory->create (nr));#ifdef HAVE_EXCEPTIONS  }   catch (CosRelationships::RelationshipFactory::DegreeError_catch &ex) {    //       cout << "DegreeError exception!!!\n" << flush;    //       cout << "Required degree is " << ex->required_degree << "\n" << flush;    state_good = TRUE;  }   catch (CosRelationships::RelationshipFactory::DuplicateRoleName_catch &ex) {    cout << "DuplicateRoleName exception!!!\n" << flush;    cout << "ex->culprits.length () = " << (ex->culprits).length () << "\n" << flush;    for (unsigned int i=0; i<(ex->culprits).length () ; i++) {      cout << i << ". name: " << (ex->culprits[i]).name << "\n" << flush;    }    exception = TRUE;  }   catch (CosRelationships::RelationshipFactory::UnknownRoleName_catch &ex) {    cout << "UnknownRoleName exception!!!\n" << flush;    cout << "ex->culprits.length () = " << (ex->culprits).length () << "\n" << flush;    for (unsigned int i=0; i< (ex->culprits).length (); i++) {      cout << i << ". name: " << (ex->culprits[i]).name << "\n" << flush;    }    exception = TRUE;    cout << "End of catch statement!\n" << flush;  }#endif  if (state_good)     cout << "ok.\n" << flush;  else    cout << "failed\n" << flush;  exception = FALSE;  state_good = FALSE;  cout << "Checking RelationshipFactory::RoleTypeError exception  ..."        << flush;  nr.length (2);  nr[0].name = CORBA::string_dup ("ContainsRole");  nr[0].aRole = CosRelationships::Role::_duplicate (role1);  nr[1].name = CORBA::string_dup ("ContainedInRole");  nr[1].aRole = CosRelationships::Role::_duplicate (role1);  // ContainedInRole#ifdef HAVE_EXCEPTIONS   try {#endif    relship1 = CosContainment::Relationship::_narrow      (containment_factory->create (nr));#ifdef HAVE_EXCEPTIONS  }   catch (CosRelationships::RelationshipFactory::DegreeError_catch &ex) {    cout << "DegreeError exception!!!\n" << flush;    cout << "Required degree is " << ex->required_degree << "\n" << flush;    exception = TRUE;  }   catch (CosRelationships::RelationshipFactory::DuplicateRoleName_catch &ex) {    cout << "DuplicateRoleName exception!!!\n" << flush;    cout << "ex->culprits.length () = " << (ex->culprits).length () << "\n" << flush;    for (unsigned int i=0; i<(ex->culprits).length () ; i++) {      cout << i << ". name: " << (ex->culprits[i]).name << "\n" << flush;    }    exception = TRUE;  }   catch (CosRelationships::RelationshipFactory::UnknownRoleName_catch &ex) {    cout << "UnknownRoleName exception!!!\n" << flush;    cout << "ex->culprits.length () = " << (ex->culprits).length () << "\n" << flush;    for (unsigned int i=0; i< (ex->culprits).length (); i++) {      cout << i << ". name: " << (ex->culprits[i]).name << "\n" << flush;    }    exception = TRUE;    cout << "End of catch statement!\n" << flush;  }  catch (CosRelationships::RelationshipFactory::RoleTypeError_catch &ex) {    //      cout << "RoleTypeError exception!!!\n" << flush;    //      cout << "ex->culprits.length () = " << (ex->culprits).length () << "\n" << flush;    //      for (int i=0; i< (ex->culprits).length (); i++) {    //        cout << i << ". name: " << (ex->culprits[i]).name << "\n" << flush;    //      }    state_good = TRUE;  }#endif  if (state_good)    cout << "ok.\n" << flush;  else    cout << "failed.\n" << flush;  exception = FALSE;  state_good = FALSE;  cout << "Checking RelationshipFactory::MaxCardinalityExceeded exception  ..."       << flush;  nr.length (2);  nr[0].name = CORBA::string_dup ("ContainsRole");  nr[0].aRole = CosRelationships::Role::_duplicate (role1);  nr[1].name = CORBA::string_dup ("ContainedInRole");  // will be twice  nr[1].aRole = CosRelationships::Role::_duplicate (role2);#ifdef HAVE_EXCEPTIONS  try {#endif    relship1 = CosContainment::Relationship::_narrow       (containment_factory->create (nr));#ifdef HAVE_EXCEPTIONS  }   catch (CosRelationships::RelationshipFactory::DegreeError_catch &ex) {    cout << "DegreeError exception!!!\n" << flush;    cout << "Required degree is " << ex->required_degree << "\n" << flush;    exception = TRUE;  }   catch (CosRelationships::RelationshipFactory::DuplicateRoleName_catch &ex) {    cout << "DuplicateRoleName exception!!!\n" << flush;    cout << "ex->culprits.length () = " << (ex->culprits).length () << "\n" << flush;    for (unsigned int i=0; i<(ex->culprits).length () ; i++) {      cout << i << ". name: " << (ex->culprits[i]).name << "\n" << flush;    }    exception = TRUE;  }   catch (CosRelationships::RelationshipFactory::UnknownRoleName_catch &ex) {    cout << "UnknownRoleName exception!!!\n" << flush;    cout << "ex->culprits.length () = " << (ex->culprits).length () << "\n" << flush;    for (unsigned int i=0; i< (ex->culprits).length (); i++) {      cout << i << ". name: " << (ex->culprits[i]).name << "\n" << flush;    }    exception = TRUE;    cout << "End of catch statement!\n" << flush;  }  catch (CosRelationships::RelationshipFactory::MaxCardinalityExceeded_catch &ex) {    //       cout << "MaxCardinalityExceeded exception!!!\n" << flush;    //       cout << "ex->culprits.length () = " << (ex->culprits).length () << "\n" << flush;    //       for (int i=0; i< (ex->culprits).length (); i++) {    //         cout << i << ". name: " << (ex->culprits[i]).name << "\n" << flush;    //       }    state_good = TRUE;  }#endif  if (state_good)    cout << "ok.\n" << flush;  else    cout << "failed.\n" << flush;  cout << "Checking Role::get_relationships ()  ..." << flush;  CosRelationships::RelationshipIterator_var     iterator = CosRelationships::RelationshipIterator::_nil ();  CosRelationships::RelationshipHandles* rel_handles;  rel_handles = NULL;  role1->get_relationships (3, rel_handles, iterator);  if ((rel_handles != NULL) && (CORBA::is_nil (iterator))) {    rel_handles = NULL;    iterator = CosRelationships::RelationshipIterator::_nil ();    role1->get_relationships (0, rel_handles, iterator);    if (rel_handles->length () == 0)       if (!CORBA::is_nil (iterator))	cout << "ok.\n" << flush;      else	cout << "error3!\n" << flush;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -