API Documentation
Loading...
Searching...
No Matches
UUIDDictionary.h
Go to the documentation of this file.
1
/**--------------------------------------------------------------------------------------------
2
Copyright (c) 2019, NDEVR LLC
3
tyler.parke@ndevr.org
4
__ __ ____ _____ __ __ _______
5
| \ | | | __ \ | ___|\ \ / / | __ \
6
| \ | | | | \ \ | |___ \ \ / / | |__) |
7
| . \| | | |__/ / | |___ \ V / | _ /
8
| |\ |_|_____/__|_____|___\_/____| | \ \
9
|__| \__________________________________| \__\
10
11
Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12
Licensee a limited, non-exclusive, non-transferable, royalty-free license
13
(without the right to sublicense) to use the API solely for the purpose of
14
Licensee's internal development efforts to develop applications for which
15
the API was provided.
16
17
The above copyright notice and this permission notice shall be included in all
18
copies or substantial portions of the Software.
19
20
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
DEALINGS IN THE SOFTWARE.
26
27
Library: Base
28
File: UUIDDictionary
29
Included in API: True
30
Author(s): Tyler Parke
31
*-----------------------------------------------------------------------------------------**/
32
#pragma once
33
#include <NDEVR/BaseValues.h>
34
#include <NDEVR/Exception.h>
35
#include <NDEVR/Dictionary.h>
36
#include <unordered_map>
37
namespace
NDEVR
38
{
39
/*template<class t_value>
40
class Dictionary<UUID, t_value>
41
{
42
public:
43
Dictionary()
44
{}
45
bool hasKey(const t_key& key) const
46
{
47
return std::unordered_map<t_key, t_value>::find(key) != std::unordered_map<t_key, t_value>::end();
48
}
49
50
const t_value& get(const t_key& key) const
51
{
52
return std::unordered_map<t_key, t_value>::at(key);
53
}
54
t_value& get(const t_key& key)
55
{
56
lib_assert(hasKey(key), "Tried to get from Dictionary, without having key");
57
return std::unordered_map<t_key, t_value>::at(key);
58
}
59
uint04 indexOf(const t_key& key) const
60
{
61
uint04 i = 0;
62
for (const auto& location : *this)
63
{
64
if (location.first == key)
65
return i;
66
i++;
67
}
68
return Constant<uint04>::NaN;
69
}
70
void removeIndex(uint04 index)
71
{
72
erase(std::next(std::unordered_map<t_key, t_value>::begin(), index)->first);
73
}
74
const t_value& getFromIndex(uint04 index) const
75
{
76
return std::next(std::unordered_map<t_key, t_value>::begin(), index)->second;
77
}
78
t_value& getFromIndex(uint04 index)
79
{
80
return std::next(std::unordered_map<t_key, t_value>::begin(), index)->second;
81
}
82
void set(const t_key& key, const t_value& value)
83
{
84
std::unordered_map<t_key, t_value>::at(key) = value;
85
}
86
87
const t_value& operator[](const t_key& key) const
88
{
89
lib_assert(hasKey(key), "Tried to get from Dictionary, without having key");
90
return std::unordered_map<t_key, t_value>::at(key);
91
}
92
t_value& operator[](const t_key& key)
93
{
94
return (std::unordered_map<t_key, t_value>::try_emplace(_STD move(key)).first->second);
95
}
96
uint04 size() const
97
{
98
return cast<uint04>(std::unordered_map<t_key, t_value>::size());
99
}
100
Buffer<Buffer<Buffer<uint04>>>[260] m_lookup;
101
};*/
102
}
NDEVR
Definition
ACIColor.h:37
Base
Headers
UUIDDictionary.h