13 #ifndef OGLPLUS_OBJECT_GROUP_1405011014_HPP
14 #define OGLPLUS_OBJECT_GROUP_1405011014_HPP
16 #include <oglplus/object/seq_tpl.hpp>
17 #include <oglplus/config/compiler.hpp>
24 template <
typename ObjName>
28 template <
typename ObjTag>
32 typedef typename ObjTag::NameType NameT;
33 std::vector<NameT> _names;
44 Group(
const Group& that)
49 : _names(std::move(temp._names))
52 #if !OGLPLUS_NO_INITIALIZER_LISTS
53 Group(std::initializer_list<ObjectName<ObjTag>> names)
56 _names.reserve(names.size());
58 auto i = names.begin();
59 while(i != names.end())
68 template <
typename StdRange>
75 auto b = begin(range);
78 _names.reserve(distance(b, e));
91 _names.push_back(
GetName(name));
114 template <
typename ObjTag>
115 inline Group<ObjectName<ObjTag>>
116 operator , (ObjectName<ObjTag> a, ObjectName<ObjTag> b)
118 return Group<ObjectName<ObjTag>>(a, b);
121 template <
typename ObjTag>
122 inline Group<ObjectName<ObjTag>>&&
123 operator , (Group<ObjectName<ObjTag>>&& g, ObjectName<ObjTag> n)
129 template <
typename ObjName, std::
size_t N>
132 template <
typename ObjTag, std::
size_t N>
133 class StaticGroup<ObjectName<ObjTag>, N>
136 typedef typename ObjTag::NameType NameT;
138 std::array<NameT, N> _names;
140 #if !OGLPLUS_NO_VARIADIC_TEMPLATES
141 void _init(std::size_t) { }
143 template <
typename ... Tags>
146 ObjectName<ObjTag> name,
147 ObjectName<Tags> ... names
151 _init(i+1, names...);
155 StaticGroup(
const ObjectName<ObjTag> (&names)[N])
157 for(std::size_t i=0; i!=N; ++i)
163 #if !OGLPLUS_NO_VARIADIC_TEMPLATES
164 template <
typename ... Tag>
165 StaticGroup(ObjectName<Tag>... names)
171 ObjectName<ObjTag> n0,
172 ObjectName<ObjTag> n1
180 ObjectName<ObjTag> n0,
181 ObjectName<ObjTag> n1,
182 ObjectName<ObjTag> n2
191 Sequence<ObjectName<ObjTag>> seq(
void)
const
193 return Sequence<ObjectName<ObjTag>>(
203 operator Sequence<ObjectName<ObjTag>> (void)
const
209 #if !OGLPLUS_NO_VARIADIC_TEMPLATES
210 template <
typename ObjTag,
typename ... ObjTags>
211 inline StaticGroup<ObjectName<ObjTag>, 1+
sizeof...(ObjTags)>
212 MakeGroup(ObjectName<ObjTag> name, ObjectName<ObjTags>... names)
214 return StaticGroup<ObjectName<ObjTag>, 1+
sizeof...(ObjTags)>(
220 template <
typename ObjTag>
221 inline StaticGroup<ObjectName<ObjTag>, 2>
222 MakeGroup(ObjectName<ObjTag> n0, ObjectName<ObjTag> n1)
224 return StaticGroup<ObjectName<ObjTag>, 2>(n0, n1);
227 template <
typename ObjTag>
228 inline StaticGroup<ObjectName<ObjTag>, 3>
229 MakeGroup(ObjectName<ObjTag> n0, ObjectName<ObjTag> n1, ObjectName<ObjTag> n2)
231 return StaticGroup<ObjectName<ObjTag>, 3>(n0, n1, n2);
237 #endif // include guard
Common base class for Object name sequences.
Definition: fwd.hpp:139
Group & Add(ObjectName< ObjTag > name)
Add a new name to this group.
Definition: group.hpp:89
Group(void)
Constructs an empty Group.
Definition: group.hpp:36
Group(const StdRange &range)
Constructs the Group from a std range supporting begin and end.
Definition: group.hpp:69
ObjTag::NameType GetName(ObjectName< ObjTag >)
Returns the base name assigned to named object.
Definition: name_tpl.hpp:128
A common template for "named" objects like textures, buffers, etc.
Definition: fwd.hpp:136