JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
Load_State.h
Go to the documentation of this file.
1 //
2 // Created by Nico on 08/05/2019.
3 //
4 
5 #ifndef JODA_LOAD_STATE_H
6 #define JODA_LOAD_STATE_H
7 
8 #define JODA_DEFAULT_LINE_SEPERATED false
9 
13 #include "Query_State.h"
15 
21 };
22 
23 struct loadState {
24  template <typename Input>
25  inline loadState(const Input &in, queryState &qs) {}
26 
27  template <typename Input>
28  inline void success(const Input &in, queryState &qs) {
29  assert(sampleNum > 0 && sampleNum <= 1 && "Sample num has to be in (0,1)");
30  qs.q->setLoad(loadVar);
31  for (auto &&source : sources) {
32  qs.q->addImportSource(std::move(source));
33  }
34  // Set LoadJoinManager
35  qs.q->setLoadJoinManager(StorageCollection::getInstance().getOrStartJoin(
36  std::move(groupvalprov)));
37  }
38 
39  inline bool putValProv(std::unique_ptr<joda::query::IValueProvider> &&val) {
40  assert(val != nullptr && "Should not pass nullptr");
41  if (val == nullptr) return false;
42  if (groupvalprov == nullptr) {
43  groupvalprov = std::move(val);
44  return true;
45  }
46  assert(false && "Should not be full");
47  return false;
48  }
49 
50  std::string loadVar;
51  std::string loadFile;
52  std::unique_ptr<joda::query::IValueProvider> groupvalprov;
54  double sampleNum = 1;
56  std::vector<std::unique_ptr<docparsing::IImportSource>> sources;
57 };
58 } // namespace joda::queryparsing::grammar
59 #endif // JODA_LOAD_STATE_H
#define JODA_DEFAULT_LINE_SEPERATED
Definition: Load_State.h:8
static StorageCollection & getInstance()
Definition: StorageCollection.h:32
Source_Value
Definition: Load_State.h:16
@ NO_SOURCE
Definition: Load_State.h:17
@ URL_SOURCE
Definition: Load_State.h:20
@ FILE_SOURCE
Definition: Load_State.h:18
@ DIRECTORY_SOURCE
Definition: Load_State.h:19
Definition: Load_State.h:23
Source_Value source
Definition: Load_State.h:53
void success(const Input &in, queryState &qs)
Definition: Load_State.h:28
std::string loadVar
Definition: Load_State.h:50
bool lineSeperated
Definition: Load_State.h:55
std::unique_ptr< joda::query::IValueProvider > groupvalprov
Definition: Load_State.h:52
bool putValProv(std::unique_ptr< joda::query::IValueProvider > &&val)
Definition: Load_State.h:39
loadState(const Input &in, queryState &qs)
Definition: Load_State.h:25
std::vector< std::unique_ptr< docparsing::IImportSource > > sources
Definition: Load_State.h:56
std::string loadFile
Definition: Load_State.h:51
Definition: Query_State.h:21
std::shared_ptr< joda::query::Query > q
Definition: Query_State.h:33