12.7.3 Implementational Details about Stats

If you will be writing your own statistic process, this provides some information that might be useful.

The stat object provides a scaffolding for looping through the various objects in a network. Thus, if you want to do something at the unit level, you can simply write a Unit_Stat function, and the stat will automatically iterate over layers and units to call the unit stat function on every unit. This makes it relatively easy to write a new statistic.

See the header file `src/pdp/stats.h' for more information about how a stat object works. In particular, notice that there are recommended ways of speeding up otherwise generic functions that rely on type-scanned information.