⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 events.h

📁 用VC++编译的13818-5 MPEG2系统层分析代码
💻 H
字号:
/* 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.*/
/* Events.H */
#ifndef events_h
#define events_h
extern "C"{#include <stdio.h>}enum EventType{  TSParsed,		// TS*  PESHeaderParsed,	// PES*  PATParsed,		// PATSection*  MapParsed,	      	// MapSection*	  CAParsed,		// CASection*  BadCRC,		// Section*  Discontinuity,	// TS*  RandomAccess,		// TS*  PCREvent,		// TS*   PTSDTSEvent,		// PES*  UnexpectedPid,	// Wrapper* with int as pid  Termination,		// NULL  NumberEventTypes};typedef void (*Callback)(EventType, void*, void*);//typedef void Callback (EventType t, Callback f, void* d);
//void (*Callback)(EventType, void*, void*);
class CallbackRecord;class EventManager{public:  EventManager ();
//  void Register (EventType t, Callback f, void* d);//  void Register2 (EventType t, Callback f, void* d);
 void Register (EventType t, Callback f, void* d);

  void Trigger (EventType, void*);private:  CallbackRecord* Callbacks[NumberEventTypes];};class CallbackRecord{public:  EventType type;  Callback callback;  void* client_data;//  CallbackRecord (EventType, Callback, void*);
    CallbackRecord (EventType t, Callback c, void* d);
};class Wrapper{public:  Wrapper(int);  Wrapper(char);  int i;  char c;};/* DOCUMENTATION Applications can make use of the event mechanism implemented in the EventManager class.  There are various places in the MSYS library where events are "triggered".  For example when a transport packet is parsed the event "TSParsed" is triggered.  At this point if there is a callback "registered" with the EventManager for the TSParsed event, then that callback routine will be called. Callbacks must all have the same type:    typedef void Callback (EventType, void*, void*);     where   EventType is one of the values listed above.   The first void* is called the "client_data".  It is any pointer   specified by the application at the time of registration.   The second void* is called "call_data".  It is a pointer passed by   the EventManager to an object that is specific to that event.  For   example, the TSParsed event will pass a TS object representing the   parse to the callback.  The type of call data associated with each   EventType is listed above with the EventTypes.  Currently only one callback can be registered for each EventType. They are stored and indexed in a simple array along with their client_data. A class Wrapper is provided for passing ints and chars as client_data and call_data. Public methods are:  EventManager ();    The only constructor.  void Register (EventType, Callback, void*);    Used to register a callback with an EventType.  The third argument    is client_data.  void Trigger (EventType, void*);    Used to trigger an event.  The second argument is call_data.*/#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -