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 149 150 151 152 153 154 155 156
|
// 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 __JoinPointPlan_h__
#define __JoinPointPlan_h__
#include "JPAdvice.h"
#include "AdviceInfo.h"
#include "OrderPlanner.h"
#include "CFlow.h"
#include "Puma/Array.h"
using namespace Puma;
namespace Puma {
class ErrorSink;
class CUnit;
class ManipCommander;
class ACAspectInfo;
class ACSliceInfo;
} // namespace Puma
class Condition;
class LineDirectiveMgr;
class ACUnit;
class IntroductionUnit;
// abstract base of all join point plans
// (referenced by JoinPointLoc)
class JoinPointPlan : public OrderPlanner<ACAspectInfo> {
public:
virtual ~JoinPointPlan () {}
// check the final plan for this join point -> false on error
virtual bool check (ErrorSink &err) { return true; }
};
// base class of all plans for code join points
class JPP_Code : public JoinPointPlan {
JPAdvice _jpa;
Array<AdviceInfo*> _unsorted;
Array<const Condition*> _conds;
CFlowList _triggers;
public:
// get the join point advice tree structure
JPAdvice *jp_advice () { return &_jpa; }
// consider an advice in the plan for this code join point
bool consider (AdviceInfo *ai, const Condition &cond);
// consider a necessary cflow trigger at this join point
bool consider (const CFlow &cflow) {
_triggers.push_back (cflow);
return true;
}
// return the list of cflows that must be entered/left here
const CFlowList &cflows () const { return _triggers; }
void issue (int index);
bool check (ErrorSink &err);
};
#ifdef ACMODEL
class JPP_Class : public JoinPointPlan {
Array<ACM_Introduction*> _base;
Array<ACM_Introduction*> _other;
Array<ACM_Introduction*> _unsorted;
void gen_intro_inline (Unit *unit, ACM_Introduction *ii,
ACSliceInfo *acsi, ErrorStream &err, LineDirectiveMgr &lmgr,
CStructure *target) const;
void gen_intro_non_inline (Unit *unit, ACM_Introduction *ii,
ACSliceInfo *acsi, ErrorStream &err, LineDirectiveMgr &lmgr,
CStructure *target) const;
void gen_base_intro (IntroductionUnit &intro_unit,
ACM_Introduction *ii, bool first) const;
void instantiate_intro (ErrorStream &err, Unit *unit, CT_Intro *intro,
const Unit &pattern, CStructure *target, Location &loc) const;
public:
// consider an introduction in the plan for this class join point
bool consider (ACM_Introduction *ii);
void issue (ACM_Introduction*ii);
bool check(ErrorSink &err);
int baseIntros () const { return _base.length (); }
ACM_Introduction *baseIntro (int i) const { return _base.lookup (i); }
int otherIntros () const { return _other.length (); }
ACM_Introduction *otherIntro (int i) const { return _other.lookup (i); }
void gen_intros (list<Unit*> &units, ErrorStream &err,
CStructure *target, LineDirectiveMgr &lmgr, bool non_inline = false) const;
void gen_base_intros (list<Unit*> &units, ErrorStream &err,
CClassInfo *target, LineDirectiveMgr &lmgr) const;
};
#else
class JPP_Class : public JoinPointPlan {
Array<JPL_Introduction*> _base;
Array<JPL_Introduction*> _other;
Array<JPL_Introduction*> _unsorted;
void gen_intro_inline (Unit *unit, JPL_Introduction *ii,
ACSliceInfo *acsi, ErrorStream &err, LineDirectiveMgr &lmgr,
CStructure *target) const;
void gen_intro_non_inline (Unit *unit, JPL_Introduction *ii,
ACSliceInfo *acsi, ErrorStream &err, LineDirectiveMgr &lmgr,
CStructure *target) const;
void gen_base_intro (IntroductionUnit &intro_unit,
JPL_Introduction *ii, bool first) const;
void instantiate_intro (ErrorStream &err, Unit *unit, CT_Intro *intro,
const Unit &pattern, CStructure *target, Location &loc) const;
public:
// consider an introduction in the plan for this class join point
bool consider (JPL_Introduction *ii);
void issue (JPL_Introduction*ii);
bool check(ErrorSink &err);
int baseIntros () const { return _base.length (); }
JPL_Introduction *baseIntro (int i) const { return _base.lookup (i); }
int otherIntros () const { return _other.length (); }
JPL_Introduction *otherIntro (int i) const { return _other.lookup (i); }
void gen_intros (list<Unit*> &units, ErrorStream &err,
CStructure *target, LineDirectiveMgr &lmgr, bool non_inline = false) const;
void gen_base_intros (list<Unit*> &units, ErrorStream &err,
CClassInfo *target, LineDirectiveMgr &lmgr) const;
};
#endif // ACMODEL
#endif // __JoinPointPlan_h__
|