CyberEngineMkIII
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Private Attributes | List of all members
CYB::Engine::PushContext Class Reference

Context switching RAII helper. More...

#include <CYBInterop.hpp>

Collaboration diagram for CYB::Engine::PushContext:
Collaboration graph
[legend]

Public Member Functions

 PushContext (Context &ANewContext) noexcept
 Saves the current Context and calls MakeCurrent on ANewContext. More...
 
 ~PushContext ()
 Calls MakeCurrent on FOldContext.
 

Private Attributes

ContextFOldContext
 The context to pop upon destruction.
 

Detailed Description

Context switching RAII helper.

Definition at line 64 of file CYBInterop.hpp.

Constructor & Destructor Documentation

CYB::Engine::PushContext::PushContext ( Context ANewContext)
noexcept

Saves the current Context and calls MakeCurrent on ANewContext.

Parameters
ANewContextThe new Context to push
Thread Safety
This function requires no thread safety

Definition at line 51 of file CYBInterop.cpp.

51  :
52  FOldContext(static_cast<Context&>(Context::GetContext()))
53 {
54  ANewContext.MakeCurrent();
55 }
Context & FOldContext
The context to pop upon destruction.
Definition: CYBInterop.hpp:66
void MakeCurrent(void) noexcept
Set the current thread's Context singleton to this Context.
Definition: CYBInterop.cpp:47
static Context & GetContext(void) noexcept
Get the API's Context.
Definition: CYBInterop.cpp:35

The documentation for this class was generated from the following files: