www.pudn.com > MPEG2systemsrc.rar > Events.C
/* Copyright (C) 1995, Tektronix Inc. All Rights Reserved.
*
* Usage Restrictions
*
* License is granted to copy, to use, and to make and to use derivative
* works for research and evaluation purposes only.
*
* Disclaimer of Warranty
*
* These software programs are available to the user without any license
* fee or royalty on an "as is" basis. Tektronix Inc. disclaims any and
* all warranties, whether express, implied, or statuary, including any
* implied warranties or merchantability or of fitness for a particular
* purpose. In no event shall the copyright-holder be liable for any
* incidental, punitive, or consequential damages of any kind whatsoever
* arising from the use of these programs.
*
* This disclaimer of warranty extends to the user of these programs and
* user's customers, employees, agents, transferees, successors, and
* assigns.
*
* The Tektronix Inc. does not represent or warrant that the programs
* furnished hereunder are free of infringement of any third-party
* patents.
*/
/* Event implementation */
#include "Events.H"
EventManager::EventManager ()
{
for (int i = 0; i < (int) NumberEventTypes; i++)
{
Callbacks[i] = NULL;
}
}
void EventManager::Register (EventType t, Callback f, void* d)
{
CallbackRecord* crec = new CallbackRecord(t, f, d);
Callbacks[t] = crec;
}
void EventManager::Trigger (EventType t, void* call_data)
{
if ((t < 0) || (t >= NumberEventTypes)) return;
CallbackRecord* crec = Callbacks[t];
if (crec) crec->callback(crec->type, crec->client_data, call_data);
}
CallbackRecord::CallbackRecord (EventType t, Callback c, void* d)
{
type = t;
callback = c;
client_data = d;
}
Wrapper::Wrapper (int ii)
{
i = ii;
}
Wrapper::Wrapper (char cc)
{
c = cc;
}