From 48c812b0338b859aa6c00c8504dd2f16a4bb44f9 Mon Sep 17 00:00:00 2001 From: dean11 Date: Tue, 26 Nov 2013 21:51:40 +0100 Subject: [PATCH] Forgot to follow coding standard... --- Code/Misc/Misc.vcxproj | 1 - Code/Misc/Misc.vcxproj.filters | 3 -- Code/Misc/Resource/Loaders/ByteLoader.cpp | 3 ++ Code/Misc/Resource/Loaders/CustomLoader.cpp | 3 ++ Code/Misc/Resource/OResource.cpp | 4 ++ Code/Misc/Resource/OResourceHandler.cpp | 3 +- Code/Misc/Resource/OysterResource.h | 4 +- Code/Misc/Thread/IThreadObject.h | 32 +++++++++------- Code/Misc/Thread/OysterMutex.cpp | 4 ++ Code/Misc/Thread/OysterMutex.h | 4 ++ Code/Misc/Thread/OysterThread.h | 6 ++- Code/Misc/Thread/OysterThread_Impl.cpp | 33 +++-------------- Code/Misc/Thread/OysterThread_Impl.h | 41 --------------------- 13 files changed, 52 insertions(+), 89 deletions(-) delete mode 100644 Code/Misc/Thread/OysterThread_Impl.h diff --git a/Code/Misc/Misc.vcxproj b/Code/Misc/Misc.vcxproj index ac0da812..ca39cada 100644 --- a/Code/Misc/Misc.vcxproj +++ b/Code/Misc/Misc.vcxproj @@ -161,7 +161,6 @@ - diff --git a/Code/Misc/Misc.vcxproj.filters b/Code/Misc/Misc.vcxproj.filters index 7bb7a072..abee7ddd 100644 --- a/Code/Misc/Misc.vcxproj.filters +++ b/Code/Misc/Misc.vcxproj.filters @@ -65,8 +65,5 @@ Header Files - - Header Files - \ No newline at end of file diff --git a/Code/Misc/Resource/Loaders/ByteLoader.cpp b/Code/Misc/Resource/Loaders/ByteLoader.cpp index 86a571ca..622d3a71 100644 --- a/Code/Misc/Resource/Loaders/ByteLoader.cpp +++ b/Code/Misc/Resource/Loaders/ByteLoader.cpp @@ -1,3 +1,6 @@ +///////////////////////////////////////////////////////////////////// +// Created by [Dennis Andersen] [2013] +///////////////////////////////////////////////////////////////////// #include "..\OResource.h" #include "..\..\Utilities.h" diff --git a/Code/Misc/Resource/Loaders/CustomLoader.cpp b/Code/Misc/Resource/Loaders/CustomLoader.cpp index 05d7113d..312c4c53 100644 --- a/Code/Misc/Resource/Loaders/CustomLoader.cpp +++ b/Code/Misc/Resource/Loaders/CustomLoader.cpp @@ -1,3 +1,6 @@ +///////////////////////////////////////////////////////////////////// +// Created by [Dennis Andersen] [2013] +///////////////////////////////////////////////////////////////////// #include "..\OResource.h" #include "..\..\Utilities.h" diff --git a/Code/Misc/Resource/OResource.cpp b/Code/Misc/Resource/OResource.cpp index af0bc14a..4311669f 100644 --- a/Code/Misc/Resource/OResource.cpp +++ b/Code/Misc/Resource/OResource.cpp @@ -1,3 +1,7 @@ +///////////////////////////////////////////////////////////////////// +// Created by [Dennis Andersen] [2013] +///////////////////////////////////////////////////////////////////// + #include "OResource.h" using namespace Oyster::Resource; diff --git a/Code/Misc/Resource/OResourceHandler.cpp b/Code/Misc/Resource/OResourceHandler.cpp index a6fcffbc..9d911875 100644 --- a/Code/Misc/Resource/OResourceHandler.cpp +++ b/Code/Misc/Resource/OResourceHandler.cpp @@ -60,7 +60,8 @@ OHRESOURCE OysterResource::LoadResource(const wchar_t filename[], CustomLoadFunc if(!resourceData) return 0; - if(resourceData) resourceData->SetResourceID(CustomId); + resourceData->SetResourceID(CustomId); + resourcePrivate.SaveResource(resourceData); return (OHRESOURCE)resourceData->GetResourceHandle(); diff --git a/Code/Misc/Resource/OysterResource.h b/Code/Misc/Resource/OysterResource.h index e152f0d1..16d5122d 100644 --- a/Code/Misc/Resource/OysterResource.h +++ b/Code/Misc/Resource/OysterResource.h @@ -13,7 +13,9 @@ namespace Oyster struct CustomData; /** A Resource handle representing various resources */ typedef unsigned long OHRESOURCE; + /** Typedef on a fuction required for custom unloading */ typedef void(*CustomUnloadFunction)(void* loadedData); + /** Typedef on a fuction required for custom loading */ typedef const CustomData&(*CustomLoadFunction)(const wchar_t filename[]); /** An enum class representing all avalible resources that is supported. */ @@ -26,7 +28,7 @@ namespace Oyster ResourceType_Byte_UNICODE, /**< Handle can be interpeted as char[] or char* */ ResourceType_Byte_UTF16LE, /**< Handle can be interpeted as char[] or char* */ - ResourceType_COUNT, /**< Handle can be interpeted as ? */ + ResourceType_COUNT, /**< Not used. */ ResourceType_UNKNOWN = -1, /**< Handle can be interpeted as void* */ }; diff --git a/Code/Misc/Thread/IThreadObject.h b/Code/Misc/Thread/IThreadObject.h index d89b2de0..b21c942e 100644 --- a/Code/Misc/Thread/IThreadObject.h +++ b/Code/Misc/Thread/IThreadObject.h @@ -1,3 +1,7 @@ +///////////////////////////////////////////////////////////////////// +// Created by [Dennis Andersen] [2013] +///////////////////////////////////////////////////////////////////// + #ifndef MISC_I_THREAD_OBJECT_H #define MISC_I_THREAD_OBJECT_H @@ -12,22 +16,22 @@ namespace Oyster */ class IThreadObject { - public: - /** - * Override this to get notified when the thread is started. - */ - virtual void ThreadEntry() { } - /** - * Override this to get notified when the thread is about to exit. - */ - virtual void ThreadExit() { } - /** - * This function is required to get threading working. - */ - virtual bool DoWork ( ) = 0; + public: + /** + * Override this to get notified when the thread is started. + */ + virtual void ThreadEntry() { } + /** + * Override this to get notified when the thread is about to exit. + */ + virtual void ThreadExit() { } + /** + * This function is required to get threading working. + */ + virtual bool DoWork ( ) = 0; }; } } -#endif // !MISC_I_WORKER_THREAD_H +#endif // !MISC_I_THREAD_OBJECT_H diff --git a/Code/Misc/Thread/OysterMutex.cpp b/Code/Misc/Thread/OysterMutex.cpp index 0892ed64..a8dfd20f 100644 --- a/Code/Misc/Thread/OysterMutex.cpp +++ b/Code/Misc/Thread/OysterMutex.cpp @@ -1,3 +1,7 @@ +///////////////////////////////////////////////////////////////////// +// Created by [Dennis Andersen] [2013] +///////////////////////////////////////////////////////////////////// + #include "OysterMutex.h" #include diff --git a/Code/Misc/Thread/OysterMutex.h b/Code/Misc/Thread/OysterMutex.h index 22ebca1d..b36585c1 100644 --- a/Code/Misc/Thread/OysterMutex.h +++ b/Code/Misc/Thread/OysterMutex.h @@ -1,3 +1,7 @@ +///////////////////////////////////////////////////////////////////// +// Created by [Dennis Andersen] [2013] +///////////////////////////////////////////////////////////////////// + #ifndef MISC_OYSTER_MUTEX_H #define MISC_OYSTER_MUTEX_H diff --git a/Code/Misc/Thread/OysterThread.h b/Code/Misc/Thread/OysterThread.h index 80309ef6..873497ad 100644 --- a/Code/Misc/Thread/OysterThread.h +++ b/Code/Misc/Thread/OysterThread.h @@ -1,3 +1,7 @@ +///////////////////////////////////////////////////////////////////// +// Created by [Dennis Andersen] [2013] +///////////////////////////////////////////////////////////////////// + #ifndef MISC_OYSTER_THREAD_H #define MISC_OYSTER_THREAD_H @@ -42,4 +46,4 @@ namespace Oyster } } -#endif // !MISC_I_OYSTER_THREAD_H +#endif // !MISC_OYSTER_THREAD_H diff --git a/Code/Misc/Thread/OysterThread_Impl.cpp b/Code/Misc/Thread/OysterThread_Impl.cpp index d07b2867..171c8aa9 100644 --- a/Code/Misc/Thread/OysterThread_Impl.cpp +++ b/Code/Misc/Thread/OysterThread_Impl.cpp @@ -1,8 +1,12 @@ +///////////////////////////////////////////////////////////////////// +// Created by [Dennis Andersen] [2013] +///////////////////////////////////////////////////////////////////// + #include "OysterThread.h" -#include #include "OysterMutex.h" -#include #include "..\Utilities.h" +#include +#include using namespace Oyster::Thread; using namespace Utility::DynamicMemory::SmartPointer; @@ -141,31 +145,6 @@ OYSTER_THREAD_ERROR OysterThread::Create(IThreadObject* worker, bool start) ThreadFunction fnc = ThreadingFunction; -/* - //Create a lambda function with current worker instance to fire of the thread -#if defined(DEBUG) || defined (_DEBUG) - ThreadFunction fnc = [](ThreadData* w) -> void - { - while(w->state == OYSTER_THREAD_STATE_STOPED); - - w->owner->ThreadEntry(); - while (true) - { - w->mutexLock.LockMutex(); - w->owner->DoWork(); - w->mutexLock.UnlockMutex(); - } - w->mutexLock.LockMutex(); - w->owner->ThreadExit(); - w->mutexLock.UnlockMutex(); - }; - -#else - ThreadFunction fnc = ThreadingFunction; - //ThreadFunction fnc = THREAD_LAMBDA_FUNCTION_CREATION; -#endif -*/ - //Maby move this thread creation to a seperate Start() function because std::thread fires the thread when it is created. :( this->privateData->threadData->workerThread = new std::thread(fnc, this->privateData->threadData); diff --git a/Code/Misc/Thread/OysterThread_Impl.h b/Code/Misc/Thread/OysterThread_Impl.h deleted file mode 100644 index 01febbdd..00000000 --- a/Code/Misc/Thread/OysterThread_Impl.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef INCLUDE_GUARD_OYSTER_THREAD_H -#define INCLUDE_GUARD_OYSTER_THREAD_H - -#include "IOysterThread.h" -#include - -namespace Oyster -{ - namespace Thread - { - //class OysterThread :public IOysterThread - //{ - //private: - // std::thread thread; //owner->ThreadEntry(); - // - // while (true) - // { - // this->owner->DoWork(); - // } - // - // this->owner->ThreadExit(); - // } - //}; - } -} - - - -#endif // !INCLUDE_GUARD_OYSTER_THREAD_H \ No newline at end of file