当前位置: 首页>>代码示例>>C++>>正文


C++ preProcess函数代码示例

本文整理汇总了C++中preProcess函数的典型用法代码示例。如果您正苦于以下问题:C++ preProcess函数的具体用法?C++ preProcess怎么用?C++ preProcess使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了preProcess函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Select

Relation* Select(vector<string> &words, SchemaManager &schema_manager, MainMemory &mem){
	vector<string> select_list, from_list, where_list, order_list;
	bool has_distinct = false, has_where = false, has_orderby = false;
	int i = 1;
	if (words[i] == "DISTINCT"){
		has_distinct = true;
		i++;
	}
	while (i < words.size() && words[i] != "FROM"){
		// drop comma
		select_list.push_back(splitBy(words[i], ",")[0]);
		i++;
	}
	i++; // skip FROM
	while ( i < words.size() && words[i] != "WHERE" && words[i] != "ORDER"){
		from_list.push_back(splitBy(words[i], ",")[0]);
		i++;
	}
	if (i < words.size()){
		if (words[i] == "WHERE"){
			has_where = true;
			i++; // skip WHERE
			while (i < words.size() && words[i] != "ORDER"){
				where_list.push_back(words[i]);
				i++;
			}
		}
		if (i < words.size() && words[i] == "ORDER"){
			has_orderby = true;
			i = i + 2; // skip ORDER BY
			order_list.push_back(words[i]);
			i++;
		}
	}

	// add table name to each column name
	preProcess(from_list, select_list, schema_manager);
	preProcess(from_list, where_list, schema_manager);
	preProcess(from_list, order_list, schema_manager);
	/*
	   print(select_list);
	   print(from_list);
	   print(where_list);
	   print(order_list);
	   */
	Relation* view =  generateLQP(has_distinct, select_list, from_list, where_list, order_list, schema_manager, mem);

	cout<<*view<<endl;
	return view;
}
开发者ID:tonywang1990,项目名称:TinySQL-implementation,代码行数:50,代码来源:query.cpp

示例2: locker

	Packet::Ptr PacketSocket::selectPacket()
	{
		QMutexLocker locker(&mutex);
		Packet::Ptr ret(0);
		// this function should ensure that between
		// each data packet at least 3 control packets are sent
		// so requests can get through
		
		if (ctrl_packets_sent < 3)
		{
			// try to send another control packet
			if (control_packets.size() > 0)
				ret = control_packets.front();
			else if (data_packets.size() > 0)
				ret = data_packets.front(); 
		}
		else
		{
			if (data_packets.size() > 0)
			{
				ctrl_packets_sent = 0;
				ret = data_packets.front();
			}
			else if (control_packets.size() > 0)
				ret = control_packets.front();
		}
		
		if (ret)
			preProcess(ret);
		
		return ret;
	}
开发者ID:KDE,项目名称:libktorrent,代码行数:32,代码来源:packetsocket.cpp

示例3: main

int main(int argc, char **argv) {

	FILE *entrada;
	FILE *saida;
	FILE *automatoFile;
	TArquivo *context;
	Automato *automato;

	if ((entrada = fopen("resources/Entrada.txt", "r+")) != NULL) {
		context = preProcess(entrada);

		if((automatoFile = fopen("resources/Automato.txt", "r+")) != NULL){
			automato=inicializaAutomato(automatoFile);

			if ((saida = fopen("resources/Saida.txt", "w+")) != NULL) {
				process(automato,context,entrada,saida);
				fclose(saida);
			}else{
				printf("Falha ao criar arquivo de saida");
			}
		}
		else{
			printf("Falha ao carregar automato");
		}
		fclose(entrada);
	}else{
		printf("Falha ao abrir o arquivo");
	}
	return EXIT_SUCCESS;
}
开发者ID:johngodoi,项目名称:AL-C2,代码行数:30,代码来源:AL-C2.c

示例4: preProcess

/**
 * Method to preprocess the scenegraph before exporting.
 * The method will find the total number of nodes in the
 * scene and convert all the standard MAX materials in the scene to
 * OSG materials and textures.
 */
