// // G A M E.O.N.E - LOW LEVEL LIB V1.0 // Copyright (C) 2001 LEVEL ONE ENTERTAINMENT, // Licensed under the terms of LGPL. //:--------------------------------------------------------------------------- //:Description // // LOW LEVEL CStream CLASS INCLUDE FILE // //:--------------------------------------------------------------------------- #ifndef _STREAM_H #define _STREAM_H class CStream; /************************************************************************/ /* CSTREAM MODULE */ /************************************************************************/ class CStreamModule { public: CStreamModule(); virtual ~CStreamModule(); virtual int read(void *ioBuf, int iNum); virtual int write(void *ioBuf, int iNum); virtual int ioCtl( char *iCmd, void *ioOption ); virtual CStreamModule * Clone(); public: CStreamModule *link(CStreamModule *iPrev, CStreamModule *iNext ); CStreamModule *unlink(void); CStreamModule *Next(void); CStreamModule *Prev(void); CStreamModule *mNext; CStreamModule *mPrev; friend class CStream; }; typedef enum { HEAD, TAIL } eStreamOptions; /************************************************************************/ /* CSTREAM */ /************************************************************************/ class CStream : public CStreamModule { public: CStream( CStreamModule *iDevice ); virtual ~CStream(); public: //! read iNum blocks thru modules int read(void *ioBuf, int iNum); //! write iNum blocks thru modules int write(void *ioBuf, int iNum); //! read num blocks bypassing pushed modules int xread(void *ioBuf, int iNum); //! write num blocks bypassing pushed modules int xwrite(void *ioBuf, int iNum); //! push a module at head or tail CStreamModule * push( CStreamModule *iModule, eStreamOptions iOpt ); //! removes a module by pointer CStreamModule * pop( CStreamModule *iModule ); //! send a command down the CStream int ioCtl( char *iCmd, void *ioOption ); //! Create a copy of this Stream CStreamModule * Clone(); protected: CStreamModule *mDevice; //Tail }; #endif //_STREAM_H