~ubuntu-branches/ubuntu/quantal/aspectc++/quantal

« back to all changes in this revision

Viewing changes to AspectC++/IntroductionInfo.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-04-10 17:40:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080410174052-xdnsm7oi8hauyyf1
Tags: 1.0pre4~svn.20080409+dfsg-3
Fix another missing include, this time in Ag++/StdSystem.cc

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#ifndef __IntroductionInfo_h__
20
20
#define __IntroductionInfo_h__
21
21
 
22
 
#include "Puma/Array.h"
23
 
#include "Puma/Printable.h"
24
 
#include "Puma/ACTree.h"
25
 
#include "Puma/CProtection.h"
26
 
#include "Puma/Unit.h"
 
22
#include <iostream>
 
23
using namespace std;
27
24
 
 
25
#include "PointCut.h"
 
26
#include "JoinPointLoc.h"
 
27
#include "BackEndProblems.h"
 
28
#include "PointCutEvaluator.h"
 
29
#include "PointCutContext.h"
 
30
#include "JoinPointModel.h"
 
31
#include "TransformInfo.h"
28
32
using namespace Puma;
29
33
 
30
 
namespace Puma {
31
 
  class ACIntroductionInfo;
32
 
  class CT_AdviceDecl;
33
 
  class CObjectInfo;
34
 
} // namespace Puma
35
 
 
36
 
class AspectInfo;
37
 
 
38
34
class IntroductionInfo {
 
35
 
 
36
  JPL_Aspect &_aspect;
 
37
  PointCut _pointcut;
 
38
  JPL_Introduction &_intro;
 
39
  PointCutExpr *_pce;
 
40
 
39
41
public:
40
 
  enum intro_type { INTRO_BASECLASS, INTRO_INHERITED, INTRO_OTHER,
41
 
    INTRO_SLICE_REF, INTRO_SLICE_DECL, INTRO_ERROR };
42
 
  
43
 
 private:
44
 
  AspectInfo *_aspect;
45
 
  ACIntroductionInfo *_acii;
46
 
  CT_AdviceDecl *_tree;
47
 
  intro_type _type;
48
 
  CProtection::Type _prot;
49
 
  Array<CObjectInfo*> _objs;
50
 
  Unit _pattern;
51
 
  
52
 
 public:
53
 
 
54
 
  IntroductionInfo (AspectInfo *ai, ACIntroductionInfo *acii);
55
 
  ACIntroductionInfo *ac_info () const { return _acii; }
56
 
  void print (ostream& os) const;
57
 
  CObjectInfo *object (int i) const { return _objs.lookup (i); }
58
 
  int objects () const { return _objs.length (); }
59
 
  intro_type type () const { return _type; }
60
 
  const char *type_str () const {
61
 
    switch (_type) {
62
 
    case INTRO_BASECLASS:  return "baseclass";
63
 
    case INTRO_INHERITED:  return "inherited";
64
 
    case INTRO_OTHER:      return "intro";
65
 
    case INTRO_SLICE_REF:  return "slice ref";
66
 
    case INTRO_SLICE_DECL: return "slice decl";
67
 
    case INTRO_ERROR:      return "error"; // Hm, shouldn't happen
68
 
    }
69
 
    return "error"; // just to suppress warnings
70
 
  }
71
 
  int line () const { return _tree->token ()->location ().line (); }
72
 
  int lines () const {
73
 
    return _tree->end_token ()->location ().line () - 
74
 
                         line () + 1;
75
 
  }
76
 
  const Unit &unit () const {
77
 
    return *(Unit*)_tree->token ()->belonging_to ();
78
 
  }
79
 
  CT_AdviceDecl *tree () const { return _tree; }
80
 
  CProtection::Type prot () const { return _prot; }
81
 
  AspectInfo *aspect () { return _aspect; }
82
 
  const Unit &pattern () const { return _pattern; }
 
42
  IntroductionInfo (JPL_Aspect &a, JPL_Introduction &i) :
 
43
    _aspect (a), _intro (i), _pce (0) {}
 
44
  ~IntroductionInfo () {
 
45
    if (_pce) PointCutEvaluator::destroy (_pce);
 
46
  }
 
47
  JPL_Aspect &aspect () const { return _aspect; }
 
48
  PointCut &pointcut () { return _pointcut; }
 
49
  JPL_Introduction &intro () const { return _intro; }
 
50
  PointCutExpr *expr () const { return _pce; }
 
51
  void analyze_expr (ErrorStream &err, JoinPointModel &jpm) {
 
52
    PointCutContext context (jpm);
 
53
    PointCutEvaluator eval (err, context);
 
54
    context.concrete_aspect (_aspect);
 
55
    _pce = eval.create (_intro.expr (), JoinPointLoc::Name);
 
56
  }
83
57
};
84
58
 
85
59
#endif // __IntroductionInfo_h__