aboutsummaryrefslogtreecommitdiffstats
path: root/messagebus/src/vespa/messagebus/routing/verbatimdirective.h
blob: 66b1a22c759168fb5f70f56a6c32de22684ab4ce (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
39
40
41
42
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "ihopdirective.h"

namespace mbus {

/**
 * This class represents a verbatim match within a {@link Hop}'s selector. This is nothing more than a string that will
 * be used as-is when performing service name lookups.
 *
 * @author Simon Thoresen Hult
 * @version $Id$
 */
class VerbatimDirective : public IHopDirective {
private:
    string _image;

public:
    /**
     * Constructs a new verbatim selector item for a given image.
     *
     * @param image The image to assign to this.
     */
    VerbatimDirective(vespalib::stringref image);
    ~VerbatimDirective() override;

    /**
     * Returns the image to which this is a verbatim match.
     *
     * @return The image.
     */
    const string &getImage() const { return _image; }

    Type getType() const override { return TYPE_VERBATIM; }
    bool matches(const IHopDirective &dir) const override;
    string toString() const override;
    string toDebugString() const override;
};

} // mbus