17 #ifndef INCLUDED_ENTITYMAP
18 #define INCLUDED_ENTITYMAP
39 template<
class K,
class V>
struct key_val {
72 template<
class U>
struct _iter :
public std::iterator<std::forward_iterator_tag, U>
130 while (key >= newCapacity) newCapacity += 4096;
135 debug_warn(
"EntityMap::insert() realloc failed! Out of memory.");
136 throw std::bad_alloc();
199 for (; ptr !=
end; ++ptr)
242 template<
class VSerializer>
248 size_t len = value.
size();
253 VSerializer()(serialize,
"value", it->second);
263 for (
size_t i = 0; i < len; ++i)
268 VSerializer()(deserialize,
"value", v);
#define UNUSED(param)
mark a function parameter as unused and avoid the corresponding compiler warning. ...
void insert(const key_type key, const mapped_type &value)
const_iterator end() const
key_val< entity_id_t, T > value_type
EntityMap & operator=(const EntityMap &)
const_iterator find(const entity_id_t key) const
Serialization interface; see serialization overview.
void erase(const entity_id_t key)
iterator find(const entity_id_t key)
virtual void NumberU32_Unbounded(const char *name, uint32_t &out)
Representation of an entity, with the data needed for queries.
size_t count(const entity_id_t key) const
void operator()(ISerializer &serialize, const char *name, EntityMap< V > &value)
void operator()(IDeserializer &deserialize, const char *name, EntityMap< V > &value)
bool operator!=(_iter other)
#define T(string_literal)
void NumberU32_Unbounded(const char *name, uint32_t value)
Serialize a number.
const_iterator begin() const
_iter< value_type const > const_iterator
bool operator==(_iter other)
_iter< value_type > iterator
void NumberI32_Unbounded(const char *name, int32_t value)
Serialize a number.
#define debug_warn(expr)
display the error dialog with the given text.
const entity_id_t INVALID_ENTITY
Invalid entity ID.
u32 entity_id_t
Entity ID type.
A fast replacement for map<entity_id_t, T>.
Deserialization interface; see serialization overview.