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
|
// 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 __Plan_h__
#define __Plan_h_
#include <string>
#include <set>
using namespace std;
#include "JoinPointLoc.h"
#include "JoinPointPlan.h"
#include "Condition.h"
#include "Puma/Array.h"
using namespace Puma;
class AdviceInfo;
class OrderInfo;
class IntroductionInfo;
class AspectInfo;
class CFlow;
class JoinPointModel;
namespace Puma {
class ACAspectInfo;
class ACIntroductionInfo;
class CT_AdviceDecl;
class ErrorSink;
} // namespace Puma
class Plan {
public:
typedef set<AspectInfo> AspectContainer;
ErrorStream &_err;
JoinPointModel &_jpm;
Array<AdviceInfo*> _advice_infos;
list<IntroductionInfo*> _introduction_infos;
list<OrderInfo*> _order_infos;
set<AspectInfo> _aspect_infos;
Array<JoinPointLoc*> _exec_jpls;
Array<JoinPointLoc*> _call_jpls;
Array<JoinPointLoc*> _cons_jpls;
Array<JoinPointLoc*> _dest_jpls;
Array<JoinPointLoc*> _class_jpls;
TypeCheckSet _type_checks_false;
TypeCheckSet _type_checks_true;
public:
Plan (ErrorStream &e, JoinPointModel &jpm);
~Plan ();
// manage advice and aspect ressources
AspectInfo *addAspect (JPL_Aspect &);
AspectContainer &aspect_infos () { return _aspect_infos; }
AdviceInfo *addAdvice (AspectInfo &ai, JPL_AdviceCode &code);
IntroductionInfo *addIntroduction (JPL_Aspect &jpl_aspect, JPL_Introduction &intro);
AdviceInfo *addAdvice (AspectInfo *ai, CT_AdviceDecl *ad);
OrderInfo *addOrder (JPL_Aspect &a, JPL_Order &o);
const list<OrderInfo*> &order_infos () const { return _order_infos; }
const list<IntroductionInfo*> &introduction_infos () const { return _introduction_infos; }
// consider a join point and advice/intro in the plan
void consider (JoinPointLoc *jpl, const Condition &cond, AdviceInfo *ai);
JPP_Class *consider (JoinPointLoc *jpl, JPL_Introduction *intro);
void consider (JoinPointLoc *jpl, JPL_Aspect&, JPL_Aspect&);
void consider (JoinPointLoc *jpl, const CFlow& cflow);
// calculate the order for a single join points
void order (JoinPointLoc *jpl);
// calculate the order for all join points
void order ();
// check the plan for a specific join point
void check (JoinPointLoc *jpl);
// check the final plan -> messages to the error sink
void check ();
// read the accumulated plans
int exec_jp_plans () const { return _exec_jpls.length (); }
JPL_Method &exec_jp_loc (int i) const {
return *(JPL_Method*)_exec_jpls.lookup (i);
}
JPP_Code &exec_jp_plan (int i) const {
return *(JPP_Code*)exec_jp_loc (i).plan ();
}
int call_jp_plans () const { return _call_jpls.length (); }
JPL_MethodCall &call_jp_loc (int i) const {
return *(JPL_MethodCall*)_call_jpls.lookup (i);
}
JPP_Code &call_jp_plan (int i) const {
return *(JPP_Code*)call_jp_loc (i).plan ();
}
int cons_jp_plans () const { return _cons_jpls.length (); }
JPL_Construction &cons_jp_loc (int i) const {
return *(JPL_Construction*)_cons_jpls.lookup (i);
}
JPP_Code &cons_jp_plan (int i) const {
return *(JPP_Code*)cons_jp_loc (i).plan ();
}
int dest_jp_plans () const { return _dest_jpls.length (); }
JPL_Destruction &dest_jp_loc (int i) const {
return *(JPL_Destruction*)_dest_jpls.lookup (i);
}
JPP_Code &dest_jp_plan (int i) const {
return *(JPP_Code*)dest_jp_loc (i).plan ();
}
int class_jp_plans () const { return _class_jpls.length (); }
JPL_Class &class_jp_loc (int i) const {
return *(JPL_Class*)_class_jpls.lookup (i);
}
JPP_Class &class_jp_plan (int i) const {
return *(JPP_Class*)class_jp_loc (i).plan ();
}
const TypeCheckSet &type_checks_false () const {
return _type_checks_false;
}
const TypeCheckSet &type_checks_true () const {
return _type_checks_true;
}
};
#endif // __Plan_h__
|