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 public:
22  enum Relative { SET, CURRENT, END };
23 
24  Storage(void);
25  ~Storage(void) override;
26 
27  using IOInput::read;
28  using IOInput::readv;
29  using IOOutput::write;
30  using IOOutput::writev;
31 
32  virtual bool prefetch(const IOPosBuffer *what, IOSize n);
33  virtual IOSize read(void *into, IOSize n, IOOffset pos);
35  virtual IOSize readv(IOPosBuffer *into, IOSize buffers);
36  virtual IOSize write(const void *from, IOSize n, IOOffset pos);
38  virtual IOSize writev(const IOPosBuffer *from, IOSize buffers);
39 
40  virtual bool eof(void) const;
41  virtual IOOffset size(void) const;
42  virtual IOOffset position(void) const;
43  virtual IOOffset position(IOOffset offset, Relative whence = SET) = 0;
44 
45  virtual void rewind(void);
46 
47  virtual void resize(IOOffset size) = 0;
48 
49  virtual void flush(void);
50  virtual void close(void);
51 
52 private:
53  // undefined, no semantics
54  Storage(const Storage &) = delete;
55  Storage &operator=(const Storage &) = delete;
56 };
57 
58 #endif // STORAGE_FACTORY_STORAGE_H
Storage::size
virtual IOOffset size(void) const
Definition: Storage.cc:77
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
pos
Definition: PixelAliasList.h:18
Storage::eof
virtual bool eof(void) const
Definition: Storage.cc:98
Storage::END
Definition: Storage.h:22
IOOutput.h
Storage::SET
Definition: Storage.h:22
Storage::Relative
Relative
Definition: Storage.h:22
Storage::readv
virtual IOSize readv(IOPosBuffer *into, IOSize buffers)
Definition: Storage.cc:24
IOInput::readv
virtual IOSize readv(IOBuffer *into, IOSize buffers)
Definition: IOInput.cc:111
IOOutput
Definition: IOOutput.h:7
IOOutput::writev
virtual IOSize writev(const IOBuffer *from, IOSize buffers)
Definition: IOOutput.cc:84
IOInput.h
Storage::resize
virtual void resize(IOOffset size)=0
IOBuffer
Definition: IOBuffer.h:7
Storage::rewind
virtual void rewind(void)
Definition: Storage.cc:87
IOOffset
int64_t IOOffset
Definition: IOTypes.h:19
Storage::Storage
Storage(void)
Definition: Storage.cc:5
IOInput
Definition: IOInput.h:7
Storage::~Storage
~Storage(void) override
Definition: Storage.cc:7
Storage::flush
virtual void flush(void)
Definition: Storage.cc:93
Storage::prefetch
virtual bool prefetch(const IOPosBuffer *what, IOSize n)
Definition: Storage.cc:90
Storage::writev
virtual IOSize writev(const IOPosBuffer *from, IOSize buffers)
Definition: Storage.cc:57
Storage::position
virtual IOOffset position(void) const
Definition: Storage.cc:72
IOInput::read
int read(void)
Definition: IOInput.cc:52
Storage::close
virtual void close(void)
Definition: Storage.cc:95
IOPosBuffer.h
Storage::CURRENT
Definition: Storage.h:22
IOOutput::write
IOSize write(unsigned char byte)
Definition: IOOutput.cc:39
IOPosBuffer
Definition: IOPosBuffer.h:7
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
IOSize
size_t IOSize
Definition: IOTypes.h:14
Storage
Definition: Storage.h:20
Storage::write
virtual IOSize write(const void *from, IOSize n, IOOffset pos)
Definition: Storage.cc:44
Storage::operator=
Storage & operator=(const Storage &)=delete