aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2025-07-14 20:19:00 +0000
committerFelix Morgner <felix.morgner@ost.ch>2025-07-14 20:19:00 +0000
commit67785bfc07072fce56331052c1cd8de023eb2f4c (patch)
treed18dda87136a8f2e446d84195b3c39c27bc5f094 /arch
parentf12fa671ccadfdeaca1529157c3bd458f9e37c30 (diff)
downloadteachos-67785bfc07072fce56331052c1cd8de023eb2f4c.tar.xz
teachos-67785bfc07072fce56331052c1cd8de023eb2f4c.zip
x86_64: remove container
Diffstat (limited to 'arch')
-rw-r--r--arch/x86_64/include/arch/stl/container.hpp99
-rw-r--r--arch/x86_64/include/arch/stl/contiguous_pointer_iterator.hpp216
2 files changed, 0 insertions, 315 deletions
diff --git a/arch/x86_64/include/arch/stl/container.hpp b/arch/x86_64/include/arch/stl/container.hpp
deleted file mode 100644
index 4ea08c7..0000000
--- a/arch/x86_64/include/arch/stl/container.hpp
+++ /dev/null
@@ -1,99 +0,0 @@
-#ifndef TEACHOS_ARCH_X86_64_STL_CONTAINER_HPP
-#define TEACHOS_ARCH_X86_64_STL_CONTAINER_HPP
-
-#include <iterator>
-
-namespace teachos::arch::stl
-{
- /**
- * @brief Minimal iterator concept required for usage in container
- */
- template<typename T>
- concept Iterator = std::forward_iterator<T>;
-
- /**
- * @brief Read-only container for given template type, that allow to easily use this container instance in C++20
- * ranges calls.
- *
- * @tparam T Iterator the container uses to signal the start and end of it's data, has to atleast be a simple forward
- * iterator.
- */
- template<Iterator T>
- struct container
- {
- using iterator = T; ///< Iterators used by this container.
- using size_type = std::size_t; ///< Maximum size of this container.
-
- /**
- * @brief Defaulted constructor.
- */
- container() = default;
-
- /**
- * @brief Constructor.
- *
- * @param begin Iterator containing non-owning pointer to the first element of all memory areas.
- * @param end Iterator pointing to one past the last element of all memory areas.
- */
- container(iterator begin, iterator end)
- : begin_itr(begin)
- , end_itr(end)
- {
- // Nothing to do
- }
-
- /**
- * @brief Returns the iterator pointing to the first element of the memory area.
- * Allows using this class in the for each loop, because it follows the InputIterator template scheme.
- *
- * @return Iterator pointing to first element of the memory area.
- */
- [[gnu::section(".stl_text")]]
- auto begin() const -> iterator
- {
- return begin_itr;
- }
-
- /**
- * @brief Returns the iterator pointing to one past the last element of the memory area.
- * Allows using this class in the for each loop, because it follows the InputIterator template scheme.
- *
- * @return Iterator pointing to one past the last element of the memory area.
- */
- [[gnu::section(".stl_text")]]
- auto end() const -> iterator
- {
- return end_itr;
- }
-
- /**
- * @brief Calculates the size of this container, simply subtracts the iterator pointing to the first element by the
- * last.
- *
- * @return Actual size of this container.
- */
- [[gnu::section(".stl_text")]]
- auto size() const -> size_type
- {
- return std::distance(begin(), end());
- }
-
- /**
- * @brief Calcualtes the size and returns true if the size is 0 and the container therefore emtpy.
- *
- * @return Whether the container is empty, size being 0 or not
- */
- [[gnu::section(".stl_text")]]
- auto empty() const -> bool
- {
- return size() == 0;
- }
-
- private:
- iterator begin_itr = {}; ///< Pointer to the first element of the given template type.
- iterator end_itr = {}; ///< Pointer to one pas the last element of the given template type.
- };
-
-} // namespace teachos::arch::stl
-
-#endif // TEACHOS_ARCH_X86_64_STL_CONTAINER_HPP
diff --git a/arch/x86_64/include/arch/stl/contiguous_pointer_iterator.hpp b/arch/x86_64/include/arch/stl/contiguous_pointer_iterator.hpp
deleted file mode 100644
index f2dfb2b..0000000
--- a/arch/x86_64/include/arch/stl/contiguous_pointer_iterator.hpp
+++ /dev/null
@@ -1,216 +0,0 @@
-#ifndef TEACHOS_ARCH_X86_64_STL_CONTIGUOUS_POINTER_ITERATOR_HPP
-#define TEACHOS_ARCH_X86_64_STL_CONTIGUOUS_POINTER_ITERATOR_HPP
-
-#include <iterator>
-
-namespace teachos::arch::stl
-{
- /**
- * @brief Generic contiguous iterator for given template type. Allows to easily use this iterator instance in
- * algorithm calls.
- *
- * @note Allows any value that is contained in an array in memory, which is a block of contiguous memory. This is the
- * case because we assume we can simply increment or decrement the pointer address to get the next valid instance of
- * the given value type.
- *
- * @tparam T Value the iterator points too.
- */
- template<typename T>
- struct contiguous_pointer_iterator
- {
- using iterator_category = std::contiguous_iterator_tag; ///< Iterator category of this type.
- using difference_type = std::ptrdiff_t; ///< Type when diving one instance of this iterator by another.
- using value_type = T; ///< Underlying value pointed to by this iterator.
- using reference_type = value_type &; ///< Reference to value returned by dereference * operation.
- using pointer_type = value_type *; ///< Pointer to value returned by arrow -> operation.
-
- /**
- * @brief Defaulted constructor.
- */
- contiguous_pointer_iterator() = default;
-
- /**
- * @brief Constructor.
- *
- * @param p Underlying address the iterator should point too.
- */
- explicit contiguous_pointer_iterator(value_type * p)
- : ptr(p)
- {
- // Nothing to do
- }
-
- /**
- * @brief Dereferences the initally given pointer to its value.
- *
- * @return Reference to the value.
- */
- [[gnu::section(".stl_text")]]
- auto operator*() const -> reference_type
- {
- return *ptr;
- }
-
- /**
- * @brief Get underlying value, which is the intially passed pointer.
- *
- * @return Pointer to the underlying value passed intially.
- */
- [[gnu::section(".stl_text")]]
- auto operator->() const -> pointer_type
- {
- return ptr;
- }
-
- /**
- * @brief Pre decrement operator. Returns a reference to the changed address.
- *
- * @return Reference to the decremented underlying address.
- */
- [[gnu::section(".stl_text")]]
- auto operator--() -> contiguous_pointer_iterator &
- {
- contiguous_pointer_iterator const old_value = *this;
- ++ptr;
- return old_value;
- }
-
- /**
- * @brief Pre increment operator. Returns a reference to the changed address.
- *
- * @return Reference to the incremented underlying address.
- */
- [[gnu::section(".stl_text")]]
- auto operator++() -> contiguous_pointer_iterator &
- {
- ++ptr;
- return *this;
- }
-
- /**
- * @brief Post decrement operator. Returns a copy of the address.
- *
- * @return Copy of the decremented underlying address.
- */
- [[gnu::section(".stl_text")]]
- auto operator--(int) -> contiguous_pointer_iterator
- {
- auto const old_value = *this;
- --ptr;
- return old_value;
- }
-
- /**
- * @brief Post increment operator. Returns a copy of the address.
- *
- * @return Copy of the incremented underlying address.
- */
- [[gnu::section(".stl_text")]]
- auto operator++(int) -> contiguous_pointer_iterator
- {
- auto const old_value = *this;
- ++ptr;
- return old_value;
- }
-
- /**
- * @brief Addition assignment operator. Returns a reference to the changed address.
- *
- * @param value Value we want to add to the underlying address.
- * @return Reference to the changed underlying address.
- */
- [[gnu::section(".stl_text")]]
- auto operator+=(difference_type value) -> contiguous_pointer_iterator &
- {
- ptr += value;
- return *this;
- }
-
- /**
- * @brief Subtraction assignment operator. Returns a reference to the changed address.
- *
- * @param value Value we want to subtract from the underlying address.
- * @return Reference to the changed underlying address.
- */
- [[gnu::section(".stl_text")]]
- auto operator-=(difference_type value) -> contiguous_pointer_iterator &
- {
- ptr -= value;
- return *this;
- }
-
- /**
- * @brief Addition operator. Returns the changed address.
- *
- * @param value Value we want to add to a copy of the underlying address.
- * @return Copy of underlying address incremented by the given value.
- */
- [[gnu::section(".stl_text")]]
- auto operator+(difference_type value) const -> contiguous_pointer_iterator
- {
- return contiguous_pointer_iterator{ptr + value};
- }
-
- /**
- * @brief Subtraction operator. Returns the changed address.
- *
- * @param value Value we want to subtrcat from a copy of the underlying address.
- * @return Copy of underlying address decremented by the given value.
- */
- [[gnu::section(".stl_text")]]
- auto operator-(difference_type value) const -> contiguous_pointer_iterator
- {
- return contiguous_pointer_iterator{ptr - value};
- }
-
- /**
- * @brief Subtraction operator. Returns the size difference between two iterators.
- *
- * @param other Other iterator we want to substract the underlying address with ours.
- * @return Size difference between the underlying address of this instance and the given iterator.
- */
- [[gnu::section(".stl_text")]]
- auto operator-(const contiguous_pointer_iterator & other) const -> difference_type
- {
- return ptr - other.ptr;
- }
-
- /**
- * @brief Index operator overload. Returns a reference to the value at the given index. Simply returns the
- * dereferenced underlying pointer incremented by the given index.
- *
- * @param index Index we want to access and get the value from.
- * @return Reference to the value at the given index.
- */
- [[gnu::section(".stl_text")]]
- auto operator[](difference_type index) const -> value_type &
- {
- return *(ptr + index);
- }
-
- /**
- * @brief Defaulted comparsion operator. Simply compares the memory address of both iterators.
- *
- * @param other Other iterator to compare to.
- * @return Whether both iterators point to the same underlying address in memory.
- */
- [[gnu::section(".stl_text")]]
- auto operator==(contiguous_pointer_iterator const & other) const -> bool = default;
-
- /**
- * @brief Defaulted threeway comparsion operator. Simply compares the memory address of both iterators.
- *
- * @param other Other iterator to compare to.
- * @return Whether the given iterator is smaller or larger than this iterator.
- */
- [[gnu::section(".stl_text")]]
- auto operator<=>(contiguous_pointer_iterator const & other) const -> std::strong_ordering = default;
-
- private:
- pointer_type ptr =
- {}; ///< Underlying value the iterator is currently pointing too and should increment or decrement.
- };
-
-} // namespace teachos::arch::stl
-
-#endif // TEACHOS_ARCH_X86_64_STL_CONTIGUOUS_POINTER_ITERATOR_HPP