/* * Copyright (c) 2018-2019 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include /* Declare false allowed struct. */ template struct AllowedOut : std::false_type {}; struct OutDataTag{}; struct OutHandleTag{}; struct OutSessionTag{}; /* Define out struct, so that we can get errors on enable_if */ template class Out { static_assert(std::is_pod::value && !std::is_pod::value, "Invalid IPC Out Type!"); }; template class Out::value || AllowedOut::value>::type> : public OutDataTag { private: T *obj; public: Out(T *o) : obj(o) { } void SetValue(const T& t) { *obj = t; } const T& GetValue() { return *obj; } T *GetPointer() { return obj; } /* Convenience operators. */ T& operator*() { return *obj; } T* operator->() { return obj; } }; template class Out { static_assert(std::is_pod::value && !std::is_pod::value, "Invalid IPC Out Type (Raw Pointer)!"); }; template struct OutHelper; template struct OutHelper> { using type = T; };