Files

75 lines
1.4 KiB
C++

/**
* @file include/ActivOneApi/Context.h
*
* @brief Header file for the Context class.
*/
#if (!defined ACTIV_ONE_API_CONTEXT_H)
#define ACTIV_ONE_API_CONTEXT_H
#include "ActivOneApi/External.h"
#include "ActivOneApi/TypeDefinitions.h"
//! Activ namespace.
namespace Activ
{
//! OneApi namespace.
namespace OneApi
{
class Session;
/**
* @brief Context class.
* Callback context information, includes the Handle of the request that generated the event, the Session and associated
* user data.
*/
class Context
{
public:
/**
* @brief Get Handle.
*
* @return The Handle associated with the request that generated this event.
*/
Handle GetHandle() const
{
return m_handle;
}
/**
* @brief Get user data.
*
* @return The user data assigned to during the initial request.
*/
void *GetUserData() const
{
return m_pUserData;
}
/**
* @brief Get Session.
*
* @return The Session generating this event.
*/
Session &GetSession() const
{
return *m_pSession;
}
private:
friend class RequestBase;
Handle m_handle; ///< Handle of the request that generated this event.
void * m_pUserData; ///< Pointer to user data provided during request.
Session * m_pSession; ///< Pointer to the session that this request belongs to.
};
} // namespace OneApi
} // namespace Activ
#endif // (!defined ACTIV_ONE_API_CONTEXT_H)