/* * Copyright (C) 2017-2019 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once #include "runtime/event/user_event.h" #include "runtime/event/event_builder.h" namespace OCLRT { #define FORWARD_CONSTRUCTOR(THIS_CLASS, BASE_CLASS) \ template \ THIS_CLASS(ArgsT &&... args) : BASE_CLASS(std::forward(args)...) { \ } #define FORWARD_FUNC(FUNC_NAME, BASE_CLASS) \ template \ void FUNC_NAME(ArgsT &&... args) { \ BASE_CLASS::FUNC_NAME(std::forward(args)...); \ } template struct MockEvent : public BaseEventType { FORWARD_CONSTRUCTOR(MockEvent, BaseEventType); // make some protected members public : FORWARD_FUNC(submitCommand, BaseEventType); using BaseEventType::timeStampNode; using Event::calcProfilingData; using Event::magic; using Event::queueTimeStamp; using Event::submitTimeStamp; using Event::timestampPacketContainer; }; #undef FORWARD_CONSTRUCTOR #undef FORWARD_FUNC struct MockEventBuilder : EventBuilder { MockEventBuilder() = default; MockEventBuilder(Event *ev) { setEvent(ev); } void setEvent(Event *ev) { this->event = ev; } template static EventType *createAndFinalize(ArgsT &&... args) { MockEventBuilder mb; mb.create(std::forward(args)...); return static_cast(mb.finalizeAndRelease()); } }; } // namespace OCLRT