#LyX 1.4.3 created this file. For more info see http://www.lyx.org/
\lyxformat 245
\begin_document
\begin_header
\textclass article
\begin_preamble
%--------------------------------------------------------------------
% PDF related
%--------------------------------------------------------------------
\newif\ifpdf 
\ifx\pdfoutput\undefined 
  \pdffalse                     % we are not running PDFLaTeX 
\else 
  \pdfoutput=1                % we are running PDFLaTeX 
  \pdftrue 
\fi

%--------------------------------------------------------------------
% setup hyperref
%--------------------------------------------------------------------
\ifpdf
  \usepackage{color}
  \pagecolor{white}
  \usepackage{hyperref}  
  \hypersetup{% 
    %
    %% general document information
    pdftitle          = {AspectC++ Language Reference}, 
    pdfsubject     = {Dokumentation}, 
    pdfkeywords  = {AOP, AspectC++, pure-systems}, 
    pdfauthor      = {\textcopyright\ pure-systems GmbH and Olaf Spinczyk}, 
    pdfcreator     = {\LaTeX\ with package \flqq hyperref\frqq},
    pdfproducer  = {pdfTeX-0.\the\pdftexversion\pdftexrevision},
    %
    %% document style
    colorlinks=true,                  % colored link
    urlcolor=blue,                    % blue URL links
    bookmarks=true,                % generate bookmarks
    bookmarksnumbered=true,  % generate section numbers
    pdfpagemode=None           % don't open bookmarks
  } 
  
  %% set document creation date to 10.7.2003 00:00
  \pdfinfo {/CreationDate (D:20051206000000)}
\fi

