aboutsummaryrefslogtreecommitdiffstats
path: root/messagebus/src/vespa/messagebus/routing/policydirective.h
blob: 4237d3caab780b2e8a312d4e70e36fe90369d165 (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
43
44
45
46
47
48
49
50
51
52
// Copyright Yahoo. 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 policy directive within a {@link Hop}'s selector. This means to create the named protocol
 * using the given parameter string, and the running that protocol within the context of this directive.
 *
 * @author Simon Thoresen Hult
 * @version $Id$
 */
class PolicyDirective : public IHopDirective {
private:
    string _name;
    string _param;

public:

    /**
     * Constructs a new policy selector item.
     *
     * @param name  The name of the policy to invoke.
     * @param param The parameter to pass to the name constructor.
     */
    PolicyDirective(vespalib::stringref name, vespalib::stringref param);
    ~PolicyDirective();

    /**
     * Returns the name of the policy that this item is to invoke.
     *
     * @return The name name.
     */
    const string &getName() const { return _name; }

    /**
     * Returns the parameter string for this policy directive.
     *
     * @return The parameter.
     */
    const string &getParam() const { return _param; }

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

} // mbus