5 #ifndef JODA_RAPIDJSONDOCUMENT_H
6 #define JODA_RAPIDJSONDOCUMENT_H
8 #include <rapidjson/allocators.h>
9 #include <rapidjson/fwd.h>
12 #include "../../../../../misc/include/joda/misc/FileNameRepo.h"
31 std::unique_ptr<const IOrigin> &&
origin);
39 std::unique_ptr<const IOrigin> &&
origin);
67 const std::unique_ptr<RJDocument> &
getJson()
const;
79 void setOrigin(std::unique_ptr<const IOrigin> &&orig);
96 unsigned long getId()
const;
112 const std::unique_ptr<ViewLayer> &
getView()
const;
116 const std::unique_ptr<const IOrigin>&
getOrigin()
const;
120 template <
typename Handler>
123 DCHECK(
view !=
nullptr) <<
"View was not computed";
124 return view->Accept(handler);
126 DCHECK(
json !=
nullptr) <<
"Json was not loaded";
127 return json->Accept(handler);
134 std::unique_ptr<RJDocument>
json;
135 std::unique_ptr<ViewLayer>
view;
139 static std::atomic_ulong currID;
rapidjson::GenericPointer< RJValue, RJBaseAlloc > RJPointer
Definition: RJFwd.h:30
rapidjson::GenericValue< RJChar, RJMemoryPoolAlloc > RJValue
Definition: RJFwd.h:29
std::unique_ptr< RJMemoryPoolAlloc > RJMemoryPoolPointer
Definition: RapidJsonDocument.h:143
unsigned long DOC_ID
Definition: RapidJsonDocument.h:16
std::unique_ptr< RapidJsonDocument > RJDocumentPointer
Definition: RapidJsonDocument.h:142
Definition: RapidJsonDocument.h:22
const std::unique_ptr< RJDocument > & getJson() const
Definition: RapidJsonDocument.cpp:12
const std::unique_ptr< const IOrigin > & getOrigin() const
Definition: RapidJsonDocument.cpp:25
std::unique_ptr< RJDocument > json
Definition: RapidJsonDocument.h:134
void setOrigin(std::unique_ptr< const IOrigin > &&orig)
Definition: RapidJsonDocument.cpp:43
void setJson(std::unique_ptr< RJDocument > &&json)
Definition: RapidJsonDocument.cpp:39
RapidJsonDocument & operator=(RapidJsonDocument &&other) noexcept=default
RapidJsonDocument & operator=(const RapidJsonDocument &other)=delete
RJValue const * Get(const RJPointer &ptr) const
Definition: RapidJsonDocument.cpp:56
const std::unique_ptr< ViewLayer > & getView() const
Definition: RapidJsonDocument.cpp:65
bool isView_
Definition: RapidJsonDocument.h:136
bool Accept(Handler &handler) const
Definition: RapidJsonDocument.h:121
bool isView() const
Definition: RapidJsonDocument.cpp:49
std::unique_ptr< ViewLayer > view
Definition: RapidJsonDocument.h:135
RapidJsonDocument(RapidJsonDocument &&doc) noexcept=default
bool isValid() const
Definition: RapidJsonDocument.cpp:47
void removeDoc()
Definition: RapidJsonDocument.cpp:16
static DOC_ID getNewID()
Definition: RapidJsonDocument.cpp:22
RapidJsonDocument(const RapidJsonDocument &doc)=delete
void setView(std::unique_ptr< ViewLayer > &&view)
Definition: RapidJsonDocument.cpp:51
std::unique_ptr< const IOrigin > origin
Definition: RapidJsonDocument.h:133
unsigned long getId() const
Definition: RapidJsonDocument.cpp:20
~RapidJsonDocument()=default