next up previous
Next: Projections Up: Querying and updating populations Previous: Querying and updating populations

Querying/updating a population from an entity's event handler

An entity sends a query to a number of other entities, and wants to change its state depending on the results. This needs a mechanism to gather a number of responses to a query and to fire off a callback when all the results come in.


   // in an entity's handleEvents() method:
   Time t = // local time + min output delay
   Population p = // population to query.
   EntityQuery q = // query to run
   Callback c = // function to run when the results come in
   queryPopulation( t, p, q, c );

Fred Howell