summaryrefslogtreecommitdiffhomepage
path: root/src/search-result.hpp
blob: 97d4024228a1045dd1999d43efd7f648ab480317 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once
#include "compat/vector-wrapper-fwd.hpp"
#include "src/global-coords.hpp"
#include <Corrade/Containers/Pointer.h>

namespace floormat {

struct point;

struct path_search_result final
{
    friend struct test_app;
    struct node;

    size_t size() const;
    uint32_t cost() const;
    void set_cost(uint32_t value);
    float time() const;
    void set_time(float time);
    bool is_found() const;
    void set_found(bool value);
    uint32_t distance() const;
    void set_distance(uint32_t dist);

    vector_wrapper<point, vector_wrapper_repr::ref> raw_path();
    ArrayView<const point> path() const;
    explicit operator bool() const;

    path_search_result();
    path_search_result(const path_search_result& x) noexcept;
    path_search_result& operator=(const path_search_result& x) noexcept;
    path_search_result(path_search_result&&) noexcept;
    path_search_result& operator=(path_search_result&&) noexcept;
    ~path_search_result() noexcept;

private:
    Pointer<node> _node;
    float _time = 0;
    uint32_t _cost = 0, _distance = (uint32_t)-1;
    bool _found : 1 = false;

    static Pointer<node> _pool; // NOLINT(*-avoid-non-const-global-variables)
};

} // namespace floormat