mirror of
https://github.com/zeldaret/botw
synced 2026-07-11 06:34:48 -04:00
Switch to subrepos
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"
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
#ifndef SEAD_METHODTREE_H_
|
||||
#define SEAD_METHODTREE_H_
|
||||
|
||||
#include <container/seadTreeNode.h>
|
||||
#include <heap/seadDisposer.h>
|
||||
#include <prim/seadBitFlag.h>
|
||||
#include <prim/seadDelegate.h>
|
||||
#include <prim/seadNamable.h>
|
||||
#include <prim/seadRuntimeTypeInfo.h>
|
||||
#include <prim/seadStorageFor.h>
|
||||
|
||||
namespace sead
|
||||
{
|
||||
class CriticalSection;
|
||||
|
||||
template <typename T, typename U>
|
||||
class IDelegate2;
|
||||
|
||||
class MethodTreeNode : public IDisposer, public TTreeNode<MethodTreeNode*>, public INamable
|
||||
{
|
||||
SEAD_RTTI_BASE(MethodTreeNode)
|
||||
|
||||
public:
|
||||
enum PauseFlag
|
||||
{
|
||||
cPause_None = 0,
|
||||
cPause_Self = 1,
|
||||
cPause_Child = 2,
|
||||
cPause_Both = 3,
|
||||
};
|
||||
|
||||
using PauseEventDelegate = IDelegate2<MethodTreeNode*, PauseFlag>;
|
||||
|
||||
// NON_MATCHING: stores for mPauseFlag, mPauseEventDelegate, mUserID
|
||||
explicit MethodTreeNode(CriticalSection* cs) : TTreeNode(this)
|
||||
{
|
||||
mCriticalSection = cs;
|
||||
mPauseEventDelegate = nullptr;
|
||||
mUserID = nullptr;
|
||||
mDelegateHolder.construct(sead::Delegate<MethodTreeNode>());
|
||||
setPauseFlag(cPause_Both);
|
||||
}
|
||||
|
||||
~MethodTreeNode() override { detachAll(); }
|
||||
|
||||
template <typename Delegate>
|
||||
void bind(const Delegate& delegate, const char* name)
|
||||
{
|
||||
lock_();
|
||||
mDelegateHolder.construct(delegate);
|
||||
unlock_();
|
||||
|
||||
if (name)
|
||||
setName(name);
|
||||
}
|
||||
|
||||
void call();
|
||||
void detachAll();
|
||||
void pushBackChild(MethodTreeNode* node);
|
||||
void pushFrontChild(MethodTreeNode* node);
|
||||
|
||||
void setPauseFlag(PauseFlag flag)
|
||||
{
|
||||
lock_();
|
||||
if (mPauseEventDelegate)
|
||||
mPauseEventDelegate->invoke(this, flag);
|
||||
mPauseFlag = flag;
|
||||
unlock_();
|
||||
}
|
||||
|
||||
private:
|
||||
void attachMutexRec_(CriticalSection* m) const;
|
||||
void callRec_();
|
||||
|
||||
void lock_();
|
||||
void unlock_();
|
||||
|
||||
StorageFor<sead::AnyDelegate> mDelegateHolder;
|
||||
mutable CriticalSection* mCriticalSection;
|
||||
[[maybe_unused]] u32 mPriority;
|
||||
BitFlag32 mPauseFlag;
|
||||
PauseEventDelegate* mPauseEventDelegate;
|
||||
void* mUserID;
|
||||
};
|
||||
|
||||
} // namespace sead
|
||||
|
||||
#endif // SEAD_METHODTREE_H_
|
||||
Reference in New Issue
Block a user