SOLA
Loading...
Searching...
No Matches
peer_discovery_attributes.h
1// Copyright 2023 The SOLA authors
2//
3// This file is part of DAISI.
4//
5// DAISI is free software: you can redistribute it and/or modify it under the terms of the GNU
6// General Public License as published by the Free Software Foundation; version 2.
7//
8// DAISI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
9// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
10// Public License for more details.
11//
12// You should have received a copy of the GNU General Public License along with DAISI. If not, see
13// <https://www.gnu.org/licenses/>.
14//
15// SPDX-License-Identifier: GPL-2.0-only
16
17#ifndef DAISI_MINHTON_NS3_MINHTON_PEER_DISCOVERY_ATTRIBUTES_H_
18#define DAISI_MINHTON_NS3_MINHTON_PEER_DISCOVERY_ATTRIBUTES_H_
19
20#include <variant>
21
22#include "manager/scenariofile_component.h"
23#include "peer_discovery_general.h"
24
25namespace daisi::minhton_ns3 {
26
27/*********************/
28/* PRESENCE BEHAVIOR */
29/*********************/
30
32 double percentage;
33
34 void parse(const YAML::Node &node);
35};
36
37/*******************/
38/* CONTENT BEHAVIOR */
39/*******************/
40
42 // Only exactly one must be valid
43 std::optional<int> content_int;
44 std::optional<float> content_float;
45 std::optional<bool> content_bool;
46 std::optional<std::string> content_string;
47
48 double prob;
49
50 void parse(const YAML::Node &node);
51};
52
53struct Choice {
54 static std::string typeName() { return "choice"; }
55
56 std::vector<ChoiceValue> values;
57
58 void parse(const YAML::Node &node);
59};
60
61struct Constant {
62 static std::string typeName() { return "constant"; }
63
64 // Only exactly one must be valid
65 std::optional<int> value_int;
66 std::optional<float> value_float;
67 std::optional<bool> value_bool;
68 std::optional<std::string> value_string;
69
70 void parse(const YAML::Node &node);
71};
72
74 std::variant<Choice, Constant, Gaussian, Uniform> content_behavior;
75
76 void parse(const YAML::Node &node);
77};
78
79/*******************/
80/* UPDATE BEHAVIOR */
81/*******************/
82
84 static std::string typeName() { return "static"; }
85
86 void parse(YAML::Node) { /* nothing required */
87 }
88};
89
91 std::variant<ConstantTime, Gaussian, Uniform, StaticUpdate> update_behavior;
92
93 void parse(const YAML::Node &node);
94};
95
96/*******************/
97/**** ATTRIBUTE ****/
98/*******************/
99
101 std::string name;
102 PresenceBehavior presence_behavior;
103 ContentBehavior content_behavior;
104 UpdateBehavior update_behavior;
105
106 void parse(const YAML::Node &node);
107};
108
109} // namespace daisi::minhton_ns3
110
111#endif
Definition peer_discovery_attributes.h:41
Definition peer_discovery_attributes.h:53
Definition peer_discovery_attributes.h:61
Definition peer_discovery_attributes.h:73
Definition peer_discovery_attributes.h:100
Definition peer_discovery_attributes.h:31
Definition peer_discovery_attributes.h:83
Definition peer_discovery_attributes.h:90