[aspectc-user] how to access sliced fields

steven stevdev at web.de
Wed May 6 22:23:55 CEST 2009


hello folks,

I have a type 'Heap' defined in 'Heap.h' and 'Heap.cpp'.
I want to weave an instance field 'gc' into 'Heap' that is supposed
to be initialized in 'Heap's constructor. I defined a slice but I do
not know how to access a sliced member/ member function in an advice.

How can this be achieved?

#ifndef MARK_SWEEP
#define MARK_SWEEP

#include "GarbageCollector.h"

aspect MarkSweep{
    pointcut heapType() = "Heap";


    advice heapType():slice class{
    	 GarbageCollector* gc;
    	 void init(){ gc = new GarbageCollector();}
    };

    advice construction(heapType()) && args(i): after(int i){
		//Heap::init(); ??
	}
};

#endif


regards,

steven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.aspectc.org/pipermail/aspectc-user/attachments/20090506/a00d184e/attachment.html>


More information about the aspectc-user mailing list