// TimeEquipSubState.h: interface for the CTimeEquipSubState class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_TIMEEQUIPSUBSTATE_H__6773B056_566C_4379_A8AF_7D784B1B181E__INCLUDED_)
#define AFX_TIMEEQUIPSUBSTATE_H__6773B056_566C_4379_A8AF_7D784B1B181E__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#ifdef  BUILD_MCCTRDLL
#define     MCCTRDLLCLASS   __declspec(dllexport)
#else
#define     MCCTRDLLCLASS   __declspec(dllimport)
#endif

#include "dbini.h"

class MCCTRDLLCLASS CTimeEquipSubState
{
public:
//  default constructor
    CTimeEquipSubState(CString csSectionName = "", CString csKeyName = "",
                       CString csFileName = RUNTIME_INI);

//  default destructor
    virtual ~CTimeEquipSubState();

//  Start timer
    void Start();

//  Stop timer
    void Stop();

//  Reset timer to 0
    void Reset();

//  Get timer time
    LONGLONG GetTime();

//  set timer time
    void SetTime(LONGLONG);

//  Add timer time
    void AddTime(LONGLONG lTimeSpan);

//  check if timer has been started
    bool IsTimerStarted();

//  record debugging info to file
    void WriteTimeSpanToFile();

//  copy current time span to previous time span
    void CopyCurTimeSpanToPrev();

//  check time span has changed
    bool IsTimeSpanChanged();

//  Set Section Name
    bool SetSectionName(const char *ccSectionName);

//  Set KeyName
    bool SetKeyName(const char *ccKeyName);

//  Get Start Time
    LONGLONG GetStartTime();

    enum
    {
        RESET_TIMER,
        START_TIMER,
        STOP_TIMER,
    };

private:
//  flag to detemine whether the timer has started
    bool m_bTimerStarted;

//  attribute to store start time
    LONGLONG m_lStartTime;

//  attribute to store timer time span
//  time span = startTime - stop time
    LONGLONG m_lTimeSpan;

//  previous time span
    LONGLONG m_lPrevTimeSpan;

//  Section name of the debug info file
    CString m_csSectionName;

//  Key name of the debug info file
    CString m_csKeyName;

//  File name of the debug info file
    CString m_csFileName;
};

#endif // !defined(AFX_TIMEEQUIPSUBSTATE_H__6773B056_566C_4379_A8AF_7D784B1B181E__INCLUDED_)