%--------------------------------------------------------------------
% create hyperrefs depending on the use of pdflatex
%--------------------------------------------------------------------
\newcommand\depref[2]{%
  \ifpdf
    \href{#1}{#2}
  \else  
    {#2}
  \fi
}

%--------------------------------------------------------------------
% setup pure-systems style
%--------------------------------------------------------------------
\usepackage{floatflt}
\usepackage{../styles/pure-systems}
\doctype{Documentation:}
\credit{
  \noindent\small{(c) 2002-2005 Olaf Spinczyk and pure-systems GmbH\\All rights reserved.}}
\pslogo{
  \resizebox{6cm}{!}{\includegraphics{../images/ps-logo}}}
\otherlogo{
  \resizebox{4cm}{!}{\includegraphics{../images/ac++logo}}}
\sloppy
\remark{
  \small{(c) 2002-2005 Olaf Spinczyk$^1$ and pure-systems GmbH$^2$\\~\\
$^1$\depref{mailto:os@aspectc.org}{os@aspectc.org}\\
\depref{http://www.aspectc.org}{www.aspectc.org}\\~\\
$^2$\depref{mailto:aspectc@pure-systems.com}{aspectc@pure-systems.com}\\
\depref{http://www.pure-systems.com}{www.pure-systems.com}\\
Agnetenstr. 14\\
39106 Magdeburg\\
Germany
}}
\version{1.6, \today}

%--------------------------------------------------------------------
% place footnotes at the bottom of the page
%--------------------------------------------------------------------
\renewcommand\footnoterule{%
  \vfill
  \kern-3\p@
  \hrule\@width.3\columnwidth
  \kern2.6\p@}

%--------------------------------------------------------------------
% leave less than one and a half space between lines
%--------------------------------------------------------------------
\setstretch{1.15}

%--------------------------------------------------------------------
% 'list of examples' environment
%--------------------------------------------------------------------
\newcommand\examplesname{List of Examples}
\newenvironment{examples} 
  {\section*{\examplesname}% 
   \@mkboth{\MakeUppercase\examplesname}% 
                 {\MakeUppercase\examplesname}% 
   \thispagestyle{plain}
   \parindent\z@ \parskip\z@ \@plus .3\p@\relax} %
  {\clearpage}

%--------------------------------------------------------------------
% environment 'comment' 
%--------------------------------------------------------------------
\usepackage{comment}

%--------------------------------------------------------------------
% add 'Index' to table of contents 
%--------------------------------------------------------------------
\let\old@theindex\theindex
\def\theindex{
  \old@theindex
  \addcontentsline{toc}{section}{\indexname}}
\end_preamble
\language english
\inputencoding auto
\fontscheme pslatex
\graphics default
\paperfontsize 12
\spacing onehalf
\papersize default
\use_geometry false
\use_amsmath 1
\cite_engine basic
\use_bibtopic false
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\papercolumns 1
\papersides 2
\paperpagestyle default
\tracking_changes false
\output_changes true
\end_header

\begin_body

\begin_layout Title

\emph on
AspectC++ Language Reference
\end_layout

\begin_layout Author
Matthias Urban
\size largest

\newline

\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
vspace{8mm}
\end_layout

\end_inset

and Olaf Spinczyk
\end_layout

\begin_layout Standard
\begin_inset LatexCommand \tableofcontents{}

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
clearpage
\end_layout

\end_inset


\end_layout

\begin_layout Section
About
\end_layout

\begin_layout Standard
This document is intended to be used as a reference book for the AspectC++
 language elements.
 It describes in-depth the use and meaning of each element providing examples.
 For experienced users the contents of this document is summarized in the
\emph on
 
\emph default

\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
depref{http://www.aspectc.com/ac++quickref.pdf}{
\backslash
emph{AspectC++ Quick Reference}}
\backslash
hspace{-4pt}
\end_layout

\end_inset

.
 A step-by-step introduction how to program with AspectC++ is given in the
 
\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
depref{http://www.aspectc.com/doc.html}{
\backslash
emph{AspectC++ Programming Guide}}
\backslash
hspace{-4pt}
\end_layout

\end_inset


\begin_inset Foot
status open

\begin_layout Standard
Sorry, but the Programming Guide is not written yet 
\family typewriter
:-(
\end_layout

\end_inset

.
 Detailed information about the AspectC++ compiler 
\series bold
ac++
\series default

\begin_inset LatexCommand \index{ac++@\texttt{ac++}}

\end_inset

 can be looked up in the 
\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
depref{http://www.aspectc.com/ac++compilerman.pdf}{
\backslash
emph{AC++ Compiler Manual}}
\backslash
hspace{-4pt}
\end_layout

\end_inset

.
 
\end_layout

\begin_layout Standard
AspectC++ is an aspect-oriented extension to the C++ language
\begin_inset Foot
status collapsed

\begin_layout Standard
defined in the ISO/IEC 14882:1998(E) standard
\end_layout

\end_inset

.
 It is similar to AspectJ
\begin_inset Foot
status collapsed

\begin_layout Standard

\family typewriter
\begin_inset ERT
status open

\begin_layout Standard


\backslash
depref{http://www.aspectj.org}{
\backslash
texttt{www.aspectj.org}}
\end_layout

\end_inset


\end_layout

\end_inset

 but, due to the nature of C++, in some points completely different.
 The first part of this document introduces the basic concepts of the AspectC++
 language.
 The in-depth description of each language element is subject of the second
 part.
\end_layout

\begin_layout Section
Basic Concepts
\end_layout

\begin_layout Subsection
Pointcuts
\begin_inset LatexCommand \index{pointcut|(}

\end_inset


\end_layout

\begin_layout Standard
Aspects in AspectC++ implement crosscutting concerns
\begin_inset LatexCommand \index{crosscutting concern}

\end_inset

 in a modular way.
 With this in mind the most important element of the AspectC++ language
 is the pointcut.
 Pointcuts describe a set of join points
\begin_inset LatexCommand \index{join point}

\end_inset

 by determining on which condition an aspect shall take effect.
 Thereby each join point can either refer to a function, an attribute, a
 type, a variable, or a point from which a join point is accessed so that
 this condition can be for instance the event of reaching a designated code
 position
\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
begin{comment}
\end_layout

\end_inset

 or the allocation of a variable with a certain value
\begin_inset ERT
status collapsed

\begin_layout Standard

\end_layout

\begin_layout Standard

\end_layout

\begin_layout Standard


\backslash
end{comment}
\end_layout

\begin_layout Standard

\end_layout

\end_inset

.
 Depending on the kind of pointcuts, they are evaluated at compile time
 or at runtime.
\end_layout

\begin_layout Subsubsection
Match Expressions
\begin_inset LatexCommand \index{match expression|(}

\end_inset


\begin_inset LatexCommand \index{search pattern!match expression|(}

\end_inset


\end_layout

\begin_layout Standard
There are two types of pointcuts in AspectC++: 
\emph on
code pointcuts
\emph default
 and 
\emph on
name pointcuts
\emph default
.
 Name pointcuts
\begin_inset LatexCommand \index{name pointcut}

\end_inset


\begin_inset LatexCommand \index{pointcut!name}

\end_inset

 describe a set of (statically) known program entities like types, attributes,
 functions, variables, or namespaces.
 All name pointcuts are based on match expressions.
 A match expression can be understood as a search pattern
\begin_inset LatexCommand \index{search pattern}

\end_inset


\begin_inset LatexCommand \index{match expression!search pattern}

\end_inset

.
 In such a search pattern the special character 
\begin_inset Quotes eld
\end_inset

%
\begin_inset Quotes erd
\end_inset

 is interpreted as a wildcard for names or parts of a signature.
 The special character sequence 
\begin_inset Quotes eld
\end_inset

...
\begin_inset Quotes erd
\end_inset

 matches any number of parameters in a function signature or any number
 of scopes in a qualified name.
 A match expression is a quoted string.
\end_layout

\begin_layout Subsubsection*
Example: match expressions (name pointcuts)
\begin_inset LatexCommand \label{exa:match-expressions}

\end_inset


\end_layout

\begin_layout Description

\family typewriter
\series medium
"int
\series default
\InsetSpace ~

\series medium
C::%(...)"
\family default
\series default
 \InsetSpace ~

\newline
matches all member functions of the class C that return an 
\family typewriter
int
\end_layout

\begin_layout Description

\family typewriter
\series medium
"%List"
\family default
\series default
 \InsetSpace ~

\newline
matches any class, struct, union, or enum whose name ends with 
\begin_inset Quotes eld
\end_inset

List
\begin_inset Quotes erd
\end_inset


\end_layout

\begin_layout Description

\family typewriter
\series medium
"% 
\series default
printf(const char *, ...)"
\family default
 \InsetSpace ~

\newline
matches the function 
\family typewriter
printf
\family default
 (defined in the global scope) having at least one parameter of type 
\family typewriter
const\InsetSpace ~
char\InsetSpace ~
*
\family default
 and returning any type
\end_layout

\begin_layout Description

\family typewriter
\series medium
"const
\series default
\InsetSpace ~

\series medium
%&\InsetSpace ~
...::%(...)" 
\series default
\InsetSpace ~

\newline

\family default
matches all functions that return a reference to a constant object
\end_layout

\begin_layout Standard
Match expressions select program entities with respect to their definition
 scope, their type, and their name.
 A detailed description of the match expression semantics follows in section
 
\begin_inset LatexCommand \vref{sec:Match-Expressions}

\end_inset

.
 The grammar which defines syntactically valid match expressions is shown
 in appendix 
\begin_inset LatexCommand \vref{sec:Match-Expression-Grammar}

\end_inset

.
 
\begin_inset LatexCommand \index{match expression|)}

\end_inset


\begin_inset LatexCommand \index{search pattern!match expression|)}

\end_inset


\end_layout

\begin_layout Subsubsection
Pointcut Expressions
\begin_inset LatexCommand \index{pointcut!expression|(}

\end_inset


\end_layout

\begin_layout Standard
The other type of pointcuts, the code pointcuts
\begin_inset LatexCommand \index{code pointcut}

\end_inset


\begin_inset LatexCommand \index{pointcut!code}

\end_inset

, describe an intersection through the set of the points in the control
 flow
\begin_inset LatexCommand \index{control flow}

\end_inset

 of a program.
 A code pointcut can refer to a call or execution point of a function
\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
begin{comment}
\end_layout

\end_inset

 but also to write and read points of attributes and variables
\begin_inset ERT
status collapsed

\begin_layout Standard

\end_layout

\begin_layout Standard

\end_layout

\begin_layout Standard


\backslash
end{comment}
\end_layout

\begin_layout Standard

\end_layout

\end_inset

.
 They can only be created with the help of name pointcuts because all join
 points supported by AspectC++ require at least one name to be defined.
 This is done by calling predefined pointcut functions
\begin_inset LatexCommand \index{pointcut function}

\end_inset


\begin_inset LatexCommand \index{pointcut!function}

\end_inset

 in a pointcut expression that expect a pointcut as argument.
 Such a pointcut function is for instance 
\series bold
within
\series default
(
\emph on
pointcut
\emph default
), which filters all join points that are within the functions or classes
 in the given pointcut.
\end_layout

\begin_layout Standard
Name and code pointcuts can be combined in pointcut expressions by using
 the algebraic operators 
\begin_inset Quotes eld
\end_inset

&&
\begin_inset Quotes erd
\end_inset

, 
\begin_inset Quotes eld
\end_inset

||
\begin_inset Quotes erd
\end_inset

, and 
\begin_inset Quotes eld
\end_inset

!
\begin_inset Quotes erd
\end_inset

.
\end_layout

\begin_layout Subsubsection*
Example: pointcut expressions
\begin_inset LatexCommand \label{exa:pointcut-expressions}

\end_inset


\end_layout

\begin_layout Description

\family typewriter
\series medium
"%List"\InsetSpace ~
&&\InsetSpace ~
!derived("Queue")
\family default
\series default
 \InsetSpace ~

\newline
describes the set of classes with names that end with 
\begin_inset Quotes eld
\end_inset

List
\begin_inset Quotes erd
\end_inset

 and that are not derived from the class 
\family typewriter
Queue
\end_layout

\begin_layout Description

\family typewriter
\series medium
call("void 
\series default
draw()
\series medium
")\InsetSpace ~

\series default
&&\InsetSpace ~
within
\series medium
("
\series default
Shape
\series medium
")
\family default
\series default
 \InsetSpace ~

\newline
describes the set of calls to the function 
\family typewriter
draw
\family default
 that are within methods of the class 
\family typewriter
Shape
\family default

\begin_inset LatexCommand \index{pointcut!expression|)}

\end_inset


\end_layout

\begin_layout Subsubsection
Types of Join Points
\begin_inset LatexCommand \index{join point|(}

\end_inset


\end_layout

\begin_layout Standard
According to the two types of pointcuts supported by AspectC++ there are
 also two types of join points.
 Based on a short code fragment the differences and relations between these
 two types of join points shall be clarified.
\end_layout

\begin_layout LyX-Code
class Shape;
\newline
void draw(Shape&);
\newline

\newline
namespace Circle {
\newline
  typedef int PRECISION;
\newline

  
\newline
  class S_Circle : public Shape {
\newline
    PRECISION m_radius;
\newline
  public:
\newline
    ...
\end_layout

\begin_layout LyX-Code
    void radius(PRECISION r) { m_radius=r; }
\newline
  };
\newline
  
\newline
  void draw(PRECISION
 r) {
\end_layout

\begin_layout LyX-Code
    S_Circle circle;
\end_layout

\begin_layout LyX-Code
    circle.radius(r);
\end_layout

\begin_layout LyX-Code
    draw(circle);
\newline
  }
\newline
}
\newline

\newline
int main() {
\newline
  Circle::draw(10);
\newline
  return 0;
\newline
}
\end_layout

\begin_layout Standard
Code join points
\begin_inset LatexCommand \index{code join point}

\end_inset


\begin_inset LatexCommand \index{join point!code}

\end_inset

 are used to form code pointcuts and name join points (i.e.\InsetSpace ~
names) are used
 to form name pointcuts.
 Figure 
\begin_inset LatexCommand \vref{fig:join-points}

\end_inset

 shows some join points of the code fragment and how they correlate.
 
\end_layout

\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status collapsed

\begin_layout Standard
\align center
\begin_inset Graphics
	filename ../images/JoinPointModel.eps
	scale 65

\end_inset


\end_layout

\begin_layout Caption
\begin_inset LatexCommand \label{fig:join-points}

\end_inset

join points and their relations
\end_layout

\end_inset


\end_layout

\begin_layout Standard
Every 
\series bold
execution
\series default

\begin_inset LatexCommand \index{execution join point}

\end_inset


\begin_inset LatexCommand \index{join point!execution}

\end_inset

 join point is associated with the name of an executable function.
 Pure virtual functions
\begin_inset LatexCommand \index{pure virtual!functions}

\end_inset

 are not executable.
 Thus, advice code for execution join points would never be triggered for
 this kind of function.
 However, the call of such a function, i.e.\InsetSpace ~
a 
\series bold
call
\series default
 join point with this function as target, is absolutely possible.
\end_layout

\begin_layout Standard
Every 
\series bold
call
\series default

\begin_inset LatexCommand \index{call join point}

\end_inset


\begin_inset LatexCommand \index{join point!call}

\end_inset

 join point is associated with two names: the name of the source and the
 target function of a function call.
 As there can be multiple function calls within the same function, each
 function name can be associated with a list of 
\series bold
call
\series default
 join points
\begin_inset LatexCommand \index{join point|)}

\end_inset

.
 
\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
begin{comment}
\end_layout

\end_inset

The same holds for 
\series bold
set
\series default

\begin_inset LatexCommand \index{set join point}

\end_inset


\begin_inset LatexCommand \index{join point!set}

\end_inset

 and 
\series bold
get
\series default

\begin_inset LatexCommand \index{get join point}

\end_inset


\begin_inset LatexCommand \index{join point!get}

\end_inset

 join points, which represent write resp.\InsetSpace ~
read operations on attributes or
 global variables.
 Each of these join points is associated with the name of the function that
 contains the join point and the name of the accessed attribute or global
 variable.
\begin_inset ERT
status collapsed

\begin_layout Standard

\end_layout

\begin_layout Standard

\end_layout

\begin_layout Standard


\backslash
end{comment}
\end_layout

\begin_layout Standard

\end_layout

\end_inset

A 
\series bold
construction
\series default
 joinpoint means the class specific instruction sequence executed when an
 instance is created.
 In analogy, a 
\series bold
destruction
\series default
 joinpoint means the object destruction.
\end_layout

\begin_layout Subsubsection
Pointcut declarations
\series bold

\begin_inset LatexCommand \index{pointcut!declaration|(}

\end_inset


\end_layout

\begin_layout Standard
AspectC++ provides the possibility to name pointcut
\begin_inset LatexCommand \index{name pointcut}

\end_inset


\begin_inset LatexCommand \index{pointcut!name}

\end_inset

 expressions with the help of pointcut declarations.
 This makes it possible to reuse pointcut expressions in different parts
 of a program.
 They are allowed where C++ declarations are allowed.
 Thereby the usual C++ name lookup and inheritance rules are also applicable
 for pointcut declarations.
\end_layout

\begin_layout Standard
A pointcut declaration is introduced by the keyword 
\family typewriter
pointcut
\family default
.
 
\end_layout

\begin_layout Subsubsection*
Example: pointcut declaration
\begin_inset LatexCommand \label{exa:pointcut-declaration}

\end_inset


\end_layout

\begin_layout Description

\family typewriter
\series medium
pointcut
\series default
\InsetSpace ~

\series medium
lists()\InsetSpace ~
=
\series default
\InsetSpace ~

\series medium
derived("List");
\family default
\series default
 \InsetSpace ~

\newline

\family typewriter
lists
\family default
 can now be used everywhere in a program where a pointcut expression can
 be used to refer to 
\family typewriter
derived("List")
\end_layout

\begin_layout Standard
Furthermore pointcut declarations can be used to define pure virtual pointcuts
\begin_inset LatexCommand \index{pure virtual!pointcut}

\end_inset


\begin_inset LatexCommand \index{pointcut!pure virtual}

\end_inset

.
 This enables the possibility of having re-usable abstract aspects
\begin_inset LatexCommand \index{aspect}

\end_inset


\begin_inset LatexCommand \index{abstract aspect}

\end_inset


\begin_inset LatexCommand \index{aspect!abstract}

\end_inset

 that are discussed in section 
\begin_inset LatexCommand \ref{sub:Aspects}

\end_inset

.
 The syntax of pure virtual pointcut declarations is the same as for usual
 pointcut declarations except the keyword 
\family typewriter
virtual
\family default
 following 
\family typewriter
pointcut
\family default
 and that the pointcut expression is 
\begin_inset Quotes eld
\end_inset

0
\begin_inset Quotes erd
\end_inset

.
\end_layout

\begin_layout Subsubsection*
Example: pure virtual pointcut declaration
\begin_inset LatexCommand \label{exa:pure-virtual}

\end_inset


\end_layout

\begin_layout Description

\family typewriter
\series medium
pointcut
\series default
\InsetSpace ~

\series medium
virtual\InsetSpace ~
methods()\InsetSpace ~
=
\series default
\InsetSpace ~

\series medium
0;
\family default
\series default
 \InsetSpace ~

\newline

\family typewriter
methods
\family default
 is a pure virtual pointcut that has to be redefined in a derived aspect
 to refer to the actual pointcut
\begin_inset LatexCommand \index{pointcut|)}

\end_inset

 expression
\series bold

\begin_inset LatexCommand \index{pointcut!declaration|)}

\end_inset


\end_layout

\begin_layout Subsection
Slices
\begin_inset LatexCommand \index{slice|(}

\end_inset


\end_layout

\begin_layout Standard
A 
\emph on
slice
\emph default
 is a fragment of a C++ language element that defines a scope.
 It can be used by advice to extend the static structure of the programm.
 For example, the elements of a class slice can be merged into one or more
 target classes by introduction advice.
 The following example shows a simple class slice declaration.
\end_layout

\begin_layout Subsubsection*
Example: class slice declaration
\begin_inset LatexCommand \label{exa:class-slice-declaration}

\end_inset


\end_layout

\begin_layout LyX-Code
slice class Chain {
\end_layout

\begin_layout LyX-Code
  Chain *_next;
\end_layout

\begin_layout LyX-Code
public:
\end_layout

\begin_layout LyX-Code
  Chain *next () const { return _next; }
\end_layout

\begin_layout LyX-Code
};
\end_layout

\begin_layout Standard
\begin_inset LatexCommand \index{slice|)}

\end_inset


\end_layout

\begin_layout Subsection
Advice Code
\begin_inset LatexCommand \index{advice|(}

\end_inset


\begin_inset LatexCommand \index{advice!code|(}

\end_inset


\end_layout

\begin_layout Standard
To a code join point
\begin_inset LatexCommand \index{code join point}

\end_inset


\begin_inset LatexCommand \index{join point!code}

\end_inset

 so-called advice code can be bound.
 Advice code can be understood as an action
\begin_inset LatexCommand \index{action}

\end_inset


\begin_inset LatexCommand \index{runtime support!action}

\end_inset

 activated by an aspect when a corresponding code join point in a program
 is reached.
 The activation of the advice code can happen before
\begin_inset LatexCommand \index{before}

\end_inset


\begin_inset LatexCommand \index{advice!before}

\end_inset

, after
\begin_inset LatexCommand \index{after}

\end_inset


\begin_inset LatexCommand \index{advice!after}

\end_inset

, or before and after the code join point is reached.
 The AspectC++ language element to specify advice code is the advice declaration
\begin_inset LatexCommand \index{advice!declaration}

\end_inset

.
 It is introduced by the keyword 
\family typewriter
advice
\family default
 followed by a pointcut expression defining where and under which conditions
 the advice code shall be activated.
 
\end_layout

\begin_layout Subsubsection*
Example: advice declaration
\begin_inset LatexCommand \label{exa:advice-declaration}

\end_inset


\end_layout

\begin_layout LyX-Code
advice execution("void login(...)") : before() {
\newline
  cout << "Logging in." << endl;
\newline
}
\end_layout

\begin_layout Standard
The code fragment 
\family typewriter
:before()
\family default
 following the pointcut expression determines that the advice code shall
 be activated directly 
\series bold
before
\series default

\begin_inset LatexCommand \index{before}

\end_inset


\begin_inset LatexCommand \index{advice!before}

\end_inset

 the code join point is reached.
 It is also possible here to use 
\family typewriter
:after()
\family default
 which means 
\series bold
after
\series default

\begin_inset LatexCommand \index{after}

\end_inset


\begin_inset LatexCommand \index{advice!after}

\end_inset

 reaching the code join point respectively 
\family typewriter
:around()
\family default
 which means that the advice code shall be executed instead of the code
 described by the code join point.
 In an 
\series bold
around
\series default

\begin_inset LatexCommand \index{around}

\end_inset


\begin_inset LatexCommand \index{advice!around}

\end_inset

 advice the advice code can explicitly trigger the execution of the program
 code at the join point so that advice code can be executed 
\series bold
before
\series default
 and 
\series bold
after
\series default
 the join point.
 There are no special access rights of advice code regarding to program
 code at a join point.
\end_layout

\begin_layout Standard
Beside the pure description of join points pointcuts can also bind variables
 to context
\begin_inset LatexCommand \index{context variables}

\end_inset

 information of a join point.
 Thus for instance the actual argument values of a function call can be
 made accessible to the advice code.
\end_layout

\begin_layout Subsubsection*
Example: advice declaration with access to context information
\begin_inset LatexCommand \label{exa:advice-declaration-with}

\end_inset


\end_layout

\begin_layout LyX-Code
pointcut new_user(const char *name) = 
\newline
  execution("void login(...)") && args(name);
 
\newline

\newline
advice new_user(name) : before(const char *name) { 
\newline
  cout << "User " <<
 name << " is logging in." << endl; 
\newline
}
\end_layout

\begin_layout Standard
In the example above at first the pointcut 
\family typewriter
new_user
\family default
 is defined including a context variable
\begin_inset LatexCommand \index{context variables}

\end_inset

 
\family typewriter
name
\family default
 that is bound to it.
 This means that a value of type 
\family typewriter
const char*
\family default
 is supplied every time the join point described by the pointcut 
\family typewriter
new_user
\family default
 is reached.
 The pointcut function 
\family typewriter
args
\family default
 used in the pointcut expression delivers all join points in the program
 where an argument of type 
\family typewriter
const char*
\family default
 is used.
 Therefore 
\family typewriter
args(name)
\family default
 in touch with the 
\series bold
execution
\series default

\begin_inset LatexCommand \index{execution join point}

\end_inset


\begin_inset LatexCommand \index{join point!execution}

\end_inset

 join point binds 
\family typewriter
name
\family default
 to the first and only parameter of the function 
\family typewriter
login
\family default
.
 
\end_layout

\begin_layout Standard
The advice declaration in the example above following the pointcut declaration
 binds the execution of advice code to the event when a join point described
 in 
\family typewriter
new_user
\family default
 is reached.
 The context variable
\begin_inset LatexCommand \index{context variables}

\end_inset

 that holds the actual value of the parameter of the reached join point
 has to be declared as a formal parameter of 
\family typewriter
before
\family default
, 
\family typewriter
after
\family default
, or 
\family typewriter
around
\family default
.
 This parameter can be used in the advice code like an oridinary function
 parameter.
\end_layout

\begin_layout Standard
Beside the pointcut function 
\family typewriter
args
\family default

\begin_inset LatexCommand \index{args@\texttt{args()}}

\end_inset


\begin_inset LatexCommand \index{pointcut function!args@\texttt{args()}}

\end_inset

 the binding of context variables is performed by 
\family typewriter
that
\family default

\begin_inset LatexCommand \index{that@\texttt{that()}}

\end_inset


\begin_inset LatexCommand \index{pointcut function!that@\texttt{that()}}

\end_inset

,
\family typewriter
 target
\family default

\begin_inset LatexCommand \index{target@\texttt{target()}}

\end_inset


\begin_inset LatexCommand \index{pointcut function!target@\texttt{target()}}

\end_inset

, and 
\family typewriter
result
\family default

\begin_inset LatexCommand \index{result@\texttt{result()}}

\end_inset


\begin_inset LatexCommand \index{pointcut function!base@\texttt{base()}}

\end_inset

.
 At the same time these pointcut functions act as filters corresponding
 to the type of the context variable.
 For instance 
\family typewriter
args
\family default
 in the example above filters all join points having an argument of type
 
\family typewriter
const char*
\family default
.
\begin_inset LatexCommand \index{advice!code|)}

\end_inset


\end_layout

\begin_layout Subsubsection
Introductions
\begin_inset LatexCommand \index{introduction|(}

\end_inset


\begin_inset LatexCommand \index{advice!introduction|(}

\end_inset


\end_layout

\begin_layout Standard
The second type of advice supported by AspectC++ are the introductions.
 Introductions are used to extend program code and data structures in particular.
 The following example extends two classes each by an attribute and a method.
\end_layout

\begin_layout Subsubsection*
Example: introductions
\begin_inset LatexCommand \label{exa:introductions}

\end_inset


\end_layout

\begin_layout LyX-Code
pointcut shapes() = "Circle" || "Polygon";
\newline

\newline
advice shapes() : slice class
 {
\newline
  bool m_shaded;
\newline
  void shaded(bool state) {
\newline
    m_shaded = state;
\newline
  }
\newline
};
\end_layout

\begin_layout Standard
Like an ordinary advice declaration an introduction is introduced by the
 keyword 
\family typewriter
advice
\family default
.
 If the following pointcut is a name pointcut
\begin_inset LatexCommand \index{name pointcut}

\end_inset


\begin_inset LatexCommand \index{pointcut!name}

\end_inset

 the slice declaration following the token 
\begin_inset Quotes eld
\end_inset

:
\begin_inset Quotes erd
\end_inset

 is introduced in the classes and aspects described by the pointcut.
 Introduced code can then be used in normal program code like any other
 function, attribute, etc.
 Advice code in introductions has full access rights
\begin_inset LatexCommand \index{introduction!access rights}

\end_inset

 regarding to program code at a join point, i.e.\InsetSpace ~
a method introduced in a class
 has access even to private members of that class.
\end_layout

\begin_layout Standard
Slices can also be used to introduce new base classes.
 In the first line of the following example it is made sure that every class
 with a name that ends with 
\begin_inset Quotes eld
\end_inset

Object
\begin_inset Quotes erd
\end_inset

 is derived from a class 
\family typewriter
MemoryPool
\family default
.
 This class may implement an own memory management by overloading the 
\family typewriter
new
\family default
 and 
\family typewriter
delete
\family default
 operators.
 Classes that inherit from 
\family typewriter
MemoryPool
\family default
 must redefine the pure virtual method 
\family typewriter
release
\family default
 that is part of the implemented memory management.
 This is done in the second line for all classes in the pointcut
\begin_inset LatexCommand \index{advice|)}

\end_inset


\begin_inset LatexCommand \index{introduction|)}

\end_inset


\begin_inset LatexCommand \index{advice!introduction|)}

\end_inset

.
\end_layout

\begin_layout Subsubsection*
Example: base class introduction
\begin_inset LatexCommand \label{exa:base-class-intro}

\end_inset


\end_layout

\begin_layout LyX-Code
advice "%Object" : slice class : public MemoryPool {
\newline
  virtual void release()
 = 0;
\newline
}
\end_layout

\begin_layout Subsubsection
Advice Ordering
\begin_inset LatexCommand \index{ordering|(}

\end_inset


\end_layout

\begin_layout Standard
If more than one advice affects the same join point it might be necessary
 to define an order of advice execution if there is a dependency between
 the advice codes (
\begin_inset Quotes eld
\end_inset

aspect interaction
\begin_inset Quotes erd
\end_inset


\begin_inset LatexCommand \index{aspect interaction}

\end_inset

).
 The following example shows how the precedence of advice code can be defined
 in AspectC++.
\end_layout

\begin_layout Subsubsection*
Example: advice ordering
\begin_inset LatexCommand \label{exa:order}

\end_inset


\end_layout

\begin_layout LyX-Code
advice execution("void send(...)") : order("Encrypt", "Log")
\begin_inset LatexCommand \index{order}

\end_inset


\begin_inset LatexCommand \index{advice!order}

\end_inset

;
\end_layout

\begin_layout Standard
If advice of both aspects (see 
\begin_inset LatexCommand \ref{sub:Aspects}

\end_inset

) 
\family typewriter
Encrypt
\family default
 and 
\family typewriter
Log
\family default
 should be run when the function 
\family typewriter
send(...)
\family default
 is executed this order declaration defines that the advice of 
\family typewriter
Encrypt
\family default
 has a higher precedence.
 More details on advice ordering and precedence 
\begin_inset LatexCommand \index{precedence}

\end_inset

 can be found in section 
\begin_inset LatexCommand \vref{sec:ordering}

\end_inset

.
\end_layout

\begin_layout Subsection
Aspects
\begin_inset LatexCommand \label{sub:Aspects}

\end_inset


\begin_inset LatexCommand \index{aspect|(}

\end_inset


\end_layout

\begin_layout Standard
The aspect is the language element of AspectC++ to collect introductions
 and advice code implementing a common crosscutting concern
\begin_inset LatexCommand \index{crosscutting concern}

\end_inset

 in a modular way.
 This put aspects in a position to manage common state information.
 They are formulated by means of aspect declarations
\begin_inset LatexCommand \index{aspect!declaration}

\end_inset

 as a extension to the class concept of C++.
 The basic structure of an aspect declaration is exactly the same as an
 usual C++ class definition, except for the keyword 
\family typewriter
aspect
\family default
 instead of 
\family typewriter
class
\family default
, 
\family typewriter
struct
\family default
 or 
\family typewriter
union
\family default
.
 According to that, aspects can have attributes and methods and can inherit
 from classes and even other aspects.
\end_layout

\begin_layout Subsubsection*
Example: aspect declaration
\begin_inset LatexCommand \label{exa:aspect-decl}

\end_inset


\end_layout

\begin_layout LyX-Code
aspect Counter { 
\newline
  static int m_count;
\newline
  
\newline
  pointcut counted() = "Circle"
 || "Polygon";
\newline
  
\newline
  advice counted() : slice struct {
\newline
    class Helper {
\newline
  
    Helper() { Counter::m_count++; }
\newline
    } m_counter;
\newline
  };
\newline
  
\newline
  advice execution("%
 main(...)") : after() {
\newline
    cout << "Final count: " << m_count << " objects"
 << endl;
\newline
  }
\newline
};
\newline
...
 and at an appropriate place
\newline
#include "Counter.ah"
\newline
int Counter::m_count = 0;
\end_layout

\begin_layout Standard
In this example the count of object instantiations for a set of classes
 is determined.
 Therefore, an attribute 
\family typewriter
m_counter
\family default
 is introduced into the classes described by the pointcut incrementing a
 global counter on construction time.
 By applying advice code for the function 
\family typewriter
main
\family default
 the final count of object instantiations is displayed when the program
 terminates.
 
\end_layout

\begin_layout Standard
This example can also be rewritten as an abstract aspect
\begin_inset LatexCommand \index{abstract aspect}

\end_inset


\begin_inset LatexCommand \index{aspect!abstract}

\end_inset

 that can for instance be archived in an aspect library for the purpose
 of reuse.
 It only require to reimplement the pointcut declaration to be pure virtual
\begin_inset LatexCommand \index{pure virtual!pointcut}

\end_inset

.
\end_layout

\begin_layout Subsubsection*
Example: abstract aspect
\begin_inset LatexCommand \label{exa:abstract-aspect}

\end_inset


\end_layout

\begin_layout LyX-Code
aspect Counter { 
\newline
  static int m_count;
\newline
  Counter() : m_count(0) {}
\newline
  
\newline
  pointcut
 virtual counted() = 0;
\newline
  ...
\newline
};
\end_layout

\begin_layout Standard
It is now possible to inherit from 
\family typewriter
Counter
\family default
 to reuse its functionality by reimplementing 
\family typewriter
counted
\family default
 to refer to the actual pointcut expression.
\end_layout

\begin_layout Subsubsection*
Example: reused abstract aspect
\begin_inset LatexCommand \label{exa:reused-abstract}

\end_inset


\end_layout

\begin_layout LyX-Code
aspect MyCounter : public Counter { 
\newline
  pointcut counted() = derived("Shape");
\newline
};
\end_layout

\begin_layout Subsubsection
Aspect Instantiation
\begin_inset LatexCommand \index{aspect!instantiation|(}

\end_inset


\end_layout

\begin_layout Standard
By default aspects in AspectC++ are automatically instantiated as global
 objects.
 The idea behind it is that aspects can also provide global program properties
 and therefore have to be always accessible.
 However in some special cases it may be desired to change this behavior,
 e.g.\InsetSpace ~
in the context of operating systems when an aspect shall be instantiated
 per process or per thread.
 
\end_layout

\begin_layout Standard
The default instantiation scheme can be changed by defining the static method
 
\family typewriter
aspectof
\family default

\begin_inset LatexCommand \index{aspectof@\texttt{aspectof()}}

\end_inset

 resp.\InsetSpace ~

\family typewriter
aspectOf
\family default

\begin_inset LatexCommand \index{aspectOf@\texttt{aspectOf()}}

\end_inset

 that is otherwise generated for an aspect.
 This method is intended to be always able to return an instance of the
 appropriate aspect.
\end_layout

\begin_layout Subsubsection*
Example: aspect instantiation using 
\family typewriter
aspectof
\begin_inset LatexCommand \label{exa:aspect-aspectof}

\end_inset


\end_layout

\begin_layout LyX-Code
aspect ThreadCounter : public Counter {
\newline
  pointcut counted() = "Thread";
\newline

  
\newline
  advice counted() : ThreadCounter m_instance;
\newline
  
\newline
  static ThreadCounter
 *aspectof() {
\newline
    return tjp->target()->m_instance;
\newline
  }
\newline
};
\end_layout

\begin_layout Standard
The introduction of 
\family typewriter
m_instance
\family default
 into 
\family typewriter
Thread
\family default
 guarantees that every thread object has an instance of the aspect.
 By calling 
\family typewriter
aspectof
\family default
 it is possible to get this instance at any join point which is essential
 for accessing advice code and members of the aspect.
 For this purpose code in 
\family typewriter
aspectof
\family default
 has full access to the actual join point in a way described in the next
 section.
\begin_inset LatexCommand \index{aspect|)}

\end_inset


\begin_inset LatexCommand \index{aspect!instantiation|)}

\end_inset


\end_layout

\begin_layout Subsection
Runtime Support
\begin_inset LatexCommand \index{runtime support|(}

\end_inset


\end_layout

\begin_layout Subsubsection
Support for Advice Code
\begin_inset LatexCommand \index{runtime support!for advice code|(}

\end_inset


\begin_inset LatexCommand \index{advice!runtime support|(}

\end_inset


\end_layout

\begin_layout Standard
For many aspects access to context variables
\begin_inset LatexCommand \index{context variables}

\end_inset

 may not be sufficient to get enough information about the join point where
 advice code was activated.
 For instance a control flow
\begin_inset LatexCommand \index{control flow}

\end_inset

 aspect for a complete logging of function calls in a program would need
 information about function arguments and its types on runtime to be able
 to produce a type-compatible output.
 
\end_layout

\begin_layout Standard
In AspectC++ this information is provided by the members of the class 
\family typewriter
JoinPoint
\family default

\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}}

\end_inset


\begin_inset LatexCommand \index{runtime support!JoinPoint@\texttt{JoinPoint}}

\end_inset

 
\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
begin{comment}
\end_layout

\end_inset

available both in advice code and introductions 
\begin_inset ERT
status collapsed

\begin_layout Standard

\end_layout

\begin_layout Standard

\end_layout

\begin_layout Standard


\backslash
end{comment}
\end_layout

\begin_layout Standard

\end_layout

\end_inset

(see table below).
 
\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="21" columns="2">
<features islongtable="true">
<column alignment="center" valignment="top" leftline="true" width="0cm">
<column alignment="center" valignment="top" leftline="true" rightline="true" width="0cm">
<row topline="true">
<cell multicolumn="1" alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\series bold
types:
\end_layout

\end_inset
</cell>
<cell multicolumn="2" alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
Result
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
result type
\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
That
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
object type
\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
Target
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
target type
\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
AC::Type
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
encoded type of an object
\end_layout

\end_inset
</cell>
</row>
<row topline="true" bottomline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
AC::JPType
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
join point types
\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell multicolumn="1" alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\series bold
static methods:
\end_layout

\end_inset
</cell>
<cell multicolumn="2" alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
int args()
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
number of arguments
\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
AC::Type type()
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
typ of the function or attribute
\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
AC::Type argtype(int)
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
types of the arguments
\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
const char *signature()
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
signature of the function or attribute
\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
unsigned id()
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
identification of the join point
\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
AC::Type resulttype()
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
result type
\end_layout

\end_inset
</cell>
</row>
<row topline="true" bottomline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
AC::JPType jptype()
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
type of join point
\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell multicolumn="1" alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\series bold
non-static methods:
\end_layout

\end_inset
</cell>
<cell multicolumn="2" alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
void *arg(int)
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
actual argument
\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
Result *result()
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
result value
\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
That *that()
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
object refered to by 
\family typewriter
\size small
this
\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
Target *target()
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
target object of a call
\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
void proceed()
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
execute join point code
\end_layout

\end_inset
</cell>
</row>
<row topline="true" bottomline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
AC::Action &action()
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
Action
\family default
 structure
\end_layout

\end_inset
</cell>
</row>
</lyxtabular>

\end_inset


\end_layout

\begin_layout Standard
\align center
Table 1: API of class 
\family typewriter
JoinPoint
\family default
 available in advice code
\end_layout

\begin_layout Standard
Types and static methods of the 
\family typewriter
JoinPoint
\family default
 API deliver information that is the same for every advice code activation.
 The non-static methods deliver information that differ from one activation
 to another.
 These methods are accessed by the object 
\family typewriter
tjp
\family default

\begin_inset LatexCommand \index{tjp@\texttt{tjp}}

\end_inset


\begin_inset LatexCommand \index{runtime support!thisJoinPoint@\texttt{thisJoinPoint}}

\end_inset

 resp.\InsetSpace ~

\family typewriter
thisJoinPoint
\family default

\begin_inset LatexCommand \index{thisJoinPoint@\texttt{thisJoinPoint}}

\end_inset


\begin_inset LatexCommand \index{runtime support!thisJoinPoint@\texttt{thisJoinPoint}}

\end_inset

 which is of type 
\family typewriter
JoinPoint
\family default
 and is always available in advice code
\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
begin{comment}
\end_layout

\end_inset

 and introductions
\begin_inset ERT
status collapsed

\begin_layout Standard

\end_layout

\begin_layout Standard

\end_layout

\begin_layout Standard


\backslash
end{comment}
\end_layout

\begin_layout Standard

\end_layout

\end_inset

, too.
\end_layout

\begin_layout Standard
The following example illustrates how to implement a re-usable control flow
\begin_inset LatexCommand \index{control flow}

\end_inset

 aspect using the 
\family typewriter
JoinPoint
\family default
 API.
 
\end_layout

\begin_layout Subsubsection*
Example: re-usable trace aspect
\begin_inset LatexCommand \label{exa:re-usable-trace}

\end_inset


\end_layout

\begin_layout LyX-Code
aspect Trace {
\newline
  pointcut virtual methods() = 0;
\newline
  
\newline
  advice execution(methods())
 : around() {
\newline
    cout << "before " << JoinPoint::signature() << "(";
\end_layout

\begin_layout LyX-Code
    for (unsigned i = 0; i < JoinPoint::args(); i++)
\newline
      printvalue(tjp->arg(i)
, JoinPoint::argtype(i));
\newline
    cout << ")" << endl;
\newline
    tjp->proceed()
\series bold
;
\newline

\series default
    cout << "after" << endl;
\newline
  } 
\newline
};
\end_layout

\begin_layout Standard
This aspect weaves tracing code into every function specified by the virtual
 pointcut
\begin_inset LatexCommand \index{pure virtual!pointcut}

\end_inset

 redefined in a derived aspect.
 The helper function 
\family typewriter
printvalue
\family default
 is responsible for the formated output of the arguments given at the function
 call.
 After calling 
\family typewriter
printvalue
\family default
 for every argument the program code of the actual join point is executed
 by calling 
\family typewriter
proceed
\family default

\begin_inset LatexCommand \index{proceed@\texttt{proceed()}}

\end_inset


\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!proceed()@\texttt{proceed()}}

\end_inset

 on the 
\family typewriter
JoinPoint
\family default
 object.
 The functionality of 
\family typewriter
proceed
\family default
 is achieved by making use of the so-called actions.
\end_layout

\begin_layout Subsubsection
Actions
\begin_inset LatexCommand \index{action|(}

\end_inset


\begin_inset LatexCommand \index{runtime support!action|(}

\end_inset


\end_layout

\begin_layout Standard
In AspectC++ an action is the statement sequence that would follow a reached
 join point in a running program if advice code would not have been activated.
 Thus 
\family typewriter
tjp->proceed()
\family default

\begin_inset LatexCommand \index{proceed@\texttt{proceed()}}

\end_inset


\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!proceed()@\texttt{proceed()}}

\end_inset

 triggers the execution of the program code of a join point.
 This can be the call or execution of a function
\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
begin{comment}
\end_layout

\end_inset

 as well as the writing or reading of attributes or variables
\begin_inset ERT
status collapsed

\begin_layout Standard

\end_layout

\begin_layout Standard

\end_layout

\begin_layout Standard


\backslash
end{comment}
\end_layout

\begin_layout Standard

\end_layout

\end_inset

.
 The actions concept is realized in the 
\family typewriter
AC::Action
\family default
 structure.
 In fact, 
\family typewriter
proceed
\family default
 is equivalent to 
\family typewriter
action().trigger()
\family default

\begin_inset LatexCommand \index{trigger@\texttt{trigger()}}

\end_inset


\begin_inset LatexCommand \index{action!trigger@\texttt{trigger()}}

\end_inset

 so that 
\family typewriter
tjp->proceed()
\family default
 may also be replaced by 
\family typewriter
tjp->action().trigger()
\family default
.
 Thereby the method 
\family typewriter
action()
\family default

\begin_inset LatexCommand \index{action@\texttt{action()}}

\end_inset


\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!action@\texttt{action()}}

\end_inset

 of the 
\family typewriter
JoinPoint
\family default

\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}}

\end_inset


\begin_inset LatexCommand \index{runtime support!JoinPoint@\texttt{JoinPoint}}

\end_inset

 API returns the actual action object for a join point.
\begin_inset LatexCommand \index{runtime support!for advice code|)}

\end_inset


\begin_inset LatexCommand \index{advice!runtime support|)}

\end_inset


\begin_inset LatexCommand \index{action|)}

\end_inset


\begin_inset LatexCommand \index{runtime support!action|)}

\end_inset


\end_layout

\begin_layout Standard
\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
begin{comment}
\end_layout

\end_inset


\end_layout

\begin_layout Subsubsection
Support for Introductions
\begin_inset LatexCommand \index{runtime support!for introductions|(}

\end_inset


\begin_inset LatexCommand \index{introduction!runtime support|(}

\end_inset


\end_layout

\begin_layout Standard
The 
\family typewriter
JoinPoint
\family default
 API available in code introduced by an introduction is listed in the following
 table.
\end_layout

\begin_layout Standard
\begin_inset Float table
placement H
wide false
sideways false
status open

\begin_layout Standard
\align center
\begin_inset Tabular
<lyxtabular version="3" rows="6" columns="2">
<features>
<column alignment="center" valignment="top" leftline="true" width="0pt">
<column alignment="center" valignment="top" leftline="true" rightline="true" width="0cm">
<row topline="true">
<cell multicolumn="1" alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\series bold
static methods:
\end_layout

\end_inset
</cell>
<cell multicolumn="2" alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
const char *signature()
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
signature of the function or attribute
\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
unsigned id()
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
identification of the join point
\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
AC::JPType jptype()
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
type of join point
\end_layout

\end_inset
</cell>
</row>
<row topline="true">
<cell multicolumn="1" alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\series bold
types:
\end_layout

\end_inset
</cell>
<cell multicolumn="2" alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\end_layout

\end_inset
</cell>
</row>
<row topline="true" bottomline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
Aspect
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
type of the aspect
\end_layout

\end_inset
</cell>
</row>
</lyxtabular>

\end_inset


\end_layout

\begin_layout Caption

\family typewriter
JoinPoint
\family default
 API for introductions
\end_layout

\end_inset


\end_layout

\begin_layout Standard
In difference to the API available for advice code the API for introduction
 only provides static information about a join point.
 A nice demonstration of this API is shown in the following example.
\end_layout

\begin_layout Subsubsection*
Example: static type identification using introductions
\begin_inset LatexCommand \label{exa:static-type-id}

\end_inset


\end_layout

\begin_layout LyX-Code
aspect TypeInfo {
\newline
  pointcut virtual typed() = 0;
\newline
  
\newline
  advice typed() : static
 unsigned type_id() {
\newline
    return JoinPoint::id();
\newline
  }
\newline
  
\newline
  advice typed() :
 virtual unsigned type() { 
\newline
    return type_id(); 
\newline
  }
\newline
};
\end_layout

\begin_layout Standard
The first introduction of this aspect introduces a static method 
\family typewriter
type_id
\family default
 into a set of classes returning an unique integer value.
 By introducing a second non-static but virtual method type into these classes
 also returning the unique integer value a type identification can be realized
 like this:
\end_layout

\begin_layout LyX-Code
if (obj->type() == AClass::type_id())
\newline
  ...
\newline
else if (obj->type() == AnotherClass::typ
e_id())
\newline
  ...
\end_layout

\begin_layout Standard
This implements a nice alternative to the C++ RTTI mechanism especially
 when the RTTI support of a compiler is switched off.
 
\end_layout

\begin_layout Standard
Code of introductions have to use the type 
\family typewriter
Aspect
\family default

\begin_inset LatexCommand \index{Aspect@\texttt{Aspect}}

\end_inset


\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!Aspect@\texttt{Aspect}}

\end_inset

 to get access to the methods and attributes of an aspect, e.g.\InsetSpace ~
by calling
 
\family typewriter
Aspect::aspectof()
\family default
.
 Because the static function 
\family typewriter
aspectof
\family default

\begin_inset LatexCommand \index{aspectof@\texttt{aspectof()}}

\end_inset

 is always generated for an aspect, except when it is already explicitly
 defined, 
\family typewriter
aspectof
\family default
 always returns the actual aspect instance.
 By courtesy of this technique the example 
\begin_inset LatexCommand \vpageref{exa:aspect-decl}

\end_inset

 can be changed to provide not only the count of all threads but to provide
 a count for every thread.
\end_layout

\begin_layout Subsubsection*
Example: 
\begin_inset LatexCommand \label{exa:extended-thread}

\end_inset

extended thread counting
\begin_inset LatexCommand \index{runtime support|)}

\end_inset


\begin_inset LatexCommand \index{runtime support!for introductions|)}

\end_inset


\begin_inset LatexCommand \index{introduction!runtime support|)}

