Grok  9.7.5
FlowComponent.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2022 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  FlowComponent(void) = default;
23  ~FlowComponent(void) {}
24  FlowComponent* addTo(tf::Taskflow& composition)
25  {
26  composedFlowTask_ = composition.composed_of(flow_);
27  return this;
28  }
30  {
31  composedFlowTask_.precede(successor->composedFlowTask_);
32  return this;
33  }
34  FlowComponent* name(const std::string& name)
35  {
36  composedFlowTask_.name(name);
37  return this;
38  }
39  tf::Task* nextTask()
40  {
41  tasks_.push(flow_.placeholder());
42  return &tasks_.back();
43  }
44 
45  std::queue<tf::Task> tasks_;
46  tf::Taskflow flow_;
48 };
Definition: FlowComponent.h:21
tf::Taskflow flow_
Definition: FlowComponent.h:46
tf::Task composedFlowTask_
Definition: FlowComponent.h:47
FlowComponent(void)=default
FlowComponent * addTo(tf::Taskflow &composition)
Definition: FlowComponent.h:24
std::queue< tf::Task > tasks_
Definition: FlowComponent.h:45
tf::Task * nextTask()
Definition: FlowComponent.h:39
FlowComponent * name(const std::string &name)
Definition: FlowComponent.h:34
~FlowComponent(void)
Definition: FlowComponent.h:23
FlowComponent * precede(FlowComponent *successor)
Definition: FlowComponent.h:29