1
// This file is part of the AspectC++ compiler 'ac++'.
2
// Copyright (C) 1999-2003 The 'ac++' developers (see aspectc.org)
4
// This program is free software; you can redistribute it and/or
5
// modify it under the terms of the GNU General Public License as
6
// published by the Free Software Foundation; either version 2 of
7
// the License, or (at your option) any later version.
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
14
// You should have received a copy of the GNU General Public
15
// License along with this program; if not, write to the Free
16
// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19
#ifndef __TUnitModelElementFactory_h__
20
#define __TUnitModelElementFactory_h__
22
#include "ModelElementFactory.h"
23
#include "JoinPointLoc.h"
24
#include "TransformInfo.h"
26
/* helper classes to merge the TI_ classes into the JPL_ classes, i.e. to
27
* extend the join point model elements by transformation infos
30
class TU_Type : public JPL_Type, public TI_Type {
32
TU_Type (const string &s) : JPL_Type (s) { transform_info (this); }
33
~TU_Type () { transform_info (0); }
34
virtual JoinPointLoc &jpl () { return *this; }
37
class TU_Namespace : public JPL_Namespace, public TI_Namespace {
39
TU_Namespace (const string &s) : JPL_Namespace (s) { transform_info (this); }
40
~TU_Namespace () { transform_info (0); }
41
virtual JoinPointLoc &jpl () { return *this; }
44
class TU_Class : public JPL_Class, public TI_Class {
46
TU_Class (const string &s) : JPL_Class (s) { transform_info (this); }
47
~TU_Class () { transform_info (0); }
48
virtual JoinPointLoc &jpl () { return *this; }
51
class TU_Aspect : public JPL_Aspect, public TI_Aspect {
53
TU_Aspect (const string &s) : JPL_Aspect (s) { transform_info (this); }
54
~TU_Aspect () { transform_info (0); }
55
virtual JoinPointLoc &jpl () { return *this; }
58
class TU_Function : public JPL_Function, public TI_Function {
60
TU_Function (const string &n, const string &s) : JPL_Function (n, s) { transform_info (this); }
61
~TU_Function () { transform_info (0); }
62
virtual JoinPointLoc &jpl () { return *this; }
65
class TU_AdviceCode : public JPL_AdviceCode, public TI_AdviceCode {
67
TU_AdviceCode (const string &n, const string &s) : JPL_AdviceCode (n, s) { transform_info (this); }
68
~TU_AdviceCode () { transform_info (0); }
69
virtual JoinPointLoc &jpl () { return *this; }
72
class TU_ClassSlice : public JPL_ClassSlice, public TI_ClassSlice {
74
TU_ClassSlice (const string &s) : JPL_ClassSlice (s) { transform_info (this); }
75
~TU_ClassSlice () { transform_info (0); }
76
virtual JoinPointLoc &jpl () { return *this; }
79
class TU_MethodCall : public JPL_MethodCall, public TI_MethodCall {
81
TU_MethodCall () { transform_info (this); }
82
~TU_MethodCall () { transform_info (0); }
83
virtual JoinPointLoc &jpl () { return *this; }
86
class TU_Method : public JPL_Method, public TI_Method {
88
TU_Method () { transform_info (this); }
89
~TU_Method () { transform_info (0); }
90
virtual JoinPointLoc &jpl () { return *this; }
93
class TU_Construction : public JPL_Construction, public TI_Construction {
95
TU_Construction () { transform_info (this); }
96
~TU_Construction () { transform_info (0); }
97
virtual JoinPointLoc &jpl () { return *this; }
100
class TU_Destruction : public JPL_Destruction, public TI_Destruction {
102
TU_Destruction () { transform_info (this); }
103
~TU_Destruction () { transform_info (0); }
104
virtual JoinPointLoc &jpl () { return *this; }
107
class TU_Introduction : public JPL_Introduction, public TI_Introduction {
109
TU_Introduction () { transform_info (this); }
110
~TU_Introduction () { transform_info (0); }
111
virtual JoinPointLoc &jpl () { return *this; }
114
class TU_Order : public JPL_Order, public TI_Order {
116
TU_Order () { transform_info (this); }
117
~TU_Order () { transform_info (0); }
118
virtual JoinPointLoc &jpl () { return *this; }
122
/* a model element factory for the translation unit model that additionally
123
* contains references to the Puma information about the model elements,
124
* which is needed for transformations.
127
class TUnitModelElementFactory {
129
virtual ~TUnitModelElementFactory () {}
131
virtual TU_Namespace *make_namespace (const string &s) {
132
return new TU_Namespace (s);
134
virtual TU_Class *make_class (const string &s) {
135
return new TU_Class (s);
137
virtual TU_Aspect *make_aspect (const string &s) {
138
return new TU_Aspect (s);
140
virtual TU_Function *make_function (const string &n, const string &s) {
141
return new TU_Function (n, s);
143
virtual TU_AdviceCode *make_advice_code (const string &n, const string &s) {
144
return new TU_AdviceCode (n, s);
146
virtual TU_ClassSlice *make_class_slice (const string &s) {
147
return new TU_ClassSlice (s);
149
virtual TU_Type *make_type (const string &s) { return new TU_Type (s); }
150
virtual TU_Method *make_execution () { return new TU_Method; }
151
virtual TU_MethodCall *make_call () { return new TU_MethodCall; }
152
virtual TU_Construction *make_construction () { return new TU_Construction; }
153
virtual TU_Destruction *make_destruction () { return new TU_Destruction; }
154
virtual TU_Introduction *make_introduction () { return new TU_Introduction; }
155
virtual TU_Order *make_order () { return new TU_Order; }
158
#endif // __TUnitModelElementFactory_h__