\end_inset


\end_layout

\begin_layout LyX-Code
aspect Counter { 
\newline
  int m_count;
\newline
  ...
\newline
  advice counted() : class Helper {
\newline
   
 Helper() { Aspect::aspectof()->m_count++; }
\newline
  } m_counter;
\newline
  ...
\newline
};
\end_layout

\begin_layout Standard
\begin_inset ERT
status collapsed

\begin_layout Standard

\end_layout

\begin_layout Standard

\end_layout

\begin_layout Standard


\backslash
end{comment}
\end_layout

\begin_layout Standard

\end_layout

\end_inset


\end_layout

\begin_layout Section
\begin_inset LatexCommand \label{sec:Match-Expressions}

\end_inset

Match Expressions
\begin_inset LatexCommand \index{match expression|(}

\end_inset


\begin_inset LatexCommand \index{search pattern!match expression|(}

\end_inset


\end_layout

\begin_layout Standard
Match expressions are a used to describe a set of statically known program
 entities in an AspectC++ program.
 They can either be match expressions for functions or for types.
 A class is seen as a special kind of type in this context.
 
\end_layout

\begin_layout Standard
For function matching a match expression is internally decomposed into the
 function type pattern
\begin_inset LatexCommand \index{type pattern}

\end_inset

, the scope pattern
\begin_inset LatexCommand \index{scope pattern}

\end_inset

, and the name pattern
\begin_inset LatexCommand \index{name pattern}

\end_inset

.
\end_layout

\begin_layout Subsubsection*
Example: type, scope, and name parts of a function match expression 
\family typewriter

\begin_inset LatexCommand \label{exa:match-expr-parts}

\end_inset


\end_layout

\begin_layout LyX-Code
"const % Puma::...::parse_% (Token *)"
\end_layout

\begin_layout Standard
This match expression describes the following requirements on a compared
 function name:
\end_layout

\begin_layout Description
name: the function name has to match the name pattern 
\family typewriter
parse_%
\end_layout

\begin_layout Description
scope: the scope in which the function is defined has to match 
\family typewriter
Puma::...::
\end_layout

\begin_layout Description
type: the function type has to match 
\family typewriter
const %(Token *)
\end_layout

\begin_layout Standard
For classes and other types this decomposion is not necessary.
 For example, the type name 
\begin_inset Quotes eld
\end_inset


\family typewriter
Puma::CCParser
\family default

\begin_inset Quotes erd
\end_inset

 is sufficient to describe a class, because this is the same as the class
 name.
\end_layout

\begin_layout Standard
If an entity matches all parts of the match expression, it becomes an element
 of the set, which should be defined by the match expression.
\end_layout

\begin_layout Standard
The grammar used for match expression parsing is shown in appendix 
\begin_inset LatexCommand \vref{sec:Match-Expression-Grammar}

\end_inset

.
 The following subsections separately describe the name, scope, and type
 matching mechanisms.
 Note, that name and scope matching is used for matching of function names
 as well as matching of named types like classes.
\end_layout

\begin_layout Subsection
\begin_inset LatexCommand \label{sub:Name-Matching}

\end_inset

Name Matching
\begin_inset LatexCommand \index{match expression!name matching|(}

\end_inset


\begin_inset LatexCommand \index{name matching|(}

\end_inset


\end_layout

\begin_layout Subsubsection
Simple Name Matching
\end_layout

\begin_layout Standard
Name matching is trivial as long as the compared name is a normal C++ identifier.
 If the 
\emph on
name pattern
\emph default
 
\begin_inset LatexCommand \index{name pattern}

\end_inset

 does 
\emph on
not
\emph default
 contain the special wildcard character %
\begin_inset LatexCommand \index{\%}

\end_inset

, it matches a name only if it is exactly the same.
 Otherwise each wildcard character matches an arbitrary sequence of characters
 in the compared name.
 The wildcard character also matches an empty sequence.
\end_layout

\begin_layout Subsubsection*
Example: simple name patterns 
\family typewriter

\begin_inset LatexCommand \label{exa:match-name-patterns}

\end_inset


\family default

\begin_inset LatexCommand \index{match expression!simple name pattern}

\end_inset


\begin_inset LatexCommand \index{simple name pattern}

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="5" columns="2">
<features>
<column alignment="left" valignment="top" width="0">
<column alignment="block" valignment="top" width="12cm">
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
Token
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
only matches 
\family typewriter
Token
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
%
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches any name
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
parse_%
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches any name beginning with 
\family typewriter
parse_
\family default
 like 
\family typewriter
parse_declarator
\family default
 or 
\family typewriter
parse_
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
parse_%_id%
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches names like 
\family typewriter
parse_type_id
\family default
, 
\family typewriter
parse_private_identifier
\family default
, etc.
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
%_token
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches all names that end with 
\family typewriter
_token
\family default
 like 
\family typewriter
start_token
\family default
, 
\family typewriter
end_token
\family default
, and 
\family typewriter
_token
\end_layout

\end_inset
</cell>
</row>
</lyxtabular>

\end_inset


\begin_inset VSpace bigskip
\end_inset


\end_layout

\begin_layout Subsubsection
Operator Function and Conversion Function Name Matching
\end_layout

\begin_layout Standard
The name matching mechanism is more complicated if the pattern is compared
 with the name of a conversion function or an operator function.
 Both are matched by the name pattern 
\family typewriter
%
\family default

\begin_inset LatexCommand \index{\%}

\end_inset

.
 However, with a different name pattern than 
\family typewriter
%
\family default
 they are only matched if the pattern begins with "
\family typewriter
operator
\family default
\InsetSpace ~
".
 The pattern "
\family typewriter
operator\InsetSpace ~
%
\family default
" matches any operator function or conversion function name.
\end_layout

\begin_layout Standard
C++ defines a fixed set of operators which are allowed to be overloaded.
 In a name pattern the same operators may be used after the "
\family typewriter
operator
\family default
\InsetSpace ~
" prefix to match a specific operator function name.
 Operator names in name patterns are not allowed to contain the wildcard
 character.
 For ambiguity resolution the operators 
\family typewriter
%
\family default
 and 
\family typewriter
%=
\family default
 are matched by 
\family typewriter
%%
\family default
 and 
\family typewriter
%%=
\family default
 
\begin_inset LatexCommand \index{\%\%}

\end_inset

in a name pattern.
\end_layout

\begin_layout Subsubsection*
Example: operator name patterns
\begin_inset LatexCommand \index{match expression!operator name pattern}

\end_inset


\begin_inset LatexCommand \index{operator name pattern}

\end_inset

 
\family typewriter

\begin_inset LatexCommand \label{exa:match-operator-name-patterns}

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="2">
<features>
<column alignment="left" valignment="top" width="0">
<column alignment="block" valignment="top" width="11cm">
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
operator\InsetSpace ~
%
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches any operator function name (as well as any conversion function name)
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
operator\InsetSpace ~
+=
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches only the name of a 
\family typewriter
+=
\family default
 operator
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
operator\InsetSpace ~
%%
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches the name of an 
\family typewriter
operator\InsetSpace ~
%
\end_layout

\end_inset
</cell>
</row>
</lyxtabular>

\end_inset


\begin_inset VSpace bigskip
\end_inset


\end_layout

\begin_layout Standard
Conversion functions don't have a real name.
 For example, the conversion function 
\family typewriter
operator int*()
\family default
 defined in a class 
\family typewriter
C
\family default
 defines a conversion from a 
\family typewriter
C
\family default
 instance into an object of type 
\family typewriter
int*
\family default
.
 To match conversion functions the name pattern may contain a type pattern
 after the prefix "
\family typewriter
operator 
\family default
".
 The type matching mechanism is explained in section 
\begin_inset LatexCommand \ref{sub:Type-Matching}

\end_inset

.
\end_layout

\begin_layout Subsubsection*
Example: conversion function name patterns
\begin_inset LatexCommand \index{match expression!conversion function name pattern}

\end_inset


\begin_inset LatexCommand \index{conversion function name pattern}

\end_inset

 
\family typewriter

\begin_inset LatexCommand \label{exa:match-conversion-function-name-patterns}

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="2">
<features>
<column alignment="left" valignment="top" width="0">
<column alignment="block" valignment="top" width="11cm">
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
operator\InsetSpace ~
%
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches any conversion function name
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
operator\InsetSpace ~
int*
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches any name of a conversion that converts something into an 
\family typewriter
int*
\family default
 object
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
operator\InsetSpace ~
%*
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches any conversion function name if that function converts something
 into a pointer
\end_layout

\end_inset
</cell>
</row>
</lyxtabular>

\end_inset


\begin_inset VSpace bigskip
\end_inset


\end_layout

\begin_layout Subsubsection
Constructors and Destructors
\end_layout

\begin_layout Standard
Name patterns cannot be used to match constructor or destructor names.
\end_layout

\begin_layout Subsubsection
Scope Restrictions
\end_layout

\begin_layout Standard
In a match expression a name pattern can optionally be prefixed by a scope
 pattern.
 A scope pattern (see section 
\begin_inset LatexCommand \ref{sub:Scope-Matching}

\end_inset

) is used to describe restrictions on the definition scope of matched entities.
 If no scope pattern is given, a compared function or type has to be defined
 in the global scope to be matched.
\begin_inset LatexCommand \index{name matching|)}

\end_inset


\begin_inset LatexCommand \index{match expression!name matching|)}

\end_inset


\begin_inset VSpace bigskip
\end_inset


\end_layout

\begin_layout Subsection
\begin_inset LatexCommand \label{sub:Scope-Matching}

\end_inset

Scope Matching
\begin_inset LatexCommand \index{match expression!scope matching|(}

\end_inset


\begin_inset LatexCommand \index{scope matching|(}

\end_inset


\end_layout

\begin_layout Standard
Restrictions on definition scopes can be described by 
\emph on
scope patterns
\emph default

\begin_inset LatexCommand \index{scope pattern}

\end_inset

.
 This is a sequence of name patterns (or the special 
\emph on
any scope sequence
\emph default
 
\begin_inset LatexCommand \index{any scope sequence}

\end_inset

pattern 
\family typewriter
...
\family default

\begin_inset LatexCommand \index{...}

\end_inset

), which are separated by 
\family typewriter
::
\family default
, like in 
\family typewriter
Puma::...::
\family default
.
 A scope pattern always ends with 
\family typewriter
::
\family default
 and should never start with 
\family typewriter
::
\family default
, because scope patterns are interpreted relative to the global scope anyway
\begin_inset Foot
status collapsed

\begin_layout Standard
This restriction is also needed to avoid ambiguities in the match expression
 grammer: Does 
\begin_inset Quotes eld
\end_inset


\family typewriter
A\InsetSpace ~
::\InsetSpace ~
B\InsetSpace ~
::\InsetSpace ~
C(int)
\family default

\begin_inset Quotes erd
\end_inset

 mean 
\begin_inset Quotes eld
\end_inset


\family typewriter
A\InsetSpace ~
::B::C(int)
\family default

\begin_inset Quotes erd
\end_inset

 or 
\begin_inset Quotes eld
\end_inset


\family typewriter
A::B\InsetSpace ~
::C(int)
\family default

\begin_inset Quotes erd
\end_inset

?
\end_layout

\end_inset

.
 The definition scope can either be a namespace or a class.
\end_layout

\begin_layout Standard
A scope pattern matches the definition scope of a compared function or type
 if every part can successfully be matched with a corresponding part in
 the qualified name of the definition scope.
 The compared qualified name has to be relative to the global scope and
 should not start with 
\family typewriter
::
\family default
, which is optional in a C++ nested-name-specifier.
 The special 
\family typewriter
...

\family default
 pattern matches any (even empty) sequence of scope names.
\end_layout

\begin_layout Subsubsection*
Example: scope patterns 
\family typewriter

\begin_inset LatexCommand \label{exa:match-scope-patterns}

\end_inset


\family default

\begin_inset LatexCommand \index{match expression!scope pattern}

\end_inset


\begin_inset LatexCommand \index{scope pattern}

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="4" columns="2">
<features>
<column alignment="left" valignment="top" width="0">
<column alignment="block" valignment="top" width="11cm">
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
...::
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches any definition scope, even the global scope
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
Puma::CCParser::
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches the scope 
\family typewriter
Puma::CCParser
\family default
 exactly
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
...::%Compiler%::
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches any class or namespace, which matches the name pattern 
\family typewriter
%Compiler%
\family default
, in any scope
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
Puma::...::
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches any scope defined within the class or namespace 
\family typewriter
Puma 
\family default
and 
\family typewriter
Puma
\family default
 itself
\end_layout

\end_inset
</cell>
</row>
</lyxtabular>

\end_inset


\begin_inset LatexCommand \index{scope matching|)}

\end_inset


\begin_inset LatexCommand \index{match expression!scope matching|)}

\end_inset


\begin_inset VSpace bigskip
\end_inset


\end_layout

\begin_layout Subsection
\begin_inset LatexCommand \label{sub:Type-Matching}

\end_inset

Type Matching
\begin_inset LatexCommand \index{match expression!type matching|(}

\end_inset


\begin_inset LatexCommand \index{type matching|(}

\end_inset


\end_layout

\begin_layout Subsubsection
The Match Mechanism
\end_layout

\begin_layout Standard
C++ types can be represented as a tree.
 For example, the function type 
\family typewriter
int(double)
\family default
 is a function type node with two children, one is an 
\family typewriter
int
\family default
 node, the other a 
\family typewriter
double
\family default
 node.
 Both children are leafs of the tree.
\end_layout

\begin_layout Standard
The types used in match expressions can also be interpreted as trees.
 As an addition to normal C++ types they can also contain the %
\begin_inset LatexCommand \index{\%}

\end_inset

 wildcard character, name patterns, and scope patterns.
 A single wildcard character in a type pattern becomes a special 
\emph on
any type node
\emph default
 
\begin_inset LatexCommand \index{any type node}

\end_inset

 in the tree representation.
\end_layout

\begin_layout Standard
For comparing a type pattern with a specific type the tree representation
 is used and the 
\emph on
any type node
\emph default
 matches an arbitrary type (sub-)tree.
 
\end_layout

\begin_layout Subsubsection*
Example: type patterns with the wildcard character 
\family typewriter

\begin_inset LatexCommand \label{exa:match-type-patterns-wildcard}

\end_inset


\family default

\begin_inset LatexCommand \index{match expression!type pattern with \%}

\end_inset


\begin_inset LatexCommand \index{type pattern with \%}

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="2">
<features>
<column alignment="left" valignment="top" width="0">
<column alignment="block" valignment="top" width="11cm">
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
%
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches any type
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
void (*)(%)
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches any pointer type that points to functions with a single argument
 and a 
\family typewriter
void
\family default
 result type
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
%*
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches any pointer type
\end_layout

\end_inset
</cell>
</row>
</lyxtabular>

\end_inset


\begin_inset VSpace bigskip
\end_inset


\end_layout

\begin_layout Subsubsection
Matching of Named Types
\end_layout

\begin_layout Standard
Type patterns may also contain name and scope patterns.
 They become a 
\emph on
named type node
\begin_inset LatexCommand \index{named type}

\end_inset


\emph default
 in the tree representation and match any union, struct, class, or enumeration
 type if its name and scope match the given pattern (see section 
\begin_inset LatexCommand \ref{sub:Name-Matching}

\end_inset

 and 
\begin_inset LatexCommand \ref{sub:Scope-Matching}

\end_inset

).
\end_layout

\begin_layout Subsubsection
Matching of 
\begin_inset Quotes eld
\end_inset

Pointer to Member
\begin_inset Quotes erd
\end_inset

 Types
\end_layout

\begin_layout Standard
Patterns for pointers to members
\begin_inset LatexCommand \index{pointer to member}

\end_inset

 also contain a scope pattern, e.g.
 
\family typewriter
%\InsetSpace ~
(Puma::CSyntax::*)()
\family default
.
 In this context the scope pattern is mandatory.
 The pattern is used for matching the class associated with a pointer to
 member type.
\end_layout

\begin_layout Subsubsection
Matching of Qualified Types (
\family typewriter
const
\family default
/
\family typewriter
volatile
\family default
)
\end_layout

\begin_layout Standard
Many C++ types can be qualified as 
\family typewriter
const
\family default
 
\begin_inset LatexCommand \index{const}

\end_inset

or 
\family typewriter
volatile
\family default

\begin_inset LatexCommand \index{volatile}

\end_inset

.
 In a type pattern these qualifier can also be used, but they are interpreted
 restrictions.
 If no 
\family typewriter
const
\family default
 or 
\family typewriter
volatile
\family default
 qualifier is given in a type pattern, the pattern also matches qualified
 types
\begin_inset Foot
status open

\begin_layout Standard
Matching only non-constant or non-volatile types can be achieved by using
 the operators explained in section 
\begin_inset LatexCommand \vref{sub:Algebraic-Operators}

\end_inset

.
 For example, 
\family typewriter
!"const\InsetSpace ~
%"
\family default
 describes all types which are not constant.
\end_layout

\end_inset

.
\end_layout

\begin_layout Subsubsection*
Example: type patterns with 
\family typewriter
const
\family default
 and 
\family typewriter
volatile
\family default
 
\family typewriter

\begin_inset LatexCommand \label{exa:match-type-patterns-cv}

\end_inset


\family default

\begin_inset LatexCommand \index{match expression!type pattern with cv qualifier}

\end_inset


\begin_inset LatexCommand \index{type pattern with cv qualifier}

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="2">
<features>
<column alignment="left" valignment="top" width="0">
<column alignment="block" valignment="top" width="9cm">
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
%
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches any type, even types qualified with 
\family typewriter
const
\family default
 or 
\family typewriter
volatile
\family default
 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
const %
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches only types qualified by 
\family typewriter
const
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
% (*)() const volatile
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches the type of all pointers to functions that are qualified by 
\family typewriter
const
\family default
 and 
\family typewriter
volatile
\end_layout

\end_inset
</cell>
</row>
</lyxtabular>

\end_inset


\begin_inset VSpace bigskip
\end_inset


\end_layout

\begin_layout Subsubsection
Handling of Conversion Function Types
\end_layout

\begin_layout Standard
The result type of conversion functions is interpreted as a special 
\emph on
undefined
\emph default
 type in type patterns as well as in compared types.
 The 
\emph on
undefined
\emph default
 
\begin_inset LatexCommand \index{undefined type}

\end_inset

 type is only matched by the 
\emph on
any type
\emph default
 node and the 
\emph on
undefined type
\emph default
 node.
\end_layout

\begin_layout Subsubsection
Ellipses in Function Type Patterns
\end_layout

\begin_layout Standard
In the list of function argument types the type pattern 
\family typewriter
...

\family default
 
\begin_inset LatexCommand \index{...}

\end_inset

can be used to match an arbitrary (even empty) list of types.
 The 
\family typewriter
...

\family default
 pattern should not be followed by other argument type patterns in the list
 of argument types.
\end_layout

\begin_layout Subsubsection
Matching of Virtual Functions
\end_layout

\begin_layout Standard
The 
\emph on
decl-specifier-seq
\emph default
 of a function type match expression may include the keyword 
\family typewriter
\size small
virtual
\family default
\size default
.
 In this case the function type match expression only matches virtual or
 pure virtual member functions.
 As 
\family typewriter
\size small
const
\family default
\size default
 and 
\family typewriter
\size small
volatile
\family default
\size default
, the 
\family typewriter
\size small
virtual
\family default
\size default
 keyword is regarded as a restriction.
 This means that a function type match expression without 
\family typewriter
\size small
virtual
\family default
\size default
 matches virtual and non-virtual functions.
\end_layout

\begin_layout Subsubsection*
Example: type patterns with 
\family typewriter
virtual
\family default
 
\family typewriter

\begin_inset LatexCommand \label{exa:match-type-patterns-virtual}

\end_inset


\family default

\begin_inset LatexCommand \index{match expression!type pattern with virtual keyword}

\end_inset


\begin_inset LatexCommand \index{type pattern with virtual keyword}

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="2">
<features>
<column alignment="left" valignment="top" width="0">
<column alignment="block" valignment="top" width="9cm">
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
virtual % ...::%(...)
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches all virtual or pure virtual functions in any scope
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
% C::%(...)
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard
matches all member functions of C, even if they are virtual
\end_layout

\end_inset
</cell>
</row>
</lyxtabular>

\end_inset


\begin_inset VSpace bigskip
\end_inset


\end_layout

\begin_layout Subsubsection
Argument Type Adjustment
\end_layout

\begin_layout Standard
Argument types 
\begin_inset LatexCommand \index{argument types}

\end_inset

 in type patterns are adjusted according to the usual C++ rules, i.e.
 array and function types are converted to pointers to the given type and
 
\family typewriter
const
\family default
/
\family typewriter
volatile
\family default
 qualifiers are removed.
 Futhermore, argument type lists containing a single 
\family typewriter
void
\family default
 type are converted into an empty argument type list.
\begin_inset LatexCommand \index{type matching|)}

\end_inset


\begin_inset LatexCommand \index{match expression!type matching|)}

\end_inset


\end_layout

\begin_layout Description
\begin_inset LatexCommand \index{match expression|)}

\end_inset


\begin_inset LatexCommand \index{search pattern!match expression|)}

