radioviz.services.item_counter

This module provides the ItemCounter class for managing sequential counters.

The ItemCounter class allows for maintaining and incrementing a counter value, starting from a specified initial value. It’s designed to be used in scenarios where sequential numbering is required, such as generating unique identifiers or tracking item counts in various applications.

Classes

ItemCounter([start_value])

A class to manage sequential counting operations.

class radioviz.services.item_counter.ItemCounter(start_value: int = 1)[source]

Bases: object

A class to manage sequential counting operations.

This class maintains an internal counter that can be incremented and retrieved. The counter starts at a specified value and increments by 1 with each call to the next() method.

Parameters:

start_value (int) – The initial value for the counter. Defaults to 1.

Initialize the ItemCounter with a starting value.

Parameters:

start_value (int) – The initial value for the counter. Defaults to 1.

next() int[source]

Increment the counter by one and return the new value.

Returns:

The new counter value after incrementing.

Return type:

int

reset() None[source]

Reset the counter to its initial value.

This method resets the internal counter to the value specified during object initialization. It does not take any parameters and returns nothing.

Returns:

None

property count: int

Get the current counter value.

Returns:

The current counter value.

Return type:

int