mirror of
https://github.com/zeldaret/botw
synced 2026-05-28 08:25:01 -04:00
18c60323a9
git subrepo clone https://github.com/open-ead/sead lib/sead subrepo: subdir: "lib/sead" merged: "1b66e825d" upstream: origin: "https://github.com/open-ead/sead" branch: "master" commit: "1b66e825d" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" git subrepo clone (merge) https://github.com/open-ead/nnheaders lib/NintendoSDK subrepo: subdir: "lib/NintendoSDK" merged: "9ee21399f" upstream: origin: "https://github.com/open-ead/nnheaders" branch: "master" commit: "9ee21399f" git-subrepo: version: "0.4.3" origin: "ssh://git@github.com/ingydotnet/git-subrepo" commit: "2f68596" git subrepo clone https://github.com/open-ead/agl lib/agl subrepo: subdir: "lib/agl" merged: "7c063271b" upstream: origin: "https://github.com/open-ead/agl" branch: "master" commit: "7c063271b" git-subrepo: version: "0.4.3" origin: "ssh://git@github.com/ingydotnet/git-subrepo" commit: "2f68596" git subrepo clone https://github.com/open-ead/EventFlow lib/EventFlow subrepo: subdir: "lib/EventFlow" merged: "c35d21b34" upstream: origin: "https://github.com/open-ead/EventFlow" branch: "master" commit: "c35d21b34" git-subrepo: version: "0.4.3" origin: "ssh://git@github.com/ingydotnet/git-subrepo" commit: "2f68596"
56 lines
1.0 KiB
C++
56 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include "basis/seadTypes.h"
|
|
#include "container/seadSafeArray.h"
|
|
|
|
namespace sead
|
|
{
|
|
class StackTraceBase
|
|
{
|
|
public:
|
|
StackTraceBase();
|
|
virtual ~StackTraceBase() = default;
|
|
|
|
virtual uintptr_t get(s32 index) const = 0;
|
|
virtual s32 size() const = 0;
|
|
|
|
void trace(const void*);
|
|
|
|
protected:
|
|
virtual void clear_() = 0;
|
|
virtual void push_(uintptr_t addr) = 0;
|
|
virtual bool isFull_() = 0;
|
|
};
|
|
|
|
template <s32 Capacity>
|
|
class StackTrace : public StackTraceBase
|
|
{
|
|
public:
|
|
~StackTrace() override = default;
|
|
|
|
uintptr_t get(s32 index) const override
|
|
{
|
|
if (index >= mSize)
|
|
return 0;
|
|
return mBuffer[index];
|
|
}
|
|
|
|
s32 size() const override { return mSize; }
|
|
|
|
protected:
|
|
void clear_() override { mSize = 0; }
|
|
|
|
void push_(uintptr_t addr) override
|
|
{
|
|
mBuffer[mSize] = addr;
|
|
++mSize;
|
|
}
|
|
|
|
bool isFull_() override { return mSize >= mBuffer.size(); }
|
|
|
|
private:
|
|
SafeArray<uintptr_t, Capacity> mBuffer{};
|
|
s32 mSize{};
|
|
};
|
|
} // namespace sead
|