aboutsummaryrefslogtreecommitdiffstats
path: root/vespaclient/src/vespa/vespaclient/vesparoute/params.h
blob: b16ac40212b99f9f981e9fd0ca88d5d8b4e8ce2c (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <string>
#include <vector>
#include <vespa/messagebus/network/rpcnetworkparams.h>

namespace vesparoute {

/**
 * All parameters for application is contained in this class to simplify the api for parsing them.
 */
class Params {
public:
    /** Constructs a new parameter object. */
    Params();

    /** Destructor. Frees any allocated resources. */
    virtual ~Params();

    /** Returns the rpc network params object. */
    mbus::RPCNetworkParams &getRPCNetworkParams() { return _rpcParams; }

    /** Returns a const reference to the rpc network params object. */
    const mbus::RPCNetworkParams &getRPCNetworkParams() const { return _rpcParams; }

    /** Returns the list of hops to print. */
    std::vector<std::string> &getHops() { return _hops; }

    /** Returns a const reference to the list of hops to print. */
    const std::vector<std::string> &getHops() const { return _hops; }

    /** Returns the list of routes to print. */
    std::vector<std::string> &getRoutes() { return _routes; }

    /** Returns a const reference the list of routes to print. */
    const std::vector<std::string> &getRoutes() const { return _routes; }

    /** Sets the config id to use for document types. */
    void
    setDocumentTypesConfigId(const std::string &configId)
    {
        _documentTypesConfigId = configId;
    }

    /** Returns the config id to use for the document manager. */
    const std::string &
    getDocumentTypesConfigId()
    {
        return _documentTypesConfigId;
    }

    /** Sets the config id to use for routing. */
    void setRoutingConfigId(const std::string &configId) { _routingConfigId = configId; }

    /** Returns the config id to use for routing. */
    const std::string &getRoutingConfigId() { return _routingConfigId; }

    /** Sets the name of the protocol whose routing table to use. */
    void setProtocol(const std::string &protocol) { _protocol = protocol; }

    /** Returns the name of the protocol whose routing table to use. */
    const std::string &getProtocol() const { return _protocol; }

    /** Sets wether or not to print all hops. */
    void setListHops(bool lst) { _lstHops = lst; }

    /** Returns wether or not to print all hops. */
    bool getListHops() const { return _lstHops; }

    /** Sets wether or not to print all routes. */
    void setListRoutes(bool lst) { _lstRoutes = lst; }

    /** Returns wether or not to print all routes. */
    bool getListRoutes() const { return _lstRoutes; }

    /** Sets wether or not to print all services. */
    void setListServices(bool lst) { _lstServices = lst; }

    /** Returns wether or not to print all services. */
    bool getListServices() const { return _lstServices; }

    /** Sets wether or not to print the full routing table content. */
    void setDump(bool dump) { _dump = dump; }

    /** Returns wether or not to print the full routing table content. */
    bool getDump() const { return _dump; }

    /** Sets wether or not to verify service names. */
    void setVerify(bool verify) { _verify = verify; }

    /** Returns wether or not to verify service names. */
    bool getVerify() const { return _verify; }

    const std::string & getSlobrokConfigId() const { return _slobrokConfigId; }
    void setSlobrokId(const std::string & id) { _slobrokConfigId = id; }

private:
    mbus::RPCNetworkParams   _rpcParams;
    std::vector<std::string> _hops;
    std::vector<std::string> _routes;
    std::string              _documentTypesConfigId;
    std::string              _routingConfigId;
    std::string              _protocol;
    std::string              _slobrokConfigId;
    bool                     _lstHops;
    bool                     _lstRoutes;
    bool                     _lstServices;
    bool                     _dump;
    bool                     _verify;
};

}