diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-25 04:45:17 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-25 04:48:09 +0100 |
commit | 50e42d74c9b25e2ec4c6b9fd3434f431c0b5c3d9 (patch) | |
tree | 826691d937867e21587fd87adb2de6d34175eecd /src/search-result.hpp | |
parent | 4746d19f7a749808391d1ad7ee6bd86950ba064f (diff) |
rename path_search -> search
Diffstat (limited to 'src/search-result.hpp')
-rw-r--r-- | src/search-result.hpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/search-result.hpp b/src/search-result.hpp new file mode 100644 index 00000000..d29fdc44 --- /dev/null +++ b/src/search-result.hpp @@ -0,0 +1,50 @@ +#pragma once +#include "compat/defs.hpp" +#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; + + const point* data() const; + const point& operator[](size_t index) const; + 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::lvalue_reference_to_vector> raw_path(); + ArrayView<const point> path() const; + explicit operator ArrayView<const point>() 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: + struct node; + + static Pointer<node> _pool; // NOLINT(*-avoid-non-const-global-variables) + + Pointer<node> _node; + float _time = 0; + uint32_t _cost = 0, _distance = (uint32_t)-1; + bool _found : 1 = false; +}; + +} // namespace floormat |