Radium Engine  1.5.20
Loading...
Searching...
No Matches
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.
 
 ~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)
}
This class represents vertex + attributes per vertex. Toplogy is handled in MultiIndexedGeometry subc...
Attrib< T >::Container & getDataWithLock(const AttribHandle< T > &h)
Get the locked data container from the attrib handle.
Definition Attribs.hpp:633

Definition at line 402 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 409 of file Attribs.hpp.

+ Here is the call graph for this function:

◆ ~ScopedLockState()

Ra::Core::Utils::AttribManager::ScopedLockState::~ScopedLockState ( )
inline

Destructor, unlock all attribs whose have been locked after the initialization of the Unlocker.

Definition at line 418 of file Attribs.hpp.


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