Decentralised Art Server
High-performance C++ backend that exposes HTML interface and a secure REST API for managing Performative Transactions entities
 
Loading...
Searching...
No Matches
feature.hpp
Go to the documentation of this file.
1#pragma once
2#include <absl/hash/hash.h>
3
4#include "feature.pb.h"
5
6#include "parser.hpp"
7
8namespace dcn
9{
10
19 template <typename H>
20 inline H AbslHashValue(H h, const TransformationDef & td)
21 {
22 h = H::combine(std::move(h), td.name());
23 for (const int32_t & arg : td.args()) {
24 h = H::combine(std::move(h), arg);
25 }
26 return h;
27 }
28
37 template <typename H>
38 inline H AbslHashValue(H h, const Dimension& d)
39 {
40 for (const TransformationDef & t : d.transformations()) {
41 h = H::combine(std::move(h), t);
42 }
43 return h;
44 }
45
54 template <typename H>
55 inline H AbslHashValue(H h, const Feature& f) {
56 h = H::combine(std::move(h), f.name());
57 for (const Dimension & d : f.dimensions()) {
58 h = H::combine(std::move(h), d);
59 }
60 return h;
61 }
62
63 std::string constructFeatureSolidityCode(const Feature & feature);
64}
65
66namespace dcn::parse
67{
72 template<>
73 Result<json> parseToJson(TransformationDef transform_def, use_json_t);
74
79 template<>
80 Result<TransformationDef> parseFromJson(json json, use_json_t);
81
86 template<>
87 Result<json> parseToJson(Dimension dimension, use_json_t);
88
93 template<>
94 Result<Dimension> parseFromJson(json json, use_json_t);
95
100 template<>
101 Result<std::string> parseToJson(Dimension dimension, use_protobuf_t);
102
107 template<>
108 Result<Dimension> parseFromJson(std::string json_str, use_protobuf_t);
109
114 template<>
115 Result<json> parseToJson(Feature feature, use_json_t);
116
121 template<>
122 Result<Feature> parseFromJson(json json_obj, use_json_t);
123
129 template<>
130 Result<std::string> parseToJson(Feature feature, use_protobuf_t);
131
136 template<>
137 Result<Feature> parseFromJson(std::string json_str, use_protobuf_t);
138
143 template<>
144 Result<json> parseToJson(FeatureRecord feature, use_json_t);
145
150 template<>
151 Result<std::string> parseToJson(FeatureRecord feature_record, use_protobuf_t);
152
157 template<>
158 Result<FeatureRecord> parseFromJson(json json_obj, use_json_t);
159
164 template<>
165 Result<FeatureRecord> parseFromJson(std::string json_str, use_protobuf_t);
166}
Definition auth.cpp:4
Result< json > parseToJson(T message, use_json_t)
Converts a T to a JSON object using JSON.
Result< T > parseFromJson(json json, use_json_t)
Converts a JSON string to a T using JSON.
Definition decentralised_art.hpp:30
std::string constructFeatureSolidityCode(const Feature &feature)
Definition feature.cpp:7
H AbslHashValue(H h, const Condition &c)
Combines hash values for a Condition object.
Definition condition.hpp:24
nlohmann::json json
Definition parser.hpp:4