Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:54:06

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