API Documentation
Loading...
Searching...
No Matches
ObjectInfo.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: ObjectInfo
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/Vector.h>
34#include <type_traits>
35#include <utility>
36/**--------------------------------------------------------------------------------------------------
37Namespace: Parke
38Namespace that wraps all Logic created by Tyler Parke
39 *-----------------------------------------------------------------------------------------------**/
40
41namespace NDEVR
42{
44 {};
45 /**--------------------------------------------------------------------------------------------------
46 Struct: ObjectInfo
47
48 \brief Information about the object.
49
50 Author: Tyler Parke
51
52 Date: 2017-11-17
53 *-----------------------------------------------------------------------------------------------**/
54
55 template<typename t_type, bool is_vector = IsVec<t_type>::value, bool is_buffer = std::is_base_of<BufferBase, t_type>::value>
56 struct ObjectInfo;
57
58 /**--------------------------------------------------------------------------------------------------
59 Struct: ObjectInfo<t_type,false>
60
61 \brief Information about the object.
62
63 Author: Tyler Parke
64
65 Date: 2017-11-17
66 *-----------------------------------------------------------------------------------------------**/
67 template<typename t_type>
68 struct ObjectInfo<t_type, false, false>
69 {
70 /** The number of dimensions or zero if scaler type. */
71 static const uint01 Dimensions = 0;
72 /** True if object is a vector. */
73 static const bool Vector = false;
74 /** True if object is a Buffer. */
75 static const bool Buffer = false;
76 /** Useful for buffers. Determines whether the object needs to call an allocator. */
77 static const bool Primitive = std::is_integral<t_type>::value || std::is_floating_point<t_type>::value || std::is_enum<t_type>::value || std::is_pointer<t_type>::value;
78 /** True if the object is a pointer. */
79 static const bool Pointer = std::is_pointer<t_type>::value;
80 /** True if unsigned. */
81 static const bool Unsigned = std::is_unsigned<t_type>::value;
82 /** True if is a floating point number. */
83 static const bool Float = std::is_floating_point<t_type>::value;
84 /** True is an integer. */
85 static const bool Integer = std::is_integral<t_type>::value;
86 /** True is a number. */
87 static const bool Number = std::is_integral<t_type>::value || std::is_floating_point<t_type>::value;
88 /** True if is an enum. */
89 static const bool Enum = std::is_enum<t_type>::value;
90 /** True is a string. */
91 static const bool String = false;
92 /** True is a color. */
93 static const bool Color = false;
94
95 static const bool Boolean = false;
96 /**--------------------------------------------------------------------------------------------------
97 Fn: static constexpr ObjectInfo<t_type, false> VectorSub()
98
99 \brief If this object is of type vector, returns this object's sub object. Otherwise returns the object itself
100
101 Author: Tyler Parke
102
103 Date: 2017-11-17
104
105 Returns: An ObjectInfo&lt;t_type,false&gt;
106 *-----------------------------------------------------------------------------------------------**/
107
109 };
110
111
112 /**--------------------------------------------------------------------------------------------------
113 Struct: ObjectInfo<t_type,true>
114
115 \brief Information about the object.
116
117 Author: Tyler Parke
118
119 Date: 2017-11-17
120 *-----------------------------------------------------------------------------------------------**/
121 template<typename t_type>
122 struct ObjectInfo<t_type, true, false>
123 {
124 static const uint01 Dimensions = t_type::NumberOfDimensions();
125 static const bool Vector = true;
126 static const bool Buffer = false;
127 static const bool Primitive = ObjectInfo<decltype(t_type::Type())>::Primitive;
128 static const bool Pointer = ObjectInfo<decltype(t_type::Type())>::Pointer;
129 static const bool Unsigned = ObjectInfo<decltype(t_type::Type())>::Unsigned;
130 static const bool Float = ObjectInfo<decltype(t_type::Type())>::Float;
131 static const bool Integer = ObjectInfo<decltype(t_type::Type())>::Integer;
132 static const bool Number = ObjectInfo<decltype(t_type::Type())>::Number;
133 static const bool String = ObjectInfo<decltype(t_type::Type())>::String;
134 static const bool Color = ObjectInfo<decltype(t_type::Type())>::Color;
135 static const bool Boolean = ObjectInfo<decltype(t_type::Type())>::Boolean;
136 static constexpr ObjectInfo<decltype(t_type::Type())> VectorSub() { return ObjectInfo<decltype(t_type::Type())>(); }
137 };
138
139 template<typename t_type>
140 struct ObjectInfo<t_type, false, true>
141 {
142 static const uint01 Dimensions = 0;
143 static const bool Vector = false;
144 static const bool Buffer = true;
145 static const bool Primitive = false;
146 static const bool Pointer = ObjectInfo<decltype(t_type::Type())>::Pointer;
147 static const bool Unsigned = ObjectInfo<decltype(t_type::Type())>::Unsigned;
148 static const bool Float = ObjectInfo<decltype(t_type::Type())>::Float;
149 static const bool Integer = ObjectInfo<decltype(t_type::Type())>::Integer;
150 static const bool Number = ObjectInfo<decltype(t_type::Type())>::Number;
151 static const bool String = ObjectInfo<decltype(t_type::Type())>::String;
152 static const bool Color = ObjectInfo<decltype(t_type::Type())>::Color;
153 static const bool Boolean = ObjectInfo<decltype(t_type::Type())>::Boolean;
154 static constexpr ObjectInfo<decltype(t_type::Type())> VectorSub() { return ObjectInfo<decltype(t_type::Type())>(); }
155 };
156
157 template<>
158 struct ObjectInfo<bool, false, false>
159 {
160 static const uint01 Dimensions = 0;
161 static const bool Vector = false;
162 static const bool Buffer = false;
163 static const bool Primitive = true;
164 static const bool Pointer = false;
165 static const bool Unsigned = false;
166 static const bool Float = false;
167 static const bool Integer = false;
168 static const bool Number = false;
169 static const bool Enum = false;
170 static const bool String = false;
171 static const bool Color = false;
172 static const bool Boolean = true;
174 };
175 template<>
176 struct ObjectInfo<char, false, false>
177 {
178 static const uint01 Dimensions = 0;
179 static const bool Vector = false;
180 static const bool Buffer = false;
181 static const bool Primitive = true;
182 static const bool Pointer = false;
183 static const bool Unsigned = false;
184 static const bool Float = false;
185 static const bool Integer = false;
186 static const bool Number = false;
187 static const bool Enum = false;
188 static const bool String = false;
189 static const bool Color = false;
190 static const bool Boolean = false;
192 };
193
194 template<class t_first_type, class t_second_type>
195 struct ObjectInfo<std::pair<t_first_type, t_second_type>, false, false>
196 {
197 static const uint01 Dimensions = 0;
198 static const bool Vector = false;
199 static const bool Buffer = false;
201 static const bool Pointer = false;
202 static const bool Unsigned = false;
203 static const bool Float = false;
204 static const bool Integer = false;
205 static const bool Number = false;
206 static const bool Enum = false;
207 static const bool String = false;
208 static const bool Color = false;
209 static const bool Boolean = false;
211 };
212}
Definition ObjectInfo.h:44
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition Color.h:36
Definition Pointer.hpp:62
Definition String.h:40
An element of a vector space. An element of the real coordinate space Rn Basis vector,...
Definition Vector.hpp:62
Definition ACIColor.h:37
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:98
Definition File.h:213
static constexpr ObjectInfo< bool, false, false > VectorSub()
Definition ObjectInfo.h:173
static constexpr ObjectInfo< char, false > VectorSub()
Definition ObjectInfo.h:191
static constexpr ObjectInfo< std::pair< t_first_type, t_second_type >, false > VectorSub()
Definition ObjectInfo.h:210
static constexpr ObjectInfo< t_type, false > VectorSub()
If this object is of type vector, returns this object's sub object. Otherwise returns the object itse...
Definition ObjectInfo.h:108
static constexpr ObjectInfo< decltype(t_type::Type())> VectorSub()
Definition ObjectInfo.h:154
static constexpr ObjectInfo< decltype(t_type::Type())> VectorSub()
Definition ObjectInfo.h:136
Information about the object.
Definition ObjectInfo.h:56