\end_inset


\end_layout

\begin_layout Section
Predefined Pointcut Functions
\begin_inset LatexCommand \label{sec:Predefined}

\end_inset


\begin_inset LatexCommand \index{pointcut function|(}

\end_inset


\begin_inset LatexCommand \index{pointcut!function|(}

\end_inset


\end_layout

\begin_layout Standard
On the following pages a complete list of the pointcut functions supported
 by AspectC++ is presented.
 For every pointcut function it is indicated which type of pointcut is expected
 as argument(s) and of which type the result pointcut is.
 Thereby 
\begin_inset Quotes eld
\end_inset

N
\begin_inset Quotes erd
\end_inset

 stands for name pointcut and 
\begin_inset Quotes eld
\end_inset

C
\begin_inset Quotes erd
\end_inset

 for code pointcut.
 The optionally given index is an assurance about the type of join point(s)
 described by the result pointcut
\begin_inset Foot
status collapsed

\begin_layout Standard
C, C
\begin_inset Formula $_{\textrm{C}}$
\end_inset

, C
\begin_inset Formula $_{\textrm{E}}$
\end_inset

, C
\begin_inset Formula $_{\textrm{S}}$
\end_inset

, C
\begin_inset Formula $_{\textrm{G}}$
\end_inset

: Code (any, only 
\emph on
\bar under
C
\bar default
all
\emph default
, only 
\emph on
\bar under
E
\bar default
xecution
\emph default
, only 
\emph on
\bar under
S
\bar default
et
\emph default
, only 
\emph on
\bar under
G
\bar default
et
\emph default
); N, N
\begin_inset Formula $_{N}$
\end_inset

, N
\begin_inset Formula $_{C}$
\end_inset

, N
\begin_inset Formula $_{F}$
\end_inset

, N
\begin_inset Formula $_{T}$
\end_inset

: Names (any, only 
\emph on
\bar under
N
\bar default
amespace
\emph default
, only 
\emph on
\bar under
C
\bar default
lass
\emph default
, only 
\emph on
\bar under
F
\bar default
unction
\emph default
, only 
\emph on
\bar under
T
\bar default
ype
\emph default
)
\end_layout

\end_inset

.
 
\end_layout

\begin_layout Subsection
Types
\end_layout

\begin_layout Description
base
\series medium
(
\emph on
pointcut
\emph default
)
\family typewriter
\series default
 
\family default

\begin_inset LatexCommand \index{base@\texttt{base()}}

\end_inset


\begin_inset LatexCommand \index{pointcut function!base@\texttt{base()}}

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
hfill 
\end_layout

\end_inset

N
\begin_inset Formula $\rightarrow$
\end_inset

N
\begin_inset Formula $_{C,F}$
\end_inset


\newline
returns all base classes 
\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
begin{comment}
\end_layout

\end_inset

resp.\InsetSpace ~
redefined functions 
\begin_inset ERT
status collapsed

\begin_layout Standard

\end_layout

\begin_layout Standard

\end_layout

\begin_layout Standard


\backslash
end{comment}
\end_layout

\begin_layout Standard

\end_layout

\end_inset

of classes in the pointcut
\end_layout

\begin_layout Description
derived
\series medium
(
\emph on
pointcut
\emph default
)
\family typewriter
\series default
 
\family default

\begin_inset LatexCommand \index{derived@\texttt{derived()}}

\end_inset


\begin_inset LatexCommand \index{pointcut function!derived@\texttt{derived()}}

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
hfill 
\end_layout

\end_inset

N
\begin_inset Formula $\rightarrow$
\end_inset

N
\begin_inset Formula $_{C,F}$
\end_inset


\newline
returns all classes in the pointcut and all classes derived from them
\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
begin{comment}
\end_layout

\end_inset

 resp.\InsetSpace ~
all redefined functions of derived classes
\begin_inset ERT
status collapsed

\begin_layout Standard

\end_layout

\begin_layout Standard

\end_layout

\begin_layout Standard


\backslash
end{comment}
\end_layout

\begin_layout Standard

\end_layout

\end_inset


\end_layout

\begin_layout Subsubsection*
Example: type matching
\begin_inset LatexCommand \label{exa:type-matching}

\end_inset


\end_layout

\begin_layout Standard
A software may contain the following class hierarchy.
 
\end_layout

\begin_layout LyX-Code
class Shape { ...
 };
\newline
class Point : public Shape { ...
 };
\newline
...
\newline
class Rectangle : public Line, public Rotatable { ...
 };
\end_layout

\begin_layout Standard
With the following aspect a special feature is added to a designated set
 of classes of this class hierarchy.
\end_layout

\begin_layout LyX-Code
aspect Scale {
\newline
  pointcut scalable() = 
\newline
    (base("Rectangle") && derived("Point")
) || "Rectangle";
\newline
  
\newline
  advice "Point" : baseclass("Scalable");
\newline
  advice scalable()
 : void scale(int value) { ...
 }
\newline
};
\end_layout

\begin_layout Standard
The pointcut describes the classes 
\family typewriter
Point
\family default
 and 
\family typewriter
Rectangle
\family default
 and all classes derived from 
\family typewriter
Point
\family default
 that are direct or indirect base classes of 
\family typewriter
Rectangle
\family default
.
 With the first advice 
\family typewriter
Point
\family default
 gets a new base class.
 The second advice adds a corresponding method to all classes in the pointcut.
\end_layout

\begin_layout Subsection
Control Flow
\begin_inset LatexCommand \index{control flow|(}

\end_inset


\end_layout

\begin_layout Description
cflow
\series medium
(
\emph on
pointcut
\emph default
)
\family typewriter
\series default
 
\family default

\begin_inset LatexCommand \index{cflow@\texttt{cflow()}}

\end_inset


\begin_inset LatexCommand \index{pointcut function!cflow@\texttt{cflow()}}

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
hfill 
\end_layout

\end_inset

C
\begin_inset Formula $\rightarrow$
\end_inset

C
\newline
captures join points occuring in the dynamic execution context of join
 points in the pointcut.
 Currently the language features being used in the argument pointcut are
 restricted.
 The argument ist not allowed to contain any context variable bindings (see
 
\begin_inset LatexCommand \ref{sub:context}

\end_inset

) or other pointcut functions which have to be evaluated at runtime like
 
\series bold
cflow
\series default
(
\emph on
pointcut
\emph default
) itself.
\end_layout

\begin_layout Subsubsection*
Example: control flow dependant advice activation
\begin_inset LatexCommand \label{exa:control-flow}

\end_inset


\end_layout

\begin_layout Standard
The following example demonstrates the use of the 
\series bold
cflow
\series default
 pointcut function.
\end_layout

\begin_layout LyX-Code
class Bus {
\newline
  void out (unsigned char);
\newline
  unsigned char in ();
\newline
};
\end_layout

\begin_layout Standard
Consider the class 
\family typewriter
Bus
\family default
 shown above.
 It might be part of an operating system kernel and is used there to access
 peripheral devices via a special I/O bus.
 The execution of the member functions 
\family typewriter
in()
\family default
 and 
\family typewriter
out()
\family default
 should not be interrupted, because this would break the timing of the bus
 communication.
 Therefore, we decide to implement an interrupt synchronization aspect that
 disables interrupts during the execution of in() and out():
\end_layout

\begin_layout LyX-Code
aspect BusIntSync {
\newline
  pointcut critical() = execution("% Bus::%(...)");
\newline
  advice
 critical() && !cflow(execution("% os::int_handler()")) : 
\newline
  around() {
\newline
 
   os::disable_ints();
\newline
    tjp->proceed();
\newline
    os::enable_ints();
\newline
  }
\newline
};
\end_layout

\begin_layout Standard
As the bus driver code might also be called from an interrupt handler, the
 interrupts should not be disabled in any case.
 Therefore, the pointcut expression exploits the 
\series bold
cflow()
\series default
 pointcut function to add a runtime condition for the advice activation.
 The advice body should only be executed if the control flow did not come
 from the interrupt handler 
\family typewriter
os::int_handler()
\family default
, because it is not interruptable by definition and 
\family typewriter
os::enable_ints()
\family default
 in the advice body would turn on the interrupts too early.
\begin_inset LatexCommand \index{control flow|)}

\end_inset


\end_layout

\begin_layout Subsection
Scope
\end_layout

\begin_layout Description
within
\series medium
(
\emph on
pointcut
\emph default
)
\family typewriter
\series default
 
\family default

\begin_inset LatexCommand \index{within@\texttt{within()}}

\end_inset


\begin_inset LatexCommand \index{pointcut function!within@\texttt{within()}}

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
hfill 
\end_layout

\end_inset

N
\begin_inset Formula $\rightarrow$
\end_inset

C
\newline
filters all join points that are within the functions or classes in the
 pointcut
\end_layout

\begin_layout Subsubsection*
Example: matching in scopes
\begin_inset LatexCommand \label{exa:matching-in-scopes}

\end_inset


\end_layout

\begin_layout LyX-Code
aspect Logger {
\newline
  pointcut calls() = 
\newline
    call("void transmit()") && within("Trans
mitter");
\newline
  
\newline
  advice calls() : around() {
\newline
    cout << "transmitting ...
 " << flush;
\newline
    tjp->proceed();
\newline
    cout << "finished." << endl;
\newline
  }
\newline
};
\end_layout

\begin_layout Standard
This aspect inserts code logging all calls to 
\family typewriter
transmit
\family default
 that are within the methods of class 
\family typewriter
Transmitter
\family default
.
 
\end_layout

\begin_layout Subsection
Functions
\end_layout

\begin_layout Description
call
\series medium
(
\emph on
pointcut
\emph default
)
\family typewriter
\series default
 
\family default

\begin_inset LatexCommand \index{call@\texttt{call()}}

\end_inset


\begin_inset LatexCommand \index{pointcut function!call@\texttt{call()}}

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
hfill 
\end_layout

\end_inset

N
\begin_inset Formula $\rightarrow$
\end_inset

C
\begin_inset Formula $_{C}$
\end_inset


\newline
Provides all join points where a named entity in the pointcut is called.
 The pointcut may contain function names or class names.
 In the case of a class name all calls to methods of that class are provided.
\end_layout

\begin_layout Description
execution
\series medium
(
\emph on
pointcut
\emph default
)
\family typewriter
\series default
 
\family default

\begin_inset LatexCommand \index{execution@\texttt{execution()}}

\end_inset


\begin_inset LatexCommand \index{pointcut function!execution@\texttt{execution()}}

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
hfill 
\end_layout

\end_inset

N
\begin_inset Formula $\rightarrow$
\end_inset

C
\begin_inset Formula $_{E}$
\end_inset


\newline
provides all join points referring to the implementation of a named entity
 in the pointcut.
 The pointcut may contain function names or class names.
 In the case of a class name all implementations of methods of that class
 are provided.
\end_layout

\begin_layout Subsubsection*
Example: function matching
\begin_inset LatexCommand \label{exa:function-matching}

\end_inset


\end_layout

\begin_layout Standard
The following aspect weaves debugging code into a program that checks whether
 a method is called on a null pointer and whether the argument of the call
 is null.
\end_layout

\begin_layout LyX-Code
aspect Debug {
\newline
  pointcut fct() = "% MemPool::dealloc(void*)";
\newline
  pointcut
 exec() = execution(fct());
\newline
  pointcut calls() = call(fct());
\newline
  
\newline
  advice exec()
 && args(ptr) : before(void *ptr) {
\newline
    assert(ptr && "argument is NULL");
\newline

  }
\newline
  advice calls() : before() {
\newline
    assert(tjp->target() && "'this' is NULL");
\newline

  }
\newline
};
\end_layout

\begin_layout Standard
The first advice provides code to check the argument of the function 
\family typewriter
dealloc
\family default
 before the function is executed.
 A check whether 
\family typewriter
dealloc
\family default
 is called on a null object is provided by the second advice.
 This is realized by checking the target of the call.
\end_layout

\begin_layout Subsection
Object Construction and Destruction
\end_layout

\begin_layout Description
construction
\series medium
(
\emph on
pointcut
\emph default
)
\family typewriter
\series default
 
\family default

\begin_inset LatexCommand \index{construction@\texttt{construction()}}

\end_inset


\begin_inset LatexCommand \index{pointcut function!construction@\texttt{construction()}}

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
hfill 
\end_layout

\end_inset

N
\begin_inset Formula $\rightarrow$
\end_inset

C
\begin_inset Formula $_{Cons}$
\end_inset


\newline
all join points where an instance of the given class(es) is constructed.
 The construction joinpoint begins after all base class and member construction
 joinpoints.
 It can be imagined as the execution of the constructor.
 However, advice for construction joinpoints work, even if there is no construct
or defined explicitly.
 A construction joinpoint has arguments and argument types, which can be
 exposed or filtered, e.g.
 by using the 
\series bold
args
\series default
 pointcut function.
\end_layout

\begin_layout Description
destruction
\series medium
(
\emph on
pointcut
\emph default
)
\family typewriter
\series default
 
\family default

\begin_inset LatexCommand \index{destruction@\texttt{destruction()}}

\end_inset


\begin_inset LatexCommand \index{pointcut function!destruction@\texttt{destruction()}}

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
hfill 
\end_layout

\end_inset

N
\begin_inset Formula $\rightarrow$
\end_inset

C
\begin_inset Formula $_{Des}$
\end_inset


\newline
all join points where an instance of the given class(es) is destructed.
 The destruction joinpoint ends before the destruction joinpoint of all
 members and base classes.
 It can be imagined as the execution of the destructor, although a destructor
 does not to be defined explicitly.
 A destruction joinpoint has an empty argument list.
\end_layout

\begin_layout Subsubsection*
Example: instance counting
\begin_inset LatexCommand \label{exa:instance-counting}

\end_inset


\end_layout

\begin_layout Standard
The following aspect counts how many instances of the class 
\family typewriter
ClassOfInterest
\family default
 are created and destroyed.
\end_layout

\begin_layout LyX-Code
aspect InstanceCounting { 
\newline
  // the class for which instances should be counted
 
\newline
  pointcut observed() = "ClassOfInterest";
\newline
  // count constructions and
 destructions 
\newline
  advice construction (observed ()) : before () { _created++;
 } 
\newline
  advice destruction (observed ())  : after ()  { _destroyed++; }
\newline
public:
 
\newline
  // Singleton aspects can have a default constructor 
\newline
  InstanceCounting
 () { _created = _destroyed = 0; }
\newline
private: 
\newline
  // counters
\end_layout

\begin_layout LyX-Code
  int _created;
\end_layout

\begin_layout LyX-Code
  int _destroyed;
\end_layout

\begin_layout LyX-Code
}; 
\end_layout

\begin_layout Standard
The implementation of this aspect is straightforward.
 Two counters are initialized by the aspect constructor and incremented
 by the construction/destruction advice.
 By defining 
\family typewriter
observed()
\family default
 as a pure virtual pointcut the aspect can easily be transformed into a
 reusable abstract aspect.
\end_layout

\begin_layout Standard
\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
begin{comment}
\end_layout

\end_inset


\end_layout

\begin_layout Subsection
Attributes
\end_layout

\begin_layout Standard
The 
\series bold
set
\series default
 and 
\series bold
get
\series default
 pointcut functions are not yet implemented in the AspectC++ compiler 
\series bold
ac++
\begin_inset LatexCommand \index{ac++@\texttt{ac++}}

\end_inset


\series default
.
\end_layout

\begin_layout Description
set
\series medium
(
\emph on
pointcut
\emph default
) 
\series default

\begin_inset LatexCommand \index{set@\texttt{set()}}

\end_inset


\begin_inset LatexCommand \index{pointcut function!set@\texttt{set()}}

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
hfill 
\end_layout

\end_inset

N
\begin_inset Formula $\rightarrow$
\end_inset

C
\begin_inset Formula $_{S}$
\end_inset


\newline
selects all join points where the value of an attribute or global variable
 is modified
\end_layout

\begin_layout Description
get
\series medium
(
\emph on
pointcut
\emph default
)
\family typewriter
\series default
 
\family default

\begin_inset LatexCommand \index{get@\texttt{get()}}

\end_inset


\begin_inset LatexCommand \index{pointcut function!get@\texttt{get()}}

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
hfill 
\end_layout

\end_inset

N
\begin_inset Formula $\rightarrow$
\end_inset

C
\begin_inset Formula $_{G}$
\end_inset


\newline
selects all join points where the value of an attribute or global variable
 is read
\end_layout

\begin_layout Subsubsection*
Example: attribute matching
\begin_inset LatexCommand \label{exa:attribute-matching}

\end_inset


\end_layout

\begin_layout Standard
\begin_inset ERT
status collapsed

\begin_layout Standard

\end_layout

\begin_layout Standard

\end_layout

\begin_layout Standard


\backslash
end{comment}
\end_layout

\begin_layout Standard

\end_layout

\end_inset


\end_layout

\begin_layout Subsection
\begin_inset LatexCommand \label{sub:context}

\end_inset

Context
\end_layout

\begin_layout Description
that
\series medium
(
\emph on
type\InsetSpace ~
pattern
\emph default
)
\family typewriter
\series default
 
\family default

\begin_inset LatexCommand \index{that@\texttt{that()}}

\end_inset


\begin_inset LatexCommand \index{pointcut function!that@\texttt{that()}}

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
hfill 
\end_layout

\end_inset

N
\begin_inset Formula $\rightarrow$
\end_inset

C
\newline
returns all join points where the current C++ 
\family typewriter
this
\family default
 pointer refers to an object which is an instance of a type that is compatible
 to the type described by the type pattern
\end_layout

\begin_layout Description
target
\series medium
(
\emph on
type\InsetSpace ~
pattern
\emph default
)
\family typewriter
\series default
 
\family default

\begin_inset LatexCommand \index{target@\texttt{target()}}

\end_inset


\begin_inset LatexCommand \index{pointcut function!target@\texttt{target()}}

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
hfill 
\end_layout

\end_inset

N
\begin_inset Formula $\rightarrow$
\end_inset

C
\newline
returns all join points where the target object of a call is an instance
 of a type
\emph on
 
\emph default
that is compatible to the type described by the type pattern
\end_layout

\begin_layout Description
result
\series medium
(
\emph on
type\InsetSpace ~
pattern
\emph default
)
\family typewriter
\series default
 
\family default

\begin_inset LatexCommand \index{result@\texttt{result()}}

\end_inset


\begin_inset LatexCommand \index{pointcut function!base@\texttt{base()}}

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
hfill 
\end_layout

\end_inset

N
\begin_inset Formula $\rightarrow$
\end_inset

C
\newline
returns all join points where the result object of a call/execution is
 an instance of a type matched by the type pattern
\end_layout

\begin_layout Description
args
\series medium
(
\emph on
type\InsetSpace ~
pattern
\emph default
,\InsetSpace ~
...)
\family typewriter
\series default
 
\family default

\begin_inset LatexCommand \index{args@\texttt{args()}}

\end_inset


\begin_inset LatexCommand \index{pointcut function!args@\texttt{args()}}

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
hfill 
\end_layout

\end_inset

(N,...)
\begin_inset Formula $\rightarrow$
\end_inset

C
\newline
The argument list of 
\series bold
args
\series default
 contains type patterns that are used to filter all joinpoints, e.g.
 calls to functions or function executions, with a matching signature.
 
\end_layout

\begin_layout Standard
Instead of the type pattern it is also possible here to pass the name of
 a variable to which the context information is bound (a 
\series bold
context variable
\series default
).
 In this case the type of the variable is used for the type matching.
 Context variables must be declared in the argument list of 
\series bold
before()
\series default
, 
\series bold
after()
\series default
, or 
\series bold
around()
\series default
 and can be used like a function argument in the advice body.
\end_layout

\begin_layout Standard
The 
\series bold
that()
\series default
 and 
\series bold
target()
\series default
 pointcut functions are special, because they might cause a run-time type
 check.
 The 
\series bold
args()
\series default
 and 
\series bold
result()
\series default
 functions are evaluated at compile time.
\end_layout

\begin_layout Subsubsection*
Example: context matching
\begin_inset LatexCommand \label{exa:context-matching}

\end_inset


\end_layout

\begin_layout Subsection
\begin_inset LatexCommand \label{sub:Algebraic-Operators}

\end_inset

Algebraic Operators
\end_layout

\begin_layout Description

\series medium
\emph on
pointcut
\series default
\emph default
\InsetSpace ~
&&
\series medium
\emph on
\InsetSpace ~
pointcut
\family typewriter
\series default
\emph default
 
\family default

\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
hfill 
\end_layout

\end_inset

(N,N)
\begin_inset Formula $\rightarrow$
\end_inset

N, (C,C)
\begin_inset Formula $\rightarrow$
\end_inset

C
\newline
intersection of the join points in the pointcuts
\end_layout

\begin_layout Description

\series medium
\emph on
pointcut
\series default
\emph default
\InsetSpace ~
||
\series medium
\emph on
\InsetSpace ~
pointcut
\family typewriter
\series default
\emph default
 
\family default

\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
hfill 
\end_layout

\end_inset

(N,N)
\begin_inset Formula $\rightarrow$
\end_inset

N, (C,C)
\begin_inset Formula $\rightarrow$
\end_inset

C
\newline
union of the join points in the pointcuts
\end_layout

\begin_layout Description
!
\series medium
\emph on
\InsetSpace ~
pointcut
\family typewriter
\series default
\emph default
 
\family default

\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
hfill 
\end_layout

\end_inset

N
\begin_inset Formula $\rightarrow$
\end_inset

N, C
\begin_inset Formula $\rightarrow$
\end_inset

C
\newline
exclusion of the join points in the pointcut
\end_layout

\begin_layout Subsubsection*
Example: 
\begin_inset LatexCommand \label{exa:combining-pointcut}

\end_inset

combining pointcut expressions
\begin_inset LatexCommand \index{pointcut function|)}

\end_inset


\begin_inset LatexCommand \index{pointcut!function|)}

\end_inset


\end_layout

\begin_layout Section
Slices
\end_layout

\begin_layout Standard
This section defines the syntax and semantics of slice declarations.
 The next section will describe how slices can be used by advice in order
 to introduce code.
 Currently, only class slices are defined in AspectC++.
\end_layout

\begin_layout Subsection
Class Slice Declarations
\end_layout

\begin_layout Standard
Class slices may be declared in any class or namespace scope.
 They may be defined only once, but there may be an arbitrary number forward
 declarations.
 A qualified name may be used if a class slice that is already declared
 in a certain scope is redeclared or defined as shown in the following example:
\end_layout

\begin_layout LyX-Code
slice class ASlice;
\end_layout

\begin_layout LyX-Code
namespace N {
\end_layout

\begin_layout LyX-Code
 slice class ASlice; // a different slice!
\end_layout

\begin_layout LyX-Code
}
\end_layout

\begin_layout LyX-Code
slice class ASlice { // definition of the ::ASlice
\end_layout

\begin_layout LyX-Code
  int elem;
\end_layout

\begin_layout LyX-Code
};
\end_layout

\begin_layout LyX-Code
slice class N::ASlice { // definition of the N::ASlice
\end_layout

\begin_layout LyX-Code
  long elem;
\end_layout

\begin_layout LyX-Code
};
\end_layout

\begin_layout Standard
If a class slice only defines a base class, an abbreviated syntax may be
 used:
\end_layout

\begin_layout LyX-Code
slice class Chained : public Chain;
\end_layout

\begin_layout Standard
Class slices may be anonymous.
 However, this only makes sense as part of an advice declaration.
 A class slice my also be declared with the 
\family typewriter
aspect
\family default
 or 
\family typewriter
struct
\family default
 keyword instead of 
\family typewriter
class
\family default
.
 While there is no difference between class and aspect slices, the default
 access rights to the elements of a struct slice in the target classes are
 public instead of private.
 It is forbidden to declare aspects, pointcuts, advice, or slices as members
 of a class slice.
\end_layout

\begin_layout Standard
Class slices may have members that are not defined within the body of a
 class slice declaration, e.g.
 static attributes or non-inline functions:
\end_layout

\begin_layout LyX-Code
slice class SL {
\end_layout

\begin_layout LyX-Code
  static int answer;
\end_layout

\begin_layout LyX-Code
  void f();
\end_layout

\begin_layout LyX-Code
};
\end_layout

\begin_layout LyX-Code
//...
\end_layout

\begin_layout LyX-Code
slice int SL::answer = 42;
\end_layout

\begin_layout LyX-Code
slice void SL::f() { ...
 }
\end_layout

\begin_layout Standard
These external member declarations have to appear after the corresponding
 slice declaration in the source code.
\end_layout

\begin_layout Section
Advice
\begin_inset LatexCommand \index{advice!declaration|(}

\end_inset


\end_layout

\begin_layout Standard
This section describes the different types of advice offered by AspectC++.
 Advice be categorized in advice for join points in the dynamic control
 flow of the running program, e.
 g.
 function call or executions, and advice for static join points like introductio
ns into classes.
\end_layout

\begin_layout Standard
In either case the compiler makes sure that the code of the aspect header
 file, which contains the advice definition (if this is the case), is compiled
 prior to the affected join point location.
\end_layout

\begin_layout Subsection
Advice for Dynamic Join Points
\end_layout

\begin_layout Description
before
\series medium
(...)
\family typewriter
\series default
 
\family default

\begin_inset LatexCommand \index{before}

\end_inset


\begin_inset LatexCommand \index{advice!before}

\end_inset

\InsetSpace ~

\newline
the advice code is executed before the join points in the pointcut
\end_layout

\begin_layout Description
after
\series medium
(...)
\family typewriter
\series default
 
\family default

\begin_inset LatexCommand \index{after}

\end_inset


\begin_inset LatexCommand \index{advice!after}

\end_inset

\InsetSpace ~

\newline
the advice code is executed after the join points in the pointcut
\end_layout

\begin_layout Description
around
\series medium
(...)
\family typewriter
\series default
 
\family default

\begin_inset LatexCommand \index{around}

\end_inset


\begin_inset LatexCommand \index{advice!around}

\end_inset

\InsetSpace ~

\newline
the advice code is executed in place of the join points in the pointcut
\end_layout

\begin_layout Subsection
Advice for Static Join Points
\end_layout

\begin_layout Standard
Static join points in AspectC++ are classes or aspects.
 Advice for classes or aspects can introduce new members or add a base class.
 Whether the new member or base class becomes 
\series bold
private
\series default
, 
\series bold
protected
\series default
, or 
\series bold
public
\series default
 in the target class depends on the protection in the advice declaration
 in the aspect.
\end_layout

\begin_layout Description
baseclass
\series medium
(
\emph on
classname
\emph default
)
\family typewriter
\series default
 
\family default

\begin_inset LatexCommand \index{baseclass}

\end_inset


\begin_inset LatexCommand \index{advice!baseclass}

\end_inset

\InsetSpace ~

\newline
a new base class is introduced to the classes in the pointcut 
\end_layout

\begin_layout Description

\emph on
introduction\InsetSpace ~
declaration 
\emph default

\begin_inset LatexCommand \index{introduction declaration}

\end_inset


\begin_inset LatexCommand \index{advice!introduction declaration}

\end_inset

\InsetSpace ~

\newline
a new attribute, member function, or type is introduced
\end_layout

\begin_layout Standard
Introduction declarations are only semantically analyzed in the context
 of the target.
 Therefore, the declaration may refer, for instance, to types or constants,
 which are not known in the aspect definition, but only in the target class
 or classes.
 To introduce a constructor or destructor the name of the aspect, to which
 the introduction belongs, has to be taken as the constructor/destructor
 name.
\end_layout

\begin_layout Standard

\emph on
Non-inline introductions
\emph default
 can be used for introductions of static attributes or member function introduct
ion with separate declaration an definition.
 The name of the introduced member has to be a qualified name in which the
 nested name specifier is the name of the aspect to which the introduction
 belongs.
\end_layout

\begin_layout Subsubsection*
\begin_inset LatexCommand \index{advice!declaration|)}

\end_inset


\end_layout

\begin_layout Section

\family typewriter
JoinPoint
\family default
 API
\family typewriter

\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}|(}

