ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
writer_interface.hpp
1// This file is part of the ACTS project.
2//
3// Copyright (C) 2016 CERN for the benefit of the ACTS project
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9#pragma once
10
11// Project include(s)
12#include "detray/builders/detector_builder.hpp"
13
14// System include(s)
15#include <filesystem>
16#include <ios>
17#include <string>
18#include <string_view>
19
20namespace detray::io {
21
23template <class detector_t>
25 public:
27 writer_interface() = delete;
28
31 explicit writer_interface(const std::string& ext) : m_file_extension{ext} {}
32
34 virtual ~writer_interface() = default;
35
37 const std::string& file_extension() const { return m_file_extension; }
38
45 virtual std::string write(const detector_t& detector,
46 const typename detector_t::name_map& names,
47 const std::ios_base::openmode mode,
48 const std::filesystem::path& path) = 0;
49
50 private:
52 std::string m_file_extension;
53};
54
55} // namespace detray::io
writer_interface(const std::string &ext)
File gets created with a fixed ext.
Definition writer_interface.hpp:31
const std::string & file_extension() const
Definition writer_interface.hpp:37
writer_interface()=delete
All writers must define a file extension.
virtual ~writer_interface()=default
Default destructor.
virtual std::string write(const detector_t &detector, const typename detector_t::name_map &names, const std::ios_base::openmode mode, const std::filesystem::path &path)=0
Write detector components to a path using the supplied name map.
The following enums are global for all detectors.
Definition concepts.hpp:18