17#ifndef INCLUDED_ENTITYMAP
18#define INCLUDED_ENTITYMAP
40 template<
class K,
class V>
struct key_val {
137 while (
key >= newCapacity) newCapacity += 4096;
142 debug_warn(
"EntityMap::insert() realloc failed! Out of memory.");
143 throw std::bad_alloc();
209 for (; ptr !=
end; ++ptr)
257 size_t len = value.
size();
276 for (
size_t i = 0; i < len; ++i)
Helper templates definitions for serializing/deserializing common objects.
void Serializer(S &serialize, const char *name, Args &&... args)
Definition: SerializeTemplates.h:51
A fast replacement for map<entity_id_t, T>.
Definition: EntityMap.h:32
size_t size() const
Definition: EntityMap.h:129
EntityMap()
Definition: EntityMap.h:57
const_iterator end() const
Definition: EntityMap.h:122
void erase(iterator it)
Definition: EntityMap.h:181
EntityMap(const EntityMap &)
size_t m_Count
Definition: EntityMap.h:53
void insert(const key_type key, const mapped_type &value)
Definition: EntityMap.h:132
const_iterator begin() const
Definition: EntityMap.h:116
_iter< value_type const > const_iterator
Definition: EntityMap.h:104
const_iterator find(const entity_id_t key) const
Definition: EntityMap.h:231
_iter< value_type > iterator
Definition: EntityMap.h:103
void clear()
Definition: EntityMap.h:204
EntityMap & operator=(const EntityMap &)
size_t count(const entity_id_t key) const
Definition: EntityMap.h:241
T mapped_type
Definition: EntityMap.h:39
~EntityMap()
Definition: EntityMap.h:67
iterator find(const entity_id_t key)
Definition: EntityMap.h:221
size_t m_BufferCapacity
Definition: EntityMap.h:50
void erase(const entity_id_t key)
Definition: EntityMap.h:191
value_type * m_Buffer
Definition: EntityMap.h:51
entity_id_t key_type
Definition: EntityMap.h:38
key_val< entity_id_t, T > value_type
Definition: EntityMap.h:46
size_t m_BufferSize
Definition: EntityMap.h:49
bool empty() const
Definition: EntityMap.h:128
iterator begin()
Definition: EntityMap.h:106
iterator end()
Definition: EntityMap.h:112
Deserialization interface; see serialization overview.
Definition: IDeserializer.h:35
virtual void NumberU32_Unbounded(const char *name, uint32_t &out)
Definition: IDeserializer.cpp:124
Serialization interface; see serialization overview.
Definition: ISerializer.h:121
void NumberU32_Unbounded(const char *name, uint32_t value)
Serialize a number.
Definition: ISerializer.h:171
#define UNUSED(param)
mark a function parameter as unused and avoid the corresponding compiler warning.
Definition: code_annotation.h:40
#define debug_warn(expr)
display the error dialog with the given text.
Definition: debug.h:319
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
Definition: debug.h:277
#define T(string_literal)
Definition: secure_crt.cpp:77
const entity_id_t INVALID_ENTITY
Invalid entity ID.
Definition: Entity.h:35
u32 entity_id_t
Entity ID type.
Definition: Entity.h:29
Definition: EntityMap.h:74
U * val
Definition: EntityMap.h:81
bool operator!=(_iter other)
Definition: EntityMap.h:99
std::ptrdiff_t difference_type
Definition: EntityMap.h:77
_iter(U *init)
Definition: EntityMap.h:82
U * pointer
Definition: EntityMap.h:78
std::forward_iterator_tag iterator_category
Definition: EntityMap.h:75
bool operator==(_iter other)
Definition: EntityMap.h:98
_iter & operator++()
Definition: EntityMap.h:85
_iter & operator++(int)
Definition: EntityMap.h:91
U & reference
Definition: EntityMap.h:79
U * operator->()
Definition: EntityMap.h:84
U value_type
Definition: EntityMap.h:76
U & operator*()
Definition: EntityMap.h:83
Definition: EntityMap.h:40
K first_type
Definition: EntityMap.h:41
V second
Definition: EntityMap.h:44
V second_type
Definition: EntityMap.h:42
K first
Definition: EntityMap.h:43
void operator()(IDeserializer &deserialize, const char *name, EntityMap< T > &value)
Definition: EntityMap.h:271
void operator()(ISerializer &serialize, const char *name, EntityMap< T > &value)
Definition: EntityMap.h:255
Definition: SerializeTemplates.h:42
uint32_t u32
Definition: types.h:39
unsigned int uint32_t
Definition: wposix_types.h:53
pthread_key_t key
Definition: wpthread.cpp:140