Forgot to follow coding standard...

This commit is contained in:
dean11 2013-11-26 21:51:40 +01:00
parent e4904870b3
commit 48c812b033
13 changed files with 52 additions and 89 deletions

View File

@ -161,7 +161,6 @@
<ClInclude Include="Thread\IThreadObject.h" />
<ClInclude Include="Thread\OysterMutex.h" />
<ClInclude Include="Thread\OysterThread.h" />
<ClInclude Include="Thread\OysterThread_Impl.h" />
<ClInclude Include="Utilities-InlineImpl.h" />
<ClInclude Include="Utilities.h" />
<ClInclude Include="WinTimer.h" />

View File

@ -65,8 +65,5 @@
<ClInclude Include="Thread\OysterThread.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Thread\OysterThread_Impl.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -1,3 +1,6 @@
/////////////////////////////////////////////////////////////////////
// Created by [Dennis Andersen] [2013]
/////////////////////////////////////////////////////////////////////
#include "..\OResource.h"
#include "..\..\Utilities.h"

View File

@ -1,3 +1,6 @@
/////////////////////////////////////////////////////////////////////
// Created by [Dennis Andersen] [2013]
/////////////////////////////////////////////////////////////////////
#include "..\OResource.h"
#include "..\..\Utilities.h"

View File

@ -1,3 +1,7 @@
/////////////////////////////////////////////////////////////////////
// Created by [Dennis Andersen] [2013]
/////////////////////////////////////////////////////////////////////
#include "OResource.h"
using namespace Oyster::Resource;

View File

@ -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();

View File

@ -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* */
};

View File

@ -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

View File

@ -1,3 +1,7 @@
/////////////////////////////////////////////////////////////////////
// Created by [Dennis Andersen] [2013]
/////////////////////////////////////////////////////////////////////
#include "OysterMutex.h"
#include <chrono>

View File

@ -1,3 +1,7 @@
/////////////////////////////////////////////////////////////////////
// Created by [Dennis Andersen] [2013]
/////////////////////////////////////////////////////////////////////
#ifndef MISC_OYSTER_MUTEX_H
#define MISC_OYSTER_MUTEX_H

View File

@ -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

View File

@ -1,8 +1,12 @@
/////////////////////////////////////////////////////////////////////
// Created by [Dennis Andersen] [2013]
/////////////////////////////////////////////////////////////////////
#include "OysterThread.h"
#include <thread>
#include "OysterMutex.h"
#include <assert.h>
#include "..\Utilities.h"
#include <thread>
#include <assert.h>
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);

View File

@ -1,41 +0,0 @@
#ifndef INCLUDE_GUARD_OYSTER_THREAD_H
#define INCLUDE_GUARD_OYSTER_THREAD_H
#include "IOysterThread.h"
#include <thread>
namespace Oyster
{
namespace Thread
{
//class OysterThread :public IOysterThread
//{
//private:
// std::thread thread; //<! The worker thread.
// IWorkerThread *owner; //<! The owner of the thread as IThread
//
//public:
// bool Wait();
// bool Suspend();
// void Resume();
// bool Kill();
// bool IsActive();
// bool Reset();
// bool StartThread()
// {
// this->owner->ThreadEntry();
//
// while (true)
// {
// this->owner->DoWork();
// }
//
// this->owner->ThreadExit();
// }
//};
}
}
#endif // !INCLUDE_GUARD_OYSTER_THREAD_H