Toshihiro Shimizu 890ddd
#if !defined(UTILS_INTERFACEHOLDER_HPP__)
Toshihiro Shimizu 890ddd
#define UTILS_INTERFACEHOLDER_HPP__
Toshihiro Shimizu 890ddd
#include <toonz_plugin.h></toonz_plugin.h>
Toshihiro Shimizu 890ddd
#include <toonz_hostif.h></toonz_hostif.h>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
extern toonz::host_interface_t *ifactory_;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void release_interf(void *interf)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	ifactory_->release_interface(interf);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class t=""></class>
Toshihiro Shimizu 890ddd
std::unique_ptr<t, decltype(&release_interf)=""> grab_interf(const toonz::UUID *uuid)</t,>
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	T *interf = nullptr;
Toshihiro Shimizu 890ddd
	if (ifactory_->query_interface(uuid, reinterpret_cast<void **="">(&interf)))</void>
Toshihiro Shimizu 890ddd
		return std::unique_ptr<t, decltype(&release_interf)="">(nullptr, release_interf);</t,>
Toshihiro Shimizu 890ddd
	return std::move(std::unique_ptr<t, decltype(&release_interf)="">(interf, release_interf));</t,>
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif