Radium Engine  1.5.0
Ra::Core::Utils::AttribManager::ScopedLockState Class Reference

Scope lock state management for attributes. More...

#include <Core/Utils/Attribs.hpp>

+ Collaboration diagram for Ra::Core::Utils::AttribManager::ScopedLockState:

Public Member Functions

 ScopedLockState (AttribManager *a)
 Constructor, save lock state of all attribs from attribManager. More...
 
 ~ScopedLockState ()
 Destructor, unlock all attribs whose have been locked after the initialization of the Unlocker.
 

Detailed Description

Scope lock state management for attributes.

Unlock all attribs locked after the creation of the ScopedLockState object when it gets out of scope.

{
auto g = new AttribArrayGeometry();
// get write access. The attrib must be explicitly unlocked after usage
auto& attrib1 = g->getAttrib<Ra::Core::Vector3>( "attrib1" ).getDataWithLock();
// ... write to attribOne
// enable auto-unlock for all following write access requests
auto unlocker = g->vertexAttribs().getScopedLockState();
// get write access to several attribs
auto& attrib2 = g->getAttrib<Ra::Core::Vector3>( "attrib2" ).getDataWithLock();
// ... write to attrib2
auto& attrib3 = g->getAttrib<Ra::Core::Vector3>( "attrib3" ).getDataWithLock();
// ... write to attrib3
// attrib1 is still locked as it was locked outside of the unlocker scope.
// Must be explicitly unlocked.
attrib1.unlock();
// attrib2 and attrib3 are automatically unlocked when the unlocker's destructor
// is called (i.e. gets out of scope)
}
Attrib< T >::Container & getDataWithLock(const AttribHandle< T > &h)
Get the locked data container from the attrib handle.
Definition: Attribs.hpp:634

Definition at line 403 of file Attribs.hpp.

Constructor & Destructor Documentation

◆ ScopedLockState()

Ra::Core::Utils::AttribManager::ScopedLockState::ScopedLockState ( AttribManager a)
inlineexplicit

Constructor, save lock state of all attribs from attribManager.

Parameters
athe AttribManager on which locking will be supervised

Definition at line 410 of file Attribs.hpp.

+ Here is the call graph for this function:

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