API Documentation
Loading...
Searching...
No Matches
UUIDDictionary.h
Go to the documentation of this file.
1/**--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Base
28File: UUIDDictionary
29Included in API: True
30Author(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>
37namespace 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}
Definition ACIColor.h:37