-
Notifications
You must be signed in to change notification settings - Fork 2
Data Queue
This class implements a circular queue using dynamically allocated arrays. It has its own Mutex and Locking Mechanism for concurrent access by two threads. This class is internally used by the openVCIKServices.hpp for speech and sensor data queue.
#include "openVCIKDataQueue.hpp"OpenVCIKdataQueue dataQueue::dataQueue(int size)Contsructor - initiallizes the variables and allocates space for the queue.
Arguments:
- size (Type:
Integer) - Size of the queue (Default size is 10)
Throws: (Type - Integer) - 1 if bad allocation exception was resulted in allocating the queue
~dataQueue()Destructor - releases the memory allocated. The Application Programmer need not worry about it.
inline int dataQueue::getFront() Returns: the current Front Position (Type: Integer) of the queue. Can be used for debugging
inline int dataQueue::getRear(); Returns: the current Rear Position (Type: Integer) of the queue. Can be used for debugging
inline int dataQueue::getSize() Returns: the allocated size (Type: Integer) of the queue
inline int dataQueue::getQueueSize() Returns: the actual size (Type: Integer) of the queue at the point of this function call
int dataQueue::put(string data)Puts the data in queue; If the queue is found to be full it is automatically cleared.
Argument:
- data (Type:
string) - the string to be put
Returns: (Type: Integer) 0 - if successful; -1 - If out of bound (this will never happen. Just for safety)
string dataQueue::get(int current)Gets data from the queue.
Arguments:
- current (Type:
Integer) -0to return data in a circular queue get fashion;1to return the current data and not effect the queue. Default -0.
Returns: (Type: string) data from the queue if data available else \0 if queue empty
void dataQueue::clear()Clears the queue.
- Hardware setup
- Software setup
- Understanding the Framework
- Some specific Types
- Sensor data and command formats
- Your first OpenVCIK application
- How to write more sophisticated OpenVCIK applications
- Some use cases
- OpenVCIK Services
- Sub modules
- OpenVCIK Firmware