Grok 12.0.1
FlowComponent.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2024 Grok Image Compression Inc.
3 *
4 * This source code is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Affero General Public License, version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This source code is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Affero General Public License for more details.
12 *
13 * You should have received a copy of the GNU Affero General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18#pragma once
19
21{
22 public:
23 FlowComponent* addTo(tf::Taskflow& composition)
24 {
25 compositionTask_ = composition.composed_of(componentFlow_);
26 return this;
27 }
29 {
30 return precede(&successor);
31 }
33 {
34 assert(successor);
35 compositionTask_.precede(successor->compositionTask_);
36 return this;
37 }
38 FlowComponent* name(const std::string& name)
39 {
41 return this;
42 }
43 tf::Task& nextTask()
44 {
45 componentTasks_.push(componentFlow_.placeholder());
46 return componentTasks_.back();
47 }
48
49 private:
50 std::queue<tf::Task> componentTasks_;
51 tf::Taskflow componentFlow_;
53};
Definition FlowComponent.h:21
tf::Taskflow componentFlow_
Definition FlowComponent.h:51
FlowComponent * precede(FlowComponent *successor)
Definition FlowComponent.h:32
tf::Task & nextTask()
Definition FlowComponent.h:43
FlowComponent * precede(FlowComponent &successor)
Definition FlowComponent.h:28
tf::Task compositionTask_
Definition FlowComponent.h:52
std::queue< tf::Task > componentTasks_
Definition FlowComponent.h:50
FlowComponent * addTo(tf::Taskflow &composition)
Definition FlowComponent.h:23
FlowComponent * name(const std::string &name)
Definition FlowComponent.h:38