~ubuntu-branches/ubuntu/saucy/aspectc++/saucy

« back to all changes in this revision

Viewing changes to AspectC++/tests/Derived/main.cc

  • 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:
 
1
#include <stdio.h>
 
2
 
 
3
struct X {
 
4
    X () {}
 
5
};
 
6
 
 
7
struct C1 {
 
8
    void x () {
 
9
        printf ("  void C1::x()\n");
 
10
    }
 
11
    void f () {
 
12
        printf ("  void C1::f()\n");
 
13
    }
 
14
    void f (double) {
 
15
        printf ("  void C1::f(double)\n");
 
16
    }
 
17
    void f (const X&) {
 
18
        printf ("  void C1::f(X&)\n");
 
19
    }
 
20
};
 
21
 
 
22
struct C2 : C1 {
 
23
    void x () {
 
24
        printf ("  void C2::x()\n");
 
25
    }
 
26
    void f () {
 
27
        printf ("  void C2::f()\n");
 
28
    }
 
29
    void f (double) {
 
30
        printf ("  void C2::f(double)\n");
 
31
    }
 
32
    void f (const X&) {
 
33
        printf ("  void C2::f(X&)\n");
 
34
    }
 
35
};
 
36
 
 
37
struct C3 : C2 {
 
38
    void x () {
 
39
        printf ("  void C3::x()\n");
 
40
    }
 
41
    void f () {
 
42
        printf ("  void C3::f()\n");
 
43
    }
 
44
    void f (double) {
 
45
        printf ("  void C3::f(double)\n");
 
46
    }
 
47
    void f (const X&) {
 
48
        printf ("  void C3::f(X&)\n");
 
49
    }
 
50
};
 
51
 
 
52
aspect Tracer {
 
53
    advice execution (derived ("C2")) : before () {
 
54
        printf ("  before derived(\"C2\")\n");
 
55
    }
 
56
    advice execution (derived ("% C2::f(double)")) : before () {
 
57
        printf ("  before derived(\"%% C2::f(double)\")\n");
 
58
    }
 
59
    advice execution (derived ("% C2::f(X&)")) : before () {
 
60
        printf ("  before derived(\"%% C2::f(X&)\")\n");
 
61
    }
 
62
};
 
63
 
 
64
int main() {
 
65
    C3 c;
 
66
    printf ("Derived: test the 'derived' pointcut function:\n");
 
67
    printf ("==============================================\n");
 
68
    c.C1::f (3.0);
 
69
    printf ("----------------------------------------------\n");
 
70
    c.C1::f ();
 
71
    printf ("----------------------------------------------\n");
 
72
    c.C2::f (3.0);
 
73
    printf ("----------------------------------------------\n");
 
74
    c.C3::f ();
 
75
    printf ("----------------------------------------------\n");
 
76
    c.C3::f (X ());
 
77
    printf ("----------------------------------------------\n");
 
78
    c.C3::x ();
 
79
    printf ("==============================================\n");
 
80
}