Barcode Xpress Mobile for iOS
 All Classes Functions Variables Properties Pages
BXThreadQueue Class Reference

Defines a class that manages the threads using Barcode Xpress to perform recognition and decoding of images. More...

#import <BXThreadQueue.h>

Inheritance diagram for BXThreadQueue:

Instance Methods

(id) - init
 Initializes an empty thread queue. More...
 
(id) - initWithInfo:threadcount:sender:executioncallback:processingcallback:
 Initializes the thread control data structures. More...
 
(void) - dispatch:
 Creates a new thread to perform recognition on an image, if a thread in the queue is available. More...
 
(bool) - canDispatch
 Tests if there is a slot in the thread queue that is not being used by an active thread. More...
 
(bool) - canDispatch:
 Tests if there is a slot in the thread queue that is not being used by an active thread. More...
 

Protected Attributes

int m_threadCount
 An int specifying the maximum number of threads to use.
 
bool * m_threadUsed
 A boolean array of length m_threadCount. More...
 
NSLock * m_captureMutex
 Mutex used to synchronize access to thread control data structures.
 
id m_sender
 Object instance that will execute callbacks.
 
NSString * m_name
 A string representing the name of the thread queue. Set any arbitrary name.
 
SEL m_executionCallback
 Callback function to be executed to perform recognition.
 
SEL m_processingCallback
 Callback function to be executed before recognition is performed.
 

Detailed Description

Defines a class that manages the threads using Barcode Xpress to perform recognition and decoding of images.

Method Documentation

- (bool) canDispatch

Tests if there is a slot in the thread queue that is not being used by an active thread.

Returns
TRUE if there is an open slot, FALSE otherwise.
- (bool) canDispatch: (int*)  pIndex

Tests if there is a slot in the thread queue that is not being used by an active thread.

Parameters
pIndexAddress of an int that will contain the first available queue slot number if any are not being used by active threads. This return parameter will not be changed if the method returns FALSE.
Returns
TRUE if there is an open slot, FALSE otherwise.
- (void) dispatch: (BXThreadData*)  threadData

Creates a new thread to perform recognition on an image, if a thread in the queue is available.

Parameters
threadDataThis object contains a pointer to an image captured from the video camera, information about the image, and the ID of the thread that this is executing on. See BXThreadData. The image is byte data in YUV420p (planar) format. This format provides grayscale data without having to perform a conversion before calling the Barcode Xpress recognition methods.
- (id) init

Initializes an empty thread queue.

Without any callbacks, and with a maximum thread count of zero, it won't be useful to call this method. Call initWithInfo:threadcount:sender:executioncallback:processingcallback: instead.

Returns
The Object ID.
The Object ID.
- (id) initWithInfo: (NSString*)  name
threadcount: (int)  threadCount
sender: (id)  sender
executioncallback: (SEL)  executionCallback
processingcallback: (SEL)  processingCallback 

Initializes the thread control data structures.

Parameters
nameAn abitrary name for the thread queue.
threadCountMaximum number of active threads.
senderObject instance that will execute callbacks.
executionCallbackCallback executed to perform recognition.
processingCallbackCallback executed before recognition is performed.
Returns
The Object ID.

Member Data Documentation

- (bool*) m_threadUsed
protected

A boolean array of length m_threadCount.

Each boolean is TRUE if a thread is currently performing an executionCallback.