⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 process.cpp

📁 Intel开发的IPP库的应用例程
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/*
//
//               INTEL CORPORATION PROPRIETARY INFORMATION
//  This software is supplied under the terms of a license agreement or
//  nondisclosure agreement with Intel Corporation and may not be copied
//  or disclosed except in accordance with the terms of that agreement.
//        Copyright(c) 1999-2006 Intel Corporation. All Rights Reserved.
//
*/

// Process.cpp: implementation of the CProcess, CBook, CChapter.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "demo.h"
#include "MainFrm.h"
#include "Director.h"
#include "Process.h"
#include "ProcessSheet.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

///////////////////////////////////////////////////////////////////////
// CProcess class implementation.
// class CProcess provides classification for all IPP libraries.
// They are shown in Process Dialog
// and each library has its own sheet
///////////////////////////////////////////////////////////////////////

CFilter* CProcess::m_pFilter = NULL;

UINT CProcess::GetIdFilter(int idx) 
{ 
   return IDD_FILTER;
}

CProcess::CProcess() 
{
   m_CurrProcess = -1;
   CSubProcess pr;
   InsertAt(0,pr,DEMO_APP->GetNumLibs());
   if (m_pFilter == NULL)
      m_pFilter = new CFilter[DEMO_APP->GetNumLibs()];
}

void CProcess::InitFunctions() 
{ 
   for (int i=0; i<GetSize(); i++)
      ElementAt(i).InitFunctions(DEMO_APP->GetIppList() + i); 
}

void CProcess::SetFunctions() 
{
   for (int i=0; i<GetSize(); i++)
      ElementAt(i).SetFunctions(DEMO_APP->GetIppList() + i); 
}

void CProcess::CopyFunctions(CProcess* pSrc) 
{
   for (int i=0; i<GetSize(); i++)
      ElementAt(i).CopyFunctions(&(pSrc->ElementAt(i))); 
}

CBook* CProcess::Add(CString name, int idx) 
{
   if (idx >= GetSize()) return NULL;
   return ElementAt(idx).Add(name);
}

int CProcess::GetFuncCount()
{ 
   int n = 0;
   for (int i=0; i<GetSize(); i++)
      n += (*this)[i].GetFuncCount();
   return n;
}

void CProcess::GetCurrentSettings(CProcess* pDst)
{
   pDst->m_CurrProcess = m_CurrProcess;
   for (int i=0; i<GetSize(); i++) 
      (*this)[i].GetCurrentSettings(&(pDst->ElementAt(i)));
}

void CProcess::SetCurrentSettings(CProcess* pSrcProcess)
{
   pSrcProcess->GetCurrentSettings(this);
}

BOOL CProcess::ApplyVectorNoSet(CVector* pVec)
{
   BOOL result = FALSE;
   for (int i=0; i < GetSize(); i++) {
      if (ElementAt(i).ApplyVector(pVec))
         result = TRUE;
   }
   return result;
}

BOOL CProcess::ApplyVector(CVector* pVec)
{
   SetFunctions();
   return ApplyVectorNoSet(pVec);
}

BOOL CProcess::ApplyFilter(const CFilter* pFilter)
{
   BOOL result = FALSE;
   for (int i=0; i < GetSize(); i++) {
      if (ElementAt(i).ApplyFilter(pFilter))
         result = TRUE;
   }
   return result;
}

// attributes

void CProcess::SetParentProcess(CProcess* pSrc)
{
   for (int i=0; i<GetSize(); i++)
      (*this)[i].SetParentProcess(&(pSrc->ElementAt(i)));
}

BOOL CProcess::PresentBase(CString name)
{
   for (int i=0; i<GetSize(); i++) {
      if (ElementAt(i).PresentBase(name)) return TRUE;
   }
   return FALSE;
}

int CProcess::GetCurrentBook() 
{ 
   if ((m_CurrProcess < 0) ||
       (m_CurrProcess >= GetSize())) return -1; 
   return ElementAt(m_CurrProcess).GetCurrentBook();
}

int CProcess::GetCurrentChapter()
{ 
   if ((m_CurrProcess < 0) ||
       (m_CurrProcess >= GetSize())) return -1; 
   return ElementAt(m_CurrProcess).GetCurrentChapter();
}

CFunc CProcess::GetCurrentFunction(CFunc pairFunc)
{ 
   if ((m_CurrProcess < 0) ||
       (m_CurrProcess >= GetSize())) return _T(""); 
   return ElementAt(m_CurrProcess).GetCurrentFunction(pairFunc);
}

