1 /** @file
2 
3   A brief file prefix
4 
5   @section license License
6 
7   Licensed to the Apache Software Foundation (ASF) under one
8   or more contributor license agreements.  See the NOTICE file
9   distributed with this work for additional information
10   regarding copyright ownership.  The ASF licenses this file
11   to you under the Apache License, Version 2.0 (the
12   "License"); you may not use this file except in compliance
13   with the License.  You may obtain a copy of the License at
14 
15       http://www.apache.org/licenses/LICENSE-2.0
16 
17   Unless required by applicable law or agreed to in writing, software
18   distributed under the License is distributed on an "AS IS" BASIS,
19   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20   See the License for the specific language governing permissions and
21   limitations under the License.
22 */
23 
24 /*
25   Please refer to traffic_layout document for the runroot usage
26 */
27 
28 #pragma once
29 
30 #include <string>
31 #include <unordered_map>
32 
33 // name of the directory declared globally
34 const std::string LAYOUT_PREFIX        = "prefix";
35 const std::string LAYOUT_EXEC_PREFIX   = "exec_prefix";
36 const std::string LAYOUT_BINDIR        = "bindir";
37 const std::string LAYOUT_SBINDIR       = "sbindir";
38 const std::string LAYOUT_SYSCONFDIR    = "sysconfdir";
39 const std::string LAYOUT_DATADIR       = "datadir";
40 const std::string LAYOUT_INCLUDEDIR    = "includedir";
41 const std::string LAYOUT_LIBDIR        = "libdir";
42 const std::string LAYOUT_LIBEXECDIR    = "libexecdir";
43 const std::string LAYOUT_LOCALSTATEDIR = "localstatedir";
44 const std::string LAYOUT_RUNTIMEDIR    = "runtimedir";
45 const std::string LAYOUT_LOGDIR        = "logdir";
46 const std::string LAYOUT_MANDIR        = "mandir";
47 const std::string LAYOUT_INFODIR       = "infodir";
48 const std::string LAYOUT_CACHEDIR      = "cachedir";
49 
50 typedef std::unordered_map<std::string, std::string> RunrootMapType;
51 
52 // some checks for directory exist or is it a directory
53 // this is a temporary approach and will be replaced
54 bool exists(const std::string &dir);
55 bool is_directory(const std::string &directory);
56 
57 // argparser_runroot_handler should replace runroot_handler below when all program use ArgParser.
58 void argparser_runroot_handler(std::string const &value, const char *executable, bool json = false);
59 void runroot_handler(const char **argv, bool json = false);
60 
61 // get a map from default layout
62 std::unordered_map<std::string, std::string> runroot_map_default();
63 // get runroot map from yaml path and prefix
64 RunrootMapType runroot_map(const std::string &prefix);
65 
66 // help check runroot for layout
67 RunrootMapType check_runroot();
68 
69 // To get the runroot value
70 std::string_view get_runroot();
71