summaryrefslogtreecommitdiffhomepage
path: root/src/search-result.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/search-result.hpp')
-rw-r--r--src/search-result.hpp50
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