CMS 3D CMS Logo

Storage.h
Go to the documentation of this file.
1 #ifndef STORAGE_FACTORY_STORAGE_H
2 # define STORAGE_FACTORY_STORAGE_H
3 
7 
8 //
9 // ROOT will probe for prefetching support by calling
10 // ReadBufferAsync(0, 0)
11 // Storage turns this into:
12 // prefetch(0, PREFETCH_PROBE_LENGTH)
13 //
14 // For example, if the Storage implementation wants to provide a prefetch
15 // implementation, but prefers it not to be used by default, it
16 // should detect the probe and return true.
17 //
18 # define PREFETCH_PROBE_LENGTH 4096
19 
20 class Storage : public virtual IOInput, public virtual IOOutput
21 {
22 public:
23  enum Relative { SET, CURRENT, END };
24 
25  Storage (void);
26  ~Storage (void) override;
27 
28  using IOInput::read;
29  using IOInput::readv;
30  using IOOutput::write;
31  using IOOutput::writev;
32 
33  virtual bool prefetch (const IOPosBuffer *what, IOSize n);
34  virtual IOSize read (void *into, IOSize n, IOOffset pos);
35  IOSize read (IOBuffer into, IOOffset pos);
36  virtual IOSize readv (IOPosBuffer *into, IOSize buffers);
37  virtual IOSize write (const void *from, IOSize n, IOOffset pos);
38  IOSize write (IOBuffer from, IOOffset pos);
39  virtual IOSize writev (const IOPosBuffer *from, IOSize buffers);
40 
41  virtual bool eof (void) const;
42  virtual IOOffset size (void) const;
43  virtual IOOffset position (void) const;
44  virtual IOOffset position (IOOffset offset, Relative whence = SET) = 0;
45 
46  virtual void rewind (void);
47 
48  virtual void resize (IOOffset size) = 0;
49 
50  virtual void flush (void);
51  virtual void close (void);
52 
53 private:
54  // undefined, no semantics
55  Storage (const Storage &);
56  Storage &operator= (const Storage &);
57 };
58 
59 #endif // STORAGE_FACTORY_STORAGE_H
IOSize write(unsigned char byte)
Definition: IOOutput.cc:41
virtual IOSize readv(IOPosBuffer *into, IOSize buffers)
Definition: Storage.cc:31
Storage & operator=(const Storage &)
virtual void resize(IOOffset size)=0
Relative
Definition: Storage.h:23
virtual IOSize readv(IOBuffer *into, IOSize buffers)
Definition: IOInput.cc:117
virtual IOSize write(const void *from, IOSize n, IOOffset pos)
Definition: Storage.cc:59
~Storage(void) override
Definition: Storage.cc:8
virtual void close(void)
Definition: Storage.cc:128
virtual IOOffset position(void) const
Definition: Storage.cc:95
virtual void flush(void)
Definition: Storage.cc:124
int read(void)
Definition: IOInput.cc:54
virtual bool prefetch(const IOPosBuffer *what, IOSize n)
Definition: Storage.cc:119
virtual IOSize writev(const IOBuffer *from, IOSize buffers)
Definition: IOOutput.cc:90
virtual IOOffset size(void) const
Definition: Storage.cc:102
int64_t IOOffset
Definition: IOTypes.h:19
size_t IOSize
Definition: IOTypes.h:14
virtual bool eof(void) const
Definition: Storage.cc:133
virtual void rewind(void)
Definition: Storage.cc:114
Definition: IOInput.h:7
Storage(void)
Definition: Storage.cc:5
virtual IOSize writev(const IOPosBuffer *from, IOSize buffers)
Definition: Storage.cc:74