From 32f91ead4e835fb3889795ae347aa0bba73c6426 Mon Sep 17 00:00:00 2001 From: Arron Nelson Date: Mon, 2 Dec 2024 16:19:50 -0800 Subject: [PATCH] Started work on Smart Pointer Vectors (SPVs). --- CMakeLists.txt | 4 ++++ include/ehs/SPV.h | 26 ++++++++++++++++++++++++++ include/ehs/SPVE.h | 25 +++++++++++++++++++++++++ src/SPV.cpp | 3 +++ src/SPVE.cpp | 3 +++ 5 files changed, 61 insertions(+) create mode 100644 include/ehs/SPV.h create mode 100644 include/ehs/SPVE.h create mode 100644 src/SPV.cpp create mode 100644 src/SPVE.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index ebd860c..aca0260 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,6 +82,8 @@ set(EHS_SOURCES include/ehs/UniPtr.h include/ehs/ShdPtr.h include/ehs/WkPtr.h + include/ehs/SPV.h + include/ehs/SPVE.h src/db/DbVarTmpl.cpp include/ehs/db/DbVarTmpl.h @@ -187,6 +189,8 @@ set(EHS_SOURCES include/ehs/io/Directory.h include/ehs/io/socket/ehc/NetEnc.h src/io/socket/ehc/NetEnc.cpp + src/SPVE.cpp + src/SPV.cpp ) if (IS_OS_WINDOWS) diff --git a/include/ehs/SPV.h b/include/ehs/SPV.h new file mode 100644 index 0000000..772ccb2 --- /dev/null +++ b/include/ehs/SPV.h @@ -0,0 +1,26 @@ +#pragma once +#include "Types.h" + +namespace ehs +{ + template + class SPVE; + + template + class SPV + { + private: + Size size; + Size rawSize; + Size stride; + T *data; + + public: + SPV(); + + SPVE operator[](Size index) + { + return SPVE(data[index]); + } + }; +} diff --git a/include/ehs/SPVE.h b/include/ehs/SPVE.h new file mode 100644 index 0000000..e6725ca --- /dev/null +++ b/include/ehs/SPVE.h @@ -0,0 +1,25 @@ +#pragma once + +namespace ehs +{ + template + class SPVE + { + private: + SPV *owner; + T *value; + + public: + SPVE(); + + SPVE(T *value); + + SPVE(SPVE &&spve) noexcept; + + SPVE(const SPVE &spve); + + SPVE &operator=(SPVE &&spve) noexcept; + + SPVE &operator=(const SPVE &spve); + }; +} \ No newline at end of file diff --git a/src/SPV.cpp b/src/SPV.cpp new file mode 100644 index 0000000..6664241 --- /dev/null +++ b/src/SPV.cpp @@ -0,0 +1,3 @@ +// +// Created by Arron Nelson on 12/2/2024. +// diff --git a/src/SPVE.cpp b/src/SPVE.cpp new file mode 100644 index 0000000..6664241 --- /dev/null +++ b/src/SPVE.cpp @@ -0,0 +1,3 @@ +// +// Created by Arron Nelson on 12/2/2024. +//