CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TStorageFactoryFile.h
Go to the documentation of this file.
1 #ifndef TFILE_ADAPTOR_TSTORAGE_FACTORY_FILE_H
2 # define TFILE_ADAPTOR_TSTORAGE_FACTORY_FILE_H
3 
4 # include <vector>
5 # include <memory>
6 
7 # include "TFile.h"
8 
10 
11 
12 class Storage;
13 
15 class TStorageFactoryFile : public TFile
16 {
17 public:
18  ClassDef(TStorageFactoryFile, 0); // ROOT File operating on CMS Storage.
19 
20  // Due to limitations in the ROOT plugin manager, TStorageFactoryFile must
21  // provide a constructor matching all the different variants that other
22  // ROOT plugins might use
23 
24  // This one is to match TXNetFile
25  TStorageFactoryFile(const char *name, Option_t *option,
26  const char *ftitle, Int_t compress, Int_t netopt,
27  Bool_t parallelopen = kFALSE);
28 
29  // This matches everything else.
30  TStorageFactoryFile(const char *name, Option_t *option = "",
31  const char *ftitle = "", Int_t compress = 1);
32 
34 
35  virtual Bool_t ReadBuffer(char *buf, Int_t len);
36  virtual Bool_t ReadBuffer(char *buf, Long64_t pos, Int_t len);
37  virtual Bool_t ReadBufferAsync(Long64_t off, Int_t len);
38  virtual Bool_t ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf);
39  virtual Bool_t WriteBuffer(const char *buf, Int_t len);
40 
41  void ResetErrno(void) const;
42 
43 protected:
44  virtual Int_t SysOpen(const char *pathname, Int_t flags, UInt_t mode);
45  virtual Int_t SysClose(Int_t fd);
46  virtual Long64_t SysSeek(Int_t fd, Long64_t offset, Int_t whence);
47  virtual Int_t SysStat(Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime);
48  virtual Int_t SysSync(Int_t fd);
49 
50 private:
51  void Initialize(const char *name, Option_t *option = "");
52 
53  Bool_t ReadBuffersSync(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf);
54 
55  TStorageFactoryFile(void);
56 
57  std::unique_ptr<Storage> storage_; //< Real underlying storage
58 };
59 
60 #endif // TFILE_ADAPTOR_TSTORAGE_FACTORY_FILE_H
virtual Long64_t SysSeek(Int_t fd, Long64_t offset, Int_t whence)
virtual Int_t SysOpen(const char *pathname, Int_t flags, UInt_t mode)
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
virtual Bool_t ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf)
std::unique_ptr< Storage > storage_
virtual Bool_t ReadBufferAsync(Long64_t off, Int_t len)
virtual Bool_t ReadBuffer(char *buf, Int_t len)
tuple fd
Definition: ztee.py:136
virtual Bool_t WriteBuffer(const char *buf, Int_t len)
ClassDef(TStorageFactoryFile, 0)
void ResetErrno(void) const
virtual Int_t SysStat(Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime)
virtual Int_t SysClose(Int_t fd)
virtual Int_t SysSync(Int_t fd)
Bool_t ReadBuffersSync(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf)
void Initialize(const char *name, Option_t *option="")
tuple size
Write out results.