AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
task_id.h
1#ifndef TASK_ID_H
2#define TASK_ID_H
3
4#include "downward/utils/hash.h"
5
6#include <cstdint>
7#include <functional>
8
9class PlanningTask;
10
11/*
12 A TaskID uniquely identifies a task (for unordered_maps and comparison)
13 without publicly exposing the internal AbstractTask pointer.
14*/
15class TaskID {
16 const std::uintptr_t value;
17
18public:
19 explicit TaskID(const PlanningTask* task)
20 : value(reinterpret_cast<uintptr_t>(task))
21 {
22 }
23
24 bool operator==(const TaskID& other) const { return value == other.value; }
25
26 bool operator!=(const TaskID& other) const { return !(*this == other); }
27
28 std::uint64_t hash() const { return value; }
29};
30
31namespace utils {
32inline void feed(HashState& hash_state, TaskID id)
33{
34 feed(hash_state, id.hash());
35}
36} // namespace utils
37
38#endif