aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/thread/DataObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/thread/DataObject.cpp')
-rw-r--r--src/core/thread/DataObject.cpp57
1 files changed, 56 insertions, 1 deletions
diff --git a/src/core/thread/DataObject.cpp b/src/core/thread/DataObject.cpp
index c99e0bfd..b21db7cb 100644
--- a/src/core/thread/DataObject.cpp
+++ b/src/core/thread/DataObject.cpp
@@ -26,4 +26,59 @@
*
*/
-#include "DataObject.h" \ No newline at end of file
+#include "DataObject.h"
+
+#include <memory>
+#include <stack>
+
+#include "function/DataObjectOperator.h"
+
+namespace GpgFrontend::Thread {
+
+class DataObject::Impl {
+ public:
+ Impl() {}
+
+ Impl(std::initializer_list<std::any> init_list) : params_(init_list) {}
+
+ void AppendObject(std::any obj) { params_.push_back(obj); }
+
+ std::any GetParameter(size_t index) {
+ if (index >= params_.size()) {
+ throw std::out_of_range("index out of range");
+ }
+ return params_[index];
+ }
+
+ size_t GetObjectSize() { return params_.size(); }
+
+ private:
+ std::vector<std::any> params_;
+};
+
+DataObject::DataObject() : p_(std::make_unique<Impl>()) {}
+
+DataObject::DataObject(std::initializer_list<std::any> i)
+ : p_(std::make_unique<Impl>(i)) {}
+
+DataObject::~DataObject() = default;
+
+DataObject::DataObject(GpgFrontend::Thread::DataObject&&) noexcept = default;
+
+std::any DataObject::operator[](size_t index) const {
+ return p_->GetParameter(index);
+}
+
+std::any DataObject::GetParameter(size_t index) const {
+ return p_->GetParameter(index);
+}
+
+size_t DataObject::GetObjectSize() const { return p_->GetObjectSize(); }
+
+void DataObject::Swap(DataObject& other) noexcept { std::swap(p_, other.p_); }
+
+void DataObject::Swap(DataObject&& other) noexcept { p_ = std::move(other.p_); }
+
+void swap(DataObject& a, DataObject& b) noexcept { a.Swap(b); }
+
+} // namespace GpgFrontend::Thread \ No newline at end of file