aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2015-02-25 00:13:14 +0100
committerShauren <shauren.trinity@gmail.com>2015-04-28 21:19:46 +0200
commitca83e14f8b141fab0a13e08f48fca6c1ace0c4c7 (patch)
tree68487de0cd291b6aba9131a4eade228433f05d99 /src/server/shared
parent455ef1a64af14ee249e270b451f67f552ba3605a (diff)
Core/Entities: Reworked guid scopes
* Added ObjectGuid traits to easily access whether guid type can be generated globally (ObjectMgr) or not * This adds separate (per map) guid sequences depending on object type * Ported map object container from cmangos/mangos-wotlk@a2d396eb0bb195efc460944dd4e0fab2a858b300 * Added type container visitor for TypeUnorderedMapContainer * Implemented helper function to erase unique pairs from multimap containers * Moved object storage of all objects except players and transports to map level * Added containers linking database spawn id with creature/gameobject in world * Renamed DBTableGuid to spawnId * Added a separate spawn id sequence generator for creatures and gameobjects - this will be used in db tables * Moved building SMSG_UPDATE_OBJECT - updatefields changes broadcast to map update
Diffstat (limited to 'src/server/shared')
-rw-r--r--src/server/shared/Containers.h13
-rw-r--r--src/server/shared/Database/Implementation/CharacterDatabase.cpp17
-rw-r--r--src/server/shared/Database/Implementation/CharacterDatabase.h7
-rw-r--r--src/server/shared/Dynamic/TypeContainer.h83
-rw-r--r--src/server/shared/Dynamic/TypeContainerFunctions.h136
-rw-r--r--src/server/shared/Dynamic/TypeContainerVisitor.h39
-rw-r--r--src/server/shared/Dynamic/TypeList.h1
7 files changed, 210 insertions, 86 deletions
diff --git a/src/server/shared/Containers.h b/src/server/shared/Containers.h
index 5dee18cb752..685acea05e3 100644
--- a/src/server/shared/Containers.h
+++ b/src/server/shared/Containers.h
@@ -92,6 +92,19 @@ namespace Trinity
return false;
}
+
+ template<class K, class V, template<class, class, class...> class M, class... Rest>
+ void MultimapErasePair(M<K, V, Rest...>& multimap, K const& key, V const& value)
+ {
+ auto range = multimap.equal_range(key);
+ for (auto itr = range.first; itr != range.second;)
+ {
+ if (itr->second == value)
+ itr = multimap.erase(itr);
+ else
+ ++itr;
+ }
+ }
}
//! namespace Containers
}
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
index c7a63911a4c..6c18a0e76ee 100644
--- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
@@ -338,16 +338,13 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PrepareStatement(CHAR_DEL_PLAYER_HOMEBIND, "DELETE FROM character_homebind WHERE guid = ?", CONNECTION_ASYNC);
// Corpse
- PrepareStatement(CHAR_SEL_CORPSES, "SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId, corpseGuid, guid FROM corpse WHERE corpseType <> 0", CONNECTION_SYNCH);
- PrepareStatement(CHAR_INS_CORPSE, "INSERT INTO corpse (corpseGuid, guid, posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
- PrepareStatement(CHAR_DEL_CORPSE, "DELETE FROM corpse WHERE corpseGuid = ?", CONNECTION_ASYNC);
- PrepareStatement(CHAR_DEL_PLAYER_CORPSES, "DELETE FROM corpse WHERE guid = ? AND corpseType <> 0", CONNECTION_ASYNC);
- PrepareStatement(CHAR_DEL_OLD_CORPSES, "DELETE FROM corpse WHERE corpseType = 0 OR time < (UNIX_TIMESTAMP(NOW()) - ?)", CONNECTION_ASYNC);
- PrepareStatement(CHAR_SEL_CORPSE_PHASES, "SELECT Guid, PhaseId FROM corpse_phases", CONNECTION_SYNCH);
- PrepareStatement(CHAR_DEL_CORPSE_PHASES, "DELETE FROM corpse_phases WHERE Guid = ?", CONNECTION_ASYNC);
- PrepareStatement(CHAR_DEL_PLAYER_CORPSES_PHASES, "DELETE FROM corpse_phases WHERE OwnerGuid = ? AND CorpseType <> 0", CONNECTION_ASYNC);
- PrepareStatement(CHAR_DEL_OLD_CORPSE_PHASES, "DELETE FROM corpse_phases WHERE CorpseType = 0 OR Time < (UNIX_TIMESTAMP(NOW()) - ?)", CONNECTION_ASYNC);
- PrepareStatement(CHAR_INS_CORPSE_PHASES, "INSERT INTO corpse_phases (Guid, PhaseId, OwnerGuid, Time, CorpseType) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC);
+ PrepareStatement(CHAR_SEL_CORPSES, "SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId, guid FROM corpse WHERE mapId = ?", CONNECTION_SYNCH);
+ PrepareStatement(CHAR_INS_CORPSE, "INSERT INTO corpse (guid, posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
+ PrepareStatement(CHAR_DEL_CORPSE, "DELETE FROM corpse WHERE guid = ?", CONNECTION_ASYNC);
+ PrepareStatement(CHAR_DEL_CORPSES_FROM_MAP, "DELETE cp, c FROM corpse_phases cp INNER JOIN corpse c ON cp.OwnerGuid = c.guid WHERE c.mapId = ?", CONNECTION_ASYNC);
+ PrepareStatement(CHAR_SEL_CORPSE_PHASES, "SELECT cp.OwnerGuid, cp.PhaseId FROM corpse_phases cp LEFT JOIN corpse c ON cp.OwnerGuid = c.guid WHERE c.mapId = ?", CONNECTION_SYNCH);
+ PrepareStatement(CHAR_INS_CORPSE_PHASES, "INSERT INTO corpse_phases (OwnerGuid, PhaseId) VALUES (?, ?)", CONNECTION_ASYNC);
+ PrepareStatement(CHAR_DEL_CORPSE_PHASES, "DELETE FROM corpse_phases WHERE OwnerGuid = ?", CONNECTION_ASYNC);
// Creature respawn
PrepareStatement(CHAR_SEL_CREATURE_RESPAWNS, "SELECT guid, respawnTime FROM creature_respawn WHERE mapId = ? AND instanceId = ?", CONNECTION_SYNCH);
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h
index b6897204b6a..ed3b6dd8098 100644
--- a/src/server/shared/Database/Implementation/CharacterDatabase.h
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.h
@@ -294,13 +294,10 @@ enum CharacterDatabaseStatements
CHAR_SEL_CORPSES,
CHAR_INS_CORPSE,
CHAR_DEL_CORPSE,
- CHAR_DEL_PLAYER_CORPSES,
- CHAR_DEL_OLD_CORPSES,
+ CHAR_DEL_CORPSES_FROM_MAP,
CHAR_SEL_CORPSE_PHASES,
- CHAR_DEL_CORPSE_PHASES,
- CHAR_DEL_PLAYER_CORPSES_PHASES,
- CHAR_DEL_OLD_CORPSE_PHASES,
CHAR_INS_CORPSE_PHASES,
+ CHAR_DEL_CORPSE_PHASES,
CHAR_SEL_CREATURE_RESPAWNS,
CHAR_REP_CREATURE_RESPAWN,
diff --git a/src/server/shared/Dynamic/TypeContainer.h b/src/server/shared/Dynamic/TypeContainer.h
index 2165945d119..9b264fdea7f 100644
--- a/src/server/shared/Dynamic/TypeContainer.h
+++ b/src/server/shared/Dynamic/TypeContainer.h
@@ -25,6 +25,7 @@
*/
#include <map>
+#include <unordered_map>
#include <vector>
#include "Define.h"
#include "Dynamic/TypeList.h"
@@ -35,54 +36,41 @@
* By itself its meaningless but collaborate along with TypeContainers,
* it become the most powerfully container in the whole system.
*/
-template<class OBJECT> struct ContainerMapList
+template<class OBJECT>
+struct ContainerMapList
{
//std::map<OBJECT_HANDLE, OBJECT *> _element;
GridRefManager<OBJECT> _element;
};
-template<> struct ContainerMapList<TypeNull> /* nothing is in type null */
+template<>
+struct ContainerMapList<TypeNull> /* nothing is in type null */
{
};
-template<class H, class T> struct ContainerMapList<TypeList<H, T> >
+
+template<class H, class T>
+struct ContainerMapList<TypeList<H, T> >
{
ContainerMapList<H> _elements;
ContainerMapList<T> _TailElements;
};
-/*
- * @class ContaierArrayList is a multi-type container for
- * array of elements.
- */
-template<class OBJECT> struct ContainerArrayList
+template<class OBJECT, class KEY_TYPE>
+struct ContainerUnorderedMap
{
- std::vector<OBJECT> _element;
+ std::unordered_map<KEY_TYPE, OBJECT*> _element;
};
-// termination condition
-template<> struct ContainerArrayList<TypeNull> { };
-// recursion
-template<class H, class T> struct ContainerArrayList<TypeList<H, T> >
+template<class KEY_TYPE>
+struct ContainerUnorderedMap<TypeNull, KEY_TYPE>
{
- ContainerArrayList<H> _elements;
- ContainerArrayList<T> _TailElements;
};
-/*
- * @class ContainerList is a simple list of different types of elements
- *
- */
-template<class OBJECT> struct ContainerList
+template<class H, class T, class KEY_TYPE>
+struct ContainerUnorderedMap<TypeList<H, T>, KEY_TYPE>
{
- OBJECT _element;
-};
-
-/* TypeNull is underfined */
-template<> struct ContainerList<TypeNull> { };
-template<class H, class T> struct ContainerList<TypeList<H, T> >
-{
- ContainerList<H> _elements;
- ContainerMapList<T> _TailElements;
+ ContainerUnorderedMap<H, KEY_TYPE> _elements;
+ ContainerUnorderedMap<T, KEY_TYPE> _TailElements;
};
#include "TypeContainerFunctions.h"
@@ -101,14 +89,16 @@ class TypeMapContainer
template<class SPECIFIC_TYPE> size_t Count() const { return Trinity::Count(i_elements, (SPECIFIC_TYPE*)NULL); }
/// inserts a specific object into the container
- template<class SPECIFIC_TYPE> bool insert(SPECIFIC_TYPE *obj)
+ template<class SPECIFIC_TYPE>
+ bool insert(SPECIFIC_TYPE *obj)
{
SPECIFIC_TYPE* t = Trinity::Insert(i_elements, obj);
return (t != NULL);
}
/// Removes the object from the container, and returns the removed object
- //template<class SPECIFIC_TYPE> bool remove(SPECIFIC_TYPE* obj)
+ //template<class SPECIFIC_TYPE>
+ //bool remove(SPECIFIC_TYPE* obj)
//{
// SPECIFIC_TYPE* t = Trinity::Remove(i_elements, obj);
// return (t != NULL);
@@ -120,5 +110,34 @@ class TypeMapContainer
private:
ContainerMapList<OBJECT_TYPES> i_elements;
};
-#endif
+template<class OBJECT_TYPES, class KEY_TYPE>
+class TypeUnorderedMapContainer
+{
+public:
+ template<class SPECIFIC_TYPE>
+ bool Insert(KEY_TYPE const& handle, SPECIFIC_TYPE* obj)
+ {
+ return Trinity::Insert(_elements, handle, obj);
+ }
+
+ template<class SPECIFIC_TYPE>
+ bool Remove(KEY_TYPE const& handle)
+ {
+ return Trinity::Remove(_elements, handle, (SPECIFIC_TYPE*)NULL);
+ }
+
+ template<class SPECIFIC_TYPE>
+ SPECIFIC_TYPE* Find(KEY_TYPE const& handle)
+ {
+ return Trinity::Find(_elements, handle, (SPECIFIC_TYPE*)NULL);
+ }
+
+ ContainerUnorderedMap<OBJECT_TYPES, KEY_TYPE>& GetElements() { return _elements; }
+ ContainerUnorderedMap<OBJECT_TYPES, KEY_TYPE> const& GetElements() const { return _elements; }
+
+private:
+ ContainerUnorderedMap<OBJECT_TYPES, KEY_TYPE> _elements;
+};
+
+#endif
diff --git a/src/server/shared/Dynamic/TypeContainerFunctions.h b/src/server/shared/Dynamic/TypeContainerFunctions.h
index a89f5bd10d4..4a841cfda56 100644
--- a/src/server/shared/Dynamic/TypeContainerFunctions.h
+++ b/src/server/shared/Dynamic/TypeContainerFunctions.h
@@ -28,60 +28,164 @@
#include "Define.h"
#include "Dynamic/TypeList.h"
#include <map>
+#include <unordered_map>
namespace Trinity
{
+ // Helpers
+ // Insert helpers
+ template<class SPECIFIC_TYPE, class KEY_TYPE>
+ bool Insert(ContainerUnorderedMap<SPECIFIC_TYPE, KEY_TYPE>& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* obj)
+ {
+ auto i = elements._element.find(handle);
+ if (i == elements._element.end())
+ {
+ elements._element[handle] = obj;
+ return true;
+ }
+ else
+ {
+ ASSERT(i->second == obj, "Object with certain key already in but objects are different!");
+ return false;
+ }
+ }
+
+ template<class SPECIFIC_TYPE, class KEY_TYPE>
+ bool Insert(ContainerUnorderedMap<TypeNull, KEY_TYPE>& /*elements*/, KEY_TYPE const& /*handle*/, SPECIFIC_TYPE* /*obj*/)
+ {
+ return false;
+ }
+
+ template<class SPECIFIC_TYPE, class KEY_TYPE, class T>
+ bool Insert(ContainerUnorderedMap<T, KEY_TYPE>& /*elements*/, KEY_TYPE const& /*handle*/, SPECIFIC_TYPE* /*obj*/)
+ {
+ return false;
+ }
+
+ template<class SPECIFIC_TYPE, class KEY_TYPE, class H, class T>
+ bool Insert(ContainerUnorderedMap<TypeList<H, T>, KEY_TYPE>& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* obj)
+ {
+ bool ret = Insert(elements._elements, handle, obj);
+ return ret ? ret : Insert(elements._TailElements, handle, obj);
+ }
+
+ // Find helpers
+ template<class SPECIFIC_TYPE, class KEY_TYPE>
+ SPECIFIC_TYPE* Find(ContainerUnorderedMap<SPECIFIC_TYPE, KEY_TYPE> const& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* /*obj*/)
+ {
+ auto i = elements._element.find(handle);
+ if (i == elements._element.end())
+ return nullptr;
+ else
+ return i->second;
+ }
+
+ template<class SPECIFIC_TYPE, class KEY_TYPE>
+ SPECIFIC_TYPE* Find(ContainerUnorderedMap<TypeNull, KEY_TYPE> const& /*elements*/, KEY_TYPE const& /*handle*/, SPECIFIC_TYPE* /*obj*/)
+ {
+ return nullptr;
+ }
+
+ template<class SPECIFIC_TYPE, class KEY_TYPE, class T>
+ SPECIFIC_TYPE* Find(ContainerUnorderedMap<T, KEY_TYPE> const& /*elements*/, KEY_TYPE const& /*handle*/, SPECIFIC_TYPE* /*obj*/)
+ {
+ return nullptr;
+ }
+
+ template<class SPECIFIC_TYPE, class KEY_TYPE, class H, class T>
+ SPECIFIC_TYPE* Find(ContainerUnorderedMap<TypeList<H, T>, KEY_TYPE> const& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* /*obj*/)
+ {
+ SPECIFIC_TYPE* ret = Find(elements._elements, handle, (SPECIFIC_TYPE*)nullptr);
+ return ret ? ret : Find(elements._TailElements, handle, (SPECIFIC_TYPE*)nullptr);
+ }
+
+ // Erase helpers
+ template<class SPECIFIC_TYPE, class KEY_TYPE>
+ bool Remove(ContainerUnorderedMap<SPECIFIC_TYPE, KEY_TYPE>& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* /*obj*/)
+ {
+ elements._element.erase(handle);
+ return true;
+ }
+
+ template<class SPECIFIC_TYPE, class KEY_TYPE>
+ bool Remove(ContainerUnorderedMap<TypeNull, KEY_TYPE>& /*elements*/, KEY_TYPE const& /*handle*/, SPECIFIC_TYPE* /*obj*/)
+ {
+ return false;
+ }
+
+ template<class SPECIFIC_TYPE, class KEY_TYPE, class T>
+ bool Remove(ContainerUnorderedMap<T, KEY_TYPE>& /*elements*/, KEY_TYPE const& /*handle*/, SPECIFIC_TYPE* /*obj*/)
+ {
+ return false;
+ }
+
+ template<class SPECIFIC_TYPE, class KEY_TYPE, class H, class T>
+ bool Remove(ContainerUnorderedMap<TypeList<H, T>, KEY_TYPE>& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* /*obj*/)
+ {
+ bool ret = Remove(elements._elements, handle, (SPECIFIC_TYPE*)nullptr);
+ return ret ? ret : Remove(elements._TailElements, handle, (SPECIFIC_TYPE*)nullptr);
+ }
+
/* ContainerMapList Helpers */
// count functions
- template<class SPECIFIC_TYPE> size_t Count(const ContainerMapList<SPECIFIC_TYPE> &elements, SPECIFIC_TYPE* /*fake*/)
+ template<class SPECIFIC_TYPE>
+ size_t Count(ContainerMapList<SPECIFIC_TYPE> const& elements, SPECIFIC_TYPE* /*fake*/)
{
return elements._element.getSize();
}
- template<class SPECIFIC_TYPE> size_t Count(const ContainerMapList<TypeNull> &/*elements*/, SPECIFIC_TYPE* /*fake*/)
+ template<class SPECIFIC_TYPE>
+ size_t Count(ContainerMapList<TypeNull> const& /*elements*/, SPECIFIC_TYPE* /*fake*/)
{
return 0;
}
- template<class SPECIFIC_TYPE, class T> size_t Count(const ContainerMapList<T> &/*elements*/, SPECIFIC_TYPE* /*fake*/)
+ template<class SPECIFIC_TYPE, class T>
+ size_t Count(ContainerMapList<T> const& /*elements*/, SPECIFIC_TYPE* /*fake*/)
{
return 0;
}
- template<class SPECIFIC_TYPE, class T> size_t Count(const ContainerMapList<TypeList<SPECIFIC_TYPE, T> >&elements, SPECIFIC_TYPE* fake)
+ template<class SPECIFIC_TYPE, class T>
+ size_t Count(ContainerMapList<TypeList<SPECIFIC_TYPE, T>> const& elements, SPECIFIC_TYPE* fake)
{
return Count(elements._elements, fake);
}
- template<class SPECIFIC_TYPE, class H, class T> size_t Count(const ContainerMapList<TypeList<H, T> >&elements, SPECIFIC_TYPE* fake)
+ template<class SPECIFIC_TYPE, class H, class T>
+ size_t Count(ContainerMapList<TypeList<H, T>> const& elements, SPECIFIC_TYPE* fake)
{
return Count(elements._TailElements, fake);
}
// non-const insert functions
- template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Insert(ContainerMapList<SPECIFIC_TYPE> &elements, SPECIFIC_TYPE *obj)
+ template<class SPECIFIC_TYPE>
+ SPECIFIC_TYPE* Insert(ContainerMapList<SPECIFIC_TYPE>& elements, SPECIFIC_TYPE* obj)
{
//elements._element[hdl] = obj;
obj->AddToGrid(elements._element);
return obj;
}
- template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Insert(ContainerMapList<TypeNull> &/*elements*/, SPECIFIC_TYPE * /*obj*/)
+ template<class SPECIFIC_TYPE>
+ SPECIFIC_TYPE* Insert(ContainerMapList<TypeNull>& /*elements*/, SPECIFIC_TYPE* /*obj*/)
{
- return NULL;
+ return nullptr;
}
// this is a missed
- template<class SPECIFIC_TYPE, class T> SPECIFIC_TYPE* Insert(ContainerMapList<T> &/*elements*/, SPECIFIC_TYPE * /*obj*/)
+ template<class SPECIFIC_TYPE, class T>
+ SPECIFIC_TYPE* Insert(ContainerMapList<T>& /*elements*/, SPECIFIC_TYPE* /*obj*/)
{
- return NULL; // a missed
+ return nullptr; // a missed
}
// Recursion
- template<class SPECIFIC_TYPE, class H, class T> SPECIFIC_TYPE* Insert(ContainerMapList<TypeList<H, T> >&elements, SPECIFIC_TYPE *obj)
+ template<class SPECIFIC_TYPE, class H, class T>
+ SPECIFIC_TYPE* Insert(ContainerMapList<TypeList<H, T>>& elements, SPECIFIC_TYPE* obj)
{
- SPECIFIC_TYPE* t= Insert(elements._elements, obj);
- return (t != NULL ? t : Insert(elements._TailElements, obj));
+ SPECIFIC_TYPE* t = Insert(elements._elements, obj);
+ return (t != nullptr ? t : Insert(elements._TailElements, obj));
}
//// non-const remove method
@@ -93,20 +197,20 @@ namespace Trinity
//template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Remove(ContainerMapList<TypeNull> &/*elements*/, SPECIFIC_TYPE * /*obj*/)
//{
- // return NULL;
+ // return nullptr;
//}
//// this is a missed
//template<class SPECIFIC_TYPE, class T> SPECIFIC_TYPE* Remove(ContainerMapList<T> &/*elements*/, SPECIFIC_TYPE * /*obj*/)
//{
- // return NULL; // a missed
+ // return nullptr; // a missed
//}
//template<class SPECIFIC_TYPE, class T, class H> SPECIFIC_TYPE* Remove(ContainerMapList<TypeList<H, T> > &elements, SPECIFIC_TYPE *obj)
//{
// // The head element is bad
// SPECIFIC_TYPE* t = Remove(elements._elements, obj);
- // return ( t != NULL ? t : Remove(elements._TailElements, obj) );
+ // return (t != nullptr ? t : Remove(elements._TailElements, obj));
//}
}
#endif
diff --git a/src/server/shared/Dynamic/TypeContainerVisitor.h b/src/server/shared/Dynamic/TypeContainerVisitor.h
index 514b52d3dfe..e10a2331e25 100644
--- a/src/server/shared/Dynamic/TypeContainerVisitor.h
+++ b/src/server/shared/Dynamic/TypeContainerVisitor.h
@@ -37,21 +37,6 @@ template<class VISITOR, class TYPE_CONTAINER> void VisitorHelper(VISITOR &v, TYP
v.Visit(c);
}
-// terminate condition for container list
-template<class VISITOR> void VisitorHelper(VISITOR &/*v*/, ContainerList<TypeNull> &/*c*/) { }
-
-template<class VISITOR, class T> void VisitorHelper(VISITOR &v, ContainerList<T> &c)
-{
- v.Visit(c._element);
-}
-
-// recursion for container list
-template<class VISITOR, class H, class T> void VisitorHelper(VISITOR &v, ContainerList<TypeList<H, T> > &c)
-{
- VisitorHelper(v, c._elements);
- VisitorHelper(v, c._TailElements);
-}
-
// terminate condition container map list
template<class VISITOR> void VisitorHelper(VISITOR &/*v*/, ContainerMapList<TypeNull> &/*c*/) { }
@@ -67,23 +52,31 @@ template<class VISITOR, class H, class T> void VisitorHelper(VISITOR &v, Contain
VisitorHelper(v, c._TailElements);
}
-// array list
-template<class VISITOR, class T> void VisitorHelper(VISITOR &v, ContainerArrayList<T> &c)
+// for TypeMapContainer
+template<class VISITOR, class OBJECT_TYPES> void VisitorHelper(VISITOR &v, TypeMapContainer<OBJECT_TYPES> &c)
{
- v.Visit(c._element);
+ VisitorHelper(v, c.GetElements());
}
-template<class VISITOR> void VisitorHelper(VISITOR &/*v*/, ContainerArrayList<TypeNull> &/*c*/) { }
+// TypeUnorderedMapContainer
+template<class VISITOR, class KEY_TYPE>
+void VisitorHelper(VISITOR& /*v*/, ContainerUnorderedMap<TypeNull, KEY_TYPE>& /*c*/) { }
+
+template<class VISITOR, class KEY_TYPE, class T>
+void VisitorHelper(VISITOR& v, ContainerUnorderedMap<T, KEY_TYPE>& c)
+{
+ v.Visit(c._element);
+}
-// recursion
-template<class VISITOR, class H, class T> void VisitorHelper(VISITOR &v, ContainerArrayList<TypeList<H, T> > &c)
+template<class VISITOR, class KEY_TYPE, class H, class T>
+void VisitorHelper(VISITOR& v, ContainerUnorderedMap<TypeList<H, T>, KEY_TYPE>& c)
{
VisitorHelper(v, c._elements);
VisitorHelper(v, c._TailElements);
}
-// for TypeMapContainer
-template<class VISITOR, class OBJECT_TYPES> void VisitorHelper(VISITOR &v, TypeMapContainer<OBJECT_TYPES> &c)
+template<class VISITOR, class OBJECT_TYPES, class KEY_TYPE>
+void VisitorHelper(VISITOR& v, TypeUnorderedMapContainer<OBJECT_TYPES, KEY_TYPE>& c)
{
VisitorHelper(v, c.GetElements());
}
diff --git a/src/server/shared/Dynamic/TypeList.h b/src/server/shared/Dynamic/TypeList.h
index f1ccca9b043..f0355929700 100644
--- a/src/server/shared/Dynamic/TypeList.h
+++ b/src/server/shared/Dynamic/TypeList.h
@@ -40,5 +40,6 @@ struct TypeList
#define TYPELIST_3(T1, T2, T3) TypeList<T1, TYPELIST_2(T2, T3) >
#define TYPELIST_4(T1, T2, T3, T4) TypeList<T1, TYPELIST_3(T2, T3, T4) >
#define TYPELIST_5(T1, T2, T3, T4, T5) TypeList<T1, TYPELIST_4(T2, T3, T4, T5) >
+#define TYPELIST_6(T1, T2, T3, T4, T5, T6) TypeList<T1, TYPELIST_5(T2, T3, T4, T5, T6) >
#endif