---
layout: default-layout
title: CCandidateBarcodeZonesUnit Class - Dynamsoft Barcode Reader C++ Edition API Reference
description: API reference for the CCandidateBarcodeZonesUnit class in Dynamsoft Barcode Reader C++ Edition, an intermediate result unit that holds a collection of candidate barcode zones detected during processing.
keywords: GetCount, GetCandidateBarcodeZone, AddCandidateBarcodeZone, RemoveAllCandidateBarcodeZones, RemoveCandidateBarcodeZone, SetCandidateBarcodeZone, CCandidateBarcodeZonesUnit, api reference
---
# CCandidateBarcodeZonesUnit Class

The `CCandidateBarcodeZonesUnit` class represents a unit that contains candidate barcode zones unit. It inherits from the `CIntermediateResultUnit` class.

## Definition

*Namespace:* dynamsoft::dbr::intermediate_results

*Assembly:* DynamsoftBarcodeReader

*Inheritance:* [CIntermediateResultUnit]({{ site.dcvb_cpp_api }}core/intermediate-results/intermediate-result-unit.html) -> CCandidateBarcodeZonesUnit

```cpp
class CCandidateBarcodeZonesUnit: public CIntermediateResultUnit
```

## Methods

| Method                            | Description |
|-----------------------------------|-------------|
| [`AddCandidateBarcodeZone`](#addcandidatebarcodezone)           | Adds a candidate barcode zone.|
| [`GetCandidateBarcodeZone`](#getcandidatebarcodezone)           | Gets a pointer to a specific candidate barcode zone.|
| [`GetCount`](#getcount)           | Gets the number of candidate barcode zones in the unit.|
| [`RemoveAllCandidateBarcodeZones`](#removeallcandidatebarcodezones)           | Removes all the candidate barcode zones.|
| [`RemoveCandidateBarcodeZone`](#removecandidatebarcodezone)           | Removes a candidate barcode zone at the specified index.|
| [`SetCandidateBarcodeZone`](#setcandidatebarcodezone)           | Sets a candidate barcode zone at the specified index.|
| **Methods Inherited from [CIntermediateResultUnit]({{ site.dcvb_cpp_api }}core/intermediate-results/intermediate-result-unit.html):** | |
| [`GetHashId`]({{ site.dcvb_cpp_api }}core/intermediate-results/intermediate-result-unit.html#gethashid) | Gets the hash ID of the unit. |
| [`GetOriginalImageHashId`]({{ site.dcvb_cpp_api }}core/intermediate-results/intermediate-result-unit.html#getoriginalimagehashid) | Gets the hash ID of the original image. |
| [`GetOriginalImageTag`]({{ site.dcvb_cpp_api }}core/intermediate-results/intermediate-result-unit.html#getoriginalimagetag) | Gets the tag of the original image. |
| [`GetType`]({{ site.dcvb_cpp_api }}core/intermediate-results/intermediate-result-unit.html#gettype) | Gets the type of the intermediate result unit. |
| [`Clone`]({{ site.dcvb_cpp_api }}core/intermediate-results/intermediate-result-unit.html#clone) | Creates a copy of the intermediate result unit. |
| [`SetHashId`]({{ site.dcvb_cpp_api }}core/intermediate-results/intermediate-result-unit.html#sethashid) | Sets the hash ID of the unit. |
| [`SetOriginalImageHashId`]({{ site.dcvb_cpp_api }}core/intermediate-results/intermediate-result-unit.html#setoriginalimagehashid) | Sets the hash ID of the original image. |
| [`SetOriginalImageTag`]({{ site.dcvb_cpp_api }}core/intermediate-results/intermediate-result-unit.html#setoriginalimagetag) | Sets the tag of the original image. |
| [`Retain`]({{ site.dcvb_cpp_api }}core/intermediate-results/intermediate-result-unit.html#retain) | Increases the reference count of the unit. |
| [`Release`]({{ site.dcvb_cpp_api }}core/intermediate-results/intermediate-result-unit.html#release) | Decreases the reference count of the unit. |
| [`GetTransformMatrix`]({{ site.dcvb_cpp_api }}core/intermediate-results/intermediate-result-unit.html#gettransformmatrix) | Gets the transformation matrix via `CTransformMatrixType`. |
| [`SetTransformMatrix`]({{ site.dcvb_cpp_api }}core/intermediate-results/intermediate-result-unit.html#settransformmatrix) | Sets the transformation matrix via `CTransformMatrixType`. |

### AddCandidateBarcodeZone

Adds a candidate barcode zone.

```cpp
virtual int AddCandidateBarcodeZone(const CCandidateBarcodeZone& barcodeZone, const double matrixToOriginalImage[9] = IDENTITY_MATRIX) = 0;
```

**Parameters**

`barcodeZone` The candidate barcode zone.

`matrixToOriginalImage` The matrix to original image.

**Return value**

Returns 0 if successful, otherwise returns a negative value.

### GetCandidateBarcodeZone

Gets a pointer to a candidate barcode zone specified by index.

```cpp
virtual int GetCandidateBarcodeZone(int index, CCandidateBarcodeZone* barcodeZone) const = 0;
```

**Parameters**

`[in] index` The index of the candidate barcode zone.

`[out] quad` The pointer to the candidate barcode zone.

**Return value**

Returns 0 if successful, otherwise returns a negative value.

**See Also**

[CCandidateBarcodeZone]({{ site.dbr_cpp_api }}candidate-barcode-zone.html)

### GetCount

Gets the number of localized barcodes in the unit.

```cpp
virtual int GetCount() const = 0;
```

**Return value**

Returns the number of candidate barcode zones in the unit.



### RemoveAllCandidateBarcodeZones

Removes all the candidate barcode zones

```cpp
virtual void RemoveAllCandidateBarcodeZones() = 0;
```

### RemoveCandidateBarcodeZone

Removes a candidate barcode zone at the specified index

```cpp
virtual int RemoveCandidateBarcodeZone(int index) = 0;
```

**Parameters**

`index` The index of the candidate barcode zone.

**Return value**

Returns 0 if successful, otherwise returns a negative value.

### SetCandidateBarcodeZone

Sets a candidate barcode zone at the specified index.

```cpp
virtual int SetCandidateBarcodeZone(int index, const CCandidateBarcodeZone& barcodeZone, const double matrixToOriginalImage[9] = IDENTITY_MATRIX) = 0;
```

**Parameters**

`index` The index of the candidate barcode zone.

`barcodeZone` The candidate barcode zone.

`matrixToOriginalImage` The matrix to original image.

**Return value**

Returns 0 if successful, otherwise returns a negative value.
