<commit_before>/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/import/hwpf/fapi2/src/error_info.C $                      */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2011,2019                        */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
/**
 *  @file error_info.C
 *  @brief Implements the error information classes
 */

#include <stdint.h>
#include <string.h>
#include <plat_trace.H>
#include <error_info.H>
#include <buffer.H>

namespace fapi2
{
///
/// @brief Constructor
///
/// @param[in] i_ffdcId FFDC Identifier (used to decode FFDC)
/// @param[in] i_pFfdc  Pointer to the FFDC to copy
/// @param[in] i_size   Size of the FFDC to copy
///
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 = std::shared_ptr<uint8_t>(new uint8_t[i_size]());

    // If they passed us a NULL pointer they want to fill
    // in the data themselves later.
    if (i_pFfdc != nullptr)
    {
        memcpy(iv_pFfdc.get(), i_pFfdc, i_size);
    }
}

///
/// @brief Constructor.
///
/// @param[in] i_hw              Hardware to callout
/// @param[in] i_calloutPriority Priority of callout<commit_msg>Explicitly declare FFDC shared_ptr for space savings<commit_after>/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/import/hwpf/fapi2/src/error_info.C $                      */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2011,2019                        */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
/**
 *  @file error_info.C
 *  @brief Implements the error information classes
 */

#include <stdint.h>
#include <string.h>
#include <plat_trace.H>
#include <error_info.H>
#include <buffer.H>

//explicitly declare for space as these templates are used everywhere
template class std::shared_ptr<fapi2::ErrorInfo>;
template class std::shared_ptr<fapi2::ErrorInfoFfdc>;

namespace fapi2
{
///
/// @brief Constructor
///
/// @param[in] i_ffdcId FFDC Identifier (used to decode FFDC)
/// @param[in] i_pFfdc  Pointer to the FFDC to copy
/// @param[in] i_size   Size of the FFDC to copy
///
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 = std::shared_ptr<uint8_t>(new uint8_t[i_size]());

    // If they passed us a NULL pointer they want to fill
    // in the data themselves later.
    if (i_pFfdc != nullptr)
    {
        memcpy(iv_pFfdc.get(), i_pFfdc, i_size);
    }
}

///
/// @brief Constructor.
///
/// @param[in] i_hw              Hardware to callout
/// @param[in] i_calloutPriority Priority of callout
{'fraction_non_alphanumeric': 0.0937395379979913, 'fraction_numerical': 0.007030465349849347, 'mean_word_length': 1.0406420765027322, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 62, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5272869', 'n_tokens_mistral': 1399, 'n_tokens_neox': 1353, 'n_words': 411}