JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
FileJoinManager.h
Go to the documentation of this file.
1 //
2 // Created by Nico Schäfer on 02/04/18.
3 //
4 
5 #ifndef JODA_FILEJOINMANAGER_H
6 #define JODA_FILEJOINMANAGER_H
7 
8 #include <unordered_map>
9 #include "JoinManager.h"
10 
15 class FileJoinManager : public JoinManager {
16  public:
24  FileJoinManager(const std::string& name,
25  std::unique_ptr<joda::query::IValueProvider>&& valProv);
29  ~FileJoinManager() override;
30 
35  void join(const RapidJsonDocument& doc) override;
36 
41  const std::string& getBaseDir() const;
42 
43  protected:
44  bool createFile(const std::string& file, bool val);
45  bool createFile(const std::string& file, long val);
46  bool createFile(const std::string& file, const std::string& val);
47  std::string getFile(JODA_JOINID id);
48  JODA_JOINID getJoinVal(const RJValue& val);
49  bool appendDocToFile(const RapidJsonDocument& doc, const std::string& file);
50 
51  std::string baseDir;
52  std::mutex mut;
53 
55  std::unordered_map<long, JODA_JOINID> lMap; // Integer as long
56  std::unordered_map<std::string, JODA_JOINID> sMap; // String as String
57  std::unordered_map<JODA_JOINID, std::mutex> fLock; // file-lock
58 
59  bool trueValCreated = false;
60  bool falseValCreated = false;
61 };
62 
63 #endif // JODA_FILEJOINMANAGER_H
unsigned long JODA_JOINID
Definition: JoinManager.h:14
rapidjson::GenericValue< RJChar, RJMemoryPoolAlloc > RJValue
Definition: RJFwd.h:29
Definition: FileJoinManager.h:15
~FileJoinManager() override
Definition: FileJoinManager.cpp:171
std::unordered_map< long, JODA_JOINID > lMap
Definition: FileJoinManager.h:55
std::unordered_map< std::string, JODA_JOINID > sMap
Definition: FileJoinManager.h:56
FileJoinManager(const std::string &name, std::unique_ptr< joda::query::IValueProvider > &&valProv)
Definition: FileJoinManager.cpp:107
const std::string & getBaseDir() const
Definition: FileJoinManager.cpp:176
std::string baseDir
Definition: FileJoinManager.h:51
bool trueValCreated
Definition: FileJoinManager.h:59
std::string getFile(JODA_JOINID id)
Definition: FileJoinManager.cpp:103
std::mutex mut
Definition: FileJoinManager.h:52
JODA_JOINID currID
Definition: FileJoinManager.h:54
std::unordered_map< JODA_JOINID, std::mutex > fLock
Definition: FileJoinManager.h:57
JODA_JOINID getJoinVal(const RJValue &val)
Definition: FileJoinManager.cpp:13
bool appendDocToFile(const RapidJsonDocument &doc, const std::string &file)
Definition: FileJoinManager.cpp:151
void join(const RapidJsonDocument &doc) override
Definition: FileJoinManager.cpp:120
bool createFile(const std::string &file, bool val)
Definition: FileJoinManager.cpp:80
bool falseValCreated
Definition: FileJoinManager.h:60
Definition: JoinManager.h:19
@ STARTNORMAL_VAL
Definition: JoinManager.h:53
std::string name
Definition: JoinManager.h:55
std::unique_ptr< joda::query::IValueProvider > valProv
Definition: JoinManager.h:56
Definition: RapidJsonDocument.h:22