44using namespace std::literals::chrono_literals;
45using std::this_thread::sleep_for;
55 const std::size_t n_of_batches = 2;
56 const std::size_t evts_in_batch = 5;
59 app->initialize().ignore();
68 app->start().ignore();
77 std::queue<EventContext> ready;
79 std::size_t evt_count = 0;
82 for ( std::size_t batch = 1; batch <= n_of_batches; ++batch ) {
86 log <<
MSG::INFO <<
" (pretend we need time so that the processing thread drains the input queue)"
89 log <<
MSG::INFO <<
" (all events in the queue should have been processed by now)" <<
endmsg;
91 for ( std::size_t i = 0; i < evts_in_batch; ++i ) {
93 auto ctx = qep->createEventContext();
96 ready.push( std::move( ctx ) );
101 while ( !ready.empty() ) {
103 log <<
MSG::INFO <<
"- pushing event " << evt_count <<
" (" << ready.front() <<
")..." <<
endmsg;
104 qep->push( std::move( ready.front() ) );
110 if (
auto result = qep->pop() ) {
112 auto&& [sc, ctx] = std::move( *result );
117 log <<
MSG::INFO <<
"no more inputs: let's drain the output queue" <<
endmsg;
118 while ( !qep->empty() ) {
119 if (
auto result = qep->pop() ) {
120 auto&& [sc, ctx] = std::move( *result );
132 app->stop().ignore();
133 app->finalize().ignore();
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
#define DECLARE_COMPONENT(type)
Gaudi application entry point.
Application(Options opts)
Construct and configure the application from the provided options.
SmartIF< IStateful > app
Handle to the ApplicationMgr instance.
The IMessage is the interface implemented by the message service.
The IProperty is the basic interface for all components which have properties that can be set or get.
Definition of the MsgStream class used to transmit messages.
Small smart pointer class with automatic reference counting for IInterface.
int getAppReturnCode(const SmartIF< IProperty > &appmgr)
Get the application (current) return code.