contains attributes (like positions, normals, texcoords) for keys (polygon, point, corner)
#include <attribute_map.h>
Inherits mesh3d::attribute_map_base< Key >.
Data Structures | |
struct | entry |
Public Types | |
typedef Key | key_type |
typedef Value | value_type |
Public Member Functions | |
attribute_map () | |
bool | empty () const |
index_type | size () const |
void | begin_insertion (index_type estimated_count=0) |
void | insert (Key const &key, Value const &value) |
void | end_insertion () |
bool | is_inserting () const |
void | set_value (Key const &key, Value const &value) |
Value | value (Key const &key) const |
bool | has (Key const &key) const |
void | optimize () |
bool | is_optimized () const |
std::type_info const & | value_type_id () const |
Definition at line 59 of file attribute_map.h.
typedef Key mesh3d::attribute_map< Key, Value >::key_type |
Definition at line 63 of file attribute_map.h.
typedef Value mesh3d::attribute_map< Key, Value >::value_type |
Definition at line 64 of file attribute_map.h.
mesh3d::attribute_map< Key, Value >::attribute_map | ( | ) | [inline] |
Definition at line 43 of file attribute_map.inl.
bool mesh3d::attribute_map< Key, Value >::empty | ( | ) | const [inline] |
Definition at line 50 of file attribute_map.inl.
index_type mesh3d::attribute_map< Key, Value >::size | ( | ) | const [inline] |
Definition at line 56 of file attribute_map.inl.
00057 { 00058 assert(m_entries.size() < std::numeric_limits<index_type>::max()); 00059 return static_cast<index_type>(m_entries.size()); 00060 }
void mesh3d::attribute_map< Key, Value >::begin_insertion | ( | index_type | estimated_count = 0 |
) | [inline] |
Definition at line 63 of file attribute_map.inl.
00065 { 00066 assert(!is_inserting()); 00067 00068 m_entries.clear(); 00069 m_entries.reserve(estimated_count); 00070 00071 m_is_optimized = false; 00072 m_is_inserting = true; 00073 }
void mesh3d::attribute_map< Key, Value >::insert | ( | Key const & | key, | |
Value const & | value | |||
) | [inline] |
Definition at line 76 of file attribute_map.inl.
00080 { 00081 assert(is_inserting()); 00082 assert(m_entries.size() + 1 < std::numeric_limits<index_type>::max()); 00083 00084 entry e; 00085 e.key = key; 00086 e.value = value; 00087 00088 #if _HAS_ITERATOR_DEBUGGING 00089 assert( 00090 std::find(m_entries.begin(), m_entries.end(), e) == m_entries.end() 00091 ); 00092 #endif 00093 00094 m_entries.push_back(e); 00095 }
void mesh3d::attribute_map< Key, Value >::end_insertion | ( | ) | [inline] |
Definition at line 98 of file attribute_map.inl.
00099 { 00100 assert(is_inserting()); 00101 00102 m_is_inserting = false; 00103 00104 optimize(); 00105 }
bool mesh3d::attribute_map< Key, Value >::is_inserting | ( | ) | const [inline] |
Definition at line 108 of file attribute_map.inl.
void mesh3d::attribute_map< Key, Value >::set_value | ( | Key const & | key, | |
Value const & | value | |||
) | [inline] |
Definition at line 114 of file attribute_map.inl.
00118 { 00119 assert(!is_inserting()); 00120 00121 entry_container::iterator i = find(key); 00122 if(i == m_entries.end()) 00123 { 00124 insert_entry(key, value); 00125 } 00126 else 00127 { 00128 i->value = value; 00129 } 00130 }
Value mesh3d::attribute_map< Key, Value >::value | ( | Key const & | key | ) | const [inline] |
Definition at line 133 of file attribute_map.inl.
00134 { 00135 assert(!is_inserting()); 00136 00137 entry_container::const_iterator i = find(key); 00138 if(i != m_entries.end()) 00139 { 00140 return i->value; 00141 } 00142 else 00143 { 00144 throw key_not_found_exception<Key>(key); 00145 } 00146 }
bool mesh3d::attribute_map< Key, Value >::has | ( | Key const & | key | ) | const [inline] |
Definition at line 149 of file attribute_map.inl.
00150 { 00151 assert(!is_inserting()); 00152 00153 return find(key) != m_entries.end(); 00154 }
void mesh3d::attribute_map< Key, Value >::optimize | ( | ) | [inline] |
Definition at line 157 of file attribute_map.inl.
00158 { 00159 assert(!is_inserting()); 00160 00161 std::sort(m_entries.begin(), m_entries.end()); 00162 00163 m_is_optimized = true; 00164 }
bool mesh3d::attribute_map< Key, Value >::is_optimized | ( | ) | const [inline] |
Definition at line 167 of file attribute_map.inl.
std::type_info const & mesh3d::attribute_map< Key, Value >::value_type_id | ( | ) | const [inline, virtual] |
Implements mesh3d::attribute_map_base< Key >.
Definition at line 173 of file attribute_map.inl.