HAL  v4.5.0-257-ge24279b4e
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
data_container.h
Go to the documentation of this file.
1 // MIT License
2 //
3 // Copyright (c) 2019 Ruhr University Bochum, Chair for Embedded Security. All Rights reserved.
4 // Copyright (c) 2019 Marc Fyrbiak, Sebastian Wallat, Max Hoffmann ("ORIGINAL AUTHORS"). All rights reserved.
5 // Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved.
6 // Copyright (c) 2021 Jörn Langheinrich, Julian Speith, Nils Albartus, René Walendy, Simon Klix ("ORIGINAL AUTHORS"). All Rights reserved.
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in all
16 // copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 // SOFTWARE.
25 
26 #pragma once
27 
28 #include "hal_core/defines.h"
31 
32 #include <map>
33 #include <string>
34 #include <tuple>
35 #include <unordered_map>
36 #include <vector>
37 
38 namespace hal
39 {
46  {
47  public:
51  DataContainer() = default;
52 
53  virtual ~DataContainer() = default;
54 
61  bool operator==(const DataContainer& other) const;
62 
69  bool operator!=(const DataContainer& other) const;
70 
82  bool set_data(const std::string& category, const std::string& key, const std::string& data_type, const std::string& value, const bool log_with_info_level = false);
83 
91  bool has_data(const std::string& category, const std::string& key) const;
92 
100  std::tuple<std::string, std::string> get_data(const std::string& category, const std::string& key) const;
101 
110  bool delete_data(const std::string& category, const std::string& key, const bool log_with_info_level = false);
111 
117  const std::map<std::tuple<std::string, std::string>, std::tuple<std::string, std::string>>& get_data_map() const;
118 
124  void set_data_map(const std::map<std::tuple<std::string, std::string>, std::tuple<std::string, std::string>>& map);
125 
134  Result<std::monostate> set_parameter(const Parameter& param, const std::string& value);
135 
142  Result<std::string> get_parameter_value(const std::string& name) const;
143 
150  Result<std::string> get_parameter_value(const Parameter& name) const;
151 
158  Result<Parameter> get_parameter_declaration(const std::string& name) const;
159 
166  bool has_parameter(const Parameter& param) const;
167 
174  bool has_parameter(const std::string& name) const;
175 
182  bool delete_parameter(const std::string& name);
183 
189  const std::unordered_map<std::string, std::pair<Parameter, std::string>>& get_parameters() const;
190 
191  protected:
192  std::map<std::tuple<std::string, std::string>, std::tuple<std::string, std::string>> m_data;
193  std::unordered_map<std::string, std::pair<Parameter, std::string>> m_parameters;
194  };
195 } // namespace hal
#define NETLIST_API
Definition: arch_linux.h:30
DataContainer()=default
std::map< std::tuple< std::string, std::string >, std::tuple< std::string, std::string > > m_data
std::unordered_map< std::string, std::pair< Parameter, std::string > > m_parameters
virtual ~DataContainer()=default
Definition: defines.h:45
std::string name