\end_inset


\begin_inset LatexCommand \index{runtime support!JoinPoint@\texttt{JoinPoint}|(}

\end_inset


\end_layout

\begin_layout Standard
The following sections provide a complete description of the 
\family typewriter
JoinPoint
\family default
 API.
 
\end_layout

\begin_layout Subsection
Types
\end_layout

\begin_layout Description

\family typewriter
\series medium
Result
\series default
 
\family default

\begin_inset LatexCommand \index{Result@\texttt{Result}}

\end_inset


\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!Result@\texttt{Result}}

\end_inset

\InsetSpace ~

\newline
result type of a function
\end_layout

\begin_layout Description

\family typewriter
\series medium
That
\series default
 
\family default

\begin_inset LatexCommand \index{That@\texttt{That}}

\end_inset


\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!That@\texttt{That}}

\end_inset

\InsetSpace ~

\newline
object type (object initiating a call)
\end_layout

\begin_layout Description

\family typewriter
\series medium
Target
\series default
 
\family default

\begin_inset LatexCommand \index{Target@\texttt{Target}}

\end_inset


\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!Target@\texttt{Target}}

\end_inset

\InsetSpace ~

\newline
target object type (target object of a call)
\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
begin{comment}
\end_layout

\end_inset


\end_layout

\begin_layout Description

