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

« back to all changes in this revision

Viewing changes to AspectC++/OrderInfo.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 __OrderInfo_h__
20
20
#define __OrderInfo_h__
21
21
 
22
 
#include "Puma/Array.h"
23
 
#include "Puma/Printable.h"
24
 
#include "Puma/ACTree.h"
25
 
#include "Puma/Unit.h"
26
 
 
27
 
using namespace Puma;
28
 
 
29
 
namespace Puma {
30
 
  class CT_AdviceDecl;
31
 
} // namespace Puma
32
 
 
33
 
class AspectInfo;
 
22
#include "PointCutEvaluator.h"
 
23
#include "PointCutContext.h"
 
24
#include "JoinPointLoc.h"
34
25
 
35
26
class OrderInfo {
36
 
 private:
37
 
  AspectInfo *_aspect;
38
 
  CT_AdviceDecl *_tree;
39
 
  
 
27
 
 
28
  JPL_Aspect &_aspect;
 
29
  JPL_Order &_order;
 
30
  list<PointCutExpr*> _pces;
 
31
  PointCutExpr* _jp_pce;
 
32
 
 
33
  void add_pce (PointCutExpr *pce) { _pces.push_back (pce); }
 
34
  void set_jp_pce (PointCutExpr *jp_pce) { _jp_pce = jp_pce; }
 
35
 
40
36
 public:
41
37
 
42
 
  OrderInfo (AspectInfo *ai, CT_AdviceDecl *ad) :
43
 
    _aspect (ai), _tree (ad) {}
44
 
  CT_AdviceDecl *tree () const { return _tree; }
45
 
  AspectInfo *aspect () { return _aspect; }
46
 
  const Unit &unit () const {
47
 
    return *(Unit*)_tree->token ()->belonging_to ();
 
38
  OrderInfo (JPL_Aspect &a, JPL_Order &o) : _aspect (a), _order (o), _jp_pce (0) {}
 
39
  ~OrderInfo () {
 
40
    for (list<PointCutExpr*>::iterator i = _pces.begin ();
 
41
         i != _pces.end (); ++i)
 
42
      PointCutEvaluator::destroy (*i);
 
43
    if (_jp_pce)
 
44
      PointCutEvaluator::destroy (_jp_pce);
48
45
  }
49
 
  int line () const { return _tree->token ()->location ().line (); }
50
 
  int lines () {
51
 
    return _tree->end_token()->location().line() - line () + 1;
 
46
  const list<PointCutExpr*> &pces () const { return _pces; }
 
47
  PointCutExpr *jp_pce () const { return _jp_pce; }
 
48
  JPL_Aspect &aspect () const { return _aspect; }
 
49
  JPL_Order &order () const { return _order; }
 
50
  void analyze_exprs (ErrorStream &err, JoinPointModel &jpm) {
 
51
    PointCutContext context (jpm);
 
52
    PointCutEvaluator eval (err, context);
 
53
    context.concrete_aspect (_aspect);
 
54
    set_jp_pce (eval.create (_order.expr (), JoinPointLoc::Any));
 
55
    const list<CTree*> &exprs = _order.pces ();
 
56
    for (list<CTree*>::const_iterator i = exprs.begin (); i != exprs.end (); ++i)
 
57
      add_pce (eval.create (*i, JoinPointLoc::Aspect));
52
58
  }
53
59
  
54
60
};