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
particle.hpp
Go to the documentation of this file.
1#pragma once
2#include <absl/hash/hash.h>
3
4#include "particle.pb.h"
5
6#include "parser.hpp"
7
8namespace dcn
9{
18 template <typename H>
19 inline H AbslHashValue(H h, const Particle & p) {
20 h = H::combine(std::move(h), p.name(), p.feature_name());
21 for (const auto & c : p.composite_names()) {
22 h = H::combine(std::move(h), c);
23 }
24 h = H::combine(std::move(h), p.condition_name());
25 for(const auto & arg : p.condition_args()) {
26 h = H::combine(std::move(h), arg);
27 }
28 return h;
29 }
30
31 std::string constructParticleSolidityCode(const Particle & particle);
32}
33
34namespace dcn::parse
35{
40 template<>
41 Result<json> parseToJson(Particle particle, use_json_t);
42
47 template<>
48 Result<Particle> parseFromJson(json json_obj, use_json_t);
49
55 template<>
56 Result<std::string> parseToJson(Particle particle, use_protobuf_t);
57
62 template<>
63 Result<Particle> parseFromJson(std::string json_str, use_protobuf_t);
64
69 template<>
70 Result<json> parseToJson(ParticleRecord particle_record, use_json_t);
71
76 template<>
77 Result<std::string> parseToJson(ParticleRecord particle_record, use_protobuf_t);
78
83 template<>
84 Result<ParticleRecord> parseFromJson(json json_obj, use_json_t);
85
90 template<>
91 Result<ParticleRecord> parseFromJson(std::string json_str, use_protobuf_t);
92}
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 constructParticleSolidityCode(const Particle &particle)
Definition particle.cpp:5
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