HEBench
|
Helper class to encapsulate objects that will cross the boundary of the API Bridge. More...
#include <engine_object.hpp>
Public Member Functions | |
EngineObject (const BaseEngine &engine, std::shared_ptr< void > p_obj) | |
EngineObject (const EngineObject &src) | |
~EngineObject () override | |
EngineObject & | operator= (const EngineObject &src) |
const BaseEngine & | engine () const |
template<class T > | |
T & | get () |
template<class T > | |
const T & | get () const |
std::int64_t | classTag () const override |
Retrieves the tag of the class to which this object belongs. More... | |
Public Member Functions inherited from hebench::cpp::ITaggedObject | |
ITaggedObject () | |
virtual | ~ITaggedObject () |
Static Public Attributes | |
static constexpr std::int64_t | tag = 0x2000000000000000 |
Used to identify this class when returned as a handle to Test Harness. More... | |
Static Public Attributes inherited from hebench::cpp::ITaggedObject | |
static constexpr std::int64_t | MaskByteSet = 0xFF |
static constexpr std::int64_t | MaskReservedBits = MaskByteSet << 56 |
Mask representing all bits reserved by C++ wrapper. More... | |
Helper class to encapsulate objects that will cross the boundary of the API Bridge.
This class is provided to ease the creation of handles to backend internal objects (other than engine and benchmarks).
It is recommended to use BaseEngine::createHandle<ObjType>() to create HEBench opaque handles that wrap objects in an instance of this class that can cross the boundary of the API bridge. Use method BaseEngine::retrieveFromHandle<ObjType>() to retrieve the wrapped object, and BaseEngine::duplicateHandle() to create reference-counted handle duplicates.
When using this object directly, instead of the recommended wrappers, users should keep in mind that the method T &EngineObject::get<T>()
allows the retrieval of a reference to the created object of type T
by the backend when needed. However, the casting of the internal object by this method is unsafe. Users must ensure that the object contained is of the right type (such as using the tag
field in the handle for extra information).
Implementation of the API Bridge by this C++ wrapper will properly free and destroy pointers to EngineObject instances, and calling the appropriate destructor of the wrapped object of type T
when reference counts reach 0, if assigned to handles as follows:
For the automation to work well, the handle tag must satify:
Definition at line 102 of file engine_object.hpp.
|
inline |
Definition at line 114 of file engine_object.hpp.
|
inline |
Definition at line 120 of file engine_object.hpp.
|
inlineoverride |
Definition at line 124 of file engine_object.hpp.
|
inlineoverridevirtual |
Retrieves the tag of the class to which this object belongs.
Most significant 8 bits of the 64-bit tag are reserved by C++ wrapper. See ITaggedObject
for more details.
Implements hebench::cpp::ITaggedObject.
Definition at line 151 of file engine_object.hpp.
|
inline |
Definition at line 138 of file engine_object.hpp.
|
inline |
Definition at line 141 of file engine_object.hpp.
|
inline |
Definition at line 146 of file engine_object.hpp.
|
inline |
Definition at line 125 of file engine_object.hpp.
|
staticconstexpr |
Used to identify this class when returned as a handle to Test Harness.
Definition at line 112 of file engine_object.hpp.