\family typewriter
\series medium
Aspect
\family default
\series default
 
\begin_inset LatexCommand \index{Aspect@\texttt{Aspect}}

\end_inset


\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!Aspect@\texttt{Aspect}}

\end_inset

\InsetSpace ~

\newline
type of the aspect (only available in introductions)
\begin_inset ERT
status collapsed

\begin_layout Standard

\end_layout

\begin_layout Standard

\end_layout

\begin_layout Standard


\backslash
end{comment}
\end_layout

\begin_layout Standard

\end_layout

\end_inset


\end_layout

\begin_layout Subsubsection*
Example: type usage
\begin_inset LatexCommand \label{exa:type-usage}

\end_inset


\end_layout

\begin_layout Subsection
Functions
\end_layout

\begin_layout Description

\family typewriter
\series medium
static\InsetSpace ~
AC::Type
\emph on
\InsetSpace ~

\emph default
type()
\series default
 
\family default

\begin_inset LatexCommand \index{type@\texttt{type()}}

\end_inset


\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!type@\texttt{type()}}

\end_inset

\InsetSpace ~

\newline
returns the encoded type for the join point conforming with the C++ ABI
 V3 specification
\begin_inset Foot
status collapsed

\begin_layout Standard
\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
depref{http://www.codesourcery.com/cxx-abi/abi.html
\backslash
#mangling}{
\backslash
texttt{www.codesourcery.com/cxx-abi/abi.html
\backslash
#mangling}}
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Description

\family typewriter
\series medium
static\InsetSpace ~
int
\emph on
\InsetSpace ~

\emph default
args()
\series default
 
\family default

\begin_inset LatexCommand \index{args@\texttt{args()}}

\end_inset


\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!args@\texttt{args()}}

\end_inset

\InsetSpace ~

\newline
returns the number of arguments of a function for call and execution join
 points
\end_layout

\begin_layout Description

\family typewriter
\series medium
static\InsetSpace ~
AC::Type
\emph on
\InsetSpace ~

\emph default
argtype(int
\series default
\InsetSpace ~

\series medium
number)
\series default
 
\family default

\begin_inset LatexCommand \index{argtype@\texttt{argtype()}}

\end_inset


\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!argtype@\texttt{argtype()}}

