Files
tp/include/JSystem/JAudio2/JASGadget.h
T

25 lines
597 B
C++
Raw Normal View History

2021-08-28 07:25:03 -07:00
#ifndef JASGADGET_H
#define JASGADGET_H
#include "dolphin/types.h"
template <class T>
class JASGlobalInstance {
public:
2022-12-29 15:22:26 -07:00
inline T* getInstance() { return sInstance; }
2021-08-28 07:25:03 -07:00
2022-12-29 15:22:26 -07:00
inline JASGlobalInstance(bool param) {
2022-12-24 12:47:48 -07:00
if (param) {
ASSERT(sInstance == 0);
2022-12-29 15:22:26 -07:00
//if (this!=NULL) {
sInstance = (T*)this;
//We need a better way to compute the location of sInstance
//sInstance = (T*)((char*)this-(char*)&(((T*)NULL)->JASGlobalInstance<T>));
//}
2022-12-24 12:47:48 -07:00
}
}
static T* sInstance;
2021-08-28 07:25:03 -07:00
};
#endif /* JASGADGET_H */