class Target {public: void f() { // do something }};
class Target {public: void f() { // do something }};
Target.h
Target.h
#include “Dump.ah“ // the slice#include “Target.h“ // for last_aspect Problem { Target *last_; // refer to slice in Dump.ah: advice “Target“: slice Dump; // advice that needs Target: advice execution(“Target“) : after () { last_ = tjp->that(); last_->dump(); }};
#include “Dump.ah“ // the slice#include “Target.h“ // for last_aspect Problem { Target *last_; // refer to slice in Dump.ah: advice “Target“: slice Dump; // advice that needs Target: advice execution(“Target“) : after () { last_ = tjp->that(); last_->dump(); }};
Problem.ah
Problem.ah
source code
weaving (ac++)
#include “Target.h“ // for last_class Problem { Target *last_; void transformed advice { // needs Target, thus Target.h }};
#include “Target.h“ // for last_class Problem { Target *last_; void transformed advice { // needs Target, thus Target.h }};
Problem.ah
Problem.ah
woven code
#include “Dump.ah“class Target { void transformed dump { // needs stdio }public: void transformed f { // do something }};
#include “Dump.ah“class Target { void transformed dump { // needs stdio }public: void transformed f { // do something }};
Target.h
Target.h
no include cycle!
generated include (needed for the slice, which depends on stdio.h)
#include <stdio.h>slice class Dump { void dump() { // print object }};
#include <stdio.h>slice class Dump { void dump() { // print object }};
Dump.ah
Dump.ah
include
#include <stdio.h>// slice code removed by weaver
#include <stdio.h>// slice code removed by weaver
Dump.ah
Dump.ah
include
include
include