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>
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{
74 std::optional<json> parseToJson(TransformationDef transform_def, use_json_t);
75
81 template<>
82 std::optional<TransformationDef> parseFromJson(json json, use_json_t);
83
89 std::optional<json> parseToJson(Dimension dimension, use_json_t);
90
96 template<>
97 std::optional<Dimension> parseFromJson(json json, use_json_t);
98
104 std::optional<std::string> parseToJson(Dimension dimension, use_protobuf_t);
105
111 template<>
112 std::optional<Dimension> parseFromJson(std::string json_str, use_protobuf_t);
113
119 std::optional<json> parseToJson(Feature feature, use_json_t);
120
126 template<>
127 std::optional<Feature> parseFromJson(json json_obj, use_json_t);
128
134 std::optional<std::string> parseToJson(Feature feature, use_protobuf_t);
135
141 template<>
142 std::optional<Feature> parseFromJson(std::string json_str, use_protobuf_t);
143
144
145 std::optional<json> parseToJson(FeatureRecord feature, use_json_t);
146 std::optional<std::string> parseToJson(FeatureRecord feature_record, use_protobuf_t);
147
148 template<>
149 std::optional<FeatureRecord> parseFromJson(json json_obj, use_json_t);
150
151 template<>
152 std::optional<FeatureRecord> parseFromJson(std::string json_str, use_protobuf_t);
153}
Definition auth.hpp:34
std::optional< json > parseToJson(TransformationDef transform_def, use_json_t)
Parses a TransformationDef object to a JSON object.
Definition feature.cpp:93
std::optional< T > parseFromJson(json json, use_json_t)
Parses a JSON object to a Transformation object.
Definition decentralised_art.hpp:30
std::string constructFeatureSolidityCode(const Feature &feature)
Definition feature.cpp:5
H AbslHashValue(H h, const evmc::address &addr)
Definition evm_storage.hpp:137
nlohmann::json json
Definition parser.hpp:4