26 namespace Experimental {
31 class RFileStorageInterface;
32 class RFileSharedPtrCtor;
43 class RFile:
public RDirectory {
45 std::unique_ptr<Internal::RFileStorageInterface> fStorage;
47 RFile(std::unique_ptr<Internal::RFileStorageInterface> &&storage);
51 void WriteMemoryWithType(std::string_view name,
const void *address, TClass *cl);
53 friend Internal::RFileSharedPtrCtor;
62 bool fAsynchronousOpen =
false;
65 int fAsyncTimeout = 0;
70 bool fCachedRead =
false;
73 std::string fCacheDir;
82 static RFilePtr Open(std::string_view name,
const Options_t &opts = Options_t());
88 static RFilePtr OpenForUpdate(std::string_view name,
const Options_t &opts = Options_t());
94 static RFilePtr Create(std::string_view name,
const Options_t &opts = Options_t());
100 static RFilePtr Recreate(std::string_view name,
const Options_t &opts = Options_t());
107 static std::string SetCacheDir(std::string_view path);
110 static std::string GetCacheDir();
132 std::unique_ptr<T> Read(std::string_view name)
139 return std::make_unique<T>(*Get<T>(name));
144 void Write(std::string_view name,
const T &obj)
146 WriteMemoryWithType(name, &obj, TClass::GetClass<T>());
151 void Write(std::string_view name,
const T *obj)
153 WriteMemoryWithType(name, obj, TClass::GetClass<T>());
157 void Write(std::string_view name)
159 auto dep = Find(name);
160 WriteMemoryWithType(name, dep.GetPointer().get(), dep.GetType());
166 void Write(std::string_view name, std::shared_ptr<T> &&obj)
186 std::shared_ptr<RFile> fFile;
189 RFilePtr(std::shared_ptr<RFile> &&);
195 RFile *operator->() {
return fFile.get(); }
199 const RFile *operator->()
const {
return fFile.get(); }
202 operator bool()
const {
return fFile.get(); }