|
||||
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/OutputRegistry.hh 0007 //---------------------------------------------------------------------------// 0008 #pragma once 0009 0010 #include <iosfwd> 0011 #include <map> 0012 #include <memory> 0013 #include <string> 0014 0015 #include "corecel/cont/EnumArray.hh" 0016 0017 #include "OutputInterface.hh" 0018 0019 namespace celeritas 0020 { 0021 //---------------------------------------------------------------------------// 0022 /*! 0023 * Store classes that can output data at the end of the run. 0024 * 0025 * Each output interface defines a category (e.g. input, result, system) and a 0026 * name. The output manager then writes the JSON output from that entry into a 0027 * nested database: 0028 * \verbatim 0029 {"category": {"label": "data"}} 0030 * \endverbatim 0031 */ 0032 class OutputRegistry 0033 { 0034 public: 0035 //!@{ 0036 //! \name Type aliases 0037 using SPConstInterface = std::shared_ptr<OutputInterface const>; 0038 //!@} 0039 0040 public: 0041 // Add an interface for writing 0042 void insert(SPConstInterface); 0043 0044 // Write output to the given JSON object 0045 void output(JsonPimpl*) const; 0046 0047 // Dump all outputs as JSON to the given stream 0048 void output(std::ostream* os) const; 0049 0050 // Whether no output has been registered 0051 bool empty() const; 0052 0053 private: 0054 using Category = OutputInterface::Category; 0055 0056 // Interfaces by category 0057 EnumArray<Category, std::map<std::string, SPConstInterface>> interfaces_; 0058 }; 0059 0060 //---------------------------------------------------------------------------// 0061 } // namespace celeritas
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |