aboutsummaryrefslogtreecommitdiffstats
path: root/messagebus/src/vespa/messagebus/protocolset.cpp
blob: e360de86656cbbd3cadedb833b1e52812d6713e7 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "protocolset.h"

namespace mbus {

ProtocolSet::ProtocolSet()
    : _vector()
{ }

ProtocolSet &
ProtocolSet::add(IProtocol::SP protocol)
{
    _vector.push_back(protocol);
    return *this;
}

bool
ProtocolSet::empty() const
{
    return _vector.empty();
}

IProtocol::SP
ProtocolSet::extract()
{
    if (_vector.empty()) {
        return IProtocol::SP();
    }
    IProtocol::SP ret = _vector.back();
    _vector.pop_back();
    return ret;
}

} // namespace mbus