📄 inputport.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.*//* InputPorts are used to receive bitstreams from other processes. */#ifndef inputport_h#define inputport_h#include "TimeStamp.H"#include "Poly.H"#define ZERO '0'#define ONE '1'#define BADBIT '2'#define TRUE 1#define FALSE 0class InputPort{public: InputPort (); char read_bit (); char read_byte (); int read_pattern (char*); int read_markerbit (); char read_reserved_bits (int); char read_nbits (int); int read_uimsbf (int, char*); int read_tcimsbf (int, char*); TimeStamp90* read_timestamp90 (); TimeStamp27* read_timestamp27_pes_format (); TimeStamp27* read_timestamp27_ts_format (); void start_crc (); int check_crc (); void print_crc (); void stop_crc ();protected: virtual char input_bit () = 0; virtual char input_byte () = 0;private: int crc_flag; Poly* poly;};/* DOCUMENTATION InputPorts provide a stream of data. This data can be extracted from the port in a variety of ways with calls to member functions such as read_byte, read_nbits, read_pattern, etc. A CRC check can be started, and stopped and checked as described below. Subclasses of InputPort provide various implementations. For example, IPortFromFile will read bytes from a disk file, IPortFromRam will read bytes from a ram buffer. These subclasses must implement two virtual functions: input_bit and input_byte, which are then used by the generic code implemented in this base class. Bits returned from the port are represented as the chars '0' and '1' (only an actual bit is read from the port, of course, but internally bits are efficiently managed as chars). Public methods are: InputPort (); The only constuctor - never called directly by an application. char read_bit (); char read_byte (); This function requires that the port be on a byte boundary. int read_pattern (char*); int read_markerbit (); char read_reserved_bits (int); char read_nbits (int); int read_uimsbf (int, char*); int read_tcimsbf (int, char*); TimeStamp90* read_timestamp90 (); TimeStamp27* read_timestamp27_pes_format (); TimeStamp27* read_timestamp27_ts_format (); These each read from the port and return a corresponding object. void start_crc (); void stop_crc (); int check_crc (); void print_crc (); start_crc will initialize an internal degree 32 polynomial and arrange so that subsequent calls to any of the read functions will perform the appropriate bitshift operation on the polynomial. stop_crc will stop the bitshift. check_crc will read the next 32 bits from the InputPort and check them against the polynomial. */#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -