Renamed original Queue class to queue as there was conflict with another library's Queue.
Fork of Queue by
Revision 1:2670ac23765f, committed 2016-11-17
- Comitter:
- noahzwiep
- Date:
- Thu Nov 17 04:02:11 2016 +0000
- Parent:
- 0:a03810d46457
- Commit message:
- Had to rename class to lowercase "queue" as RTOS also has class called queue inside
Changed in this revision
queue.cpp | Show annotated file Show diff for this revision Revisions of this file |
queue.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r a03810d46457 -r 2670ac23765f queue.cpp --- a/queue.cpp Fri Oct 22 22:07:25 2010 +0000 +++ b/queue.cpp Thu Nov 17 04:02:11 2016 +0000 @@ -24,7 +24,7 @@ #include "queue.h" // construction -Queue::Queue( int iSize, int iCount ) +queue::queue( int iSize, int iCount ) { // allocate space for the queue if (( m_pnHead = ( unsigned char* )malloc( iSize * iCount )) != NULL ) @@ -40,14 +40,14 @@ } // destruction -Queue::~Queue( ) +queue::~queue( ) { // free the memory free( m_pnHead ); } // put an item into the queue -bool Queue::Put( void* pvItem ) +bool queue::Put( void* pvItem ) { bool bResult = false; @@ -74,7 +74,7 @@ } // get an item from the queue -bool Queue::Get( void* pvItem ) +bool queue::Get( void* pvItem ) { bool bResult = false; @@ -100,7 +100,7 @@ } // put an item into the queue -bool Queue::PutIrq( void* pvItem ) +bool queue::PutIrq( void* pvItem ) { bool bResult = false; @@ -125,7 +125,7 @@ } // get an item from the queue -bool Queue::GetIrq( void* pvItem ) +bool queue::GetIrq( void* pvItem ) { bool bResult = false; @@ -150,14 +150,14 @@ } // get the number of items in the queue -int Queue::GetNumberOfItems( void ) +int queue::GetNumberOfItems( void ) { // return the count return( m_iLclCount ); } // peeks at the item at the top of the queue -bool Queue::Peek( void* pvItem ) +bool queue::Peek( void* pvItem ) { bool bResult = false; @@ -176,7 +176,7 @@ } // flush all items from the queue -void Queue::Flush( void ) +void queue::Flush( void ) { // reset the indices m_iLclCount = 0;
diff -r a03810d46457 -r 2670ac23765f queue.h --- a/queue.h Fri Oct 22 22:07:25 2010 +0000 +++ b/queue.h Thu Nov 17 04:02:11 2016 +0000 @@ -1,4 +1,4 @@ -/* mbed Queue Library +/* mbed queue Library * Copyright (c) 2010 William Basser ( wbasser [at] gmail [dot] com ) * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -36,60 +36,60 @@ * #include "queue.h" * * Serial myPc( USBTX, USBRX ); - * Queue myQueue( 1, 5 ); + * queue myqueue( 1, 5 ); * * int main() * { * unsigned char nTemp; * * // display the number of items in the queue - * myPc.printf( "Items in queue: %d\r", myQueue.GetNumberOfItems( )); + * myPc.printf( "Items in queue: %d\r", myqueue.GetNumberOfItems( )); * * // add item to queue * nTemp = 5; - * myQueue.Put( &nTemp ); + * myqueue.Put( &nTemp ); * nTemp = 6; - * myQueue.Put( &nTemp ); + * myqueue.Put( &nTemp ); * nTemp = 7; - * myQueue.Put( &nTemp ); + * myqueue.Put( &nTemp ); * * // display the number of items in the queue - * myPc.printf( "Items in queue: %d\r", myQueue.GetNumberOfItems( )); + * myPc.printf( "Items in queue: %d\r", myqueue.GetNumberOfItems( )); * * // peek at item at the top of the queue - * myQueue.Peek( &nTemp ); + * myqueue.Peek( &nTemp ); * myPc.printf( "Peek: %d\r", nTemp ); * * // get an item from queue - * myQueue.Get( &nTemp ); + * myqueue.Get( &nTemp ); * myPc.printf( "Item 0 = %d\r", nTemp ); - * myQueue.Get( &nTemp ); + * myqueue.Get( &nTemp ); * myPc.printf( "Item 1 = %d\r", nTemp ); * * // queue should be empty - * if ( !myQueue.Get( &nTemp )) + * if ( !myqueue.Get( &nTemp )) * { * // queue is empty - * myPc.printf( "Queue empty!\r" ); + * myPc.printf( "queue empty!\r" ); * } * } * * @endcode */ -class Queue { +class queue { public: - /** Create a Queue object + /** Create a queue object * * @param iSize size of the object in queue * @param iCount number of items in the queue */ - Queue( int iSize, int iCount ); + queue( int iSize, int iCount ); /** destruction * */ - virtual ~Queue( void ); + virtual ~queue( void ); /** Add item to queue *