forked from intel/memory-optimizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOptionParser.h
49 lines (41 loc) · 1.29 KB
/
OptionParser.h
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
/*
* SPDX-License-Identifier: GPL-2.0
*
* Copyright (c) 2018 Intel Corporation
*
* Authors: Fengguang Wu <fengguang.wu@intel.com>
* Yao Yuan <yuan.yao@intel.com>
*/
#ifndef __OPTION_PARSER_H__
#define __OPTION_PARSER_H__
#include <string>
#include <yaml-cpp/yaml.h>
#include "Option.h"
// OptionParser only adds parsing functions.
//
// All data members and accessing functions are in Option,
// for easy access by other classes.
//
class OptionParser: public Option
{
public:
OptionParser();
~OptionParser();
int parse_file(std::string filename);
int reparse();
private:
int parse_option(YAML::Node &&option_node);
int parse_policies(YAML::Node &&policies_node);
void parse_one_policy(YAML::Node &&policy_node);
void parse_common_policy(const YAML::const_iterator& iter, Policy& policy);
void parse_numa_nodes(YAML::Node &numa_nodes);
void parse_one_numa_node(YAML::Node &one_numa_node, NumaHWConfigEntry &one_entry);
template<typename Tval>
int get_value(const YAML::const_iterator &iter,
const char* key_name, Tval &value);
//specialize for YAML::Node as value type
int get_value(const YAML::const_iterator &iter,
const char* key_name, YAML::Node &value);
};
#endif
// vim:set ts=2 sw=2 et: