~ubuntu-branches/ubuntu/maverick/aspectc++/maverick

« back to all changes in this revision

Viewing changes to AspectC++/AspectIncludes.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-04-10 17:40:52 UTC
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: james.westby@ubuntu.com-20080410174052-dbne39zue793jgrh
Tags: upstream-1.0pre4~svn.20080409+dfsg
ImportĀ upstreamĀ versionĀ 1.0pre4~svn.20080409+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
namespace Puma {
30
30
  class Unit;
31
31
  class CProject;
32
 
  class ACAspectInfo;
33
32
} // namespace Puma
34
33
 
35
34
using namespace Puma;
36
35
 
37
36
class AspectInfo;
 
37
class JPL_Aspect;
 
38
class BackEndProblems;
38
39
 
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
41
42
 
42
43
struct AspectRef {
43
 
  AspectInfo *_concrete_aspect;
44
 
  ACAspectInfo *_aspect;
 
44
  AspectInfo *_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;
50
49
  }
51
50
  bool operator == (const AspectRef &cmp) const {
52
51
    return _aspect == cmp._aspect;
53
52
  }
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) {}
56
54
};
57
55
 
58
56
typedef set<AspectRef> AspectRefSet;
61
59
 
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);
65
63
  
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);
68
66
public:
69
67
  
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);
74
71
  
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 (); }
79
76
 
 
77
  // searching ...
 
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; }
82
81
    
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;
85
84
};
86
85
 
87
86
#endif // __AspectIncludes_h__