Skip to content
projectopenvcik edited this page Aug 20, 2015 · 2 revisions

Description

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

#include "openVCIKDataQueue.hpp"

Namespace

OpenVCIK

Class

dataQueue 

Public member functions

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) - 0 to return data in a circular queue get fashion; 1 to 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.

Contents of this wiki


The Kit
  • Hardware setup
  • Software setup
Getting started
  • 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
API Docs
Publications

Clone this wiki locally