Esempio n. 1
0
void FlowContext::SetOpts(OptArgs &opts, Json::Value& json_params)
{
	string fo = RetrieveParameterString(opts, json_params, '-', "flow-order", "");
	if(fo.length() > 0)
	{
		if ( flowOrder )
			free ( flowOrder );
		
		flowOrder = strdup ( fo.c_str() );
		numFlowsPerCycle = strlen ( flowOrder );
		flowOrderOverride = true;
	}

	int tmp_flowlimit = RetrieveParameterInt(opts, json_params, '-', "flowlimit", -1);
	if(tmp_flowlimit >= 0)
	{
		SetFlowLimit( tmp_flowlimit );
	}

	vector<int> vec;
	RetrieveParameterVectorInt(opts, json_params, '-', "start-flow-plus-interval", "0,0", vec);
	if(vec.size() == 2)
	{
		if( vec[1] > 0)
		{
			SetFlowRange(vec[0], vec[1]);
		}
	}
	else
	{
        fprintf ( stderr, "Option Error: start-flow-plus-interval format wrong, not size = 2\n" );
        exit ( EXIT_FAILURE );
	}
}
Esempio n. 2
0
void FlowContext::SetOpts(OptArgs &opts, Json::Value& json_params)
{
	string fo = RetrieveParameterString(opts, json_params, '-', "flow-order", "");
	if(fo.length() > 0)
	{
		if ( flowOrder )
			free ( flowOrder );
    // upgrade floworder to all-caps(!)
    // otherwise problems as the code does direct char compares
    for (unsigned int i=0; i<fo.size(); i++){
      fo.at(i) = toupper(fo.at(i));
    }
		
		flowOrder = strdup ( fo.c_str() );
		numFlowsPerCycle = strlen ( flowOrder );
		flowOrderOverride = true;
	}

	int tmp_flowlimit = RetrieveParameterInt(opts, json_params, '-', "flowlimit", -1);
	if(tmp_flowlimit >= 0)
	{
		SetFlowLimit( tmp_flowlimit );
	}

	vector<int> vec;
	RetrieveParameterVectorInt(opts, json_params, '-', "start-flow-plus-interval", "0,0", vec);
	if(vec.size() == 2)
	{
		if( vec[1] > 0)
		{
			SetFlowRange(vec[0], vec[1]);
		}
	}
	else
	{
        fprintf ( stderr, "Option Error: start-flow-plus-interval format wrong, not size = 2\n" );
        exit ( EXIT_FAILURE );
	}
}
Esempio n. 3
0
void SpatialContext::SetOpts(OptArgs &opts, Json::Value& json_params)
{
    chipType = GetParamsString(json_params, "chipType", "");
	vector<int> vec1;
	RetrieveParameterVectorInt(opts, json_params, '-', "region-size", "", vec1);
	if(vec1.size() > 0)
	{
		if(vec1.size() == 2)
		{
			regionXSize = vec1[0];
			regionYSize = vec1[1];
		}
		else
		{
			fprintf ( stderr, "Option Error: region-size format wrong, not size = 2\n" );
			exit ( EXIT_FAILURE );
		}
	}

	vector<int> vec2;
	RetrieveParameterVectorInt(opts, json_params, '-', "cropped", "", vec2);
	if(vec2.size() > 0)
	{
		if(vec2.size() == 4)
		{
			numCropRegions++;
			cropRegions = ( Region * ) realloc ( cropRegions, sizeof ( Region ) * numCropRegions );

			cropRegions[numCropRegions-1].col = vec2[0];
			cropRegions[numCropRegions-1].row = vec2[1];
			cropRegions[numCropRegions-1].w = vec2[2];
			cropRegions[numCropRegions-1].h = vec2[3];
            isCropped = true;
		}
		else
		{
			fprintf ( stderr, "Option Error: cropped format wrong, not size = 4\n" );
			exit ( EXIT_FAILURE );
		}
	}
		
	vector<int> vec3;
	RetrieveParameterVectorInt(opts, json_params, '-', "analysis-region", "", vec3);
	if(vec3.size() > 0)
	{
		if(vec3.size() == 4)
		{
			chipRegion.col = vec3[0];
			chipRegion.row = vec3[1];
			chipRegion.w = vec3[2];
			chipRegion.h = vec3[3];
		}
		else
		{
			fprintf ( stderr, "Option Error: analysis-region format wrong, not size = 4\n" );
			exit ( EXIT_FAILURE );
		}
	}

	vector<int> vec4;
	RetrieveParameterVectorInt(opts, json_params, '-', "cropped-region-origin", "", vec4);
	if(vec4.size() > 0)
	{
		if(vec4.size() == 2)
		{
			cropped_region_x_offset = vec4[0];
			cropped_region_y_offset = vec4[1];
		}
		else
		{
			fprintf ( stderr, "Option Error: cropped-region-origin format wrong, not size = 2\n" );
			exit ( EXIT_FAILURE );
		}
	}
}