CarPostCondition Aspect
[CarExample Group]

This aspect is defined in file: ../../AspectXLib/car/Car/aspects/CarPost.ax

Aspect Description

Some methods in the base code return a pointer to an object. The pointer should be non-NULL but there is no check that this is indeed the case. We want to modify the base code in the following manner:
  1. If a method returns a pointer, then there should be a check that the pointer is non-NULL
  2. If a pointer return value is found to be NULL, then a recovery action should be executed.
A "recovery action" in our context is an instance of a class derived from class RecoveryAction. The recovery action should be a plug-in component for the class where the parameter valildity check is performed.
Author:
I. Birrer, O. Rohlik
See also:
CarBeginEnd
CarPreCondition
CarSynchronizeWindows

Pointcuts

functionpointerReturningFunctions
 Points to all functions that return a pointer type
function_declpointerReturningFunctionDeclarations
 Points to all function declarations that return a pointer type
classclassesWithPointerReturningFunctions
 Points to all classes that contain at least one function declaration which returns a pointer type
unitunitsWithPointerReturningFunctions
 Points to all units that contain at least one function which returns a pointer type
returnreturnStatements
  Points to all return statements inside the function located by pointerReturningFunctions pointcut

Advices

endcommentsForCheckedFunctions
 Adds a comment in front of the function declarartion located by pointcut pointerReturningFunctionDeclarations
endcommentsForClassesWithCheckedFunctions
 Adds a comment in front of the class that contain classes with functions that returns pointers
beforecheckBeforeReturn
 Adds a check of expresion value that is to be returned
addaddRecoverySupportMethodDeclaration
 Adds a method setRecoveryAction() to the classes that support recovery
addaddRecoverySupportFieldDeclaration
 Adds a field variable declaration RecoveryAction to classes that support recovery action
addaddRecoverySupportDefinition
 Adds the definition of setRecoveryAction() method to appropriate unit
addaddIncludeDecl
 Adds #include "RecoveryAction
addaddIncludeDef
 Adds #include "RecoveryAction

Pointcut Documentation

function pointerReturningFunctions (source)
Points to all functions that return a pointer type.
function_decl pointerReturningFunctionDeclarations (source)
Points to all function declarations that return a pointer type.
class classesWithPointerReturningFunctions (source)
Points to all classes that contain at least one function declaration which returns a pointer type.
unit unitsWithPointerReturningFunctions (source)
Points to all units that contain at least one function which returns a pointer type.
return returnStatements (source)
Points to all return statements inside the function located by pointerReturningFunctions pointcut. This points to all return statements in all functions that return pointers.

Advice Documentation

end commentsForCheckedFunctions (source)

Triplet: comment end comment

Adds a comment in front of the function declarartion located by pointcut pointerReturningFunctionDeclarations.

Local Pointcut: comment (source)

end commentsForClassesWithCheckedFunctions (source)

Triplet: comment end comment

Adds a comment in front of the class that contain classes with functions that returns pointers.

Local Pointcut: comment (source)

before checkBeforeReturn (source)

Triplet: return before codeFragment

Adds a check of expresion value that is to be returned. Recover if return expression evaluates to NULL.

Refers to global pointcut: return returnStatements

add addRecoverySupportMethodDeclaration (source)

Triplet: class add declaration

Adds a method setRecoveryAction() to the classes that support recovery.

Refers to global pointcut: class classesWithPointerReturningFunctions

add addRecoverySupportFieldDeclaration (source)

Triplet: class add declaration

Adds a field variable declaration RecoveryAction to classes that support recovery action.

Refers to global pointcut: class classesWithPointerReturningFunctions

add addRecoverySupportDefinition (source)

Triplet: unit add definition

Adds the definition of setRecoveryAction() method to appropriate unit.

Refers to global pointcut: unit unitsWithPointerReturningFunctions

add addIncludeDecl (source)

Triplet: unit add include

Adds #include "RecoveryAction.h" to all units where classes with functions returning pointers are defined.

Local Pointcut: unit (source)

add addIncludeDef (source)

Triplet: unit add include

Adds #include "RecoveryAction.h" to all units where functions returning pointer are defined.

Refers to global pointcut: unit unitsWithPointerReturningFunctions