pars 0.2.1
Loading...
Searching...
No Matches
kind.h
Go to the documentation of this file.
1/*
2Copyright (c) 2025 Giuseppe Roberti.
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without modification,
6are permitted provided that the following conditions are met:
7
81. Redistributions of source code must retain the above copyright notice, this
9list of conditions and the following disclaimer.
10
112. Redistributions in binary form must reproduce the above copyright notice,
12this list of conditions and the following disclaimer in the documentation and/or
13other materials provided with the distribution.
14
153. Neither the name of the copyright holder nor the names of its contributors
16may be used to endorse or promote products derived from this software without
17specific prior written permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29*/
30#pragma once
31
32#include "pars/ev/kind_base.h"
33#include "pars/ev/kind_decl.h"
34#include "pars/ev/klass.h"
35
36#include <string_view>
37
38namespace pars::ev
39{
40
41template<network_event_c event_t>
42struct sent<event_t> : base_kind<sent, event_t>
43{
44 using event_type = event_t;
45
47
48 static constexpr std::string_view uuid =
49 "665b247d-ab3f-421e-8956-1a8c02d42f35";
50};
51
52template<typename event_t>
54
55template<network_event_c event_t>
56struct received<event_t> : base_kind<received, event_t>
57{
58 using event_type = event_t;
59
61
62 static constexpr std::string_view uuid =
63 "b63dab32-1bc2-46ef-9ca0-0e1530f5c026";
64};
65
66template<typename event_t>
68
69template<>
70struct received<nngxx::msg> : base_kind<received, nngxx::msg>
71{
73
75
76 static constexpr std::string_view uuid =
77 "b63dab32-1bc2-46ef-9ca0-0e1530f5c026";
78
79 std::size_t msg_hash() const
80 {
81 auto h1 = hash_from_uuid(uuid);
82
83 auto h2 = hash_from_msg(event());
84
85 return h1 ^ (h2 << 1);
86 }
87};
88
89template<event_c event_t>
90struct fired<event_t> : base_kind<fired, event_t>
91{
92 using event_type = event_t;
93
95
96 static constexpr std::string_view uuid =
97 "280c62eb-4c24-4185-964d-e2b242671da7";
98};
99
100template<typename event_t>
102
103} // namespace pars::ev
Definition aio.h:35
clev::own< nng_msg * > msg
Definition msg.h:39
received(event_t, metadata< received, event_t >) -> received< event_t >
fired(event_t, metadata< fired, event_t >) -> fired< event_t >
sent(event_t, metadata< sent, event_t >) -> sent< event_t >
@ event
Definition flags.h:43
static constexpr std::string_view uuid
Definition kind.h:96
static constexpr std::string_view uuid
Definition kind.h:62
static constexpr std::string_view uuid
Definition kind.h:76
std::size_t msg_hash() const
Definition kind.h:79
static constexpr std::string_view uuid
Definition kind.h:48