evio  6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
IEvioCompactReader.h
Go to the documentation of this file.
1 //
2 // Copyright 2020, Jefferson Science Associates, LLC.
3 // Subject to the terms in the LICENSE file found in the top-level directory.
4 //
5 // EPSCI Group
6 // Thomas Jefferson National Accelerator Facility
7 // 12000, Jefferson Ave, Newport News, VA 23606
8 // (757)-269-7100
9 
10 
11 #ifndef EVIO_6_0_IEVIOCOMPACTREADER_H
12 #define EVIO_6_0_IEVIOCOMPACTREADER_H
13 
14 
15 #include <memory>
16 #include <vector>
17 
18 
19 #include "ByteBuffer.h"
20 #include "ByteOrder.h"
21 #include "EvioException.h"
22 #include "EvioNode.h"
23 #include "EvioXMLDictionary.h"
24 #include "IBlockHeader.h"
25 
26 
27 namespace evio {
28 
29 
42 
43  public:
44 
49  virtual bool isFile() = 0;
50 
55  virtual bool isCompressed() = 0;
56 
67  virtual void setBuffer(std::shared_ptr<ByteBuffer> & buf) = 0;
68 
75  virtual bool isClosed() = 0;
76 
81  virtual ByteOrder getByteOrder() = 0;
82 
87  virtual uint32_t getEvioVersion() = 0;
88 
93  virtual std::string getPath() = 0;
94 
100  virtual ByteOrder getFileByteOrder() = 0;
101 
107  virtual std::string getDictionaryXML() = 0;
108 
114  virtual std::shared_ptr<EvioXMLDictionary> getDictionary() = 0;
115 
122  virtual bool hasDictionary() = 0;
123 
128  virtual std::shared_ptr<ByteBuffer> getByteBuffer() = 0;
129 
135  virtual size_t fileSize() = 0;
136 
143  virtual std::shared_ptr<EvioNode> getEvent(size_t eventNumber) = 0;
144 
153  virtual std::shared_ptr<EvioNode> getScannedEvent(size_t eventNumber) = 0;
154 
160  virtual std::shared_ptr<IBlockHeader> getFirstBlockHeader() = 0;
161 
174  virtual void searchEvent(size_t eventNumber, uint16_t tag, uint8_t num,
175  std::vector<std::shared_ptr<EvioNode>> & vec) = 0;
176 
192  virtual void searchEvent(size_t eventNumber, std::string const & dictName,
193  std::shared_ptr<EvioXMLDictionary> & dictionary,
194  std::vector<std::shared_ptr<EvioNode>> & vec) = 0;
195 
215  virtual std::shared_ptr<ByteBuffer> removeEvent(size_t eventNumber) = 0;
216 
234  virtual std::shared_ptr<ByteBuffer> removeStructure(std::shared_ptr<EvioNode> & removeNode) = 0;
235 
272  virtual std::shared_ptr<ByteBuffer> addStructure(size_t eventNumber, ByteBuffer & addBuffer) = 0;
273 
283  virtual std::shared_ptr<ByteBuffer> getData(std::shared_ptr<EvioNode> & node) = 0;
284 
297  virtual std::shared_ptr<ByteBuffer> getData(std::shared_ptr<EvioNode> & node, bool copy) = 0;
298 
309  virtual std::shared_ptr<ByteBuffer> getData(std::shared_ptr<EvioNode> & node,
310  std::shared_ptr<ByteBuffer> & buf) = 0;
311 
325  virtual std::shared_ptr<ByteBuffer> getData(std::shared_ptr<EvioNode> & node,
326  std::shared_ptr<ByteBuffer> & buf, bool copy) = 0;
327 
339  virtual std::shared_ptr<ByteBuffer> getEventBuffer(size_t eventNumber) = 0;
340 
355  virtual std::shared_ptr<ByteBuffer> getEventBuffer(size_t eventNumber, bool copy) = 0;
356 
367  virtual std::shared_ptr<ByteBuffer> getStructureBuffer(std::shared_ptr<EvioNode> & node) = 0;
368 
382  virtual std::shared_ptr<ByteBuffer> getStructureBuffer(std::shared_ptr<EvioNode> & node, bool copy) = 0;
383 
385  virtual void close() = 0;
386 
394  virtual uint32_t getEventCount() = 0;
395 
402  virtual uint32_t getBlockCount() = 0;
403 
413  virtual void toFile(std::string const & fileName) = 0;
414  };
415 
416 
417 }
418 
419 #endif //EVIO_6_0_IEVIOCOMPACTREADER_H
This class is copied from one of the same name in the Java programming language.
Definition: ByteBuffer.h:42
virtual std::shared_ptr< IBlockHeader > getFirstBlockHeader()=0
This returns the FIRST block (or record) header.
virtual std::shared_ptr< EvioXMLDictionary > getDictionary()=0
Get the evio dictionary if is there is one.
virtual std::shared_ptr< ByteBuffer > addStructure(size_t eventNumber, ByteBuffer &addBuffer)=0
This method adds an evio container (bank, segment, or tag segment) as the last structure contained in...
virtual std::shared_ptr< EvioNode > getEvent(size_t eventNumber)=0
Get the EvioNode object associated with a particular event number.
virtual std::shared_ptr< ByteBuffer > getData(std::shared_ptr< EvioNode > &node)=0
Get the data associated with an evio structure in ByteBuffer form.
virtual ByteOrder getByteOrder()=0
Get the byte order of the file/buffer being read.
Numerical values associated with endian byte order.
Definition: ByteOrder.h:53
virtual uint32_t getEventCount()=0
This is the number of events in the file/buffer.
virtual void toFile(std::string const &fileName)=0
Save the internal byte buffer to the given file (overwrites existing file).
virtual bool isCompressed()=0
Is the data in the file/buffer compressed?
virtual size_t fileSize()=0
Get the size of the file being read, in bytes.
virtual ByteOrder getFileByteOrder()=0
When reading a file, this method&#39;s return value is the byte order of the evio data in the file...
virtual std::shared_ptr< EvioNode > getScannedEvent(size_t eventNumber)=0
Get the EvioNode object associated with a particular event number which has been scanned so all subst...
virtual std::string getDictionaryXML()=0
Get the XML format dictionary is there is one.
virtual std::shared_ptr< ByteBuffer > getStructureBuffer(std::shared_ptr< EvioNode > &node)=0
Get an evio structure (bank, seg, or tagseg) in ByteBuffer form.
virtual std::shared_ptr< ByteBuffer > getByteBuffer()=0
Get the byte buffer being read directly or corresponding to the event file.
virtual std::shared_ptr< ByteBuffer > removeStructure(std::shared_ptr< EvioNode > &removeNode)=0
This method removes the data, represented by the given node, from the buffer.
virtual bool hasDictionary()=0
Does this evio file have an associated XML dictionary?
This is an interface for a compact reader of evio format files and buffers.
Definition: IEvioCompactReader.h:41
virtual std::string getPath()=0
Get the path to the file.
virtual std::shared_ptr< ByteBuffer > removeEvent(size_t eventNumber)=0
This method removes the data of the given event from the buffer.
virtual uint32_t getBlockCount()=0
This is the number of blocks in the file/buffer including the empty block at the end.
virtual bool isClosed()=0
Has close() been called (without reopening by calling setBuffer(std::shared_ptr&lt;ByteBuffer&gt; &amp;))...
virtual std::shared_ptr< ByteBuffer > getEventBuffer(size_t eventNumber)=0
Get an evio bank or event in ByteBuffer form.
virtual void setBuffer(std::shared_ptr< ByteBuffer > &buf)=0
This method can be used to avoid creating additional EvioCompactReader objects by reusing this one wi...
virtual void searchEvent(size_t eventNumber, uint16_t tag, uint8_t num, std::vector< std::shared_ptr< EvioNode >> &vec)=0
This method searches the specified event in a file/buffer and returns a vector of objects each of whi...
virtual void close()=0
This sets the position to its initial value and marks reader as closed.
virtual bool isFile()=0
Is this reader reading a file?
virtual uint32_t getEvioVersion()=0
Get the evio version number.