Program Listing for File range-collector.h

Return to documentation for file (include\playback\range-collector.h)

/******************************************************************************
© Intel Corporation.

This software and the related documents are Intel copyrighted materials,
and your use of them is governed by the express license under which they
were provided to you ("License"). Unless the License provides otherwise,
you may not use, modify, copy, publish, distribute, disclose or transmit
this software or the related documents without Intel's prior written
permission.


 This software and the related documents are provided as is, with no express
or implied warranties, other than those that are expressly stated in the
License.

******************************************************************************/
#pragma once

#include "playback/callable-cache.h"
#include "playback/callable.h"
#include "playback/sync-tracker.h"

#include <memory>
#include <functional>

namespace gpa {
namespace playback {

class RangeCollector
{
public:
    using CallableParser = std::function<sync_handler::SyncCommand(Callable&)>;

    RangeCollector(gpa::playback_common::CallableKey rangeBegin, gpa::playback_common::CallableKey rangeEnd, CallableParser callableParser, uint64_t targetQueueID = 0);
    const CallableCache& GetCallableCache() const;

    bool IsRangeStarted() const;
    bool IsRangeEnded() const;
    bool IsRangeValid() const;
    bool Process(Callable& callable);

private:
    CallableCache mRangeCache;
    gpa::playback_common::CallableKey mRangeBegin;
    gpa::playback_common::CallableKey mRangeEnd;
    uint64_t mTargetQueueID;
    bool mIsRangeStarted = false;
    bool mIsRangeExtensionStarted = false;
    CallableParser mCallableParser;
    sync_handler::SyncTracker<Callable> mSyncTracker;
};

}  // namespace playback
}  // namespace gpa