aboutsummaryrefslogtreecommitdiffstats
path: root/messagebus/src/vespa/messagebus/routing/routedirective.cpp
blob: 20945fa2fe7ef6d41604d94adcef6535bc18cd56 (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
37
38
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "routedirective.h"
#include <vespa/vespalib/util/stringfmt.h>

using vespalib::make_string;

namespace mbus {

RouteDirective::RouteDirective(vespalib::stringref name) :
    _name(name)
{
    // empty
}

RouteDirective::~RouteDirective() = default;

bool
RouteDirective::matches(const IHopDirective &dir) const
{
    if (dir.getType() != TYPE_ROUTE) {
        return false;
    }
    return _name == static_cast<const RouteDirective&>(dir).getName();
}

string
RouteDirective::toString() const
{
    return make_string("route:%s", _name.c_str());
}

string
RouteDirective::toDebugString() const
{
    return make_string("RouteDirective(name = '%s')", _name.c_str());
}

} // mbus