SOLA
Loading...
Searching...
No Matches
transport_order.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_MATERIAL_FLOW_TRANSPORT_ORDER_H_
18#define DAISI_MATERIAL_FLOW_TRANSPORT_ORDER_H_
19
20#include <vector>
21
22#include "cpps/model/order_states.h"
23#include "solanet/serializer/serialize.h"
24#include "transport_order_step.h"
25
26namespace daisi::material_flow {
27
29public:
30 TransportOrder() = default;
31
32 TransportOrder(std::vector<TransportOrderStep> pickup_transport_order_steps,
33 TransportOrderStep delivery_transport_order_step);
34
35 TransportOrder(std::string uuid, std::vector<TransportOrderStep> pickup_transport_order_steps,
36 TransportOrderStep delivery_transport_order_step);
37
38 const std::string &getUuid() const;
39
40 const TransportOrderStep &getDeliveryTransportOrderStep() const;
41 std::vector<TransportOrderStep> getPickupTransportOrderSteps() const;
42
43 bool operator==(const TransportOrder &other) const;
44
45 void setOrderState(cpps::OrderStates state) { state_ = state; }
46 cpps::OrderStates getOrderState() const { return state_; }
47
48 SERIALIZE(uuid_, pickup_transport_order_steps_, delivery_transport_order_step_);
49
50private:
51 cpps::OrderStates state_ = cpps::OrderStates::kInvalid;
52
53 std::string uuid_;
54
55 std::vector<TransportOrderStep> pickup_transport_order_steps_;
56 TransportOrderStep delivery_transport_order_step_;
57};
58
59} // namespace daisi::material_flow
60
61namespace std {
62
63template <> struct hash<daisi::material_flow::TransportOrder> {
64 std::size_t operator()(const daisi::material_flow::TransportOrder &order) const {
65 string repr = order.getUuid();
66 return hash<string>()(repr);
67 }
68};
69
70} // namespace std
71
72#endif
Definition transport_order.h:28
Definition transport_order_step.h:28