<commit_before>/************************************************************************************
**  
* @copyright (c) 2013-2100, ChengDu Duyer Technology Co., LTD. All Right Reserved.
*
*************************************************************************************/
/**
* @file		g_singleton.h
* @version     
* @brief      
* @author   duye
* @date     2014-06-18
* @note 
*
*  1. 2014-06-18 duye Created this file
* 
*/

#pragma once

#include <g_system.h>
#include <g_namespace.h>

G_NS_GCOMMON_BEG

/** 
 * @brief singletion template
 */
template<typename T>
class Singleton
{
public:
    typedef T object_type;
    
public:
    static T* GetInstance();
    
protected:
    Singleton() {}
    Singleton(const Singleton&);
    Singleton& operator=(const Singleton&);

private:
    static T m_instance;
};

template<typename T> typename Singleton<T>::object_type* Singleton<T>::m_instance = NULL;

template<typename T>
T* Singleton<T>::GetInstance()
{
    return &m_instance;
}

G_NS_END
<commit_msg>Update g_singleton.h<commit_after>/************************************************************************************
**  
* @copyright (c) 2013-2100, ChengDu Duyer Technology Co., LTD. All Right Reserved.
*
*************************************************************************************/
/**
* @file		g_singleton.h
* @version     
* @brief      
* @author   duye
* @date     2014-06-18
* @note 
*
*  1. 2014-06-18 duye Created this file
* 
*/

#pragma once

#include <g_system.h>
#include <g_namespace.h>

G_NS_GCOMMON_BEG

/** 
 * @brief singletion template
 */
template<typename T>
class Singleton
{
public:
    typedef T object_type;
    
public:
    static T* GetInstance();
    
protected:
    Singleton() {}
    Singleton(const Singleton&);
    Singleton& operator=(const Singleton&);

private:
    static T m_instance;
};

template<typename T> typename Singleton<T>::object_type Singleton<T>::m_instance;

template<typename T>
T* Singleton<T>::GetInstance()
{
    return &m_instance;
}

G_NS_END

{'fraction_non_alphanumeric': 0.28, 'fraction_numerical': 0.024691358024691357, 'mean_word_length': 4.402666666666667, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5661199', 'n_tokens_mistral': 688, 'n_tokens_neox': 631, 'n_words': 146}