From 174ae36894239c27921e0febe636e09f90079342 Mon Sep 17 00:00:00 2001 From: karutoh Date: Tue, 30 Jan 2024 18:06:16 -0800 Subject: [PATCH] Test --- .gitea/workflows/demo.yaml | 22 ++++++++++++++++++ include/ehs/GarbageCollector.h | 3 +++ include/ehs/Type.h | 8 +++---- src/BaseObj.cpp | 6 ++--- src/Type.cpp | 41 ++++++++++++++++++++++++++++++++++ 5 files changed, 73 insertions(+), 7 deletions(-) create mode 100644 .gitea/workflows/demo.yaml diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml new file mode 100644 index 0000000..610ff92 --- /dev/null +++ b/.gitea/workflows/demo.yaml @@ -0,0 +1,22 @@ +name: Raspberry Pi 4 Build +run-name: ${{ gitea.actor }} is testing out Gitea Actions +on: + push: + branches: + - "main" + +jobs: + Explore-Gitea-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "The job was automatically triggered by a ${{ gitea.event_name }} event." + - run: echo "This job is now running on a ${{ runner.os }} server hosted by Gitea!" + - run: echo "The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." + - name: Check out repository code + uses: actions/checkout@v3 + - run: echo "The ${{ gitea.repository }} repository has been cloned to the runner." + - run: echo "The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ gitea.workspace }} + - run: echo "This job's status is ${{ job.status }}." \ No newline at end of file diff --git a/include/ehs/GarbageCollector.h b/include/ehs/GarbageCollector.h index d0dfbd7..0b97777 100644 --- a/include/ehs/GarbageCollector.h +++ b/include/ehs/GarbageCollector.h @@ -8,9 +8,12 @@ namespace ehs { + typedef bool (*GcLogic)(BaseObj*); + class GarbageCollector { private: + static Vector* logic; static Vector garbage; static UInt_64 max; static Thread thread; diff --git a/include/ehs/Type.h b/include/ehs/Type.h index 5549271..e5f862f 100644 --- a/include/ehs/Type.h +++ b/include/ehs/Type.h @@ -19,13 +19,13 @@ namespace ehs explicit Type(const Char_8* id); - Type(Type&& type) noexcept = default; + Type(Type&& type) noexcept; - Type(const Type& type) = default; + Type(const Type& type); - Type& operator=(Type&& type) noexcept = default; + Type& operator=(Type&& type) noexcept; - Type& operator=(const Type& type) = default; + Type& operator=(const Type& type); bool operator==(const Type& type) const; diff --git a/src/BaseObj.cpp b/src/BaseObj.cpp index a127e8b..b905213 100644 --- a/src/BaseObj.cpp +++ b/src/BaseObj.cpp @@ -142,10 +142,10 @@ namespace ehs Type* result = new Type[hierarchySize + 1]; - result[0] = newType; + result[0] = (Type&&)newType; - for (UInt_64 i = 1; i < hierarchySize; i++) - result[i] = hierarchy[i]; + for (UInt_64 i = 0; i < hierarchySize; i++) + result[i + 1] = (Type&&)hierarchy[i]; hierarchySize++; delete[] hierarchy; diff --git a/src/Type.cpp b/src/Type.cpp index 9efdebf..a860195 100644 --- a/src/Type.cpp +++ b/src/Type.cpp @@ -12,6 +12,47 @@ namespace ehs { } + Type::Type(Type&& type) noexcept + : size(type.size), id(type.id), hashId(type.hashId) + { + type.size = 0; + type.id = nullptr; + type.hashId = 0; + } + + Type::Type(const Type& type) + : size(type.size), id(type.id), hashId(type.hashId) + { + } + + Type& Type::operator=(Type&& type) noexcept + { + if (this == &type) + return *this; + + size = type.size; + id = type.id; + hashId = type.hashId; + + type.size = 0; + type.id = nullptr; + type.hashId = 0; + + return *this; + } + + Type& Type::operator=(const Type& type) + { + if (this == &type) + return *this; + + size = type.size; + id = type.id; + hashId = type.hashId; + + return *this; + } + bool Type::operator==(const Type& type) const { return hashId == type.hashId;