Wildmeshing Toolkit
AttributeScopeHandle.cpp
Go to the documentation of this file.
1
#include "
AttributeScopeHandle.hpp
"
2
#include "
AttributeManager.hpp
"
3
namespace
wmtk::attribute
{
4
AttributeScopeHandle::AttributeScopeHandle
(
AttributeManager
& manager)
5
: m_manager(manager)
6
{
7
m_manager
.
push_scope
();
8
}
9
10
11
AttributeScopeHandle::AttributeScopeHandle
(
AttributeScopeHandle
&& o)
12
: m_manager(o.m_manager)
13
, m_failed(o.m_failed)
14
, m_was_moved(o.m_was_moved)
15
{
16
o.m_was_moved =
true
;
17
}
18
19
void
AttributeScopeHandle::mark_failed
()
20
{
21
// the dev should know if they moved a handle and then tried to mark it as failed
22
assert(!
m_was_moved
);
23
if
(!
m_was_moved
) {
24
m_failed
=
true
;
25
m_manager
.
rollback_current_scope
();
26
}
27
}
28
AttributeScopeHandle::~AttributeScopeHandle
()
29
{
30
if
(!
m_was_moved
) {
31
m_manager
.
pop_scope
(!
m_failed
);
32
}
33
}
34
}
// namespace wmtk::attribute
AttributeManager.hpp
wmtk::attribute::AttributeManager
Definition:
AttributeManager.hpp:17
wmtk::attribute::AttributeManager::pop_scope
void pop_scope(bool apply_updates=true)
Definition:
AttributeManager.cpp:207
wmtk::attribute::AttributeManager::push_scope
void push_scope()
Definition:
AttributeManager.cpp:192
wmtk::attribute::AttributeManager::rollback_current_scope
void rollback_current_scope()
Definition:
AttributeManager.cpp:223
wmtk::attribute::AttributeScopeHandle
This handle is a wrapper for the MeshManager scope funtions.
Definition:
AttributeScopeHandle.hpp:15
wmtk::attribute::AttributeScopeHandle::m_was_moved
bool m_was_moved
Definition:
AttributeScopeHandle.hpp:44
wmtk::attribute::AttributeScopeHandle::~AttributeScopeHandle
~AttributeScopeHandle()
Destructor of AttributeScopeHandle.
Definition:
AttributeScopeHandle.cpp:28
wmtk::attribute::AttributeScopeHandle::m_failed
bool m_failed
Definition:
AttributeScopeHandle.hpp:43
wmtk::attribute::AttributeScopeHandle::m_manager
AttributeManager & m_manager
Definition:
AttributeScopeHandle.hpp:42
wmtk::attribute::AttributeScopeHandle::AttributeScopeHandle
AttributeScopeHandle(AttributeManager &manager)
Constructs an AttributeScopeHandle for the given AttributeManager.
Definition:
AttributeScopeHandle.cpp:4
wmtk::attribute::AttributeScopeHandle::mark_failed
void mark_failed()
Mark scope as failed.
Definition:
AttributeScopeHandle.cpp:19
AttributeScopeHandle.hpp
wmtk::attribute
Definition:
Accessor.hpp:17
src
wmtk
attribute
AttributeScopeHandle.cpp
Generated by
1.9.1