Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
fileio.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2023 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file ored/utilities/fileio.hpp
20 \brief Wrapper class for retrying file IO operations
21 \ingroup utilities
22*/
23
24#pragma once
25
26#include <boost/filesystem/path.hpp>
27#include <ql/types.hpp>
28#include <stdio.h>
29
30namespace ore {
31namespace data {
32
33using boost::filesystem::path;
34
35class FileIO {
36
37public:
38 FileIO() = delete;
39
40 //! The maximum number of retries, defaults to 7
41 static QuantLib::Size maxRetries();
42 static QuantLib::Real backoff();
43 static QuantLib::Real maxBackoff();
44 static void setMaxRetries(QuantLib::Size);
45 static void setBackoff(QuantLib::Real);
46 static void setMaxBackoff(QuantLib::Real);
47
48 //! Retry wrapper for std::fopen
49 static FILE* fopen(const char*, const char*);
50
51 //! Retry wrapper for boost::filesystem::create_directories
52 static bool create_directories(const path&);
53
54 //! Retry wrapper for boost::filesystem::remove_all
55 static bool remove_all(const path&);
56};
57
58} // namespace data
59} // namespace ore
static void setMaxBackoff(QuantLib::Real)
Definition: fileio.cpp:59
static QuantLib::Real backoff()
Definition: fileio.cpp:45
static void setBackoff(QuantLib::Real)
Definition: fileio.cpp:54
static void setMaxRetries(QuantLib::Size)
Definition: fileio.cpp:49
static bool remove_all(const path &)
Retry wrapper for boost::filesystem::remove_all.
Definition: fileio.cpp:115
static QuantLib::Real maxBackoff()
Definition: fileio.cpp:47
static QuantLib::Size maxRetries()
The maximum number of retries, defaults to 7.
Definition: fileio.cpp:43
static bool create_directories(const path &)
Retry wrapper for boost::filesystem::create_directories.
Definition: fileio.cpp:88
static FILE * fopen(const char *, const char *)
Retry wrapper for std::fopen.
Definition: fileio.cpp:64
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23