\end_inset

\InsetSpace ~

\newline
returns the encoded type of an argument conforming with the C++ ABI V3 specifica
tion
\end_layout

\begin_layout Description

\family typewriter
\series medium
static\InsetSpace ~
const\InsetSpace ~
char
\series default
\emph on
\InsetSpace ~

\series medium
\emph default
*signature()
\series default
 
\family default

\begin_inset LatexCommand \index{signature@\texttt{signature()}}

\end_inset


\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!signature@\texttt{signature()}}

\end_inset

\InsetSpace ~

\newline
gives a textual description of the join point (function name, class name,
 ...)
\end_layout

\begin_layout Description

\family typewriter
\series medium
static\InsetSpace ~
unsigned\InsetSpace ~
int
\series default
\emph on
\InsetSpace ~

\series medium
\emph default
id()
\series default
 
\family default

\begin_inset LatexCommand \index{id@\texttt{id()}}

\end_inset


\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!id@\texttt{id()}}

\end_inset

\InsetSpace ~

\newline
returns a unique numeric identifier for this join point
\end_layout

\begin_layout Description

\family typewriter
\series medium
static\InsetSpace ~
const\InsetSpace ~
char
\series default
\emph on
\InsetSpace ~

\series medium
\emph default
*filename()
\series default
 
\family default

\begin_inset LatexCommand \index{filename@\texttt{filename()}}

\end_inset


\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!filename@\texttt{filename()}}

\end_inset

\InsetSpace ~

\newline
returns the name of the file in which the join-point (shadow) is located
\end_layout

\begin_layout Description

\family typewriter
\series medium
static\InsetSpace ~
int
\series default
\emph on
\InsetSpace ~

\series medium
\emph default
line()
\series default
 
\family default

\begin_inset LatexCommand \index{line@\texttt{line()}}

\end_inset


\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!line@\texttt{line()}}

\end_inset

\InsetSpace ~

\newline
the number of the line in which the join-point (shadow) is located
\end_layout

\begin_layout Description

\family typewriter
\series medium
static\InsetSpace ~
AC::Type
\emph on
\InsetSpace ~

\emph default
resulttype()
\series default
 
\family default

\begin_inset LatexCommand \index{resulttype@\texttt{resulttype()}}

\end_inset


\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!resulttype@\texttt{resulttype()}}

\end_inset

\InsetSpace ~

\newline
returns the encoded type of the result type conforming with the C++ ABI
 V3 specification
\end_layout

\begin_layout Description

\family typewriter
\series medium
static\InsetSpace ~
AC::JPType
\emph on
\InsetSpace ~

\emph default
jptype()
\series default
 
\family default

\begin_inset LatexCommand \index{jptype@\texttt{jptype()}}

\end_inset


\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!jptype@\texttt{jptype()}}

\end_inset

\InsetSpace ~

\newline
returns a unique identifier describing the type of the join point
\end_layout

\begin_layout Subsubsection*
Example: static function usage
\begin_inset LatexCommand \label{exa:static-function-usage}

\end_inset


\end_layout

\begin_layout Description

\family typewriter
\series medium
void\InsetSpace ~
*arg(int
\series default
\InsetSpace ~

\series medium
number)
\family default
\series default
 
\begin_inset LatexCommand \index{arg@\texttt{arg()}}

\end_inset


\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!arg@\texttt{arg()}}

\end_inset

\InsetSpace ~

\newline
returns a pointer to the memory position holding the argument value with
 index 
\family typewriter
number
\end_layout

\begin_layout Description

\family typewriter
\series medium
Result
\emph on
\InsetSpace ~

\emph default
*result()
\family default
\series default
 
\family typewriter

\begin_inset LatexCommand \index{result@\texttt{result()}}

\end_inset


\family default

\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!result@\texttt{result()}}

\end_inset

\InsetSpace ~

\newline
returns a pointer to the memory location designated for the result value
 or 0 if the function has no result value
\end_layout

\begin_layout Description

\family typewriter
\series medium
That\InsetSpace ~
*that()
\family default
\series default
 
\family typewriter

\begin_inset LatexCommand \index{that@\texttt{that()}}

\end_inset


\family default

\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!that@\texttt{that()}}

\end_inset

\InsetSpace ~

\newline
returns a pointer to the object initiating a call or 0 if it is a static
 method or a global function
\end_layout

\begin_layout Description

\family typewriter
\series medium
Target\InsetSpace ~
*target()
\family default
\series default
 
\family typewriter

\begin_inset LatexCommand \index{target@\texttt{target()}}

\end_inset


\family default

\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!target@\texttt{target()}}

\end_inset

\InsetSpace ~

\newline
returns a pointer to the object that is the target of a call or 0 if it
 is a static method or a global function
\end_layout

\begin_layout Description

\family typewriter
\series medium
void\InsetSpace ~
proceed()
\family default
\series default
 
\begin_inset LatexCommand \index{proceed@\texttt{proceed()}}

\end_inset


\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!proceed()@\texttt{proceed()}}

\end_inset

\InsetSpace ~

\newline
executes the original join point code in an around advice by calling 
\family typewriter
action().trigger()
\end_layout

\begin_layout Description

\family typewriter
\series medium
AC::Action\InsetSpace ~
&action()
\family default
\series default
 
\begin_inset LatexCommand \index{action@\texttt{action()}}

\end_inset


\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}!action@\texttt{action()}}

\end_inset

\InsetSpace ~

\newline
returns the runtime action object containing the execution environment to
 execute the original functionality encapsulated by an around advice
\end_layout

\begin_layout Subsubsection*
Example: 
\begin_inset LatexCommand \label{exa:non-static-function-usage}

\end_inset

non-static function usage
\family typewriter

\begin_inset LatexCommand \index{JoinPoint@\texttt{JoinPoint}|)}

\end_inset


\begin_inset LatexCommand \index{runtime support!JoinPoint@\texttt{JoinPoint}|)}

\end_inset


\end_layout

\begin_layout Section
\begin_inset LatexCommand \label{sec:ordering}

\end_inset

