Loop and Arrays

Can someOne explain to me what the code below does?

void Device::msLogBitsAll( int dsindex, int numData)
{
double Level[NUM_SITES];
int nextbit;
int start, stop;

int ActiveSite=0;
for( int i=0; i<Device::numMeasurements; i++)
{
ActiveSite=0;
FOR_EACH_SITE(site, NUM_SITES)
{
// Calculate averages per site
start = ActiveSite*numData + Device::whereSamples[i][0];
stop = ActiveSite*numData + Device::whereSamples[i][1];

Level[site] = 0;
for( int j= start; j<= stop; j++ )
Level[site] += Data[j];
Level[site] /= (stop - start +1);

ActiveSite++;
}

if(BlowSites == all)
FOR_EACH_SITE(site, NUM_SITES)
{
nextbit = (Level[site] > DigitalThreshhold[site]) ? 1 : 0;
msLogResult( site, dsindex + i, nextbit );
}
if(BlowSites == roomonly)
FOR_ROOM_SITES(site, NUM_SITES)
{
nextbit = (Level[site] > DigitalThreshhold[site]) ? 1 : 0;
msLogResult( site, dsindex + i, nextbit );
}
if(BlowSites == temponly)
FOR_TEMP_SITES(site, NUM_SITES)
{
nextbit = (Level[site] > DigitalThreshhold[site]) ? 1 : 0;
msLogResult( site, dsindex + i, nextbit );
}
}
}
Last edited on
Topic archived. No new replies allowed.