13 #ifndef OGLPLUS_OBJECT_WRAP_TPL_1107121519_HPP
14 #define OGLPLUS_OBJECT_WRAP_TPL_1107121519_HPP
18 #include <oglplus/object/seq_tpl.hpp>
19 #include <oglplus/utils/nothing.hpp>
20 #include <type_traits>
31 template <
typename ObjTag>
32 struct ObjectSubtype : Nothing
35 template <
typename OpsTag,
typename ObjTag>
38 typedef tag::Generate Type;
41 template <
typename ObjTag>
44 template <
typename OpsTag,
typename ObjTag>
47 template <
typename OpsTg,
typename ObjTg>
51 typedef tag::ObjectOps Tag;
57 template <
class ObjTag>
66 template <
class OpsTag,
class ObjTag>
68 :
public ObjCommonOps<ObjTag>
79 template <
class OpsTag,
class ObjTag>
89 template <
class OpsTag,
class ObjTag>
91 :
public ObjZeroOps<OpsTag, ObjTag>
97 template <
typename ObjTag,
typename NameHolder>
100 ,
public ObjGenDelOps<ObjTag>
103 typedef typename ObjTag::NameType NameT;
106 ObjectTpl(
const ObjectTpl&);
108 void _describe(ObjectDesc&& description)
110 aux::ObjectDescRegistry::_register_desc(
113 std::move(description)
117 void _undescribe(
void)
119 aux::ObjectDescRegistry::_unregister_desc(
125 template <
typename GenTag>
126 void _init(GenTag gen_tag, Nothing)
128 ObjGenDelOps<ObjTag>::Gen(gen_tag, 1, &this->_name);
131 template <
typename GenTag,
typename ObjectSubtype>
132 void _init(GenTag gen_tag, ObjectSubtype type)
134 this->_type = GLenum(type);
135 _init(gen_tag, Nothing());
138 void _move_in(ObjectTpl&& temp)
139 OGLPLUS_NOEXCEPT(true)
141 this->_name = temp._name;
147 if(this->_name != 0u)
150 ObjGenDelOps<ObjTag>::Delete(1, &this->_name);
154 struct Uninitialized_ { };
156 ObjectTpl(Uninitialized_) { }
158 ObjectTpl(ObjectName<ObjTag> name)
163 ObjectTpl(ObjectName<ObjTag> name, ObjectDesc&& description)
166 _describe(std::move(description));
169 template <
typename GenTag>
170 ObjectTpl(GenTag gen_tag)
172 _init(gen_tag, Nothing());
175 template <
typename GenTag>
176 ObjectTpl(GenTag gen_tag, ObjectDesc&& description)
178 _init(gen_tag, Nothing());
179 _describe(std::move(description));
182 typedef typename ObjectSubtype<ObjTag>::Type Subtype;
184 template <
typename GenTag>
185 ObjectTpl(GenTag gen_tag, Subtype subtype)
187 _init(gen_tag, subtype);
190 template <
typename GenTag>
191 ObjectTpl(GenTag gen_tag, Subtype subtype, ObjectDesc&& description)
193 _init(gen_tag, subtype);
194 _describe(std::move(description));
198 ObjectTpl(ObjectTpl&& temp)
199 OGLPLUS_NOEXCEPT(true)
201 _move_in(std::move(temp));
205 OGLPLUS_NOEXCEPT(true)
212 ObjectTpl& operator = (ObjectTpl&& temp)
215 _move_in(std::move(temp));
220 const std::string& Description(
void)
const
222 return aux::ObjectDescRegistry::_get_desc(
228 Sequence<ObjectName<ObjTag>> seq(
void)
const
230 return Sequence<ObjectName<ObjTag>>(&this->_name, 1);
237 operator Sequence<ObjectName<ObjTag>> (void)
const
244 template <
typename ObjTag>
246 :
public ObjectTpl<ObjTag, ObjectName<ObjTag>>
249 typedef ObjectTpl<ObjTag, ObjectName<ObjTag>> Base_;
264 : Base_(std::move(description))
267 ObjHandle(tag::Generate generate, ObjectDesc&& description)
268 : Base_(generate, std::move(description))
271 ObjHandle(tag::Create create, ObjectDesc&& description)
272 : Base_(create, std::move(description))
276 typedef typename ObjectSubtype<ObjTag>::Type
Subtype;
278 ObjHandle(tag::Generate generate, Subtype subtype)
279 : Base_(generate, subtype)
283 : Base_(create, subtype)
288 : Base_(static_cast<Base_&&>(temp))
294 Base_::operator = (static_cast<Base_&&>(temp));
306 template <
typename OpsTag,
typename ObjTag>
308 :
public ObjectTpl<ObjTag, ObjectOps<OpsTag, ObjTag>>
311 typedef typename ObjGenTag<OpsTag, ObjTag>::Type DefGenTag;
312 typedef ObjectTpl<ObjTag, ObjectOps<OpsTag, ObjTag>> Base_;
314 Object(
const Object&);
316 Object(
typename Base_::Uninitialized_ uninit)
325 : Base_(name, std::move(description))
350 : Base_(DefGenTag(), std::move(description))
353 Object(tag::Generate generate, ObjectDesc&& description)
354 : Base_(generate, std::move(description))
357 Object(tag::Create create, ObjectDesc&& description)
358 : Base_(create, std::move(description))
362 typedef typename ObjectSubtype<ObjTag>::Type
Subtype;
366 : Base_(DefGenTag(), subtype)
369 Object(tag::Generate generate, Subtype subtype)
370 : Base_(generate, subtype)
373 Object(tag::Create create, Subtype subtype)
374 : Base_(create, subtype)
378 Object(Subtype subtype, ObjectDesc&& description)
379 : Base_(DefGenTag(), subtype, std::move(description))
382 Object(tag::Generate generate, Subtype subtype, ObjectDesc&& description)
383 : Base_(generate, subtype, std::move(description))
386 Object(tag::Create create, Subtype subtype, ObjectDesc&& description)
387 : Base_(create, subtype, std::move(description))
392 : Base_(static_cast<Base_&&>(temp))
396 Object& operator = (Object&& temp)
398 Base_::operator = (static_cast<Base_&&>(temp));
403 template <
typename OpsTg,
typename ObjTg>
404 struct Classify<Object<ObjectOps<OpsTg, ObjTg>>>
405 : Classify<ObjectOps<OpsTg, ObjTg>>
407 typedef Object<ObjectOps<OpsTg, ObjTg>> Base;
408 typedef tag::Object Tag;
413 #endif // include guard
ObjectSubtype< ObjTag >::Type Subtype
Object subtype.
Definition: wrap_tpl.hpp:276
ObjHandle(tag::Create create)
Construction with a specific method of object creation.
Definition: wrap_tpl.hpp:258
ObjHandle & operator=(ObjHandle &&temp)
Object handles are move assignable.
Definition: wrap_tpl.hpp:292
Declaration of Object description.
ObjHandle(tag::Generate generate)
Construction with a specific method of object creation.
Definition: wrap_tpl.hpp:253
Object(Object &&temp)
Objects are move constructible.
Definition: wrap_tpl.hpp:391
Implements operations applicable to named (non-zero) objects.
Definition: wrap_tpl.hpp:45
Object(ObjectDesc &&description)
A textual description can be attached to objects.
Definition: wrap_tpl.hpp:349
Template.
Definition: wrap_tpl.hpp:245
Object(tag::Create create)
Construction with a specific method of object creation.
Definition: wrap_tpl.hpp:344
Implements operations applicable to any object including object 0 (zero)
Definition: fwd.hpp:157
ObjTag::NameType GetName(ObjectName< ObjTag >)
Returns the base name assigned to named object.
Definition: name_tpl.hpp:128
ObjectZero(void)
ObjectZero is default constructible.
Definition: wrap_tpl.hpp:85
Object(tag::Generate generate)
Construction with a specific method of object creation.
Definition: wrap_tpl.hpp:339
Object(void)
Most objects are default constructible.
Definition: wrap_tpl.hpp:334
Object(Subtype subtype, ObjectDesc &&description)
A textual description can be attached to objects.
Definition: wrap_tpl.hpp:378
ObjHandle(ObjHandle &&temp)
Object handles are move constructible.
Definition: wrap_tpl.hpp:287
ObjectSubtype< ObjTag >::Type Subtype
Object subtype.
Definition: wrap_tpl.hpp:362
Implements operations applicable to any object and any operation kind.
Definition: fwd.hpp:151
Base template for all "named" objects.
ObjHandle(ObjectDesc &&description)
A textual description can be attached to object handles.
Definition: wrap_tpl.hpp:263
Object(Subtype subtype)
Construction with subtype specification.
Definition: wrap_tpl.hpp:365
A common template for "named" objects like textures, buffers, etc.
Definition: fwd.hpp:136