2018-02-24 14:14:54 +01:00
|
|
|
// Copyright 2018 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-10-27 06:46:03 +02:00
|
|
|
#include <cstddef>
|
2020-01-03 15:00:10 +01:00
|
|
|
#include <boost/serialization/access.hpp>
|
|
|
|
#include <boost/serialization/export.hpp>
|
2018-10-27 06:46:03 +02:00
|
|
|
#include "common/common_types.h"
|
|
|
|
|
2018-02-24 14:14:54 +01:00
|
|
|
namespace FileSys {
|
|
|
|
|
|
|
|
class DelayGenerator {
|
|
|
|
public:
|
2018-10-27 06:46:03 +02:00
|
|
|
virtual ~DelayGenerator();
|
2018-09-06 22:03:28 +02:00
|
|
|
virtual u64 GetReadDelayNs(std::size_t length) = 0;
|
2018-11-02 18:11:22 +01:00
|
|
|
virtual u64 GetOpenDelayNs() = 0;
|
2018-02-24 14:14:54 +01:00
|
|
|
|
|
|
|
// TODO (B3N30): Add getter for all other file/directory io operations
|
2020-01-03 15:00:10 +01:00
|
|
|
private:
|
|
|
|
template <class Archive>
|
|
|
|
void serialize(Archive& ar, const unsigned int) {}
|
|
|
|
friend class boost::serialization::access;
|
2018-02-24 14:14:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class DefaultDelayGenerator : public DelayGenerator {
|
|
|
|
public:
|
2018-10-27 06:46:03 +02:00
|
|
|
u64 GetReadDelayNs(std::size_t length) override;
|
2018-11-02 18:11:22 +01:00
|
|
|
u64 GetOpenDelayNs() override;
|
2018-02-24 14:14:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace FileSys
|
2020-01-03 15:00:10 +01:00
|
|
|
|
|
|
|
BOOST_CLASS_EXPORT_KEY(FileSys::DefaultDelayGenerator);
|