Commit e1deba5b by Marcus Winter

dataflow_cpp: added operator to directly connect output 0 to input 0

parent fde3ae66
......@@ -68,6 +68,11 @@ class ConstantSource
typename TypeAt<typename OutputsType::Types, Index>::Result & GetOutput() {
return outputs_.template Get<Index>();
}
template <typename T>
void operator >> (T & target) {
GetOutput<0>() >> target.GetInput<0>();
}
};
} // namespace internal
......
......@@ -98,6 +98,11 @@ class Process< Slices, Serial, Inputs<Slices, I1, I2, I3, I4, I5>,
return outputs_.template Get<Index>();
}
template <typename T>
void operator >> (T & target) {
GetOutput<0>() >> target.GetInput<0>();
}
virtual void OnClock(int clock) {
const int idx = clock % Slices;
if (!inputs_.AreAtClock(clock))
......
......@@ -99,6 +99,11 @@ class Select
return outputs_.template Get<Index>();
}
template <typename T>
void operator >> (T & target) {
GetOutput<0>() >> target.GetInput<0>();
}
virtual void OnClock(int clock) {
//const int idx = clock % Slices;
if (!inputs_.AreAtClock(clock))
......
......@@ -81,6 +81,11 @@ class Source< Slices, Outputs<Slices, O1, O2, O3, O4, O5> >
return outputs_.template Get<Index>();
}
template <typename T>
void operator >> (T & target) {
GetOutput<0>() >> target.GetInput<0>();
}
private:
OutputsType outputs_;
ExecutorType executor_;
......
......@@ -96,6 +96,11 @@ class Switch
return outputs_.template Get<Index>();
}
template <typename T>
void operator >> (T & target) {
GetOutput<0>() >> target.GetInput<0>();
}
virtual void OnClock(int clock) {
//const int idx = clock % Slices;
if (!inputs_.AreAtClock(clock))
......
......@@ -235,6 +235,14 @@ class Network {
*/
template <int Index>
typename OutputsType::Types<Index>::Result & GetOutput();
/**
* Connects output port 0 to input port 0 of \c target.
* \param target Process to connect to.
* \tparam T Type of target process.
*/
template <typename T>
void operator >> (T & target);
};
/**
......@@ -315,6 +323,14 @@ class Network {
*/
template <int Index>
typename OutputsType::Types<Index>::Result & GetOutput();
/**
* Connects output port 0 to input port 0 of \c target.
* \param target Process to connect to.
* \tparam T Type of target process.
*/
template <typename T>
void operator >> (T & target);
};
/**
......@@ -385,6 +401,14 @@ class Network {
*/
template <int Index>
typename OutputsType::Types<Index>::Result & GetOutput();
/**
* Connects output port 0 to input port 0 of \c target.
* \param target Process to connect to.
* \tparam T Type of target process.
*/
template <typename T>
void operator >> (T & target);
};
/**
......@@ -455,6 +479,14 @@ class Network {
*/
template <int Index>
typename OutputsType::Types<Index>::Result & GetOutput();
/**
* Connects output port 0 to input port 0 of \c target.
* \param target Process to connect to.
* \tparam T Type of target process.
*/
template <typename T>
void operator >> (T & target);
};
/**
......@@ -588,6 +620,14 @@ class Network {
*/
template <int Index>
typename OutputsType::Types<Index>::Result & GetOutput();
/**
* Connects output port 0 to input port 0 of \c target.
* \param target Process to connect to.
* \tparam T Type of target process.
*/
template <typename T>
void operator >> (T & target);
};
/**
......@@ -639,6 +679,14 @@ class Network {
*/
template <int Index>
typename OutputsType::Types<Index>::Result & GetOutput();
/**
* Connects output port 0 to input port 0 of \c target.
* \param target Process to connect to.
* \tparam T Type of target process.
*/
template <typename T>
void operator >> (T & target);
};
/**
......
read.GetOutput<0>() >> replace.GetInput<0>();
replace.GetOutput<0>() >> write.GetInput<0>();
read >> replace;
replace >> write;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment