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 h = H::combine(std::move(h), d.feature_name());
41 for (const TransformationDef & t : d.transformations()) {
42 h = H::combine(std::move(h), t);
43 }
44 return h;
45 }
46
55 template <typename H>
56 inline H AbslHashValue(H h, const Feature& f) {
57 h = H::combine(std::move(h), f.name());
58 for (const Dimension & d : f.dimensions()) {
59 h = H::combine(std::move(h), d);
60 }
61 return h;
62 }
63
64 std::string constructFeatureSolidityCode(const Feature & feature);
65}
66
67namespace dcn::parse
68{
73 template<>
74 Result<json> parseToJson(TransformationDef transform_def, use_json_t);
75
80 template<>
81 Result<TransformationDef> parseFromJson(json json, use_json_t);
82
87 template<>
88 Result<json> parseToJson(Dimension dimension, use_json_t);
89
94 template<>
95 Result<Dimension> parseFromJson(json json, use_json_t);
96
101 template<>
102 Result<std::string> parseToJson(Dimension dimension, use_protobuf_t);
103
108 template<>
109 Result<Dimension> parseFromJson(std::string json_str, use_protobuf_t);
110
115 template<>
116 Result<json> parseToJson(Feature feature, use_json_t);
117
122 template<>
123 Result<Feature> parseFromJson(json json_obj, use_json_t);
124
130 template<>
131 Result<std::string> parseToJson(Feature feature, use_protobuf_t);
132
137 template<>
138 Result<Feature> parseFromJson(std::string json_str, use_protobuf_t);
139
144 template<>
145 Result<json> parseToJson(FeatureRecord feature, use_json_t);
146
151 template<>
152 Result<std::string> parseToJson(FeatureRecord feature_record, use_protobuf_t);
153
158 template<>
159 Result<FeatureRecord> parseFromJson(json json_obj, use_json_t);
160
165 template<>
166 Result<FeatureRecord> parseFromJson(std::string json_str, use_protobuf_t);
167}
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:29
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