Radium Engine  1.5.0
Attribs.cpp
1 #include <Core/Types.hpp>
2 #include <Core/Utils/Attribs.hpp>
3 #include <Core/Utils/Log.hpp>
4 
5 namespace Ra {
6 namespace Core {
7 namespace Utils {
8 
9 AttribBase::~AttribBase() {
10  detachAll();
11 }
12 
13 AttribManager::~AttribManager() {
14  clear();
15 }
16 
18  m_attribs.clear();
19  m_attribsIndex.clear();
20  m_numAttribs = 0;
21 }
22 
24  m_attribs.clear();
25  m_numAttribs = 0;
26  for ( const auto& attr : m.m_attribs ) {
27  m_attribsIndex[attr->getName()] = m_attribs.size();
28  m_attribs.push_back( attr->clone() );
29  ++m_numAttribs;
30  }
31 }
32 
34  // one way
35  for ( const auto& attr : m_attribsIndex ) {
36  if ( other.m_attribsIndex.find( attr.first ) == other.m_attribsIndex.cend() ) {
37  return false;
38  }
39  }
40  // the other way
41  for ( const auto& attr : other.m_attribsIndex ) {
42  if ( m_attribsIndex.find( attr.first ) == m_attribsIndex.cend() ) { return false; }
43  }
44  return true;
45 }
46 
47 } // namespace Utils
48 } // namespace Core
49 } // namespace Ra
The AttribManager provides attributes management by handles.
Definition: Attribs.hpp:204
bool hasSameAttribs(const AttribManager &other)
Definition: Attribs.cpp:33
void copyAllAttributes(const AttribManager &m)
Definition: Attribs.cpp:23
void clear()
clear all attribs, invalidate handles.
Definition: Attribs.cpp:17
void detachAll()
Detach all observers.
Definition: Observable.hpp:73
Definition: Cage.cpp:3