Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-11 09:40:22

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "ActsPlugins/Json/ActsJson.hpp"
0013 
0014 #include <nlohmann/json.hpp>
0015 
0016 // Custom Json encoder/decoders. Naming is mandated by nlohmann::json and thus
0017 // can not match our naming guidelines.
0018 namespace Acts {
0019 
0020 /// Convert Transform3 to JSON
0021 /// @param j Destination JSON object
0022 /// @param t Source Transform3 to convert
0023 void to_json(nlohmann::json& j, const Transform3& t);
0024 
0025 /// Convert JSON to Transform3
0026 /// @param j Source JSON object
0027 /// @param t Destination Transform3 to populate
0028 void from_json(const nlohmann::json& j, Transform3& t);
0029 
0030 namespace Transform3JsonConverter {
0031 
0032 /// @brief The options for the transform converter
0033 struct Options {
0034   /// Write the identity transform explicitly
0035   bool writeIdentity = false;
0036   /// Apply a transpose to flip column/row order
0037   bool transpose = false;
0038 };
0039 
0040 /// @brief The Transform converter to json
0041 ///
0042 /// @param t the transform to be converted
0043 /// @param options transformation options
0044 ///
0045 /// @return a json object representing the transform
0046 nlohmann::json toJson(const Transform3& t, const Options& options = {});
0047 
0048 /// @brief The Transform converter from json
0049 ///
0050 /// @param jTransform the transform json transformation
0051 ///
0052 /// @return a transform object
0053 Transform3 fromJson(const nlohmann::json& jTransform);
0054 
0055 }  // namespace Transform3JsonConverter
0056 }  // namespace Acts