From 72bad342ad75294ae85aac8b2e2e7bea54193c15 Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 31 Mar 2019 19:59:58 +0800 Subject: *misc --- source/modules/asura-utils/io/reloadable.h | 33 ------------------------ source/modules/asura-utils/io/renewable.h | 38 ++++++++++++++++++++++++++++ source/modules/asura-utils/threading/mutex.h | 5 +++- 3 files changed, 42 insertions(+), 34 deletions(-) delete mode 100644 source/modules/asura-utils/io/reloadable.h create mode 100644 source/modules/asura-utils/io/renewable.h (limited to 'source/modules/asura-utils') diff --git a/source/modules/asura-utils/io/reloadable.h b/source/modules/asura-utils/io/reloadable.h deleted file mode 100644 index c3b89ac..0000000 --- a/source/modules/asura-utils/io/reloadable.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __ASURA_ENGINE_RENEWABLE_H__ -#define __ASURA_ENGINE_RENEWABLE_H__ - -#include "../scripting/portable.hpp" - -namespace AsuraEngine -{ - namespace IO - { - - /// - /// 可以重新构建的数据结构。比如图片、音频这种,从解析后数据可以直接构建,可以在编辑器内重 - /// 新构建,不会修改handle值,改变不具备破坏性,适用于不改变handle的资源。 - /// - ASURA_ABSTRACT class Renewable - { - public: - Renewable(); - virtual ~ Renewable(); - - /// - /// 继承Renewable的需要提供一个Refresh方法 - /// - virtual bool Refresh(AEIO::DecodedData* decode_data) = 0; - - }; - - } -} - -namespace AEIO = AsuraEngine::IO; - -#endif \ No newline at end of file diff --git a/source/modules/asura-utils/io/renewable.h b/source/modules/asura-utils/io/renewable.h new file mode 100644 index 0000000..769bdf6 --- /dev/null +++ b/source/modules/asura-utils/io/renewable.h @@ -0,0 +1,38 @@ +#ifndef __ASURA_ENGINE_RENEWABLE_H__ +#define __ASURA_ENGINE_RENEWABLE_H__ + +#include "../scripting/portable.hpp" + +#include "decoded_data.h" + +namespace AsuraEngine +{ + namespace IO + { + + /// + /// 可以重新构建的数据结构。比如图片、音频这种,从解析后数据可以直接构建,可以在编辑器内重 + /// 新构建,不会修改handle值,改变不具备破坏性,适用于不改变handle的资源。 + /// + ASURA_ABSTRACT class Renewable + { + public: + Renewable(); + virtual ~ Renewable(); + + /// + /// 继承Renewable的需要提供一个Refresh方法 + /// + /// 依据Effective C++条款09.应该禁止在构造函数中调用virtual方法,所以这里的Refresh + /// 被从构造函数中抽离,需要手动调用Refresh。 + /// + virtual bool Refresh(AEIO::DecodedData* decode_data) = 0; + + }; + + } +} + +namespace AEIO = AsuraEngine::IO; + +#endif \ No newline at end of file diff --git a/source/modules/asura-utils/threading/mutex.h b/source/modules/asura-utils/threading/mutex.h index 7afbe35..5d33be1 100644 --- a/source/modules/asura-utils/threading/mutex.h +++ b/source/modules/asura-utils/threading/mutex.h @@ -30,6 +30,10 @@ namespace AsuraEngine private: + // 禁止复制 + Mutex(const Mutex&); + Mutex& operator=(const Mutex&); + MutexImpl* mImpl; }; @@ -52,7 +56,6 @@ namespace AsuraEngine Mutex& m; }; -// 将所在的栈从此位置开始到退栈处作为临界区锁定。 #define lock(m) \ if(_mutex_locker _asura_mutex_locker = m){} else -- cgit v1.1-26-g67d0