BOOL OSGExp::preProcess(INode* node, TimeValue t){

	if (_ip->GetCancel())
			return TRUE;

	// Only export material if hole scene is to be exported or
	// this node is choosen to be exported.
	if(!_onlyExportSelected || node->Selected()) {

		// Add to the total number of nodes.
		_nTotalNodeCount++;
	
		// Add the nodes material to out material list
		// Null entries are ignored when added...
		if(_options->getExportMaterials()){
			BOOL mtlAdded = _mtlList->addMtl(node->GetMtl(), _options, t);
			if(mtlAdded){
				// Update material exporting progress bar.
				_nCurMtl++;
				_ip->ProgressUpdate((int)((float)_nCurMtl/_nTotalMtlCount*100.0f)); 
			}
		}
	}

	// For each child of this node, we recurse into ourselves 
	// and increment the counter until no more children are found.
	for (int c = 0; c < node->NumberOfChildren(); c++) {
		if(!preProcess(node->GetChildNode(c),t))
			return FALSE;
	}
	return TRUE;
}
开发者ID:VRAC-WATCH,项目名称:deltajug,代码行数:38,代码来源:OSGExp.cpp

示例5: longestPalindrome

string longestPalindrome(string s) {
  string T = preProcess(s);
  int n = T.length();
  int *P = new int[n];
  int C = 0, R = 0;
  for (int i = 1; i < n-1; i++) {
    int i_mirror = 2*C-i; // equals to i' = C - (i-C)
    
    P[i] = (R > i) ? min(R-i, P[i_mirror]) : 0;
    
    // Attempt to expand palindrome centered at i
    while (T[i + 1 + P[i]] == T[i - 1 - P[i]])
      P[i]++;
 
    // If palindrome centered at i expand past R,
    // adjust center based on expanded palindrome.
    if (i + P[i] > R) {
      C = i;
      R = i + P[i];
    }
  }
 
  // Find the maximum element in P.
  int maxLen = 0;
  int centerIndex = 0;
  for (int i = 1; i < n-1; i++) {
    if (P[i] > maxLen) {
      maxLen = P[i];
      centerIndex = i;
    }
  }
  delete[] P;
  
  return s.substr((centerIndex - 1 - maxLen)/2, maxLen);
}
开发者ID:ysc6688,项目名称:leetcode,代码行数:35,代码来源:5.cpp

示例6: Image

void ImageGLProcessor::process() {
    if (internalInvalid_) {
        internalInvalid_ = false;
        const DataFormatBase* format = inport_.getData()->getDataFormat();
        size2_t dimensions;
        if (outport_.isHandlingResizeEvents() || !inport_.isOutportDeterminingSize())
            dimensions  = outport_.getData()->getDimensions();
        else
            dimensions = inport_.getData()->getDimensions();
        if (!outport_.hasData() || format != outport_.getData()->getDataFormat()
            || dimensions != outport_.getData()->getDimensions()){
            Image *img = new Image(dimensions, format);
            img->copyMetaDataFrom(*inport_.getData());
            outport_.setData(img);
        }
    }

    TextureUnit imgUnit;    
    utilgl::bindColorTexture(inport_, imgUnit);

    utilgl::activateTargetAndCopySource(outport_, inport_, ImageType::ColorOnly);
    shader_.activate();

    utilgl::setShaderUniforms(shader_, outport_, "outportParameters_");
    shader_.setUniform("inport_", imgUnit.getUnitNumber());

    preProcess();

    utilgl::singleDrawImagePlaneRect();
    shader_.deactivate();
    utilgl::deactivateCurrentTarget();

    postProcess();
}
开发者ID:sunwj,项目名称:inviwo,代码行数:34,代码来源:imageglprocessor.cpp

示例7: longestPalindrome

    string longestPalindrome(string s) {
        string T = preProcess(s);
        const int n = T.length();
        vector<int> P(n);
        int C = 0, R = 0;
        for (int i = 1; i < n - 1; ++i) {
            int i_mirror = 2 * C - i; // equals to i' = C - (i-C)

            P[i] = (R > i) ? min(R - i, P[i_mirror]) : 0;

            // Attempt to expand palindrome centered at i
            while (T[i + 1 + P[i]] == T[i - 1 - P[i]]) {
                ++P[i];
            }

            // If palindrome centered at i expands the past R,
            // adjust center based on expanded palindrome.
            if (i + P[i] > R) {
                C = i;
                R = i + P[i];
            }
        }

        // Find the maximum element in P.
        int max_len = 0, center_index = 0;
        for (int i = 1; i < n - 1; ++i) {
            if (P[i] > max_len) {
                max_len = P[i];
                center_index = i;
            }
        }

        return s.substr((center_index - 1 - max_len) / 2, max_len);
    }
开发者ID:HowieWang,项目名称:leetCode,代码行数:34,代码来源:longest-palindromic-substring.cpp

示例8: getContext

