Core/Serialization: Add type tag parameters
This commit is contained in:
@@ -72,8 +72,8 @@ namespace Nz
|
||||
typedef BoundingVolume<double> BoundingVolumed;
|
||||
typedef BoundingVolume<float> BoundingVolumef;
|
||||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const BoundingVolume<T>& boundingVolume);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, BoundingVolume<T>* boundingVolume);
|
||||
template<typename T> bool Serialize(SerializationContext& context, const BoundingVolume<T>& boundingVolume, TypeTag<BoundingVolume<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, BoundingVolume<T>* boundingVolume, TypeTag<BoundingVolume<T>>);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -603,9 +603,9 @@ namespace Nz
|
||||
* \remark Does not save OBB corners
|
||||
*/
|
||||
template<typename T>
|
||||
bool Serialize(SerializationContext& context, const BoundingVolume<T>& boundingVolume)
|
||||
bool Serialize(SerializationContext& context, const BoundingVolume<T>& boundingVolume, TypeTag<BoundingVolume<T>>)
|
||||
{
|
||||
if (!Serialize(context, static_cast<UInt8>(boundingVolume.extend)))
|
||||
if (!Serialize(context, static_cast<UInt8>(boundingVolume.extend)>))
|
||||
return false;
|
||||
|
||||
if (!Serialize(context, boundingVolume.aabb))
|
||||
@@ -627,7 +627,7 @@ namespace Nz
|
||||
* \remark The resulting oriented box corners will *not* be updated, a call to Update is required
|
||||
*/
|
||||
template<typename T>
|
||||
bool Unserialize(SerializationContext& context, BoundingVolume<T>* boundingVolume)
|
||||
bool Unserialize(SerializationContext& context, BoundingVolume<T>* boundingVolume, TypeTag<BoundingVolume<T>>)
|
||||
{
|
||||
UInt8 extend;
|
||||
if (!Unserialize(context, &extend))
|
||||
|
||||
@@ -100,8 +100,8 @@ namespace Nz
|
||||
typedef Box<Int32> Boxi32;
|
||||
typedef Box<UInt32> Boxui32;
|
||||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Box<T>& box);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Box<T>* box);
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Box<T>& box, TypeTag<Box<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Box<T>* box, TypeTag<Box<T>>);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -912,7 +912,7 @@ namespace Nz
|
||||
* \param box Input Box
|
||||
*/
|
||||
template<typename T>
|
||||
bool Serialize(SerializationContext& context, const Box<T>& box)
|
||||
bool Serialize(SerializationContext& context, const Box<T>& box, TypeTag<Box<T>>)
|
||||
{
|
||||
if (!Serialize(context, box.x))
|
||||
return false;
|
||||
@@ -943,7 +943,7 @@ namespace Nz
|
||||
* \param box Output Box
|
||||
*/
|
||||
template<typename T>
|
||||
bool Unserialize(SerializationContext& context, Box<T>* box)
|
||||
bool Unserialize(SerializationContext& context, Box<T>* box, TypeTag<Box<T>>)
|
||||
{
|
||||
if (!Unserialize(context, &box->x))
|
||||
return false;
|
||||
|
||||
@@ -65,8 +65,8 @@ namespace Nz
|
||||
typedef EulerAngles<double> EulerAnglesd;
|
||||
typedef EulerAngles<float> EulerAnglesf;
|
||||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const EulerAngles<T>& eulerAngles);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, EulerAngles<T>* eulerAngles);
|
||||
template<typename T> bool Serialize(SerializationContext& context, const EulerAngles<T>& eulerAngles, TypeTag<EulerAngles<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, EulerAngles<T>* eulerAngles, TypeTag<EulerAngles<T>>);
|
||||
}
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::EulerAngles<T>& angles);
|
||||
|
||||
@@ -340,7 +340,7 @@ namespace Nz
|
||||
* \param angles Input euler angles
|
||||
*/
|
||||
template<typename T>
|
||||
bool Serialize(SerializationContext& context, const EulerAngles<T>& angles)
|
||||
bool Serialize(SerializationContext& context, const EulerAngles<T>& angles, TypeTag<EulerAngles<T>>)
|
||||
{
|
||||
if (!Serialize(context, angles.pitch))
|
||||
return false;
|
||||
@@ -362,7 +362,7 @@ namespace Nz
|
||||
* \param angles Output euler angles
|
||||
*/
|
||||
template<typename T>
|
||||
bool Unserialize(SerializationContext& context, EulerAngles<T>* angles)
|
||||
bool Unserialize(SerializationContext& context, EulerAngles<T>* angles, TypeTag<EulerAngles<T>>)
|
||||
{
|
||||
if (!Unserialize(context, &angles->pitch))
|
||||
return false;
|
||||
|
||||
@@ -58,9 +58,9 @@ namespace Nz
|
||||
String ToString() const;
|
||||
|
||||
template<typename U>
|
||||
friend bool Serialize(SerializationContext& context, const Frustum<U>& frustum);
|
||||
friend bool Serialize(SerializationContext& context, const Frustum<U>& frustum, TypeTag<Frustum<T>>);
|
||||
template<typename U>
|
||||
friend bool Unserialize(SerializationContext& context, Frustum<U>* frustum);
|
||||
friend bool Unserialize(SerializationContext& context, Frustum<U>* frustum, TypeTag<Frustum<T>>);
|
||||
|
||||
private:
|
||||
Vector3<T> m_corners[BoxCorner_Max+1];
|
||||
|
||||
@@ -684,7 +684,7 @@ namespace Nz
|
||||
* \param matrix Input frustum
|
||||
*/
|
||||
template<typename T>
|
||||
bool Serialize(SerializationContext& context, const Frustum<T>& frustum)
|
||||
bool Serialize(SerializationContext& context, const Frustum<T>& frustum, TypeTag<Frustum<T>>)
|
||||
{
|
||||
for (unsigned int i = 0; i <= BoxCorner_Max; ++i)
|
||||
{
|
||||
@@ -709,7 +709,7 @@ namespace Nz
|
||||
* \param matrix Output frustum
|
||||
*/
|
||||
template<typename T>
|
||||
bool Unserialize(SerializationContext& context, Frustum<T>* frustum)
|
||||
bool Unserialize(SerializationContext& context, Frustum<T>* frustum, TypeTag<Frustum<T>>)
|
||||
{
|
||||
for (unsigned int i = 0; i <= BoxCorner_Max; ++i)
|
||||
{
|
||||
|
||||
@@ -141,8 +141,8 @@ namespace Nz
|
||||
typedef Matrix4<double> Matrix4d;
|
||||
typedef Matrix4<float> Matrix4f;
|
||||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Matrix4<T>& matrix);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Matrix4<T>* matrix);
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Matrix4<T>& matrix, TypeTag<Matrix4<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Matrix4<T>* matrix, TypeTag<Matrix4<T>>);
|
||||
}
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Matrix4<T>& matrix);
|
||||
|
||||
@@ -1767,7 +1767,7 @@ namespace Nz
|
||||
* \param matrix Input matrix
|
||||
*/
|
||||
template<typename T>
|
||||
bool Serialize(SerializationContext& context, const Matrix4<T>& matrix)
|
||||
bool Serialize(SerializationContext& context, const Matrix4<T>& matrix, TypeTag<Matrix4<T>>)
|
||||
{
|
||||
for (unsigned int i = 0; i < 16; ++i)
|
||||
{
|
||||
@@ -1786,7 +1786,7 @@ namespace Nz
|
||||
* \param matrix Output matrix
|
||||
*/
|
||||
template<typename T>
|
||||
bool Unserialize(SerializationContext& context, Matrix4<T>* matrix)
|
||||
bool Unserialize(SerializationContext& context, Matrix4<T>* matrix, TypeTag<Matrix4<T>>)
|
||||
{
|
||||
T* head = matrix->operator T*();
|
||||
for (unsigned int i = 0; i < 16; ++i)
|
||||
|
||||
@@ -71,8 +71,8 @@ namespace Nz
|
||||
typedef OrientedBox<double> OrientedBoxd;
|
||||
typedef OrientedBox<float> OrientedBoxf;
|
||||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const OrientedBox<T>& obb);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, OrientedBox<T>* obb);
|
||||
template<typename T> bool Serialize(SerializationContext& context, const OrientedBox<T>& obb, TypeTag<OrientedBox<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, OrientedBox<T>* obb, TypeTag<OrientedBox<T>>);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -442,7 +442,7 @@ namespace Nz
|
||||
* \remark Does not save OBB corners
|
||||
*/
|
||||
template<typename T>
|
||||
bool Serialize(SerializationContext& context, const OrientedBox<T>& obb)
|
||||
bool Serialize(SerializationContext& context, const OrientedBox<T>& obb, TypeTag<OrientedBox<T>>)
|
||||
{
|
||||
if (!Serialize(context, obb.localBox))
|
||||
return false;
|
||||
@@ -460,7 +460,7 @@ namespace Nz
|
||||
* \remark The resulting oriented box corners will *not* be updated, a call to Update is required
|
||||
*/
|
||||
template<typename T>
|
||||
bool Unserialize(SerializationContext& context, OrientedBox<T>* obb)
|
||||
bool Unserialize(SerializationContext& context, OrientedBox<T>* obb, TypeTag<OrientedBox<T>>)
|
||||
{
|
||||
if (!Unserialize(context, &obb->localBox))
|
||||
return false;
|
||||
|
||||
@@ -62,8 +62,8 @@ namespace Nz
|
||||
typedef Plane<double> Planed;
|
||||
typedef Plane<float> Planef;
|
||||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Plane<T>& plane);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Plane<T>* plane);
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Plane<T>& plane, TypeTag<Plane<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Plane<T>* plane, TypeTag<Plane<T>>);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -434,7 +434,7 @@ namespace Nz
|
||||
* \param plane Input Vector2
|
||||
*/
|
||||
template<typename T>
|
||||
bool Serialize(SerializationContext& context, const Plane<T>& plane)
|
||||
bool Serialize(SerializationContext& context, const Plane<T>& plane, TypeTag<Plane<T>>)
|
||||
{
|
||||
if (!Serialize(context, plane.normal))
|
||||
return false;
|
||||
@@ -453,7 +453,7 @@ namespace Nz
|
||||
* \param plane Output Plane
|
||||
*/
|
||||
template<typename T>
|
||||
bool Unserialize(SerializationContext& context, Plane<T>* plane)
|
||||
bool Unserialize(SerializationContext& context, Plane<T>* plane, TypeTag<Plane<T>>)
|
||||
{
|
||||
if (!Unserialize(context, &plane->normal))
|
||||
return false;
|
||||
|
||||
@@ -91,8 +91,8 @@ namespace Nz
|
||||
typedef Quaternion<double> Quaterniond;
|
||||
typedef Quaternion<float> Quaternionf;
|
||||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Quaternion<T>& quat);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Quaternion<T>* quat);
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Quaternion<T>& quat, TypeTag<Quaternion<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Quaternion<T>* quat, TypeTag<Quaternion<T>>);
|
||||
}
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Quaternion<T>& quat);
|
||||
|
||||
@@ -826,7 +826,7 @@ namespace Nz
|
||||
* \param quat Input Quaternion
|
||||
*/
|
||||
template<typename T>
|
||||
bool Serialize(SerializationContext& context, const Quaternion<T>& quat)
|
||||
bool Serialize(SerializationContext& context, const Quaternion<T>& quat, TypeTag<Quaternion<T>>)
|
||||
{
|
||||
if (!Serialize(context, quat.x))
|
||||
return false;
|
||||
@@ -851,7 +851,7 @@ namespace Nz
|
||||
* \param quat Output Quaternion
|
||||
*/
|
||||
template<typename T>
|
||||
bool Unserialize(SerializationContext& context, Quaternion<T>* quat)
|
||||
bool Unserialize(SerializationContext& context, Quaternion<T>* quat, TypeTag<Quaternion<T>>)
|
||||
{
|
||||
if (!Unserialize(context, &quat->x))
|
||||
return false;
|
||||
|
||||
@@ -77,8 +77,8 @@ namespace Nz
|
||||
typedef Ray<double> Rayd;
|
||||
typedef Ray<float> Rayf;
|
||||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Ray<T>& ray);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Ray<T>* ray);
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Ray<T>& ray, TypeTag<Ray<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Ray<T>* ray, TypeTag<Ray<T>>);
|
||||
}
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Ray<T>& vec);
|
||||
|
||||
@@ -772,7 +772,7 @@ namespace Nz
|
||||
* \param ray Input Ray
|
||||
*/
|
||||
template<typename T>
|
||||
bool Serialize(SerializationContext& context, const Ray<T>& ray)
|
||||
bool Serialize(SerializationContext& context, const Ray<T>& ray, TypeTag<Ray<T>>)
|
||||
{
|
||||
if (!Serialize(context, ray.origin))
|
||||
return false;
|
||||
@@ -791,7 +791,7 @@ namespace Nz
|
||||
* \param ray Output Ray
|
||||
*/
|
||||
template<typename T>
|
||||
bool Unserialize(SerializationContext& context, Ray<T>* ray)
|
||||
bool Unserialize(SerializationContext& context, Ray<T>* ray, TypeTag<Ray<T>>)
|
||||
{
|
||||
if (!Unserialize(context, &ray->origin))
|
||||
return false;
|
||||
|
||||
@@ -94,8 +94,8 @@ namespace Nz
|
||||
typedef Rect<Int32> Recti32;
|
||||
typedef Rect<UInt32> Rectui32;
|
||||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Rect<T>& rect);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Rect<T>* rect);
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Rect<T>& rect, TypeTag<Rect<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Rect<T>* rect, TypeTag<Rect<T>>);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -808,7 +808,7 @@ namespace Nz
|
||||
* \param rect Input Rect
|
||||
*/
|
||||
template<typename T>
|
||||
bool Serialize(SerializationContext& context, const Rect<T>& rect)
|
||||
bool Serialize(SerializationContext& context, const Rect<T>& rect, TypeTag<Rect<T>>)
|
||||
{
|
||||
if (!Serialize(context, rect.x))
|
||||
return false;
|
||||
@@ -833,7 +833,7 @@ namespace Nz
|
||||
* \param rect Output Rect
|
||||
*/
|
||||
template<typename T>
|
||||
bool Unserialize(SerializationContext& context, Rect<T>* rect)
|
||||
bool Unserialize(SerializationContext& context, Rect<T>* rect, TypeTag<Rect<T>>)
|
||||
{
|
||||
if (!Unserialize(context, &rect->x))
|
||||
return false;
|
||||
|
||||
@@ -81,8 +81,8 @@ namespace Nz
|
||||
typedef Sphere<double> Sphered;
|
||||
typedef Sphere<float> Spheref;
|
||||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Sphere<T>& sphere);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Sphere<T>* sphere);
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Sphere<T>& sphere, TypeTag<Sphere<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Sphere<T>* sphere, TypeTag<Sphere<T>>);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -623,7 +623,7 @@ namespace Nz
|
||||
* \param sphere Input Sphere
|
||||
*/
|
||||
template<typename T>
|
||||
bool Serialize(SerializationContext& context, const Sphere<T>& sphere)
|
||||
bool Serialize(SerializationContext& context, const Sphere<T>& sphere, TypeTag<Sphere<T>>)
|
||||
{
|
||||
if (!Serialize(context, sphere.x))
|
||||
return false;
|
||||
@@ -648,7 +648,7 @@ namespace Nz
|
||||
* \param sphere Output Sphere
|
||||
*/
|
||||
template<typename T>
|
||||
bool Unserialize(SerializationContext& context, Sphere<T>* sphere)
|
||||
bool Unserialize(SerializationContext& context, Sphere<T>* sphere, TypeTag<Sphere<T>>)
|
||||
{
|
||||
if (!Unserialize(context, &sphere->x))
|
||||
return false;
|
||||
|
||||
@@ -103,15 +103,15 @@ namespace Nz
|
||||
T x, y;
|
||||
};
|
||||
|
||||
typedef Vector2<double> Vector2d;
|
||||
typedef Vector2<float> Vector2f;
|
||||
typedef Vector2<int> Vector2i;
|
||||
typedef Vector2<unsigned int> Vector2ui;
|
||||
typedef Vector2<Int32> Vector2i32;
|
||||
typedef Vector2<UInt32> Vector2ui32;
|
||||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Vector2<T>& vector);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Vector2<T>* vector);
|
||||
using Vector2d = Vector2<double>;
|
||||
using Vector2f = Vector2<float>;
|
||||
using Vector2i = Vector2<int>;
|
||||
using Vector2ui = Vector2<unsigned int>;
|
||||
using Vector2i32 = Vector2<Int32>;
|
||||
using Vector2ui32 = Vector2<UInt32>;
|
||||
|
||||
}
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Vector2<T>& vec);
|
||||
|
||||
@@ -961,7 +961,7 @@ namespace Nz
|
||||
* \param vector Input Vector2
|
||||
*/
|
||||
template<typename T>
|
||||
bool Serialize(SerializationContext& context, const Vector2<T>& vector)
|
||||
bool Serialize(SerializationContext& context, const Vector2<T>& vector, TypeTag<Vector2<T>>)
|
||||
{
|
||||
if (!Serialize(context, vector.x))
|
||||
return false;
|
||||
@@ -980,7 +980,7 @@ namespace Nz
|
||||
* \param vector Output Vector2
|
||||
*/
|
||||
template<typename T>
|
||||
bool Unserialize(SerializationContext& context, Vector2<T>* vector)
|
||||
bool Unserialize(SerializationContext& context, Vector2<T>* vector, TypeTag<Vector2<T>>)
|
||||
{
|
||||
if (!Unserialize(context, &vector->x))
|
||||
return false;
|
||||
|
||||
@@ -132,8 +132,8 @@ namespace Nz
|
||||
typedef Vector3<Int32> Vector3i32;
|
||||
typedef Vector3<UInt32> Vector3ui32;
|
||||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Vector3<T>& vector);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Vector3<T>* vector);
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Vector3<T>& vector, TypeTag<Vector3<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Vector3<T>* vector, TypeTag<Vector3<T>>);
|
||||
}
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Vector3<T>& vec);
|
||||
|
||||
@@ -1248,7 +1248,7 @@ namespace Nz
|
||||
* \param vector Input Vector3
|
||||
*/
|
||||
template<typename T>
|
||||
bool Serialize(SerializationContext& context, const Vector3<T>& vector)
|
||||
bool Serialize(SerializationContext& context, const Vector3<T>& vector, TypeTag<Vector3<T>>)
|
||||
{
|
||||
if (!Serialize(context, vector.x))
|
||||
return false;
|
||||
@@ -1270,7 +1270,7 @@ namespace Nz
|
||||
* \param vector Output Vector3
|
||||
*/
|
||||
template<typename T>
|
||||
bool Unserialize(SerializationContext& context, Vector3<T>* vector)
|
||||
bool Unserialize(SerializationContext& context, Vector3<T>* vector, TypeTag<Vector3<T>>)
|
||||
{
|
||||
if (!Unserialize(context, &vector->x))
|
||||
return false;
|
||||
|
||||
@@ -108,8 +108,8 @@ namespace Nz
|
||||
typedef Vector4<Int32> Vector4i32;
|
||||
typedef Vector4<UInt32> Vector4ui32;
|
||||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Vector4<T>& vector);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Vector4<T>* vector);
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Vector4<T>& vector, TypeTag<Vector4<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Vector4<T>* vector, TypeTag<Vector4<T>>);
|
||||
}
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Vector4<T>& vec);
|
||||
|
||||
@@ -1011,7 +1011,7 @@ namespace Nz
|
||||
* \param vector Input Vector3
|
||||
*/
|
||||
template<typename T>
|
||||
bool Serialize(SerializationContext& context, const Vector4<T>& vector)
|
||||
bool Serialize(SerializationContext& context, const Vector4<T>& vector, TypeTag<Vector4<T>>)
|
||||
{
|
||||
if (!Serialize(context, vector.x))
|
||||
return false;
|
||||
@@ -1036,7 +1036,7 @@ namespace Nz
|
||||
* \param vector Output Vector3
|
||||
*/
|
||||
template<typename T>
|
||||
bool Unserialize(SerializationContext& context, Vector4<T>* vector)
|
||||
bool Unserialize(SerializationContext& context, Vector4<T>* vector, TypeTag<Vector4<T>>)
|
||||
{
|
||||
if (!Unserialize(context, &vector->x))
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user