OTSSampleClr.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #include "stdafx.h"
  2. #include "OTSSampleClr.h"
  3. #include <COTSUtilityDllFunExport.h>
  4. namespace OTSCLRINTERFACE {
  5. //using namespace Newtonsoft::Json ::Linq;
  6. COTSSampleClr::COTSSampleClr()
  7. {
  8. theSample = new COTSSamplePtr(new COTSSample());
  9. }
  10. COTSSampleClr::COTSSampleClr(COTSSamplePtr pSample) // copy constructor
  11. {
  12. ASSERT(pSample);
  13. //theSample= new COTSSamplePtr(new COTSSample(pSample.get()));
  14. theSample = new COTSSamplePtr(pSample);
  15. //*theSample = pSample;
  16. }
  17. COTSSampleClr::~COTSSampleClr()
  18. {
  19. if (theSample != nullptr)
  20. {
  21. delete theSample;
  22. theSample = nullptr;
  23. }
  24. }
  25. COTSSampleClr::!COTSSampleClr()
  26. {
  27. if (theSample != nullptr)
  28. {
  29. delete theSample;
  30. theSample = nullptr;
  31. }
  32. }
  33. COTSSamplePtr COTSSampleClr::GetSamplePtr()
  34. {
  35. return *theSample;
  36. }
  37. // has measure results test
  38. bool COTSSampleClr::HasMeasureResult()
  39. {
  40. COTSSamplePtr pSample = GetSamplePtr();
  41. if (pSample == nullptr)
  42. {
  43. LogErrorTrace(__FILE__, __LINE__, _T("HasMeasureResult: invalide pointer."));
  44. return false;
  45. }
  46. return pSample->HasMeasureResult();
  47. }
  48. bool COTSSampleClr::GetBSESize(int% a_nWidth, int% a_nHeight)
  49. {
  50. COTSSamplePtr pSample = GetSamplePtr();
  51. if (pSample == nullptr)
  52. {
  53. LogErrorTrace(__FILE__, __LINE__, _T("GetBSESize: invalide pointer."));
  54. return false;
  55. }
  56. int nWidth = 0;
  57. int nHeight = 0;
  58. bool bRet = pSample->GetBSESize(nWidth, nHeight);
  59. a_nWidth = nWidth;
  60. a_nHeight = nHeight;
  61. return bRet;
  62. }
  63. }