JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
DefaultContainerScheduler.h
Go to the documentation of this file.
1 //
2 // Created by Nico on 13/05/2019.
3 //
4 
5 #ifndef JODA_DEFAULTCONTAINERSCHEDULER_H
6 #define JODA_DEFAULTCONTAINERSCHEDULER_H
7 
10 #include <joda/misc/RJFwd.h>
11 #include <rapidjson/istreamwrapper.h>
12 
13 namespace joda::docparsing {
18 template <bool meta>
20  public:
21  typedef short ContainerIdentifier;
22 
30  size_t contSize = 0);
31 
38 
44  ContainerIdentifier getContainerForDoc(std::string &raw);
45 
51  ContainerIdentifier getContainerForDoc(rapidjson::IStreamWrapper &stream);
52 
61  std::unique_ptr<RJDocument> &&doc,
62  std::unique_ptr<IOrigin> &&origin, size_t size);
63 
70  std::unique_ptr<RJDocument> getNewDoc(ContainerIdentifier id);
71 
76  void finalize();
77 
78  virtual ~DefaultContainerScheduler() = default;
79 
80  private:
82  size_t contSize;
83 
84  std::unique_ptr<JSONContainer> currentContainer;
85  std::unique_ptr<JSONContainer> createContainer(size_t contSize) const;
86 };
87 } // namespace joda::docparsing
88 
89 #endif // JODA_DEFAULTCONTAINERSCHEDULER_H
rapidjson::GenericDocument< RJChar, RJMemoryPoolAlloc, RJBaseAlloc > RJDocument
Definition: RJFwd.h:28
Definition: DefaultContainerScheduler.h:19
short ContainerIdentifier
Definition: DefaultContainerScheduler.h:21
DefaultContainerScheduler(JsonContainerQueue::queue_t *queue, size_t contSize=0)
Definition: DefaultContainerScheduler.cpp:55
ContainerIdentifier getContainerForDoc(const RJDocument &doc)
Definition: DefaultContainerScheduler.cpp:70
void scheduleDocument(ContainerIdentifier id, std::unique_ptr< RJDocument > &&doc, std::unique_ptr< IOrigin > &&origin, size_t size)
std::unique_ptr< RJDocument > getNewDoc(ContainerIdentifier id)
Definition: DefaultContainerScheduler.cpp:84
Definition: IImportSource.h:12
Definition: Queue.h:19