Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:10:51

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 // Set the Geometry Context PLUGIN
0012 #ifdef ACTS_CORE_GEOMETRYCONTEXT_PLUGIN
0013 #include ACTS_CORE_GEOMETRYCONTEXT_PLUGIN
0014 #else
0015 
0016 #include "Acts/Utilities/detail/ContextType.hpp"
0017 
0018 #include <ostream>
0019 
0020 namespace Acts {
0021 
0022 /// @brief This is the central definition of the Acts
0023 /// payload object regarding detector geometry status (e.g. alignment)
0024 ///
0025 /// It is propagated through the code to allow for event/thread
0026 /// dependent geometry changes
0027 
0028 class GeometryContext : public ContextType {
0029  public:
0030   /// Inherit all constructors
0031   using ContextType::ContextType;
0032   using ContextType::operator=;
0033 };
0034 
0035 /// Helper struct that stores an object and a context, and will print it to
0036 /// an outstream.
0037 /// This allows you to write
0038 /// ```cpp
0039 /// std::cout << surface->toStream(geoContext) << std::endl;
0040 /// ```
0041 template <typename T>
0042 struct GeometryContextOstreamWrapper {
0043   GeometryContextOstreamWrapper(const T& object, const GeometryContext& gctx)
0044       : m_object(object), m_gctx(gctx) {}
0045 
0046   GeometryContextOstreamWrapper(const GeometryContextOstreamWrapper&) = delete;
0047   GeometryContextOstreamWrapper(GeometryContextOstreamWrapper&&) = delete;
0048   GeometryContextOstreamWrapper& operator=(
0049       const GeometryContextOstreamWrapper&) = delete;
0050   GeometryContextOstreamWrapper& operator=(GeometryContextOstreamWrapper&&) =
0051       delete;
0052 
0053   friend std::ostream& operator<<(
0054       std::ostream& os, const GeometryContextOstreamWrapper& osWrapper) {
0055     osWrapper.toStream(os);
0056     return os;
0057   }
0058 
0059  private:
0060   void toStream(std::ostream& os) const { m_object.toStreamImpl(m_gctx, os); }
0061 
0062   const T& m_object;
0063   const GeometryContext& m_gctx;
0064 };
0065 
0066 }  // namespace Acts
0067 
0068 #endif