ROSE  0.11.83.1
API.h
1 
2 #ifndef Rose_CodeGen_API_h
3 #define Rose_CodeGen_API_h
4 
5 #include "Rose/CodeGen/Driver.h"
6 #include "Rose/CodeGen/Object.h"
7 
8 #include <vector>
9 #include <map>
10 #include <string>
11 
12 namespace Rose { namespace CodeGen {
13 
17 template <typename CRT>
18 class API {
19  public:
20  using a_namespace = symbol_t<Object::a_namespace> *;
21  using a_class = symbol_t<Object::a_class> *;
22  using a_typedef = symbol_t<Object::a_typedef> *;
23  using a_variable = symbol_t<Object::a_variable> *;
24  using a_function = symbol_t<Object::a_function> *;
25 
26  void load(Driver & driver);
27 
28  void add_nodes_for_namequal(Driver & driver, SgSourceFile * srcfile) const;
29 
30  void display(std::ostream & out) const;
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 build_command_line(std::vector<std::string> & cmdline) 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 /* Rose_CodeGen_API_h */
64 
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:18
Main namespace for the ROSE library.
facilitates the manipulation of source-files (esp.
Definition: Driver.h:22