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 ); } }
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 ); } }