void CProcess::SetCurrentProcess(int nProcess)
{
   if ((nProcess >= 0) && (nProcess < GetSize()))
      m_CurrProcess = nProcess;
   else if (GetSize() > 0)
      m_CurrProcess = 0;
   else
      m_CurrProcess = -1;
}

void CProcess::SetCurrentBook(int nProcess, int nBook)
{
   SetCurrentProcess(nProcess);
   if (m_CurrProcess >= 0)
      ElementAt(m_CurrProcess).SetCurrentBook(nBook);
}

void CProcess::SetCurrentChapter(int nProcess, int nBook, int nChapter)
{
   SetCurrentProcess(nProcess);
   if (m_CurrProcess >= 0)
      ElementAt(m_CurrProcess).SetCurrentChapter(nBook, nChapter);
}

void CProcess::SetCurrentFunction(int nProcess, int nBook, int nChapter, CFunc func)
{
   SetCurrentProcess(nProcess);
   if (m_CurrProcess >= 0)
      ElementAt(m_CurrProcess).SetCurrentFunction(nBook, nChapter, func);
}

int CProcess::GetFunctionsWithBase(CString baseName, CFuncList& funcList)
{
   funcList.RemoveAll();
   int result = 0;
   for (int i=0; i<GetSize(); i++) {
      CFuncList subList;
      result += ElementAt(i).GetFunctionsWithBase(baseName, subList);
      funcList.AddTail(&subList);
   }
   return result;
}

BOOL CProcess::GetFunction(CVector* pVec, CFunc& func)
{
   CProcessSheet sheet(_T("Choose function"));
   sheet.CreatePages(this,pVec);

   if (sheet.StartFilterProblem()) {
      CProcessSheet tmpSheet(_T("Choose function"));
      tmpSheet.CreatePages(this,pVec);
      tmpSheet.Create(MAIN_FRAME);
      if (tmpSheet.OnFilter()) {
         tmpSheet.OnOK();
         sheet.CreatePages(this, pVec);
      }
      tmpSheet.EndDialog(IDCANCEL);
   }
   if (sheet.DoModal() != IDOK)
      return FALSE;
   func = sheet.m_Func;
   return TRUE;
}

///////////////////////////////////////////////////////////////////////
// CSubProcess class implementation
// class CSubProcess provides classification for one IPP library.
// Library consists of books.
// Books are shown in the left column of Process Dialog sheet
// and each library has its own sheet
///////////////////////////////////////////////////////////////////////

CSubProcess::CSubProcess() 
{
   m_CurrBook = -1;
   m_pParentProcess = NULL;
}

void CSubProcess::InitFunctions(CFuncList* pFuncList)
{
   for (int nBook=0; nBook < GetSize(); nBook++)
      ElementAt(nBook).InitFunctions(pFuncList);
}

void CSubProcess::SetFunctions(CFuncList* pFuncList) 
{
   if (m_pParentProcess)
      CopyFunctions(m_pParentProcess);
   else
      InitFunctions(pFuncList); 
}

BOOL CSubProcess::ApplyVector(CVector* pVec)
{
   BOOL result = FALSE;
   for (int nBook=0; nBook < GetSize(); nBook++) {
      if (ElementAt(nBook).ApplyVector(pVec))
         result = TRUE;
   }
   return result;
}

BOOL CSubProcess::ApplyFilter(const CFilter* pFilter, int libIdx)
{
   SetFunctions(DEMO_APP->GetIppList() + libIdx);
   BOOL result = FALSE;
   for (int nBook=0; nBook < GetSize(); nBook++) {
      if (ElementAt(nBook).ApplyFilter(pFilter))
         result = TRUE;
   }
   return result;
}

int CSubProcess::GetFuncCount()
{
   int result = 0;
   for (int nBook=0; nBook < GetSize(); nBook++) {
      result += GetAt(nBook).GetFuncCount();
   }
   return result;
}

void CSubProcess::CopyFunctions(CSubProcess* pSrc)
{
   for (int i = 0; i < GetSize(); i++) {
      ElementAt(i).CopyFunctions(&(pSrc->ElementAt(i)));
   }
}

void CSubProcess::GetCurrentSettings(CSubProcess* pDst)
{
   pDst->m_CurrBook = m_CurrBook;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -