ROSE  0.11.98.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  std::set<size_t> const & fids() const { return file_ids; };
29 
30  private: // Static fields provided by user code
31  static std::string const name;
32 
33  // Static fields used to locate and open the header files
34  static std::string const cache;
35  static std::vector<std::string> const paths;
36  static std::vector<std::string> const files;
37  static std::vector<std::string> const flags;
38 
39  // Object maps used to load API elements into the CRT "sub-class" (introspection of sort)
40  static std::map<std::string, a_namespace CRT::* > const namespaces;
41  static std::map<std::string, a_class CRT::* > const classes;
42  static std::map<std::string, a_typedef CRT::* > const typedefs;
43  static std::map<std::string, a_variable CRT::* > const variables;
44  static std::map<std::string, a_function CRT::* > const functions;
45 
46  private:
47  std::set<size_t> file_ids;
48 
49  void set_command_line(Driver & driver) const;
50  void load_headers(Driver & driver);
51  void load_api(Driver & driver);
52 
53  template <typename API>
54  friend struct SymbolScanner;
55 };
56 
57 } }
58 
59 #include "Rose/CodeGen/API.txx"
60 
61 #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