metaforce/Runtime/IVParamObj.hpp

43 lines
876 B
C++
Raw Normal View History

2016-02-13 09:02:47 +00:00
#ifndef __PSHAG_IVPARAMOBJ_HPP__
#define __PSHAG_IVPARAMOBJ_HPP__
2015-08-22 01:58:41 +00:00
2015-08-22 02:59:57 +00:00
#include <memory>
2015-08-22 01:58:41 +00:00
#include "IObj.hpp"
2016-03-04 23:04:53 +00:00
namespace urde
2015-08-22 01:58:41 +00:00
{
class IVParamObj : public IObj
{
public:
virtual ~IVParamObj() {}
};
class CVParamTransfer
{
std::shared_ptr<IVParamObj> m_ref;
2015-08-22 01:58:41 +00:00
public:
2016-02-16 05:50:41 +00:00
CVParamTransfer() = default;
2015-08-26 01:34:56 +00:00
CVParamTransfer(IVParamObj* obj) : m_ref(obj) {}
CVParamTransfer(const CVParamTransfer& other) : m_ref(other.m_ref) {}
IVParamObj* GetObj() const {return m_ref.get();}
CVParamTransfer ShareTransferRef() {return CVParamTransfer(*this);}
static CVParamTransfer Null() {return CVParamTransfer();}
2015-08-22 01:58:41 +00:00
};
template<class T>
class TObjOwnerParam : public IVParamObj
{
T m_param;
protected:
~TObjOwnerParam() {}
public:
TObjOwnerParam(T&& obj) : m_param(std::move(obj)) {}
T& GetParam() {return m_param;}
2015-08-22 01:58:41 +00:00
};
}
2016-02-13 09:02:47 +00:00
#endif // __PSHAG_IVPARAMOBJ_HPP__