X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fcommon%2Fproperty-input-impl.h;h=996fde754d9ca10e1d405cfd3372efbd958a1770;hb=0db05961b8c65b81ab2e8795f3264cd6fb5cc919;hp=8a700caf637fb2cd50bd7dc57f5686d71eb6d65c;hpb=53ad0a8d1d3c644d74301687625e3dedabe592b0;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/common/property-input-impl.h b/dali/internal/event/common/property-input-impl.h index 8a700ca..996fde7 100644 --- a/dali/internal/event/common/property-input-impl.h +++ b/dali/internal/event/common/property-input-impl.h @@ -1,8 +1,8 @@ -#ifndef __DALI_INTERNAL_PROPERTY_INPUT_IMPL_H__ -#define __DALI_INTERNAL_PROPERTY_INPUT_IMPL_H__ +#ifndef DALI_INTERNAL_PROPERTY_INPUT_IMPL_H +#define DALI_INTERNAL_PROPERTY_INPUT_IMPL_H /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,15 @@ #include #include +#if defined (ANDROID) || defined(WIN32) || defined(__APPLE__) +namespace std +{ + +uint64_t _Hash_bytes(const void* bytes, uint64_t size, uint64_t seed); + +} +#endif + namespace Dali { @@ -48,9 +57,7 @@ public: /** * Virtual destructor. */ - virtual ~PropertyInputImpl() - { - } + virtual ~PropertyInputImpl() = default; /** * Query the type of property input. @@ -307,6 +314,63 @@ public: return false; } + std::uint64_t Hash(BufferIndex bufferIndex, uint64_t seed) const + { + switch ( GetType() ) + { + case Property::BOOLEAN: + { + return std::_Hash_bytes(&GetBoolean(bufferIndex), sizeof(bool), seed); + } + + case Property::INTEGER: + { + return std::_Hash_bytes(&GetInteger(bufferIndex), sizeof(int), seed); + } + + case Property::FLOAT: + { + return std::_Hash_bytes(&GetFloat(bufferIndex), sizeof(float), seed); + } + + case Property::VECTOR2: + { + return std::_Hash_bytes(&GetVector2(bufferIndex), sizeof(Vector2), seed); + } + + case Property::VECTOR3: + { + return std::_Hash_bytes(&GetVector3(bufferIndex), sizeof(Vector3), seed); + } + + case Property::VECTOR4: + { + return std::_Hash_bytes(&GetVector4(bufferIndex), sizeof(Vector4), seed); + } + + case Property::ROTATION: + { + return std::_Hash_bytes(&GetQuaternion(bufferIndex), sizeof(Quaternion), seed); + } + + case Property::MATRIX: + { + return std::_Hash_bytes(&GetMatrix(bufferIndex), sizeof(Matrix), seed); + } + + case Property::MATRIX3: + { + return std::_Hash_bytes(&GetMatrix3(bufferIndex), sizeof(Matrix3), seed); + } + + default: + break; // print nothing + } + + return seed; + } + + /** * Print the property value using a stream. * @param[in] debugStream The output stream. @@ -381,4 +445,4 @@ public: } // namespace Dali -#endif // __DALI_INTERNAL_PROPERTY_INPUT_IMPL_H__ +#endif // DALI_INTERNAL_PROPERTY_INPUT_IMPL_H