Old fashion design for PC-104
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

138 lines
3.2 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 08/10/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: LgMaskSchedule.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of LgMaskSchedule.cpp
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "LgMaskSchedule.h"
  16. #include "LgMaskScheduleEngine.h"
  17. HANDLE m_hModule = NULL;
  18. BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
  19. {
  20. switch ( ul_reason_for_call )
  21. {
  22. case DLL_PROCESS_ATTACH: m_hModule = hModule; break;
  23. case DLL_THREAD_ATTACH: break;
  24. case DLL_THREAD_DETACH: break;
  25. case DLL_PROCESS_DETACH: m_hModule = NULL; break;
  26. }
  27. return TRUE;
  28. }
  29. CLgMaskSchedule::CLgMaskSchedule()
  30. {
  31. m_pReserved = new CLgMaskScheduleEngine();
  32. }
  33. CLgMaskSchedule::~CLgMaskSchedule()
  34. {
  35. if( m_pReserved )
  36. delete reinterpret_cast<CLgMaskScheduleEngine*>(m_pReserved);
  37. }
  38. static void MaskScheduleCallback( LPVOID lParam, CLgMaskScheduleLgsSwitch& arrSwitch )
  39. {
  40. reinterpret_cast<CLgMaskSchedule*>(lParam)->MaskSwitch( arrSwitch );
  41. }
  42. BOOL CLgMaskSchedule::Create()
  43. {
  44. if( !m_pReserved )
  45. return FALSE;
  46. return reinterpret_cast<CLgMaskScheduleEngine*>(m_pReserved)->Create( MaskScheduleCallback, this );
  47. }
  48. void CLgMaskSchedule::Destroy()
  49. {
  50. if( !m_pReserved )
  51. return;
  52. reinterpret_cast<CLgMaskScheduleEngine*>(m_pReserved)->Destroy();
  53. }
  54. BOOL CLgMaskSchedule::Load( LPCTSTR pFileName )
  55. {
  56. if( !m_pReserved )
  57. return FALSE;
  58. return reinterpret_cast<CLgMaskScheduleEngine*>(m_pReserved)->Load( pFileName );
  59. }
  60. BOOL CLgMaskSchedule::Save( LPCTSTR pFileName )
  61. {
  62. if( !m_pReserved )
  63. return FALSE;
  64. return reinterpret_cast<CLgMaskScheduleEngine*>(m_pReserved)->Save( pFileName );
  65. }
  66. void CLgMaskSchedule::OnTimer( SYSTEMTIME *pST )
  67. {
  68. if( !m_pReserved )
  69. return;
  70. reinterpret_cast<CLgMaskScheduleEngine*>(m_pReserved)->OnTimer( pST );
  71. }
  72. BOOL CLgMaskSchedule::Add( PMASK_SCHEDULE pHzSchedule )
  73. {
  74. if( !m_pReserved )
  75. return FALSE;
  76. return reinterpret_cast<CLgMaskScheduleEngine*>(m_pReserved)->Add( pHzSchedule );
  77. }
  78. BOOL CLgMaskSchedule::Delete( INT nIndex )
  79. {
  80. if( !m_pReserved )
  81. return FALSE;
  82. return reinterpret_cast<CLgMaskScheduleEngine*>(m_pReserved)->Delete( nIndex );
  83. }
  84. void CLgMaskSchedule::DeleteAll()
  85. {
  86. if( !m_pReserved )
  87. return;
  88. reinterpret_cast<CLgMaskScheduleEngine*>(m_pReserved)->DeleteAll();
  89. }
  90. CLgScheduleArray& CLgMaskSchedule::GetScheduleArray()
  91. {
  92. if( !m_pReserved )
  93. {
  94. static CLgScheduleArray array;
  95. return array;
  96. }
  97. return reinterpret_cast<CLgMaskScheduleEngine*>(m_pReserved)->GetScheduleArray();
  98. }
  99. void CLgMaskSchedule::MaskSwitch( CLgMaskScheduleLgsSwitch &arrSwitch )
  100. {
  101. if( !m_pReserved )
  102. return;
  103. reinterpret_cast<CLgMaskScheduleEngine*>(m_pReserved)->MaskSwitch( arrSwitch );
  104. }
  105. void CLgMaskSchedule::UpdateSchedule( INT nIndex )
  106. {
  107. if( !m_pReserved )
  108. return;
  109. reinterpret_cast<CLgMaskScheduleEngine*>(m_pReserved)->UpdateSchedule( nIndex );
  110. }