Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-09 08:30:26

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 <cstdio>
0012 #include <filesystem>
0013 
0014 namespace ActsPlugins::detail {
0015 
0016 /// @brief helper to wrap a file handle
0017 class WrappedFileHandle {
0018  public:
0019   explicit WrappedFileHandle(const std::filesystem::path& outf = "");
0020   ~WrappedFileHandle();
0021   WrappedFileHandle(const WrappedFileHandle&) = delete;
0022   WrappedFileHandle& operator=(const WrappedFileHandle&) = delete;
0023 
0024   WrappedFileHandle(WrappedFileHandle&& other) noexcept;
0025 
0026   WrappedFileHandle& operator=(WrappedFileHandle&& other) noexcept;
0027   FILE* operator()() const;
0028   bool isRedirected() const;
0029   const std::filesystem::path& path() const;
0030 
0031  private:
0032   FILE* m_handle = nullptr;
0033   std::filesystem::path m_path{};
0034 };
0035 
0036 }  // namespace ActsPlugins::detail