File: TUnitModelElementFactory.h

package info (click to toggle)
aspectc%2B%2B 1.0pre4~svn.20080711-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 104,504 kB
  • ctags: 363,975
  • sloc: cpp: 1,645,814; ansic: 16,601; sh: 2,175; makefile: 1,043
file content (158 lines) | stat: -rw-r--r-- 5,918 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
// This file is part of the AspectC++ compiler 'ac++'.
// Copyright (C) 1999-2003  The 'ac++' developers (see aspectc.org)
//                                                                
// This program is free software;  you can redistribute it and/or 
// modify it under the terms of the GNU General Public License as 
// published by the Free Software Foundation; either version 2 of 
// the License, or (at your option) any later version.            
//                                                                
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
// GNU General Public License for more details.                   
//                                                                
// You should have received a copy of the GNU General Public      
// License along with this program; if not, write to the Free     
// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
// MA  02111-1307  USA                                            

#ifndef __TUnitModelElementFactory_h__
#define __TUnitModelElementFactory_h__

#include "ModelElementFactory.h"
#include "JoinPointLoc.h"
#include "TransformInfo.h"

/* helper classes to merge the TI_ classes into the JPL_ classes, i.e. to
 * extend the join point model elements by transformation infos
 */
 
class TU_Type : public JPL_Type, public TI_Type {
public:
  TU_Type (const string &s) : JPL_Type (s) { transform_info (this); }
  ~TU_Type () { transform_info (0); }
  virtual JoinPointLoc &jpl () { return *this; }
};

class TU_Namespace : public JPL_Namespace, public TI_Namespace {
public:
  TU_Namespace (const string &s) : JPL_Namespace (s) { transform_info (this); }
  ~TU_Namespace () { transform_info (0); }
  virtual JoinPointLoc &jpl () { return *this; }
};

class TU_Class : public JPL_Class, public TI_Class {
public:
  TU_Class (const string &s) : JPL_Class (s) { transform_info (this); }
  ~TU_Class () { transform_info (0); }
  virtual JoinPointLoc &jpl () { return *this; }
};

class TU_Aspect : public JPL_Aspect, public TI_Aspect {
public:
  TU_Aspect (const string &s) : JPL_Aspect (s) { transform_info (this); }
  ~TU_Aspect () { transform_info (0); }
  virtual JoinPointLoc &jpl () { return *this; }
};

class TU_Function : public JPL_Function, public TI_Function {
public:
  TU_Function (const string &n, const string &s) : JPL_Function (n, s) { transform_info (this); }
  ~TU_Function () { transform_info (0); }
  virtual JoinPointLoc &jpl () { return *this; }
};

class TU_AdviceCode : public JPL_AdviceCode, public TI_AdviceCode {
public:
  TU_AdviceCode (const string &n, const string &s) : JPL_AdviceCode (n, s) { transform_info (this); }
  ~TU_AdviceCode () { transform_info (0); }
  virtual JoinPointLoc &jpl () { return *this; }
};

class TU_ClassSlice : public JPL_ClassSlice, public TI_ClassSlice {
public:
  TU_ClassSlice (const string &s) : JPL_ClassSlice (s) { transform_info (this); }
  ~TU_ClassSlice () { transform_info (0); }
  virtual JoinPointLoc &jpl () { return *this; }
};

class TU_MethodCall : public JPL_MethodCall, public TI_MethodCall {
public:
  TU_MethodCall () { transform_info (this); }
  ~TU_MethodCall () { transform_info (0); }
  virtual JoinPointLoc &jpl () { return *this; }
};

class TU_Method : public JPL_Method, public TI_Method {
public:
  TU_Method () { transform_info (this); }
  ~TU_Method () { transform_info (0); }
  virtual JoinPointLoc &jpl () { return *this; }
};

class TU_Construction : public JPL_Construction, public TI_Construction {
public:
  TU_Construction () { transform_info (this); }
  ~TU_Construction () { transform_info (0); }
  virtual JoinPointLoc &jpl () { return *this; }
};

class TU_Destruction : public JPL_Destruction, public TI_Destruction {
public:
  TU_Destruction () { transform_info (this); }
  ~TU_Destruction () { transform_info (0); }
  virtual JoinPointLoc &jpl () { return *this; }
};

class TU_Introduction : public JPL_Introduction, public TI_Introduction {
public:
  TU_Introduction () { transform_info (this); }
  ~TU_Introduction () { transform_info (0); }
  virtual JoinPointLoc &jpl () { return *this; }
};

class TU_Order : public JPL_Order, public TI_Order {
public:
  TU_Order () { transform_info (this); }
  ~TU_Order () { transform_info (0); }
  virtual JoinPointLoc &jpl () { return *this; }
};


/* a model element factory for the translation unit model that additionally
 * contains references to the Puma information about the model elements,
 * which is needed for transformations.
 */
 
class TUnitModelElementFactory {
public:
  virtual ~TUnitModelElementFactory () {}
  
  virtual TU_Namespace *make_namespace (const string &s) {
    return new TU_Namespace (s); 
  }
  virtual TU_Class *make_class (const string &s) {
    return new TU_Class (s);
  }
  virtual TU_Aspect *make_aspect (const string &s) {
    return new TU_Aspect (s);
  }
  virtual TU_Function *make_function (const string &n, const string &s) {
    return new TU_Function (n, s);
  }
  virtual TU_AdviceCode *make_advice_code (const string &n, const string &s) {
    return new TU_AdviceCode (n, s);
  }
  virtual TU_ClassSlice *make_class_slice (const string &s) {
    return new TU_ClassSlice (s);
  }
  virtual TU_Type *make_type (const string &s)  { return new TU_Type (s); }
  virtual TU_Method *make_execution ()          { return new TU_Method; }
  virtual TU_MethodCall *make_call ()           { return new TU_MethodCall; }
  virtual TU_Construction *make_construction () { return new TU_Construction; }
  virtual TU_Destruction *make_destruction ()   { return new TU_Destruction; }
  virtual TU_Introduction *make_introduction () { return new TU_Introduction; }
  virtual TU_Order *make_order ()               { return new TU_Order; }
};

#endif // __TUnitModelElementFactory_h__