mv_machine_learning: code refactoring to AsyncManager
authorInki Dae <inki.dae@samsung.com>
Tue, 12 Sep 2023 09:18:58 +0000 (18:18 +0900)
committerKwanghoon Son <k.son@samsung.com>
Wed, 25 Oct 2023 01:54:03 +0000 (10:54 +0900)
commit37a766addc53868de8baceba73ec24f27157c6c3
treee31df1672826c8112d37a05ea8217449635826aa
parentb567fc7c492cee9f164bfa161e79ddfb3548b8aa
mv_machine_learning: code refactoring to AsyncManager

[Issue type] : code refactoring

Do code refactoring to AsyncManager by introducing new public member functions -
push() and pop() - and by moving existing all member functions as private ones
excepting isWorking(), popFromInput() and pushToOutput() which are used
in InferenceCallback function of the object detection task group.

By doing this, it can support async API with AsyncManager easily because
what each task group has to do for it is to call push() in PerformAsync()
and to call pop() in getOutput(). In addition, this patch moves the logic
of inferenceCallback() to lamda block of performAsync().

For async API support, what each task group have to do is,
    void TaskGroup::performAsync()
    {
        ...
        // create AsyncManager class with lamda function.
        ...
        _async_manager->push(inputVectors);
    }

    void TaskGroup::getOutput()
    {
        if (_async_manager) {
            ...
            _current_result = _async_manager->pop();
        }
        ...
    }

Change-Id: I022c71b921b5351d739ba685c188625806162000
Signed-off-by: Inki Dae <inki.dae@samsung.com>
mv_machine_learning/common/include/async_manager.h
mv_machine_learning/common/src/async_manager.cpp
mv_machine_learning/object_detection/include/object_detection.h
mv_machine_learning/object_detection/src/object_detection.cpp