Add a virtual method on `RunIn` to execute some code in the context of
a message iterator's `next` method.
Change-Id: I6f8ca7a9596fd998f07c401c1859177c728a0b53
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11834
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
+void RunIn::onMsgIterNext(bt2::SelfMessageIterator, bt2::ConstMessageArray&)
+{
+}
+
namespace {
class RunInSource;
namespace {
class RunInSource;
explicit RunInSourceMsgIter(const bt2::SelfMessageIterator self,
bt2::SelfMessageIteratorConfiguration,
const bt2::SelfComponentOutputPort port) :
explicit RunInSourceMsgIter(const bt2::SelfMessageIterator self,
bt2::SelfMessageIteratorConfiguration,
const bt2::SelfComponentOutputPort port) :
- bt2::UserMessageIterator<RunInSourceMsgIter, RunInSource> {self, "RUN-IN-SRC-MSG-ITER"}
+ bt2::UserMessageIterator<RunInSourceMsgIter, RunInSource> {self, "RUN-IN-SRC-MSG-ITER"},
+ _mRunIn {&port.data<RunIn>()}, _mSelf {self}
- port.data<RunIn>().onMsgIterInit(self);
+ _mRunIn->onMsgIterInit(self);
- void _next(bt2::ConstMessageArray&)
+ void _next(bt2::ConstMessageArray& msgs)
+ _mRunIn->onMsgIterNext(_mSelf, msgs);
+
+private:
+ RunIn *_mRunIn;
+ bt2::SelfMessageIterator _mSelf;
};
class RunInSource final :
};
class RunInSource final :
* Called when initializing the message iterator `self`.
*/
virtual void onMsgIterInit(bt2::SelfMessageIterator self);
* Called when initializing the message iterator `self`.
*/
virtual void onMsgIterInit(bt2::SelfMessageIterator self);
+
+ /*
+ * Called within the "next" method of `self` to return the messages
+ * `msgs`.
+ */
+ virtual void onMsgIterNext(bt2::SelfMessageIterator self, bt2::ConstMessageArray& msgs);