Fix generate_module_interface.xslt used to server shard_unifier_service/nel_database_mapping.xml file

main/atys-live
Nuno 3 years ago
parent 41794a1122
commit e43515e88a

@ -19,7 +19,22 @@
<!-- ##### Root template matcher ####### --> <!-- ##### Root template matcher ####### -->
<!-- ######################################################### --> <!-- ######################################################### -->
<xsl:template match="generator"> <xsl:template match="generator">
<xsl:if test="$output != 'php'"> <xsl:if test="$output != 'php'">// Ryzom - MMORPG Framework &lt;http://dev.ryzom.com/projects/ryzom/&gt;
// Copyright (C) 2010-2021 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it ! // WARNING : this is a generated file, don't change it !
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
@ -1676,13 +1691,14 @@ namespace <xsl:value-of select="@name"/>
<xsl:for-each select="child_class[@on-delete = 'cascade' and @cont='vector']"> <xsl:for-each select="child_class[@on-delete = 'cascade' and @cont='vector']">
{ {
// cascading deletion for vector child <xsl:value-of select="@name"/> // cascading deletion for vector child <xsl:value-of select="@name"/>
nlassert(load<xsl:value-of select="@name"/>(connection, __FILE__, __LINE__)); if (load<xsl:value-of select="@name"/>(connection, __FILE__, __LINE__))
{
const std::vector &lt; <xsl:value-of select="@type"/>Ptr &gt; &amp; childs = get<xsl:value-of select="@name"/>(); const std::vector &lt; <xsl:value-of select="@type"/>Ptr &gt; &amp; childs = get<xsl:value-of select="@name"/>();
while (!childs.empty()) while (!childs.empty())
{ {
get<xsl:value-of select="@name"/>ByIndex(childs.size()-1)->remove(connection); get<xsl:value-of select="@name"/>ByIndex((uint32)childs.size()-1)->remove(connection);
}
} }
} }
@ -1690,8 +1706,8 @@ namespace <xsl:value-of select="@name"/>
<xsl:for-each select="child_class[@on-delete = 'cascade' and @cont='map']"> <xsl:for-each select="child_class[@on-delete = 'cascade' and @cont='map']">
{ {
// cascading deletion for map child <xsl:value-of select="@name"/> // cascading deletion for map child <xsl:value-of select="@name"/>
nlassert(load<xsl:value-of select="@name"/>(connection, __FILE__, __LINE__)); if (load<xsl:value-of select="@name"/>(connection, __FILE__, __LINE__))
{
const std::map &lt; uint32, <xsl:value-of select="@type"/>Ptr &gt; &amp; childs = get<xsl:value-of select="@name"/>(); const std::map &lt; uint32, <xsl:value-of select="@type"/>Ptr &gt; &amp; childs = get<xsl:value-of select="@name"/>();
while (!childs.empty()) while (!childs.empty())
@ -1699,21 +1715,23 @@ namespace <xsl:value-of select="@name"/>
get<xsl:value-of select="@name"/>ById(childs.begin()->first)->remove(connection); get<xsl:value-of select="@name"/>ById(childs.begin()->first)->remove(connection);
} }
} }
}
</xsl:for-each> </xsl:for-each>
<xsl:for-each select="child_class[@on-delete = 'cascade' and @relation='one-to-one']"> <xsl:for-each select="child_class[@on-delete = 'cascade' and @relation='one-to-one']">
{ {
// cascading deletion for single child <xsl:value-of select="@name"/> // cascading deletion for single child <xsl:value-of select="@name"/>
nlassert(load<xsl:value-of select="@name"/>(connection, __FILE__, __LINE__)); if (load<xsl:value-of select="@name"/>(connection, __FILE__, __LINE__))
{
if (get<xsl:value-of select="@name"/>() != NULL) if (get<xsl:value-of select="@name"/>() != NULL)
get<xsl:value-of select="@name"/>()->remove(connection); get<xsl:value-of select="@name"/>()->remove(connection);
} }
}
</xsl:for-each> </xsl:for-each>
<xsl:for-each select="child_class[@on-delete = 'update' and @cont='vector']"> <xsl:for-each select="child_class[@on-delete = 'update' and @cont='vector']">
{ {
// unreference (and update) for vector child <xsl:value-of select="@name"/> // unreference (and update) for vector child <xsl:value-of select="@name"/>
nlassert(load<xsl:value-of select="@name"/>(connection, __FILE__, __LINE__)); if (load<xsl:value-of select="@name"/>(connection, __FILE__, __LINE__))
{
const std::vector &lt; <xsl:value-of select="@type"/>Ptr &gt; &amp; childs = get<xsl:value-of select="@name"/>(); const std::vector &lt; <xsl:value-of select="@type"/>Ptr &gt; &amp; childs = get<xsl:value-of select="@name"/>();
for (uint i=0; i &lt; childs.size(); ++i) for (uint i=0; i &lt; childs.size(); ++i)
@ -1725,11 +1743,12 @@ namespace <xsl:value-of select="@name"/>
get<xsl:value-of select="@name"/>ByIndex(i)->update(connection); get<xsl:value-of select="@name"/>ByIndex(i)->update(connection);
} }
} }
}
</xsl:for-each> </xsl:for-each>
<xsl:for-each select="child_class[@on-delete = 'update' and @cont='map']"> <xsl:for-each select="child_class[@on-delete = 'update' and @cont='map']">
{ {
// unreference (and update) for map child <xsl:value-of select="@name"/> // unreference (and update) for map child <xsl:value-of select="@name"/>
nlassert(load<xsl:value-of select="@name"/>(connection, __FILE__, __LINE__)); if (load<xsl:value-of select="@name"/>(connection, __FILE__, __LINE__)) {
const std::map &lt; uint32, <xsl:value-of select="@type"/>Ptr &gt; &amp; childs = get<xsl:value-of select="@name"/>(); const std::map &lt; uint32, <xsl:value-of select="@type"/>Ptr &gt; &amp; childs = get<xsl:value-of select="@name"/>();
std::map&lt; uint32, <xsl:value-of select="@type"/>Ptr &gt;::const_iterator first(childs.begin()), last(childs.end()); std::map&lt; uint32, <xsl:value-of select="@type"/>Ptr &gt;::const_iterator first(childs.begin()), last(childs.end());
@ -1743,12 +1762,13 @@ namespace <xsl:value-of select="@name"/>
get<xsl:value-of select="@name"/>ById(it->first)->update(connection); get<xsl:value-of select="@name"/>ById(it->first)->update(connection);
} }
} }
}
</xsl:for-each> </xsl:for-each>
<xsl:for-each select="child_class[@on-delete = 'update' and @relation='one-to-one']"> <xsl:for-each select="child_class[@on-delete = 'update' and @relation='one-to-one']">
{ {
// unreference (and update) for single child <xsl:value-of select="@name"/> // unreference (and update) for single child <xsl:value-of select="@name"/>
nlassert(load<xsl:value-of select="@name"/>(connection, __FILE__, __LINE__)); if (load<xsl:value-of select="@name"/>(connection, __FILE__, __LINE__))
{
<xsl:variable name="type" select="@type"/> <xsl:variable name="type" select="@type"/>
<xsl:variable name="child_name" select="@name"/> <xsl:variable name="child_name" select="@name"/>
<xsl:variable name="parent_prop" select="//class[@name = $type]/property[@db_col = //class[@name = $type]/parent[@class = $className]/@db_col]/@name"/> <xsl:variable name="parent_prop" select="//class[@name = $type]/property[@db_col = //class[@name = $type]/parent[@class = $className]/@db_col]/@name"/>
@ -1758,6 +1778,7 @@ namespace <xsl:value-of select="@name"/>
get<xsl:value-of select="@name"/>()->update(connection); get<xsl:value-of select="@name"/>()->update(connection);
} }
} }
}
</xsl:for-each> </xsl:for-each>
// change the persistant state to 'removed'. // change the persistant state to 'removed'.
@ -1886,7 +1907,7 @@ namespace <xsl:value-of select="@name"/>
} }
else if (cmd == NOPE::cc_instance_count) else if (cmd == NOPE::cc_instance_count)
{ {
return _ObjectCache.size(); return (uint32)_ObjectCache.size();
} }
// default return value // default return value
@ -1904,7 +1925,7 @@ namespace <xsl:value-of select="@name"/>
TReleasedObject::iterator first(_ReleasedObject.begin()), last(_ReleasedObject.end()); TReleasedObject::iterator first(_ReleasedObject.begin()), last(_ReleasedObject.end());
for (; first != last; ++first) for (; first != last; ++first)
{ {
nbReleased += first->second.size(); nbReleased += (uint32)first->second.size();
} }
nlinfo(" There are %u object instances in cache not referenced (waiting deletion or re-use))", nbReleased); nlinfo(" There are %u object instances in cache not referenced (waiting deletion or re-use))", nbReleased);
@ -2117,7 +2138,7 @@ ERROR : parent/child relation support only 'map' or 'vector' cont specification
return false; return false;
} }
std::auto_ptr&lt;MSW::CStoreResult&gt; result = connection.storeResult(); CUniquePtr&lt;MSW::CStoreResult&gt; result(connection.storeResult());
for (uint i=0; i&lt;result->getNumRows(); ++i) for (uint i=0; i&lt;result->getNumRows(); ++i)
{ {
@ -2195,7 +2216,7 @@ ERROR : parent/child relation support only 'map' or 'vector' cont specification
return false; return false;
} }
std::auto_ptr&lt;MSW::CStoreResult&gt; result = connection.storeResult(); CUniquePtr&lt;MSW::CStoreResult&gt; result(connection.storeResult());
// check that the data description is consistent with database content // check that the data description is consistent with database content
nlassert(result->getNumRows() &lt;= 1); nlassert(result->getNumRows() &lt;= 1);
@ -2300,9 +2321,9 @@ ERROR : parent/child relation support only 'map' or 'vector' cont specification
} }
// no object with this id, return a null pointer // no object with this id, return a null pointer
static <xsl:value-of select="@type"/>Ptr nil; static <xsl:value-of select="@type"/>Ptr nilPtr;
return nil; return nilPtr;
} }
</xsl:when> </xsl:when>
@ -2321,8 +2342,8 @@ ERROR : parent/child relation support only 'map' or 'vector' cont specification
if (it == _<xsl:value-of select="@name"/>->end()) if (it == _<xsl:value-of select="@name"/>->end())
{ {
// no object with this id, return a null pointer // no object with this id, return a null pointer
static <xsl:value-of select="@type"/>Ptr nil; static <xsl:value-of select="@type"/>Ptr nilPtr;
return nil; return nilPtr;
} }
return const_cast&lt; <xsl:value-of select="@type"/>Ptr &amp; &gt;(it->second); return const_cast&lt; <xsl:value-of select="@type"/>Ptr &amp; &gt;(it->second);

Loading…
Cancel
Save