ROSE  0.11.145.0
API.h
1 #ifndef ROSE_CodeGen_API_H
2 #define ROSE_CodeGen_API_H
3 
4 #include <Rose/CodeGen/Driver.h>
5 #include <Rose/CodeGen/Object.h>
6 
7 #include <vector>
8 #include <map>
9 #include <string>
10 
11 namespace Rose { namespace CodeGen {
12 
16 template <typename CRT>
17 class API {
18  public:
19  using a_namespace = symbol_t<Object::a_namespace> *;
20  using a_class = symbol_t<Object::a_class> *;
21  using a_typedef = symbol_t<Object::a_typedef> *;
22  using a_variable = symbol_t<Object::a_variable> *;
23  using a_function = symbol_t<Object::a_function> *;
24 
25  void load(Driver & driver);
26  void display(std::ostream & out) const;
27 
28  void add_nodes_for_namequal(Driver & driver, SgSourceFile * srcfile) const;
29 
30  std::set<size_t> const & fids() const { return file_ids; };
31 
32  private: // Static fields provided by user code
33  static std::string const name;
34 
35  // Static fields used to locate and open the header files
36  static std::string const cache;
37  static std::vector<std::string> const paths;
38  static std::vector<std::string> const files;
39  static std::vector<std::string> const flags;
40 
41  // Object maps used to load API elements into the CRT "sub-class" (introspection of sort)
42  static std::map<std::string, a_namespace CRT::* > const namespaces;
43  static std::map<std::string, a_class CRT::* > const classes;
44  static std::map<std::string, a_typedef CRT::* > const typedefs;
45  static std::map<std::string, a_variable CRT::* > const variables;
46  static std::map<std::string, a_function CRT::* > const functions;
47 
48  private:
49  std::set<size_t> file_ids;
50 
51  void set_command_line(Driver & driver) const;
52  void load_headers(Driver & driver);
53  void load_api(Driver & driver);
54 
55  template <typename API>
56  friend struct SymbolScanner;
57 };
58 
59 } }
60 
61 #include "Rose/CodeGen/API.txx"
62 
63 #endif
typename object_helper< otag >::symbol_t symbol_t
The SgSymbol specialization for an Object kind /tparam otag an Object kind.
Definition: Object.h:26
permits to gather types and symbols to extract an API from a set of headers.
Definition: API.h:17
Main namespace for the ROSE library.
facilitates the manipulation of source-files (esp.
Definition: Driver.h:21