2020-04-14 00:07:37 +00:00
|
|
|
/*
|
2021-10-04 19:59:10 +00:00
|
|
|
* Copyright (c) Atmosphère-NX
|
2020-04-14 00:07:37 +00:00
|
|
|
*
|
|
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#include <stratosphere.hpp>
|
|
|
|
#include "erpt_srv_session_impl.hpp"
|
|
|
|
#include "erpt_srv_report_impl.hpp"
|
|
|
|
#include "erpt_srv_manager_impl.hpp"
|
|
|
|
#include "erpt_srv_attachment_impl.hpp"
|
|
|
|
|
|
|
|
namespace ams::erpt::srv {
|
|
|
|
|
2021-01-17 15:55:32 +00:00
|
|
|
extern ams::sf::ExpHeapAllocator g_sf_allocator;
|
|
|
|
|
2020-07-08 00:07:23 +00:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
template<typename Interface, typename Impl>
|
2021-01-17 15:55:32 +00:00
|
|
|
ALWAYS_INLINE Result OpenInterface(ams::sf::Out<ams::sf::SharedPointer<Interface>> &out) {
|
2020-07-08 00:07:23 +00:00
|
|
|
/* Create an interface holder. */
|
2021-01-17 15:55:32 +00:00
|
|
|
auto intf = ams::sf::ObjectFactory<ams::sf::ExpHeapAllocator::Policy>::CreateSharedEmplaced<Interface, Impl>(std::addressof(g_sf_allocator));
|
2020-07-08 00:07:23 +00:00
|
|
|
R_UNLESS(intf != nullptr, erpt::ResultOutOfMemory());
|
|
|
|
|
|
|
|
/* Return it. */
|
2021-01-17 15:55:32 +00:00
|
|
|
out.SetValue(intf);
|
2020-07-08 00:07:23 +00:00
|
|
|
return ResultSuccess();
|
|
|
|
}
|
2020-04-14 00:07:37 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-01-17 15:55:32 +00:00
|
|
|
Result SessionImpl::OpenReport(ams::sf::Out<ams::sf::SharedPointer<erpt::sf::IReport>> out) {
|
2020-07-08 00:07:23 +00:00
|
|
|
return OpenInterface<erpt::sf::IReport, ReportImpl>(out);
|
|
|
|
}
|
2020-04-14 00:07:37 +00:00
|
|
|
|
2021-01-17 15:55:32 +00:00
|
|
|
Result SessionImpl::OpenManager(ams::sf::Out<ams::sf::SharedPointer<erpt::sf::IManager>> out) {
|
2020-07-08 00:07:23 +00:00
|
|
|
return OpenInterface<erpt::sf::IManager, ManagerImpl>(out);
|
2020-04-14 00:07:37 +00:00
|
|
|
}
|
|
|
|
|
2021-01-17 15:55:32 +00:00
|
|
|
Result SessionImpl::OpenAttachment(ams::sf::Out<ams::sf::SharedPointer<erpt::sf::IAttachment>> out) {
|
2020-07-08 00:07:23 +00:00
|
|
|
return OpenInterface<erpt::sf::IAttachment, AttachmentImpl>(out);
|
2020-04-14 00:07:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|