pflib v3.0.0-rc1-25-gb91774e
Pretty Fine HGCROC Interaction Library
All Classes Namespaces Files Functions Variables Typedefs Pages
Compile.h
Go to the documentation of this file.
1
7#ifndef PFLIB_COMPILE_H
8#define PFLIB_COMPILE_H
9
10#include <map>
11#include <string>
12#include <vector>
13#include <stdint.h>
14
16
17namespace YAML {
18class Node;
19}
20
21namespace pflib {
22
39int str_to_int(std::string str);
40
45
57class Compiler {
58 public:
62 static Compiler get(const std::string& roc_type_version);
63
96 void compile(const std::string& page, const std::string& param, const int& val,
97 std::map<int,std::map<int,uint8_t>>& registers);
98
110 compile(const std::string& page_name, const std::string& param_name, const int& val);
111
140
165 decompile(const std::map<int,std::map<int,uint8_t>>& compiled_config, bool be_careful);
166
182
192
231 void extract(const std::vector<std::string>& setting_files,
233
245 compile(const std::vector<std::string>& setting_files, bool prepend_defaults = true);
246
258 compile(const std::string& setting_file, bool prepend_defaults = true);
259
260 private:
265 Compiler(const ParameterLUT& parameter_lut, const PageLUT& page_lut);
266
277 void extract(YAML::Node params, std::map<std::string,std::map<std::string,int>>& settings);
278
279 private:
280 const ParameterLUT& parameter_lut_;
281 const PageLUT& page_lut_;
282};
283} // namespace pflib
284
285#endif
A non-copyable mapping.
Definition register_maps_types.h:91
The object that does the compiling.
Definition Compile.h:57
std::map< std::string, std::map< std::string, int > > decompile(const std::map< int, std::map< int, uint8_t > > &compiled_config, bool be_careful)
unpack register values into the page names, parameter names and parameter values mapping
Definition Compile.cxx:121
Compiler(const ParameterLUT &parameter_lut, const PageLUT &page_lut)
Private constructor, only access Compiler instances from the static get method so that we can ensure ...
Definition Compile.cxx:50
std::map< std::string, std::map< std::string, int > > defaults()
get the default parameter values as specified in the manual
Definition Compile.cxx:186
static Compiler get(const std::string &roc_type_version)
Get an instance of the compiler for the input HGCROC type_version string.
Definition Compile.cxx:42
void compile(const std::string &page, const std::string &param, const int &val, std::map< int, std::map< int, uint8_t > > &registers)
Overlay a single parameter onto the input register map.
Definition Compile.cxx:53
void extract(const std::vector< std::string > &setting_files, std::map< std::string, std::map< std::string, int > > &settings)
Extract the page name, parameter name, and parameter values from the YAML files into the passed setti...
Definition Compile.cxx:197
std::vector< std::string > parameters(const std::string &page)
get the parameter names for the input page-type
Definition Compile.cxx:169
This version of the fast control code interfaces with the CMS Fast control library which can be contr...
Definition Backend.cxx:3
int str_to_int(std::string str)
Get an integer from the input string.
Definition Compile.cxx:13
std::string upper_cp(const std::string &str)
Get a copy of the input string with all caps.
Definition Compile.cxx:34
Header defining types stored within the parameter to register mappings.