Blender  V2.93
COM_Debug.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * Copyright 2013, Blender Foundation.
17  */
18 
19 #pragma once
20 
21 #include <map>
22 #include <string>
23 
24 #include "COM_NodeOperation.h"
25 #include "COM_defines.h"
26 
27 namespace blender::compositor {
28 
29 class Node;
30 class ExecutionSystem;
31 class ExecutionGroup;
32 
33 class DebugInfo {
34  public:
36 
37  typedef std::map<const Node *, std::string> NodeNameMap;
38  typedef std::map<const NodeOperation *, std::string> OpNameMap;
39  typedef std::map<const ExecutionGroup *, GroupState> GroupStateMap;
40 
41  static std::string node_name(const Node *node);
42  static std::string operation_name(const NodeOperation *op);
43 
44  static void convert_started();
45  static void execute_started(const ExecutionSystem *system);
46 
47  static void node_added(const Node *node);
48  static void node_to_operations(const Node *node);
49  static void operation_added(const NodeOperation *operation);
50  static void operation_read_write_buffer(const NodeOperation *operation);
51 
52  static void execution_group_started(const ExecutionGroup *group);
53  static void execution_group_finished(const ExecutionGroup *group);
54 
55  static void graphviz(const ExecutionSystem *system);
56 
57 #ifdef COM_DEBUG
58  protected:
59  static int graphviz_operation(const ExecutionSystem *system,
60  NodeOperation *operation,
61  const ExecutionGroup *group,
62  char *str,
63  int maxlen);
64  static int graphviz_legend_color(const char *name, const char *color, char *str, int maxlen);
65  static int graphviz_legend_line(
66  const char *name, const char *color, const char *style, char *str, int maxlen);
67  static int graphviz_legend_group(
68  const char *name, const char *color, const char *style, char *str, int maxlen);
69  static int graphviz_legend(char *str, int maxlen);
70  static bool graphviz_system(const ExecutionSystem *system, char *str, int maxlen);
71 
72  private:
73  static int m_file_index;
75  static NodeNameMap m_node_names;
77  static OpNameMap m_op_names;
79  static std::string m_current_node_name;
81  static std::string m_current_op_name;
83  static GroupStateMap m_group_states;
84 #endif
85 };
86 
87 } // namespace blender::compositor
static std::string node_name(const Node *node)
Definition: COM_Debug.cc:464
static void node_added(const Node *node)
Definition: COM_Debug.cc:478
static void operation_read_write_buffer(const NodeOperation *operation)
Definition: COM_Debug.cc:487
static void execute_started(const ExecutionSystem *system)
Definition: COM_Debug.cc:475
static void execution_group_started(const ExecutionGroup *group)
Definition: COM_Debug.cc:490
static std::string operation_name(const NodeOperation *op)
Definition: COM_Debug.cc:468
static void operation_added(const NodeOperation *operation)
Definition: COM_Debug.cc:484
std::map< const Node *, std::string > NodeNameMap
Definition: COM_Debug.h:37
std::map< const NodeOperation *, std::string > OpNameMap
Definition: COM_Debug.h:38
static void graphviz(const ExecutionSystem *system)
Definition: COM_Debug.cc:496
std::map< const ExecutionGroup *, GroupState > GroupStateMap
Definition: COM_Debug.h:39
static void node_to_operations(const Node *node)
Definition: COM_Debug.cc:481
static void execution_group_finished(const ExecutionGroup *group)
Definition: COM_Debug.cc:493
Class ExecutionGroup is a group of Operations that are executed as one. This grouping is used to comb...
the ExecutionSystem contains the whole compositor tree.
NodeOperation contains calculation logic.
OperationNode * node
#define str(s)
Definition: node.h:98