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 #include <vector>
0013
0014 #include "corecel/Macros.hh"
0015 #include "celeritas/phys/Primary.hh"
0016
0017 #include "EventIOInterface.hh"
0018
0019 namespace celeritas
0020 {
0021 class ParticleParams;
0022
0023
0024
0025
0026
0027 class JsonEventReader : public EventReaderInterface
0028 {
0029 public:
0030
0031
0032 using SPConstParticles = std::shared_ptr<ParticleParams const>;
0033 using result_type = std::vector<Primary>;
0034
0035
0036
0037 JsonEventReader(std::string const& filename, SPConstParticles particles);
0038
0039
0040 CELER_DELETE_COPY_MOVE(JsonEventReader);
0041 ~JsonEventReader() override = default;
0042
0043
0044 result_type operator()() final;
0045
0046
0047 size_type num_events() const final { return num_events_; }
0048
0049 private:
0050 std::ifstream infile_;
0051 SPConstParticles particles_;
0052 size_type num_events_{0};
0053 };
0054
0055
0056 }