USAGEMODE HRESULT Filter_ShowConfigDlg(void* pExistingFilter, const void* psMsgEntry, ETYPE_BUS eType, UINT nHardware, CWnd* pParent) { //Place this code at the beginning of the export function. //Save previous resource handle and switch to current one. HINSTANCE hInst = AfxGetResourceHandle(); AfxSetResourceHandle(FilterDLL.hResource); HRESULT hResult = S_FALSE; switch (eType) { case CAN: { if (pExistingFilter != NULL) { SFILTERAPPLIED_CAN* pAppliedFilterCan = (SFILTERAPPLIED_CAN*)pExistingFilter; SFILTERAPPLIED_CAN sTempObj; sTempObj.bClone(*pAppliedFilterCan); CFilterConfigDlg omDlg(&sTempObj, (SMSGENTRY *)psMsgEntry, nHardware, pParent); if (omDlg.DoModal() == IDOK) { pAppliedFilterCan->bClone(sTempObj); hResult = S_OK; } //delete omDlg; } } break; case LIN: if (pExistingFilter != NULL) { SFILTERAPPLIED_LIN* pAppliedFilterLin = (SFILTERAPPLIED_LIN*)pExistingFilter; SFILTERAPPLIED_LIN sTempObj; sTempObj.bClone(*pAppliedFilterLin); CFilterConfigDlg omDlg(&sTempObj,(ClusterConfig *) psMsgEntry, nHardware, pParent); if (omDlg.DoModal() == IDOK) { pAppliedFilterLin->bClone(sTempObj); hResult = S_OK; } //delete omDlg; } break; default: { } break; } //Place this at the end of the export function. //switch back to previous resource handle. AfxSetResourceHandle(hInst); return hResult; }
HRESULT CMsgContainerLIN::GetFilterScheme(void* pvFilterApplied) { HRESULT hResult = S_FALSE; SFILTERAPPLIED_LIN* psFilterLIN = (SFILTERAPPLIED_LIN*)pvFilterApplied; if (psFilterLIN != NULL) { // if (psFilterLIN->bClone(m_sFilterLIN) == TRUE) if (psFilterLIN->bClone(m_sFilterLIN) == true) { //hResult = TRUE; hResult = S_OK; } } return hResult; }
int CLogObjectLIN::Der_SetConfigData(xmlNodePtr pNodePtr) { int nResult = S_OK; SFILTERAPPLIED_LIN sFilterApplied; CStringArray omStrFilters; std::map<std::string, int> mapFilters; if (S_OK == sFilterApplied.nSetXMLConfigData(pNodePtr->doc, LIN)) { while(pNodePtr != nullptr) //TODO:Move To Utils { if ( pNodePtr->xmlChildrenNode != nullptr ) { if ((!xmlStrcmp(pNodePtr->name, (const xmlChar*)"Filter"))) { int nEnabled = 1; xmlAttrPtr pAttr = pNodePtr->properties; while (pAttr) { // walk through all the attributes and find the required one if (pAttr->type == XML_ATTRIBUTE_NODE) { std::string strAttrName((char*)pAttr->name); if ((strAttrName == "IsEnabled") ) { nEnabled = atoi((char*)pAttr->children->content); break; // found } } pAttr = pAttr->next; } xmlChar* key = xmlNodeListGetString(pNodePtr->doc, pNodePtr->xmlChildrenNode, 1); if(nullptr != key) { mapFilters[(char*)key] = nEnabled; xmlFree(key); } } } pNodePtr = pNodePtr->next; } //sFilterApplied.nGetFiltersFromName(m_sFilterApplied, omStrFilters); sFilterApplied.nGetFiltersFromName(m_sFilterApplied, mapFilters); } return nResult; }
static void vPopulateFilterApplied(const SFILTERAPPLIED_LIN* psFilterConfigured, SFILTERAPPLIED_LIN& sFilterApplied, CMainEntryList& SrcList) { SMAINENTRY& sMainEntry = SrcList.GetHead(); int nCount = sMainEntry.m_odSelEntryList.GetCount(); sFilterApplied.vClear(); sFilterApplied.m_psFilters = new SFILTERSET[nCount]; POSITION pos = sMainEntry.m_odSelEntryList.GetHeadPosition(); while (pos) { SSUBENTRY& sSubEntry = sMainEntry.m_odSelEntryList.GetNext(pos); const PSFILTERSET psTemp = SFILTERSET::psGetFilterSetPointer(psFilterConfigured->m_psFilters, psFilterConfigured->m_ushTotal, sSubEntry.m_omSubEntryName.GetBuffer(MAX_PATH)); ASSERT (psTemp != NULL); sFilterApplied.m_psFilters[sFilterApplied.m_ushTotal].bClone(*psTemp); sFilterApplied.m_ushTotal++; } }
void CLogObjectLIN::GetFilterInfo(SFILTERAPPLIED_LIN& sFilterInfo) const { sFilterInfo.bClone(m_sFilterApplied); }