Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:03:42

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2022-2024 UT-Battelle, LLC, and other Celeritas developers.
0003 // See the top-level COPYRIGHT file for details.
0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0005 //---------------------------------------------------------------------------//
0006 //! \file corecel/io/LabelIO.json.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include <nlohmann/json.hpp>
0011 
0012 #include "Label.hh"
0013 
0014 namespace celeritas
0015 {
0016 //---------------------------------------------------------------------------//
0017 /*!
0018  * Read a label from a JSON file.
0019  */
0020 inline void from_json(nlohmann::json const& j, Label& value)
0021 {
0022     value = Label::from_separator(j.get<std::string>());
0023 }
0024 
0025 //---------------------------------------------------------------------------//
0026 /*!
0027  * Write a label to a JSON file.
0028  */
0029 inline void to_json(nlohmann::json& j, Label const& value)
0030 {
0031     j = to_string(value);
0032 }
0033 
0034 //---------------------------------------------------------------------------//
0035 }  // namespace celeritas