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.

76 lines
1.6 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __BASICFIFO_H_INCL__
  2. #define __BASICFIFO_H_INCL__
  3. #include <malloc.h>
  4. typedef struct DataPackageFIFO{
  5. DataPackageFIFO *next;
  6. void *data;
  7. } DataPackageFIFO, *pDataPackageFIFO;
  8. /**
  9. * TODO: Add class description
  10. *
  11. * @author gagua
  12. */
  13. class basicFIFO {
  14. private:
  15. pDataPackageFIFO head;
  16. pDataPackageFIFO tale;
  17. int nodeCount;
  18. public:
  19. // Constructor
  20. basicFIFO();
  21. // Destructor
  22. virtual ~basicFIFO();
  23. // Copy constructor
  24. // TODO: Uncomment the copy constructor when you need it.
  25. //basicFIFO(const basicFIFO& src);
  26. // Assignment operator
  27. // TODO: Uncomment the assignment operator when you need it.
  28. //basicFIFO& operator=(const basicFIFO& src);
  29. bool pushData( void *buffer );
  30. bool pushNode( pDataPackageFIFO &node );
  31. pDataPackageFIFO popNode( void );
  32. void *popData( void );
  33. int getCount( void ){ return nodeCount; };
  34. bool clear( void );
  35. pDataPackageFIFO touch( int index );
  36. bool removeNode( pDataPackageFIFO &node );
  37. };
  38. // Constructor implementation
  39. inline basicFIFO::basicFIFO(){
  40. head = NULL;
  41. tale = NULL;
  42. };
  43. // Destructor implementation
  44. inline basicFIFO::~basicFIFO(){
  45. if( head != NULL ){
  46. clear();
  47. };
  48. };
  49. // TODO: Uncomment the copy constructor when you need it.
  50. //inline basicFIFO::basicFIFO(const basicFIFO& src)
  51. //{
  52. // // TODO: copy
  53. //}
  54. // TODO: Uncomment the assignment operator when you need it.
  55. //inline basicFIFO& basicFIFO::operator=(const basicFIFO& rhs)
  56. //{
  57. // if (this == &rhs) {
  58. // return *this;
  59. // }
  60. //
  61. // // TODO: assignment
  62. //
  63. // return *this;
  64. //}
  65. #endif // __BASICFIFO_H_INCL__