diff --git a/core/include/cubos/core/memory/buffer_stream.hpp b/core/include/cubos/core/memory/buffer_stream.hpp index b6442fdc67..7f5cb5df71 100644 --- a/core/include/cubos/core/memory/buffer_stream.hpp +++ b/core/include/cubos/core/memory/buffer_stream.hpp @@ -1,32 +1,47 @@ +/// @file +/// @brief Class @ref cubos::core::memory::BufferStream. +/// @ingroup core-memory + #pragma once #include namespace cubos::core::memory { - /// Implements a stream that writes to/reads from a buffer. + /// @brief Stream implementation which writes to/reads from a buffer. + /// @ingroup core-memory class BufferStream : public Stream { public: - /// @param buffer The buffer to read/write from. - /// @param size The size of the buffer. + ~BufferStream() override; + + /// @brief Constructs using an existing buffer. + /// @param buffer Buffer to read/write from. + /// @param size Size of the buffer. + /// @param readOnly Whether the buffer is read-only. BufferStream(void* buffer, std::size_t size, bool readOnly = false); - /// @param buffer The buffer to read/write from. - /// @param size The size of the buffer. + /// @brief Constructs using a read-only buffer. + /// @param buffer Buffer to read/write from. + /// @param size Size of the buffer. BufferStream(const void* buffer, std::size_t size); - /// Initializes a buffer stream with a new buffer, initially of the given size. - /// When initialized this way, the buffer stream will own the buffer and will delete it when it is destroyed. - /// It will expand the buffer when needed. - /// @param size The size of the buffer. + /// @brief Constructs using a new buffer, managed internally and which grows as needed. + /// @param size Initial size of the buffer. BufferStream(std::size_t size = 16); - ~BufferStream() override; - BufferStream(const BufferStream& /*other*/); - BufferStream(BufferStream&& /*other*/) noexcept; + /// @brief Constructs a copy of another buffer stream. If the given buffer stream owns its + /// buffer, the copy will also create its own buffer. Otherwise, it will share the buffer + /// with the original. + /// @param other Buffer stream to copy. + BufferStream(const BufferStream& other); + + /// @brief Move constructs. + /// @param other Buffer stream to move. + BufferStream(BufferStream&& other) noexcept; - /// Gets the buffer of this stream. + /// @brief Gets the buffer of this stream. + /// @return Buffer. const void* getBuffer() const; // Method implementations. diff --git a/core/include/cubos/core/memory/endianness.hpp b/core/include/cubos/core/memory/endianness.hpp index f3cbbb518d..9e068b0862 100644 --- a/core/include/cubos/core/memory/endianness.hpp +++ b/core/include/cubos/core/memory/endianness.hpp @@ -1,43 +1,53 @@ +/// @file +/// @brief Endianness utility functions. +/// @ingroup core-memory + #pragma once namespace cubos::core::memory { - /// Swaps the bytes of a value, changing the endianness. - /// @tparam T The type of the value. - /// @param value The value to swap. - /// @return The swapped value. + /// @brief Swaps the bytes of a value, changing its endianness. + /// @tparam T Value type. + /// @param value Value to swap. + /// @return Swapped value. + /// @ingroup core-memory template T swapBytes(T value); - /// Checks if the current platform is little endian. - /// @return True if the current platform is little endian, false otherwise. + /// @brief Checks if the current platform is little endian. + /// @return Whether its little endian. + /// @ingroup core-memory bool isLittleEndian(); - /// Converts a value from little endianness to local endianness. - /// @tparam T The type of the value. - /// @param value The value to convert. - /// @return The converted value. + /// @brief Converts a value from little endianness to local endianness. + /// @tparam T Value type. + /// @param value Value to convert. + /// @return Converted value. + /// @ingroup core-memory template T fromLittleEndian(T value); - /// Converts a value from local endianness to little endianness. - /// @tparam T The type of the value. - /// @param value The value to convert. - /// @return The converted value. + /// @brief Converts a value from local endianness to little endianness. + /// @tparam T Value type. + /// @param value Value to convert. + /// @return Converted value. + /// @ingroup core-memory template T toLittleEndian(T value); - /// Converts a value from big endianness to local endianness. - /// @tparam T The type of the value. - /// @param value The value to convert. - /// @return The converted value. + /// @brief Converts a value from big endianness to local endianness. + /// @tparam T Value type. + /// @param value Value to convert. + /// @return Converted value. + /// @ingroup core-memory template T fromBigEndian(T value); - /// Converts a value from local endianness to big endianness. - /// @tparam T The type of the value. - /// @param value The value to convert. - /// @return The converted value. + /// @brief Converts a value from local endianness to big endianness. + /// @tparam T Value type. + /// @param value Value to convert. + /// @return Converted value. + /// @ingroup core-memory template T toBigEndian(T value); diff --git a/core/include/cubos/core/memory/guards.hpp b/core/include/cubos/core/memory/guards.hpp index 25941bbc82..19e841bfdd 100644 --- a/core/include/cubos/core/memory/guards.hpp +++ b/core/include/cubos/core/memory/guards.hpp @@ -1,49 +1,62 @@ +/// @file +/// @brief Classes @ref cubos::core::memory::ReadGuard and @ref cubos::core::memory::WriteGuard. +/// @ingroup core-memory + #pragma once namespace cubos::core::memory { - /// Utility class to provide safe read-only access to an object using a lock. + /// @brief Provides safe read-only access to an object using a lock. /// - /// @details This class was created because there are multiple parts of the code that need to provide + /// This class was created because there are multiple parts of the code that need to provide /// access to objects in a thread-safe manner. /// - /// Usage example: + /// ## Usage example + /// + /// @code{.cpp} /// using AssetMetaRead = core::memory::ReadGuard>; + /// @endcode /// - /// @tparam T The type of the object to guard. - /// @tparam Lock The type of the lock to use. + /// @tparam T Guarded object type. + /// @tparam Lock Held lock type. + /// @ingroup core-memory template class ReadGuard { public: - /// @param object The object to guard. - /// @param lock The lock to use. + /// @brief Constructor. + /// @param object Object to guard. + /// @param lock Lock to hold. inline ReadGuard(const T& object, Lock&& lock) : mObject(object) , mLock(std::move(lock)) { } - /// @param other The other guard to move from. + /// @brief Move constructor. + /// @param other Guard to move from. inline ReadGuard(ReadGuard&& other) noexcept : mObject(other.object) , mLock(std::move(other.lock)) { } - /// @returns The underlying object. + /// @brief Gets a reference to the underlying object. + /// @return Underlying object. inline const T& get() const { return mObject; } - /// @returns The underlying object. + /// @brief Gets a reference to the underlying object. + /// @return Underlying object. inline const T& operator*() const { return mObject; } - /// @returns The underlying object. + /// @brief Gets a pointer to the underlying object. + /// @return Underlying object. inline const T* operator->() const { return &mObject; @@ -54,66 +67,78 @@ namespace cubos::core::memory Lock mLock; ///< Lock used to guard the object. }; - /// Utility class to provide safe read-write access to an object using a lock. + /// @brief Provides safe read-write access to an object using a lock. /// - /// @details This class was created because there are multiple parts of the code that need to provide + /// This class was created because there are multiple parts of the code that need to provide /// access to objects in a thread-safe manner. /// - /// Usage example: + /// ## Usage example + /// + /// @code{.cpp} /// using AssetMetaWrite = core::memory::WriteGuard>; + /// @endcode /// - /// @tparam T The type of the object to guard. - /// @tparam Lock The type of the lock to use. + /// @tparam T Guarded object type. + /// @tparam Lock Held lock type. + /// @ingroup core-memory template class WriteGuard { public: - /// @param object The object to guard. - /// @param lock The lock to use. + /// @brief Constructor. + /// @param object Object to guard. + /// @param lock Lock to hold. inline WriteGuard(T& object, Lock&& lock) : mObject(object) , mLock(std::move(lock)) { } - /// @param other The other guard to move from. + /// @brief Move constructs. + /// @param other Guard to move from. inline WriteGuard(WriteGuard&& other) noexcept : mObject(other.object) , mLock(std::move(other.lock)) { } - /// @returns The underlying object. + /// @brief Gets a reference to the underlying object. + /// @return Underlying object. inline T& get() { return mObject; } - /// @returns The underlying object. + /// @brief Gets a reference to the underlying object. + /// @return Underlying object. inline T& operator*() { return mObject; } - /// @returns The underlying object. + /// @brief Gets a pointer to the underlying object. + /// @return Underlying object. inline T* operator->() { return &mObject; } - /// @returns The underlying object. + /// @brief Gets a reference to the underlying object. + /// @return Underlying object. inline const T& get() const { return mObject; } - /// @returns The underlying object. + /// @brief Gets a reference to the underlying object. + /// @return Underlying object. inline const T& operator*() const { return mObject; } - /// @returns The underlying object. + /// @brief Gets a pointer to the underlying object. + /// @return Underlying object. inline const T* operator->() const { return &mObject; diff --git a/core/include/cubos/core/memory/module.dox b/core/include/cubos/core/memory/module.dox new file mode 100644 index 0000000000..c8baea9079 --- /dev/null +++ b/core/include/cubos/core/memory/module.dox @@ -0,0 +1,15 @@ +/// @dir +/// @brief @ref core-memory module. + +#pragma once + +/// @namespace cubos::core::memory +/// @brief @ref core-memory module. +/// @ingroup core-memory + +namespace cubos::core::memory +{ + /// @defgroup core-memory Memory + /// @ingroup core + /// @brief Provides memory utilities. +} // namespace cubos::core::memory diff --git a/core/include/cubos/core/memory/standard_stream.hpp b/core/include/cubos/core/memory/standard_stream.hpp index 658f9150d9..14ea511184 100644 --- a/core/include/cubos/core/memory/standard_stream.hpp +++ b/core/include/cubos/core/memory/standard_stream.hpp @@ -1,3 +1,7 @@ +/// @file +/// @brief Class @ref cubos::core::memory::StandardStream. +/// @ingroup core-memory + #pragma once #include @@ -6,15 +10,21 @@ namespace cubos::core::memory { - /// Stream implementation for stdio. + /// @brief Stream implementation which wraps a `libc` file pointer. + /// @ingroup core-memory class StandardStream : public Stream { public: - /// @param file Stdio file to read/write from. + ~StandardStream() override; + + /// @brief Constructs. + /// @param file File to read/write from. /// @param close Should the file be closed when this stream is destructed? StandardStream(FILE* file, bool close = false); - StandardStream(StandardStream&& /*other*/) noexcept; - ~StandardStream() override; + + /// @brief Move constructs. + /// @param other Moved stream. + StandardStream(StandardStream&& other) noexcept; std::size_t read(void* data, std::size_t size) override; std::size_t write(const void* data, std::size_t size) override; @@ -24,7 +34,7 @@ namespace cubos::core::memory char peek() const override; private: - FILE* mFile; ///< Stdio file to read/write from. + FILE* mFile; ///< File to read/write from. bool mClose; ///< Should the file be closed when this stream is destructed? }; } // namespace cubos::core::memory diff --git a/core/include/cubos/core/memory/stream.hpp b/core/include/cubos/core/memory/stream.hpp index 9adc6dd776..e41942393c 100644 --- a/core/include/cubos/core/memory/stream.hpp +++ b/core/include/cubos/core/memory/stream.hpp @@ -1,3 +1,7 @@ +/// @file +/// @brief Class @ref cubos::core::memory::Stream. +/// @ingroup core-memory + #pragma once #include @@ -6,7 +10,8 @@ namespace cubos::core::memory { - /// Seek origin. + /// @brief Stream seek origin. + /// @ingroup core-memory enum class SeekOrigin { Begin, @@ -14,184 +19,195 @@ namespace cubos::core::memory End }; - /// Abstract class for memory streams. + /// @brief Interface class for memory streams. Abstracts away sources or destinations of data. + /// @ingroup core-memory class Stream { public: + virtual ~Stream() = default; + + /// @brief Constructs. Stream() = default; + + /// @brief Move constructs. Stream(Stream&&) = default; + + /// @brief Forbid copy construction. Stream(const Stream&) = delete; - virtual ~Stream() = default; - static Stream& stdIn; ///< Stream wrapper for stdin. - static Stream& stdOut; ///< Stream wrapper for stdout. - static Stream& stdErr; ///< Stream wrapper for stderr. + static Stream& stdIn; ///< Stream wrapper for `stdin`. + static Stream& stdOut; ///< Stream wrapper for `stdout`. + static Stream& stdErr; ///< Stream wrapper for `stderr`. - /// Reads data from the stream. - /// @param data The buffer to read data into. - /// @param size The size of the buffer. - /// @return The number of bytes read. + /// @brief Reads data from the stream. + /// @param data Buffer to read data into. + /// @param size Size of the buffer. + /// @return Number of bytes read. virtual std::size_t read(void* data, std::size_t size) = 0; - /// Writes data to the stream. - /// @param data The buffer to write data from. - /// @param size The size of the buffer. - /// @return The number of bytes written. + /// @brief Writes data to the stream. + /// @param data Buffer to write data from. + /// @param size Size of the buffer. + /// @return Number of bytes written. virtual std::size_t write(const void* data, std::size_t size) = 0; - /// Gets the current position in the stream. - /// @return The current position in the stream, or SIZE_MAX if the position is unknown. + /// @brief Gets the current position in the stream. + /// @return Current position in the stream, or SIZE_MAX if the position is unknown. virtual std::size_t tell() const = 0; - /// Seeks to a position in the stream. - /// @param offset The offset to seek to. - /// @param origin The origin of the offset. + /// @brief Seeks to a position in the stream. + /// @param offset Offset to seek to. + /// @param origin Origin of the offset. virtual void seek(ptrdiff_t offset, SeekOrigin origin) = 0; - /// Checks if the stream still has content to read. - /// @return True if the stream has no more content to read, false otherwise. + /// @brief Checks if the stream still has content to read. + /// @return Whether the stream has reached the end. virtual bool eof() const = 0; - /// Peeks one byte from the stream. - /// @return The byte peeked. + /// @brief Peeks one byte from the stream. + /// @return Peeked byte. virtual char peek() const = 0; - /// Gets one byte from the stream. - /// @return The byte read. + /// @brief Gets one byte from the stream. + /// @return Read byte. char get(); - /// Puts one byte into the stream. - /// @param c The byte to put. + /// @brief Puts one byte into the stream. + /// @param c Byte to put. void put(char c); - /// Prints a signed integer to the stream. - /// @tparam T The type of the integer. - /// @param value The value to print. - /// @param base The base to use. + /// @brief Prints a signed integer to the stream. + /// @tparam T Type of the integer. + /// @param value Value to print. + /// @param base Base to use. template requires(::std::is_integral_v&& ::std::is_signed_v) void print(T value, std::size_t base = 10); - /// Prints a signed integer to the stream. - /// @tparam T The type of the integer. - /// @param value The value to print. - /// @param base The base to use. + /// @brief Prints a signed integer to the stream. + /// @tparam T Integer type. + /// @param value Value to print. + /// @param base Base to use. template requires(::std::is_integral_v && !::std::is_signed_v) inline void print(T value, std::size_t base = 10); - /// Prints a 64 bit signed integer to the stream. - /// @param value The value to print. - /// @param base The base to use. + /// @brief Prints a 64 bit signed integer to the stream. + /// @param value Value to print. + /// @param base Base to use. void print(int64_t value, std::size_t base = 10); - /// Prints a 64 bit unsigned integer to the stream. - /// @param value The value to print. - /// @param base The base to use. + /// @brief Prints a 64 bit unsigned integer to the stream. + /// @param value Value to print. + /// @param base Base to use. void print(uint64_t value, std::size_t base = 10); - /// Prints a float to the stream. - /// @param value The value to print. - /// @param decimalPlaces The number of decimal places to print. + /// @brief Prints a float to the stream. + /// @param value Value to print. + /// @param decimalPlaces Number of decimal places to print. void print(float value, std::size_t decimalPlaces = 4); - /// Prints a double to the stream. - /// @param value The value to print. - /// @param decimalPlaces The number of decimal places to print. + /// @brief Prints a double to the stream. + /// @param value Value to print. + /// @param decimalPlaces Number of decimal places to print. void print(double value, std::size_t decimalPlaces = 4); - /// Prints a string to the stream. - /// @param str The value to print. + /// @brief Prints a string to the stream. + /// @param str String to print. void print(const char* str); - /// Prints a string to the stream. - /// @param str The string to print. - /// @param size The size of the string. + /// @brief Prints a string to the stream. + /// @param str String to print. + /// @param size Size of the string. void print(const char* str, std::size_t size); - /// Prints a string to the stream. - /// @param str The value to print. + /// @brief Prints a string to the stream. + /// @param str Value to print. void print(const ::std::string& str); - /// Prints a formatted string the stream. - /// Example usage: + /// @brief Prints a formatted string the stream. + /// + /// ## Usage /// + /// @code{.cpp} /// stream.printf("Hello, {}!\n", "world"); /// stream.printf("{} + {} = {}\n", 1, 2, 3); /// stream.printf("\\{} {}\n", 1, 2); // This will print "{} 2" + /// @endcode /// /// @tparam T Type of the first argument. - /// @tparam TArgs The types of the remaining arguments. + /// @tparam TArgs Types of the remaining arguments. + /// @param fmt Format string. /// @param arg First argument to print. - /// @param args The arguments to print. + /// @param args Remaining arguments to print. template void printf(const char* fmt, T arg, TArgs... args); - /// Formatted print recursion tail function. - /// @param fmt The remainder format string. + /// @brief Prints a string to the stream. + /// @note This overload is used to terminate the recursion in @ref printf(). + /// @param fmt Format string. void printf(const char* fmt); - /// Parses a 8 bit signed integer from the stream. - /// @param value Parsed value. - /// @param base The base to use. + /// @brief Parses a 8 bit signed integer from the stream. + /// @param[out] value Parsed value. + /// @param base Base to use. void parse(int8_t& value, std::size_t base = 10); - /// Parses a 16 bit signed integer from the stream. - /// @param value Parsed value. - /// @param base The base to use. + /// @brief Parses a 16 bit signed integer from the stream. + /// @param[out] value Parsed value. + /// @param base Base to use. void parse(int16_t& value, std::size_t base = 10); - /// Parses a 32 bit signed integer from the stream. - /// @param value Parsed value. - /// @param base The base to use. + /// @brief Parses a 32 bit signed integer from the stream. + /// @param[out] value Parsed value. + /// @param base Base to use. void parse(int32_t& value, std::size_t base = 10); - /// Parses a 64 bit signed integer from the stream. - /// @param value Parsed value. - /// @param base The base to use. + /// @brief Parses a 64 bit signed integer from the stream. + /// @param[out] value Parsed value. + /// @param base Base to use. void parse(int64_t& value, std::size_t base = 10); - /// Parses a 8 bit unsigned integer from the stream. - /// @param value Parsed value. - /// @param base The base to use. + /// @brief Parses a 8 bit unsigned integer from the stream. + /// @param[out] value Parsed value. + /// @param base Base to use. void parse(uint8_t& value, std::size_t base = 10); - /// Parses a 16 bit unsigned integer from the stream. - /// @param value Parsed value. - /// @param base The base to use. + /// @brief Parses a 16 bit unsigned integer from the stream. + /// @param[out] value Parsed value. + /// @param base Base to use. void parse(uint16_t& value, std::size_t base = 10); - /// Parses a 32 bit unsigned integer from the stream. - /// @param value Parsed value. - /// @param base The base to use. + /// @brief Parses a 32 bit unsigned integer from the stream. + /// @param[out] value Parsed value. + /// @param base Base to use. void parse(uint32_t& value, std::size_t base = 10); - /// Parses a 64 bit unsigned integer from the stream. - /// @param value Parsed value. - /// @param base The base to use. + /// @brief Parses a 64 bit unsigned integer from the stream. + /// @param[out] value Parsed value. + /// @param base Base to use. void parse(uint64_t& value, std::size_t base = 10); - /// Parses a float from the stream. - /// @param value Parsed value. + /// @brief Parses a float from the stream. + /// @param[out] value Parsed value. void parse(float& value); - /// Parses a double from the stream. - /// @param value Parsed value. + /// @brief Parses a double from the stream. + /// @param[out] value Parsed value. void parse(double& value); - /// Reads a string from the stream until the terminator (or '\0') is found. - /// If terminator is nullptr reads a string until '\0' is found. - /// @param str The string to read. - /// @param terminator The terminator to use. + /// @brief Reads a string from the stream until the @p terminator (or `\0`) is found. + /// @param[out] str Read string. + /// @param terminator Optional terminator to use. void readUntil(std::string& str, const char* terminator); - /// Reads from the stream until the terminator (or '\0') is found. - /// @param buffer The buffer to read into. - /// @param size The size of the buffer. - /// @param terminator The terminator to use. - /// @return The number of bytes read. + /// @brief Reads a string from the stream until the @p terminator (or `\0`) is found. + /// @param buffer Buffer to read into. + /// @param size Size of the buffer. + /// @param terminator Optional terminator to use. + /// @return Number of bytes read. std::size_t readUntil(char* buffer, std::size_t size, const char* terminator); - /// Ignores a number of bytes from the stream. - /// @param size The number of bytes to ignore. + /// @brief Ignores a number of bytes from the stream. + /// @param size Number of bytes to ignore. void ignore(std::size_t size); }; diff --git a/core/include/cubos/core/memory/type_map.hpp b/core/include/cubos/core/memory/type_map.hpp index e33eec9094..cdb7f2b742 100644 --- a/core/include/cubos/core/memory/type_map.hpp +++ b/core/include/cubos/core/memory/type_map.hpp @@ -1,3 +1,7 @@ +/// @file +/// @brief Class @ref cubos::core::memory::TypeMap. +/// @ingroup core-memory + #pragma once #include @@ -6,25 +10,32 @@ namespace cubos::core::memory { - /// A map that stores values of a specific type, using types as keys. - /// @tparam V The type of the values to store. + /// @brief A map that stores values of type @p V, using types as keys. + /// @tparam V Values type. + /// @ingroup core-memory template class TypeMap { public: + ~TypeMap() = default; + + /// @brief Constructs an empty map. TypeMap() = default; + + /// @brief Move constructs. TypeMap(TypeMap&&) noexcept = default; - ~TypeMap() = default; - /// @param key The key to identify the value. - /// @param value The value to store. + /// @brief Sets the value associated to the given type. + /// @param key Index of the type to use as a key. + /// @param value Value to store. inline void set(std::type_index key, V value) { mMap.emplace(key, std::move(value)); } - /// @param key The key to identify the value. - /// @returns The value stored in the map, or null if no value is stored. + /// @brief Gets the value associated to the given type. + /// @param key Index of the type to use as a key. + /// @return Pointer to the value or null if it isn't stored. inline V* at(std::type_index key) { auto it = mMap.find(key); @@ -35,8 +46,9 @@ namespace cubos::core::memory return &it->second; } - /// @param key The key to identify the value. - /// @returns The value stored in the map, or null if no value is stored. + /// @brief Gets the value associated to the given type. + /// @param key Index of the type to use as a key. + /// @return Pointer to the value or null if it isn't stored. inline const V* at(std::type_index key) const { auto it = mMap.find(key); @@ -47,70 +59,76 @@ namespace cubos::core::memory return &it->second; } - /// @tparam K The type of the key. - /// @param value The value to store. + /// @brief Sets the value associated to the given type. + /// @tparam K Type to use as a key. + /// @param value Value to store. template inline void set(V value) { this->set(std::type_index(typeid(K)), std::move(value)); } - /// @tparam K The type of the key. - /// @returns The value stored in the map, or null if no value is stored. + /// @brief Gets the value associated to the given type. + /// @tparam K Type to use as a key. + /// @return Pointer to the value or null if it isn't stored. template inline V* at() { return this->at(std::type_index(typeid(K))); } - /// @tparam K The type of the key. - /// @returns The value stored in the map, or null if no value is stored. + /// @brief Gets the value associated to the given type. + /// @tparam K Type to use as a key. + /// @return Pointer to the value or null if it isn't stored. template inline const V* at() const { return this->at(std::type_index(typeid(K))); } - /// Removes all elements from the map. + /// @brief Removes all values from the map. inline void clear() { mMap.clear(); } - /// Removes the element with the given key from the map. - /// @param key The key to identify the value. + /// @brief Removes the value with the given key from the map. + /// @param key Index of the type to use as a key. inline void erase(std::type_index key) { mMap.erase(key); } - /// Removes the element with the given key from the map. - /// @tparam K The key to identify the value. + /// @brief Removes the value with the given key from the map. + /// @tparam K Type to use as a key. template inline void erase() { this->erase(std::type_index(typeid(K))); } - /// @returns The number of elements in the map. + /// @brief Gets the number of values in the map. + /// @return Number of values in the map. inline std::size_t size() const { return mMap.size(); } - /// @returns Iterator to the beginning of the map. + /// @brief Gets an iterator to the beginning of the map. + /// @return Iterator to the beginning of the map. inline auto begin() const { return mMap.begin(); } - /// @returns Iterator to the end of the map. + /// @brief Gets an iterator to the end of the map. + /// @return Iterator to the end of the map. inline auto end() const { return mMap.end(); } private: - std::unordered_map mMap; ///< The map of values. + std::unordered_map mMap; ///< Map of values indexed by type index. }; } // namespace cubos::core::memory