本文整理汇总了C++中Dictionary::GetKey方法的典型用法代码示例。如果您正苦于以下问题:C++ Dictionary::GetKey方法的具体用法?C++ Dictionary::GetKey怎么用?C++ Dictionary::GetKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dictionary
的用法示例。
在下文中一共展示了Dictionary::GetKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SimulationRun
//.........这里部分代码省略.........
}
else{CurrentVehicle->AverageAnonymitySetSizeCounter++;}
}
for(int i=0;i<VehicleMax;i++)
{
Vehicle* CurrentVehicle=Vehicles[i];
if(SimulationTime==CurrentVehicle->v_end_t)
{
CurrentVehicle->v_end_x=CurrentVehicle->x;
CurrentVehicle->v_end_y=CurrentVehicle->y;
CurrentVehicle->v_terminated=SimulationTime;
//We set ending data AFTER the protocol text so the set isn't prematurely decremented.
if(CurrentVehicle->AssignedSet!=NULL){CurrentVehicle->AssignedSet->RemoveVehicle(CurrentVehicle);}
}
}
if(TraceFileEOF){break;}
SimulationTime=NextSimulationTime;
}
if((--VehicleNum)%VehicleNumMask==VehicleNumMaskOffset)
{
VehicleNum=VehicleNum/VehicleNumMask;
Vehicle* CurrentVehicle=Vehicles[VehicleNum];//We decrement VehicleNum because trace files base their lists with 1 as the first index.
CurrentVehicle->x=x;
CurrentVehicle->y=y;
}
}
if(RunValid)
{
PrimaryProtocol->SimulationEnd();
time_t SimulationRunTime=time(NULL)-SimulationBeginTime;
OutputVariables.Set("RunTime",to_string(((long double)SimulationRunTime)/60.0));
//This loop adds inputs as outputs, so the resulting printed line can also reference parameters used in the run.
for(int i=0;i<RunVariables.Count();i++){OutputVariables.Set(RunVariables.GetKey(i),RunVariables.Get(i));}
//This loop calculates various averages.
int AnonymousVehicleCount=0;
int AverageAnonymitySamples=0;
float AverageAnonymitySetSize=0.0;
float AverageAnonymityDistance=0.0;
float AverageAnonymityTime=0.0;
float PeakAnonymityTime=0.0;
for(int i=0;i<Vehicles.Count();i++)
{
Vehicle* CurrentVehicle=Vehicles[i];
if(CurrentVehicle->v_terminated==-1)
{
cerr<<"TERMINATE ERROR: Vehicle#"<<i<<" was supposed to terminate at "<<CurrentVehicle->v_end_t<<"/"<<SimulationTime<<endl;
CurrentVehicle->v_terminated=CurrentVehicle->v_end_t;
}
AverageAnonymitySamples+=(CurrentVehicle->v_terminated-CurrentVehicle->v_begin_t)+1;
AverageAnonymitySetSize+=CurrentVehicle->AverageAnonymitySetSizeCounter;
AverageAnonymityDistance+=CurrentVehicle->AverageAnonymityDistanceCounter;
if(CurrentVehicle->v_k_assign_t!=-1)
{
AnonymousVehicleCount++;
float AnonTime=CurrentVehicle->v_terminated-CurrentVehicle->v_k_silent_t;
AverageAnonymityTime+=AnonTime;
PeakAnonymityTime=max(PeakAnonymityTime,AnonTime);
}
}
if(AnonymousVehicleCount>0){AverageAnonymityTime/=AnonymousVehicleCount;}
if(AverageAnonymitySamples==0)
{
AverageAnonymitySetSize=0.0f;
AverageAnonymityDistance=0.0f;