xref: /openbmc/phosphor-logging/elog_serialize.hpp (revision f18bf836d206b1bc5b4fd849127a2e706eddf0aa)
172654f10SDeepak Kodihalli #pragma once
272654f10SDeepak Kodihalli 
3*f18bf836SPatrick Venture #include "config.h"
4*f18bf836SPatrick Venture 
5*f18bf836SPatrick Venture #include "elog_entry.hpp"
6*f18bf836SPatrick Venture 
7*f18bf836SPatrick Venture #include <experimental/filesystem>
872654f10SDeepak Kodihalli #include <string>
972654f10SDeepak Kodihalli #include <vector>
1072654f10SDeepak Kodihalli 
1172654f10SDeepak Kodihalli namespace phosphor
1272654f10SDeepak Kodihalli {
1372654f10SDeepak Kodihalli namespace logging
1472654f10SDeepak Kodihalli {
1572654f10SDeepak Kodihalli 
1672654f10SDeepak Kodihalli namespace fs = std::experimental::filesystem;
1772654f10SDeepak Kodihalli 
1872654f10SDeepak Kodihalli /** @brief Serialize and persist error d-bus object
1972654f10SDeepak Kodihalli  *  @param[in] a - const reference to error entry.
2072654f10SDeepak Kodihalli  *  @param[in] dir - pathname of directory where the serialized error will
2172654f10SDeepak Kodihalli  *                   be placed.
2272654f10SDeepak Kodihalli  *  @return fs::path - pathname of persisted error file
2372654f10SDeepak Kodihalli  */
2472654f10SDeepak Kodihalli fs::path serialize(const Entry& e,
2572654f10SDeepak Kodihalli                    const fs::path& dir = fs::path(ERRLOG_PERSIST_PATH));
2672654f10SDeepak Kodihalli 
2772654f10SDeepak Kodihalli /** @brief Deserialze a persisted error into a d-bus object
2872654f10SDeepak Kodihalli  *  @param[in] path - pathname of persisted error file
2972654f10SDeepak Kodihalli  *  @param[in] e - reference to error object which is the target of
3072654f10SDeepak Kodihalli  *             deserialization.
3172654f10SDeepak Kodihalli  *  @return bool - true if the deserialization was successful, false otherwise.
3272654f10SDeepak Kodihalli  */
3372654f10SDeepak Kodihalli bool deserialize(const fs::path& path, Entry& e);
3472654f10SDeepak Kodihalli 
3572654f10SDeepak Kodihalli } // namespace logging
3672654f10SDeepak Kodihalli } // namespace phosphor
37