object: add some top level comments

This commit is contained in:
Danny Robson 2017-09-01 12:33:41 +10:00
parent d88ecaf613
commit 4f7e12951c

View File

@ -12,7 +12,7 @@
* limitations under the License. * limitations under the License.
* *
* Copyright: * Copyright:
* 2016, Danny Robson <danny@nerdcruft.net> * 2016-2017, Danny Robson <danny@nerdcruft.net>
*/ */
#ifndef CRUFT_VK_OBJECT_HPP #ifndef CRUFT_VK_OBJECT_HPP
@ -25,6 +25,8 @@
#include <vector> #include <vector>
namespace cruft::vk { namespace cruft::vk {
/// the base class for all non-trivial vulkan objects requiring lifetime
/// management.
template <typename T> template <typename T>
struct object { struct object {
using id_t = typename id_traits<T>::id_t; using id_t = typename id_traits<T>::id_t;
@ -41,6 +43,9 @@ namespace cruft::vk {
}; };
/// a vulkan object that must be directly instantiated through
/// constructor arguments, rather than being enumerated and owned by
/// another object.
template <typename T> template <typename T>
struct instantiated : public object<T> { struct instantiated : public object<T> {
using id_t = typename object<T>::id_t; using id_t = typename object<T>::id_t;
@ -67,6 +72,8 @@ namespace cruft::vk {
} }
}; };
/// a vulkan object that is obtained by listings from a parent object.
template <typename T> template <typename T>
struct enumerated : public object<T> { struct enumerated : public object<T> {
using object<T>::object; using object<T>::object;
@ -74,6 +81,11 @@ namespace cruft::vk {
static std::vector<T> find (const instance&); static std::vector<T> find (const instance&);
}; };
/// a vulkan object that is directly owned by a parent object.
///
/// typically implies that this object must be freed using a reference to
/// the parent object.
template <typename T, typename O> template <typename T, typename O>
struct owned : public object<T> { }; struct owned : public object<T> { };
} }