diff options
author | Morph <39850852+Morph1984@users.noreply.github.com> | 2022-02-02 22:04:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-02 22:04:26 +0100 |
commit | d68eb751c53df785f842d56983ce4dfbb89aae3f (patch) | |
tree | 510752a162e2bbb0e0f5a1e60b499aa4dca0493e /src/common | |
parent | Merge pull request #7834 from german77/repeat (diff) | |
parent | common_types: Remove NonCopyable struct (diff) | |
download | yuzu-d68eb751c53df785f842d56983ce4dfbb89aae3f.tar yuzu-d68eb751c53df785f842d56983ce4dfbb89aae3f.tar.gz yuzu-d68eb751c53df785f842d56983ce4dfbb89aae3f.tar.bz2 yuzu-d68eb751c53df785f842d56983ce4dfbb89aae3f.tar.lz yuzu-d68eb751c53df785f842d56983ce4dfbb89aae3f.tar.xz yuzu-d68eb751c53df785f842d56983ce4dfbb89aae3f.tar.zst yuzu-d68eb751c53df785f842d56983ce4dfbb89aae3f.zip |
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/common_types.h | 10 | ||||
-rw-r--r-- | src/common/telemetry.h | 26 |
2 files changed, 17 insertions, 19 deletions
diff --git a/src/common/common_types.h b/src/common/common_types.h index 4cec89fbd..99bffc460 100644 --- a/src/common/common_types.h +++ b/src/common/common_types.h @@ -46,13 +46,3 @@ using GPUVAddr = u64; ///< Represents a pointer in the GPU virtual address space using u128 = std::array<std::uint64_t, 2>; static_assert(sizeof(u128) == 16, "u128 must be 128 bits wide"); - -// An inheritable class to disallow the copy constructor and operator= functions -class NonCopyable { -protected: - constexpr NonCopyable() = default; - ~NonCopyable() = default; - - NonCopyable(const NonCopyable&) = delete; - NonCopyable& operator=(const NonCopyable&) = delete; -}; diff --git a/src/common/telemetry.h b/src/common/telemetry.h index 49186e848..d38aeac99 100644 --- a/src/common/telemetry.h +++ b/src/common/telemetry.h @@ -8,6 +8,7 @@ #include <map> #include <memory> #include <string> +#include "common/common_funcs.h" #include "common/common_types.h" namespace Common::Telemetry { @@ -28,7 +29,7 @@ struct VisitorInterface; /** * Interface class for telemetry data fields. */ -class FieldInterface : NonCopyable { +class FieldInterface { public: virtual ~FieldInterface() = default; @@ -52,14 +53,15 @@ public: template <typename T> class Field : public FieldInterface { public: + YUZU_NON_COPYABLE(Field); + Field(FieldType type_, std::string name_, T value_) : name(std::move(name_)), type(type_), value(std::move(value_)) {} - Field(const Field&) = default; - Field& operator=(const Field&) = default; + ~Field() override = default; - Field(Field&&) = default; - Field& operator=(Field&& other) = default; + Field(Field&&) noexcept = default; + Field& operator=(Field&& other) noexcept = default; void Accept(VisitorInterface& visitor) const override; @@ -98,9 +100,15 @@ private: /** * Collection of data fields that have been logged. */ -class FieldCollection final : NonCopyable { +class FieldCollection final { public: + YUZU_NON_COPYABLE(FieldCollection); + FieldCollection() = default; + ~FieldCollection() = default; + + FieldCollection(FieldCollection&&) noexcept = default; + FieldCollection& operator=(FieldCollection&&) noexcept = default; /** * Accept method for the visitor pattern, visits each field in the collection. @@ -133,7 +141,7 @@ private: * Telemetry fields visitor interface class. A backend to log to a web service should implement * this interface. */ -struct VisitorInterface : NonCopyable { +struct VisitorInterface { virtual ~VisitorInterface() = default; virtual void Visit(const Field<bool>& field) = 0; @@ -160,8 +168,8 @@ struct VisitorInterface : NonCopyable { * Empty implementation of VisitorInterface that drops all fields. Used when a functional * backend implementation is not available. */ -struct NullVisitor : public VisitorInterface { - ~NullVisitor() = default; +struct NullVisitor final : public VisitorInterface { + YUZU_NON_COPYABLE(NullVisitor); void Visit(const Field<bool>& /*field*/) override {} void Visit(const Field<double>& /*field*/) override {} |