void OutputDeviceNodeXAudio::submitNextBuffer()
{
	auto ctx = getContext();
	if( ! ctx )
		return;

	lock_guard<mutex> lock( ctx->getMutex() );

	// verify context still exists, since its destructor may have been holding the lock
	ctx = getContext();
	if( ! ctx )
		return;

	ctx->preProcess();

	auto internalBuffer = getInternalBuffer();
	internalBuffer->zero();
	pullInputs( internalBuffer );

	if( checkNotClipping() )
		internalBuffer->zero();

	if( getNumChannels() == 2 )
		dsp::interleaveStereoBuffer( internalBuffer, &mBufferInterleaved );

	HRESULT hr = mSourceVoice->SubmitSourceBuffer( &mXAudioBuffer );
	CI_ASSERT( hr == S_OK );

	ctx->postProcess();
}
开发者ID:SuguruSasaki,项目名称:Cinder-Emscripten,代码行数:30,代码来源:ContextXAudio.cpp

示例9: main

int main() {
	int t;
	unsigned long long f;
	generatePrime();
	scanf("%d", &t);
	while (t--) {
		scanf("%llu", &f);
		
		if(f<5)
			printf("%d",2);
		
		while(1) {
			if(f%2==0)
				f--;
			else
				f-=2;
		
			if(preProcess(f)) {
				printf("%llu\n", f);
				break;		
			}
			
		}
		
	}
	return 0;
} 
开发者ID:Arjav96,项目名称:My-Spoj-Solutions,代码行数:27,代码来源:PAGAIN.c

示例10: readInputs

/**
 * @name processAutomatic(EngineData *inp)
 * @param inp pointer to EngineData structure
 * processes the whole sequence from reading inputs to writing outputs
 */
void TruthTableEngine::processAutomatic(EngineData *inp) {
	readInputs(inp);		// read inputs
	preProcess(inp);		// pre process into testbyte
	process(inp);			// search for valid combination
	postProcess(inp);		// copy result to output array
	writeOutputs(inp);		// write digital pins based on active levels
}
开发者ID:nicoverduin,项目名称:TruthTableEngineClass,代码行数:12,代码来源:TruthTableEngineClass.cpp

示例11: preProcess

bool ProcessObject::start()
{
	
	if(m_pProcInfo.hProcess)
		return true;

	//Pre-Process
	preProcess();
	// start a process with given index
	STARTUPINFO startUpInfo = { sizeof(STARTUPINFO),NULL,_T(""),NULL,0,0,0,0,0,0,0,STARTF_USESHOWWINDOW,0,0,NULL,0,0,0};  
	if(m_isUserInterface)
		startUpInfo.wShowWindow = SW_SHOW;
	else
		startUpInfo.wShowWindow = SW_HIDE;
	startUpInfo.lpDesktop = NULL;

	// set the correct desktop for the process to be started
	if(m_isImpersonate==false)
	{

		// create the process
		if(CreateProcess(NULL, const_cast<TCHAR*>(m_commandLine.GetString()),NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS, NULL,NULL,&startUpInfo,&m_pProcInfo))
		{
			Sleep(m_delayStartTime);
			return true;
		}
		else
		{
			TCHAR pTemp[256];
			long nError = GetLastError();

			_stprintf(pTemp,_T("Failed to start program '%s', error code = %d"), m_commandLine.GetString(), nError); 
			LOG_WRITER_INSTANCE.WriteLog( pTemp);
			return false;
		}
	}
	else
	{
		HANDLE hToken = NULL;
		if(LogonUser(m_userName.GetString(),(m_domainName.GetLength()==0)?_T("."):m_domainName.GetString(),m_userPassword.GetString(),LOGON32_LOGON_SERVICE,LOGON32_PROVIDER_DEFAULT,&hToken))
		{
			if(CreateProcessAsUser(hToken,NULL,const_cast<TCHAR*>(m_commandLine.GetString()),NULL,NULL,TRUE,NORMAL_PRIORITY_CLASS,NULL,NULL,&startUpInfo,&m_pProcInfo))
			{
				Sleep(m_delayStartTime);
				return true;
			}
			long nError = GetLastError();
			TCHAR pTemp[256];
			_stprintf(pTemp,_T("Failed to start program '%s' as user '%s', error code = %d"), m_commandLine.GetString(), m_userName.GetString(), nError); 
			LOG_WRITER_INSTANCE.WriteLog( pTemp);
			return false;
		}
		long nError = GetLastError();
		TCHAR pTemp[256];
		_stprintf(pTemp,_T("Failed to logon as user '%s', error code = %d"), m_userName.GetString(), nError); 
		LOG_WRITER_INSTANCE.WriteLog( pTemp);
		return false;
	}

}
开发者ID:Respublica,项目名称:EpWinService,代码行数:60,代码来源:epProcessObject.cpp

