123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330 |
- #include "stdafx.h"
- #include "ReportMgrClr.h"
- #include <COTSUtilityDllFunExport.h>
- #include "IClassifyEngine.h"
- namespace OTSCLRINTERFACE {
- CReportMgrClr::CReportMgrClr()
- {
- m_pReportMgr = new CReportMgrPtr(new CReportMgr());
- }
- CReportMgrClr::CReportMgrClr(CReportMgrPtr pRProjFileMgr)
- {
- ASSERT(pRProjFileMgr);
- if (!pRProjFileMgr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("CReportMgrClr: Generate ReportProjFileMgr pointer failed."));
- return;
- }
- m_pReportMgr = new CReportMgrPtr(pRProjFileMgr);
-
- }
-
- CReportMgrClr::~CReportMgrClr()
- {
- if (m_pReportMgr != nullptr)
- {
- delete m_pReportMgr;
- m_pReportMgr = nullptr;
- }
- }
- CReportMgrClr::!CReportMgrClr()
- {
- if (m_pReportMgr != nullptr)
- {
- delete m_pReportMgr;
- m_pReportMgr = nullptr;
- }
- }
-
- CReportMgrPtr CReportMgrClr::GetCReportMgrPtr()
- {
- return *m_pReportMgr;
- }
-
- void CReportMgrClr::SetSwitchForSmlResultFile(int nIndex,bool ifcheck)
- {
- auto smlMgrs=m_pReportMgr->get()->GetSmplMsrResultMgrs();
- auto smlFile=smlMgrs[nIndex]->GetSmplMsrResultFile();
- smlFile->SetSwitch(ifcheck);
- }
- CPropParamClr^ CReportMgrClr::GetPropertyParamImage()
- {
- if (m_pReportMgr == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetPropertyParamImage: current CLR point is invalid."));
- return nullptr;
- }
- CPropParamPtr pPropParam = m_pReportMgr->get()->GetPropertyParamImage();
- ASSERT(pPropParam);
- if (!pPropParam)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetPropertyParamImage: get empty prop param pointer."));
- return nullptr;
- }
- CPropParamClr^ pPropParamClr = gcnew CPropParamClr(pPropParam);
- return pPropParamClr;
- }
- CPropParamClr^ CReportMgrClr::GetPropertyParamTable()
- {
- if (m_pReportMgr == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetPropertyParamGrid: current CLR point is invalid."));
- return nullptr;
- }
- CPropParamPtr pPropParam = m_pReportMgr->get()->GetPropertyParamForGrid();
- ASSERT(pPropParam);
- if (!pPropParam)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetPropertyParamGrid: get empty prop param pointer."));
- return nullptr;
- }
- CPropParamClr^ pPropParamClr = gcnew CPropParamClr(pPropParam);
- return pPropParamClr;
- }
- CPropParamClr^ CReportMgrClr::GetPropertyParamChart()
- {
- if (m_pReportMgr == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetPropertyParamChart: current CLR point is invalid."));
- return nullptr;
- }
- CReportMgrPtr pReportProjFileMgr = GetCReportMgrPtr();
- ASSERT(pReportProjFileMgr);
- if (!pReportProjFileMgr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetPropertyParamChart: get empty report project file manager pointer."));
- return nullptr;
- }
- CPropParamPtr pPropParam = pReportProjFileMgr->GetPropertyParamChart();
- ASSERT(pPropParam);
- if (!pPropParam)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetPropertyParamChart: get empty prop param pointer."));
- return nullptr;
- }
- CPropParamClr^ pPropParamClr = gcnew CPropParamClr(pPropParam);
- return pPropParamClr;
- }
- bool CReportMgrClr::ResetPropertyParams(bool a_bClear)
- {
- if (m_pReportMgr == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("ResetPropertyParams: empty pointer."));
- return false;
- }
- CReportMgrPtr pRProjFileMgrPtr = GetCReportMgrPtr();
-
- if (nullptr == pRProjFileMgrPtr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("ResetPropertyParams: can't generate pointer."));
- return false;
- }
- bool bRet = pRProjFileMgrPtr->ResetPropertyParams(a_bClear);
-
- return bRet;
- }
-
- List<CSmplMsrResultFileMgrClr^>^ CReportMgrClr::GetSmplMsrResultMgrs()
- {
- if (m_pReportMgr == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetSmplMsrResultMgrs: empty pointer."));
- return nullptr;
- }
- CReportMgrPtr pRProjFileMgrPtr = GetCReportMgrPtr();
- if (nullptr == pRProjFileMgrPtr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetSmplMsrResultMgrs: can't generate pointer."));
- return nullptr;
- }
- List<CSmplMsrResultFileMgrClr^>^ listSmplMsrResultFileMgrClr = gcnew List<CSmplMsrResultFileMgrClr^>();
- CSmplMsrResultFileMgrList listCSmplMsrResultFileMgr = pRProjFileMgrPtr->GetSmplMsrResultMgrs();
- for (auto pCSmplMsrResultFileMgr : listCSmplMsrResultFileMgr)
- {
- CSmplMsrResultFileMgrClr^ CMgrClr = gcnew CSmplMsrResultFileMgrClr(pCSmplMsrResultFileMgr);
- listSmplMsrResultFileMgrClr->Add(CMgrClr);
- }
- return listSmplMsrResultFileMgrClr;
- }
- bool CReportMgrClr::AddASmplMsrResultMgr(String^ a_strPathName)
- {
- if (m_pReportMgr == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetSmplMsrResultMgrs: empty pointer."));
- return false;
- }
- CReportMgrPtr pRProjFileMgrPtr = GetCReportMgrPtr();
- if (nullptr == pRProjFileMgrPtr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetSmplMsrResultMgrs: can't generate pointer."));
- return false;
- }
- //get the ptr object and then operate it.
- if (!pRProjFileMgrPtr->AddASmplMsrResultMgr(a_strPathName))
- {
- LogErrorTrace(__FILE__, __LINE__, _T("(CReportMgrClr::AddASmplMsrResultMgr) AddASmplMsrResultMgr(a_strPathName = %s) = false "), a_strPathName);
- return false;
- }
-
- return true;
- }
- CSmplMsrResultFileMgrClr^ CReportMgrClr::GetASmplMsrResultMgrByPathName(String^ a_strPathName)
- {
- if (m_pReportMgr == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetSmplMsrResultMgrs: empty pointer."));
- return nullptr;
- }
- CReportMgrPtr RProjFileMgrPtr = GetCReportMgrPtr();
- if (nullptr == RProjFileMgrPtr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("(CReportMgrClr::GetASmplMsrResultMgrByPathName(String^ a_strPathName = %s)) RProjFileMgrPtr = null "), a_strPathName);
- return nullptr;
- }
- CSmplMsrResultFileMgrPtr pSMsrRetFileMgr = RProjFileMgrPtr->GetASmplMsrResultMgrByPathName(a_strPathName);
- if (nullptr == pSMsrRetFileMgr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("(CReportMgrClr::GetASmplMsrResultMgrByPathName(String^ a_strPathName = %s)) pSMsrRetFileMgr = null "), a_strPathName);
- return nullptr;
- }
- CSmplMsrResultFileMgrClr^ pSMsrRetFileMgrClr = gcnew CSmplMsrResultFileMgrClr(pSMsrRetFileMgr);
- return pSMsrRetFileMgrClr;
- }
-
-
- // working sample index
- int CReportMgrClr::GetWorkingSampleIndex()
- {
- if (m_pReportMgr == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetWorkingSampleIndex: invalid pointer."));
- return -1;
- }
- CReportMgrPtr RProjFileMgrPtr = GetCReportMgrPtr();
- if (nullptr == RProjFileMgrPtr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("(GetWorkingSampleIndex: invalid pointer."));
- return -1;
- }
- return RProjFileMgrPtr->GetWorkingSampleIndex();
- }
- void CReportMgrClr::SetWorkingSampleIndex(int a_nWorkingSampleIndex)
- {
- if (m_pReportMgr == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetWorkingSampleIndex: invalid pointer."));
- return;
- }
- CReportMgrPtr RProjFileMgrPtr = GetCReportMgrPtr();
- if (nullptr == RProjFileMgrPtr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("(SetWorkingSampleIndex: invalid pointer."));
- return;
- }
- RProjFileMgrPtr->SetWorkingSampleIndex(a_nWorkingSampleIndex);
- }
-
-
- CGridDataListClr^ CReportMgrClr::GridDataTransfer(CPropParamClr^ thePropParam)
- {
-
- if (m_pReportMgr == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GridDataTransfer: invalid pointer."));
- return nullptr;
- }
- CReportMgrPtr pReportMgr = GetCReportMgrPtr();
- ASSERT(pReportMgr);
- if (!pReportMgr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GridDataTransfer: failed to create pointer."));
- return nullptr;
- }
- CGridDatasList listGridData = pReportMgr->GridDataTransfer(thePropParam->GetPropParamPtr());
- CGridDataListClr^ listGridDataClr = gcnew CGridDataListClr();
- for (auto pGridData : listGridData)
- {
- CGridDataClr^ GridDataClr = gcnew CGridDataClr(pGridData);
- listGridDataClr->Add(GridDataClr);
- }
- return listGridDataClr;
- }
-
- bool CReportMgrClr::IsHaveMultiDataSource()
- {
- if (m_pReportMgr == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("IsHaveMultiDataSource: invalid pointer."));
- return false;
- }
- CReportMgrPtr pReportProjFileMgr = GetCReportMgrPtr();
- ASSERT(pReportProjFileMgr);
- if (!pReportProjFileMgr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("IsHaveMultiDataSource: failed to create pointer."));
- return false;
- }
- bool bRet = pReportProjFileMgr->IsHaveMultiDataSource();
- return bRet;
- }
- CRptParamFileClr^ CReportMgrClr::GetRptParamFileClr()
- {
- auto paramfile = m_pReportMgr->get()->GetRptParamFilePtr();
- auto paramFileClr =gcnew CRptParamFileClr(paramfile);
- return paramFileClr;
- }
-
- }
|