Beispiel #1
0
bool MPPS_SCP_EMULATOR_CLASS::processCommandDataset(DCM_COMMAND_CLASS *command_ptr, DCM_DATASET_CLASS *dataset_ptr)

//  DESCRIPTION     : Process the Storage command and dataset.
//  PRECONDITIONS   :
//  POSTCONDITIONS  :
//  EXCEPTIONS      :
//  NOTES           :
//<<===========================================================================
{
    bool result;

    // handle individual commands
    switch(command_ptr->getCommandId())
    {
    case DIMSE_CMD_NCREATE_RQ:
        if (dataset_ptr)
        {
            // process the CREATE command
            result = processCreate(dataset_ptr);
        }
        else
        {
            // missing dataset
            UINT16 status = DCM_STATUS_PROCESSING_FAILURE;
            result = sendResponse(DIMSE_CMD_NCREATE_RSP, status);
        }
        break;

    case DIMSE_CMD_NSET_RQ:
        if (dataset_ptr)
        {
            // process the SET command
            result = processSet(dataset_ptr);
        }
        else
        {
            // missing dataset
            UINT16 status = DCM_STATUS_PROCESSING_FAILURE;
            result = sendResponse(DIMSE_CMD_NSET_RSP, status);
        }
        break;

    default:
    {
        // unknown command
        UINT16 status = DCM_STATUS_UNRECOGNIZED_OPERATION;
        result = sendResponse(command_ptr->getCommandId(), status);
    }
    break;
    }

    // return result
    return result;
}
Beispiel #2
0
int SSIEngine::executeComponent(HttpSession *pSession,
                                SSIComponent *pComponent)
{
    AutoBuf *pBuf;
    int ret;

    LS_DBG_H(pSession->getLogSession(), "SSI Process component: %d",
             pComponent->getType());

    switch (pComponent->getType())
    {
    case SSIComponent::SSI_String:
        pBuf = pComponent->getContentBuf();
        pSession->appendDynBody(pBuf->begin(), pBuf->size());
        break;
    case SSIComponent::SSI_Config:
        updateSSIConfig(pSession, pComponent, pSession->getReq()->getSSIRuntime());
        break;
    case SSIComponent::SSI_Echo:
        processEcho(pSession, pComponent);
        break;
    case SSIComponent::SSI_Exec:
        ret = processExec(pSession, pComponent);
        return ret;
        break;
    case SSIComponent::SSI_FSize:
    case SSIComponent::SSI_Flastmod:
        processFileAttr(pSession, pComponent);
        break;
    case SSIComponent::SSI_Include:
        ret = processInclude(pSession, pComponent);
        return ret;
        break;
    case SSIComponent::SSI_Printenv:
        processPrintEnv(pSession);
        break;
    case SSIComponent::SSI_Set:
        processSet(pSession, pComponent);
        break;
    case SSIComponent::SSI_If:
    case SSIComponent::SSI_Elif:
        processIf(pSession, (SSI_If *)pComponent);
        break;
        //SSI_Else,
        //SSI_Elif,
        //SSI_Endif,

    }
    return 0;
}
Beispiel #3
0
int main(){
	int i, j;
	state_t *statep;
	//popolo le aree della ROM
	init_area(INT_NEWAREA, (memaddr) int_handler);
	init_area(TLB_NEWAREA, (memaddr) tlb_handler);
	init_area(PGMTRAP_NEWAREA, (memaddr) trap_handler);
	init_area(SYSBK_NEWAREA, (memaddr) sys_handler);
	//inizializzo le strutture di phase1
	initPcbs();
	initASL();
	//inizializzo le variabili di sistema
	process_count = 0;
	softblock_count = 0;
	//mappa dei process id liberi
	for( i = 0; i < MAXPROC ; i++ ) pid_map[i] = 0;
	//array di puntatori ai processi attivi
	for( i = 0; i < MAXPROC ; i++ ) activeProcesses[i] = NULL;
	//semafori dei device
	for(i = 0; i < MAX_DEVICES; i++) devSem[i] = 0;
    	//registri di stato da conservare dei device
	for(i = 0; i < MAX_DEVICES; i++) devStatus[i] = 0;
	//tempo di gestione degli interrupt
	for(i = 0; i < MAX_DEVICES; i++) interruptTime[i] = 0;

	if( !((first = allocPcb()) && (twiddle = allocPcb()))){
		PANIC();
	}

	processSet( twiddle, (memaddr) idle, PRIO_IDLE);	//il processo idle ha id 1
	
	processSet( first, (memaddr) test, PRIO_NORM );

	current_process = NULL;
	process_count++;
	scheduler();
}
Beispiel #4
0
void AbstractOptionStorage::finishSet()
{
    GMX_RELEASE_ASSERT(bInSet_, "startSet() not called");
    bInSet_ = false;
    // We mark the option as set even when there are errors to avoid additional
    // errors from required options not set.
    // TODO: There could be a separate flag for this purpose.
    setFlag(efOption_Set);
    if (!bSetValuesHadErrors_)
    {
        // TODO: Correct handling of the efOption_ClearOnNextSet requires
        // processSet() and/or convertValue() to check it internally.
        // OptionStorageTemplate takes care of it, but it's error-prone if
        // a custom option is implemented that doesn't use it.
        processSet();
    }
    bSetValuesHadErrors_ = false;
    clearFlag(efOption_ClearOnNextSet);
    clearSet();
}
bool PRINT_SCP_EMULATOR_CLASS::processCommandDataset(DCM_COMMAND_CLASS *command_ptr, DCM_DATASET_CLASS *dataset_ptr)

