Files
compute-runtime/unit_tests/helpers/raii_hw_helper.h
Filip Hazubski 5f021afd6d Move HwHelper to core directory
Change-Id: I2c78a8b737ee8e61b917b4918da37e77bbd9fe34
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
2019-11-15 14:06:40 +01:00

32 lines
697 B
C++

/*
* Copyright (C) 2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "core/helpers/hw_helper.h"
namespace NEO {
extern HwHelper *hwHelperFactory[IGFX_MAX_CORE];
template <class MockHelper>
class RAIIHwHelperFactory {
public:
GFXCORE_FAMILY gfxCoreFamily;
HwHelper *hwHelper;
MockHelper mockHwHelper;
RAIIHwHelperFactory(GFXCORE_FAMILY gfxCoreFamily) {
this->gfxCoreFamily = gfxCoreFamily;
hwHelper = hwHelperFactory[this->gfxCoreFamily];
hwHelperFactory[this->gfxCoreFamily] = &mockHwHelper;
}
~RAIIHwHelperFactory() {
hwHelperFactory[this->gfxCoreFamily] = hwHelper;
}
};
} // namespace NEO