Stdafx: Major header cleanup

This commit is contained in:
Sacha
2014-07-11 21:59:13 +10:00
parent 14050c7302
commit 6e06fdf638
41 changed files with 68 additions and 217 deletions
-88
View File
@@ -1,88 +0,0 @@
#pragma once
template<typename T, size_t size> class SizedStack
{
T m_ptr[size];
uint m_count;
public:
SizedStack()
{
Clear();
}
~SizedStack()
{
Clear();
}
void Clear()
{
m_count = 0;
}
bool Pop(T& dst)
{
if(!m_count)
return false;
dst = m_ptr[--m_count];
return true;
}
bool Push(const T& src)
{
if(m_count + 1 > size)
return false;
m_ptr[m_count++] = src;
return true;
}
size_t GetFreeCount() const
{
return size - m_count;
}
size_t GetCount() const
{
return m_count;
}
size_t GetMaxCount() const
{
return size;
}
};
template<typename T> struct ScopedPtr
{
private:
T* m_ptr;
public:
ScopedPtr() : m_ptr(nullptr)
{
}
ScopedPtr(T* ptr) : m_ptr(ptr)
{
}
~ScopedPtr()
{
Swap(nullptr);
}
operator T*() { return m_ptr; }
operator const T*() const { return m_ptr; }
T* operator ->() { return m_ptr; }
const T* operator ->() const { return m_ptr; }
void Swap(T* ptr)
{
delete m_ptr;
m_ptr = ptr;
}
};
+2 -1
View File
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "Utilities/SSemaphore.h"
#include "Emu/System.h"
void SSemaphore::wait()
{
@@ -84,4 +85,4 @@ bool SSemaphore::post_and_wait()
wait();
return true;
}
}
+1
View File
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "Utilities/Log.h"
#include "Emu/Memory/Memory.h"
#include "Thread.h"
+7 -1
View File
@@ -1,5 +1,4 @@
#pragma once
#include "Array.h"
#include <functional>
#include <thread>
#include <vector>
@@ -8,6 +7,13 @@
#include <condition_variable>
#include <Utilities/SSemaphore.h>
static std::thread::id main_thread;
struct rThread
{
static bool IsMain() { std::this_thread::get_id() == main_thread; }
};
class ThreadExec;
class NamedThreadBase
-41
View File
@@ -1,41 +0,0 @@
#include "stdafx.h"
rTimer::rTimer()
{
handle = reinterpret_cast<void*>(new wxTimer());
}
rTimer::~rTimer()
{
delete reinterpret_cast<wxTimer*>(handle);
}
void rTimer::Start()
{
reinterpret_cast<wxTimer*>(handle)->Start();
}
void rTimer::Stop()
{
reinterpret_cast<wxTimer*>(handle)->Stop();
}
void rSleep(u32 time)
{
wxSleep(time);
}
void rMicroSleep(u64 time)
{
wxMicroSleep(time);
}
bool rThread::IsMain()
{
return wxThread::IsMain();
}
void rYieldIfNeeded()
{
wxYieldIfNeeded();
}
-22
View File
@@ -1,22 +0,0 @@
#pragma once
struct rTimer
{
rTimer();
rTimer(const rTimer& other) = delete;
~rTimer();
void Start();
void Stop();
private:
void *handle;
};
void rSleep(u32 time);
void rMicroSleep(u64 time);
struct rThread
{
static bool IsMain();
};
void rYieldIfNeeded();
+1
View File
@@ -2,6 +2,7 @@
#include <memory>
#include "Utilities/rXml.h"
#include <wx/xml/xml.h>
rXmlNode::rXmlNode()
+2
View File
@@ -1,3 +1,5 @@
#pragma once
/*
* Copyright 2001-2004 Unicode, Inc.
*