BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSTemporaryFiles.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2022.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#ifndef BDSTEMPORARYFILES_H
20#define BDSTEMPORARYFILES_H
21
22#include "G4String.hh"
23
24#include <vector>
25
42{
43public:
45
48
51 G4String CreateTemporaryFileUnnamed(const G4String& extension);
52
56 G4String CreateTemporaryFile(const G4String& originalFilePath,
57 G4String fileNamePrefix = "",
58 G4String fileNameSuffix = "");
59
60private:
63
68 void InitialiseTempDir();
69
71 void WarnOfNewFile(const G4String& newFileName);
72
75
79 std::vector<G4String> allocatedFiles;
82};
83
84#endif
Holder for all temporary files created by BDSIM.
BDSTemporaryFiles()
Private default constructor as singleton.
G4bool temporaryDirectorySet
Whether directory has been set and made.
G4bool removeTemporaryFiles
Whether to clean up.
G4String temporaryDirectory
Directory all files will be placed in.
static BDSTemporaryFiles * instance
Singleton instance.
G4int unNamedFileCount
Count of unnamed files created.
static BDSTemporaryFiles * Instance()
Singleton accessor.
G4String CreateTemporaryFileUnnamed(const G4String &extension)
std::vector< G4String > allocatedFiles
Record of of all files allocated.
G4String userSpecifiedTemporaryDirectory
Optional user-specified path to try.
G4String CreateTemporaryFile(const G4String &originalFilePath, G4String fileNamePrefix="", G4String fileNameSuffix="")
void WarnOfNewFile(const G4String &newFileName)
User feedback that new file has been created.