File: main.cc

package info (click to toggle)
aspectc%2B%2B 1%3A2.2%2Bgit20181008-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 18,704 kB
  • sloc: cpp: 110,629; ansic: 7,644; sh: 2,192; makefile: 1,317; pascal: 634; python: 402; xml: 349
file content (68 lines) | stat: -rw-r--r-- 1,536 bytes parent folder | download | duplicates (11)
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
#include <stdio.h>

class myClass {
public:
  void method(void);

  void inlineMethod(void) {
    printf("  in myClass::inlineMethod()\n");
  }
};


void myClass::method(void) {
  printf("  in myClass::method()\n");
}

aspect myClassTracer {

  pointcut jps () =
    call ("% myClass::%(...)") || execution ("% myClass::%(...)");

  advice jps () : before () {
    printf ("  -> before advice 1 for joinpoint \"%s\"\n",
	    JoinPoint::signature ());
  }

  advice jps () : around () {
    printf ("  -> around advice 1 for joinpoint \"%s\"\n",
	    JoinPoint::signature ());
    printf ("  >>>\n");
    tjp->proceed ();
    printf ("  <<<\n");
  }

  advice jps () : after () {
    printf ("  -> after advice 1 for joinpoint \"%s\"\n",
	    JoinPoint::signature ());
  }

  advice jps () : before () {
    printf ("  -> before advice 2 for joinpoint \"%s\"\n",
	    JoinPoint::signature ());
  }

  advice jps () : around () {
    printf ("  -> around advice 2 for joinpoint \"%s\"\n",
	    JoinPoint::signature ());
    printf ("  >>>\n");
    tjp->proceed ();
    printf ("  <<<\n");
  }

  advice jps () : after () {
    printf ("  -> after advice 2 for joinpoint \"%s\"\n",
	    JoinPoint::signature ());
  }
};

int main () {
  myClass mc;

  printf ("VoidArg: checks advice for functions with void argument (#206)\n");
  printf ("==============================================================\n");
  mc.inlineMethod ();
  mc.method ();
  printf ("==============================================================\n");
  return 0;
}