blob: d9991415d102a550e862303e44b665d61d5bb077 (
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/messagebus/common.h>
#include <memory>
namespace mbus {
/**
* This class is the base class for the primitives that make up a {@link Hop}'s selector.
*
* @author Simon Thoresen Hult
* @version $Id$
*/
class IHopDirective {
public:
/**
* Defines the various polymorphic variants of a hop directive.
*/
enum Type {
TYPE_ERROR,
TYPE_POLICY,
TYPE_ROUTE,
TYPE_TCP,
TYPE_VERBATIM
};
/**
* Convenience typedefs.
*/
using UP = std::unique_ptr<IHopDirective>;
using SP = std::shared_ptr<IHopDirective>;
/**
* Implements a virtual destructor to allow virtual methods.
*/
virtual ~IHopDirective() {
// empty
}
/**
* Returns the type of directive that this is.
*
* @return The type.
*/
virtual Type getType() const = 0;
/**
* Returns true if this directive matches another.
*
* @param dir The directive to compare this to.
* @return True if this matches the argument.
*/
virtual bool matches(const IHopDirective &dir) const = 0;
/**
* Returns a string representation of this that can be parsed.
*
* @return The string.
*/
virtual string toString() const = 0;
/**
* Returns a string representation of this that can be debugged but not parsed.
*
* @return The debug string.
*/
virtual string toDebugString() const = 0;
};
} // mbus
|