Extraction and Examination of Relations in C++ Systems
by Keith Paton


Example 1:
(a)
a.cxx
#include "a.h"
#include "b.h"
int A::foo(B *aBptr);
{
   return aBptr->foo();
}

(b)
a.cxx
#include "a.h"
#include "free.h"
class B;
int A::foo(B *aBptr);
{
   return bar(aBptr);
}

Example 2:
a.h                            Comment

#ifndef A_H
#define A_H

#include "b.h"
#include "c.h"
#include "d.h"
#include "e.h"
#include "f.h"
#include "g.h"
#include "h.h"

class A:public B       // A inherits B 
{
C theCobject;	       // A defines an object in C
D* theDptr;            // A defines a pointer to an object in D
inline  E foo(         // A::foo returns an object in E
	F anF,         // A::foo receives an object in F
	G* aGptr,      // A::foo receives a pointer to an object in G
	H* anHptr)     // A::foo receives a pointer to an object in H
	{
	  return G->getE(anHptr);  // A::foo invokes a member function in G
	}
};
#endif


Figure 5:

a.rep
File a.h

Directive             Score            Comment

#include "b.h"        required          A inherits from B
#include "c.h"        required          A defines an object in C
#include "d.h"        NOT required      Use class D
#include "e.h"        required          A::foo returns an object in E
#include "f.h"        required          A::foo receives an object in F
#include "g.h"        required          A::foo invokes a member function in G
#include "h.h"        NOT required      Use class H

Figure 6:

Action.bat
Downgrade a.h a1.h         Create a new file a1.h from a.h by removing 
d.h                        include "d.h"
h.h                        include "h.h" 
                           and inserting
D                          class D;
H                          class H;
                           in their places.





2