Advice Ordering
\begin_inset LatexCommand \index{advice!ordering|(}

\end_inset


\end_layout

\begin_layout Subsection
\begin_inset LatexCommand \label{sub:aspect-precedence}

\end_inset

Aspect Precedence
\begin_inset LatexCommand \index{precedence!of aspects|(}

\end_inset


\end_layout

\begin_layout Standard
AspectC++ provides a very flexible mechanism to define aspect precedence.
 The precedence is used to determine the execution order of advice code
 if more than one aspect affect the same join point.
 The precedence in AspectC++ is an attribute of a join point.
 This means that the precedence relationship between two aspects might vary
 in different parts of the system.
 The compiler checks the following conditions to determine the precendence
 of aspects:
\end_layout

\begin_layout Description
order\InsetSpace ~
declaration: if the programmer provides an order declaration, which
 defines the precedence relationship between two aspects for a join point,
 the compiler will obey this definition or abort with a compile-time error
 if there is a cycle in the precedence graph.
 Order declarations have the following syntax:
\family typewriter
\series bold

\newline
advice
\family default
\series default
 
\emph on
pointcut-expr
\emph default
 : 
\family typewriter
\series bold
order
\family default
\series default
 
\family typewriter
\series bold
(
\family default
\series default
 
\emph on
high
\family typewriter
\series bold
\emph default
,
\family default
\series default
 ...
\emph on
low
\emph default
 
\family typewriter
\series bold
)
\newline

\family default
\series default
The argument list of 
\family typewriter
order
\family default
 has to contain at least two elements.
 Each element is a pointcut expression, which describes a set of aspects.
 Each aspect in a certain set has a higher precedence than all aspects,
 which are part of a set following later in the list (on the right hand
 side).
 For example '
\family typewriter
("A1"||"A2","A3"||"A4")
\family default
' means that 
\family typewriter
A1
\family default
 has precedence over 
\family typewriter
A3
\family default
 and 
\family typewriter
A4
\family default
 and that 
\family typewriter
A2
\family default
 has precedence over 
\family typewriter
A3
\family default
 and 
\family typewriter
A4
\family default
.
 This order directive does 
\emph on
not
\emph default
 define the relation between 
\family typewriter
A1
\family default
 and 
\family typewriter
A2
\family default
 or 
\family typewriter
A3
\family default
 and 
\family typewriter
A4
\family default
.
 Of course, the pointcut expressions in the argument list of 
\family typewriter
order
\family default
 may contain named pointcuts and even pure virtual pointcuts.
\end_layout

\begin_layout Description
inheritance\InsetSpace ~
relation: if there is no order declaration given and one aspect
 has a base aspect the derived aspect has a higher precedence than the base
 aspect.
\end_layout

\begin_layout Subsection
\begin_inset LatexCommand \label{sub:advice-precedence}

\end_inset

Advice Precedence
\begin_inset LatexCommand \index{precedence!of advice|(}

\end_inset


\end_layout

\begin_layout Standard
The precedence of advice is determined with a very simple scheme:
\end_layout

\begin_layout Itemize
if two advice declarations belong to different aspects and there is a precedence
 relation between these aspects (see section 
\begin_inset LatexCommand \vref{sub:aspect-precedence}

\end_inset

) the same relation will be assumed for the advice.
\end_layout

\begin_layout Itemize
if two advice declarations belong to the same aspect the one that is declared
 first has the higher precedence.
\end_layout

\begin_layout Subsection
Effects of Advice Precedence
\begin_inset LatexCommand \index{precedence!effects|(}

\end_inset


\end_layout

\begin_layout Standard
Only advice predecence has an effect on the generated code.
 The effect depends on the kind of join point, which is affected by two
 advice declarations.
\end_layout

\begin_layout Subsubsection*
Class Join Points
\end_layout

\begin_layout Standard
Advice on class join points can extend the attribute list or base class
 list.
 If advice has a higher precedence than another it will be handled first.
 For example, an introduced new base class of advice with a high precedence
 will appear in the base class list on the left side of a base class, which
 was inserted by advice with lower precedence.
 This means that the execution order of the constructors of introduced base
 classes can be influenced, for instance, by order declarations.
\end_layout

\begin_layout Standard
The order of introduced attributes also has an impact on the constructor/destruc
tor execution order as well as the object layout.
\end_layout

\begin_layout Subsubsection*
Code Join Points
\end_layout

\begin_layout Standard
Advice on code join points can be 
\family typewriter
before
\family default
, 
\family typewriter
after
\family default
, or 
\family typewriter
around
\family default
 advice.
 For 
\family typewriter
before
\family default
 and 
\family typewriter
around
\family default
 advice a higher precedence means that the corresponding advice code will
 be run first.
 For 
\family typewriter
after
\family default
 advice a higher precedence means that the advice code will be run later.
\end_layout

\begin_layout Standard
If 
\family typewriter
around
\family default
 advice code does not call 
\family typewriter
tjp->proceed()
\family default
 or 
\family typewriter
trigger()
\family default
 on the action object no advice code with lower precedence will be run.
 The execution of advice with higher precedence is not affected by 
\family typewriter
around
\family default
 advice with lower precedence.
\end_layout

\begin_layout Standard
For example, consider an aspect that defines advice
\begin_inset Foot
status collapsed

\begin_layout Standard
BE is 
\family typewriter
before
\family default
 advice, AF 
\family typewriter
after
\family default
 advice, and AR 
\family typewriter
around
\family default
 advice
\end_layout

\end_inset

 in the following order: BE1, AF1, AF2, AR1, BE2, AR2, AF3.
 As described in section 
\begin_inset LatexCommand \vref{sub:advice-precedence}

\end_inset

 the declaration order also defines the precedence: BE1 has the highest
 and AF3 the lowest.
 The result is the following advice code execution sequence:
\end_layout

\begin_layout Enumerate
BE1 (highest precedence)
\end_layout

\begin_layout Enumerate
AR1 (the indented advice will only be executed if 
\family typewriter
proceed()
\family default
 is called!)
\end_layout

\begin_deeper
\begin_layout Enumerate
BE2 (before AR2, buts depends on AR1)
\end_layout

\begin_layout Enumerate
AR2 (the indented code will only be executed if 
\family typewriter
proceed()
\family default
 is called!)
\end_layout

\begin_deeper
\begin_layout Enumerate
original code under the join point
\end_layout

\begin_layout Enumerate
AF3
\end_layout

\end_deeper
\end_deeper
\begin_layout Enumerate
AF2 (does not depend on AR1 and AR2, because of higher precedence)
\end_layout

\begin_layout Enumerate
AF1 (run after AF2, because it has a higher precedence)
\end_layout

\begin_layout Section
\start_of_appendix
Grammar
\begin_inset LatexCommand \index{grammar}

\end_inset


\end_layout

\begin_layout Standard
The AspectC++ syntax is an extension to the C++ syntax.
 It adds four new keywords to the C++ language: 
\family typewriter
aspect
\family default
, 
\family typewriter
advice
\family default
, 
\family typewriter
slice
\family default
, and 
\family typewriter
pointcut
\family default
.
 Additionally it extends the C++ language by advice and pointcut declarations.
 In contrast to pointcut declarations, advice declarations may only occur
 in aspect declarations.
 
\end_layout

\begin_layout Description

\series medium
\shape italic
class-key:
\series default
\shape default
 
\series bold
\InsetSpace ~

\newline

\family typewriter
\series default
aspect
\end_layout

\begin_layout Description

\series medium
\shape italic
declaration:
\series default
 \InsetSpace ~

\newline
pointcut-declaration
\newline
slice-declaration
\newline
advice-declaration
\end_layout

\begin_layout Description

\series medium
\shape italic
member-declaration:
\series default
 \InsetSpace ~

\newline
pointcut-declaration
\newline
slice-declaration
\newline
advice-declaration
\end_layout

\begin_layout Description

\series medium
\shape italic
pointcut-declaration:
\series default
 
\emph on

\begin_inset LatexCommand \index{pointcut!declaration}

\end_inset


\emph default
\InsetSpace ~

\newline

\family typewriter
\shape default
pointcut
\family default
\shape italic
 \InsetSpace ~
declaration
\end_layout

\begin_layout Description

\series medium
\shape italic
pointcut-expression:
\series default
 
\series medium

\begin_inset LatexCommand \index{pointcut!expression}

\end_inset


\series default
\InsetSpace ~

\newline
constant-expression
\end_layout

\begin_layout Description

\series medium
\shape italic
advice-declaration:
\series default
 
\begin_inset LatexCommand \index{advice!declaration}

\end_inset

\InsetSpace ~

\newline

\family typewriter
\shape default
advice
\family default
\shape italic
 \InsetSpace ~
pointcut-expression\InsetSpace ~
 
\series bold
\shape default
:
\series default
\shape italic
 \InsetSpace ~
order-declaration
\newline

\family typewriter
\shape default
advice
\family default
\shape italic
 \InsetSpace ~
pointcut-expression\InsetSpace ~
 
\series bold
\shape default
:
\series default
\shape italic
 \InsetSpace ~
slice-reference
\newline

\family typewriter
\shape default
advice
\family default
\shape italic
 \InsetSpace ~
pointcut-expression\InsetSpace ~
 
\series bold
\shape default
:
\series default
\shape italic
 \InsetSpace ~
declaration
\end_layout

\begin_layout Description

\series medium
\shape italic
order-declaration:
\series default
 
\begin_inset LatexCommand \index{order!declaration}

\end_inset

\InsetSpace ~

\newline

\family typewriter
\shape default
order (
\family default
\shape italic
 \InsetSpace ~
pointcur-expression-seq\InsetSpace ~

\family typewriter
\shape default
)
\end_layout

\begin_layout Description

\series medium
\shape italic
slice-reference:
\series default
 
\begin_inset LatexCommand \index{slice!reference}

\end_inset

\InsetSpace ~

\newline

\family typewriter
\shape default
slice\InsetSpace ~
::
\family default
\shape italic

\begin_inset Formula $_{\textrm{opt}}$
\end_inset

\InsetSpace ~
nested-name-specifier
\begin_inset Formula $_{\textrm{opt}}$
\end_inset

 unqualified-id\InsetSpace ~

\family typewriter
\emph on
;
\end_layout

\begin_layout Description

\series medium
\shape italic
slice-declaration:
\series default

\begin_inset LatexCommand \index{slice!declaration}

\end_inset

\InsetSpace ~

\newline

\family typewriter
\emph on
slice 
\family default
\series medium
\emph default
declaration
\end_layout

\begin_layout Section
\begin_inset LatexCommand \label{sec:Match-Expression-Grammar}

\end_inset

Match Expression Grammar
\begin_inset LatexCommand \index{match expression!grammar}

\end_inset


\begin_inset LatexCommand \index{match expression grammar}

\end_inset


\end_layout

\begin_layout Standard
Match expression in AspectC++ are used to define a type pattern and an optional
 object name pattern to select a subset of the known program entities like
 functions, attributes, or argument/result types.
 The grammer is very similar to the grammer of C++ declarations.
 Any rules, which are referenced here but not defined, should be looked
 up in the ISO C++ standard.
\end_layout

\begin_layout Description

\series medium
\shape italic
match-expression:
\series default
\shape default
 
\series bold
\InsetSpace ~

\family typewriter
\series default
 
\newline

\family default
\shape italic
match-declaration
\end_layout

\begin_layout Description

\series medium
\emph on
match-id:
\series default
\emph default
 \InsetSpace ~

\newline

\family typewriter
%
\family default

\newline

\emph on
nondigit
\emph default

\newline

\emph on
match-id
\emph default
 
\family typewriter
%
\family default

\newline

\emph on
match-id nondigit
\emph default

\newline

\emph on
match-id digit
\end_layout

\begin_layout Description

\series medium
\emph on
match-declaration:
\series default
\emph default
 \InsetSpace ~

\newline

\emph on
match-decl-specifier-seq
\begin_inset Formula $_{\textrm{opt}}$
\end_inset

 match-declarator
\end_layout

\begin_layout Description

\series medium
\emph on
match-decl-specifier-seq:
\series default
\emph default
 \InsetSpace ~

\newline

\emph on
match-decl-specifier-seq
\begin_inset Formula $_{\textrm{opt}}$
\end_inset

 match-decl-specifier
\end_layout

\begin_layout Description

\series medium
\emph on
match-decl-specifier:
\series default
\emph default
 \InsetSpace ~

\newline

\emph on
nested-match-name-specifier
\begin_inset Formula $_{\textrm{opt}}$
\end_inset

 match-id
\newline
cv-qualifier
\newline
match-function-specifier
\newline

\family typewriter
\emph default
char
\newline
wchar_t
\newline
bool
\newline
short
\newline
int
\newline
long
\newline
signed
\newline
unsigned
\newline
float
\newline
double
\newline
void
\end_layout

\begin_layout Description

\series medium
\emph on
match-function-specifier:
\series default
\emph default
 \InsetSpace ~

\newline

\family typewriter
virtual
\end_layout

\begin_layout Description

\series medium
\emph on
nested-match-name-specifier:
\series default
\emph default
 \InsetSpace ~

\newline

\emph on
match-id
\family typewriter
\emph default
\InsetSpace ~
::\InsetSpace ~

\family default
\emph on
nested-match-name-specifier
\begin_inset Formula $_{\textrm{opt}}$
\end_inset


\newline

\family typewriter
\emph default
...\InsetSpace ~
::\InsetSpace ~

\family default
\emph on
nested-match-name-specifier
\begin_inset Formula $_{\textrm{opt}}$
\end_inset


\end_layout

\begin_layout Description

\series medium
\emph on
match-declarator
\series default
\emph default
: \InsetSpace ~

\newline

\emph on
direct-match-declarator
\newline
match-ptr-declarator match-declarator
\end_layout

\begin_layout Description

\series medium
\emph on
abstract-match-declarator
\series default
\emph default
: \InsetSpace ~

\newline

\emph on
direct-abstract-match-declarator
\newline
match-ptr-declarator abstract-match-declarator
\end_layout

\begin_layout Description

\series medium
\emph on
direct-match-declarator:
\series default
\emph default
 \InsetSpace ~

\newline

\emph on
match-declarator-id
\newline
direct-match-declarator 
\family typewriter
\emph default
(
\family default
\emph on
 match-parameter-declaration-clause 
\family typewriter
\emph default
)
\family default
\emph on
 cv-qualifier-seq
\begin_inset Formula $_{\textrm{opt}}$
\end_inset


\newline
direct-match-declarator 
\family typewriter
\emph default
[
\family default
\emph on
 match-array-size 
\family typewriter
\emph default
]
\end_layout

\begin_layout Description

\series medium
\emph on
direct-abstract-match-declarator:
\series default
\emph default
 \InsetSpace ~

\emph on

\newline
direct-abstract-match-declarator 
\family typewriter
\emph default
(
\family default
\emph on
 match-parameter-declaration-clause 
\family typewriter
\emph default
)
\family default
\emph on
 cv-qualifier-seq
\begin_inset Formula $_{\textrm{opt}}$
\end_inset


\newline
direct-abstract-match-declarator 
\family typewriter
\emph default
[
\family default
\emph on
 match-array-size 
\family typewriter
\emph default
]
\end_layout

\begin_layout Description

\series medium
\emph on
match-array-size:
\series default
\emph default
 \InsetSpace ~

\newline

\family typewriter
%
\family default

\newline

\emph on
decimal-literal
\end_layout

\begin_layout Description

\series medium
\emph on
match-ptr-operator:
\series default
\emph default
 \InsetSpace ~

\newline

\family typewriter
*
\family default
 
\emph on
cv-qualifier-seq
\begin_inset Formula $_{\textrm{opt}}$
\end_inset


\emph default

\newline

\family typewriter
&
\family default

\newline

\emph on
nested-match-name-specifier
\emph default
 
\family typewriter
*
\family default
 
\emph on
cv-qualifier-seq
\begin_inset Formula $_{\textrm{opt}}$
\end_inset


\end_layout

\begin_layout Description

\series medium
\emph on
match-parameter-declaration-clause:
\series default
\emph default
 \InsetSpace ~

\newline

\family typewriter
\emph on
...
\family default

\newline
match-parameter-declaration-list
\begin_inset Formula $_{\textrm{opt}}$
\end_inset


\newline
match-parameter-declaration-list
\family typewriter
 , ...
\end_layout

\begin_layout Description

\series medium
\emph on
match-parameter-declaration-list:
\series default
\emph default
 \InsetSpace ~

\newline

\emph on
match-parameter-declaration
\newline
match-parameter-declaration-list
\family typewriter
 , 
\family default
match-parameter-declaration
\end_layout

\begin_layout Description

\series medium
\emph on
match-parameter-declaration:
\series default
\emph default
 \InsetSpace ~

\newline

\emph on
matct-decl-specifier-seq match-abstract-declarator
\begin_inset Formula $_{\textrm{opt}}$
\end_inset


\end_layout

\begin_layout Description

\series medium
\emph on
match-declarator-id:
\series default
\emph default
 \InsetSpace ~

\newline

\emph on
nested-match-name-specifier
\begin_inset Formula $_{\textrm{opt}}$
\end_inset

 match-id
\newline
nested-match-name-specifier
\begin_inset Formula $_{\textrm{opt}}$
\end_inset

 match-operator-function-id
\newline
nested-match-name-specifier
\begin_inset Formula $_{\textrm{opt}}$
\end_inset

 match-conversion-function-id
\end_layout

\begin_layout Description

\series medium
\emph on
match-operator-function-id:
\series default
\emph default
 \InsetSpace ~

\newline

\family typewriter
operator %
\family default

\newline

\family typewriter
operator
\family default
 
\emph on
match-operator
\end_layout

\begin_layout Description

\series medium
\emph on
match-operator:
\series default
\emph default
 one of
\newline

\begin_inset Tabular
<lyxtabular version="3" rows="4" columns="13">
<features>
<column alignment="block" valignment="top" width="0.6cm">
<column alignment="block" valignment="top" width="0.6cm">
<column alignment="block" valignment="top" width="0.6cm">
<column alignment="block" valignment="top" width="0.6cm">
<column alignment="block" valignment="top" width="0.6cm">
<column alignment="block" valignment="top" width="0.6cm">
<column alignment="block" valignment="top" width="0.6cm">
<column alignment="block" valignment="top" width="0.6cm">
<column alignment="block" valignment="top" width="0.6cm">
<column alignment="block" valignment="top" width="0.6cm">
<column alignment="block" valignment="top" width="0.6cm">
<column alignment="block" valignment="top" width="0.6cm">
<column alignment="block" valignment="top" width="0.6cm">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
new
\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="center" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
delete
\end_layout

\end_inset
</cell>
<cell multicolumn="2" alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="center" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
new[]
\end_layout

\end_inset
</cell>
<cell multicolumn="2" alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="center" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
delete[]
\end_layout

\end_inset
</cell>
<cell multicolumn="2" alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
+
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
-
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
*
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
/
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
%%
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
^
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
&
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
|
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
~
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
!
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
=
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
<
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
>
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
+=
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
-=
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
*=
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
/=
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
%%=
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
^=
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
&=
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
|=
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
<<
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
>>
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
>>=
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
<<=
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
==
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
!=
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
<=
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
>=
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
&&
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
||
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
++
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
--
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
,
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
->*
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
->
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
()
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\family typewriter
[]
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\end_layout

\end_inset
</cell>
</row>
</lyxtabular>

\end_inset


\end_layout

\begin_layout Description

\series medium
\emph on
match-conversion-function-id:
\series default
\emph default
 \InsetSpace ~

\newline

\family typewriter
operator
\family default
 
\emph on
match-conversion-type-id
\end_layout

\begin_layout Description

\series medium
\emph on
match-conversion-type-id:
\series default
\emph default
 \InsetSpace ~

\newline

\emph on
match-type-specifier-seq match-conversion-declarator
\begin_inset Formula $_{\textrm{opt}}$
\end_inset


\end_layout

\begin_layout Description

\series medium
\emph on
match-conversion-declarator:
\series default
\emph default
 \InsetSpace ~

\newline

\emph on
match-ptr-operator match-conversion-declarator
\begin_inset Formula $_{\textrm{opt}}$
\end_inset


\end_layout

\begin_layout Standard
\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
cleardoublepage
\backslash
begin{examples}
\end_layout

\end_inset


\end_layout

\begin_layout Standard
\noindent
match expressions (name pointcuts), 
\begin_inset LatexCommand \pageref{exa:match-expressions}

\end_inset


\end_layout

\begin_layout Standard
\noindent
pointcut expressions, 
\begin_inset LatexCommand \pageref{exa:pointcut-expressions}

\end_inset


\end_layout

\begin_layout Standard
\noindent
pointcut declaration, 
\begin_inset LatexCommand \pageref{exa:pointcut-declaration}

\end_inset


\end_layout

\begin_layout Standard
\noindent
pure virtual pointcut declaration, 
\begin_inset LatexCommand \pageref{exa:pure-virtual}

\end_inset


\end_layout

\begin_layout Standard
\noindent
class slice declaration, 
\begin_inset LatexCommand \pageref{exa:class-slice-declaration}

\end_inset


\end_layout

\begin_layout Standard
\noindent
advice declaration, 
\begin_inset LatexCommand \pageref{exa:advice-declaration}

\end_inset


\end_layout

\begin_layout Standard
\noindent
advice declaration with access to context information, 
\begin_inset LatexCommand \pageref{exa:advice-declaration-with}

\end_inset


\end_layout

\begin_layout Standard
\noindent
introductions, 
\begin_inset LatexCommand \pageref{exa:introductions}

\end_inset


\end_layout

\begin_layout Standard
\noindent
base class introduction, 
\begin_inset LatexCommand \pageref{exa:base-class-intro}

\end_inset


\end_layout

\begin_layout Standard
\noindent
advice ordering, 
\begin_inset LatexCommand \pageref{exa:order}

\end_inset


\end_layout

\begin_layout Standard
\noindent
aspect declaration, 
\begin_inset LatexCommand \pageref{exa:aspect-decl}

\end_inset


\end_layout

\begin_layout Standard
\noindent
abstract aspect, 
\begin_inset LatexCommand \pageref{exa:abstract-aspect}

\end_inset


\end_layout

\begin_layout Standard
\noindent
reused abstract aspect, 
\begin_inset LatexCommand \pageref{exa:reused-abstract}

\end_inset


\end_layout

\begin_layout Standard
\noindent
aspect instantiation using 
\family typewriter
aspectof
\family default
, 
\begin_inset LatexCommand \pageref{exa:aspect-aspectof}

\end_inset


\end_layout

\begin_layout Standard
\noindent
re-usable trace aspect, 
\begin_inset LatexCommand \pageref{exa:re-usable-trace}

\end_inset


\end_layout

\begin_layout Standard
\noindent
\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
begin{comment}
\end_layout

\end_inset

static type identification using introductions, 
\begin_inset LatexCommand \pageref{exa:static-type-id}

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Standard

\end_layout

\begin_layout Standard

\end_layout

\begin_layout Standard


\backslash
end{comment}
\end_layout

\begin_layout Standard

\end_layout

\end_inset


\end_layout

\begin_layout Standard
\noindent
\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
begin{comment}
\end_layout

\end_inset

extended thread counting, 
\begin_inset LatexCommand \pageref{exa:extended-thread}

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Standard

\end_layout

\begin_layout Standard

\end_layout

\begin_layout Standard


\backslash
end{comment}
\end_layout

\begin_layout Standard

\end_layout

\end_inset


\end_layout

\begin_layout Standard
\noindent
type, scope, and name parts of a function match expression, 
\begin_inset LatexCommand \pageref{exa:match-expr-parts}

\end_inset


\end_layout

\begin_layout Standard
\noindent
simple name patterns, 
\begin_inset LatexCommand \pageref{exa:match-name-patterns}

\end_inset


\end_layout

\begin_layout Standard
\noindent
operator name patterns, 
\begin_inset LatexCommand \pageref{exa:match-operator-name-patterns}

\end_inset


\end_layout

\begin_layout Standard
\noindent
conversion function name patterns, 
\begin_inset LatexCommand \pageref{exa:match-conversion-function-name-patterns}

\end_inset


\end_layout

\begin_layout Standard
\noindent
scope patterns, 
\begin_inset LatexCommand \pageref{exa:match-scope-patterns}

\end_inset


\end_layout

\begin_layout Standard
\noindent
type patterns with the wildcard character, 
\begin_inset LatexCommand \pageref{exa:match-type-patterns-wildcard}

\end_inset


\end_layout

\begin_layout Standard
\noindent
type patterns with 
\family typewriter
const
\family default
 and 
\family typewriter
volatile
\family default
, 
\begin_inset LatexCommand \pageref{exa:match-type-patterns-cv}

\end_inset


\end_layout

\begin_layout Standard
\noindent
type patterns with 
\family typewriter
virtual
\family default
, 
\begin_inset LatexCommand \pageref{exa:match-type-patterns-virtual}

\end_inset


\end_layout

\begin_layout Standard
\noindent
type matching, 
\begin_inset LatexCommand \pageref{exa:type-matching}

\end_inset


\end_layout

\begin_layout Standard
\noindent
control flow dependant advice activation, 
\begin_inset LatexCommand \pageref{exa:control-flow}

\end_inset


\end_layout

\begin_layout Standard
\noindent
matching in scopes, 
\begin_inset LatexCommand \pageref{exa:matching-in-scopes}

\end_inset


\end_layout

\begin_layout Standard
\noindent
function matching, 
\begin_inset LatexCommand \pageref{exa:function-matching}

\end_inset


\end_layout

\begin_layout Standard
\noindent
instance counting
\begin_inset LatexCommand \label{exa:instance-counting}

\end_inset


\end_layout

\begin_layout Standard
\noindent
\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
begin{comment}
\end_layout

\end_inset

attribute matching, 
\begin_inset LatexCommand \pageref{exa:attribute-matching}

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Standard

\end_layout

\begin_layout Standard

\end_layout

\begin_layout Standard


\backslash
end{comment}
\end_layout

\begin_layout Standard

\end_layout

\end_inset


\end_layout

\begin_layout Standard
\noindent
context matching, 
\begin_inset LatexCommand \pageref{exa:context-matching}

\end_inset


\end_layout

\begin_layout Standard
\noindent
combining pointcut expressions, 
\begin_inset LatexCommand \pageref{exa:combining-pointcut}

\end_inset


\end_layout

\begin_layout Standard
\noindent
advice placement, 
\begin_inset LatexCommand \pageref{exa:advice-placement}

\end_inset


\end_layout

\begin_layout Standard
\noindent
type usage, 
\begin_inset LatexCommand \pageref{exa:type-usage}

\end_inset


\end_layout

\begin_layout Standard
\noindent
static function usage, 
\begin_inset LatexCommand \pageref{exa:static-function-usage}

\end_inset


\end_layout

\begin_layout Standard
\noindent
non-static function usage, 
\begin_inset LatexCommand \pageref{exa:non-static-function-usage}

\end_inset


\end_layout

\begin_layout Standard
\begin_inset ERT
status collapsed

\begin_layout Standard


\backslash
end{examples}
\backslash
addcontentsline{toc}{section}{
\backslash
examplesname}
\end_layout

\end_inset


\end_layout

\begin_layout Standard
\begin_inset LatexCommand \printindex{}

\end_inset


\end_layout

\end_body
\end_document
