Blender V4.3
COM_simple_operation.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include "BLI_string_ref.hh"
8
9#include "COM_operation.hh"
10#include "COM_result.hh"
11
13
14/* ------------------------------------------------------------------------------------------------
15 * Simple Operation
16 *
17 * A simple operation is an operation that takes exactly one input and computes exactly one output.
18 * Moreover, the output is guaranteed to only have a single user, that is, its reference count will
19 * be one. Such operations can be attached to the inputs of operations to pre-process the inputs to
20 * prepare them before the operation is executed. */
21class SimpleOperation : public Operation {
22 private:
23 /* The identifier of the output. This is constant for all operations. */
24 static const StringRef output_identifier_;
25 /* The identifier of the input. This is constant for all operations. */
26 static const StringRef input_identifier_;
27
28 public:
30
31 /* Get a reference to the output result of the operation, this essentially calls the super
32 * get_result method with the output identifier of the operation. */
34
35 /* Map the input of the operation to the given result, this essentially calls the super
36 * map_input_to_result method with the input identifier of the operation. */
37 void map_input_to_result(Result *result);
38
39 protected:
40 /* Simple operations don't need input processors, so override with an empty implementation. */
42
43 /* Get a reference to the input result of the operation, this essentially calls the super
44 * get_result method with the input identifier of the operation. */
46
47 /* Switch the result mapped to the input with the given result, this essentially calls the super
48 * switch_result_mapped_to_input method with the input identifier of the operation. */
50
51 /* Populate the result of the operation, this essentially calls the super populate_result method
52 * with the output identifier of the operation and sets the initial reference count of the result
53 * to 1, since the result of an operation is guaranteed to have a single user. */
54 void populate_result(Result result);
55
56 /* Declare the descriptor of the input of the operation to be the given descriptor, this
57 * essentially calls the super declare_input_descriptor method with the input identifier of the
58 * operation. */
60
61 /* Get a reference to the descriptor of the input, this essentially calls the super
62 * get_input_descriptor method with the input identifier of the operation. */
64};
65
66} // namespace blender::realtime_compositor
void declare_input_descriptor(InputDescriptor descriptor)
descriptor