/* doc: <routine name="eif_twin" export="public"> doc: <summary>Default implementation of feature {ANY}.twin.</summary> doc: <thread_safety>Safe</thread_safety> doc: <synchronization>None required</synchronization> doc: </routine> */ rt_public EIF_REFERENCE eif_twin (EIF_REFERENCE Current) { EIF_BOOLEAN a; EIF_REFERENCE Result = NULL; EIF_GET_CONTEXT REQUIRE ("current_attached", Current); RT_GC_PROTECT (Current); /* Protect against GC */ RT_GC_PROTECT (Result); a = c_check_assert (EIF_FALSE); Result = eclone (Current); if (!egc_has_old_copy_semantic) { /* When using the new semantic for `copy', we have to perform * a shallow copy of the object being twined before call `copy'. */ ecopy (Current, Result); } #ifdef WORKBENCH call_copy (Dtype (Result), Result, Current); #else egc_copy [Dtype (Result)] (Result, Current); #endif c_check_assert (a); RT_GC_WEAN_N(2); /* Remove protection */ return Result; }
/* doc: <routine name="eif_standard_twin" export="public"> doc: <summary>Default implementation of feature {ANY}.standard_twin.</summary> doc: <thread_safety>Safe</thread_safety> doc: <synchronization>None required</synchronization> doc: </routine> */ rt_public EIF_REFERENCE eif_standard_twin (EIF_REFERENCE Current) { EIF_BOOLEAN a; EIF_REFERENCE Result = NULL; EIF_GET_CONTEXT REQUIRE ("current_attached", Current); RT_GC_PROTECT (Current); /* Protect against GC */ RT_GC_PROTECT (Result); a = c_check_assert (EIF_FALSE); Result = eclone (Current); ecopy (Current, Result); c_check_assert (a); RT_GC_WEAN_N(2); /* Remove protection */ return Result; }
rt_public EIF_REFERENCE rtclone(EIF_REFERENCE source) { /* Clone source, copy the source in the clone and return the clone */ EIF_GET_CONTEXT EIF_REFERENCE result = NULL; /* Address of the cloned object */ if (source == (EIF_REFERENCE) 0) return (EIF_REFERENCE) 0; /* Object protections in case of GC cycle */ RT_GC_PROTECT(source); RT_GC_PROTECT(result); result = eclone (source); /* Clone object */ ecopy (source, result); /* Performs copy from `source' to `result' */ RT_GC_WEAN_N(2); /* Remove protection */ ENSURE ("result_created", result); return result; /* Pointer to the cloned object */ }
int main() { try { func1(); } catch (edm::Exception& e) { if(e.explainSelf() != answer) { std::cerr << "Exception message incorrect.\n" "==expected==\n" << answer << "\n==message==\n" <<e.explainSelf() << std::endl; abort(); } edm::Exception ecopy(e); if (e.explainSelf() != ecopy.explainSelf()) { abort(); } } catch (cms::Exception& e) { abort(); } edm::Exception e1(edm::errors::Unknown, "blah"); edm::Exception e1String(edm::errors::Unknown, std::string("blah")); if (e1.explainSelf() != e1String.explainSelf()) { abort(); } if (e1.returnCode() != 8003) { abort(); } if (e1.category() != std::string("Unknown")) { abort(); } if (e1.message() != std::string("blah ")) { abort(); } cms::Exception* ptr = &e1; cms::Exception* ptrCloneCopy = ptr->clone(); if (ptrCloneCopy->returnCode() != 8003) { abort(); } try { edm::Exception::throwThis(edm::errors::ProductNotFound, "a", "b", "c", "d", "e"); } catch (edm::Exception & ex) { if (ex.explainSelf() != std::string( "An exception of category 'ProductNotFound' occurred.\n" "Exception Message:\n" "a bcde\n")) { abort(); } } try { edm::Exception::throwThis(edm::errors::ProductNotFound, "a", 1, "b"); } catch (edm::Exception & ex) { if (ex.explainSelf() != std::string( "An exception of category 'ProductNotFound' occurred.\n" "Exception Message:\n" "a 1b\n")) { abort(); } } return 0; }