Debian Codegraph @

modules/objectdb_profiler/editor/data_viewers/class_view.h

raw symbols SCIP
1 /**************************************************************************/
2 /* class_view.h */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10 /* */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the */
13 /* "Software"), to deal in the Software without restriction, including */
14 /* without limitation the rights to use, copy, modify, merge, publish, */
15 /* distribute, sublicense, and/or sell copies of the Software, and to */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions: */
18 /* */
19 /* The above copyright notice and this permission notice shall be */
20 /* included in all copies or substantial portions of the Software. */
21 /* */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29 /**************************************************************************/
30
31 #pragma once
32
33 #include "../snapshot_data.h"
34 #include "snapshot_view.h"
35
36 class Tree;
37 class TreeItem;
38
39 struct ClassData {
40 ClassData() {}
41 ClassData(const String &p_name, const String &p_parent) :
42 class_name(p_name), parent_class_name(p_parent) {}
43 String class_name;
44 String parent_class_name;
45 HashSet<String> child_classes;
46 LocalVector<SnapshotDataObject *> instances;
47 TreeItem *tree_node = nullptr;
48 HashMap<GameStateSnapshot *, int> recursive_instance_count_cache;
49
50 int instance_count(GameStateSnapshot *p_snapshot = nullptr);
51 int get_recursive_instance_count(HashMap<String, ClassData> &p_all_classes, GameStateSnapshot *p_snapshot = nullptr);
52 };
53
54 class SnapshotClassView : public SnapshotView {
55 GDCLASS(SnapshotClassView, SnapshotView);
56
57 protected:
58 Tree *class_tree = nullptr;
59 Tree *object_list = nullptr;
60 Tree *diff_object_list = nullptr;
61
62 void _object_selected(Tree *p_tree);
63 void _class_selected();
64 void _add_objects_to_class_map(HashMap<String, ClassData> &p_class_map, GameStateSnapshot *p_objects);
65 void _notification(int p_what);
66
67 Tree *_make_object_list_tree(const String &p_column_name);
68 void _populate_object_list(GameStateSnapshot *p_snapshot, Tree *p_list, const String &p_name_base);
69 void _update_lists();
70
71 public:
72 SnapshotClassView();
73 virtual void show_snapshot(GameStateSnapshot *p_data, GameStateSnapshot *p_diff_data) override;
74 };