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.

50 lines
1.3 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: DirectOutputSet.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of DirectOutputSet.cpp
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "DirectOutputSet.h"
  16. #include "..\..\LgLib\Version.h"
  17. CDirectOutputSet::CDirectOutputSet()
  18. {
  19. m_ppOutput = NULL;
  20. m_nOutput = 0;
  21. }
  22. CDirectOutputSet::~CDirectOutputSet()
  23. {
  24. if( m_ppOutput )
  25. {
  26. for( int i = 0; i < m_nOutput; i++ )
  27. delete m_ppOutput[i];
  28. free( m_ppOutput );
  29. }
  30. }
  31. BOOL CDirectOutputSet::ConnectToDevice( CDeviceDO *pDeviceDO, int nDeviceBit, int nSensorBit )
  32. {
  33. CDirectOutput *pDirectOutput = new CDirectOutput;
  34. if( !pDirectOutput )
  35. return FALSE;
  36. m_ppOutput = (CDirectOutput**)realloc( m_ppOutput, sizeof(CDirectOutput*) * (m_nOutput + 1) );
  37. if( !m_ppOutput )
  38. {
  39. m_nOutput = 0;
  40. delete pDirectOutput;
  41. return FALSE;
  42. }
  43. m_ppOutput[ m_nOutput ] = pDirectOutput;
  44. return m_ppOutput[ m_nOutput++ ]->ConnectToDevice( pDeviceDO, nDeviceBit, nSensorBit );
  45. }