Nebula
Loading...
Searching...
No Matches
attributedefinition.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
14
15//------------------------------------------------------------------------------
16namespace Attr
17{
18template<class VALUETYPE, class TYPE>
20{
21public:
23 AttributeDefinition(const Util::String& n, const Util::String& tn, const Util::FourCC& fourCC, AccessMode am, TYPE defVal);
24
26 using AttrDeclType = TYPE;
27};
28
29//------------------------------------------------------------------------------
32template<class VALUETYPE, class TYPE>
34 AttributeDefinitionBase(n, tn, fcc, am, defVal, false)
35{
36 // empty
37}
38
39//------------------------------------------------------------------------------
40// macro definitions
41//------------------------------------------------------------------------------
42#define DeclareByte(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::ByteTypeClass, byte> NAME;
43#define DefineByte(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::ByteTypeClass, byte> NAME(#NAME, "byte", FOURCC,ACCESSMODE, byte(0));
44#define DefineByteWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::ByteTypeClass, byte> NAME(#NAME, "byte", FOURCC,ACCESSMODE,DEFVAL);
45
46#define DeclareShort(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::ShortTypeClass, short> NAME;
47#define DefineShort(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::ShortTypeClass, short> NAME(#NAME, "short", FOURCC,ACCESSMODE, short(0));
48#define DefineShortWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::ShortTypeClass, short> NAME(#NAME, "short", FOURCC,ACCESSMODE,DEFVAL);
49
50#define DeclareUShort(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::UShortTypeClass, ushort> NAME;
51#define DefineUShort(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::UShortTypeClass, ushort> NAME(#NAME, "ushort", FOURCC,ACCESSMODE, ushort(0));
52#define DefineUShortWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::UShortTypeClass, ushort> NAME(#NAME, "ushort", FOURCC,ACCESSMODE,DEFVAL);
53
54#define DeclareInt(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::IntTypeClass, int> NAME;
55#define DefineInt(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::IntTypeClass, int> NAME(#NAME, "int", FOURCC,ACCESSMODE, int(0));
56#define DefineIntWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::IntTypeClass, int> NAME(#NAME, "int", FOURCC,ACCESSMODE,DEFVAL);
57
58#define DeclareUInt(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::UIntTypeClass, uint> NAME;
59#define DefineUInt(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::UIntTypeClass, uint> NAME(#NAME, "uint", FOURCC,ACCESSMODE, uint(0));
60#define DefineUIntWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::UIntTypeClass, uint> NAME(#NAME, "uint", FOURCC,ACCESSMODE,DEFVAL);
61
62#define DeclareInt64(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::Int64TypeClass, int64_t> NAME;
63#define DefineInt64(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::Int64TypeClass, int64_t> NAME(#NAME, "int64", FOURCC,ACCESSMODE, int64_t(0));
64#define DefineInt64WithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::Int64TypeClass, int64_t> NAME(#NAME, "int64", FOURCC,ACCESSMODE,DEFVAL);
65
66#define DeclareUInt64(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::UInt64TypeClass, uint64_t> NAME;
67#define DefineUInt64(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::UInt64TypeClass, uint64_t> NAME(#NAME, "uint64", FOURCC,ACCESSMODE, uint64_t(0));
68#define DefineUInt64WithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::UInt64TypeClass, uint64_t> NAME(#NAME, "uint64", FOURCC,ACCESSMODE,DEFVAL);
69
70#define DeclareFloat(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::FloatTypeClass, float> NAME;
71#define DefineFloat(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::FloatTypeClass, float> NAME(#NAME, "float", FOURCC,ACCESSMODE, float(0.0f));
72#define DefineFloatWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::FloatTypeClass, float> NAME(#NAME, "float", FOURCC,ACCESSMODE,DEFVAL);
73
74#define DeclareDouble(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::DoubleTypeClass, double> NAME;
75#define DefineDouble(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::DoubleTypeClass, double> NAME(#NAME, "double", FOURCC,ACCESSMODE, double(0.0));
76#define DefineDoubleWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::DoubleTypeClass, double> NAME(#NAME, "double", FOURCC,ACCESSMODE,DEFVAL);
77
78#define DeclareBool(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::BoolTypeClass, bool> NAME;
79#define DefineBool(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::BoolTypeClass, bool> NAME(#NAME, "bool", FOURCC,ACCESSMODE, bool(false));
80#define DefineBoolWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::BoolTypeClass, bool> NAME(#NAME, "bool", FOURCC,ACCESSMODE,DEFVAL);
81
82#define DeclareFloat2(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::Float2TypeClass, Math::float2> NAME;
83#define DefineFloat2(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::Float2TypeClass, Math::float2> NAME(#NAME, "Math::float2", FOURCC,ACCESSMODE, Math::float2(0.0f, 0.0f));
84#define DefineFloat2WithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::Float2TypeClass, Math::float2> NAME(#NAME, "Math::float2", FOURCC,ACCESSMODE,DEFVAL);
85
86#define DeclareFloat4(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::Float4TypeClass, Math::vec4> NAME;
87#define DefineFloat4(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::Float4TypeClass, Math::vec4> NAME(#NAME, "Math::vec4", FOURCC,ACCESSMODE, Math::vec4(0.0f, 0.0f, 0.0f, 0.0f));
88#define DefineFloat4WithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::Float4TypeClass, Math::vec4> NAME(#NAME, "Math::vec4", FOURCC,ACCESSMODE,DEFVAL);
89
90#define DeclareQuaternion(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::QuaternionTypeClass, Math::quaternion> NAME;
91#define DefineQuaternion(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::QuaternionTypeClass, Math::quaternion> NAME(#NAME, "Math::quaternion", FOURCC,ACCESSMODE, Math::quaternion(0.0f, 0.0f, 0.0f, 1.0f));
92#define DefineQuaternionWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::QuaternionTypeClass, Math::quaternion> NAME(#NAME, "Math::quaternion", FOURCC,ACCESSMODE,DEFVAL);
93
94#define DeclareString(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::StringTypeClass, Util::String> NAME;
95#define DefineString(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::StringTypeClass, Util::String> NAME(#NAME, "Util::String", FOURCC,ACCESSMODE, Util::String());
96#define DefineStringWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::StringTypeClass, Util::String> NAME(#NAME, "Util::String", FOURCC,ACCESSMODE,DEFVAL);
97
98#define DeclareMatrix44(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::Matrix44TypeClass, Math::mat4> NAME;
99#define DefineMatrix44(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::Matrix44TypeClass, Math::mat4> NAME(#NAME, "Math::mat4", FOURCC,ACCESSMODE, Math::mat4());
100#define DefineMatrix44WithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::Matrix44TypeClass, Math::mat4> NAME(#NAME, "Math::mat4", FOURCC,ACCESSMODE,DEFVAL);
101
102#define DeclareTransform44(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::Transform44TypeClass, Math::transform44> NAME;
103#define DefineTransform44(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::Transform44TypeClass, Math::transform44> NAME(#NAME, "Math::transform44", FOURCC,ACCESSMODE, Math::transform44());
104#define DefineTransform44WithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::Transform44TypeClass, Math::transform44> NAME(#NAME, "Math::transform44", FOURCC,ACCESSMODE,DEFVAL);
105
106#define DeclareBlob(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::BlobTypeClass, Util::Blob> NAME;
107#define DefineBlob(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::BlobTypeClass, Util::Blob> NAME(#NAME, "Util::Blob", FOURCC,ACCESSMODE, Util::Blob());
108#define DefineBlobWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::BlobTypeClass, Util::Blob> NAME(#NAME, "Util::Blob", FOURCC,ACCESSMODE,DEFVAL);
109
110#define DeclareGuid(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::GuidTypeClass, Util::Guid> NAME;
111#define DefineGuid(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::GuidTypeClass, Util::Guid> NAME(#NAME, "Util::Guid", FOURCC,ACCESSMODE, Util::Guid());
112#define DefineGuidWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::GuidTypeClass, Util::Guid> NAME(#NAME, "Util::Guid", FOURCC,ACCESSMODE,DEFVAL);
113
114#define DeclareVoidPtr(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::VoidPtrTypeClass, void*> NAME;
115#define DefineVoidPtr(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::VoidPtrTypeClass, void*> NAME(#NAME, "void*", FOURCC,ACCESSMODE, nullptr);
116#define DefineVoidPtrWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::VoidPtrTypeClass, void*> NAME(#NAME, "void*", FOURCC,ACCESSMODE,DEFVAL);
117
118#define DeclareIntArray(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::IntArrayTypeClass, Util::Array<int>> NAME;
119#define DefineIntArray(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::IntArrayTypeClass, Util::Array<int>> NAME(#NAME, "Util::Array<int>", FOURCC,ACCESSMODE, Util::Array<int>());
120#define DefineIntArrayWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::IntArrayTypeClass, Util::Array<int>> NAME(#NAME, "Util::Array<int>", FOURCC,ACCESSMODE,DEFVAL);
121
122#define DeclareFloatArray(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::FloatArrayTypeClass, Util::Array<float>> NAME;
123#define DefineFloatArray(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::FloatArrayTypeClass, Util::Array<float>> NAME(#NAME, "Util::Array<float>", FOURCC,ACCESSMODE, Util::Array<float>());
124#define DefineFloatArrayWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::FloatArrayTypeClass, Util::Array<float>> NAME(#NAME, "Util::Array<float>", FOURCC,ACCESSMODE,DEFVAL);
125
126#define DeclareBoolArray(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::BoolArrayTypeClass, Util::Array<bool>> NAME;
127#define DefineBoolArray(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::BoolArrayTypeClass, Util::Array<bool>> NAME(#NAME, "Util::Array<bool>", FOURCC,ACCESSMODE, Util::Array<bool>());
128#define DefineBoolArrayWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::BoolArrayTypeClass, Util::Array<bool>> NAME(#NAME, "Util::Array<bool>", FOURCC,ACCESSMODE,DEFVAL);
129
130#define DeclareFloat2Array(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::Float2ArrayTypeClass, Util::Array<Math::float2>> NAME;
131#define DefineFloat2Array(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::Float2ArrayTypeClass, Util::Array<Math::float2>> NAME(#NAME, "Util::Array<Math::float2>", FOURCC,ACCESSMODE, Util::Array<Math::float2>());
132#define DefineFloat2ArrayWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::Float2ArrayTypeClass, Util::Array<Math::float2>> NAME(#NAME, "Util::Array<Math::float2>", FOURCC,ACCESSMODE,DEFVAL);
133
134#define DeclareFloat4Array(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::Float4ArrayTypeClass, Util::Array<Math::vec4>> NAME;
135#define DefineFloat4Array(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::Float4ArrayTypeClass, Util::Array<Math::vec4>> NAME(#NAME, "Util::Array<Math::vec4>", FOURCC,ACCESSMODE, Util::Array<Math::vec4>());
136#define DefineFloat4ArrayWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::Float4ArrayTypeClass, Util::Array<Math::vec4>> NAME(#NAME, "Util::Array<Math::vec4>", FOURCC,ACCESSMODE,DEFVAL);
137
138#define DeclareStringArray(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::StringArrayTypeClass, Util::Array<Util::String>> NAME;
139#define DefineStringArray(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::StringArrayTypeClass, Util::Array<Util::String>> NAME(#NAME, "Util::Array<Util::String>", FOURCC,ACCESSMODE, Util::Array<Util::String>());
140#define DefineStringArrayWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::StringArrayTypeClass, Util::Array<Util::String>> NAME(#NAME, "Util::Array<Util::String>", FOURCC,ACCESSMODE,DEFVAL);
141
142#define DeclareMatrix44Array(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::Matrix44ArrayTypeClass, Util::Array<Math::mat4>> NAME;
143#define DefineMatrix44Array(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::Matrix44ArrayTypeClass, Util::Array<Math::mat4>> NAME(#NAME, "Util::Array<Math::mat4>", FOURCC,ACCESSMODE, Util::Array<Math::mat4>());
144#define DefineMatrix44ArrayWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::Matrix44ArrayTypeClass, Util::Array<Math::mat4>> NAME(#NAME, "Util::Array<Math::mat4>", FOURCC,ACCESSMODE,DEFVAL);
145
146#define DeclareBlobArray(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::BlobArrayTypeClass, Util::Array<Util::Blob>> NAME;
147#define DefineBlobArray(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::BlobArrayTypeClass, Util::Array<Util::Blob>> NAME(#NAME, "Util::Array<Util::Blob>", FOURCC,ACCESSMODE, Util::Array<Util::Blob>());
148#define DefineBlobArrayWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::BlobArrayTypeClass, Util::Array<Util::Blob>> NAME(#NAME, "Util::Array<Util::Blob>", FOURCC,ACCESSMODE,DEFVAL);
149
150#define DeclareGuidArray(NAME,FOURCC,ACCESSMODE) extern const AttributeDefinition<Attr::GuidArrayTypeClass, Util::Array<Util::Guid>> NAME;
151#define DefineGuidArray(NAME,FOURCC,ACCESSMODE) const AttributeDefinition<Attr::GuidArrayTypeClass, Util::Array<Util::Guid>> NAME(#NAME, "Util::Array<Util::Guid>", FOURCC,ACCESSMODE, Util::Array<Util::Guid>());
152#define DefineGuidArrayWithDefault(NAME,FOURCC,ACCESSMODE,DEFVAL) const AttributeDefinition<Attr::GuidArrayTypeClass, Util::Array<Util::Guid>> NAME(#NAME, "Util::Array<Util::Guid>", FOURCC,ACCESSMODE,DEFVAL);
153
154} // namespace Attr
155//------------------------------------------------------------------------------
Implements a universal attribute definition, consisting of an attribute name, attribute fourcc code,...
Definition attributedefinitionbase.h:30
Util::FourCC fourCC
Definition attributedefinitionbase.h:141
This extends the typeless AttributeDefinitionBase class by a typed template class,...
Definition attributedefinition.h:20
AttributeDefinition(const Util::String &n, const Util::String &tn, const Util::FourCC &fourCC, AccessMode am, TYPE defVal)
constructor
Definition attributedefinition.h:33
TYPE AttrDeclType
Inner type.
Definition attributedefinition.h:26
A four-character-code is a quasi-human-readable 32-bit-id.
Definition fourcc.h:19
Definition accessmode.h:13
AccessMode
Definition accessmode.h:15
Nebula's universal string class.
Definition string.h:50