1 #ifndef JSONSINGLETON_H
2 #define JSONSINGLETON_H
3 
4 template <typename T> class JSONSingleton {
5 public:
get(void)6 	static inline T get(void){
7 		return get_singleton() -> ptr;
8 	}
set(T p)9 	static inline void set(T p){
10 		get_singleton() -> ptr = p;
11 	}
12 private:
JSONSingleton()13 	inline JSONSingleton() : ptr(NULL) { }
14 	JSONSingleton(const JSONSingleton<T> &);
15 	JSONSingleton<T> operator = (const JSONSingleton<T> &);
get_singleton(void)16 	static inline JSONSingleton<T> * get_singleton(void){
17 		static JSONSingleton<T> instance;
18 		return &instance;
19 	}
20 	T ptr;
21 };
22 
23 #endif
24