Xiangiqgame
AI engine for Xiangqi
Loading...
Searching...
No Matches
json_utility_interface.hpp
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <string>
7
8using namespace std;
9
10namespace piecepoints {
11class BPOPointsSKeys;
12} // namespace piecepoints
13
16template <typename ConcreteJsonUtility>
18public:
19 template <typename T>
20 void Import(T &object, const string file_path) {
21 static_cast<ConcreteJsonUtility *>(this)->ImplementImport(object, file_path);
22 }
23
24 template <typename T>
25 void Export(T &object, const string file_path) {
26 static_cast<ConcreteJsonUtility *>(this)->ImplementExport(object, file_path);
27 }
28
29 void Import(piecepoints::BPOPointsSKeys &bpo_points, const string file_path) {
30 static_cast<ConcreteJsonUtility *>(this)->ImplementImport(bpo_points, file_path);
31 }
32
33 void Export(piecepoints::BPOPointsSKeys &bpo_points, const string file_path) {
34 static_cast<ConcreteJsonUtility *>(this)->ImplementExport(bpo_points, file_path);
35 }
36};
CRTP interface with methods of importing / exporting objects from / to json files (concrete example =...
void Export(T &object, const string file_path)
void Import(piecepoints::BPOPointsSKeys &bpo_points, const string file_path)
void Import(T &object, const string file_path)
void Export(piecepoints::BPOPointsSKeys &bpo_points, const string file_path)
Piece Points spec in "Base Points Offset" form with string keys in member unordered_map objects for e...
Providing position-dependent values of pieces to objects in moveselection namespace.