示例12: process

        /** @brief called to process everything */
        virtual void process(void)
        {
            // If _dstImg was set, check that the _renderWindow is lying into dstBounds
            if (_dstImg) {
                const OfxRectI& dstBounds = _dstImg->getBounds();
                // is the renderWindow within dstBounds ?
                assert(dstBounds.x1 <= _renderWindow.x1 && _renderWindow.x2 <= dstBounds.x2 &&
                       dstBounds.y1 <= _renderWindow.y1 && _renderWindow.y2 <= dstBounds.y2);
                // exit gracefully in case of error
                if (!(dstBounds.x1 <= _renderWindow.x1 && _renderWindow.x2 <= dstBounds.x2 &&
                      dstBounds.y1 <= _renderWindow.y1 && _renderWindow.y2 <= dstBounds.y2) ||
                    (_renderWindow.x1 >= _renderWindow.x2) ||
                    (_renderWindow.y1 >= _renderWindow.y2)) {
                    return;
                }
            }

            // call the pre MP pass
            preProcess();

            // make sure there are at least 4096 pixels per CPU and at least 1 line par CPU
            unsigned int nCPUs = ((std::min)(_renderWindow.x2 - _renderWindow.x1, 4096) *
                                  (_renderWindow.y2 - _renderWindow.y1)) / 4096;
            // make sure the number of CPUs is valid (and use at least 1 CPU)
            nCPUs = std::max(1u, (std::min)(nCPUs, OFX::MultiThread::getNumCPUs()));

            // call the base multi threading code, should put a pre & post thread calls in too
            multiThread(nCPUs);

            // call the post MP pass
            postProcess();
        }
开发者ID:gobomus,项目名称:pluginOFX,代码行数:33,代码来源:basic.cpp

示例13: preProcess

/**
 * 顔を認識して、該当する人のIDを返す
 */
int EigenFace::recognize(IplImage* testFace)
{
  // 事前加工
  IplImage* resizedFaceImage = preProcess(testFace);
  
  float * projectedTestFace = 0;
  
  // project the test images onto the PCA subspace
  projectedTestFace = (float *)cvAlloc( nEigens*sizeof(float) );
  int iNearest, nearest;

  // project the test image onto the PCA subspace
  cvEigenDecomposite(
    resizedFaceImage,
    nEigens,
    eigenVectArr,
    0, 0,
    pAvgTrainImg,
    projectedTestFace);

  iNearest = findNearestNeighbor(projectedTestFace);
  nearest  = trainPersonNumMat->data.i[iNearest];
  
  cvReleaseImage(&resizedFaceImage);

  return nearest;
}
开发者ID:moscoper,项目名称:pf-android-robot,代码行数:30,代码来源:EigenFace.cpp

示例14: ProcessImg

int ProcessImg(int argc,char** argv) {


	char fn_in[MAX_FNAME_LEN] = {0};
	char fn_out[MAX_FNAME_LEN] = {0};
	int i = 0;
	IplImage * pImgIn, *pImgOut;
	if(argc ==3){
		strcpy(fn_in,argv[1]);
		strcpy(fn_out,argv[2]);
		//whichKernel = 7;
	}else if(argc ==4){
		strcpy(fn_in,argv[1]);
		strcpy(fn_out,argv[2]);
		whichKernel = atoi(argv[3]);
	}else{
		exit(0);
	}

	pImgIn = cvLoadImage( fn_in,-1);

	VIEDOW = pImgIn ->width;
	VIEDOH = pImgIn ->height;

	CvSize ImageSize = cvSize(VIEDOW,VIEDOH);
	pImgOut = cvCreateImage( ImageSize , IPL_DEPTH_8U, 3 ); 
	pImagePool[0] = cvCreateImage( ImageSize , IPL_DEPTH_8U, 3 ); 
	preProcess(0,pImgIn,0,pImgOut);

	cvSaveImage(fn_out,pImgOut);
	return 0;
}
开发者ID:maverick0122,项目名称:vas,代码行数:32,代码来源:KeyBoard.cpp

示例15: loadSrc

//wraps it all together
void FindGoal::finalize()
{
    loadSrc();
    cv::Mat blurred = preProcess(src);
    std::vector<cv::Vec4i> houghLines = edgeDetection(blurred, srcCopy);
    cv::Vec4i goalCors = shapeValidation(houghLines);
    graphics(goalCors, srcCopy);
}
开发者ID:redsphinx,项目名称:COD,代码行数:9,代码来源:FindGoal.cpp


注:本文中的preProcess函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。