Skip to content

Commit

Permalink
fix: clarify copy constructor and assignment deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
RiscadoA committed Mar 1, 2024
1 parent 87becc9 commit 5ada782
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 20 deletions.
4 changes: 2 additions & 2 deletions core/include/cubos/core/data/des/deserializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ namespace cubos::core::data
/// @brief Constructs.
Deserializer() = default;

/// @name Deleted copy and move constructors.
/// @name Forbid any kind of copying.
/// @brief Deleted as the hooks may contain references to the deserializer.
/// @{
Deserializer(Deserializer&&) = delete;
Deserializer(const Deserializer&) = delete;
Deserializer& operator=(const Deserializer&) = delete;
/// @}

/// @brief Function type for deserialization hooks.
Expand Down
7 changes: 4 additions & 3 deletions core/include/cubos/core/data/ser/serializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ namespace cubos::core::data
/// @brief Default constructs.
Serializer() = default;

/// @brief Forbids copying.
/// @name Forbid any kind of copying.
/// @brief Deleted as the hooks may contain references to the serializer.
/// @{
Serializer(const Serializer&) = delete;

/// @brief Forbids copy assignment.
Serializer& operator=(const Serializer&) = delete;
/// @}

/// @brief Function type for serialization hooks.
using Hook = memory::Function<bool(const void*)>;
Expand Down
7 changes: 5 additions & 2 deletions core/include/cubos/core/ecs/table/dense/table.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ namespace cubos::core::ecs
/// @brief Constructs a table without columns.
DenseTable() = default;

/// @brief Forbid move construction.
DenseTable(DenseTable&&) noexcept = delete;
/// @name Forbid any kind of copying.
/// @{
DenseTable(const DenseTable&) = delete;
DenseTable& operator=(const DenseTable&) = delete;
/// @}

/// @brief Adds a new column to the table.
///
Expand Down
5 changes: 4 additions & 1 deletion core/include/cubos/core/gl/render_device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,11 @@ namespace cubos::core::gl
virtual ~RenderDevice() = default;
RenderDevice() = default;

/// @brief Forbid copy construction.
/// @name Forbid any kind of copying.
/// @{
RenderDevice(const RenderDevice&) = delete;
RenderDevice& operator=(const RenderDevice&) = delete;
/// @}

/// @brief Creates a new framebuffer.
/// @param desc Framebuffer description.
Expand Down
5 changes: 4 additions & 1 deletion core/include/cubos/core/memory/stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ namespace cubos::core::memory
/// @brief Move constructs.
Stream(Stream&&) = default;

/// @brief Forbid copy construction.
/// @name Forbid any kind of copying.
/// @{
Stream(const Stream&) = delete;
Stream& operator=(const Stream&) = delete;
/// @}

static Stream& stdIn; ///< Stream wrapper for `stdin`.
static Stream& stdOut; ///< Stream wrapper for `stdout`.
Expand Down
5 changes: 4 additions & 1 deletion core/include/cubos/core/reflection/type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ namespace cubos::core::reflection
class CUBOS_CORE_API Type final
{
public:
/// @name Forbid any kind of copying.
/// @{
Type(const Type&) = delete;
Type(Type&&) = delete;
Type& operator=(const Type&) = delete;
/// @}

/// @brief Constructs with a type the given name.
/// @param name Name of the type.
Expand Down
8 changes: 4 additions & 4 deletions core/include/cubos/core/thread_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ namespace cubos::core
/// @param numThreads Number of threads to create.
ThreadPool(std::size_t numThreads);

/// @brief Forbid copy construction.
/// @name Forbid any kind of copying.
/// @{
ThreadPool(const ThreadPool&) = delete;

/// @brief Forbid move construction.
ThreadPool(ThreadPool&&) = delete;
ThreadPool& operator=(const ThreadPool&) = delete;
/// @}

/// @brief Adds a task to the thread pool. Starts when a thread becomes available.
/// @param task Task to add.
Expand Down
8 changes: 4 additions & 4 deletions engine/include/cubos/engine/assets/assets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ namespace cubos::engine
/// @brief Constructs an empty manager without any bridges or metadata.
Assets();

/// @brief Forbid copying.
/// @name Forbid any kind of copying.
/// @{
Assets(const Assets&) = delete;

/// @brief Forbid moving.
Assets(Assets&&) = delete;
Assets& operator=(const Assets&) = delete;
/// @}

/// @brief Registers a new bridge for the given extension.
///
Expand Down
5 changes: 4 additions & 1 deletion engine/include/cubos/engine/renderer/pps/pass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ namespace cubos::engine
/// @param renderDevice Render device to use.
PostProcessingPass(core::gl::RenderDevice& renderDevice);

/// @brief Deleted copy constructor.
/// @name Forbid any kind of copying.
/// @{
PostProcessingPass(const PostProcessingPass&) = delete;
PostProcessingPass& operator=(const PostProcessingPass&) = delete;
/// @}

/// @brief Called when the window framebuffer size changes.
/// @param size New size of the window.
Expand Down
5 changes: 4 additions & 1 deletion engine/include/cubos/engine/renderer/renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ namespace cubos::engine
/// @param size Size of the window.
BaseRenderer(core::gl::RenderDevice& renderDevice, glm::uvec2 size);

/// @brief Deleted copy constructor.
/// @name Forbid any kind of copying.
/// @{
BaseRenderer(const BaseRenderer&) = delete;
BaseRenderer& operator=(const BaseRenderer&) = delete;
/// @}

/// @brief Uploads a grid to the GPU and returns an handle which can be used to draw it.
/// @param grid Grid to upload.
Expand Down

0 comments on commit 5ada782

Please sign in to comment.