blob: 9b07b32570accf63489e5c69c6eabf24dac6c7f8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "callstack.h"
#include "message.h"
#include "reply.h"
#include "idiscardhandler.h"
#include <cassert>
namespace mbus {
void
CallStack::discard()
{
while (!_stack.empty()) {
const Frame &frame = _stack.back();
if (frame.discardHandler != nullptr) {
frame.discardHandler->handleDiscard(frame.ctx);
}
_stack.pop_back();
}
}
CallStack::~CallStack() = default;
IReplyHandler &
CallStack::pop(Reply &reply)
{
assert(!_stack.empty());
const Frame &frame = _stack.back();
IReplyHandler *handler = frame.replyHandler;
reply.setContext(frame.ctx);
_stack.pop_back();
return *handler;
}
} // namespace mbus
|