Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-13 08:21:03

0001 #ifndef G4HepEmDataJsonIO_HH
0002 #define G4HepEmDataJsonIO_HH
0003 
0004 #include <iosfwd>
0005 
0006 struct G4HepEmParameters;
0007 struct G4HepEmData;
0008 struct G4HepEmState;
0009 
0010 /**
0011  * @file    G4HepEmDataJsonIO.hh
0012  * @author  B. Morgan
0013  * @date    2021
0014  *
0015  * @brief Functions to (de)serialize ``G4HepEMData`` data structures to/from JSON
0016  */
0017 
0018 /**
0019  * Write a ``G4HepEmParameters` object to an output stream as JSON text
0020  *
0021  * @param[in,out] os output stream to serialize to
0022  * @param[in] params ``G4HepEmParameters to serialize
0023  *
0024  * @pre params must not be nullptr
0025  *
0026  * @return true if the serialization completed correctly
0027  */
0028 bool G4HepEmParametersToJson(std::ostream& os, const G4HepEmParameters* params);
0029 
0030 /**
0031  * Create a new ``G4HepEmParameters`` instance from an input stream of JSON data
0032  *
0033  * @param[in] is input stream to read data from
0034  * @return pointer to newly constructed ``G4HepEmParameters`` instance
0035  *
0036  * @post return value is ``nullptr`` if the data could not be read correctly
0037  */
0038 G4HepEmParameters* G4HepEmParametersFromJson(std::istream& is);
0039 
0040 /**
0041  * Write a ``G4HepEmData`` object to an output stream as JSON text
0042  *
0043  * @param[in,out] os output stream to serialize to
0044  * @param[in] data ``G4HepEmData`` to serialize
0045  *
0046  * @pre data must not be nullptr
0047  *
0048  * @return true if the serialization completed correctly
0049  */
0050 bool G4HepEmDataToJson(std::ostream& os, const G4HepEmData* data);
0051 
0052 /**
0053  * Create a new ``G4HepEmData`` instance from an input stream of JSON data
0054  *
0055  * @param[in] is input stream to read data from
0056  *
0057  * @return pointer to newly constructed ``G4HepEMData`` instance
0058  *
0059  * @post return value is ``nullptr`` if the data could not be read correctly
0060  */
0061 G4HepEmData* G4HepEmDataFromJson(std::istream& is);
0062 
0063 /**
0064  * Write a ``G4HepEmState`` object to an output stream as JSON text
0065  *
0066  * @param[in,out] os output stream to serialize to
0067  * @param[in] data ``G4HepEmState`` to serialize
0068  *
0069  * @pre data must not be nullptr
0070  *
0071  * @return true if the serialization completed correctly
0072  */
0073 bool G4HepEmStateToJson(std::ostream& os, const G4HepEmState* data);
0074 
0075 /**
0076  * Create a new ``G4HepEmState`` instance from an input stream of JSON data
0077  *
0078  * @param[in] is input stream to read data from
0079  *
0080  * @return pointer to newly constructed ``G4HepEMState`` instance
0081  *
0082  * @post return value is ``nullptr`` if the data could not be read correctly
0083  */
0084 G4HepEmState* G4HepEmStateFromJson(std::istream& is);
0085 
0086 
0087 
0088 #endif // G4HepEmDataDataJsonIO_HH