Barcode Xpress Mobile for iOS
BXThreadQueue Class Reference

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

#import <BXThreadQueue.h>

List of all members.

Public Member Functions

(id) - init
 Initialize an empty thread queue.
(id) - initWithInfo:::::
 Initialize the thread control data structures.
(void) - dispatch:
 Create a new thread to perform recognition on an image, if a thread in the queue is available.
(bool) - canDispatch
 Test to see if there is a slot in the thread queue that is not being used by an active thread.
(bool) - canDispatch:
 Test to see if there is a slot in the thread queue that is not being used by an active thread.

Protected Attributes

int m_threadCount
 The maximum number of threads to use.
bool * m_threadUsed
 Boolean array of length m_threadCount.
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
 Name of the thread queue. Set any arbitrary name.
SEL m_executionCallback
 Callback executed to perform recognition.
SEL m_processingCallback
 Callback executed before recognition is performed.

Detailed Description

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


Member Function Documentation

- (bool) canDispatch

Test to see 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

Test to see 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

Create 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

Initialize an empty thread queue.

Without any callbacks, and with a maximum thread count of zero, it won't be useful. There's no reason to call this method. Call -initWithInfo instead.

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

Initialize 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]

Boolean array of length m_threadCount.

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