33
32
} // namespace Puma
35
34
using namespace Puma;
38
class BackEndProblems;
39
40
// this class manages all #includes and forward declarations, which have to be
40
41
// generated in order to make the aspects visible at the join points they affect
43
AspectInfo *_concrete_aspect;
44
ACAspectInfo *_aspect;
45
45
// Kind of dependency: the value defines the importance
46
46
enum Kind { AR_UNKNOWN = 0, AR_DECL = 1, AR_ADVICE = 2 } _kind;
47
operator ACAspectInfo* () const { return _aspect; }
48
47
bool operator < (const AspectRef &cmp) const {
49
48
return _aspect < cmp._aspect;
51
50
bool operator == (const AspectRef &cmp) const {
52
51
return _aspect == cmp._aspect;
54
AspectRef (AspectInfo *ca, ACAspectInfo *a, Kind k) : _concrete_aspect (ca),
55
_aspect (a), _kind (k) {}
53
AspectRef (AspectInfo *a, Kind k) : _aspect (a), _kind (k) {}
58
56
typedef set<AspectRef> AspectRefSet;
62
60
class AspectIncludes : private UnitAspectRefMap {
63
61
// helper function that find the unit in which an aspect 'ai' is defined
64
static Unit *aspect_unit (ACAspectInfo *ai);
62
static Unit *aspect_unit (JPL_Aspect *a);
66
64
// generate the #include directive for a given aspect header unit
67
static string generate (CProject &project, ACAspectInfo *ai);
65
static string generate (CProject &project, JPL_Aspect *a);
70
// this function declares that a unit 'iu' depends on the aspect 'ai'
68
// this function declares that a unit 'iu' depends on the aspect 'a'
71
69
// ('kind' specifies the kind of dependy, i.e. class def, decl, or advice)
72
void insert (Unit *iu, AspectInfo *ai, ACAspectInfo *acai,
73
AspectRef::Kind kind);
70
void insert (Unit *iu, AspectInfo *a, AspectRef::Kind kind);
75
72
// interator type and functions to access the elements (only const access)
76
73
typedef UnitAspectRefMap::const_iterator const_iterator;
77
74
const_iterator begin () const { return UnitAspectRefMap::begin (); }
78
75
const_iterator end () const { return UnitAspectRefMap::end (); }
78
using UnitAspectRefMap::find;
80
79
// get the target unit associated with an entry
81
80
Unit *unit (const_iterator entry) const { return (*entry).first; }
83
82
// generate the #include directives for a given unit
84
string generate (CProject &prj, const_iterator entry) const;
83
string generate (const_iterator entry, const BackEndProblems &bep) const;
87
86
#endif // __AspectIncludes_h__