HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
plugin_gui_extension_demo.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 
30 #include "hal_core/defines.h"
32 #include <vector>
33 #include <unordered_set>
34 #include <unordered_map>
35 #include <string>
36 
37 namespace hal
38 {
39  class GuiExtensionPythonBase;
40 
45  {
46  std::unordered_map<std::string,GuiExtensionPythonBase*> m_python_plugins;
47  std::vector<ContextMenuContribution> m_module_context_contribution;
48  std::vector<ContextMenuContribution> m_gate_context_contribution;
49  std::vector<ContextMenuContribution> m_net_context_contribution;
50  std::vector<PluginParameter> m_parameter;
51 
52  public:
55 
56  std::vector<ContextMenuContribution> get_context_contribution(const Netlist* nl,
57  const std::vector<u32>& mods,
58  const std::vector<u32>& gats,
59  const std::vector<u32>& nets) override;
60 
61  void execute_function(std::string tag,
62  Netlist* nl,
63  const std::vector<u32>& mods,
64  const std::vector<u32>& gats,
65  const std::vector<u32>& nets) override;
66 
67  std::vector<PluginParameter> get_parameter() const override;
68 
69  void set_parameter(const std::vector<PluginParameter>& params) override;
70 
71  void add_module_context(GuiExtensionPythonBase* plug, const std::string tagname, const std::string label);
72 
73  void add_gate_context(GuiExtensionPythonBase* plug, const std::string tagname, const std::string label);
74 
75  void add_net_context(GuiExtensionPythonBase* plug, const std::string tagname, const std::string label);
76 
77  void add_main_menu(GuiExtensionPythonBase* plug, const std::vector<PluginParameter>& params);
78 
79  void clear();
80 
82  };
83 
90  {
91  friend class GuiExtensionPythonBase;
92  public:
94 
95  std::string get_name() const override;
96  std::string get_version() const override;
97  std::string get_description() const override;
98 
99  void initialize() override;
100 
101  };
102 } // namespace hal
#define PLUGIN_API
Definition: arch_linux.h:32
void add_net_context(GuiExtensionPythonBase *plug, const std::string tagname, const std::string label)
void add_gate_context(GuiExtensionPythonBase *plug, const std::string tagname, const std::string label)
std::vector< PluginParameter > get_parameter() const override
static GuiExtensionContext * sInstance
void add_module_context(GuiExtensionPythonBase *plug, const std::string tagname, const std::string label)
void execute_function(std::string tag, Netlist *nl, const std::vector< u32 > &mods, const std::vector< u32 > &gats, const std::vector< u32 > &nets) override
void set_parameter(const std::vector< PluginParameter > &params) override
void add_main_menu(GuiExtensionPythonBase *plug, const std::vector< PluginParameter > &params)
std::vector< ContextMenuContribution > get_context_contribution(const Netlist *nl, const std::vector< u32 > &mods, const std::vector< u32 > &gats, const std::vector< u32 > &nets) override
Definition: defines.h:45
void initialize()
Definition: event_log.cpp:302