You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
1.6 KiB
89 lines
1.6 KiB
#ifndef __BASICFIFO_H_INCL__
|
|
#define __BASICFIFO_H_INCL__
|
|
|
|
#include <malloc.h>
|
|
|
|
typedef struct DataPackageFIFO
|
|
{
|
|
DataPackageFIFO * next;
|
|
void * data;
|
|
} DataPackageFIFO, *pDataPackageFIFO;
|
|
|
|
/**
|
|
* TODO: Add class description
|
|
*
|
|
* @author gagua
|
|
*/
|
|
class basicFIFO
|
|
{
|
|
private:
|
|
|
|
pDataPackageFIFO head;
|
|
pDataPackageFIFO tale;
|
|
int nodeCount;
|
|
|
|
public:
|
|
|
|
// Constructor
|
|
basicFIFO();
|
|
|
|
// Destructor
|
|
virtual ~basicFIFO();
|
|
|
|
// Copy constructor
|
|
// TODO: Uncomment the copy constructor when you need it.
|
|
// basicFIFO(const basicFIFO& src);
|
|
|
|
// Assignment operator
|
|
// TODO: Uncomment the assignment operator when you need it.
|
|
// basicFIFO& operator=(const basicFIFO& src);
|
|
bool pushData(void * buffer);
|
|
bool pushNode(pDataPackageFIFO & node);
|
|
pDataPackageFIFO popNode(void);
|
|
void * popData(void);
|
|
|
|
int getCount(void)
|
|
{
|
|
return nodeCount;
|
|
}
|
|
|
|
bool clear(void);
|
|
pDataPackageFIFO touch(int index);
|
|
bool removeNode(pDataPackageFIFO & node);
|
|
};
|
|
|
|
// Constructor implementation
|
|
inline basicFIFO::basicFIFO()
|
|
{
|
|
head = NULL;
|
|
tale = NULL;
|
|
}
|
|
|
|
// Destructor implementation
|
|
inline basicFIFO::~basicFIFO()
|
|
{
|
|
if (head != NULL)
|
|
{
|
|
clear();
|
|
};
|
|
}
|
|
|
|
// TODO: Uncomment the copy constructor when you need it.
|
|
// inline basicFIFO::basicFIFO(const basicFIFO& src)
|
|
//{
|
|
// // TODO: copy
|
|
//}
|
|
|
|
// TODO: Uncomment the assignment operator when you need it.
|
|
// inline basicFIFO& basicFIFO::operator=(const basicFIFO& rhs)
|
|
//{
|
|
// if (this == &rhs) {
|
|
// return *this;
|
|
// }
|
|
//
|
|
// // TODO: assignment
|
|
//
|
|
// return *this;
|
|
//}
|
|
|
|
#endif // __BASICFIFO_H_INCL__
|