DeepTrackDataObject#
- class deeptrack.backend.core.DeepTrackDataObject#
Bases:
object
Basic data container for DeepTrack2.
DeepTrackDataObject is a simple data container to store some data and track its validity.
Attributes#
- dataAny
The stored data. Default is None.
- validbool
A flag indicating whether the stored data is valid. Default is False.
Methods#
- store(dataAny) -> None
Stores data in the container and marks it as valid.
- current_value() -> Any
Returns the currently stored data.
- is_valid() -> bool
Returns whether the stored data is valid.
- invalidate() -> None
Marks the data as invalid.
- validate() -> None
Marks the data as valid.
Example#
Create a DeepTrackDataObject:
>>> data_obj = core.DeepTrackDataObject()
Store a value in this container:
>>> data_obj.store(42) >>> print(data_obj.current_value()) 42
Check if the stored data is valid:
>>> print(data_obj.is_valid()) True
Invalidate the stored data:
>>> data_obj.invalidate() >>> print(data_obj.is_valid()) False
Validate the data again to restore its status:
>>> data_obj.validate() >>> print(data_obj.is_valid()) True
Methods Summary
Retrieve the stored data.
Mark the stored data as invalid.
is_valid
()Return whether the stored data is valid.
store
(data)Store data and mark it as valid.
validate
()Mark the stored data as valid.
Methods Documentation
- invalidate() None #
Mark the stored data as invalid.
- is_valid() bool #
Return whether the stored data is valid.
Returns#
- bool
True if the data is valid, False otherwise.
- store(data: Any) None #
Store data and mark it as valid.
Parameters#
- dataAny
The data to be stored in the container.
- validate() None #
Mark the stored data as valid.