ROSE 0.11.145.247
Factory.h
1#ifndef ROSE_CodeGen_Factory_H
2#define ROSE_CodeGen_Factory_H
3
4#include <Rose/CodeGen/API.h>
5
6namespace Rose { namespace CodeGen {
7
17template <typename CRT, typename API>
18class Factory;
19
28template <typename CRT, typename apiT, Object otag>
30
31using tplargs_t = std::vector<SgTemplateArgument *>;
32
33template <typename CRT, typename API>
34class Factory {
35 public:
37
38 public:
39 Driver & driver;
40 API api;
41
42 public:
43 Factory(Driver & driver_);
44
58 template <Object otag, typename... Args>
59 declaration_t<otag> * instantiate(symbol_t<otag> * API::* obj, SgNamedType * parent, Args... args) const;
60
74 template <Object otag, typename... Args>
75 reference_t<otag> * reference(symbol_t<otag> * API::* obj, SgNamedType * parent, Args... args) const;
76
90 template <Object otag, typename... Args>
91 SgExpression * access(symbol_t<otag> * API::* obj, SgExpression * parent, Args... args) const;
92
93
94 protected:
101 template <Object otag>
102 using access_return_t = std::conditional_t<otag == Object::a_class || otag == Object::a_typedef, SgType, SgExpression>;
103
104 template <Object otag, std::enable_if_t<otag == Object::a_class || otag == Object::a_typedef> * = nullptr>
105 static SgScopedType * build_scoped_ref(SgNamedType * lhs, reference_t<otag> * rhs);
106
107 template <Object otag, std::enable_if_t<otag != Object::a_class && otag != Object::a_typedef> * = nullptr>
108 static SgScopedRefExp * build_scoped_ref(SgNamedType * lhs, reference_t<otag> * rhs);
109
110 public:
122 template <Object otag, typename... Args>
123 access_return_t<otag> * access(symbol_t<otag> * API::* obj, SgNamedType * parent, Args... args) const;
124};
125
126} }
127
128#include "Rose/CodeGen/factory/factory.txx"
129#include "Rose/CodeGen/factory/namespaces.txx"
130#include "Rose/CodeGen/factory/classes.txx"
131#include "Rose/CodeGen/factory/typedefs.txx"
132#include "Rose/CodeGen/factory/variables.txx"
133#include "Rose/CodeGen/factory/functions.txx"
134
135#endif
permits to gather types and symbols to extract an API from a set of headers.
Definition API.h:17
facilitates the manipulation of source-files (esp.
Definition Driver.h:22
constructs expressions and types for the given API
Definition Factory.h:34
reference_t< otag > * reference(symbol_t< otag > *API::*obj, SgNamedType *parent, Args... args) const
Return an expression or type referencing the object.
std::conditional_t< otag==Object::a_class||otag==Object::a_typedef, SgType, SgExpression > access_return_t
Select return type for access based on Object type.
Definition Factory.h:102
declaration_t< otag > * instantiate(symbol_t< otag > *API::*obj, SgNamedType *parent, Args... args) const
Return an instantiation.
access_return_t< otag > * access(symbol_t< otag > *API::*obj, SgNamedType *parent, Args... args) const
Build expression or type to access static member and subtype of the parent type.
SgExpression * access(symbol_t< otag > *API::*obj, SgExpression *parent, Args... args) const
Build expression to access a member of the parent expression.
This class represents the notion of an expression. Expressions are derived from SgLocatedNodes,...
typename object_helper< otag >::symbol_t symbol_t
The SgSymbol specialization for an Object kind /tparam otag an Object kind.
Definition Object.h:27
typename object_helper< otag >::decl_t declaration_t
The SgDeclarationStatement specialization for an Object kind /tparam otag an Object kind.
Definition Object.h:39
typename object_helper< otag >::ref_t reference_t
The SgReference specialization for an Object kind /tparam otag an Object kind.
Definition Object.h:33
Object
The five kind of objects manipulated by Rose::CodeGen::API and associated Rose::CodeGen::Factory.
Definition Object.h:12
The ROSE library.
enables partial specializations w.r.t the template parameter otag
Definition Factory.h:29