//  DESCRIPTION     : Process the Print command (and dataset).
//  PRECONDITIONS   :
//  POSTCONDITIONS  :
//  EXCEPTIONS      : 
//  NOTES           :
//<<===========================================================================
{
	bool result;

	// handle individual commands
	switch(command_ptr->getCommandId())
	{
	case DIMSE_CMD_NACTION_RQ:
		// process the ACTION command
		result = processAction(command_ptr->getEncodePresentationContextId());
		break;
	case DIMSE_CMD_NCREATE_RQ:
	    if ((sopClassUidM == FILM_SESSION_SOP_CLASS_UID) ||
		    (dataset_ptr))
		{
			// process the CREATE command
            // - Basic Film Session may not define a dataset - but that is OK
			result = processCreate(command_ptr->getEncodePresentationContextId(), dataset_ptr);
		}
		else
		{
			// missing dataset
			UINT16 status = DCM_STATUS_PROCESSING_FAILURE;
			result = sendResponse(DIMSE_CMD_NCREATE_RSP,
				command_ptr->getEncodePresentationContextId(),
				status);
		}
		break;
	case DIMSE_CMD_NDELETE_RQ:
		// process the DELETE command
		result = processDelete(command_ptr->getEncodePresentationContextId());
		break;
	case DIMSE_CMD_NEVENTREPORT_RSP:
		// nothing to do here
		result = true;
		break;
	case DIMSE_CMD_NGET_RQ:
		// process the GET command
		result = processGet(command_ptr);
		break;
	case DIMSE_CMD_NSET_RQ:
		if (dataset_ptr)
		{
			// process the SET dataset
			result = processSet(command_ptr->getEncodePresentationContextId(), dataset_ptr);
		}
		else
		{
			// missing dataset
			UINT16 status = DCM_STATUS_PROCESSING_FAILURE;
			result = sendResponse(DIMSE_CMD_NSET_RSP,
				command_ptr->getEncodePresentationContextId(), 
				status);
		}
		break;
	default:
		{
			// unknown command
			UINT16 status = DCM_STATUS_UNRECOGNIZED_OPERATION;
			result = sendResponse(command_ptr->getCommandId(),
				command_ptr->getEncodePresentationContextId(), 
				status);
		}
		break;
	}

	// return result
	return result;
}
int main(int argc, char **argv){ 
	t = clock();
	cout << "calculating..." << endl;

    Params *par = new Params();
    // par->put("input_type.char","diffs");
    par->put("input_type.char","fulls");
    par->put("header_size.int",30.0);
    par->put("footnote_size.int",30.0);  
    par->put("camera_type.char","reconyx");
    par->put("diff_thres.int",60.0);
    par->put("median_size.int",9.0);
    par->put("output_image.char","out.png");
    par->put("input_images.char","images.txt");
    par->put("output_file.char","output.txt");
    par->put("draw_images.int",1.0);
    par->put("match_images.int",0.0);
    // par->put("match_images.int",1.0);
    par->put("image_width.int",340);
    par->put("image_height.int",280);
    par->put("min_coverage.float",0.007);
    par->put("max_coverage.float",0.80);
    par->put("confidence_thres.float",0.24);
    par->put("conf_factor.float",10);

    for(int i=1;i<argc;i++){ 
        if(!strcmp(argv[i],"-p")){
            par->load(argv[i+1]);
        }else if(!strcmp(argv[i],"-i")){
            par->put("input_images.char",argv[i+1]);
        }else if(!strcmp(argv[i],"-o")){
            par->put("output_file.char",argv[i+1]);
        }
    }

    vector<char *> filenames;
    vector<BB> bbs;
    loadFileNames(par->getString("input_images.char"),filenames);
    if(filenames.size()<1){ return 1; }
    
    printRuntime(t, clock(), "Load file names");

    float conf_factor = par->getValue("conf_factor.float");
    ofstream textoutput(par->getString("output_file.char"));

    // cout << "TEST01" << endl;
    // cout << par->getString("input_type.char") << endl;
    // cout << filenames[10] << endl;

    if(!strcmp(par->getString("input_type.char"),"fulls")){
		//clock_t temp_t = t;
        for(uint i=0; i<filenames.size(); i+=3){
            int sel = processSet(par, filenames, i, bbs, clock());
			
			//temp_t = printRuntime(temp_t, clock(), "dataset");
			
            if(bbs.size()>0){
                textoutput <<  filenames[i] << " " << bbs[0].valid << " " << bbs[sel].sx << " " << bbs[sel].sy << " " <<  bbs[sel].ex-bbs[sel].sx << " " << bbs[sel].ey-bbs[sel].sy  << " " << bbs[sel].confidence   << " " << bbs[sel].coverage  <<  "\n";
                // textoutput <<  filenames[i] << " " << bbs.size() << " " << bbs[sel].ex << " " << bbs[sel].ey << " " << bbs[sel].w << " " << bbs[sel].h << " " << bbs[sel].x << " " << bbs[sel].y << "\n";
                
            }else{
                textoutput <<  filenames[i] << " " << 0 << " " << 0 << " " << 0 << " " <<  0 << " " << 0  << " " << 0   << " " << 0  << "\n";
            }
            //cout << i << " " << filenames[i] << " of " << filenames.size() <<" bbs.size " <<  bbs.size()<< endl;

            bbs.clear();
        }
    }else{
        // (input_type.char == "diffs") --> computeDifferences(images)
        int sel = processSet(par, filenames, -1, bbs, clock());
        //textoutput << 0 << endl;
        if(bbs.size()>0){
            if(bbs[0].valid){
                //currently outputting this to output file
                textoutput <<  filenames[1] << " " << 1 << " " << round(conf_factor*bbs[sel].confidence) << " " << bbs[sel].sx << " " << bbs[sel].sy << " " <<  bbs[sel].ex-bbs[sel].sx << " " << bbs[sel].ey-bbs[sel].sy <<endl;
            }
        }
    }

    textoutput.close();
    
    printRuntime(t, clock(), "All of main");
    cout << "TESTOUT" << endl;

    //par->save("params.par");
    delete par;
    return 0;
}