YPC
0.2.0
include
hpda
common
processor_with_input.h
1
#pragma once
2
#include <hpda/common/common.h>
3
#include <hpda/common/processor_with_output.h>
4
#include <
hpda/engine/engine.h
>
5
#include <hpda/engine/functor.h>
6
7
namespace
hpda {
8
namespace
internal {
9
template
<
typename
InputObjType>
10
class
processor_with_input
:
virtual
public
functor
{
11
public
:
12
typedef
InputObjType input_type;
13
14
processor_with_input
(
processor_with_output<InputObjType>
*input)
15
:
functor
(), m_upper_stream(input) {
16
functor::set_engine(input->get_engine());
17
add_predecessor(input);
18
};
19
20
virtual
~
processor_with_input
() {}
21
22
// virtual bool next_input() {
23
// try {
24
// return m_upper_stream->next_output();
25
//} catch (std::exception &e) {
26
// return false;
27
//}
28
//}
29
30
InputObjType input_value()
const
{
return
m_upper_stream->output_value(); }
31
32
inline
bool
has_input_value()
const
{
return
m_upper_stream->has_value(); }
33
34
inline
void
consume_input_value() { m_upper_stream->reset_done_value(); }
35
36
inline
void
change_upper_stream(
processor_with_output<InputObjType>
*input) {
37
m_upper_stream = input;
38
}
39
40
protected
:
41
internal::processor_with_output<InputObjType>
*m_upper_stream;
42
};
43
44
}
// namespace internal
45
template
<
typename
... ARGS>
46
using
processor_with_input
=
internal::processor_with_input
<ntobject<ARGS...>>;
47
template
<
typename
T>
48
using
processor_with_input_t
=
internal::processor_with_input<T>
;
49
}
// namespace hpda
hpda::internal::processor_with_input
Definition:
processor_with_input.h:10
engine.h
A class to represent the computing task.
hpda::internal::processor_with_output< InputObjType >
hpda::functor
Definition:
functor.h:7
Generated by
1.8.17