File indexing completed on 2026-11-07 10:11:35
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include <fstream>
0010 #include <memory>
0011 #include <string>
0012
0013 #include "corecel/Macros.hh"
0014 #include "celeritas/Types.hh"
0015
0016 #include "EventIOInterface.hh"
0017
0018 namespace celeritas
0019 {
0020 class ParticleParams;
0021
0022
0023
0024
0025
0026
0027
0028 class JsonEventWriter : public EventWriterInterface
0029 {
0030 public:
0031
0032
0033 using SPConstParticles = std::shared_ptr<ParticleParams const>;
0034
0035
0036
0037 JsonEventWriter(std::string const& filename, SPConstParticles particles);
0038
0039
0040 CELER_DELETE_COPY_MOVE(JsonEventWriter);
0041 ~JsonEventWriter() override = default;
0042
0043
0044 void operator()(VecPrimary const& primaries) override;
0045
0046 private:
0047 std::ofstream outfile_;
0048 SPConstParticles particles_;
0049 EventId::size_type event_count_{0};
0050 bool warned_mismatched_events_{false};
0051 };
0052
0053
0054 }