PikeAero::CObject Class Reference

#include <cobject.h>

Inheritance diagram for PikeAero::CObject:

Inheritance graph
[legend]
Collaboration diagram for PikeAero::CObject:

Collaboration graph
[legend]

Data Structures

struct  tCallBack

Public Types


Public Member Functions

virtual void callback (CEvent *e)
 Receive a callback event through this virtual method.
 CObject ()
void dispatch (CEvent *e)
 broadcast an event to anyone listening
void dispatchCallback (CEvent *e)
 broadcast an event to anyone listening on callbacks
virtual void event (CEvent *e)
 receive a software event
virtual void installCallback (CObject *object, CMachine::ubit16 type)
 Install a callback object.
virtual void irq (CMachine::InterruptVector v)
 receive a hardware interrupt.
void operator delete (void *p)
void operator delete[] (void *p)
void * operator new (long unsigned int size)
void * operator new[] (long unsigned int size)
virtual ~CObject ()

Private Attributes

tCallBack ** mCallBack
CMachine::ubit8 mCallBackCount

Detailed Description

Definition at line 35 of file cobject.h.


Member Enumeration Documentation

Enumerator:
errOK 
errOutOfMemory 
errOutOfRange 
errTimeout 

Definition at line 37 of file cobject.h.

00037                      {
00038             errOK           = 0,
00039             errOutOfMemory  = 100,
00040             errOutOfRange,
00041             errTimeout,
00042         } tErrorCode;


Constructor & Destructor Documentation

PikeAero::CObject::CObject (  ) 

Definition at line 25 of file cobject.cpp.

00026 : mCallBack(NULL)
00027 , mCallBackCount(0)
00028 {
00029 }

PikeAero::CObject::~CObject (  )  [virtual]

Definition at line 32 of file cobject.cpp.

References PikeAero::CMemHeap::free(), mCallBack, and mCallBackCount.

00033 {
00034     if ( mCallBack != NULL )
00035     {
00036         for( CMachine::ubit32 i=0; i < mCallBackCount; i++)
00037         {
00038             CMemHeap::free( mCallBack[i] );
00039         }
00040     }
00041 }

Here is the call graph for this function:


Member Function Documentation

virtual void PikeAero::CObject::callback ( CEvent e  )  [inline, virtual]

Receive a callback event through this virtual method.

Parameters:
e Contains the event type and sender.

Reimplemented in PikeAero::CInputTimingToothCounter.

Definition at line 81 of file cobject.h.

Referenced by dispatchCallback().

00081 {}

Here is the caller graph for this function:

void PikeAero::CObject::dispatch ( CEvent e  ) 

broadcast an event to anyone listening

broadcast an event to anyone listening [ inherits pointer ownership ]

Definition at line 68 of file cobject.cpp.

References PikeAero::CEventQueue::enqueue(), and PikeAero::CEvent::setSender().

Referenced by PikeAero::CCommunicationPacket::event(), PikeAero::CTaskAggregator::perSecond(), PikeAero::CTaskTimeBase::run(), and PikeAero::CTaskAnalogInputADC::run().

00069 {
00070     e->setSender(this);
00071     CEventQueue::enqueue(e);
00072 }

Here is the call graph for this function:

Here is the caller graph for this function:

void PikeAero::CObject::dispatchCallback ( CEvent e  ) 

broadcast an event to anyone listening on callbacks

broadcast an event to anyone listening on callbacks

Definition at line 77 of file cobject.cpp.

References callback(), mCallBack, mCallBackCount, PikeAero::CObject::CObject::tCallBack::object, PikeAero::CObject::CObject::tCallBack::type, and PikeAero::CEvent::type().

Referenced by PikeAero::CTimeBaseOneShot::irq().

00078 {
00079     for(CMachine::ubit32 i=0; i < mCallBackCount; i++)
00080     {
00081         if ( e->type() == mCallBack[i]->type )
00082         {
00083             mCallBack[i]->object->callback(e);
00084         }
00085     }
00086 }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void PikeAero::CObject::event ( CEvent e  )  [inline, virtual]

void PikeAero::CObject::installCallback ( CObject object,
CMachine::ubit16  type 
) [virtual]

Install a callback object.

Parameters:
object The object who's callback method will get called.
type The CEvent type that will get dispatched to the callbacl object.
install a callback object.

Definition at line 91 of file cobject.cpp.

References PikeAero::CMemHeap::malloc(), mCallBack, mCallBackCount, PikeAero::CObject::CObject::tCallBack::object, PikeAero::CMemHeap::realloc(), and PikeAero::CObject::CObject::tCallBack::type.

Referenced by PikeAero::CInputTimingToothCounter::CInputTimingToothCounter().

00092 {
00093     mCallBack = (tCallBack**) CMemHeap::realloc( mCallBack, sizeof(CObject*)*(mCallBackCount+1) );
00094     mCallBack [mCallBackCount] = (tCallBack*) CMemHeap::malloc( sizeof(tCallBack) );
00095     mCallBack [mCallBackCount]->type = type;
00096     mCallBack [mCallBackCount]->object = object;
00097     ++mCallBackCount;
00098 }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void PikeAero::CObject::irq ( CMachine::InterruptVector  v  )  [inline, virtual]

void PikeAero::CObject::operator delete ( void *  p  ) 

Definition at line 49 of file cobject.cpp.

References PikeAero::CMemHeap::free().

00050 {
00051     CMemHeap::free(p);
00052 }

Here is the call graph for this function:

void PikeAero::CObject::operator delete[] ( void *  p  ) 

Definition at line 60 of file cobject.cpp.

References PikeAero::CMemHeap::free().

00061 {
00062     CMemHeap::free(p);
00063 }

Here is the call graph for this function:

void * PikeAero::CObject::operator new ( long unsigned int  size  ) 

new/delete operators

Definition at line 43 of file cobject.cpp.

References PikeAero::CMemHeap::malloc().

00044 {
00045     void* p = (void*)CMemHeap::malloc(size);
00046     return p;
00047 }

Here is the call graph for this function:

void * PikeAero::CObject::operator new[] ( long unsigned int  size  ) 

Definition at line 54 of file cobject.cpp.

References PikeAero::CMemHeap::malloc().

00055 {
00056     void* p = (void*)CMemHeap::malloc(size);
00057     return p;
00058 }

Here is the call graph for this function:


Field Documentation

Definition at line 89 of file cobject.h.

Referenced by dispatchCallback(), installCallback(), and ~CObject().

Definition at line 90 of file cobject.h.

Referenced by dispatchCallback(), installCallback(), and ~CObject().


The documentation for this class was generated from the following files:

Generated on Sun Oct 25 14:00:12 2009 for stingray3 by  doxygen 1.5.8