00001
00002 00004
00005 #if !defined(AFX_FIFO_H__6F821C1A_AB16_414E_9293_ABE8257F20A3__INCLUDED_)
00006 #define AFX_FIFO_H__6F821C1A_AB16_414E_9293_ABE8257F20A3__INCLUDED_
00007
00008 #if _MSC_VER > 1000
00009 #pragma once
00010 #endif // _MSC_VER > 1000
00011
00012 #include <Queue.h>
00013
00029 class CFiFo : public CQueue {
00030 short dir;
00031 deque<LPPIXEL> queue;
00032 deque<short> qparity;
00033 public:
00034 CFiFo() {
00035 dir = 1;
00036 };
00037
00038 ~CFiFo() {
00039 queue.clear();
00040 qparity.clear();
00041 };
00042
00043 inline bool empty() {
00044 return queue.empty();
00045 };
00046
00047 inline void add(LPPIXEL entry) {
00048 if (dir == 1)
00049 queue.push_front(entry);
00050 else
00051 queue.push_back(entry);
00052 };
00053 inline void add(LPPIXEL entry, short parity) {
00054 if (dir == 1) {
00055 queue.push_front(entry);
00056 qparity.push_front(parity);
00057 } else {
00058 queue.push_back(entry);
00059 qparity.push_back(parity);
00060 }
00061 };
00062 inline void first(LPPIXEL *p) {
00063 if (dir != 1) {
00064 *p = queue.front();
00065 queue.pop_front();
00066 } else {
00067 *p = queue.back();
00068 queue.pop_back();
00069 }
00070 };
00071 inline void first(LPPIXEL *p, short *parity) {
00072 if (dir != 1) {
00073 *p = queue.front();
00074 queue.pop_front();
00075 *parity = qparity.front();
00076 qparity.pop_front();
00077 } else {
00078 *p = queue.back();
00079 queue.pop_back();
00080 *parity = qparity.back();
00081 qparity.pop_back();
00082 }
00083 };
00084 inline void invert(void) {
00085 dir = (dir == 1) ? -1 : 1;
00086 return;
00087 };
00088 };
00089
00090 #endif // !defined(AFX_FIFO_H__6F821C1A_AB16_414E_9293_ABE8257F20A3__INCLUDED_)