35 #include "core/GpgFrontendCoreExport.h"
36 #include "core/utils/MemoryUtils.h"
41 using DataObjectPtr = std::shared_ptr<DataObject>;
53 auto operator[](
size_t index)
const -> std::any;
55 void AppendObject(std::any);
57 [[nodiscard]]
auto GetParameter(
size_t index)
const -> std::any;
59 [[nodiscard]]
auto GetObjectSize()
const -> size_t;
65 template <
typename... Args>
66 auto Check() ->
bool {
67 if (
sizeof...(Args) != GetObjectSize())
return false;
69 std::vector<std::type_info const*> type_list = {&
typeid(Args)...};
70 for (
size_t i = 0; i < type_list.size(); ++i) {
71 if (std::type_index(*type_list[i]) !=
72 std::type_index((*
this)[i].type())) {
74 "value of index {} in data object is type: {}, "
75 "not expected type: {}",
76 i, ((*
this)[i]).type().name(), type_list[i]->name());
85 SecureUniquePtr<Impl> p_;
88 template <
typename... Args>
89 auto TransferParams(Args&&... args) -> std::shared_ptr<DataObject> {
90 return GpgFrontend::SecureCreateSharedObject<DataObject>(
95 auto ExtractParams(
const std::shared_ptr<DataObject>& d_o,
int index) -> T {
97 throw std::invalid_argument(
"nullptr provided for DataObjectPtr");
99 return std::any_cast<T>(d_o->GetParameter(index));
102 void swap(DataObject& a, DataObject& b) noexcept;
Definition: DataObject.cpp:35
Definition: DataObject.h:43