AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
pattern_information.h
1#ifndef PDBS_PATTERN_INFORMATION_H
2#define PDBS_PATTERN_INFORMATION_H
3
4#include "downward/pdbs/types.h"
5
6#include "downward/task_proxy.h"
7
8#include <memory>
9
10namespace utils {
11class LogProxy;
12}
13
14namespace pdbs {
15/*
16 This class is a wrapper for a pair of a pattern and the corresponding PDB.
17 It always contains a pattern and can contain the computed PDB. If the latter
18 is not set, it is computed on demand.
19 Ownership of the information is shared between the creators of this class
20 (usually PatternGenerators), the class itself, and its users (consumers of
21 patterns like heuristics).
22
23 TODO: consider using this class not for shared ownership but for actual
24 ownership transfer, from the generator to the user.
25*/
26class PatternInformation {
27 TaskProxy task_proxy;
28 Pattern pattern;
29 std::shared_ptr<PatternDatabase> pdb;
30
31 void create_pdb_if_missing();
32
33 bool information_is_valid() const;
34
35public:
36 PatternInformation(
37 const TaskProxy& task_proxy,
38 Pattern pattern,
39 utils::LogProxy& log);
40
41 void set_pdb(const std::shared_ptr<PatternDatabase>& pdb);
42
43 TaskProxy get_task_proxy() const { return task_proxy; }
44
45 const Pattern& get_pattern() const;
46 std::shared_ptr<PatternDatabase> get_pdb();
47};
48} // namespace pdbs
49
50#endif