/* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ /* $Source: src/usr/hwpf/fapi/fapiErrorInfo.C $ */ /* */ /* IBM CONFIDENTIAL */ /* */ /* COPYRIGHT International Business Machines Corp. 2011,2013 */ /* */ /* p1 */ /* */ /* Object Code Only (OCO) source materials */ /* Licensed Internal Code Source Materials */ /* IBM HostBoot Licensed Internal Code */ /* */ /* The source code for this program is not published or otherwise */ /* divested of its trade secrets, irrespective of what has been */ /* deposited with the U.S. Copyright Office. */ /* */ /* Origin: 30 */ /* */ /* IBM_PROLOG_END_TAG */ /** * @file fapiErrorInfo.C * * @brief Implements the ErrorInfo structs and classes */ /* * Change Log ****************************************************************** * Flag Defect/Feature User Date Description * ------ -------------- ---------- ----------- ---------------------------- * mjjones 08/05/2011 Created * mjjones 08/24/2011 Added ErrorInfoGard. * mjjones 09/22/2011 Major updates * mjjones 03/16/2012 Add FfdcType. Remove copy * ctor and assignment operator * mjjones 08/14/2012 Merge Callout/Deconfig/Gard * structures into one * mjjones 09/19/2012 Replace FFDC type with ID * mjjones 03/22/2013 Support Procedure Callouts */ #include #include namespace fapi { //****************************************************************************** // ErrorInfoFfdc Constructor //****************************************************************************** ErrorInfoFfdc::ErrorInfoFfdc(const uint32_t i_ffdcId, const void * i_pFfdc, const uint32_t i_size) : iv_ffdcId(i_ffdcId), iv_size(i_size) { iv_pFfdc = new uint8_t[i_size]; memcpy(iv_pFfdc, i_pFfdc, i_size); } //****************************************************************************** // ErrorInfoFfdc Destructor //****************************************************************************** ErrorInfoFfdc::~ErrorInfoFfdc() { delete [] iv_pFfdc; iv_pFfdc = NULL; } //****************************************************************************** // ErrorInfoFfdc getData function //****************************************************************************** const void * ErrorInfoFfdc::getData(uint32_t & o_size) const { o_size = iv_size; return iv_pFfdc; } //****************************************************************************** // ErrorInfoProcedureCallout Constructor //****************************************************************************** ErrorInfoProcedureCallout::ErrorInfoProcedureCallout( const ProcedureCallouts::ProcedureCallout i_procedure, const CalloutPriorities::CalloutPriority i_calloutPriority) : iv_procedure(i_procedure), iv_calloutPriority(i_calloutPriority) { } //****************************************************************************** // ErrorInfoCDG Constructor //****************************************************************************** ErrorInfoCDG::ErrorInfoCDG(const Target & i_target) : iv_target(i_target), iv_callout(false), iv_calloutPriority(CalloutPriorities::LOW), iv_deconfigure(false), iv_gard(false) { } //****************************************************************************** // ErrorInfo Destructor //****************************************************************************** ErrorInfo::~ErrorInfo() { for (ErrorInfo::ErrorInfoFfdcItr_t l_itr = iv_ffdcs.begin(); l_itr != iv_ffdcs.end(); ++l_itr) { delete (*l_itr); (*l_itr) = NULL; } for (ErrorInfo::ErrorInfoProcedureCalloutItr_t l_itr = iv_procedureCallouts.begin(); l_itr != iv_procedureCallouts.end(); ++l_itr) { delete (*l_itr); (*l_itr) = NULL; } for (ErrorInfo::ErrorInfoCDGItr_t l_itr = iv_CDGs.begin(); l_itr != iv_CDGs.end(); ++l_itr) { delete (*l_itr); (*l_itr) = NULL; } } //****************************************************************************** // ErrorInfo getCreateErrorInfoCDG //****************************************************************************** ErrorInfoCDG & ErrorInfo::getCreateErrorInfoCDG(const Target & i_target) { ErrorInfoCDG * l_pInfo = NULL; for (ErrorInfo::ErrorInfoCDGCItr_t l_itr = iv_CDGs.begin(); l_itr != iv_CDGs.end(); ++l_itr) { if ((*l_itr)->iv_target == i_target) { l_pInfo = (*l_itr); break; } } if (l_pInfo == NULL) { l_pInfo = new ErrorInfoCDG(i_target); iv_CDGs.push_back(l_pInfo); } return *l_pInfo; } }