JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
FileOrigin.h
Go to the documentation of this file.
1 //
2 // Created by Nico Schäfer on 30/07/18.
3 //
4 
5 #ifndef JODA_FILEORIGIN_H
6 #define JODA_FILEORIGIN_H
7 
8 #include "IDPositionOrigin.h"
9 #include "IOrigin.h"
10 #include "joda/misc/FileNameRepo.h"
11 #include "joda/misc/RJFwd.h"
12 
17 class FileOrigin : public IDPositionOrigin {
18  public:
19  // Identifies an interval of a File where one/or multiple documents can be
20  // parsed without skipping through the file
21  typedef std::pair<FILEID, std::pair<long, long>> ParseInterval;
22 
23  FileOrigin(FILEID id);
24  FileOrigin(FILEID file, long start, long end, int index);
25  /*
26  * Inherited
27  */
28  bool isReparsable() const override;
29  std::unique_ptr<IOrigin> clone() const override;
30  std::unique_ptr<RJDocument> reparse(RJMemoryPoolAlloc &alloc) const override;
31  std::string toString() const override;
32  std::string getStreamName() const override;
33 
38  FILEID getFile() const;
43  ParseInterval getInterval() const;
44 
50  static std::vector<ParseInterval> mergeIntervals(std::vector<ParseInterval> &&intervals);
57  static std::vector<std::unique_ptr<RJDocument>> parseIntervals(RJMemoryPoolAlloc &alloc, std::vector<ParseInterval> &&intervals);
58 };
59 
60 #endif // JODA_FILEORIGIN_H
unsigned long FILEID
Definition: FileNameRepo.h:12
rapidjson::MemoryPoolAllocator< RJBaseAlloc > RJMemoryPoolAlloc
Definition: RJFwd.h:26
Definition: FileOrigin.h:17
std::unique_ptr< RJDocument > reparse(RJMemoryPoolAlloc &alloc) const override
Definition: FileOrigin.cpp:15
ParseInterval getInterval() const
Definition: FileOrigin.cpp:57
FILEID getFile() const
Definition: FileOrigin.cpp:55
static std::vector< std::unique_ptr< RJDocument > > parseIntervals(RJMemoryPoolAlloc &alloc, std::vector< ParseInterval > &&intervals)
Definition: FileOrigin.cpp:92
std::string getStreamName() const override
Definition: FileOrigin.cpp:66
bool isReparsable() const override
Definition: FileOrigin.cpp:13
std::unique_ptr< IOrigin > clone() const override
Definition: FileOrigin.cpp:51
FileOrigin(FILEID id)
Definition: FileOrigin.cpp:70
static std::vector< ParseInterval > mergeIntervals(std::vector< ParseInterval > &&intervals)
Definition: FileOrigin.cpp:72
std::pair< FILEID, std::pair< long, long > > ParseInterval
Definition: FileOrigin.h:21
std::string toString() const override
Definition: FileOrigin.cpp:61
Definition: IDPositionOrigin.h:16
int index
Definition: IDPositionOrigin.h:47
long end
Definition: IDPositionOrigin.h:46
long start
Definition: IDPositionOrigin.h:45