<aspect xmlns:src="http://www.sdml.info/srcML/src" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cpp="http://www.sdml.info/srcML/cpp" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://control.ee.ethz.ch/XWeaver/AspectX" xsi:schemaLocation="http://control.ee.ethz.ch/XWeaver/AspectX ../../../../src/xsd/aspectX.xsd" name="PointcutLibrary">
        
<description>
            This aspect contains pointcut definitions that are used by other aspects in the group.
        It is one of the fours sample aspect programs that modifies the component to access 
        all its parameters from a 
<i>parameter database by copy</i> and one of the two aspect
        programs that modifies the component to access 
        all its parameters from a 
<i>parameter database by pointer</i>.
            
            This group of aspect programs show an example of how the implementation of selected classes in a certain code 
            base can be modified to change the way in which member variables are handled. In this example, all
        member variables in the base code are moved to a dedicated object called parameter database
        (see 
<a href="http://www.pnp-software.com/ObsFramework/doc/ParameterDatabase.html">Parameter 
        Database Design Pattern
</a>).
        
<p />
        The 
        
<a href="http://www.pnp-software.com/ObsFramework/doc/doxygen/html/classDC__BasicDatabase.html"><code>DC_BasicDatabase</code></a>
        is used as a component that stores the parameter data of target class. 
        The 
<code>DC_BasicDatabase</code> class extends the abstract class 
        
<a href="http://www.pnp-software.com/ObsFramework/doc/doxygen/html/classParameterDatabase.html"><code>ParameterDatabase</code></a>.
        Both classes are defined and implemented in 
        
<a href="http://www.pnp-software.com/ObsFramework/">OBS Framework</a>.
        
<p />
        
<i>This file</i> contains pointcuts that are used by the other aspect programs in the group.
        Aspect programs can link pointcuts defined in this file using  
        
<code>&lt;include href="Pointcuts.xml"/&gt;</code>.
        
        
<author>A. Pasetti, O. Rohlik</author>
        
<see>BaseParameter</see>
        
<see>GetParameter</see>
        
<see>SetParameter</see>
        
<see>ParameterDatabaseByPointer</see>
        
</description>
         
        
<pointcut name="targetClass" type="src:class" constraint="src:name='SampleClass'">
                
<description>
                    Points to the target class to be modified by this aspect program. This is a very 
                    simple pointcut that captures all classes and then adds the restriction that the 
                    name of the class must be equal to "SampleClass". Note that this pointcut points 
                    to the class declaration only, not the class implementation. The class implementation 
                    is captured by the targetImplementationUnit pointcut that points to the 
                    implementation of the methods declared in the target class.
                
</description>
        
</pointcut>
        
        
<pointcut name="targetImplementationUnit" type="src:unit">
            
<description>
                Points to the unit that contains the implementation of methods of the target class. 
                In srcML, a unit is a source file (a definition file, a declaration file, 
                or an inline file). This pointcut therefore identifies the source file 
                that may use member variables declared in the target method.
            
</description>
        
<restriction type="isDefinitionOf">
            
<pointcutRef ref="targetClass" type="src:class" />
        
</restriction>
        
</pointcut>
        
        
<pointcut name="anySampleClassExpr" type="src:expr">
            
<description>
                Points to all expressions used in target class implementation. 
                The expressions (srcML element 
<code>expr</code>) may be used in definitions 
                of methods, constructors and destructors.
            
</description>
            
<or>
            
<restriction type="within">
                
<pointcut type="src:function">
                    
<restriction type="within">
                        
<pointcutRef ref="targetImplementationUnit" type="src:unit" />
                    
</restriction>
                
</pointcut>
            
</restriction>
            
<restriction type="within">
                
<pointcut type="src:constructor">
                    
<restriction type="within">
                        
<pointcutRef ref="targetImplementationUnit" type="src:unit" />
                    
</restriction>
                
</pointcut>
            
</restriction>
            
<restriction type="within">
                    
<pointcut type="src:destructor">
                    
<restriction type="within">
                        
<pointcutRef ref="targetImplementationUnit" type="src:unit" />
                    
</restriction>
                
</pointcut>
            
</restriction>            
        
</or>        
        
</pointcut>
                
        
<pointcut name="targetClassDeclaration" type="src:unit">
                
<description>
            Points to the unit that contains the declaration of the target class. 
            
</description>
                
<restriction type="contain">
                        
<pointcutRef type="src:class" ref="targetClass" />
                
</restriction>
        
</pointcut>        
                        
        
<pointcut name="targetIntNameGetter" type="src:name" constraint="(text()='_width' or text()='_height') and (not(contains(following-sibling::text(),'=')) or (contains(following-sibling::text(),'==')))">
            
<description>
                Points to occurrences of member variables 
<code>_width</code> and <code>_height</code>.
                This pointcut points to 
