retdec
module.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_CTYPES_MODULE_H
8 #define RETDEC_CTYPES_MODULE_H
9 
10 #include <memory>
11 #include <string>
12 #include <unordered_map>
13 
14 namespace retdec {
15 namespace ctypes {
16 
17 class Context;
18 class Function;
19 
23 class Module
24 {
25  public:
26  explicit Module(const std::shared_ptr<Context> &context);
27 
28  bool hasFunctionWithName(const std::string &name) const;
29  std::shared_ptr<Function> getFunctionWithName(const std::string &name) const;
30  void addFunction(const std::shared_ptr<Function> &function);
31 
32  std::shared_ptr<Context> getContext() const;
33 
34  private:
36  std::shared_ptr<Context> context;
37 
38  using Functions = std::unordered_map<std::string, std::shared_ptr<Function>>;
41 };
42 
43 } // namespace ctypes
44 } // namespace retdec
45 
46 #endif
Storage for C functions.
Definition: module.h:24
std::shared_ptr< Context > context
Container for all functions and types.
Definition: module.h:36
Functions functions
Container for functions in this module.
Definition: module.h:40
std::shared_ptr< Context > getContext() const
Definition: module.cpp:61
bool hasFunctionWithName(const std::string &name) const
Checks if module contains function.
Definition: module.cpp:26
std::shared_ptr< Function > getFunctionWithName(const std::string &name) const
Returns function from module.
Definition: module.cpp:36
void addFunction(const std::shared_ptr< Function > &function)
Adds new function to module.
Definition: module.cpp:47
Module(const std::shared_ptr< Context > &context)
Constructs a new module.
Definition: module.cpp:20
std::unordered_map< std::string, std::shared_ptr< Function > > Functions
Definition: module.h:38
Definition: archive_wrapper.h:19