MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ clone()

std::shared_ptr< Logic > MayaFlux::Nodes::Generator::Logic::clone ( ) const

An independent node with the same behaviour and fresh state.

Same mode, operator, thresholds, function and coefficient array as the array stands now, so a state-bearing kernel's clone continues from the current state. History, saved state and hooks are not copied. The input node, if any, is shared, and so is closure state captured by a function; the coefficient array is the state that is not.

Attach one clone per channel instead of one node to several.

Definition at line 132 of file Logic.cpp.

133{
134 std::shared_ptr<Logic> copy;
135
137 switch (m_mode) {
139 copy = std::make_shared<Logic>(m_coef_direct_function, m_coefficients);
140 break;
143 break;
145 copy = std::make_shared<Logic>(m_coef_temporal_function, m_coefficients);
146 break;
148 copy = std::make_shared<Logic>(m_coef_multi_function, m_input_count, m_coefficients);
149 break;
150 }
151 }
152
153 if (!copy) {
154 switch (m_mode) {
157 ? std::make_shared<Logic>(m_direct_function)
158 : std::make_shared<Logic>(m_operator, m_threshold);
159 break;
161 copy = std::make_shared<Logic>(m_sequential_function, m_history_size);
162 break;
164 copy = std::make_shared<Logic>(m_temporal_function);
165 break;
167 copy = std::make_shared<Logic>(m_multi_input_function, m_input_count);
169 copy->m_multi_input_function = copy->default_multi_input_function();
170 copy->m_default_multi_input = true;
171 }
172 break;
173 }
174 }
175
176 copy->m_coefficients = m_coefficients;
177 copy->m_threshold = m_threshold;
178 copy->m_low_threshold = m_low_threshold;
179 copy->m_high_threshold = m_high_threshold;
180 copy->m_edge_type = m_edge_type;
181 copy->m_input_node = m_input_node;
182 copy->m_input_nodes = m_input_nodes;
183 return copy;
184}
SequentialFunction m_sequential_function
Function for sequential mode.
Definition Logic.hpp:698
TemporalFunction m_temporal_function
Function for temporal mode.
Definition Logic.hpp:699
DirectFunction m_direct_function
Function for direct mode.
Definition Logic.hpp:696
CoefSequentialFunction m_coef_sequential_function
The function behind m_sequential_function while bound.
Definition Logic.hpp:721
CoefDirectFunction m_coef_direct_function
The function behind m_direct_function while bound.
Definition Logic.hpp:720
std::vector< std::shared_ptr< Node > > m_input_nodes
Nodes feeding the input slots in parallel input mode.
Definition Logic.hpp:714
size_t m_history_size
Maximum size of the history buffer.
Definition Logic.hpp:702
EdgeType m_edge_type
Type of edge to detect.
Definition Logic.hpp:707
Logic(double threshold=0.5)
Constructs a Logic node with threshold quantization.
Definition Logic.cpp:9
double m_threshold
Threshold for boolean conversion.
Definition Logic.hpp:704
double m_high_threshold
High threshold for hysteresis.
Definition Logic.hpp:706
CoefTemporalFunction m_coef_temporal_function
The function behind m_temporal_function while bound.
Definition Logic.hpp:722
std::vector< double > m_coefficients
Coefficient array handed to coefficient-aware functions.
Definition Logic.hpp:718
bool m_coef_bound
True while the active mode runs a coefficient function.
Definition Logic.hpp:723
std::shared_ptr< Node > m_input_node
Input node for processing.
Definition Logic.hpp:713
LogicOperator m_operator
Current logic operator.
Definition Logic.hpp:695
bool m_default_multi_input
True while the parallel function is the built in all-above-threshold one.
Definition Logic.hpp:724
double m_low_threshold
Low threshold for hysteresis.
Definition Logic.hpp:705
MultiInputFunction m_multi_input_function
Function for recursive/feedforward mode.
Definition Logic.hpp:697
CoefMultiInputFunction m_coef_multi_function
The function behind m_multi_input_function while bound.
Definition Logic.hpp:715
LogicMode m_mode
Current processing mode.
Definition Logic.hpp:694
size_t m_input_count
Expected number of inputs for multi-input mode.
Definition Logic.hpp:703
@ SEQUENTIAL
State-based evaluation using history of inputs (sequential logic)
@ DIRECT
Stateless evaluation of current input only (combinational logic)
@ TEMPORAL
Time-dependent evaluation with timing constraints.
@ MULTI_INPUT
Parallel evaluation of multiple input signals.
@ CUSTOM
User-defined boolean function.
CopiedText copy(std::string_view text, const LayoutResult &layout, size_t a, size_t b)
Copy a byte range: the text it spans, and the quads that render it.

References MayaFlux::Nodes::Generator::CUSTOM, MayaFlux::Nodes::Generator::DIRECT, m_coef_bound, m_coef_direct_function, m_coef_multi_function, m_coef_sequential_function, m_coef_temporal_function, m_coefficients, m_default_multi_input, m_direct_function, m_edge_type, m_high_threshold, m_history_size, m_input_count, m_input_node, m_input_nodes, m_low_threshold, m_mode, m_multi_input_function, m_operator, m_sequential_function, m_temporal_function, m_threshold, MayaFlux::Nodes::Generator::MULTI_INPUT, MayaFlux::Nodes::Generator::SEQUENTIAL, and MayaFlux::Nodes::Generator::TEMPORAL.