Add generic handlers

Former-commit-id: 8fc343d3a056de8031cf453748b8801d50d3710e
This commit is contained in:
Lynix
2016-03-31 21:14:22 +02:00
parent a2f6e54104
commit a77ad42fcb
16 changed files with 542 additions and 423 deletions

View File

@@ -0,0 +1,47 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
#pragma once
#ifndef NAZARA_OBJECTHANDLER_HPP
#define NAZARA_OBJECTHANDLER_HPP
#include <Nazara/Core/Bitset.hpp>
#include <memory>
#include <vector>
namespace Nz
{
template<typename T> class ObjectHandle;
template<typename T>
class HandledObject
{
friend ObjectHandle<T>;
public:
HandledObject() = default;
HandledObject(const HandledObject& object);
HandledObject(HandledObject&& object);
~HandledObject();
ObjectHandle<T> CreateHandle();
HandledObject& operator=(const HandledObject& object);
HandledObject& operator=(HandledObject&& object);
protected:
void UnregisterAllHandles();
private:
void RegisterHandle(ObjectHandle<T>* handle);
void UnregisterHandle(ObjectHandle<T>* handle);
std::vector<ObjectHandle<T>*> m_handles;
};
}
#include <Nazara/Core/HandledObject.inl>
#endif // NAZARA_OBJECTHANDLER_HPP