Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
Resource.inl
Go to the documentation of this file.
1/*
2 Copyright (c) 2018 DIVIDE-Studio
3 Copyright (c) 2009 Ionut Cava
4
5 This file is part of DIVIDE Framework.
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software
9 and associated documentation files (the "Software"), to deal in the Software
10 without restriction,
11 including without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so,
15 subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED,
22 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27 IN CONNECTION WITH THE SOFTWARE
28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 */
31
32#pragma once
33#ifndef RESOURCE_INL_
34#define RESOURCE_INL_
35
36namespace Divide
37{
38
39template<typename T>
40[[nodiscard]] size_t GetHash( const PropertyDescriptor<T>& descriptor ) noexcept
41{
42 return 1337;
43}
44
45template<typename T>
47{
48 return GetHash(lhs) == GetHash(rhs);
49}
50
51template<typename T>
53{
54 return GetHash( lhs ) != GetHash( rhs );
55}
56
57template <typename T>
58ResourceDescriptor<T>::ResourceDescriptor( const std::string_view resourceName )
59 : ResourceDescriptorBase( resourceName )
60{
61}
62
63template <typename T>
64ResourceDescriptor<T>::ResourceDescriptor( const std::string_view resourceName, const PropertyDescriptor<T>& descriptor )
65 : ResourceDescriptorBase( resourceName )
66 , _propertyDescriptor( descriptor )
67{
68}
69
70template <typename T>
72{
73 _hash = GetHash( _propertyDescriptor );
75 return _hash;
76}
77
78template<typename T>
80{
81 return lhs.getHash() == rhs.getHash();
82}
83
84template<typename T>
86{
87 return lhs.getHash() != rhs.getHash();
88}
89
90} //namespace Divide
91
92#endif //RESOURCE_INL_
#define FORCE_INLINE
void Hash_combine(size_t &seed, const T &v, const Rest &... rest) noexcept
a la Boost
Definition: MathHelper.inl:799
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
FORCE_INLINE bool operator!=(const GUIDWrapper &lhs, const GUIDWrapper &rhs) noexcept
Definition: GUIDWrapper.h:67
size_t GetHash(const PropertyDescriptor< T > &descriptor) noexcept
Definition: Resource.inl:40
bool operator==(const DisplayManager::OutputDisplayProperties &lhs, const DisplayManager::OutputDisplayProperties &rhs) noexcept
Definition: Application.inl:37
size_t getHash() const override
Definition: Resource.cpp:82
ResourceDescriptor(std::string_view resourceName)
Definition: Resource.inl:58
size_t getHash() const final
Definition: Resource.inl:71