SOLA
Loading...
Searching...
No Matches
amr_static_ability.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_CPPS_AMR_MODEL_AMR_STATIC_ABILITY_H_
18#define DAISI_CPPS_AMR_MODEL_AMR_STATIC_ABILITY_H_
19
20#include <iostream>
21#include <string>
22#include <tuple>
23#include <unordered_map>
24#include <utility>
25
26#include "amr_load_carrier.h"
27#include "solanet/serializer/serialize.h"
28
29namespace daisi::cpps::amr {
30
31// TODO: add documentation
33public:
34 AmrStaticAbility() = default;
35 AmrStaticAbility(const LoadCarrier &load_carrier, float max_payload_weight_kg);
36
37 const LoadCarrier &getLoadCarrier() const;
38 float getMaxPayloadWeight() const;
39 bool isValid() const;
40
41 friend bool operator==(const AmrStaticAbility &a1, const AmrStaticAbility &a2);
42 friend bool operator!=(const AmrStaticAbility &a1, const AmrStaticAbility &a2);
43 friend bool operator<(const AmrStaticAbility &a1, const AmrStaticAbility &a2);
44 friend bool operator<=(const AmrStaticAbility &a1, const AmrStaticAbility &a2);
45 friend bool operator>(const AmrStaticAbility &a1, const AmrStaticAbility &a2);
46 friend bool operator>=(const AmrStaticAbility &a1, const AmrStaticAbility &a2);
47
48 friend std::ostream &operator<<(std::ostream &os, const AmrStaticAbility &a);
49
50 SERIALIZE(load_carrier_, max_payload_weight_kg_);
51
52private:
53 LoadCarrier load_carrier_;
54 float max_payload_weight_kg_;
55};
56
58 std::size_t operator()(const AmrStaticAbility &ability) const {
59 std::string rep = ability.getLoadCarrier().getTypeAsString() + "|" +
60 std::to_string(ability.getMaxPayloadWeight());
61
62 std::size_t res = std::hash<std::string>()(rep);
63 return res;
64 }
65};
66
67} // namespace daisi::cpps::amr
68
69#endif
Definition amr_static_ability.h:32
Definition amr_load_carrier.h:29
Definition amr_static_ability.h:57