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

#pragma once

#include <list>
#include <g_type.h>

namespace gsys {

/**
 * @brief process monitor interface
 */
class ProcessMonitorInterface
{
public:
    virtual ~ProcessMonitorInterface() {}
    virtual void onSegmentationFault(const GInt32 sig) {}
    virtual void onCtrlC(const GInt32 sig) {}
};

class ProcessMonitor;

/**
 * @biref process monitor for system API callback
 */
class ProcessSysCallback
{
public:
    ProcessSysCallback();
    ~ProcessSysCallback();

	/**
	 * @brief regist ProcessMonitor
	 * @param [in] process_monitor : ProcessMonitor
	 */
    void registProcessMonitor(ProcessMonitor* process_monitor);
    
	/**
	 * @brief system signal callback
	 * @param [in] sig : signal
	 */
    static void signalHandlerCallback(const GInt32 sig);

private:
    static ProcessMonitor*  m_processMonitor;
};

/**
 * @biref process monitor
 */
class ProcessMonitor
{
public:
    typedef std::list<ProcessMonitorInterface*> ProcessMonitorList;
    
public:    
    ProcessMonitor();
    ~ProcessMonitor();
    
	/**
	 * @brife addition process monitor interface 
	 * @param [in] monitor_interface : process monitor interface
	 */
    void addMonitor(ProcessMonitorInterface* monitor_interface);

	/**
	 * @brief remove process monitor interface
	 * @param [in] monitor_interface : process monitor interface
	 */
    void removeMonitor(ProcessMonitorInterface* monitor_interface);
    
private:
  	// system signal handler
	void signalHandler(const GInt32 sig);

    friend class ProcessSysCallback;
    
    ProcessSysCallback  m_processSysCallback;
    ProcessMonitorList  m_processMonitorList;
};

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

#pragma once

#include <list>
#include <g_type.h>

namespace gsys {

/**
 * @brief process monitor interface
 */
class ProcessMonitorInterface
{
public:
	virtual ~ProcessMonitorInterface() {}
	virtual void onSegmentationFault(const GInt32 sig) {}
	virtual void onCtrlC(const GInt32 sig) {}
};

class ProcessMonitor;

/**
 * @biref process monitor for system API callback
 */
class ProcessSysCallback
{
public:
	ProcessSysCallback();
	~ProcessSysCallback();

	/**
	 * @brief regist ProcessMonitor
	 * @param [in] process_monitor : ProcessMonitor
	 */
	void registProcessMonitor(ProcessMonitor* process_monitor);
	
	/**
	 * @brief system signal callback
	 * @param [in] sig : signal
	 */
	static void signalHandlerCallback(const GInt32 sig);

private:
	static ProcessMonitor*  m_processMonitor;
};

/**
 * @biref process monitor
 */
class ProcessMonitor
{
public:
	typedef std::list<ProcessMonitorInterface*> ProcessMonitorList;
    
public:    
	ProcessMonitor();
	~ProcessMonitor();
    
	/**
	 * @brife addition process monitor interface 
	 * @param [in] monitor_interface : process monitor interface
	 */
	void addMonitor(ProcessMonitorInterface* monitor_interface);

	/**
	 * @brief remove process monitor interface
	 * @param [in] monitor_interface : process monitor interface
	 */
	void removeMonitor(ProcessMonitorInterface* monitor_interface);
    
private:
  	// system signal handler
	void signalHandler(const GInt32 sig);

	friend class ProcessSysCallback;
	
	ProcessSysCallback  m_processSysCallback;
	ProcessMonitorList  m_processMonitorList;
};

}
{'fraction_non_alphanumeric': 0.18067537589351737, 'fraction_numerical': 0.01626817845698792, 'mean_word_length': 4.4034620505992015, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1440112', 'n_tokens_mistral': 1204, 'n_tokens_neox': 1102, 'n_words': 301}