| |||
| Home > The Cycle Accurate Profiling Interface > The CAPICallback class |
The CAPICallback establishes a basic relation
between CAPI and the simulation kernel. There exists a single unique CAPICallback that
applies to all CAPI objects.
Example 4.6. CAPICallback definition
class CAPICallback : public CAPICallbackIF{
public:
// Return the CAInterface name for this interface.
static if_name_t IFNAME() { return "eslapi.CAPICallback2"; }
// Specify the current minor revision for this interface.
static if_rev_t IFREVISION() { return 0; }
virtual CAPITraceSegment_t * allocateTraceSegment
(const CAPIStream_t * stream)
{return NULL;}
virtual void deallocateTraceSegment (const CAPIStream_t * stream,
CAPITraceSegment_t * segment) {}
virtual uint64_t getCurrentCycle (){return (uint64_t)-1;}
virtual uint64_t getTotalAllocatedMemory(void) {return 0;}
// Return interface if requested
virtual CAInterface * ObtainInterface( if_name_t ifName,
if_rev_t minRev, if_rev_t * actualRev)
{
if((strcmp(ifName,"eslapi.CAPICallback2") == 0) && (minRev <= 0))
{
*actualRev = 0;
return this;
}
return NULL;
}
};