Counter

From CometPublic

Jump to: navigation, search

The comet statements

   LocalSolver m();
   Counter c(m,0);

Declare and initialize a counter c on the local solver m and set its initial value to 0. Comet counters implement the following API

   class Counter {
      void incr();
      int getValue();
      void reset();
      void exclud();
      void includ();
   }

Counters are build on top of incremental variables (which explain the need of a local solver for their declaration) and can therefore be used inside invariants and differentiable objects as any other variables. They also respond to the same events as any other var{int}.