<code>name</code> srcML elements that contain variables of type
                
<code>int</code>.
                The only 
<code>int</code> variables in our sample base code are <code>width</code> and <code>_height</code>.
                These variables have to be explicitly listed in the constraint attribute of the pointcut
                since the srcML doesn't provide type information for 
<code>name</code> elements.
                
<p />
                Additional constraint is imposed on 
<code>name</code> elements. 
                Only those elements are chosen that 
<i>do not appear</i> on the left side of assignments.
            
</description>
        
<restriction type="within">
            
<pointcutRef ref="anySampleClassExpr" type="src:expr" />
        
</restriction>
        
</pointcut>
        
<pointcut name="targetFloatNameGetter" type="src:name" constraint="(text()='_flt') and (not(contains(following-sibling::text()[1],'=')) or (contains(following-sibling::text()[1],'==')))">
            
<description>
                Points to occurrences of member variable 
<code>_flt</code>.
                This pointcut points to 
<code>name</code> srcML elements that contain
                
<code>float</code> variables.
                The only 
<code>float</code> variable in our sample base code is <code>_flt</code>.
                This variable has to be explicitly listed in the constraint attribute of the pointcut
                since srcML doesn't provide type information for 
<code>name</code> elements.
                
<p />
                Additional constraint is imposed on 
<code>name</code> elements. 
                Only those elements are chosen that 
<i>do not appear</i> on the left side of assignments.
        
</description>
        
<restriction type="within">
            
<pointcutRef ref="anySampleClassExpr" type="src:expr" />
        
</restriction>
        
</pointcut>
        
        
<pointcut name="targetIntNameSetter" type="src:name" constraint="(text()='_width' or text()='_height') and (contains(following-sibling::text(),'=') and not(contains(following-sibling::text(),'==')))">
            
<description>
                Points to occurrences of member variables 
<code>_width</code> and <code>_height</code>.
                This pointcut points to 
<code>name</code> srcML elements that contain
                
<code>int</code> variables.
                The only 
<code>int</code> variables in our sample base code are <code>width</code> and <code>_height</code>.
                These variables have to be explicitly listed in the constraint attribute of the pointcut
                since srcML doesn't provide type information for 
<code>name</code> elements.
                
<p />
                Additional constraint is imposed on 
<code>name</code> elements. 
                Only those elements are chosen that 
<i>appear</i> on the left side of assignments.
        
</description>
        
<restriction type="within">
            
<pointcutRef ref="anySampleClassExpr" type="src:expr" />
        
</restriction>
        
</pointcut>
        
<pointcut name="targetFloatNameSetter" type="src:name" constraint="(text()='_flt') and (contains(following-sibling::text()[1],'=') and not(contains(following-sibling::text()[1],'==')))">
        
<description>
            Points to occurrences of member variable 
<code>_flt</code>.
                This pointcut points to 
<code>name</code> srcML elements that contain
                
<code>float</code> variables.
                The only 
<code>float</code> variable in our sample base code is <code>_flt</code>.
                This variable has to be explicitly listed in the constraint attribute of the pointcut
                since srcML doesn't provide type information for 
<code>name</code> elements.
                
<p />
                Additional constraint is imposed on 
<code>name</code> elements. 
                Only those elements are chosen that 
<i>appear</i> on the left side of assignments.
        
</description>
        
<restriction type="within">
            
<pointcutRef ref="anySampleClassExpr" type="src:expr" />
        
</restriction>
        
</pointcut>

        
<pointcut name="targetIntExprSetter" type="src:expr">
            
<description>
                Points to expression elements 
<code>expr</code> where the value of the integer (<code>int</code>) member variable is changed. Such expression
                can be identified as those that have the member variable on the left side of an assignment expression 
                i.e. those that contain pointcut 
<code>targetIntNameSetter</code>.
                In this pointcut we do not assume usage of increment and decrement operators 
                (e.g. 
<code>i++</code> and <code>--i</code>).
            
</description>
            
<restriction type="parentOf">
                
<pointcutRef ref="targetIntNameSetter" type="src:name" />
            
</restriction>
        
</pointcut>
        
<pointcut name="targetFloatExprSetter" type="src:expr">
            
<description>
                Points to expression elements 
<code>expr</code> where the value of the float member variable is changed. 
                Such expression
                can be identified as those that have the member variable on the left side of an assignment expression 
                i.e. those that contain pointcut 
<code>targetFloatNameSetter</code>.
                In this pointcut we do not assume usage of increment and decrement operators 
                (e.g. 
<code>f++</code> and <code>--f</code>).
            
</description>
            
<restriction type="parentOf">
                
<pointcutRef ref="targetFloatNameSetter" type="src:name" />
            
</restriction>
        
</pointcut>
         
</aspect>






































v