1 2 /* Web Polygraph http://www.web-polygraph.org/ 3 * Copyright 2003-2011 The Measurement Factory 4 * Licensed under the Apache License, Version 2.0 */ 5 6 #ifndef POLYGRAPH__RUNTIME_GOAL_H 7 #define POLYGRAPH__RUNTIME_GOAL_H 8 9 #include "base/GoalRec.h" 10 11 class GoalSym; 12 class GoalSubj; 13 14 // run-time wrapper for GoalRec 15 class Goal: public GoalRec { 16 public: 17 static Counter MinXactForRatios; // min #xacts for ratios to make sense 18 19 public: 20 Goal(); 21 22 void configure(const GoalSym &cfg); 23 bool reached(const GoalSubj &subj) const; 24 bool reachedPositive(const GoalSubj &subj) const; 25 bool reachedNegative(const GoalSubj &subj) const; 26 27 void reportProgress(ostream &os, const GoalSubj &s) const; 28 }; 29 30 // base class for objects fed to Goal::reached() 31 class GoalSubj { 32 public: 33 virtual ~GoalSubj(); 34 35 virtual Time duration() const = 0; 36 virtual Counter xactCnt() const = 0; 37 virtual BigSize fillSz() const = 0; 38 virtual Counter fillCnt() const = 0; 39 virtual Counter xactErrCnt() const = 0; 40 41 double xactErrRatio() const; 42 }; 43 44 #endif 45