1:- module(aop_inspection,[
2
3 enable_aspect/1,
4 disable_aspect/1,
5
6 enable_extension/3,
7 disable_extension/3,
8
9 current_enabled_aspect/1,
10 current_enabled_aspect/2,
11 current_disabled_aspect/1,
12 current_aspect/1,
13 current_object/1,
14 current_method/1
15 ]). 16
20
22:- dynamic(aop:aspect/1). 23:- multifile(aop:aspect/1). 24
26:- dynamic(aop:aspect_module/2). 27:- multifile(aop:aspect_module/2). 28
29:- dynamic(aop:aspect_enabled/2). 30:- multifile(aop:aspect_enabled/2). 31
33:- dynamic(aop:object/3). 34:- multifile(aop:object/3). 35
37:- dynamic(aop:augmented/3). 38:- multifile(aop:augmented/3). 39
41:- dynamic(aop:method/3). 42:- multifile(aop:method/3). 43
45:- dynamic(aop:method_signature/5). 46:- multifile(aop:method_signature/5). 47
49:- dynamic(aop:extension/3). 50:- multifile(aop:extension/3). 51
53enable_extension(Aspect, Object, Name/Arity) :-
54 aop:extension(Aspect, Object, Name/Arity)
55 -> true
56 ; assertz(aop:extension(Aspect, Object, Name/Arity)).
57
59disable_extension(Aspect, Object, Name/Arity) :-
60 retractall(aop:extension(Aspect, Object, Name/Arity)).
61
65enable_aspect(Aspect) :-
66 retractall(aop:aspect_enabled(Aspect,_)),
67 assertz(aop:aspect_enabled(Aspect, true)).
68
69disable_aspect(Aspect) :-
70 retractall(aop:aspect_enabled(Aspect,_)),
71 assertz(aop:aspect_enabled(Aspect, false)).
72
76current_enabled_aspect(Aspect) :-
77 current_aspect(Aspect),
78 aop:aspect_enabled(Aspect,true).
79
80current_enabled_aspect(Aspect, Module) :-
81 current_enabled_aspect(Aspect),
82 aop:aspect_module(Aspect, Module),
83 aop:aspect_enabled(Aspect,true).
84
85current_disabled_aspect(Aspect) :-
86 current_aspect(Aspect),
87 aop:aspect_enabled(Aspect,false).
88
89current_aspect(Aspect) :-
90 aop:aspect(Aspect).
91
92current_object(Def) :-
93 aop:object(Aspect, Object, Module),
94 Def = aop:object(Aspect, Object, Module).
95
96current_method(Def) :-
97 aop:method(Aspect, Object, Message),
98 Def = aop:method(Aspect, Object, Message)